From ed0fff92a89ba7f8cd83a236bb059fa228beb5dd Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 14 Dec 2017 09:18:42 +0100 Subject: [PATCH 001/110] Refactoring the main entry codes --- .gitignore | 1 + src/winmain.cpp | 352 +++++++++++++++++++++++++++--------------------- src/xmlTools.h | 2 +- 3 files changed, 202 insertions(+), 153 deletions(-) diff --git a/.gitignore b/.gitignore index 36c54019..66c85b10 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ UpgradeLog*.htm *.tmp_proj .builds *.pidb +*.bak bin/ bin64/ curl/build diff --git a/src/winmain.cpp b/src/winmain.cpp index cc377279..7a4025a0 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -189,7 +189,7 @@ static void goToScreenCenter(HWND hwnd) // This is the getUpdateInfo call back function used by curl -static size_t getUpdateInfo(char *data, size_t size, size_t nmemb, std::string *updateInfo) +static size_t getUpdateInfoCallback(char *data, size_t size, size_t nmemb, std::string *updateInfo) { // What we will return size_t len = size * nmemb; @@ -353,6 +353,173 @@ static DWORD WINAPI launchProgressBar(void *) return 0; } +bool downloadBinary(string urlFrom, string destTo, pair proxyServerInfo, bool isSilentMode, pair stoppedMessage) +{ + FILE* pFile = fopen(destTo.c_str(), "wb"); + + // Download the install package from indicated location + char errorBuffer[CURL_ERROR_SIZE] = { 0 }; + CURLcode res = CURLE_FAILED_INIT; + CURL* curl = curl_easy_init(); + if (curl) + { + curl_easy_setopt(curl, CURLOPT_URL, urlFrom.c_str()); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); + + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getDownloadData); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, pFile); + + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, setProgress); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, hProgressBar); + + curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); + + if (!proxyServerInfo.first.empty() && proxyServerInfo.second != -1) + { + curl_easy_setopt(curl, CURLOPT_PROXY, proxyServerInfo.first.c_str()); + curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyServerInfo.second); + } + curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST | CURLSSLOPT_NO_REVOKE); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } + + if (res != CURLE_OK) + { + if (!isSilentMode && doAbort == false) + ::MessageBoxA(NULL, errorBuffer, "curl error", MB_OK); + if (doAbort) + { + ::MessageBoxA(NULL, stoppedMessage.first.c_str(), stoppedMessage.second.c_str(), MB_OK); + } + doAbort = false; + return false; + } + + fflush(pFile); + fclose(pFile); + + return true; +} + +bool getUpdateInfo(string &info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const string& customParam, const string& version) +{ + char errorBuffer[CURL_ERROR_SIZE] = { 0 }; + + // Check on the web the availibility of update + // Get the update package's location + CURL *curl; + CURLcode res = CURLE_FAILED_INIT; + + curl = curl_easy_init(); + if (curl) + { + std::string urlComplete = gupParams.getInfoLocation() + "?version="; + if (!version.empty()) + urlComplete += version; + else + urlComplete += gupParams.getCurrentVersion(); + + if (!customParam.empty()) + { + string customParamPost = "¶m="; + customParamPost += customParam; + urlComplete += customParamPost; + } + else if (!gupParams.getParam().empty()) + { + string customParamPost = "¶m="; + customParamPost += gupParams.getParam(); + urlComplete += customParamPost; + } + + curl_easy_setopt(curl, CURLOPT_URL, urlComplete.c_str()); + + + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); + + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getUpdateInfoCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &info2get); + + string ua = gupParams.getSoftwareName(); + + winGupUserAgent += VERSION_VALUE; + if (ua != "") + { + ua += "/"; + ua += version; + ua += " ("; + ua += winGupUserAgent; + ua += ")"; + + winGupUserAgent = ua; + } + + curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); + + if (proxyServer.hasProxySettings()) + { + curl_easy_setopt(curl, CURLOPT_PROXY, proxyServer.getProxyServer().c_str()); + curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyServer.getPort()); + } + + curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST | CURLSSLOPT_NO_REVOKE); + + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + } + + if (res != CURLE_OK) + { + if (!gupParams.isSilentMode()) + ::MessageBoxA(NULL, errorBuffer, "curl error", MB_OK); + return false; + } + return true; +} + +bool runInstaller(const string& app2runPath, const string& binWindowsClassName, const string& closeMsg, const string& closeMsgTitle) +{ + + if (!binWindowsClassName.empty()) + { + HWND h = ::FindWindowExA(NULL, NULL, binWindowsClassName.c_str(), NULL); + + if (h) + { + int installAnswer = ::MessageBoxA(NULL, closeMsg.c_str(), closeMsgTitle.c_str(), MB_YESNO); + + if (installAnswer == IDNO) + { + return 0; + } + } + + // kill all process of binary needs to be updated. + while (h) + { + ::SendMessage(h, WM_CLOSE, 0, 0); + h = ::FindWindowExA(NULL, NULL, binWindowsClassName.c_str(), NULL); + } + } + + // execute the installer + HINSTANCE result = ::ShellExecuteA(NULL, "open", app2runPath.c_str(), "", ".", SW_SHOW); + + if (result <= (HINSTANCE)32) // There's a problem (Don't ask me why, ask Microsoft) + { + return false; + } + + return true; +} + int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { bool isSilentMode = false; @@ -379,12 +546,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } + GupExtraOptions extraOptions("gupOptions.xml"); + GupNativeLang nativeLang("nativeLang.xml"); + GupParameters gupParams("gup.xml"); + hInst = hInstance; try { - GupParameters gupParams("gup.xml"); - GupExtraOptions extraOptions("gupOptions.xml"); - GupNativeLang nativeLang("nativeLang.xml"); - if (launchSettingsDlg) { if (extraOptions.hasProxySettings()) @@ -401,8 +568,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) msgBoxTitle = gupParams.getMessageBoxTitle(); abortOrNot = nativeLang.getMessageString("MSGID_ABORTORNOT"); + // + // Get update info + // std::string updateInfo; - char errorBuffer[CURL_ERROR_SIZE] = { 0 }; // Get your software's current version. // If you pass the version number as the argument @@ -416,77 +585,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) isSilentMode = gupParams.isSilentMode(); - // Check on the web the availibility of update - // Get the update package's location - CURL *curl; - CURLcode res = CURLE_FAILED_INIT; - - curl = curl_easy_init(); - if (curl) - { - std::string urlComplete = gupParams.getInfoLocation() + "?version="; - if (!version.empty()) - urlComplete += version; - else - urlComplete += gupParams.getCurrentVersion(); - - if (!customParam.empty()) - { - string customParamPost = "¶m="; - customParamPost += customParam; - urlComplete += customParamPost; - } - else if (!gupParams.getParam().empty()) - { - string customParamPost = "¶m="; - customParamPost += gupParams.getParam(); - urlComplete += customParamPost; - } - - curl_easy_setopt(curl, CURLOPT_URL, urlComplete.c_str()); - - - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); - - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getUpdateInfo); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &updateInfo); - - string ua = gupParams.getSoftwareName(); + bool getUpdateInfoSuccessful = getUpdateInfo(updateInfo, gupParams, extraOptions, customParam, version); - winGupUserAgent += VERSION_VALUE; - if (ua != "") - { - ua += "/"; - ua += version; - ua += " ("; - ua += winGupUserAgent; - ua += ")"; - - winGupUserAgent = ua; - } - - curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); - curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); - - if (extraOptions.hasProxySettings()) - { - curl_easy_setopt(curl, CURLOPT_PROXY, extraOptions.getProxyServer().c_str()); - curl_easy_setopt(curl, CURLOPT_PROXYPORT, extraOptions.getPort()); - } - - curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST | CURLSSLOPT_NO_REVOKE); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - } - - if (res != CURLE_OK) - { - if (!isSilentMode) - ::MessageBoxA(NULL, errorBuffer, "curl error", MB_OK); + if (!getUpdateInfoSuccessful) return -1; - } + GupDownloadInfo gupDlInfo(updateInfo.c_str()); @@ -502,6 +605,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } + + // + // Process Update Info + // + // Ask user if he/she want to do update string updateAvailable = nativeLang.getMessageString("MSGID_UPDATEAVAILABLE"); if (updateAvailable == "") @@ -510,7 +618,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) int thirdButtonCmd = gupParams.get3rdButtonCmd(); thirdDoUpdateDlgButtonLabel = gupParams.get3rdButtonLabel(); - //int buttonStyle = thirdButtonCmd?MB_YESNOCANCEL:MB_YESNO; int dlAnswer = 0; HWND hApp = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); bool isModal = gupParams.isMessageBoxModal(); @@ -537,7 +644,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } - + // + // Download executable bin + // ::CreateThread(NULL, 0, launchProgressBar, NULL, 0, NULL); std::string dlDest = std::getenv("TEMP"); @@ -550,89 +659,28 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) dlFileName = ::PathFindFileNameA(gupDlInfo.getDownloadLocation().c_str()); - pFile = fopen(dlDest.c_str(), "wb"); - // Download the install package from indicated location - curl = curl_easy_init(); - if(curl) - { - curl_easy_setopt(curl, CURLOPT_URL, gupDlInfo.getDownloadLocation().c_str()); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); - - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getDownloadData); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, pFile); - - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, setProgress); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, hProgressBar); - - curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); - curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); - - if (extraOptions.hasProxySettings()) - { - curl_easy_setopt(curl, CURLOPT_PROXY, extraOptions.getProxyServer().c_str()); - curl_easy_setopt(curl, CURLOPT_PROXYPORT, extraOptions.getPort()); - } - curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST | CURLSSLOPT_NO_REVOKE); + string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == "") + dlStopped = MSGID_DOWNLOADSTOPPED; - res = curl_easy_perform(curl); + bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); - curl_easy_cleanup(curl); - } - - if (res != CURLE_OK) - { - if (!isSilentMode && doAbort == false) - ::MessageBoxA(NULL, errorBuffer, "curl error", MB_OK); - if (doAbort) - { - string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); - if (dlStopped == "") - dlStopped = MSGID_DOWNLOADSTOPPED; - ::MessageBoxA(NULL, dlStopped.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); - } + if (!dlSuccessful) return -1; - } - - fflush(pFile); - fclose(pFile); - pFile = NULL; - if (gupParams.getClassName() != "") - { - HWND h = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); - if (h) - { - string msg = gupParams.getClassName(); - string closeApp = nativeLang.getMessageString("MSGID_CLOSEAPP"); - if (closeApp == "") - closeApp = MSGID_CLOSEAPP; - msg += closeApp; + // + // Run executable bin + // + string msg = gupParams.getClassName(); + string closeApp = nativeLang.getMessageString("MSGID_CLOSEAPP"); + if (closeApp == "") + closeApp = MSGID_CLOSEAPP; + msg += closeApp; - int installAnswer = ::MessageBoxA(NULL, msg.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_YESNO); - - if (installAnswer == IDNO) - { - return 0; - } - } - // kill all process of binary needs to be updated. - while (h) - { - ::SendMessage(h, WM_CLOSE, 0, 0); - h = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); - } - } + runInstaller(dlDest, gupParams.getClassName(), msg, gupParams.getMessageBoxTitle().c_str()); - // execute the installer - HINSTANCE result = ::ShellExecuteA(NULL, "open", dlDest.c_str(), "", ".", SW_SHOW); - - if (result <= (HINSTANCE)32) // There's a problem (Don't ask me why, ask Microsoft) - { - return -1; - } return 0; } catch (exception ex) { diff --git a/src/xmlTools.h b/src/xmlTools.h index 76d57542..dbbc2c61 100644 --- a/src/xmlTools.h +++ b/src/xmlTools.h @@ -72,7 +72,7 @@ class GupExtraOptions : public XMLTool { GupExtraOptions(const char * xmlFileName); const std::string & getProxyServer() const { return _proxyServer;}; long getPort() const { return _port;}; - bool hasProxySettings(){return ((_proxyServer != "") && (_port != -1));}; + bool hasProxySettings() const {return ((!_proxyServer.empty()) && (_port != -1));}; void writeProxyInfo(const char *fn, const char *proxySrv, long port); private: From cf5731a5b0aad117eca37916eba7e2fe9a04c3f7 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 14 Jan 2018 16:02:53 +0100 Subject: [PATCH 002/110] Add tinyxml filter in project file --- vcproj/GUP.vcxproj.filters | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 vcproj/GUP.vcxproj.filters diff --git a/vcproj/GUP.vcxproj.filters b/vcproj/GUP.vcxproj.filters new file mode 100644 index 00000000..16bbd786 --- /dev/null +++ b/vcproj/GUP.vcxproj.filters @@ -0,0 +1,40 @@ + + + + + + + + + + tinyxml + + + tinyxml + + + tinyxml + + + tinyxml + + + + + + + tinyxml + + + tinyxml + + + + + + + + {a37be0f3-2a3a-4108-a6c0-2e9d01318887} + + + \ No newline at end of file From 9ed66df7702997d280f3634eaa17db805b616375 Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 23 Jan 2018 09:51:46 +0100 Subject: [PATCH 003/110] Add decompression and deleting capacity Integrate ZipLib (https://bitbucket.org/wbenny/ziplib) into project Add -unzipTo & -clean to decompress and clean --- .gitignore | 1 + src/ZipLib/ZipArchive.cpp | 258 ++ src/ZipLib/ZipArchive.h | 162 ++ src/ZipLib/ZipArchiveEntry.cpp | 788 ++++++ src/ZipLib/ZipArchiveEntry.h | 391 +++ src/ZipLib/ZipFile.cpp | 235 ++ src/ZipLib/ZipFile.h | 141 + src/ZipLib/ZipLib.vcxproj | 233 ++ src/ZipLib/ZipLib.vcxproj.filters | 243 ++ src/ZipLib/compression/bzip2/bzip2_decoder.h | 212 ++ .../bzip2/bzip2_decoder_properties.h | 19 + src/ZipLib/compression/bzip2/bzip2_encoder.h | 167 ++ .../bzip2/bzip2_encoder_properties.h | 26 + .../compression/compression_interface.h | 81 + .../compression/deflate/deflate_decoder.h | 219 ++ .../deflate/deflate_decoder_properties.h | 19 + .../compression/deflate/deflate_encoder.h | 167 ++ .../deflate/deflate_encoder_properties.h | 23 + .../compression/lzma/detail/lzma_alloc.h | 16 + .../compression/lzma/detail/lzma_handle.h | 31 + .../compression/lzma/detail/lzma_header.h | 41 + .../compression/lzma/detail/lzma_in_stream.h | 105 + .../compression/lzma/detail/lzma_out_stream.h | 45 + src/ZipLib/compression/lzma/lzma_decoder.h | 191 ++ .../lzma/lzma_decoder_properties.h | 19 + src/ZipLib/compression/lzma/lzma_encoder.h | 117 + .../lzma/lzma_encoder_properties.h | 41 + src/ZipLib/compression/store/store_decoder.h | 123 + .../store/store_decoder_properties.h | 21 + src/ZipLib/compression/store/store_encoder.h | 125 + .../store/store_encoder_properties.h | 21 + .../detail/EndOfCentralDirectoryBlock.cpp | 60 + .../detail/EndOfCentralDirectoryBlock.h | 48 + .../detail/ZipCentralDirectoryFileHeader.cpp | 130 + .../detail/ZipCentralDirectoryFileHeader.h | 66 + src/ZipLib/detail/ZipGenericExtraField.cpp | 35 + src/ZipLib/detail/ZipGenericExtraField.h | 27 + src/ZipLib/detail/ZipLocalFileHeader.cpp | 145 ++ src/ZipLib/detail/ZipLocalFileHeader.h | 60 + src/ZipLib/extlibs/bzip2/blocksort.c | 1094 ++++++++ src/ZipLib/extlibs/bzip2/bzerror.c | 8 + src/ZipLib/extlibs/bzip2/bzip2.vcxproj | 170 ++ .../extlibs/bzip2/bzip2.vcxproj.filters | 51 + src/ZipLib/extlibs/bzip2/bzlib.c | 1572 ++++++++++++ src/ZipLib/extlibs/bzip2/bzlib.h | 282 ++ src/ZipLib/extlibs/bzip2/bzlib_private.h | 509 ++++ src/ZipLib/extlibs/bzip2/compress.c | 672 +++++ src/ZipLib/extlibs/bzip2/crctable.c | 104 + src/ZipLib/extlibs/bzip2/decompress.c | 646 +++++ src/ZipLib/extlibs/bzip2/huffman.c | 205 ++ src/ZipLib/extlibs/bzip2/randtable.c | 84 + src/ZipLib/extlibs/lzma/7z.h | 203 ++ src/ZipLib/extlibs/lzma/7zAlloc.c | 76 + src/ZipLib/extlibs/lzma/7zAlloc.h | 15 + src/ZipLib/extlibs/lzma/7zBuf.c | 36 + src/ZipLib/extlibs/lzma/7zBuf.h | 39 + src/ZipLib/extlibs/lzma/7zBuf2.c | 45 + src/ZipLib/extlibs/lzma/7zCrc.c | 83 + src/ZipLib/extlibs/lzma/7zCrc.h | 25 + src/ZipLib/extlibs/lzma/7zCrcOpt.c | 64 + src/ZipLib/extlibs/lzma/7zDec.c | 470 ++++ src/ZipLib/extlibs/lzma/7zFile.c | 284 ++ src/ZipLib/extlibs/lzma/7zFile.h | 83 + src/ZipLib/extlibs/lzma/7zIn.c | 1402 ++++++++++ src/ZipLib/extlibs/lzma/7zStream.c | 169 ++ src/ZipLib/extlibs/lzma/7zVersion.h | 8 + src/ZipLib/extlibs/lzma/Alloc.c | 127 + src/ZipLib/extlibs/lzma/Alloc.h | 38 + src/ZipLib/extlibs/lzma/Bcj2.c | 132 + src/ZipLib/extlibs/lzma/Bcj2.h | 38 + src/ZipLib/extlibs/lzma/Bra.c | 133 + src/ZipLib/extlibs/lzma/Bra.h | 68 + src/ZipLib/extlibs/lzma/Bra86.c | 85 + src/ZipLib/extlibs/lzma/BraIA64.c | 67 + src/ZipLib/extlibs/lzma/CpuArch.c | 168 ++ src/ZipLib/extlibs/lzma/CpuArch.h | 155 ++ src/ZipLib/extlibs/lzma/Delta.c | 62 + src/ZipLib/extlibs/lzma/Delta.h | 23 + src/ZipLib/extlibs/lzma/LzFind.c | 761 ++++++ src/ZipLib/extlibs/lzma/LzFind.h | 115 + src/ZipLib/extlibs/lzma/LzFindMt.c | 793 ++++++ src/ZipLib/extlibs/lzma/LzFindMt.h | 105 + src/ZipLib/extlibs/lzma/LzHash.h | 54 + src/ZipLib/extlibs/lzma/Lzma2Dec.c | 350 +++ src/ZipLib/extlibs/lzma/Lzma2Dec.h | 84 + src/ZipLib/extlibs/lzma/Lzma2Enc.c | 477 ++++ src/ZipLib/extlibs/lzma/Lzma2Enc.h | 66 + src/ZipLib/extlibs/lzma/Lzma86.h | 111 + src/ZipLib/extlibs/lzma/Lzma86Dec.c | 56 + src/ZipLib/extlibs/lzma/Lzma86Enc.c | 108 + src/ZipLib/extlibs/lzma/LzmaDec.c | 993 +++++++ src/ZipLib/extlibs/lzma/LzmaDec.h | 231 ++ src/ZipLib/extlibs/lzma/LzmaEnc.c | 2276 +++++++++++++++++ src/ZipLib/extlibs/lzma/LzmaEnc.h | 78 + src/ZipLib/extlibs/lzma/LzmaLib.c | 46 + src/ZipLib/extlibs/lzma/LzmaLib.h | 135 + src/ZipLib/extlibs/lzma/MtCoder.c | 327 +++ src/ZipLib/extlibs/lzma/MtCoder.h | 98 + src/ZipLib/extlibs/lzma/Ppmd.h | 86 + src/ZipLib/extlibs/lzma/Ppmd7.c | 708 +++++ src/ZipLib/extlibs/lzma/Ppmd7.h | 140 + src/ZipLib/extlibs/lzma/Ppmd7Dec.c | 187 ++ src/ZipLib/extlibs/lzma/Ppmd7Enc.c | 185 ++ src/ZipLib/extlibs/lzma/RotateDefs.h | 20 + src/ZipLib/extlibs/lzma/Sha256.c | 204 ++ src/ZipLib/extlibs/lzma/Sha256.h | 26 + src/ZipLib/extlibs/lzma/Threads.c | 84 + src/ZipLib/extlibs/lzma/Threads.h | 59 + src/ZipLib/extlibs/lzma/Types.h | 254 ++ src/ZipLib/extlibs/lzma/Xz.c | 88 + src/ZipLib/extlibs/lzma/Xz.h | 254 ++ src/ZipLib/extlibs/lzma/XzCrc64.c | 33 + src/ZipLib/extlibs/lzma/XzCrc64.h | 26 + src/ZipLib/extlibs/lzma/XzDec.c | 889 +++++++ src/ZipLib/extlibs/lzma/XzEnc.c | 520 ++++ src/ZipLib/extlibs/lzma/XzEnc.h | 39 + src/ZipLib/extlibs/lzma/XzIn.c | 305 +++ src/ZipLib/extlibs/lzma/lzma.vcxproj | 226 ++ src/ZipLib/extlibs/lzma/lzma.vcxproj.filters | 219 ++ src/ZipLib/extlibs/lzma/unix/7zBuf.h | 39 + src/ZipLib/extlibs/lzma/unix/7zBuf2.c | 45 + src/ZipLib/extlibs/lzma/unix/7zCrc.c | 76 + src/ZipLib/extlibs/lzma/unix/7zCrc.h | 25 + src/ZipLib/extlibs/lzma/unix/7zCrcOpt.c | 34 + src/ZipLib/extlibs/lzma/unix/7zStream.c | 169 ++ src/ZipLib/extlibs/lzma/unix/7zVersion.h | 7 + src/ZipLib/extlibs/lzma/unix/Aes.c | 284 ++ src/ZipLib/extlibs/lzma/unix/Aes.h | 38 + src/ZipLib/extlibs/lzma/unix/Alloc.back3 | 238 ++ src/ZipLib/extlibs/lzma/unix/Alloc.c | 280 ++ src/ZipLib/extlibs/lzma/unix/Alloc.c.back | 243 ++ src/ZipLib/extlibs/lzma/unix/Alloc.c.back2 | 222 ++ src/ZipLib/extlibs/lzma/unix/Alloc.h | 27 + src/ZipLib/extlibs/lzma/unix/Bra.c | 133 + src/ZipLib/extlibs/lzma/unix/Bra.h | 68 + src/ZipLib/extlibs/lzma/unix/Bra86.c | 85 + src/ZipLib/extlibs/lzma/unix/BraIA64.c | 67 + src/ZipLib/extlibs/lzma/unix/BwtSort.c | 516 ++++ src/ZipLib/extlibs/lzma/unix/BwtSort.h | 30 + src/ZipLib/extlibs/lzma/unix/CpuArch.c | 168 ++ src/ZipLib/extlibs/lzma/unix/CpuArch.h | 155 ++ src/ZipLib/extlibs/lzma/unix/Delta.c | 62 + src/ZipLib/extlibs/lzma/unix/Delta.h | 23 + src/ZipLib/extlibs/lzma/unix/HuffEnc.c | 146 ++ src/ZipLib/extlibs/lzma/unix/HuffEnc.h | 27 + src/ZipLib/extlibs/lzma/unix/LzFind.c | 761 ++++++ src/ZipLib/extlibs/lzma/unix/LzFind.h | 115 + src/ZipLib/extlibs/lzma/unix/LzFindMt.c | 793 ++++++ src/ZipLib/extlibs/lzma/unix/LzFindMt.h | 105 + src/ZipLib/extlibs/lzma/unix/LzHash.h | 54 + src/ZipLib/extlibs/lzma/unix/Lzma2Dec.c | 356 +++ src/ZipLib/extlibs/lzma/unix/Lzma2Dec.h | 84 + src/ZipLib/extlibs/lzma/unix/Lzma2Enc.c | 477 ++++ src/ZipLib/extlibs/lzma/unix/Lzma2Enc.h | 66 + src/ZipLib/extlibs/lzma/unix/LzmaDec.c | 999 ++++++++ src/ZipLib/extlibs/lzma/unix/LzmaDec.h | 231 ++ src/ZipLib/extlibs/lzma/unix/LzmaEnc.c | 2268 ++++++++++++++++ src/ZipLib/extlibs/lzma/unix/LzmaEnc.h | 80 + .../extlibs/lzma/unix/LzmaUtil/Lzma86Dec.c | 61 + .../extlibs/lzma/unix/LzmaUtil/Lzma86Dec.h | 51 + .../extlibs/lzma/unix/LzmaUtil/Lzma86Enc.c | 113 + .../extlibs/lzma/unix/LzmaUtil/Lzma86Enc.h | 78 + src/ZipLib/extlibs/lzma/unix/MtCoder.c | 327 +++ src/ZipLib/extlibs/lzma/unix/MtCoder.h | 98 + src/ZipLib/extlibs/lzma/unix/Ppmd.h | 85 + src/ZipLib/extlibs/lzma/unix/Ppmd7.c | 708 +++++ src/ZipLib/extlibs/lzma/unix/Ppmd7.h | 140 + src/ZipLib/extlibs/lzma/unix/Ppmd7Dec.c | 187 ++ src/ZipLib/extlibs/lzma/unix/Ppmd7Enc.c | 185 ++ src/ZipLib/extlibs/lzma/unix/Ppmd8.c | 1120 ++++++++ src/ZipLib/extlibs/lzma/unix/Ppmd8.h | 133 + src/ZipLib/extlibs/lzma/unix/Ppmd8Dec.c | 155 ++ src/ZipLib/extlibs/lzma/unix/Ppmd8Enc.c | 161 ++ src/ZipLib/extlibs/lzma/unix/RotateDefs.h | 20 + src/ZipLib/extlibs/lzma/unix/Sha256.c | 204 ++ src/ZipLib/extlibs/lzma/unix/Sha256.h | 26 + src/ZipLib/extlibs/lzma/unix/Sort.c | 93 + src/ZipLib/extlibs/lzma/unix/Sort.h | 20 + src/ZipLib/extlibs/lzma/unix/Threads.c | 582 +++++ src/ZipLib/extlibs/lzma/unix/Threads.h | 127 + src/ZipLib/extlibs/lzma/unix/Types.h | 254 ++ src/ZipLib/extlibs/lzma/unix/Xz.c | 88 + src/ZipLib/extlibs/lzma/unix/Xz.h | 252 ++ src/ZipLib/extlibs/lzma/unix/XzCrc64.c | 33 + src/ZipLib/extlibs/lzma/unix/XzCrc64.h | 26 + src/ZipLib/extlibs/lzma/unix/XzDec.c | 875 +++++++ src/ZipLib/extlibs/lzma/unix/XzEnc.c | 497 ++++ src/ZipLib/extlibs/lzma/unix/XzEnc.h | 25 + src/ZipLib/extlibs/lzma/unix/XzIn.c | 306 +++ src/ZipLib/extlibs/zlib/adler32.c | 179 ++ src/ZipLib/extlibs/zlib/compress.c | 80 + src/ZipLib/extlibs/zlib/crc32.c | 425 +++ src/ZipLib/extlibs/zlib/crc32.h | 441 ++++ src/ZipLib/extlibs/zlib/deflate.c | 1965 ++++++++++++++ src/ZipLib/extlibs/zlib/deflate.h | 346 +++ src/ZipLib/extlibs/zlib/gzguts.h | 193 ++ src/ZipLib/extlibs/zlib/infback.c | 640 +++++ src/ZipLib/extlibs/zlib/inffast.c | 340 +++ src/ZipLib/extlibs/zlib/inffast.h | 11 + src/ZipLib/extlibs/zlib/inffixed.h | 94 + src/ZipLib/extlibs/zlib/inflate.c | 1496 +++++++++++ src/ZipLib/extlibs/zlib/inflate.h | 122 + src/ZipLib/extlibs/zlib/inftrees.c | 306 +++ src/ZipLib/extlibs/zlib/inftrees.h | 62 + src/ZipLib/extlibs/zlib/trees.c | 1224 +++++++++ src/ZipLib/extlibs/zlib/trees.h | 128 + src/ZipLib/extlibs/zlib/uncompr.c | 59 + src/ZipLib/extlibs/zlib/zconf.h | 506 ++++ src/ZipLib/extlibs/zlib/zlib.h | 1744 +++++++++++++ src/ZipLib/extlibs/zlib/zlib.vcxproj | 182 ++ src/ZipLib/extlibs/zlib/zlib.vcxproj.filters | 87 + src/ZipLib/extlibs/zlib/zutil.c | 324 +++ src/ZipLib/extlibs/zlib/zutil.h | 252 ++ src/ZipLib/methods/Bzip2Method.h | 46 + src/ZipLib/methods/DeflateMethod.h | 46 + src/ZipLib/methods/ICompressionMethod.h | 103 + src/ZipLib/methods/LzmaMethod.h | 46 + src/ZipLib/methods/StoreMethod.h | 23 + src/ZipLib/methods/ZipMethodResolver.h | 30 + .../streams/compression_decoder_stream.h | 72 + .../streams/compression_encoder_stream.h | 72 + src/ZipLib/streams/crc32stream.h | 49 + src/ZipLib/streams/memstream.h | 109 + src/ZipLib/streams/nullstream.h | 28 + src/ZipLib/streams/serialization.h | 102 + .../compression_decoder_streambuf.h | 105 + .../compression_encoder_streambuf.h | 130 + .../streams/streambuffs/crc32_streambuf.h | 105 + .../streams/streambuffs/mem_streambuf.h | 201 ++ .../streams/streambuffs/null_streambuf.h | 32 + .../streams/streambuffs/sub_streambuf.h | 98 + .../streams/streambuffs/tee_streambuff.h | 63 + .../streambuffs/zip_crypto_streambuf.h | 285 +++ src/ZipLib/streams/substream.h | 59 + src/ZipLib/streams/teestream.h | 55 + src/ZipLib/streams/zip_cryptostream.h | 67 + src/ZipLib/utils/enum_utils.h | 15 + src/ZipLib/utils/stream_utils.h | 18 + src/ZipLib/utils/time_utils.h | 42 + src/winmain.cpp | 440 +++- vcproj/GUP.vcxproj | 16 +- 241 files changed, 56347 insertions(+), 105 deletions(-) create mode 100644 src/ZipLib/ZipArchive.cpp create mode 100644 src/ZipLib/ZipArchive.h create mode 100644 src/ZipLib/ZipArchiveEntry.cpp create mode 100644 src/ZipLib/ZipArchiveEntry.h create mode 100644 src/ZipLib/ZipFile.cpp create mode 100644 src/ZipLib/ZipFile.h create mode 100644 src/ZipLib/ZipLib.vcxproj create mode 100644 src/ZipLib/ZipLib.vcxproj.filters create mode 100644 src/ZipLib/compression/bzip2/bzip2_decoder.h create mode 100644 src/ZipLib/compression/bzip2/bzip2_decoder_properties.h create mode 100644 src/ZipLib/compression/bzip2/bzip2_encoder.h create mode 100644 src/ZipLib/compression/bzip2/bzip2_encoder_properties.h create mode 100644 src/ZipLib/compression/compression_interface.h create mode 100644 src/ZipLib/compression/deflate/deflate_decoder.h create mode 100644 src/ZipLib/compression/deflate/deflate_decoder_properties.h create mode 100644 src/ZipLib/compression/deflate/deflate_encoder.h create mode 100644 src/ZipLib/compression/deflate/deflate_encoder_properties.h create mode 100644 src/ZipLib/compression/lzma/detail/lzma_alloc.h create mode 100644 src/ZipLib/compression/lzma/detail/lzma_handle.h create mode 100644 src/ZipLib/compression/lzma/detail/lzma_header.h create mode 100644 src/ZipLib/compression/lzma/detail/lzma_in_stream.h create mode 100644 src/ZipLib/compression/lzma/detail/lzma_out_stream.h create mode 100644 src/ZipLib/compression/lzma/lzma_decoder.h create mode 100644 src/ZipLib/compression/lzma/lzma_decoder_properties.h create mode 100644 src/ZipLib/compression/lzma/lzma_encoder.h create mode 100644 src/ZipLib/compression/lzma/lzma_encoder_properties.h create mode 100644 src/ZipLib/compression/store/store_decoder.h create mode 100644 src/ZipLib/compression/store/store_decoder_properties.h create mode 100644 src/ZipLib/compression/store/store_encoder.h create mode 100644 src/ZipLib/compression/store/store_encoder_properties.h create mode 100644 src/ZipLib/detail/EndOfCentralDirectoryBlock.cpp create mode 100644 src/ZipLib/detail/EndOfCentralDirectoryBlock.h create mode 100644 src/ZipLib/detail/ZipCentralDirectoryFileHeader.cpp create mode 100644 src/ZipLib/detail/ZipCentralDirectoryFileHeader.h create mode 100644 src/ZipLib/detail/ZipGenericExtraField.cpp create mode 100644 src/ZipLib/detail/ZipGenericExtraField.h create mode 100644 src/ZipLib/detail/ZipLocalFileHeader.cpp create mode 100644 src/ZipLib/detail/ZipLocalFileHeader.h create mode 100644 src/ZipLib/extlibs/bzip2/blocksort.c create mode 100644 src/ZipLib/extlibs/bzip2/bzerror.c create mode 100644 src/ZipLib/extlibs/bzip2/bzip2.vcxproj create mode 100644 src/ZipLib/extlibs/bzip2/bzip2.vcxproj.filters create mode 100644 src/ZipLib/extlibs/bzip2/bzlib.c create mode 100644 src/ZipLib/extlibs/bzip2/bzlib.h create mode 100644 src/ZipLib/extlibs/bzip2/bzlib_private.h create mode 100644 src/ZipLib/extlibs/bzip2/compress.c create mode 100644 src/ZipLib/extlibs/bzip2/crctable.c create mode 100644 src/ZipLib/extlibs/bzip2/decompress.c create mode 100644 src/ZipLib/extlibs/bzip2/huffman.c create mode 100644 src/ZipLib/extlibs/bzip2/randtable.c create mode 100644 src/ZipLib/extlibs/lzma/7z.h create mode 100644 src/ZipLib/extlibs/lzma/7zAlloc.c create mode 100644 src/ZipLib/extlibs/lzma/7zAlloc.h create mode 100644 src/ZipLib/extlibs/lzma/7zBuf.c create mode 100644 src/ZipLib/extlibs/lzma/7zBuf.h create mode 100644 src/ZipLib/extlibs/lzma/7zBuf2.c create mode 100644 src/ZipLib/extlibs/lzma/7zCrc.c create mode 100644 src/ZipLib/extlibs/lzma/7zCrc.h create mode 100644 src/ZipLib/extlibs/lzma/7zCrcOpt.c create mode 100644 src/ZipLib/extlibs/lzma/7zDec.c create mode 100644 src/ZipLib/extlibs/lzma/7zFile.c create mode 100644 src/ZipLib/extlibs/lzma/7zFile.h create mode 100644 src/ZipLib/extlibs/lzma/7zIn.c create mode 100644 src/ZipLib/extlibs/lzma/7zStream.c create mode 100644 src/ZipLib/extlibs/lzma/7zVersion.h create mode 100644 src/ZipLib/extlibs/lzma/Alloc.c create mode 100644 src/ZipLib/extlibs/lzma/Alloc.h create mode 100644 src/ZipLib/extlibs/lzma/Bcj2.c create mode 100644 src/ZipLib/extlibs/lzma/Bcj2.h create mode 100644 src/ZipLib/extlibs/lzma/Bra.c create mode 100644 src/ZipLib/extlibs/lzma/Bra.h create mode 100644 src/ZipLib/extlibs/lzma/Bra86.c create mode 100644 src/ZipLib/extlibs/lzma/BraIA64.c create mode 100644 src/ZipLib/extlibs/lzma/CpuArch.c create mode 100644 src/ZipLib/extlibs/lzma/CpuArch.h create mode 100644 src/ZipLib/extlibs/lzma/Delta.c create mode 100644 src/ZipLib/extlibs/lzma/Delta.h create mode 100644 src/ZipLib/extlibs/lzma/LzFind.c create mode 100644 src/ZipLib/extlibs/lzma/LzFind.h create mode 100644 src/ZipLib/extlibs/lzma/LzFindMt.c create mode 100644 src/ZipLib/extlibs/lzma/LzFindMt.h create mode 100644 src/ZipLib/extlibs/lzma/LzHash.h create mode 100644 src/ZipLib/extlibs/lzma/Lzma2Dec.c create mode 100644 src/ZipLib/extlibs/lzma/Lzma2Dec.h create mode 100644 src/ZipLib/extlibs/lzma/Lzma2Enc.c create mode 100644 src/ZipLib/extlibs/lzma/Lzma2Enc.h create mode 100644 src/ZipLib/extlibs/lzma/Lzma86.h create mode 100644 src/ZipLib/extlibs/lzma/Lzma86Dec.c create mode 100644 src/ZipLib/extlibs/lzma/Lzma86Enc.c create mode 100644 src/ZipLib/extlibs/lzma/LzmaDec.c create mode 100644 src/ZipLib/extlibs/lzma/LzmaDec.h create mode 100644 src/ZipLib/extlibs/lzma/LzmaEnc.c create mode 100644 src/ZipLib/extlibs/lzma/LzmaEnc.h create mode 100644 src/ZipLib/extlibs/lzma/LzmaLib.c create mode 100644 src/ZipLib/extlibs/lzma/LzmaLib.h create mode 100644 src/ZipLib/extlibs/lzma/MtCoder.c create mode 100644 src/ZipLib/extlibs/lzma/MtCoder.h create mode 100644 src/ZipLib/extlibs/lzma/Ppmd.h create mode 100644 src/ZipLib/extlibs/lzma/Ppmd7.c create mode 100644 src/ZipLib/extlibs/lzma/Ppmd7.h create mode 100644 src/ZipLib/extlibs/lzma/Ppmd7Dec.c create mode 100644 src/ZipLib/extlibs/lzma/Ppmd7Enc.c create mode 100644 src/ZipLib/extlibs/lzma/RotateDefs.h create mode 100644 src/ZipLib/extlibs/lzma/Sha256.c create mode 100644 src/ZipLib/extlibs/lzma/Sha256.h create mode 100644 src/ZipLib/extlibs/lzma/Threads.c create mode 100644 src/ZipLib/extlibs/lzma/Threads.h create mode 100644 src/ZipLib/extlibs/lzma/Types.h create mode 100644 src/ZipLib/extlibs/lzma/Xz.c create mode 100644 src/ZipLib/extlibs/lzma/Xz.h create mode 100644 src/ZipLib/extlibs/lzma/XzCrc64.c create mode 100644 src/ZipLib/extlibs/lzma/XzCrc64.h create mode 100644 src/ZipLib/extlibs/lzma/XzDec.c create mode 100644 src/ZipLib/extlibs/lzma/XzEnc.c create mode 100644 src/ZipLib/extlibs/lzma/XzEnc.h create mode 100644 src/ZipLib/extlibs/lzma/XzIn.c create mode 100644 src/ZipLib/extlibs/lzma/lzma.vcxproj create mode 100644 src/ZipLib/extlibs/lzma/lzma.vcxproj.filters create mode 100644 src/ZipLib/extlibs/lzma/unix/7zBuf.h create mode 100644 src/ZipLib/extlibs/lzma/unix/7zBuf2.c create mode 100644 src/ZipLib/extlibs/lzma/unix/7zCrc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/7zCrc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/7zCrcOpt.c create mode 100644 src/ZipLib/extlibs/lzma/unix/7zStream.c create mode 100644 src/ZipLib/extlibs/lzma/unix/7zVersion.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Aes.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Aes.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Alloc.back3 create mode 100644 src/ZipLib/extlibs/lzma/unix/Alloc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Alloc.c.back create mode 100644 src/ZipLib/extlibs/lzma/unix/Alloc.c.back2 create mode 100644 src/ZipLib/extlibs/lzma/unix/Alloc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Bra.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Bra.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Bra86.c create mode 100644 src/ZipLib/extlibs/lzma/unix/BraIA64.c create mode 100644 src/ZipLib/extlibs/lzma/unix/BwtSort.c create mode 100644 src/ZipLib/extlibs/lzma/unix/BwtSort.h create mode 100644 src/ZipLib/extlibs/lzma/unix/CpuArch.c create mode 100644 src/ZipLib/extlibs/lzma/unix/CpuArch.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Delta.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Delta.h create mode 100644 src/ZipLib/extlibs/lzma/unix/HuffEnc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/HuffEnc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzFind.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzFind.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzFindMt.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzFindMt.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzHash.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Lzma2Dec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Lzma2Dec.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Lzma2Enc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Lzma2Enc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaDec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaDec.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaEnc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaEnc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.h create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/MtCoder.c create mode 100644 src/ZipLib/extlibs/lzma/unix/MtCoder.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd7.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd7.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd7Dec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd7Enc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd8.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd8.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd8Dec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Ppmd8Enc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/RotateDefs.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Sha256.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Sha256.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Sort.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Sort.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Threads.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Threads.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Types.h create mode 100644 src/ZipLib/extlibs/lzma/unix/Xz.c create mode 100644 src/ZipLib/extlibs/lzma/unix/Xz.h create mode 100644 src/ZipLib/extlibs/lzma/unix/XzCrc64.c create mode 100644 src/ZipLib/extlibs/lzma/unix/XzCrc64.h create mode 100644 src/ZipLib/extlibs/lzma/unix/XzDec.c create mode 100644 src/ZipLib/extlibs/lzma/unix/XzEnc.c create mode 100644 src/ZipLib/extlibs/lzma/unix/XzEnc.h create mode 100644 src/ZipLib/extlibs/lzma/unix/XzIn.c create mode 100644 src/ZipLib/extlibs/zlib/adler32.c create mode 100644 src/ZipLib/extlibs/zlib/compress.c create mode 100644 src/ZipLib/extlibs/zlib/crc32.c create mode 100644 src/ZipLib/extlibs/zlib/crc32.h create mode 100644 src/ZipLib/extlibs/zlib/deflate.c create mode 100644 src/ZipLib/extlibs/zlib/deflate.h create mode 100644 src/ZipLib/extlibs/zlib/gzguts.h create mode 100644 src/ZipLib/extlibs/zlib/infback.c create mode 100644 src/ZipLib/extlibs/zlib/inffast.c create mode 100644 src/ZipLib/extlibs/zlib/inffast.h create mode 100644 src/ZipLib/extlibs/zlib/inffixed.h create mode 100644 src/ZipLib/extlibs/zlib/inflate.c create mode 100644 src/ZipLib/extlibs/zlib/inflate.h create mode 100644 src/ZipLib/extlibs/zlib/inftrees.c create mode 100644 src/ZipLib/extlibs/zlib/inftrees.h create mode 100644 src/ZipLib/extlibs/zlib/trees.c create mode 100644 src/ZipLib/extlibs/zlib/trees.h create mode 100644 src/ZipLib/extlibs/zlib/uncompr.c create mode 100644 src/ZipLib/extlibs/zlib/zconf.h create mode 100644 src/ZipLib/extlibs/zlib/zlib.h create mode 100644 src/ZipLib/extlibs/zlib/zlib.vcxproj create mode 100644 src/ZipLib/extlibs/zlib/zlib.vcxproj.filters create mode 100644 src/ZipLib/extlibs/zlib/zutil.c create mode 100644 src/ZipLib/extlibs/zlib/zutil.h create mode 100644 src/ZipLib/methods/Bzip2Method.h create mode 100644 src/ZipLib/methods/DeflateMethod.h create mode 100644 src/ZipLib/methods/ICompressionMethod.h create mode 100644 src/ZipLib/methods/LzmaMethod.h create mode 100644 src/ZipLib/methods/StoreMethod.h create mode 100644 src/ZipLib/methods/ZipMethodResolver.h create mode 100644 src/ZipLib/streams/compression_decoder_stream.h create mode 100644 src/ZipLib/streams/compression_encoder_stream.h create mode 100644 src/ZipLib/streams/crc32stream.h create mode 100644 src/ZipLib/streams/memstream.h create mode 100644 src/ZipLib/streams/nullstream.h create mode 100644 src/ZipLib/streams/serialization.h create mode 100644 src/ZipLib/streams/streambuffs/compression_decoder_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/compression_encoder_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/crc32_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/mem_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/null_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/sub_streambuf.h create mode 100644 src/ZipLib/streams/streambuffs/tee_streambuff.h create mode 100644 src/ZipLib/streams/streambuffs/zip_crypto_streambuf.h create mode 100644 src/ZipLib/streams/substream.h create mode 100644 src/ZipLib/streams/teestream.h create mode 100644 src/ZipLib/streams/zip_cryptostream.h create mode 100644 src/ZipLib/utils/enum_utils.h create mode 100644 src/ZipLib/utils/stream_utils.h create mode 100644 src/ZipLib/utils/time_utils.h diff --git a/.gitignore b/.gitignore index 66c85b10..b26c59b7 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ ipch/ *.opensdf *.sdf *.cachefile +*.opendb #-- Backup & report files from converting an old project file to a newer # Visual Studio version. Backup files are not needed, because we have git ;-) diff --git a/src/ZipLib/ZipArchive.cpp b/src/ZipLib/ZipArchive.cpp new file mode 100644 index 00000000..be9e8a99 --- /dev/null +++ b/src/ZipLib/ZipArchive.cpp @@ -0,0 +1,258 @@ +#include "ZipArchive.h" +#include "streams/serialization.h" +#include +#include + +#define CALL_CONST_METHOD(expression) \ + const_cast< std::remove_pointer::type>::type*>( \ + const_cast::type>::type*>(this)->expression) + +////////////////////////////////////////////////////////////////////////// +// zip archive + +ZipArchive::Ptr ZipArchive::Create() +{ + return ZipArchive::Ptr(new ZipArchive()); +} + +ZipArchive::Ptr ZipArchive::Create(ZipArchive::Ptr&& other) +{ + ZipArchive::Ptr result(new ZipArchive()); + + result->_endOfCentralDirectoryBlock = other->_endOfCentralDirectoryBlock; + result->_entries = std::move(other->_entries); + result->_zipStream = other->_zipStream; + result->_owningStream = other->_owningStream; + + // clean "other" + other->_zipStream = nullptr; + other->_owningStream = false; + + return result; +} + +ZipArchive::Ptr ZipArchive::Create(std::istream& stream) +{ + ZipArchive::Ptr result(new ZipArchive()); + + result->_zipStream = &stream; + result->_owningStream = false; + + result->ReadEndOfCentralDirectory(); + result->EnsureCentralDirectoryRead(); + + return result; +} + +ZipArchive::Ptr ZipArchive::Create(std::istream* stream, bool takeOwnership) +{ + ZipArchive::Ptr result(new ZipArchive()); + + result->_zipStream = stream; + result->_owningStream = stream != nullptr ? takeOwnership : false; + + // jesus blew up a school bus when this metod has been implemented + if (stream != nullptr) + { + result->ReadEndOfCentralDirectory(); + result->EnsureCentralDirectoryRead(); + } + + return result; +} + +ZipArchive::ZipArchive() + : _zipStream(nullptr) + , _owningStream(false) +{ + +} + +ZipArchive::~ZipArchive() +{ + this->InternalDestroy(); +} + +ZipArchive& ZipArchive::operator = (ZipArchive&& other) +{ + _endOfCentralDirectoryBlock = other._endOfCentralDirectoryBlock; + _entries = std::move(other._entries); + _zipStream = other._zipStream; + _owningStream = other._owningStream; + + // clean "other" + other._zipStream = nullptr; + other._owningStream = false; + + return *this; +} + +ZipArchiveEntry::Ptr ZipArchive::CreateEntry(const std::string& fileName) +{ + ZipArchiveEntry::Ptr result = nullptr; + + if (this->GetEntry(fileName) == nullptr) + { + if ((result = ZipArchiveEntry::CreateNew(this, fileName)) != nullptr) + { + _entries.push_back(result); + } + } + + return result; +} + +const std::string& ZipArchive::GetComment() const +{ + return _endOfCentralDirectoryBlock.Comment; +} + +void ZipArchive::SetComment(const std::string& comment) +{ + _endOfCentralDirectoryBlock.Comment = comment; +} + +ZipArchiveEntry::Ptr ZipArchive::GetEntry(int index) +{ + return _entries[index]; +} + +ZipArchiveEntry::Ptr ZipArchive::GetEntry(const std::string& entryName) +{ + auto it = std::find_if(_entries.begin(), _entries.end(), [&entryName](ZipArchiveEntry::Ptr& value) { return value->GetFullName() == entryName; }); + + if (it != _entries.end()) + { + return *it; + } + + return nullptr; +} + +size_t ZipArchive::GetEntriesCount() const +{ + return _entries.size(); +} + +void ZipArchive::RemoveEntry(const std::string& entryName) +{ + auto it = std::find_if(_entries.begin(), _entries.end(), [&entryName](ZipArchiveEntry::Ptr& value) { return value->GetFullName() == entryName; }); + + if (it != _entries.end()) + { + _entries.erase(it); + } +} + +void ZipArchive::RemoveEntry(int index) +{ + _entries.erase(_entries.begin() + index); +} + +bool ZipArchive::EnsureCentralDirectoryRead() +{ + detail::ZipCentralDirectoryFileHeader zipCentralDirectoryFileHeader; + + _zipStream->seekg(_endOfCentralDirectoryBlock.OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber, std::ios::beg); + + while (zipCentralDirectoryFileHeader.Deserialize(*_zipStream)) + { + ZipArchiveEntry::Ptr newEntry; + + if ((newEntry = ZipArchiveEntry::CreateExisting(this, zipCentralDirectoryFileHeader)) != nullptr) + { + _entries.push_back(newEntry); + } + + // ensure clearing of the CDFH struct + zipCentralDirectoryFileHeader = detail::ZipCentralDirectoryFileHeader(); + } + + return true; +} + +bool ZipArchive::ReadEndOfCentralDirectory() +{ + const int EOCDB_SIZE = 22; // sizeof(EndOfCentralDirectoryBlockBase); + const int SIGNATURE_SIZE = 4; // sizeof(std::declval().Signature); + const int MIN_SHIFT = (EOCDB_SIZE - SIGNATURE_SIZE); + + _zipStream->seekg(-MIN_SHIFT, std::ios::end); + + if (this->SeekToSignature(detail::EndOfCentralDirectoryBlock::SignatureConstant, SeekDirection::Backward)) + { + _endOfCentralDirectoryBlock.Deserialize(*_zipStream); + return true; + } + + return false; +} + +bool ZipArchive::SeekToSignature(uint32_t signature, SeekDirection direction) +{ + std::streampos streamPosition = _zipStream->tellg(); + uint32_t buffer = 0; + int appendix = static_cast(direction == SeekDirection::Backward ? 0 - 1 : 1); + + while (!_zipStream->eof() && !_zipStream->fail()) + { + deserialize(*_zipStream, buffer); + + if (buffer == signature) + { + _zipStream->seekg(streamPosition, std::ios::beg); + return true; + } + + streamPosition += appendix; + _zipStream->seekg(streamPosition, std::ios::beg); + } + + return false; +} + +void ZipArchive::WriteToStream(std::ostream& stream) +{ + auto startPosition = stream.tellp(); + + for (auto& entry : _entries) + { + entry->SerializeLocalFileHeader(stream); + } + + auto offsetOfStartOfCDFH = stream.tellp() - startPosition; + for (auto& entry : _entries) + { + entry->SerializeCentralDirectoryFileHeader(stream); + } + + _endOfCentralDirectoryBlock.NumberOfThisDisk = 0; + _endOfCentralDirectoryBlock.NumberOfTheDiskWithTheStartOfTheCentralDirectory = 0; + + _endOfCentralDirectoryBlock.NumberOfEntriesInTheCentralDirectory = static_cast(_entries.size()); + _endOfCentralDirectoryBlock.NumberOfEntriesInTheCentralDirectoryOnThisDisk = static_cast(_entries.size()); + + _endOfCentralDirectoryBlock.SizeOfCentralDirectory = static_cast(stream.tellp() - offsetOfStartOfCDFH); + _endOfCentralDirectoryBlock.OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber = static_cast(offsetOfStartOfCDFH); + _endOfCentralDirectoryBlock.Serialize(stream); +} + +void ZipArchive::Swap(ZipArchive::Ptr other) +{ + //if (this == other) return; + if (other == nullptr) return; + + std::swap(_endOfCentralDirectoryBlock, other->_endOfCentralDirectoryBlock); + std::swap(_entries, other->_entries); + std::swap(_zipStream, other->_zipStream); + std::swap(_owningStream, other->_owningStream); +} + +void ZipArchive::InternalDestroy() +{ + if (_owningStream && _zipStream != nullptr) + { + delete _zipStream; + _zipStream = nullptr; + } +} diff --git a/src/ZipLib/ZipArchive.h b/src/ZipLib/ZipArchive.h new file mode 100644 index 00000000..9159259e --- /dev/null +++ b/src/ZipLib/ZipArchive.h @@ -0,0 +1,162 @@ +#pragma once +#include "detail/EndOfCentralDirectoryBlock.h" + +#include "ZipArchiveEntry.h" + +#include +#include +#include +#include +#include + +/** + * \brief Represents a package of compressed files in the zip archive format. + */ +class ZipArchive +{ + friend class ZipFile; + friend class ZipArchiveEntry; + + public: + typedef std::shared_ptr Ptr; + + /** + * \brief Default constructor. + */ + static ZipArchive::Ptr Create(); + + /** + * \brief Move constructor. + * + * \param other The ZipArchive instance to move. + */ + static ZipArchive::Ptr Create(ZipArchive::Ptr&& other); + + /** + * \brief Constructor. + * + * \param stream The input stream of the zip archive content. Must be seekable. + */ + static ZipArchive::Ptr Create(std::istream& stream); + + /** + * \brief Constructor. It optionally allows to simultaneously destroy and dealloc the input stream + * with the ZipArchive. + * + * \param stream The input stream of the zip archive content. Must be seekable. + * \param takeOwnership If true, it calls "delete stream" in the ZipArchive destructor. + */ + static ZipArchive::Ptr Create(std::istream* stream, bool takeOwnership); + + /** + * \brief Destructor. + */ + ~ZipArchive(); + + /** + * \brief Move assignment operator. + * + * \param other The ZipArchive instance to move. + * + * \return A shallow copy of this object. + */ + ZipArchive& operator = (ZipArchive&& other); + + /** + * \brief Creates an zip entry with given file name. + * + * \param fileName Filename of the file. + * + * \return nullptr if it fails, else the new entry. + */ + ZipArchiveEntry::Ptr CreateEntry(const std::string& fileName); + + /** + * \brief Gets the comment of the zip archive. + * + * \return The comment. + */ + const std::string& GetComment() const; + + /** + * \brief Sets a comment of the zip archive. + * + * \param comment The comment. + */ + void SetComment(const std::string& comment); + + /** + * \brief Gets a pointer to the zip entry located on the given index. + * + * \param index Zero-based index of the. + * + * \return null if it fails, else the entry. + */ + ZipArchiveEntry::Ptr GetEntry(int index); + + /** + * \brief Gets a const pointer to the zip entry with given file name. + * + * \param entryName Name of the entry. + * + * \return null if it fails, else the entry. + */ + ZipArchiveEntry::Ptr GetEntry(const std::string& entryName); + + /** + * \brief Gets the number of the zip entries in this archive. + * + * \return The number of the zip entries in this archive. + */ + size_t GetEntriesCount() const; + + /** + * \brief Removes the entry by the file name. + * + * \param entryName Name of the entry. + */ + void RemoveEntry(const std::string& entryName); + + /** + * \brief Removes the entry by the index. + * + * \param index Zero-based index of the. + */ + void RemoveEntry(int index); + + /** + * \brief Writes the zip archive content to the stream. It must be seekable. + * + * \param stream The stream to write in. + */ + void WriteToStream(std::ostream& stream); + + /** + * \brief Swaps this instance of ZipArchive with another instance. + * + * \param other The instance to swap with. + */ + void Swap(ZipArchive::Ptr other); + + private: + ZipArchive(); + ZipArchive(const ZipArchive&); + ZipArchive& operator = (const ZipArchive& other); + + enum class SeekDirection + { + Forward, + Backward + }; + + bool EnsureCentralDirectoryRead(); + bool ReadEndOfCentralDirectory(); + bool SeekToSignature(uint32_t signature, SeekDirection direction); + + void InternalDestroy(); + + detail::EndOfCentralDirectoryBlock _endOfCentralDirectoryBlock; + std::vector _entries; + std::istream* _zipStream; + bool _owningStream; +}; diff --git a/src/ZipLib/ZipArchiveEntry.cpp b/src/ZipLib/ZipArchiveEntry.cpp new file mode 100644 index 00000000..940804c5 --- /dev/null +++ b/src/ZipLib/ZipArchiveEntry.cpp @@ -0,0 +1,788 @@ +#include "ZipArchiveEntry.h" +#include "ZipArchive.h" + +#include "detail/ZipLocalFileHeader.h" + +#include "methods/ZipMethodResolver.h" + +#include "streams/zip_cryptostream.h" +#include "streams/compression_encoder_stream.h" +#include "streams/compression_decoder_stream.h" +#include "streams/nullstream.h" + +#include "utils/stream_utils.h" +#include "utils/time_utils.h" + +#include +#include +#include +#include +#include + +namespace +{ + bool IsValidFilename(const std::string& fullPath) + { + // this function ensures, that the filename will have non-zero + // length, when the filename will be normalized + + if (fullPath.length() > 0) + { + std::string tmpFilename = fullPath; + std::replace(tmpFilename.begin(), tmpFilename.end(), '\\', '/'); + + // if the filename is built only from '/', then it is invalid path + return tmpFilename.find_first_not_of('/') != std::string::npos; + } + + return false; + } + + std::string GetFilenameFromPath(const std::string& fullPath) + { + std::string::size_type dirSeparatorPos; + + if ((dirSeparatorPos = fullPath.find_last_of('/')) != std::string::npos) + { + return fullPath.substr(dirSeparatorPos + 1); + } + else + { + return fullPath; + } + } + + bool IsDirectoryPath(const std::string& fullPath) + { + return (fullPath.length() > 0 && fullPath.back() == '/'); + } +} + +ZipArchiveEntry::ZipArchiveEntry() + : _archive(nullptr) + , _archiveStream(nullptr) + , _compressionStream(nullptr) + , _encryptionStream(nullptr) + , _rawStream(nullptr) + + , _originallyInArchive(false) + , _isNewOrChanged(false) + , _hasLocalFileHeader(false) + + , _offsetOfCompressedData(-1) + , _offsetOfSerializedLocalFileHeader(-1) + + , _inputStream(nullptr) +{ + +} + +ZipArchiveEntry::~ZipArchiveEntry() +{ + this->CloseRawStream(); + this->CloseDecompressionStream(); +} + +ZipArchiveEntry::Ptr ZipArchiveEntry::CreateNew(ZipArchive* zipArchive, const std::string& fullPath) +{ + ZipArchiveEntry::Ptr result; + + assert(zipArchive != nullptr); + + if (IsValidFilename(fullPath)) + { + result.reset(new ZipArchiveEntry()); + + result->_archive = zipArchive; + result->_isNewOrChanged = true; + result->SetAttributes(Attributes::Archive); + result->SetVersionToExtract(VERSION_NEEDED_DEFAULT); + result->SetVersionMadeBy(VERSION_MADEBY_DEFAULT); + result->SetLastWriteTime(time(nullptr)); + + result->SetFullName(fullPath); + + result->SetCompressionMethod(StoreMethod::CompressionMethod); + result->SetGeneralPurposeBitFlag(BitFlag::None); + } + + return result; +} + +ZipArchiveEntry::Ptr ZipArchiveEntry::CreateExisting(ZipArchive* zipArchive, detail::ZipCentralDirectoryFileHeader& cd) +{ + ZipArchiveEntry::Ptr result; + + assert(zipArchive != nullptr); + + if (IsValidFilename(cd.Filename)) + { + result.reset(new ZipArchiveEntry()); + + result->_archive = zipArchive; + result->_centralDirectoryFileHeader = cd; + result->_originallyInArchive = true; + result->CheckFilenameCorrection(); + + // determining folder by path has more priority + // than attributes. however, if attributes + // does not correspond with path, they will be fixed. + result->SetAttributes(IsDirectoryPath(result->GetFullName()) + ? Attributes::Directory + : Attributes::Archive); + } + + return result; +} + +////////////////////////////////////////////////////////////////////////// +// public methods & getters & setters + +const std::string& ZipArchiveEntry::GetFullName() const +{ + return _centralDirectoryFileHeader.Filename; +} + +void ZipArchiveEntry::SetFullName(const std::string& fullName) +{ + std::string filename = fullName; + std::string correctFilename; + + // unify slashes + std::replace(filename.begin(), filename.end(), '\\', '/'); + + bool isDirectory = IsDirectoryPath(filename); + + // if slash is first char, remove it + if (filename[0] == '/') + { + filename = filename.substr(filename.find_first_not_of('/')); + } + + // find multiply slashes + bool prevWasSlash = false; + for (std::string::size_type i = 0; i < filename.length(); ++i) + { + if (filename[i] == '/' && prevWasSlash) continue; + prevWasSlash = (filename[i] == '/'); + + correctFilename += filename[i]; + } + + _centralDirectoryFileHeader.Filename = correctFilename; + _name = GetFilenameFromPath(correctFilename); + + this->SetAttributes(isDirectory ? Attributes::Directory : Attributes::Archive); +} + +const std::string& ZipArchiveEntry::GetName() const +{ + return _name; +} + +void ZipArchiveEntry::SetName(const std::string& name) +{ + std::string folder; + std::string::size_type dirDelimiterPos; + + // search for '/' in path name. + // if this entry is directory, search up to one character + // before the last one (which is '/') + // if this entry is file, just search until last '/' + // will be found + dirDelimiterPos = this->GetFullName().find_last_of('/', + (uint32_t)this->GetAttributes() & (uint32_t)Attributes::Archive + ? std::string::npos + : this->GetFullName().length() - 1); + + if (dirDelimiterPos != std::string::npos) + { + folder = this->GetFullName().substr(0, dirDelimiterPos); + } + + this->SetFullName(folder + name); + + if (this->IsDirectory()) + { + this->SetFullName(this->GetFullName() + '/'); + } +} + +const std::string& ZipArchiveEntry::GetComment() const +{ + return _centralDirectoryFileHeader.FileComment; +} + +void ZipArchiveEntry::SetComment(const std::string& comment) +{ + _centralDirectoryFileHeader.FileComment = comment; +} + +time_t ZipArchiveEntry::GetLastWriteTime() const +{ + return utils::time::datetime_to_timestamp(_centralDirectoryFileHeader.LastModificationDate, _centralDirectoryFileHeader.LastModificationTime); +} + +void ZipArchiveEntry::SetLastWriteTime(time_t modTime) +{ + utils::time::timestamp_to_datetime(modTime, _centralDirectoryFileHeader.LastModificationDate, _centralDirectoryFileHeader.LastModificationTime); +} + +ZipArchiveEntry::Attributes ZipArchiveEntry::GetAttributes() const +{ + return static_cast(_centralDirectoryFileHeader.ExternalFileAttributes); +} + +uint16_t ZipArchiveEntry::GetCompressionMethod() const +{ + return _centralDirectoryFileHeader.CompressionMethod; +} + +void ZipArchiveEntry::SetAttributes(Attributes value) +{ + Attributes prevVal = this->GetAttributes(); + Attributes newVal = prevVal | value; + + // if we're changing from directory to file + if (!!(prevVal & Attributes::Directory) && !!(newVal & Attributes::Archive)) + { + newVal &= ~Attributes::Directory; + + if (IsDirectoryPath(_centralDirectoryFileHeader.Filename)) + { + _centralDirectoryFileHeader.Filename.pop_back(); + } + } + + // if we're changing from file to directory + else if (!!(prevVal & Attributes::Archive) && !!(newVal & Attributes::Directory)) + { + newVal &= ~Attributes::Archive; + + if (!IsDirectoryPath(_centralDirectoryFileHeader.Filename)) + { + _centralDirectoryFileHeader.Filename += '/'; + } + } + + // if this entry is directory, ensure that crc32 & sizes + // are set to 0 and do not include any stream + if (!!(newVal & Attributes::Directory)) + { + _centralDirectoryFileHeader.Crc32 = 0; + _centralDirectoryFileHeader.CompressedSize = 0; + _centralDirectoryFileHeader.UncompressedSize = 0; + } + + _centralDirectoryFileHeader.ExternalFileAttributes = static_cast(newVal); +} + +bool ZipArchiveEntry::IsPasswordProtected() const +{ + return !!(this->GetGeneralPurposeBitFlag() & BitFlag::Encrypted); +} + +const std::string& ZipArchiveEntry::GetPassword() const +{ + return _password; +} + +void ZipArchiveEntry::SetPassword(const std::string& password) +{ + _password = password; + + // allow unset password only for empty files + if (!_originallyInArchive || (_hasLocalFileHeader && this->GetSize() == 0)) + { + this->SetGeneralPurposeBitFlag(BitFlag::Encrypted, !_password.empty()); + } +} + +uint32_t ZipArchiveEntry::GetCrc32() const +{ + return _centralDirectoryFileHeader.Crc32; +} + +size_t ZipArchiveEntry::GetSize() const +{ + return static_cast(_centralDirectoryFileHeader.UncompressedSize); +} + +size_t ZipArchiveEntry::GetCompressedSize() const +{ + return static_cast(_centralDirectoryFileHeader.CompressedSize); +} + + +bool ZipArchiveEntry::CanExtract() const +{ + return (this->GetVersionToExtract() <= VERSION_MADEBY_DEFAULT); +} + +bool ZipArchiveEntry::IsDirectory() const +{ + return !!(this->GetAttributes() & Attributes::Directory); +} + +bool ZipArchiveEntry::IsUsingDataDescriptor() const +{ + return !!(this->GetGeneralPurposeBitFlag() & BitFlag::DataDescriptor); +} + +void ZipArchiveEntry::UseDataDescriptor(bool use) +{ + this->SetGeneralPurposeBitFlag(BitFlag::DataDescriptor, use); +} + +std::istream* ZipArchiveEntry::GetRawStream() +{ + if (_rawStream == nullptr) + { + if (_originallyInArchive) + { + auto offsetOfCompressedData = this->SeekToCompressedData(); + _rawStream = std::make_shared(*_archive->_zipStream, offsetOfCompressedData, this->GetCompressedSize()); + } + else + { + _rawStream = std::make_shared(*_immediateBuffer); + } + } + + return _rawStream.get(); +} + +std::istream* ZipArchiveEntry::GetDecompressionStream() +{ + std::shared_ptr intermediateStream; + + // there shouldn't be opened another stream + if (this->CanExtract() && _archiveStream == nullptr && _encryptionStream == nullptr) + { + auto offsetOfCompressedData = this->SeekToCompressedData(); + bool needsPassword = !!(this->GetGeneralPurposeBitFlag() & BitFlag::Encrypted); + bool needsDecompress = this->GetCompressionMethod() != StoreMethod::CompressionMethod; + + if (needsPassword && _password.empty()) + { + // we need password, but we does not have it + return nullptr; + } + + // make correctly-ended substream of the input stream + intermediateStream = _archiveStream = std::make_shared(*_archive->_zipStream, offsetOfCompressedData, this->GetCompressedSize()); + + if (needsPassword) + { + std::shared_ptr cryptoStream = std::make_shared(*intermediateStream, _password.c_str()); + cryptoStream->set_final_byte(this->GetLastByteOfEncryptionHeader()); + bool hasCorrectPassword = cryptoStream->prepare_for_decryption(); + + // set it here, because in case the hasCorrectPassword is false + // the method CloseDecompressionStream() will properly delete the stream + intermediateStream = _encryptionStream = cryptoStream; + + if (!hasCorrectPassword) + { + this->CloseDecompressionStream(); + return nullptr; + } + } + + if (needsDecompress) + { + ICompressionMethod::Ptr zipMethod = ZipMethodResolver::GetZipMethodInstance(this->GetCompressionMethod()); + + if (zipMethod != nullptr) + { + intermediateStream = _compressionStream = std::make_shared(zipMethod->GetDecoder(), zipMethod->GetDecoderProperties(), *intermediateStream); + } + } + } + + return intermediateStream.get(); +} + +bool ZipArchiveEntry::IsRawStreamOpened() const +{ + return _rawStream != nullptr; +} + +bool ZipArchiveEntry::IsDecompressionStreamOpened() const +{ + return _compressionStream != nullptr; +} + +void ZipArchiveEntry::CloseRawStream() +{ + _rawStream.reset(); +} + +void ZipArchiveEntry::CloseDecompressionStream() +{ + _compressionStream.reset(); + _encryptionStream.reset(); + _archiveStream.reset(); + _immediateBuffer.reset(); +} + +bool ZipArchiveEntry::SetCompressionStream(std::istream& stream, ICompressionMethod::Ptr method /* = DeflateMethod::Create() */, CompressionMode mode /* = CompressionMode::Deferred */) +{ + // if _inputStream is set, we already have some stream to compress + // so we discard it + if (_inputStream != nullptr) + { + this->UnloadCompressionData(); + } + + _isNewOrChanged = true; + + _inputStream = &stream; + _compressionMethod = method; + _compressionMode = mode; + this->SetCompressionMethod(method->GetZipMethodDescriptor().GetCompressionMethod()); + + if (_inputStream != nullptr && _compressionMode == CompressionMode::Immediate) + { + _immediateBuffer = std::make_shared(); + this->InternalCompressStream(*_inputStream, *_immediateBuffer); + + // we have everything we need, let's act like we were loaded from archive :) + _isNewOrChanged = false; + _inputStream = nullptr; + } + + return true; +} + +void ZipArchiveEntry::UnsetCompressionStream() +{ + if (!this->HasCompressionStream()) + { + this->FetchLocalFileHeader(); + } + + this->UnloadCompressionData(); + this->SetPassword(std::string()); +} + +void ZipArchiveEntry::Remove() +{ + auto it = std::find(_archive->_entries.begin(), _archive->_entries.end(), this->shared_from_this()); + + if (it != _archive->_entries.end()) + { + _archive->_entries.erase(it); + delete this; + } +} + +////////////////////////////////////////////////////////////////////////// +// private getters & setters + +void ZipArchiveEntry::SetCompressionMethod(uint16_t value) +{ + _centralDirectoryFileHeader.CompressionMethod = value; +} + +ZipArchiveEntry::BitFlag ZipArchiveEntry::GetGeneralPurposeBitFlag() const +{ + return static_cast(_centralDirectoryFileHeader.GeneralPurposeBitFlag); +} + +void ZipArchiveEntry::SetGeneralPurposeBitFlag(BitFlag value, bool set) +{ + if (set) + { + _centralDirectoryFileHeader.GeneralPurposeBitFlag |= static_cast(value); + } + else + { + _centralDirectoryFileHeader.GeneralPurposeBitFlag &= static_cast(~value); + } +} + +uint16_t ZipArchiveEntry::GetVersionToExtract() const +{ + return _centralDirectoryFileHeader.VersionNeededToExtract; +} + +void ZipArchiveEntry::SetVersionToExtract(uint16_t value) +{ + _centralDirectoryFileHeader.VersionNeededToExtract = value; +} + +uint16_t ZipArchiveEntry::GetVersionMadeBy() const +{ + return _centralDirectoryFileHeader.VersionMadeBy; +} + +void ZipArchiveEntry::SetVersionMadeBy(uint16_t value) +{ + _centralDirectoryFileHeader.VersionMadeBy = value; +} + +int32_t ZipArchiveEntry::GetOffsetOfLocalHeader() const +{ + return _centralDirectoryFileHeader.RelativeOffsetOfLocalHeader; +} + +void ZipArchiveEntry::SetOffsetOfLocalHeader(int32_t value) +{ + _centralDirectoryFileHeader.RelativeOffsetOfLocalHeader = static_cast(value); +} + +bool ZipArchiveEntry::HasCompressionStream() const +{ + return _inputStream != nullptr; +} + +////////////////////////////////////////////////////////////////////////// +// private working methods + +void ZipArchiveEntry::FetchLocalFileHeader() +{ + if (!_hasLocalFileHeader && _originallyInArchive && _archive != nullptr) + { + _archive->_zipStream->seekg(this->GetOffsetOfLocalHeader(), std::ios::beg); + _localFileHeader.Deserialize(*_archive->_zipStream); + + _offsetOfCompressedData = _archive->_zipStream->tellg(); + } + + // sync data + this->SyncLFH_with_CDFH(); + _hasLocalFileHeader = true; +} + +void ZipArchiveEntry::CheckFilenameCorrection() +{ + // this forces recheck of the filename. + // this is useful when the check is needed after + // deserialization + this->SetFullName(this->GetFullName()); +} + +void ZipArchiveEntry::FixVersionToExtractAtLeast(uint16_t value) +{ + if (this->GetVersionToExtract() < value) + { + this->SetVersionToExtract(value); + } +} + +void ZipArchiveEntry::SyncLFH_with_CDFH() +{ + _localFileHeader.SyncWithCentralDirectoryFileHeader(_centralDirectoryFileHeader); +} + +void ZipArchiveEntry::SyncCDFH_with_LFH() +{ + _centralDirectoryFileHeader.SyncWithLocalFileHeader(_localFileHeader); + + this->FixVersionToExtractAtLeast(this->IsDirectory() + ? VERSION_NEEDED_EXPLICIT_DIRECTORY + : _compressionMethod->GetZipMethodDescriptor().GetVersionNeededToExtract()); +} + +std::ios::pos_type ZipArchiveEntry::GetOffsetOfCompressedData() +{ + if (!_hasLocalFileHeader) + { + this->FetchLocalFileHeader(); + } + + return _offsetOfCompressedData; +} + +std::ios::pos_type ZipArchiveEntry::SeekToCompressedData() +{ + // check for fail bit? + _archive->_zipStream->seekg(this->GetOffsetOfCompressedData(), std::ios::beg); + return this->GetOffsetOfCompressedData(); +} + +void ZipArchiveEntry::SerializeLocalFileHeader(std::ostream& stream) +{ + // ensure opening the stream + std::istream* compressedDataStream = nullptr; + + if (!this->IsDirectory()) + { + if (_inputStream == nullptr) + { + if (!_isNewOrChanged) + { + // the file was either compressed in immediate mode, + // or was in previous archive + compressedDataStream = this->GetRawStream(); + } + + // if file is new and empty or stream has been set to nullptr, + // just do not set any compressed data stream + } + else + { + assert(_isNewOrChanged); + compressedDataStream = _inputStream; + } + } + + if (!_hasLocalFileHeader) + { + this->FetchLocalFileHeader(); + } + + // save offset of stream here + _offsetOfSerializedLocalFileHeader = stream.tellp(); + + if (this->IsUsingDataDescriptor()) + { + _localFileHeader.CompressedSize = 0; + _localFileHeader.UncompressedSize = 0; + _localFileHeader.Crc32 = 0; + } + + _localFileHeader.Serialize(stream); + + // if this entry is a directory, it should not contain any data + // nor crc. + assert( + this->IsDirectory() + ? !GetCrc32() && !GetSize() && !GetCompressedSize() && !_inputStream + : true + ); + + if (!this->IsDirectory() && compressedDataStream != nullptr) + { + if (_isNewOrChanged) + { + this->InternalCompressStream(*compressedDataStream, stream); + + if (this->IsUsingDataDescriptor()) + { + _localFileHeader.SerializeAsDataDescriptor(stream); + } + else + { + // actualize local file header + // make non-seekable version? + stream.seekp(_offsetOfSerializedLocalFileHeader); + _localFileHeader.Serialize(stream); + stream.seekp(this->GetCompressedSize(), std::ios::cur); + } + } + else + { + utils::stream::copy(*compressedDataStream, stream); + } + } +} + +void ZipArchiveEntry::SerializeCentralDirectoryFileHeader(std::ostream& stream) +{ + _centralDirectoryFileHeader.RelativeOffsetOfLocalHeader = static_cast(_offsetOfSerializedLocalFileHeader); + _centralDirectoryFileHeader.Serialize(stream); +} + +void ZipArchiveEntry::UnloadCompressionData() +{ + // unload stream + _immediateBuffer->clear(); + _inputStream = nullptr; + + _centralDirectoryFileHeader.CompressedSize = 0; + _centralDirectoryFileHeader.UncompressedSize = 0; + _centralDirectoryFileHeader.Crc32 = 0; +} + +void ZipArchiveEntry::InternalCompressStream(std::istream& inputStream, std::ostream& outputStream) +{ + std::ostream* intermediateStream = &outputStream; + + std::unique_ptr cryptoStream; + if (!_password.empty()) + { + this->SetGeneralPurposeBitFlag(BitFlag::Encrypted); + + // std::make_unique(); + cryptoStream = std::unique_ptr(new zip_cryptostream()); + + cryptoStream->init(outputStream, _password.c_str()); + cryptoStream->set_final_byte(this->GetLastByteOfEncryptionHeader()); + intermediateStream = cryptoStream.get(); + } + + crc32stream crc32Stream; + crc32Stream.init(inputStream); + + compression_encoder_stream compressionStream( + _compressionMethod->GetEncoder(), + _compressionMethod->GetEncoderProperties(), + *intermediateStream); + intermediateStream = &compressionStream; + utils::stream::copy(crc32Stream, *intermediateStream); + + intermediateStream->flush(); + + _localFileHeader.UncompressedSize = static_cast(compressionStream.get_bytes_read()); + _localFileHeader.CompressedSize = static_cast(compressionStream.get_bytes_written() + (!_password.empty() ? 12 : 0)); + _localFileHeader.Crc32 = crc32Stream.get_crc32(); + + this->SyncCDFH_with_LFH(); +} + +void ZipArchiveEntry::FigureCrc32() +{ + if (this->IsDirectory() || _inputStream == nullptr || !_isNewOrChanged) + { + return; + } + + // stream must be seekable + auto position = _inputStream->tellg(); + + // compute crc32 + crc32stream crc32Stream; + crc32Stream.init(*_inputStream); + + // just force to read all from crc32stream + nullstream nulldev; + utils::stream::copy(crc32Stream, nulldev); + + // seek back + _inputStream->clear(); + _inputStream->seekg(position); + + _centralDirectoryFileHeader.Crc32 = crc32Stream.get_crc32(); +} + +uint8_t ZipArchiveEntry::GetLastByteOfEncryptionHeader() +{ + if (!!(this->GetGeneralPurposeBitFlag() & BitFlag::DataDescriptor)) + { + // In the case that bit 3 of the general purpose bit flag is set to + // indicate the presence of a 'data descriptor' (signature + // 0x08074b50), the last byte of the decrypted header is sometimes + // compared with the high-order byte of the lastmodified time, + // rather than the high-order byte of the CRC, to verify the + // password. + // + // This is not documented in the PKWare Appnote.txt. + // This was discovered this by analysis of the Crypt.c source file in the + // InfoZip library + // http://www.info-zip.org/pub/infozip/ + + // Also, winzip insists on this! + return uint8_t((_centralDirectoryFileHeader.LastModificationTime >> 8) & 0xff); + } + else + { + // When bit 3 is not set, the CRC value is required before + // encryption of the file data begins. In this case there is no way + // around it: must read the stream in its entirety to compute the + // actual CRC before proceeding. + this->FigureCrc32(); + return uint8_t((this->GetCrc32() >> 24) & 0xff); + } +} diff --git a/src/ZipLib/ZipArchiveEntry.h b/src/ZipLib/ZipArchiveEntry.h new file mode 100644 index 00000000..74d6b58c --- /dev/null +++ b/src/ZipLib/ZipArchiveEntry.h @@ -0,0 +1,391 @@ +#pragma once +#include "detail/ZipLocalFileHeader.h" +#include "detail/ZipCentralDirectoryFileHeader.h" + +#include "methods/ICompressionMethod.h" +#include "methods/StoreMethod.h" +#include "methods/DeflateMethod.h" +#include "methods/LzmaMethod.h" + +#include "streams/substream.h" +#include "utils/enum_utils.h" + +#include +#include +#include +#include +#include + +class ZipArchive; + +/** + * \brief Represents a compressed file within a zip archive. + */ +class ZipArchiveEntry + : public std::enable_shared_from_this +{ + friend class ZipFile; + friend class ZipArchive; + + public: + typedef std::shared_ptr Ptr; + + /** + * \brief Values that represent the way the zip entry will be compressed. + */ + enum class CompressionMode + { + Immediate, + Deferred + }; + + /** + * \brief Values that represent the MS-DOS file attributes. + */ + enum class Attributes : uint32_t + { + None = 0, + ReadOnly = 1, + Hidden = 2, + System = 4, + Directory = 16, + Archive = 32, + Device = 64, + Normal = 128, + Temporary = 256, + SparseFile = 512, + ReparsePoint = 1024, + Compressed = 2048, + }; + + MARK_AS_TYPED_ENUMFLAGS_FRIEND(Attributes); + MARK_AS_TYPED_ENUMFLAGS_FRIEND(CompressionMode); + + /** + * \brief Destructor. + */ + ~ZipArchiveEntry(); + + /** + * \brief Gets full path of the entry. + * + * \return The full name with the path. + */ + const std::string& GetFullName() const; + + /** + * \brief Sets full name with the path of the entry. + * + * \param fullName The full name with the path. + */ + void SetFullName(const std::string& fullName); + + /** + * \brief Gets only the file name of the entry (without path). + * + * \return The file name. + */ + const std::string& GetName() const; + + /** + * \brief Sets only a file name of the entry. + * If the file is located within some folder, the path is kept. + * + * \param name The file name. + */ + void SetName(const std::string& name); + + /** + * \brief Gets the comment of this zip entry. + * + * \return The comment. + */ + const std::string& GetComment() const; + + /** + * \brief Sets a comment of this zip entry. + * + * \param comment The comment. + */ + void SetComment(const std::string& comment); + + /** + * \brief Gets the time the file was last modified. + * + * \return The last write time. + */ + time_t GetLastWriteTime() const; + + /** + * \brief Sets the time the file was last modified. + * + * \param modTime Time of the modifier. + */ + void SetLastWriteTime(time_t modTime); + + /** + * \brief Gets the file attributes of this zip entry. + * + * \return The file attributes. + */ + Attributes GetAttributes() const; + + /** + * \brief Gets the compression method. + * + * \return The compression method. + */ + uint16_t GetCompressionMethod() const; + + /** + * \brief Sets the file attributes of this zip entry. + * + * \param value The file attributes. + */ + void SetAttributes(Attributes value); + + /** + * \brief Query if this entry is password protected. + * + * \return true if password protected, false if not. + */ + bool IsPasswordProtected() const; + + /** + * \brief Gets the password of the zip entry. If the password is empty string, the password is not set. + * + * \return The password. + */ + const std::string& GetPassword() const; + + /** + * \brief Sets a password of the zip entry. If the password is empty string, the password is not set. + * Use before GetDecompressionStream or SetCompressionStream. + * + * \param password The password. + */ + void SetPassword(const std::string& password); + + /** + * \brief Gets CRC 32 of the file. + * + * \return The CRC 32. + */ + uint32_t GetCrc32() const; + + /** + * \brief Gets the size of the uncompressed data. + * + * \return The size. + */ + size_t GetSize() const; + + /** + * \brief Gets the size of compressed data. + * + * \return The compressed size. + */ + size_t GetCompressedSize() const; + + /** + * \brief Determine if we can extract the entry. + * It depends on which version was the zip archive created with. + * + * \return true if we can extract, false if not. + */ + bool CanExtract() const; + + /** + * \brief Query if this entry is a directory. + * + * \return true if directory, false if not. + */ + bool IsDirectory() const; + + /** + * \brief Query if this object is using data descriptor. + * Data descriptor is small chunk of information written after the compressed data. + * It's most useful when encrypting a zip entry. + * When it is not using, the CRC32 value is required before + * encryption of the file data begins. In this case there is no way + * around it: must read the stream in its entirety to compute the + * actual CRC32 before proceeding. + * + * \return true if using data descriptor, false if not. + */ + bool IsUsingDataDescriptor() const; + + /** + * \brief Use data descriptor. + * Data descriptor is small chunk of information written after the compressed data. + * It's most useful when encrypting a zip entry. + * When it is not using, the CRC32 value is required before + * encryption of the file data begins. In this case there is no way + * around it: must read the stream in its entirety to compute the + * actual CRC32 before proceeding. + * \param use (Optional) If true, use the data descriptor, false to not use. + */ + void UseDataDescriptor(bool use = true); + + + /** + * \brief Sets the input stream to fetch the data to compress from. + * + * \param stream The input stream to compress. + * \param method (Optional) The method of compression. + * \param mode (Optional) The mode of compression. + * If deferred mode is chosen, the data are compressed when the zip archive is about to be written. + * The stream instance must exist when the ZipArchive::WriteToStream method is called. + * The advantage of deferred compression mode is the compressed data needs not to be loaded + * into the memory, because they are streamed into the final output stream. + * + * If immediate mode is chosen, the data are compressed immediately into the memory buffer. + * It is not recommended to use this method for large files. + * The advantage of immediate mode is the input stream can be destroyed (i.e. by scope) + * even before the ZipArchive::WriteToStream method is called. + * + * \return true if it succeeds, false if it fails. + */ + bool SetCompressionStream(std::istream& stream, ICompressionMethod::Ptr method = DeflateMethod::Create(), CompressionMode mode = CompressionMode::Deferred); + + /** + * \brief Sets compression stream to be null and unsets the password. The entry would contain no data with zero size. + */ + void UnsetCompressionStream(); + + /** + * \brief Gets raw stream of the compressed data. + * + * \return null if it fails, else the stream of raw data. + */ + std::istream* GetRawStream(); + + /** + * \brief Gets decompression stream. + * If the file is encrypted and correct password is not provided, it returns nullptr. + * + * \return null if it fails, else the decompression stream. + */ + std::istream* GetDecompressionStream(); + + /** + * \brief Query if the GetRawStream method has been already called. + * + * \return true if the raw stream is opened, false if not. + */ + bool IsRawStreamOpened() const; + + /** + * \brief Query if the GetDecompressionStream method has been already called. + * + * \return true if the decompression stream is opened, false if not. + */ + bool IsDecompressionStreamOpened() const; + + /** + * \brief Closes the raw stream, opened by GetRawStream. + */ + void CloseRawStream(); + + /** + * \brief Closes the decompression stream, opened by GetDecompressionStream. + */ + void CloseDecompressionStream(); + + /** + * \brief Removes this entry from the ZipArchive. + */ + void Remove(); + + private: + static const uint16_t VERSION_MADEBY_DEFAULT = 63; + + static const uint16_t VERSION_NEEDED_DEFAULT = 10; + static const uint16_t VERSION_NEEDED_EXPLICIT_DIRECTORY = 20; + static const uint16_t VERSION_NEEDED_ZIP64 = 45; + + enum class BitFlag : uint16_t + { + None = 0, + Encrypted = 1, + DataDescriptor = 8, + UnicodeFileName = 0x800 + }; + + MARK_AS_TYPED_ENUMFLAGS_FRIEND(BitFlag); + + ZipArchiveEntry(); + ZipArchiveEntry(const ZipArchiveEntry&); + ZipArchiveEntry& operator = (ZipArchiveEntry&); + + // static methods + static ZipArchiveEntry::Ptr CreateNew(ZipArchive* zipArchive, const std::string& fullPath); + static ZipArchiveEntry::Ptr CreateExisting(ZipArchive* zipArchive, detail::ZipCentralDirectoryFileHeader& cd); + + // methods + void SetCompressionMethod(uint16_t value); + + BitFlag GetGeneralPurposeBitFlag() const; + void SetGeneralPurposeBitFlag(BitFlag value, bool set = true); + + uint16_t GetVersionToExtract() const; + void SetVersionToExtract(uint16_t value); + + uint16_t GetVersionMadeBy() const; + void SetVersionMadeBy(uint16_t value); + + int32_t GetOffsetOfLocalHeader() const; + void SetOffsetOfLocalHeader(int32_t value); + + bool HasCompressionStream() const; + + void FetchLocalFileHeader(); + void CheckFilenameCorrection(); + void FixVersionToExtractAtLeast(uint16_t value); + + void SyncLFH_with_CDFH(); + void SyncCDFH_with_LFH(); + + std::ios::pos_type GetOffsetOfCompressedData(); + std::ios::pos_type SeekToCompressedData(); + + void SerializeLocalFileHeader(std::ostream& stream); + void SerializeCentralDirectoryFileHeader(std::ostream& stream); + + void UnloadCompressionData(); + void InternalCompressStream(std::istream& inputStream, std::ostream& outputStream); + + // for encryption + void FigureCrc32(); + uint8_t GetLastByteOfEncryptionHeader(); + + ////////////////////////////////////////////////////////////////////////// + ZipArchive* _archive; //< pointer to the owning zip archive + + std::shared_ptr _rawStream; //< stream of raw compressed data + std::shared_ptr _compressionStream; //< stream of uncompressed data + std::shared_ptr _encryptionStream; //< underlying encryption stream + std::shared_ptr _archiveStream; //< substream of owning zip archive file + + // internal compression data + std::shared_ptr _immediateBuffer; //< stream used in the immediate mode, stores compressed data in memory + std::istream* _inputStream; //< input stream + + ICompressionMethod::Ptr _compressionMethod; //< compression method + CompressionMode _compressionMode; //< compression mode, either deferred or immediate + + std::string _name; + + // TODO: make as flags + bool _originallyInArchive; + bool _isNewOrChanged; + bool _hasLocalFileHeader; + + detail::ZipLocalFileHeader _localFileHeader; + detail::ZipCentralDirectoryFileHeader _centralDirectoryFileHeader; + + std::ios::pos_type _offsetOfCompressedData; + std::ios::pos_type _offsetOfSerializedLocalFileHeader; + + std::string _password; +}; diff --git a/src/ZipLib/ZipFile.cpp b/src/ZipLib/ZipFile.cpp new file mode 100644 index 00000000..bf225511 --- /dev/null +++ b/src/ZipLib/ZipFile.cpp @@ -0,0 +1,235 @@ +#include "ZipFile.h" + +#include "utils/stream_utils.h" + +#include +#include +#include + +namespace +{ + std::string GetFilenameFromPath(const std::string& fullPath) + { + std::string::size_type dirSeparatorPos; + + if ((dirSeparatorPos = fullPath.find_last_of('/')) != std::string::npos) + { + return fullPath.substr(dirSeparatorPos + 1); + } + else + { + return fullPath; + } + } + + std::string MakeTempFilename(const std::string& fileName) + { + return fileName + ".tmp"; + } +} + +ZipArchive::Ptr ZipFile::Open(const std::string& zipPath) +{ + std::ifstream* zipFile = new std::ifstream(); + zipFile->open(zipPath, std::ios::binary); + + if (!zipFile->is_open()) + { + // if file does not exist, try to create it + std::ofstream tmpFile; + tmpFile.open(zipPath, std::ios::binary); + tmpFile.close(); + + zipFile->open(zipPath, std::ios::binary); + + // if attempt to create file failed, throw an exception + if (!zipFile->is_open()) + { + throw std::runtime_error("cannot open zip file"); + } + } + + return ZipArchive::Create(zipFile, true); +} + +void ZipFile::Save(ZipArchive::Ptr zipArchive, const std::string& zipPath) +{ + ZipFile::SaveAndClose(zipArchive, zipPath); + + zipArchive = ZipFile::Open(zipPath); +} + +void ZipFile::SaveAndClose(ZipArchive::Ptr zipArchive, const std::string& zipPath) +{ + // check if file exist + std::string tempZipPath = MakeTempFilename(zipPath); + std::ofstream outZipFile; + outZipFile.open(tempZipPath, std::ios::binary | std::ios::trunc); + + if (!outZipFile.is_open()) + { + throw std::runtime_error("cannot save zip file"); + } + + zipArchive->WriteToStream(outZipFile); + outZipFile.close(); + + zipArchive->InternalDestroy(); + + remove(zipPath.c_str()); + rename(tempZipPath.c_str(), zipPath.c_str()); +} + +bool ZipFile::IsInArchive(const std::string& zipPath, const std::string& fileName) +{ + ZipArchive::Ptr zipArchive = ZipFile::Open(zipPath); + return zipArchive->GetEntry(fileName) != nullptr; +} + +void ZipFile::AddFile(const std::string& zipPath, const std::string& fileName, ICompressionMethod::Ptr method) +{ + AddFile(zipPath, fileName, GetFilenameFromPath(fileName), method); +} + +void ZipFile::AddFile(const std::string& zipPath, const std::string& fileName, const std::string& inArchiveName, ICompressionMethod::Ptr method) +{ + AddEncryptedFile(zipPath, fileName, inArchiveName, std::string(), method); +} + +void ZipFile::AddEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& password, ICompressionMethod::Ptr method) +{ + AddEncryptedFile(zipPath, fileName, GetFilenameFromPath(fileName), std::string(), method); +} + +void ZipFile::AddEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& inArchiveName, const std::string& password, ICompressionMethod::Ptr method) +{ + std::string tmpName = MakeTempFilename(zipPath); + + { + ZipArchive::Ptr zipArchive = ZipFile::Open(zipPath); + + std::ifstream fileToAdd; + fileToAdd.open(fileName, std::ios::binary); + + if (!fileToAdd.is_open()) + { + throw std::runtime_error("cannot open input file"); + } + + auto fileEntry = zipArchive->CreateEntry(inArchiveName); + + if (fileEntry == nullptr) + { + //throw std::runtime_error("input file already exist in the archive"); + zipArchive->RemoveEntry(inArchiveName); + fileEntry = zipArchive->CreateEntry(inArchiveName); + } + + if (!password.empty()) + { + fileEntry->SetPassword(password); + fileEntry->UseDataDescriptor(); + } + + fileEntry->SetCompressionStream(fileToAdd, method); + + ////////////////////////////////////////////////////////////////////////// + + std::ofstream outFile; + outFile.open(tmpName, std::ios::binary); + + if (!outFile.is_open()) + { + throw std::runtime_error("cannot open output file"); + } + + zipArchive->WriteToStream(outFile); + outFile.close(); + + // force closing the input zip stream + } + + remove(zipPath.c_str()); + rename(tmpName.c_str(), zipPath.c_str()); +} + +void ZipFile::ExtractFile(const std::string& zipPath, const std::string& fileName) +{ + ExtractFile(zipPath, fileName, GetFilenameFromPath(fileName)); +} + +void ZipFile::ExtractFile(const std::string& zipPath, const std::string& fileName, const std::string& destinationPath) +{ + ExtractEncryptedFile(zipPath, fileName, destinationPath, std::string()); +} + +void ZipFile::ExtractEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& password) +{ + ExtractEncryptedFile(zipPath, fileName, GetFilenameFromPath(fileName), password); +} + +void ZipFile::ExtractEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& destinationPath, const std::string& password) +{ + ZipArchive::Ptr zipArchive = ZipFile::Open(zipPath); + + std::ofstream destFile; + destFile.open(destinationPath, std::ios::binary | std::ios::trunc); + + if (!destFile.is_open()) + { + throw std::runtime_error("cannot create destination file"); + } + + auto entry = zipArchive->GetEntry(fileName); + + if (entry == nullptr) + { + throw std::runtime_error("file is not contained in zip file"); + } + + if (!password.empty()) + { + entry->SetPassword(password); + } + + std::istream* dataStream = entry->GetDecompressionStream(); + + if (dataStream == nullptr) + { + throw std::runtime_error("wrong password"); + } + + utils::stream::copy(*dataStream, destFile); + + destFile.flush(); + destFile.close(); +} + +void ZipFile::RemoveEntry(const std::string& zipPath, const std::string& fileName) +{ + std::string tmpName = MakeTempFilename(zipPath); + + { + ZipArchive::Ptr zipArchive = ZipFile::Open(zipPath); + zipArchive->RemoveEntry(fileName); + + ////////////////////////////////////////////////////////////////////////// + + std::ofstream outFile; + + outFile.open(tmpName, std::ios::binary); + + if (!outFile.is_open()) + { + throw std::runtime_error("cannot open output file"); + } + + zipArchive->WriteToStream(outFile); + outFile.close(); + + // force closing the input zip stream + } + + remove(zipPath.c_str()); + rename(tmpName.c_str(), zipPath.c_str()); +} diff --git a/src/ZipLib/ZipFile.h b/src/ZipLib/ZipFile.h new file mode 100644 index 00000000..f49034dc --- /dev/null +++ b/src/ZipLib/ZipFile.h @@ -0,0 +1,141 @@ +#pragma once +#include "ZipArchive.h" + +#include +#include + +/** + * \brief Provides static methods for creating, extracting, and opening zip archives. + */ +class ZipFile +{ + // TODO: + // CreateFromDirectory + compression level + opening to/from stream support + // ExtractToDirectory + + public: + /** + * \brief Opens the zip archive file with the given filename. + * + * \param zipPath Full pathname of the zip file. + * + * \return The ZipArchive instance. + */ + static ZipArchive::Ptr Open(const std::string& zipPath); + + /** + * \brief Saves the zip archive file with the given filename. + * The ZipArchive class will stay open. + * + * \param zipArchive The zip archive to save. + * \param zipPath Full pathname of the zip archive file. + */ + static void Save(ZipArchive::Ptr zipArchive, const std::string& zipPath); + + /** + * \brief Saves the zip archive file and close it. + * The ZipArchive class will be clear after this method call. + * + * \param zipArchive The zip archive to save. + * \param zipPath Full pathname of the zip archive file. + */ + static void SaveAndClose(ZipArchive::Ptr zipArchive, const std::string& zipPath); + + /** + * \brief Checks if file with the given path is contained in the archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename or the path of the file to check. + * + * \return true if in archive, false if not. + */ + static bool IsInArchive(const std::string& zipPath, const std::string& fileName); + + /** + * \brief Adds a file to the zip archive. + * The name of the file in the archive will be the same as the added file name. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to add. + * \param level (Optional) The level of compression. Use CompressionLevel::Stored for no compression. + */ + static void AddFile(const std::string& zipPath, const std::string& fileName, ICompressionMethod::Ptr method = DeflateMethod::Create()); + + /** + * \brief Adds a file to the zip archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to add. + * \param inArchiveName Final name of the file in the archive. + * \param level (Optional) The level of compression. Use CompressionLevel::Stored for no compression. + */ + static void AddFile(const std::string& zipPath, const std::string& fileName, const std::string& inArchiveName, ICompressionMethod::Ptr method = DeflateMethod::Create()); + + /** + * \brief Adds an encrypted file to the zip archive. + * The name of the file in the archive will be the same as the added file name. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to add. + * \param password The password. + * \param level (Optional) The level of compression. Use CompressionLevel::Stored for no compression. + */ + static void AddEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& password, ICompressionMethod::Ptr method = DeflateMethod::Create()); + + /** + * \brief Adds an encrypted file to the zip archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to add. + * \param inArchiveName Final name of the file in the archive. + * \param password The password. + * \param level (Optional) The level of compression. Use CompressionLevel::Stored for no compression. + */ + static void AddEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& inArchiveName, const std::string& password, ICompressionMethod::Ptr method = DeflateMethod::Create()); + + /** + * \brief Extracts the file from the zip archive. + * The extracted filename will have the same file name as the name of the file in the archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to extract. + */ + static void ExtractFile(const std::string& zipPath, const std::string& fileName); + + /** + * \brief Extracts the file from the zip archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file in the archive. + * \param destinationPath Full pathname of the extracted file. + */ + static void ExtractFile(const std::string& zipPath, const std::string& fileName, const std::string& destinationPath); + + /** + * \brief Extracts an encrypted file from the zip archive. + * The extracted filename will have the same file name as the name of the file in the archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to extract. + * \param password The password. + */ + static void ExtractEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& password); + + /** + * \brief Extracts an encrypted file from the zip archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to extract. + * \param destinationPath Full pathname of the extracted file. + * \param password The password. + */ + static void ExtractEncryptedFile(const std::string& zipPath, const std::string& fileName, const std::string& destinationPath, const std::string& password); + + /** + * \brief Removes the file from the zip archive. + * + * \param zipPath Full pathname of the zip file. + * \param fileName Filename of the file to remove. + */ + static void RemoveEntry(const std::string& zipPath, const std::string& fileName); +}; diff --git a/src/ZipLib/ZipLib.vcxproj b/src/ZipLib/ZipLib.vcxproj new file mode 100644 index 00000000..0a67b26b --- /dev/null +++ b/src/ZipLib/ZipLib.vcxproj @@ -0,0 +1,233 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {dbbf348d-c221-4f2e-8a0d-24efa0d98e71} + + + {7ead1358-3e72-4fb6-a212-25d462b5c1e9} + + + {baeb16b3-db4c-432f-9e6a-2acadea0691d} + + + + {5C9FD859-DDF9-4510-8397-B329B0AE8C48} + Win32Proj + ZipLib + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/src/ZipLib/ZipLib.vcxproj.filters b/src/ZipLib/ZipLib.vcxproj.filters new file mode 100644 index 00000000..3a97ee63 --- /dev/null +++ b/src/ZipLib/ZipLib.vcxproj.filters @@ -0,0 +1,243 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {c5ae2b37-da95-4e93-8930-d4904de67e58} + + + {8d36501c-2a0c-493e-839a-a4dbb4b13854} + + + {9b9acd63-f31e-4cb5-909f-aebfe102951f} + + + {d4c8cff5-e22e-45fd-8273-a61104dbc01f} + + + {893f10de-143e-4d88-9a4e-691eb8b10c3a} + + + {cb5f7d4e-815f-4713-8a1b-e6af9c7b16dd} + + + {3b08c920-2447-4e03-b415-76ef3accef84} + + + {bb096c7e-a948-4f55-93fb-34258db3c16a} + + + {37ed4c7a-fa7b-48dc-bf69-0a5557809dd6} + + + {11bb81d5-086d-420f-83c5-c6c559267e0f} + + + {380a885f-3111-4777-a9f2-e6ced1c8b912} + + + {97bbccd3-0914-492c-94c1-20dfd544f0fd} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files\compression\deflate + + + Header Files\compression\deflate + + + Header Files\compression\deflate + + + Header Files\compression\deflate + + + Header Files\compression\lzma\detail + + + Header Files\compression\lzma\detail + + + Header Files\compression\lzma\detail + + + Header Files\compression\lzma\detail + + + Header Files\compression\lzma\detail + + + Header Files\compression\lzma + + + Header Files\compression\lzma + + + Header Files\compression\lzma + + + Header Files\compression\lzma + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\streams\streambuffs + + + Header Files\utils + + + Header Files\compression\store + + + Header Files\compression\store + + + Header Files\compression\store + + + Header Files\compression\store + + + Header Files\methods + + + Header Files\methods + + + Header Files\methods + + + Header Files\methods + + + Header Files\detail + + + Header Files\detail + + + Header Files\detail + + + Header Files\detail + + + Header Files\utils + + + Header Files\utils + + + Header Files\methods + + + Header Files\compression + + + Header Files\compression\bzip2 + + + Header Files\compression\bzip2 + + + Header Files\compression\bzip2 + + + Header Files\compression\bzip2 + + + Header Files\methods + + + Header Files\streams\streambuffs + + + Header Files\streams + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + \ No newline at end of file diff --git a/src/ZipLib/compression/bzip2/bzip2_decoder.h b/src/ZipLib/compression/bzip2/bzip2_decoder.h new file mode 100644 index 00000000..2c859b68 --- /dev/null +++ b/src/ZipLib/compression/bzip2/bzip2_decoder.h @@ -0,0 +1,212 @@ +#pragma once +#include "../compression_interface.h" + +#include "bzip2_decoder_properties.h" + +#include "../../extlibs/bzip2/bzlib.h" + +#include + +template +class basic_bzip2_decoder + : public compression_decoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_bzip2_decoder() + : _lastError(BZ_OK) + , _stream(nullptr) + , _endOfStream(false) + , _bufferCapacity(0) + , _inputBufferSize(0) + , _outputBufferSize(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_bzip2_decoder() + { + if (is_init()) + { + BZ2_bzDecompressEnd(&_bzstream); + uninit_buffers(); + } + } + + void init(istream_type& stream) override + { + bzip2_decoder_properties props; + init(stream, props); + } + + void init(istream_type& stream, compression_decoder_properties_interface& props) override + { + // init stream + _stream = &stream; + _endOfStream = false; + + // init values + _inputBufferSize = _outputBufferSize = 0; + _bytesRead = _bytesWritten = 0; + + // init buffers + bzip2_decoder_properties& bzip2Props = static_cast(props); + _bufferCapacity = bzip2Props.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + + // init bzip2 + _bzstream.bzalloc = nullptr; + _bzstream.bzfree = nullptr; + _bzstream.opaque = nullptr; + + _bzstream.next_in = nullptr; + _bzstream.next_out = nullptr; + _bzstream.avail_in = 0; + _bzstream.avail_out = (unsigned int)-1; // force first load of data + + // no verbosity & do not use small memory model + _lastError = BZ2_bzDecompressInit(&_bzstream, 0, 0); + } + + bool is_init() const override + { + return (_inputBuffer != nullptr && _outputBuffer != nullptr); + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _outputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _outputBuffer + _outputBufferSize; + } + + size_t decode_next() override + { + // do not load any data until there + // are something left + if (_bzstream.avail_out != 0) + { + // if all data has not been fetched and the stream is at the end, + // it is an error + if (_endOfStream) + { + return 0; + } + + // read data into buffer + read_next(); + + // set input buffer and its size + _bzstream.next_in = reinterpret_cast(_inputBuffer); + _bzstream.avail_in = static_cast(_inputBufferSize); + } + + // zstream output + _bzstream.next_out = reinterpret_cast(_outputBuffer); + _bzstream.avail_out = static_cast(_bufferCapacity); + + // inflate stream + if (!bzip2_suceeded(BZ2_bzDecompress(&_bzstream))) + { + return 0; + } + + // associate output buffer + size_t bytesProcessed = _bufferCapacity - static_cast(_bzstream.avail_out); + + // increase amount of total written bytes + _bytesWritten += bytesProcessed; + + if (_lastError == BZ_STREAM_END) + { + _endOfStream = true; + + // if we read more than we should last time, move pointer to the correct position + if (_bzstream.avail_in > 0) + { + _stream->clear(); + _stream->seekg(-static_cast(_bzstream.avail_in), std::ios::cur); + } + } + + _outputBufferSize = bytesProcessed; + + // return count of processed bytes from input stream + return bytesProcessed; + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete[] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + void read_next() + { + // read next bytes from input stream + _stream->read(_inputBuffer, _bufferCapacity); + + // set the size of buffer + _inputBufferSize = static_cast(_stream->gcount()); + + // increase amount of total read bytes + _bytesRead += _inputBufferSize; + + // set lzma buffer pointer to the begin + _endOfStream = _inputBufferSize != _bufferCapacity; + } + + bool bzip2_suceeded(int errorCode) + { + return ((_lastError = errorCode) >= 0); + } + + bz_stream _bzstream; // internal bzip2 structure + int _lastError; // last error of bzip2 operation + + istream_type* _stream; + bool _endOfStream; + + size_t _bufferCapacity; + size_t _inputBufferSize; // how many bytes are read in the input buffer + size_t _outputBufferSize; // how many bytes are written in the output buffer + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_bzip2_decoder> byte_bzip2_decoder; +typedef basic_bzip2_decoder> bzip2_decoder; +typedef basic_bzip2_decoder> wbzip2_decoder; diff --git a/src/ZipLib/compression/bzip2/bzip2_decoder_properties.h b/src/ZipLib/compression/bzip2/bzip2_decoder_properties.h new file mode 100644 index 00000000..e522d71e --- /dev/null +++ b/src/ZipLib/compression/bzip2/bzip2_decoder_properties.h @@ -0,0 +1,19 @@ +#pragma once +#include "../compression_interface.h" + +struct bzip2_decoder_properties + : compression_decoder_properties_interface +{ + bzip2_decoder_properties() + : BufferCapacity(1 << 15) + { + + } + + void normalize() override + { + + } + + size_t BufferCapacity; +}; diff --git a/src/ZipLib/compression/bzip2/bzip2_encoder.h b/src/ZipLib/compression/bzip2/bzip2_encoder.h new file mode 100644 index 00000000..646726b1 --- /dev/null +++ b/src/ZipLib/compression/bzip2/bzip2_encoder.h @@ -0,0 +1,167 @@ +#pragma once +#include "../compression_interface.h" + +#include "bzip2_encoder_properties.h" + +#include "../../extlibs/bzip2/bzlib.h" + +#include + +template +class basic_bzip2_encoder + : public compression_encoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_bzip2_encoder() + : _lastError(BZ_OK) + , _stream(nullptr) + , _bufferCapacity(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_bzip2_encoder() + { + if (is_init()) + { + BZ2_bzCompressEnd(&_bzstream); + uninit_buffers(); + } + } + + void init(ostream_type& stream) override + { + bzip2_encoder_properties props; + init(stream, props); + } + + void init(ostream_type& stream, compression_encoder_properties_interface& props) override + { + // init stream + _stream = &stream; + + // init values + _bytesRead = _bytesWritten = 0; + + // init buffers + bzip2_encoder_properties& bz2Props = static_cast(props); + _bufferCapacity = bz2Props.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + + // init bzip2 + _bzstream.bzalloc = nullptr; + _bzstream.bzfree = nullptr; + _bzstream.opaque = nullptr; + + _bzstream.next_in = nullptr; + _bzstream.next_out = nullptr; + _bzstream.avail_in = 0; + _bzstream.avail_out = 0; + + _lastError = BZ2_bzCompressInit(&_bzstream, bz2Props.BlockSize, 0, bz2Props.WorkFactor); + } + + bool is_init() const override + { + return _stream != nullptr; + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _inputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _inputBuffer + _bufferCapacity; + } + + void encode_next(size_t length) override + { + // set the input buffer + _bzstream.next_in = reinterpret_cast(_inputBuffer); + _bzstream.avail_in = static_cast(length); + + _bytesRead += length; + + bool flush = length < _bufferCapacity; + + // compress data + do { + // zstream output + _bzstream.next_out = reinterpret_cast(_outputBuffer); + _bzstream.avail_out = static_cast(_bufferCapacity); + + // compress stream + BZ2_bzCompress(&_bzstream, flush ? BZ_FINISH : BZ_RUN); + + size_t have = _bufferCapacity - static_cast(_bzstream.avail_out); + + if (have > 0) + { + _stream->write(_outputBuffer, have); + _bytesWritten += have; + } + } while (_bzstream.avail_out == 0); + } + + void sync() override + { + + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete[] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + bool bzip2_suceeded(int errorCode) + { + return ((_lastError = errorCode) >= 0); + } + + bz_stream _bzstream; // internal bzip2 structure + int _lastError; // last error of bzip2 operation + + ostream_type* _stream; + + size_t _bufferCapacity; + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_bzip2_encoder> byte_bzip2_encoder; +typedef basic_bzip2_encoder> bzip2_encoder; +typedef basic_bzip2_encoder> wbzip2_encoder; diff --git a/src/ZipLib/compression/bzip2/bzip2_encoder_properties.h b/src/ZipLib/compression/bzip2/bzip2_encoder_properties.h new file mode 100644 index 00000000..46d51125 --- /dev/null +++ b/src/ZipLib/compression/bzip2/bzip2_encoder_properties.h @@ -0,0 +1,26 @@ +#pragma once +#include "../compression_interface.h" + +#include + +struct bzip2_encoder_properties + : compression_encoder_properties_interface +{ + bzip2_encoder_properties() + : BufferCapacity(1 << 15) + , BlockSize(6) + , WorkFactor(30) + { + + } + + void normalize() override + { + BlockSize = clamp(1, 9, BlockSize); + WorkFactor = clamp(0, 4, WorkFactor); + } + + size_t BufferCapacity; + int BlockSize; + int WorkFactor; +}; diff --git a/src/ZipLib/compression/compression_interface.h b/src/ZipLib/compression/compression_interface.h new file mode 100644 index 00000000..22cf3d56 --- /dev/null +++ b/src/ZipLib/compression/compression_interface.h @@ -0,0 +1,81 @@ +#pragma once +#include +#include + +struct compression_properties_interface +{ + virtual void normalize() = 0; +}; + +struct compression_encoder_properties_interface + : compression_properties_interface +{ + template + inline T clamp(T minimum, T maximum, T value) + { + return std::min(std::max(minimum, value), maximum); + } +}; + +struct compression_decoder_properties_interface + : compression_properties_interface +{ + +}; + +template +class compression_interface_basic +{ + public: + typedef std::basic_istream istream_type; + typedef std::basic_ostream ostream_type; + + virtual ~compression_interface_basic() { } + + virtual bool is_init() const = 0; + + virtual size_t get_bytes_read() const = 0; + virtual size_t get_bytes_written() const = 0; + + virtual ELEM_TYPE* get_buffer_begin() = 0; + virtual ELEM_TYPE* get_buffer_end() = 0; +}; + +template +class compression_encoder_interface_basic + : public compression_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + virtual void init(ostream_type& stream) = 0; + virtual void init(ostream_type& stream, compression_encoder_properties_interface& props) = 0; + virtual void encode_next(size_t length) = 0; + virtual void sync() = 0; +}; + +template +class compression_decoder_interface_basic + : public compression_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + virtual void init(istream_type& stream) = 0; + virtual void init(istream_type& stream, compression_decoder_properties_interface& props) = 0; + virtual size_t decode_next() = 0; +}; + +typedef compression_interface_basic> byte_compression_interface; +typedef compression_interface_basic> compression_interface; +typedef compression_interface_basic> wcompression_interface; + +typedef compression_encoder_interface_basic> byte_compression_encoder_interface; +typedef compression_encoder_interface_basic> compression_encoder_interface; +typedef compression_encoder_interface_basic> wcompression_encoder_interface; + +typedef compression_decoder_interface_basic> byte_compression_decoder_interface; +typedef compression_decoder_interface_basic> compression_decoder_interface; +typedef compression_decoder_interface_basic> wcompression_decoder_interface; diff --git a/src/ZipLib/compression/deflate/deflate_decoder.h b/src/ZipLib/compression/deflate/deflate_decoder.h new file mode 100644 index 00000000..946d98e7 --- /dev/null +++ b/src/ZipLib/compression/deflate/deflate_decoder.h @@ -0,0 +1,219 @@ +#pragma once +#include "../compression_interface.h" + +#include "deflate_decoder_properties.h" + +#include "../../extlibs/zlib/zlib.h" + +#include + +template +class basic_deflate_decoder + : public compression_decoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_deflate_decoder() + : _lastError(Z_OK) + , _stream(nullptr) + , _endOfStream(false) + , _bufferCapacity(0) + , _inputBufferSize(0) + , _outputBufferSize(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_deflate_decoder() + { + if (is_init()) + { + inflateEnd(&_zstream); + uninit_buffers(); + } + } + + void init(istream_type& stream) override + { + deflate_decoder_properties props; + init(stream, props); + } + + void init(istream_type& stream, compression_decoder_properties_interface& props) override + { + // init stream + _stream = &stream; + _endOfStream = false; + + // init values + _inputBufferSize = _outputBufferSize = 0; + _bytesRead = _bytesWritten = 0; + + // init buffers + deflate_decoder_properties& deflateProps = static_cast(props); + _bufferCapacity = deflateProps.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + + // init deflate + _zstream.zalloc = nullptr; + _zstream.zfree = nullptr; + _zstream.opaque = nullptr; + + _zstream.next_in = nullptr; + _zstream.next_out = nullptr; + _zstream.avail_in = 0; + _zstream.avail_out = uInt(-1); // force first load of data + + inflateInit2(&_zstream, -MAX_WBITS); + } + + bool is_init() const override + { + return (_inputBuffer != nullptr && _outputBuffer != nullptr); + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _outputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _outputBuffer + _outputBufferSize; + } + + size_t decode_next() override + { + size_t bytesProcessed = 0; + do + { + // do not load any data until there + // are something left + if (_zstream.avail_out != 0) + { + // if all data has not been fetched and the stream is at the end, + // it is an error + if (_endOfStream) + { + return 0; + } + + // read data into buffer + read_next(); + + // set input buffer and its size + _zstream.next_in = reinterpret_cast(_inputBuffer); + _zstream.avail_in = static_cast(_inputBufferSize); + } + + // zstream output + _zstream.next_out = reinterpret_cast(_outputBuffer); + _zstream.avail_out = static_cast(_bufferCapacity); + + // inflate stream + if (!zlib_suceeded(inflate(&_zstream, Z_NO_FLUSH))) + { + return 0; + } + + // associate output buffer + bytesProcessed += _bufferCapacity - static_cast(_zstream.avail_out); + + // increase amount of total written bytes + _bytesWritten += bytesProcessed; + + if (_lastError == Z_STREAM_END) + { + _endOfStream = true; + + // if we read more than we should last time, move pointer to the correct position + if (_zstream.avail_in > 0) + { + _stream->clear(); + _stream->seekg(-static_cast(_zstream.avail_in), std::ios::cur); + } + } + + _outputBufferSize = bytesProcessed; + } + // Keep consuming input until we are able to produce some output + while (_zstream.avail_out == static_cast(_bufferCapacity)); + + // return count of processed bytes from input stream + return bytesProcessed; + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete[] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + void read_next() + { + // read next bytes from input stream + _stream->read(_inputBuffer, _bufferCapacity); + + // set the size of buffer + _inputBufferSize = static_cast(_stream->gcount()); + + // increase amount of total read bytes + _bytesRead += _inputBufferSize; + + // set lzma buffer pointer to the begin + _endOfStream = _inputBufferSize != _bufferCapacity; + } + + bool zlib_suceeded(int errorCode) + { + // Z_BUF_ERROR just means zlib filled its output buffer without + // consuming all of its input buffer. + return ((_lastError = errorCode) >= 0) || errorCode == Z_BUF_ERROR; + } + + z_stream _zstream; // internal zlib structure + int _lastError; // last error of zlib operation + + istream_type* _stream; + bool _endOfStream; + + size_t _bufferCapacity; + size_t _inputBufferSize; // how many bytes are read in the input buffer + size_t _outputBufferSize; // how many bytes are written in the output buffer + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_deflate_decoder> byte_deflate_decoder; +typedef basic_deflate_decoder> deflate_decoder; +typedef basic_deflate_decoder> wdeflate_decoder; diff --git a/src/ZipLib/compression/deflate/deflate_decoder_properties.h b/src/ZipLib/compression/deflate/deflate_decoder_properties.h new file mode 100644 index 00000000..bfcb854a --- /dev/null +++ b/src/ZipLib/compression/deflate/deflate_decoder_properties.h @@ -0,0 +1,19 @@ +#pragma once +#include "../compression_interface.h" + +struct deflate_decoder_properties + : compression_decoder_properties_interface +{ + deflate_decoder_properties() + : BufferCapacity(1 << 15) + { + + } + + void normalize() override + { + + } + + size_t BufferCapacity; +}; diff --git a/src/ZipLib/compression/deflate/deflate_encoder.h b/src/ZipLib/compression/deflate/deflate_encoder.h new file mode 100644 index 00000000..cf8f6ab1 --- /dev/null +++ b/src/ZipLib/compression/deflate/deflate_encoder.h @@ -0,0 +1,167 @@ +#pragma once +#include "../compression_interface.h" + +#include "deflate_encoder_properties.h" + +#include "../../extlibs/zlib/zlib.h" + +#include + +template +class basic_deflate_encoder + : public compression_encoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_deflate_encoder() + : _lastError(Z_OK) + , _stream(nullptr) + , _bufferCapacity(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_deflate_encoder() + { + if (is_init()) + { + deflateEnd(&_zstream); + uninit_buffers(); + } + } + + void init(ostream_type& stream) override + { + deflate_encoder_properties props; + init(stream, props); + } + + void init(ostream_type& stream, compression_encoder_properties_interface& props) override + { + // init stream + _stream = &stream; + + // init values + _bytesRead = _bytesWritten = 0; + + // init buffers + deflate_encoder_properties& deflateProps = static_cast(props); + _bufferCapacity = deflateProps.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + + // init deflate + _zstream.zalloc = nullptr; + _zstream.zfree = nullptr; + _zstream.opaque = nullptr; + + _zstream.next_in = nullptr; + _zstream.next_out = nullptr; + _zstream.avail_in = 0; + _zstream.avail_out = 0; + + deflateInit2(&_zstream, deflateProps.CompressionLevel, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY); + } + + bool is_init() const override + { + return _stream != nullptr; + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _inputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _inputBuffer + _bufferCapacity; + } + + void encode_next(size_t length) override + { + // set the input buffer + _zstream.next_in = reinterpret_cast(_inputBuffer); + _zstream.avail_in = static_cast(length); + + _bytesRead += length; + + bool flush = length < _bufferCapacity; + + // compress data + do { + // zstream output + _zstream.next_out = reinterpret_cast(_outputBuffer); + _zstream.avail_out = static_cast(_bufferCapacity); + + // compress stream + deflate(&_zstream, flush ? Z_FINISH : Z_NO_FLUSH); + + size_t have = _bufferCapacity - static_cast(_zstream.avail_out); + + if (have > 0) + { + _stream->write(_outputBuffer, have); + _bytesWritten += have; + } + } while (_zstream.avail_out == 0); + } + + void sync() override + { + + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete[] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + bool zlib_suceeded(int errorCode) + { + return ((_lastError = errorCode) >= 0); + } + + z_stream _zstream; // internal zlib structure + int _lastError; // last error of zlib operation + + ostream_type* _stream; + + size_t _bufferCapacity; + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_deflate_encoder> byte_deflate_encoder; +typedef basic_deflate_encoder> deflate_encoder; +typedef basic_deflate_encoder> wdeflate_encoder; diff --git a/src/ZipLib/compression/deflate/deflate_encoder_properties.h b/src/ZipLib/compression/deflate/deflate_encoder_properties.h new file mode 100644 index 00000000..ce61968c --- /dev/null +++ b/src/ZipLib/compression/deflate/deflate_encoder_properties.h @@ -0,0 +1,23 @@ +#pragma once +#include "../compression_interface.h" + +#include + +struct deflate_encoder_properties + : compression_encoder_properties_interface +{ + deflate_encoder_properties() + : BufferCapacity(1 << 15) + , CompressionLevel(6) + { + + } + + void normalize() override + { + CompressionLevel = clamp(0, 9, CompressionLevel); + } + + size_t BufferCapacity; + int CompressionLevel; +}; diff --git a/src/ZipLib/compression/lzma/detail/lzma_alloc.h b/src/ZipLib/compression/lzma/detail/lzma_alloc.h new file mode 100644 index 00000000..47d621e9 --- /dev/null +++ b/src/ZipLib/compression/lzma/detail/lzma_alloc.h @@ -0,0 +1,16 @@ +#pragma once +#include "../../../extlibs/lzma/Types.h" + +namespace detail +{ + class lzma_alloc + : public ISzAlloc + { + public: + lzma_alloc() + { + this->Alloc = [](void*, size_t size) { return malloc(size); }; + this->Free = [](void*, void* address) { free(address); }; + } + }; +} diff --git a/src/ZipLib/compression/lzma/detail/lzma_handle.h b/src/ZipLib/compression/lzma/detail/lzma_handle.h new file mode 100644 index 00000000..92f2ef76 --- /dev/null +++ b/src/ZipLib/compression/lzma/detail/lzma_handle.h @@ -0,0 +1,31 @@ +#pragma once +#include "lzma_alloc.h" + +#include "../../../extlibs/lzma/LzmaEnc.h" + +namespace detail +{ + class lzma_handle + { + public: + lzma_handle() + : _handle(nullptr) + { + _handle = LzmaEnc_Create(&_alloc); + } + + ~lzma_handle() + { + if (_handle != nullptr) + { + LzmaEnc_Destroy(_handle, &_alloc, &_alloc); + } + } + + CLzmaEncHandle get_native_handle() const { return _handle; } + + private: + CLzmaEncHandle _handle; + lzma_alloc _alloc; + }; +} diff --git a/src/ZipLib/compression/lzma/detail/lzma_header.h b/src/ZipLib/compression/lzma/detail/lzma_header.h new file mode 100644 index 00000000..cc89f06e --- /dev/null +++ b/src/ZipLib/compression/lzma/detail/lzma_header.h @@ -0,0 +1,41 @@ +#pragma once +#include "lzma_handle.h" +#include "lzma_out_stream.h" + +#include "../../../extlibs/lzma/7zVersion.h" +#include "../../../extlibs/lzma/LzmaEnc.h" + +namespace detail +{ + class lzma_header + { + public: + enum : size_t + { + HEADER_SIZE = LZMA_PROPS_SIZE + 4 + }; + + lzma_header() + { + _header[0] = MY_VER_MAJOR; + _header[1] = MY_VER_MINOR; + _header[2] = LZMA_PROPS_SIZE & 0xFF; + _header[3] = (LZMA_PROPS_SIZE >> 8) & 0xFF; + } + + void apply(lzma_handle& handle) + { + size_t headerSize = LZMA_PROPS_SIZE; + LzmaEnc_WriteProperties(handle.get_native_handle(), &_header[4], &headerSize); + } + + template + void write_to_stream(detail::lzma_out_stream& stream) + { + stream.write(&_header, HEADER_SIZE); + } + + private: + Byte _header[HEADER_SIZE]; + }; +} diff --git a/src/ZipLib/compression/lzma/detail/lzma_in_stream.h b/src/ZipLib/compression/lzma/detail/lzma_in_stream.h new file mode 100644 index 00000000..a93d2854 --- /dev/null +++ b/src/ZipLib/compression/lzma/detail/lzma_in_stream.h @@ -0,0 +1,105 @@ +#pragma once +#include "../../../extlibs/lzma/Types.h" + +#include +#include + +// forward declaration +template +class basic_lzma_encoder; + +namespace detail +{ + template + class lzma_in_stream + : public ISeqInStream + { + public: + template + friend class ::basic_lzma_encoder; + + typedef std::condition_variable event_t; + typedef std::mutex mutex_t; + + lzma_in_stream() + : _bytesRead(0) + , _internalBufferSize(0) + , _internalInputBuffer(nullptr) + , _endOfStream(false) + { + this->Read = [](void* p, void* buf, size_t* size) -> SRes + { + lzma_in_stream* pthis = static_cast(p); + return pthis->read(buf, size); + }; + } + + SRes read(void* buf, size_t* size) + { + size_t lastBytesRead = _bytesRead; + + // set buffer pointer and get required size + _internalInputBuffer = static_cast(buf); + _internalBufferSize = *size / sizeof(ELEM_TYPE); + + // give control back to the main thread + set_event(); + + // wait for buffer fill + if (!_endOfStream) + { + wait_for_event(); + } + + // copy the data + if ((_bytesRead - lastBytesRead) < *size) + { + _endOfStream = true; + } + + *size = _bytesRead - lastBytesRead; + + return SZ_OK; + } + + size_t get_bytes_read() const { return _bytesRead; } + + private: + size_t _bytesRead; + size_t _internalBufferSize; + ELEM_TYPE* _internalInputBuffer; + event_t _event; + mutex_t _mutex; + bool _endOfStream; + + ELEM_TYPE* get_buffer_begin() { return _internalInputBuffer; } + ELEM_TYPE* get_buffer_end() { return _internalInputBuffer + _internalBufferSize; } + + void set_event() + { + _event.notify_one(); + } + + void wait_for_event() + { + std::unique_lock lk(_mutex); + _event.wait(lk); + } + + void compress(size_t length) + { + if (_endOfStream) + { + return; + } + + _bytesRead += length; + + // set event in "read" method -> continue compression + set_event(); + + // wait until compression of the buffer is done + wait_for_event(); + } + }; +} diff --git a/src/ZipLib/compression/lzma/detail/lzma_out_stream.h b/src/ZipLib/compression/lzma/detail/lzma_out_stream.h new file mode 100644 index 00000000..4dd8aa76 --- /dev/null +++ b/src/ZipLib/compression/lzma/detail/lzma_out_stream.h @@ -0,0 +1,45 @@ +#pragma once +#include "../../../extlibs/lzma/Types.h" + +namespace detail +{ + template + class lzma_out_stream + : public ISeqOutStream + { + public: + typedef std::basic_ostream stream_t; + + lzma_out_stream() + : _bytesWritten(0) + , _stream(nullptr) + { + this->Write = [](void* p, const void* buf, size_t size) + { + lzma_out_stream* pthis = static_cast(p); + return pthis->write(buf, size); + }; + } + + size_t write(const void* buf, size_t size) + { + auto currentPosition = _stream->tellp(); + _stream->write(reinterpret_cast(buf), size); + + size_t delta = static_cast(_stream->tellp()) - static_cast(currentPosition); + _bytesWritten += delta; + + return delta; + } + + size_t get_bytes_written() const { return _bytesWritten; } + + const stream_t& get_stream() const { return *_stream; } + stream_t& get_stream() { return *_stream; } + void set_stream(stream_t& stream) { _stream = &stream; } + + private: + stream_t* _stream; + size_t _bytesWritten; + }; +} diff --git a/src/ZipLib/compression/lzma/lzma_decoder.h b/src/ZipLib/compression/lzma/lzma_decoder.h new file mode 100644 index 00000000..098e4fd3 --- /dev/null +++ b/src/ZipLib/compression/lzma/lzma_decoder.h @@ -0,0 +1,191 @@ +#pragma once +#include "../compression_interface.h" + +#include "detail/lzma_alloc.h" +#include "lzma_decoder_properties.h" + +#include "../../extlibs/lzma/LzmaDec.h" + +#include + +template +class basic_lzma_decoder + : public compression_decoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_lzma_decoder() + : _inPos(0) + , _inProcessed(0) + , _outProcessed(0) + , _stream(nullptr) + , _bufferCapacity(0) + , _inputBufferSize(0) + , _outputBufferSize(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + LzmaDec_Construct(&_handle); + } + + ~basic_lzma_decoder() + { + if (is_init()) + { + LzmaDec_Free(&_handle, &_alloc); + uninit_buffers(); + } + } + + void init(istream_type& stream) override + { + lzma_decoder_properties props; + init(stream, props); + } + + void init(istream_type& stream, compression_decoder_properties_interface& props) override + { + // init stream + _stream = &stream; + + // init values + _inPos = _inProcessed = _outProcessed = 0; + _inputBufferSize = 0; + + // init buffers + lzma_decoder_properties& lzmaProps = static_cast(props); + _bufferCapacity = lzmaProps.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + + // read lzma header + Byte header[LZMA_PROPS_SIZE + 4]; + _stream->read(reinterpret_cast(header), sizeof(header) / sizeof(ELEM_TYPE)); + + // init lzma + LzmaDec_Allocate(&_handle, &header[4], LZMA_PROPS_SIZE, &_alloc); + LzmaDec_Init(&_handle); + } + + bool is_init() const override + { + return (_inputBuffer != nullptr && _outputBuffer != nullptr); + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _outputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _outputBuffer + _outputBufferSize; + } + + size_t decode_next() override + { + if (_inPos == _inputBufferSize) + { + read_next(); + } + + _inProcessed = _inputBufferSize - _inPos; + _outProcessed = _bufferCapacity; + + ELzmaFinishMode finishMode = LZMA_FINISH_ANY; + ELzmaStatus status; + SRes res; + res = LzmaDec_DecodeToBuf( + &_handle, + reinterpret_cast(_outputBuffer), + &_outProcessed, + reinterpret_cast(_inputBuffer) + _inPos, + &_inProcessed, + finishMode, + &status); + + _inPos += _inProcessed; + _bytesWritten += _outProcessed; + + _outputBufferSize = _outProcessed; + + return _outputBufferSize; + + // if (res != SZ_OK) + // return _lzmaInProcessed; + // + // if (_lzmaInProcessed == 0 && _lzmaOutProcessed == 0) + // { + // if (status != LZMA_STATUS_FINISHED_WITH_MARK) + // return _lzmaOutProcessed; + // return _lzmaOutProcessed; + // } + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete [] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete [] _outputBuffer; + } + } + + void read_next() + { + // read next bytes from input stream + _stream->read(_inputBuffer, _bufferCapacity); + + // set the size of buffer + _inputBufferSize = static_cast(_stream->gcount()); + + // increase amount of total read bytes + _bytesRead += _inputBufferSize; + + // set lzma buffer pointer to the begin + _inPos = 0; + } + + CLzmaDec _handle; + detail::lzma_alloc _alloc; + + SizeT _inPos; + SizeT _inProcessed; + SizeT _outProcessed; + + istream_type* _stream; + + size_t _bufferCapacity; + size_t _inputBufferSize; // how many bytes are read in the input buffer + size_t _outputBufferSize; // how many bytes are written in the output buffer + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_lzma_decoder> byte_lzma_decoder; +typedef basic_lzma_decoder> lzma_decoder; +typedef basic_lzma_decoder> wlzma_decoder; diff --git a/src/ZipLib/compression/lzma/lzma_decoder_properties.h b/src/ZipLib/compression/lzma/lzma_decoder_properties.h new file mode 100644 index 00000000..e43f384c --- /dev/null +++ b/src/ZipLib/compression/lzma/lzma_decoder_properties.h @@ -0,0 +1,19 @@ +#pragma once +#include "../compression_interface.h" + +struct lzma_decoder_properties + : compression_decoder_properties_interface +{ + lzma_decoder_properties() + : BufferCapacity(1 << 15) + { + + } + + void normalize() override + { + + } + + size_t BufferCapacity; +}; diff --git a/src/ZipLib/compression/lzma/lzma_encoder.h b/src/ZipLib/compression/lzma/lzma_encoder.h new file mode 100644 index 00000000..4a66b1e2 --- /dev/null +++ b/src/ZipLib/compression/lzma/lzma_encoder.h @@ -0,0 +1,117 @@ +#pragma once +#include "../compression_interface.h" + +#include "lzma_encoder_properties.h" +#include "detail/lzma_alloc.h" +#include "detail/lzma_handle.h" +#include "detail/lzma_header.h" +#include "detail/lzma_in_stream.h" +#include "detail/lzma_out_stream.h" + +#include +#include +#include + +template +class basic_lzma_encoder + : public compression_encoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_lzma_encoder() + { + + } + + ~basic_lzma_encoder() + { + if (is_init()) + { + sync(); + } + } + + void init(ostream_type& stream) override + { + lzma_encoder_properties props; + init(stream, props); + } + + void init(ostream_type& stream, compression_encoder_properties_interface& props) override + { + lzma_encoder_properties& lzmaProps = static_cast(props); + + _ostream.set_stream(stream); + lzmaProps.apply(_handle); + + start_compression_thread(); + } + + bool is_init() const override + { + return &_ostream.get_stream() != nullptr; + } + + size_t get_bytes_read() const override + { + return _istream.get_bytes_read(); + } + + size_t get_bytes_written() const override + { + return _ostream.get_bytes_written(); + } + + ELEM_TYPE* get_buffer_begin() override + { + return _istream.get_buffer_begin(); + } + + ELEM_TYPE* get_buffer_end() override + { + return _istream.get_buffer_end(); + } + + void encode_next(size_t length) override + { + _istream.compress(length); + } + + void sync() override + { + if (_compressionThread.joinable()) + { + _compressionThread.join(); + } + } + + private: + void start_compression_thread() + { + detail::lzma_header header; + header.apply(_handle); + header.write_to_stream(_ostream); + + _compressionThread = std::thread(&basic_lzma_encoder::encode_threadroutine, this); + + _istream.wait_for_event(); + } + + bool encode_threadroutine() + { + return LzmaEnc_Encode(_handle.get_native_handle(), &_ostream, &_istream, nullptr, &_alloc, &_alloc) == SZ_OK; + } + + detail::lzma_handle _handle; + detail::lzma_alloc _alloc; + detail::lzma_in_stream _istream; + detail::lzma_out_stream _ostream; + + std::thread _compressionThread; +}; + +typedef basic_lzma_encoder> byte_lzma_encoder; +typedef basic_lzma_encoder> lzma_encoder; +typedef basic_lzma_encoder> wlzma_encoder; diff --git a/src/ZipLib/compression/lzma/lzma_encoder_properties.h b/src/ZipLib/compression/lzma/lzma_encoder_properties.h new file mode 100644 index 00000000..fad53522 --- /dev/null +++ b/src/ZipLib/compression/lzma/lzma_encoder_properties.h @@ -0,0 +1,41 @@ +#pragma once +#include "../compression_interface.h" + +#include "detail/lzma_handle.h" + +#include "../../extlibs/lzma/LzmaEnc.h" + +struct lzma_encoder_properties + : compression_encoder_properties_interface +{ + lzma_encoder_properties() + : IsMultithreaded(true) + , CompressionLevel(5) + { + + } + + void normalize() override + { + CLzmaEncProps props; + props.level = CompressionLevel; + props.numThreads = IsMultithreaded ? 2 : 1; + + LzmaEncProps_Normalize(&props); + + CompressionLevel = props.level; + IsMultithreaded = props.numThreads != 1; + } + + void apply(detail::lzma_handle& handle) + { + CLzmaEncProps props; + props.level = CompressionLevel; + props.numThreads = IsMultithreaded ? 2 : 1; + + LzmaEnc_SetProps(handle.get_native_handle(), &props); + } + + bool IsMultithreaded; + int CompressionLevel; +}; diff --git a/src/ZipLib/compression/store/store_decoder.h b/src/ZipLib/compression/store/store_decoder.h new file mode 100644 index 00000000..dfd9d3da --- /dev/null +++ b/src/ZipLib/compression/store/store_decoder.h @@ -0,0 +1,123 @@ +#pragma once +#include "../compression_interface.h" + +#include "store_decoder_properties.h" + +#include "../../streams/crc32stream.h" +#include "../../extlibs/zlib/zlib.h" + +#include + +template +class basic_store_decoder + : public compression_decoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_store_decoder() + : _stream(nullptr) + , _bufferCapacity(0) + , _outputBufferSize(0) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_store_decoder() + { + if (is_init()) + { + uninit_buffers(); + } + } + + void init(istream_type& stream) override + { + store_decoder_properties props; + init(stream, props); + } + + void init(istream_type& stream, compression_decoder_properties_interface& props) override + { + // init stream + _stream = &stream; + + // init values + _outputBufferSize = 0; + _bytesRead = _bytesWritten = 0; + + // init buffers + store_decoder_properties& storeProps = static_cast(props); + _bufferCapacity = storeProps.BufferCapacity; + + uninit_buffers(); + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + } + + bool is_init() const override + { + return (_outputBuffer != nullptr); + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _outputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _outputBuffer + _outputBufferSize; + } + + size_t decode_next() override + { + // read next bytes from input stream + _stream->read(_outputBuffer, _bufferCapacity); + + // set the size of buffer + _outputBufferSize = static_cast(_stream->gcount()); + + // increase amount of total read & written bytes + _bytesRead += _outputBufferSize; + _bytesWritten += _outputBufferSize; + + // return count of processed bytes from input stream + return _outputBufferSize; + } + + private: + void uninit_buffers() + { + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + istream_type* _stream; + + size_t _bufferCapacity; + size_t _outputBufferSize; // how many bytes are written in the output buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_store_decoder> byte_store_decoder; +typedef basic_store_decoder> store_decoder; +typedef basic_store_decoder> wstore_decoder; diff --git a/src/ZipLib/compression/store/store_decoder_properties.h b/src/ZipLib/compression/store/store_decoder_properties.h new file mode 100644 index 00000000..13a0ee76 --- /dev/null +++ b/src/ZipLib/compression/store/store_decoder_properties.h @@ -0,0 +1,21 @@ +#pragma once +#include "../compression_interface.h" + +#include + +struct store_decoder_properties + : compression_decoder_properties_interface +{ + store_decoder_properties() + : BufferCapacity(1 << 15) + { + + } + + void normalize() override + { + + } + + size_t BufferCapacity; +}; diff --git a/src/ZipLib/compression/store/store_encoder.h b/src/ZipLib/compression/store/store_encoder.h new file mode 100644 index 00000000..757e5899 --- /dev/null +++ b/src/ZipLib/compression/store/store_encoder.h @@ -0,0 +1,125 @@ +#pragma once +#include "../compression_interface.h" + +#include "store_encoder_properties.h" + +#include "../../streams/crc32stream.h" +#include "../../extlibs/zlib/zlib.h" + +#include + +template +class basic_store_encoder + : public compression_encoder_interface_basic +{ + public: + typedef typename compression_interface_basic::istream_type istream_type; + typedef typename compression_interface_basic::ostream_type ostream_type; + + basic_store_encoder() + : _stream(nullptr) + , _bufferCapacity(0) + , _inputBuffer(nullptr) + , _outputBuffer(nullptr) + , _bytesRead(0) + , _bytesWritten(0) + { + + } + + ~basic_store_encoder() + { + if (is_init()) + { + uninit_buffers(); + } + } + + void init(ostream_type& stream) override + { + store_encoder_properties props; + init(stream, props); + } + + void init(ostream_type& stream, compression_encoder_properties_interface& props) override + { + // init stream + _stream = &stream; + + // init values + _bytesRead = _bytesWritten = 0; + + // init buffers + store_encoder_properties& storeProps = static_cast(props); + _bufferCapacity = storeProps.BufferCapacity; + + uninit_buffers(); + _inputBuffer = new ELEM_TYPE[_bufferCapacity]; + _outputBuffer = new ELEM_TYPE[_bufferCapacity]; + } + + bool is_init() const override + { + return _stream != nullptr; + } + + size_t get_bytes_read() const override + { + return _bytesRead; + } + + size_t get_bytes_written() const override + { + return _bytesWritten; + } + + ELEM_TYPE* get_buffer_begin() override + { + return _inputBuffer; + } + + ELEM_TYPE* get_buffer_end() override + { + return _inputBuffer + _bufferCapacity; + } + + void encode_next(size_t length) override + { + _stream->write(_inputBuffer, length); + + _bytesRead += length; + _bytesWritten += length; + } + + void sync() override + { + + } + + private: + void uninit_buffers() + { + if (_inputBuffer != nullptr) + { + delete[] _inputBuffer; + } + + if (_outputBuffer != nullptr) + { + delete[] _outputBuffer; + } + } + + ostream_type* _stream; + + size_t _bufferCapacity; + ELEM_TYPE* _inputBuffer; // pointer to the start of the input buffer + ELEM_TYPE* _outputBuffer; // pointer to the start of the output buffer + + size_t _bytesRead; + size_t _bytesWritten; +}; + +typedef basic_store_encoder> byte_store_encoder; +typedef basic_store_encoder> store_encoder; +typedef basic_store_encoder> wstore_encoder; diff --git a/src/ZipLib/compression/store/store_encoder_properties.h b/src/ZipLib/compression/store/store_encoder_properties.h new file mode 100644 index 00000000..b52d663d --- /dev/null +++ b/src/ZipLib/compression/store/store_encoder_properties.h @@ -0,0 +1,21 @@ +#pragma once +#include "../compression_interface.h" + +#include + +struct store_encoder_properties + : compression_encoder_properties_interface +{ + store_encoder_properties() + : BufferCapacity(1 << 15) + { + + } + + void normalize() override + { + + } + + size_t BufferCapacity; +}; diff --git a/src/ZipLib/detail/EndOfCentralDirectoryBlock.cpp b/src/ZipLib/detail/EndOfCentralDirectoryBlock.cpp new file mode 100644 index 00000000..1e7c30b2 --- /dev/null +++ b/src/ZipLib/detail/EndOfCentralDirectoryBlock.cpp @@ -0,0 +1,60 @@ +#include "EndOfCentralDirectoryBlock.h" +#include "../streams/serialization.h" +#include + +namespace detail { + +EndOfCentralDirectoryBlock::EndOfCentralDirectoryBlock() +{ + memset(this, 0, sizeof(EndOfCentralDirectoryBlockBase)); + Signature = SignatureConstant; +} + +bool EndOfCentralDirectoryBlock::Deserialize(std::istream& stream) +{ + // this condition should be optimized out :) + if (sizeof(EndOfCentralDirectoryBlockBase) == EndOfCentralDirectoryBlockBase::SIZE_IN_BYTES) + { + deserialize(stream, *this); + } + else + { + deserialize(stream, Signature); + deserialize(stream, NumberOfThisDisk); + deserialize(stream, NumberOfTheDiskWithTheStartOfTheCentralDirectory); + deserialize(stream, NumberOfEntriesInTheCentralDirectoryOnThisDisk); + deserialize(stream, NumberOfEntriesInTheCentralDirectory); + deserialize(stream, SizeOfCentralDirectory); + deserialize(stream, OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber); + deserialize(stream, CommentLength); + } + + deserialize(stream, Comment, CommentLength); + + return true; +} + +void EndOfCentralDirectoryBlock::Serialize(std::ostream& stream) +{ + CommentLength = static_cast(Comment.length()); + + if (sizeof(EndOfCentralDirectoryBlockBase) == EndOfCentralDirectoryBlockBase::SIZE_IN_BYTES) + { + serialize(stream, *this); + } + else + { + serialize(stream, Signature); + serialize(stream, NumberOfThisDisk); + serialize(stream, NumberOfTheDiskWithTheStartOfTheCentralDirectory); + serialize(stream, NumberOfEntriesInTheCentralDirectoryOnThisDisk); + serialize(stream, NumberOfEntriesInTheCentralDirectory); + serialize(stream, SizeOfCentralDirectory); + serialize(stream, OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber); + serialize(stream, CommentLength); + } + + serialize(stream, Comment); +} + +} diff --git a/src/ZipLib/detail/EndOfCentralDirectoryBlock.h b/src/ZipLib/detail/EndOfCentralDirectoryBlock.h new file mode 100644 index 00000000..39d13e63 --- /dev/null +++ b/src/ZipLib/detail/EndOfCentralDirectoryBlock.h @@ -0,0 +1,48 @@ +#pragma once +#include +#include +#include + +class ZipArchive; +class ZipArchiveEntry; + +namespace detail { + +struct EndOfCentralDirectoryBlockBase +{ + enum : size_t + { + SIZE_IN_BYTES = 22 + }; + + uint32_t Signature; + uint16_t NumberOfThisDisk; + uint16_t NumberOfTheDiskWithTheStartOfTheCentralDirectory; + uint16_t NumberOfEntriesInTheCentralDirectoryOnThisDisk; + uint16_t NumberOfEntriesInTheCentralDirectory; + uint32_t SizeOfCentralDirectory; + uint32_t OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber; + uint16_t CommentLength; +}; + +struct EndOfCentralDirectoryBlock + : EndOfCentralDirectoryBlockBase +{ + enum : uint32_t + { + SignatureConstant = 0x06054b50 + }; + + std::string Comment; + + EndOfCentralDirectoryBlock(); + + private: + friend class ::ZipArchive; + friend class ::ZipArchiveEntry; + + bool Deserialize(std::istream& stream); + void Serialize(std::ostream& stream); +}; + +} diff --git a/src/ZipLib/detail/ZipCentralDirectoryFileHeader.cpp b/src/ZipLib/detail/ZipCentralDirectoryFileHeader.cpp new file mode 100644 index 00000000..a204ed04 --- /dev/null +++ b/src/ZipLib/detail/ZipCentralDirectoryFileHeader.cpp @@ -0,0 +1,130 @@ +#include "ZipCentralDirectoryFileHeader.h" +#include "ZipLocalFileHeader.h" + +#include "../streams/serialization.h" + +#include +#include + +namespace detail { + +ZipCentralDirectoryFileHeader::ZipCentralDirectoryFileHeader() +{ + memset(this, 0, sizeof(ZipCentralDirectoryFileHeaderBase)); + Signature = SignatureConstant; +} + +void ZipCentralDirectoryFileHeader::SyncWithLocalFileHeader(ZipLocalFileHeader& lfh) +{ + Crc32 = lfh.Crc32; + CompressedSize = lfh.CompressedSize; + UncompressedSize = lfh.UncompressedSize; + + FilenameLength = static_cast(Filename.length()); + FileCommentLength = static_cast(FileComment.length()); +} + +bool ZipCentralDirectoryFileHeader::Deserialize(std::istream& stream) +{ + if (sizeof(ZipCentralDirectoryFileHeaderBase) == ZipCentralDirectoryFileHeaderBase::SIZE_IN_BYTES) + { + deserialize(stream, *this); + } + else + { + deserialize(stream, Signature); + deserialize(stream, VersionMadeBy); + deserialize(stream, VersionNeededToExtract); + deserialize(stream, GeneralPurposeBitFlag); + deserialize(stream, CompressionMethod); + deserialize(stream, LastModificationTime); + deserialize(stream, LastModificationDate); + deserialize(stream, Crc32); + deserialize(stream, CompressedSize); + deserialize(stream, UncompressedSize); + deserialize(stream, FilenameLength); + deserialize(stream, ExtraFieldLength); + deserialize(stream, FileCommentLength); + deserialize(stream, DiskNumberStart); + deserialize(stream, InternalFileAttributes); + deserialize(stream, ExternalFileAttributes); + deserialize(stream, RelativeOffsetOfLocalHeader); + } + + // If there is not any other entry. + if (stream.fail() || Signature != SignatureConstant) + { + stream.clear(); + stream.seekg(static_cast(static_cast(stream.tellg()) - stream.gcount()), std::istream::beg); + return false; + } + + deserialize(stream, Filename, FilenameLength); + + if (ExtraFieldLength > 0) + { + ZipGenericExtraField extraField; + + auto extraFieldEnd = ExtraFieldLength + stream.tellg(); + + while (extraField.Deserialize(stream, extraFieldEnd)) + { + ExtraFields.push_back(extraField); + } + } + + deserialize(stream, FileComment, FileCommentLength); + + return true; +} + +void ZipCentralDirectoryFileHeader::Serialize(std::ostream& stream) +{ + FilenameLength = static_cast(Filename.length()); + FileCommentLength = static_cast(FileComment.length()); + ExtraFieldLength = 0; + + for (auto& extraField : ExtraFields) + { + ExtraFieldLength += static_cast(ZipGenericExtraField::HEADER_SIZE + extraField.Data.size()); + } + + if (sizeof(ZipCentralDirectoryFileHeaderBase) == ZipCentralDirectoryFileHeaderBase::SIZE_IN_BYTES) + { + serialize(stream, *this); + } + else + { + serialize(stream, Signature); + serialize(stream, VersionMadeBy); + serialize(stream, VersionNeededToExtract); + serialize(stream, GeneralPurposeBitFlag); + serialize(stream, CompressionMethod); + serialize(stream, LastModificationTime); + serialize(stream, LastModificationDate); + serialize(stream, Crc32); + serialize(stream, CompressedSize); + serialize(stream, UncompressedSize); + serialize(stream, FilenameLength); + serialize(stream, ExtraFieldLength); + serialize(stream, FileCommentLength); + serialize(stream, DiskNumberStart); + serialize(stream, InternalFileAttributes); + serialize(stream, ExternalFileAttributes); + serialize(stream, RelativeOffsetOfLocalHeader); + } + + serialize(stream, Filename); + + if (ExtraFieldLength > 0) + { + for (auto& extraField : ExtraFields) + { + extraField.Serialize(stream); + } + } + + serialize(stream, FileComment); +} + +} diff --git a/src/ZipLib/detail/ZipCentralDirectoryFileHeader.h b/src/ZipLib/detail/ZipCentralDirectoryFileHeader.h new file mode 100644 index 00000000..9263453c --- /dev/null +++ b/src/ZipLib/detail/ZipCentralDirectoryFileHeader.h @@ -0,0 +1,66 @@ +#pragma once +#include "ZipGenericExtraField.h" + +#include +#include +#include +#include + +class ZipArchive; +class ZipArchiveEntry; + +namespace detail { + +struct ZipLocalFileHeader; + +struct ZipCentralDirectoryFileHeaderBase +{ + enum : size_t + { + SIZE_IN_BYTES = 46 + }; + + uint32_t Signature; + uint16_t VersionMadeBy; + uint16_t VersionNeededToExtract; + uint16_t GeneralPurposeBitFlag; + uint16_t CompressionMethod; + uint16_t LastModificationTime; + uint16_t LastModificationDate; + uint32_t Crc32; + uint32_t CompressedSize; + uint32_t UncompressedSize; + uint16_t FilenameLength; + uint16_t ExtraFieldLength; + uint16_t FileCommentLength; + uint16_t DiskNumberStart; + uint16_t InternalFileAttributes; + uint32_t ExternalFileAttributes; + int32_t RelativeOffsetOfLocalHeader; +}; + +struct ZipCentralDirectoryFileHeader + : ZipCentralDirectoryFileHeaderBase +{ + enum : uint32_t + { + SignatureConstant = 0x02014b50 + }; + + std::string Filename; + std::vector ExtraFields; + std::string FileComment; + + ZipCentralDirectoryFileHeader(); + + private: + friend class ::ZipArchive; + friend class ::ZipArchiveEntry; + + void SyncWithLocalFileHeader(ZipLocalFileHeader& lfh); + + bool Deserialize(std::istream& stream); + void Serialize(std::ostream& stream); +}; + +} diff --git a/src/ZipLib/detail/ZipGenericExtraField.cpp b/src/ZipLib/detail/ZipGenericExtraField.cpp new file mode 100644 index 00000000..14a08bc8 --- /dev/null +++ b/src/ZipLib/detail/ZipGenericExtraField.cpp @@ -0,0 +1,35 @@ +#include "ZipGenericExtraField.h" +#include "../streams/serialization.h" + +namespace detail { + +bool ZipGenericExtraField::Deserialize(std::istream& stream, std::istream::pos_type extraFieldEnd) +{ + if ((extraFieldEnd - stream.tellg()) < HEADER_SIZE) + { + return false; + } + + deserialize(stream, Tag); + deserialize(stream, Size); + + if ((extraFieldEnd - stream.tellg()) < Size) + { + return false; + } + + deserialize(stream, Data, Size); + + return true; +} + +void ZipGenericExtraField::Serialize(std::ostream& stream) +{ + Size = static_cast(Data.size()); + + serialize(stream, Tag); + serialize(stream, Size); + serialize(stream, Data); +} + +} diff --git a/src/ZipLib/detail/ZipGenericExtraField.h b/src/ZipLib/detail/ZipGenericExtraField.h new file mode 100644 index 00000000..27a64600 --- /dev/null +++ b/src/ZipLib/detail/ZipGenericExtraField.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include + +namespace detail { + +struct ZipGenericExtraField +{ + enum : size_t + { + HEADER_SIZE = 4 + }; + + uint16_t Tag; + uint16_t Size; + std::vector Data; + + private: + friend struct ZipLocalFileHeader; + friend struct ZipCentralDirectoryFileHeader; + + bool Deserialize(std::istream& stream, std::istream::pos_type extraFieldEnd); + void Serialize(std::ostream& stream); +}; + +} diff --git a/src/ZipLib/detail/ZipLocalFileHeader.cpp b/src/ZipLib/detail/ZipLocalFileHeader.cpp new file mode 100644 index 00000000..0e89cb1e --- /dev/null +++ b/src/ZipLib/detail/ZipLocalFileHeader.cpp @@ -0,0 +1,145 @@ +#include "ZipLocalFileHeader.h" +#include "ZipCentralDirectoryFileHeader.h" + +#include "../streams/serialization.h" + +#include + +namespace detail { + +ZipLocalFileHeader::ZipLocalFileHeader() +{ + memset(this, 0, sizeof(ZipLocalFileHeaderBase)); + Signature = SignatureConstant; +} + +void ZipLocalFileHeader::SyncWithCentralDirectoryFileHeader(ZipCentralDirectoryFileHeader& cdfh) +{ + VersionNeededToExtract = cdfh.VersionNeededToExtract; + GeneralPurposeBitFlag = cdfh.GeneralPurposeBitFlag; + CompressionMethod = cdfh.CompressionMethod; + LastModificationTime = cdfh.LastModificationTime; + LastModificationDate = cdfh.LastModificationDate; + Crc32 = cdfh.Crc32; + CompressedSize = cdfh.CompressedSize; + UncompressedSize = cdfh.UncompressedSize; + + Filename = cdfh.Filename; + FilenameLength = static_cast(Filename.length()); +} + +bool ZipLocalFileHeader::Deserialize(std::istream& stream) +{ + if (sizeof(ZipLocalFileHeaderBase) == ZipLocalFileHeaderBase::SIZE_IN_BYTES) + { + deserialize(stream, *this); + } + else + { + deserialize(stream, Signature); + deserialize(stream, VersionNeededToExtract); + deserialize(stream, GeneralPurposeBitFlag); + deserialize(stream, CompressionMethod); + deserialize(stream, LastModificationTime); + deserialize(stream, LastModificationDate); + deserialize(stream, Crc32); + deserialize(stream, CompressedSize); + deserialize(stream, UncompressedSize); + deserialize(stream, FilenameLength); + deserialize(stream, ExtraFieldLength); + } + + // If there is not any other entry. + if (stream.fail() || Signature != SignatureConstant) + { + stream.clear(); + stream.seekg(static_cast(static_cast(stream.tellg()) - stream.gcount()), std::ios::beg); + return false; + } + + deserialize(stream, Filename, FilenameLength); + + if (ExtraFieldLength > 0) + { + ZipGenericExtraField extraField; + + auto extraFieldEnd = ExtraFieldLength + stream.tellg(); + + while (extraField.Deserialize(stream, extraFieldEnd)) + { + ExtraFields.push_back(extraField); + } + } + + return true; +} + +void ZipLocalFileHeader::Serialize(std::ostream& stream) +{ + FilenameLength = static_cast(Filename.length()); + ExtraFieldLength = 0; + + for (auto& extraField : ExtraFields) + { + ExtraFieldLength += static_cast(ZipGenericExtraField::HEADER_SIZE + extraField.Data.size()); + } + + if (sizeof(ZipLocalFileHeaderBase) == ZipLocalFileHeaderBase::SIZE_IN_BYTES) + { + serialize(stream, *this); + } + else + { + serialize(stream, Signature); + serialize(stream, VersionNeededToExtract); + serialize(stream, GeneralPurposeBitFlag); + serialize(stream, CompressionMethod); + serialize(stream, LastModificationTime); + serialize(stream, LastModificationDate); + serialize(stream, Crc32); + serialize(stream, CompressedSize); + serialize(stream, UncompressedSize); + serialize(stream, FilenameLength); + serialize(stream, ExtraFieldLength); + } + + serialize(stream, Filename); + + if (ExtraFieldLength > 0) + { + for (auto& extraField : ExtraFields) + { + extraField.Serialize(stream); + } + } +} + +void ZipLocalFileHeader::DeserializeAsDataDescriptor(std::istream& stream) +{ + uint32_t firstWord; + deserialize(stream, firstWord); + + // the signature is optional, if it's missing, + // we're starting with crc32 + if (firstWord != DataDescriptorSignature) + { + deserialize(stream, Crc32); + } + else + { + Crc32 = firstWord; + } + + deserialize(stream, CompressedSize); + deserialize(stream, UncompressedSize); +} + +void ZipLocalFileHeader::SerializeAsDataDescriptor(std::ostream& stream) +{ + serialize(stream, DataDescriptorSignature); + serialize(stream, Crc32); + serialize(stream, CompressedSize); + serialize(stream, UncompressedSize); +} + +} diff --git a/src/ZipLib/detail/ZipLocalFileHeader.h b/src/ZipLib/detail/ZipLocalFileHeader.h new file mode 100644 index 00000000..7d5344be --- /dev/null +++ b/src/ZipLib/detail/ZipLocalFileHeader.h @@ -0,0 +1,60 @@ +#pragma once +#include "ZipGenericExtraField.h" + +#include +#include +#include + +class ZipArchiveEntry; + +namespace detail { + +struct ZipCentralDirectoryFileHeader; + +struct ZipLocalFileHeaderBase +{ + enum : size_t + { + SIZE_IN_BYTES = 30 + }; + + uint32_t Signature; + uint16_t VersionNeededToExtract; + uint16_t GeneralPurposeBitFlag; + uint16_t CompressionMethod; + uint16_t LastModificationTime; + uint16_t LastModificationDate; + uint32_t Crc32; + uint32_t CompressedSize; + uint32_t UncompressedSize; + uint16_t FilenameLength; + uint16_t ExtraFieldLength; +}; + +struct ZipLocalFileHeader + : ZipLocalFileHeaderBase +{ + enum : uint32_t + { + SignatureConstant = 0x04034b50, + DataDescriptorSignature = 0x08074b50 + }; + + std::string Filename; + std::vector ExtraFields; + + ZipLocalFileHeader(); + + private: + friend class ::ZipArchiveEntry; + + void SyncWithCentralDirectoryFileHeader(ZipCentralDirectoryFileHeader& cdfh); + + bool Deserialize(std::istream& stream); + void Serialize(std::ostream& stream); + + void DeserializeAsDataDescriptor(std::istream& stream); + void SerializeAsDataDescriptor(std::ostream& stream); +}; + +} diff --git a/src/ZipLib/extlibs/bzip2/blocksort.c b/src/ZipLib/extlibs/bzip2/blocksort.c new file mode 100644 index 00000000..d0d662cd --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/blocksort.c @@ -0,0 +1,1094 @@ + +/*-------------------------------------------------------------*/ +/*--- Block sorting machinery ---*/ +/*--- blocksort.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*---------------------------------------------*/ +/*--- Fallback O(N log(N)^2) sorting ---*/ +/*--- algorithm, for repetitive blocks ---*/ +/*---------------------------------------------*/ + +/*---------------------------------------------*/ +static +__inline__ +void fallbackSimpleSort ( UInt32* fmap, + UInt32* eclass, + Int32 lo, + Int32 hi ) +{ + Int32 i, j, tmp; + UInt32 ec_tmp; + + if (lo == hi) return; + + if (hi - lo > 3) { + for ( i = hi-4; i >= lo; i-- ) { + tmp = fmap[i]; + ec_tmp = eclass[tmp]; + for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) + fmap[j-4] = fmap[j]; + fmap[j-4] = tmp; + } + } + + for ( i = hi-1; i >= lo; i-- ) { + tmp = fmap[i]; + ec_tmp = eclass[tmp]; + for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) + fmap[j-1] = fmap[j]; + fmap[j-1] = tmp; + } +} + + +/*---------------------------------------------*/ +#define fswap(zz1, zz2) \ + { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } + +#define fvswap(zzp1, zzp2, zzn) \ +{ \ + Int32 yyp1 = (zzp1); \ + Int32 yyp2 = (zzp2); \ + Int32 yyn = (zzn); \ + while (yyn > 0) { \ + fswap(fmap[yyp1], fmap[yyp2]); \ + yyp1++; yyp2++; yyn--; \ + } \ +} + + +#define fmin(a,b) ((a) < (b)) ? (a) : (b) + +#define fpush(lz,hz) { stackLo[sp] = lz; \ + stackHi[sp] = hz; \ + sp++; } + +#define fpop(lz,hz) { sp--; \ + lz = stackLo[sp]; \ + hz = stackHi[sp]; } + +#define FALLBACK_QSORT_SMALL_THRESH 10 +#define FALLBACK_QSORT_STACK_SIZE 100 + + +static +void fallbackQSort3 ( UInt32* fmap, + UInt32* eclass, + Int32 loSt, + Int32 hiSt ) +{ + Int32 unLo, unHi, ltLo, gtHi, n, m; + Int32 sp, lo, hi; + UInt32 med, r, r3; + Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; + Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; + + r = 0; + + sp = 0; + fpush ( loSt, hiSt ); + + while (sp > 0) { + + AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); + + fpop ( lo, hi ); + if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { + fallbackSimpleSort ( fmap, eclass, lo, hi ); + continue; + } + + /* Random partitioning. Median of 3 sometimes fails to + avoid bad cases. Median of 9 seems to help but + looks rather expensive. This too seems to work but + is cheaper. Guidance for the magic constants + 7621 and 32768 is taken from Sedgewick's algorithms + book, chapter 35. + */ + r = ((r * 7621) + 1) % 32768; + r3 = r % 3; + if (r3 == 0) med = eclass[fmap[lo]]; else + if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else + med = eclass[fmap[hi]]; + + unLo = ltLo = lo; + unHi = gtHi = hi; + + while (1) { + while (1) { + if (unLo > unHi) break; + n = (Int32)eclass[fmap[unLo]] - (Int32)med; + if (n == 0) { + fswap(fmap[unLo], fmap[ltLo]); + ltLo++; unLo++; + continue; + }; + if (n > 0) break; + unLo++; + } + while (1) { + if (unLo > unHi) break; + n = (Int32)eclass[fmap[unHi]] - (Int32)med; + if (n == 0) { + fswap(fmap[unHi], fmap[gtHi]); + gtHi--; unHi--; + continue; + }; + if (n < 0) break; + unHi--; + } + if (unLo > unHi) break; + fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; + } + + AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); + + if (gtHi < ltLo) continue; + + n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); + m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); + + n = lo + unLo - ltLo - 1; + m = hi - (gtHi - unHi) + 1; + + if (n - lo > hi - m) { + fpush ( lo, n ); + fpush ( m, hi ); + } else { + fpush ( m, hi ); + fpush ( lo, n ); + } + } +} + +#undef fmin +#undef fpush +#undef fpop +#undef fswap +#undef fvswap +#undef FALLBACK_QSORT_SMALL_THRESH +#undef FALLBACK_QSORT_STACK_SIZE + + +/*---------------------------------------------*/ +/* Pre: + nblock > 0 + eclass exists for [0 .. nblock-1] + ((UChar*)eclass) [0 .. nblock-1] holds block + ptr exists for [0 .. nblock-1] + + Post: + ((UChar*)eclass) [0 .. nblock-1] holds block + All other areas of eclass destroyed + fmap [0 .. nblock-1] holds sorted order + bhtab [ 0 .. 2+(nblock/32) ] destroyed +*/ + +#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) +#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) +#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) +#define WORD_BH(zz) bhtab[(zz) >> 5] +#define UNALIGNED_BH(zz) ((zz) & 0x01f) + +static +void fallbackSort ( UInt32* fmap, + UInt32* eclass, + UInt32* bhtab, + Int32 nblock, + Int32 verb ) +{ + Int32 ftab[257]; + Int32 ftabCopy[256]; + Int32 H, i, j, k, l, r, cc, cc1; + Int32 nNotDone; + Int32 nBhtab; + UChar* eclass8 = (UChar*)eclass; + + /*-- + Initial 1-char radix sort to generate + initial fmap and initial BH bits. + --*/ + if (verb >= 4) + VPrintf0 ( " bucket sorting ...\n" ); + for (i = 0; i < 257; i++) ftab[i] = 0; + for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; + for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; + for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; + + for (i = 0; i < nblock; i++) { + j = eclass8[i]; + k = ftab[j] - 1; + ftab[j] = k; + fmap[k] = i; + } + + nBhtab = 2 + (nblock / 32); + for (i = 0; i < nBhtab; i++) bhtab[i] = 0; + for (i = 0; i < 256; i++) SET_BH(ftab[i]); + + /*-- + Inductively refine the buckets. Kind-of an + "exponential radix sort" (!), inspired by the + Manber-Myers suffix array construction algorithm. + --*/ + + /*-- set sentinel bits for block-end detection --*/ + for (i = 0; i < 32; i++) { + SET_BH(nblock + 2*i); + CLEAR_BH(nblock + 2*i + 1); + } + + /*-- the log(N) loop --*/ + H = 1; + while (1) { + + if (verb >= 4) + VPrintf1 ( " depth %6d has ", H ); + + j = 0; + for (i = 0; i < nblock; i++) { + if (ISSET_BH(i)) j = i; + k = fmap[i] - H; if (k < 0) k += nblock; + eclass[k] = j; + } + + nNotDone = 0; + r = -1; + while (1) { + + /*-- find the next non-singleton bucket --*/ + k = r + 1; + while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; + if (ISSET_BH(k)) { + while (WORD_BH(k) == 0xffffffff) k += 32; + while (ISSET_BH(k)) k++; + } + l = k - 1; + if (l >= nblock) break; + while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; + if (!ISSET_BH(k)) { + while (WORD_BH(k) == 0x00000000) k += 32; + while (!ISSET_BH(k)) k++; + } + r = k - 1; + if (r >= nblock) break; + + /*-- now [l, r] bracket current bucket --*/ + if (r > l) { + nNotDone += (r - l + 1); + fallbackQSort3 ( fmap, eclass, l, r ); + + /*-- scan bucket and generate header bits-- */ + cc = -1; + for (i = l; i <= r; i++) { + cc1 = eclass[fmap[i]]; + if (cc != cc1) { SET_BH(i); cc = cc1; }; + } + } + } + + if (verb >= 4) + VPrintf1 ( "%6d unresolved strings\n", nNotDone ); + + H *= 2; + if (H > nblock || nNotDone == 0) break; + } + + /*-- + Reconstruct the original block in + eclass8 [0 .. nblock-1], since the + previous phase destroyed it. + --*/ + if (verb >= 4) + VPrintf0 ( " reconstructing block ...\n" ); + j = 0; + for (i = 0; i < nblock; i++) { + while (ftabCopy[j] == 0) j++; + ftabCopy[j]--; + eclass8[fmap[i]] = (UChar)j; + } + AssertH ( j < 256, 1005 ); +} + +#undef SET_BH +#undef CLEAR_BH +#undef ISSET_BH +#undef WORD_BH +#undef UNALIGNED_BH + + +/*---------------------------------------------*/ +/*--- The main, O(N^2 log(N)) sorting ---*/ +/*--- algorithm. Faster for "normal" ---*/ +/*--- non-repetitive blocks. ---*/ +/*---------------------------------------------*/ + +/*---------------------------------------------*/ +static +__inline__ +Bool mainGtU ( UInt32 i1, + UInt32 i2, + UChar* block, + UInt16* quadrant, + UInt32 nblock, + Int32* budget ) +{ + Int32 k; + UChar c1, c2; + UInt16 s1, s2; + + AssertD ( i1 != i2, "mainGtU" ); + /* 1 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 2 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 3 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 4 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 5 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 6 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 7 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 8 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 9 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 10 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 11 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 12 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + + k = nblock + 8; + + do { + /* 1 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 2 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 3 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 4 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 5 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 6 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 7 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 8 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + + if (i1 >= nblock) i1 -= nblock; + if (i2 >= nblock) i2 -= nblock; + + k -= 8; + (*budget)--; + } + while (k >= 0); + + return False; +} + + +/*---------------------------------------------*/ +/*-- + Knuth's increments seem to work better + than Incerpi-Sedgewick here. Possibly + because the number of elems to sort is + usually small, typically <= 20. +--*/ +static +Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, + 9841, 29524, 88573, 265720, + 797161, 2391484 }; + +static +void mainSimpleSort ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + Int32 nblock, + Int32 lo, + Int32 hi, + Int32 d, + Int32* budget ) +{ + Int32 i, j, h, bigN, hp; + UInt32 v; + + bigN = hi - lo + 1; + if (bigN < 2) return; + + hp = 0; + while (incs[hp] < bigN) hp++; + hp--; + + for (; hp >= 0; hp--) { + h = incs[hp]; + + i = lo + h; + while (True) { + + /*-- copy 1 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + /*-- copy 2 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + /*-- copy 3 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + if (*budget < 0) return; + } + } +} + + +/*---------------------------------------------*/ +/*-- + The following is an implementation of + an elegant 3-way quicksort for strings, + described in a paper "Fast Algorithms for + Sorting and Searching Strings", by Robert + Sedgewick and Jon L. Bentley. +--*/ + +#define mswap(zz1, zz2) \ + { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } + +#define mvswap(zzp1, zzp2, zzn) \ +{ \ + Int32 yyp1 = (zzp1); \ + Int32 yyp2 = (zzp2); \ + Int32 yyn = (zzn); \ + while (yyn > 0) { \ + mswap(ptr[yyp1], ptr[yyp2]); \ + yyp1++; yyp2++; yyn--; \ + } \ +} + +static +__inline__ +UChar mmed3 ( UChar a, UChar b, UChar c ) +{ + UChar t; + if (a > b) { t = a; a = b; b = t; }; + if (b > c) { + b = c; + if (a > b) b = a; + } + return b; +} + +#define mmin(a,b) ((a) < (b)) ? (a) : (b) + +#define mpush(lz,hz,dz) { stackLo[sp] = lz; \ + stackHi[sp] = hz; \ + stackD [sp] = dz; \ + sp++; } + +#define mpop(lz,hz,dz) { sp--; \ + lz = stackLo[sp]; \ + hz = stackHi[sp]; \ + dz = stackD [sp]; } + + +#define mnextsize(az) (nextHi[az]-nextLo[az]) + +#define mnextswap(az,bz) \ + { Int32 tz; \ + tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ + tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ + tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } + + +#define MAIN_QSORT_SMALL_THRESH 20 +#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) +#define MAIN_QSORT_STACK_SIZE 100 + +static +void mainQSort3 ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + Int32 nblock, + Int32 loSt, + Int32 hiSt, + Int32 dSt, + Int32* budget ) +{ + Int32 unLo, unHi, ltLo, gtHi, n, m, med; + Int32 sp, lo, hi, d; + + Int32 stackLo[MAIN_QSORT_STACK_SIZE]; + Int32 stackHi[MAIN_QSORT_STACK_SIZE]; + Int32 stackD [MAIN_QSORT_STACK_SIZE]; + + Int32 nextLo[3]; + Int32 nextHi[3]; + Int32 nextD [3]; + + sp = 0; + mpush ( loSt, hiSt, dSt ); + + while (sp > 0) { + + AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); + + mpop ( lo, hi, d ); + if (hi - lo < MAIN_QSORT_SMALL_THRESH || + d > MAIN_QSORT_DEPTH_THRESH) { + mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); + if (*budget < 0) return; + continue; + } + + med = (Int32) + mmed3 ( block[ptr[ lo ]+d], + block[ptr[ hi ]+d], + block[ptr[ (lo+hi)>>1 ]+d] ); + + unLo = ltLo = lo; + unHi = gtHi = hi; + + while (True) { + while (True) { + if (unLo > unHi) break; + n = ((Int32)block[ptr[unLo]+d]) - med; + if (n == 0) { + mswap(ptr[unLo], ptr[ltLo]); + ltLo++; unLo++; continue; + }; + if (n > 0) break; + unLo++; + } + while (True) { + if (unLo > unHi) break; + n = ((Int32)block[ptr[unHi]+d]) - med; + if (n == 0) { + mswap(ptr[unHi], ptr[gtHi]); + gtHi--; unHi--; continue; + }; + if (n < 0) break; + unHi--; + } + if (unLo > unHi) break; + mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; + } + + AssertD ( unHi == unLo-1, "mainQSort3(2)" ); + + if (gtHi < ltLo) { + mpush(lo, hi, d+1 ); + continue; + } + + n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); + m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); + + n = lo + unLo - ltLo - 1; + m = hi - (gtHi - unHi) + 1; + + nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; + nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; + nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; + + if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); + if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); + if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); + + AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); + AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); + + mpush (nextLo[0], nextHi[0], nextD[0]); + mpush (nextLo[1], nextHi[1], nextD[1]); + mpush (nextLo[2], nextHi[2], nextD[2]); + } +} + +#undef mswap +#undef mvswap +#undef mpush +#undef mpop +#undef mmin +#undef mnextsize +#undef mnextswap +#undef MAIN_QSORT_SMALL_THRESH +#undef MAIN_QSORT_DEPTH_THRESH +#undef MAIN_QSORT_STACK_SIZE + + +/*---------------------------------------------*/ +/* Pre: + nblock > N_OVERSHOOT + block32 exists for [0 .. nblock-1 +N_OVERSHOOT] + ((UChar*)block32) [0 .. nblock-1] holds block + ptr exists for [0 .. nblock-1] + + Post: + ((UChar*)block32) [0 .. nblock-1] holds block + All other areas of block32 destroyed + ftab [0 .. 65536 ] destroyed + ptr [0 .. nblock-1] holds sorted order + if (*budget < 0), sorting was abandoned +*/ + +#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) +#define SETMASK (1 << 21) +#define CLEARMASK (~(SETMASK)) + +static +void mainSort ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + UInt32* ftab, + Int32 nblock, + Int32 verb, + Int32* budget ) +{ + Int32 i, j, k, ss, sb; + Int32 runningOrder[256]; + Bool bigDone[256]; + Int32 copyStart[256]; + Int32 copyEnd [256]; + UChar c1; + Int32 numQSorted; + UInt16 s; + if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); + + /*-- set up the 2-byte frequency table --*/ + for (i = 65536; i >= 0; i--) ftab[i] = 0; + + j = block[0] << 8; + i = nblock-1; + for (; i >= 3; i -= 4) { + quadrant[i] = 0; + j = (j >> 8) | ( ((UInt16)block[i]) << 8); + ftab[j]++; + quadrant[i-1] = 0; + j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); + ftab[j]++; + quadrant[i-2] = 0; + j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); + ftab[j]++; + quadrant[i-3] = 0; + j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); + ftab[j]++; + } + for (; i >= 0; i--) { + quadrant[i] = 0; + j = (j >> 8) | ( ((UInt16)block[i]) << 8); + ftab[j]++; + } + + /*-- (emphasises close relationship of block & quadrant) --*/ + for (i = 0; i < BZ_N_OVERSHOOT; i++) { + block [nblock+i] = block[i]; + quadrant[nblock+i] = 0; + } + + if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); + + /*-- Complete the initial radix sort --*/ + for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; + + s = block[0] << 8; + i = nblock-1; + for (; i >= 3; i -= 4) { + s = (s >> 8) | (block[i] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i; + s = (s >> 8) | (block[i-1] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-1; + s = (s >> 8) | (block[i-2] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-2; + s = (s >> 8) | (block[i-3] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-3; + } + for (; i >= 0; i--) { + s = (s >> 8) | (block[i] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i; + } + + /*-- + Now ftab contains the first loc of every small bucket. + Calculate the running order, from smallest to largest + big bucket. + --*/ + for (i = 0; i <= 255; i++) { + bigDone [i] = False; + runningOrder[i] = i; + } + + { + Int32 vv; + Int32 h = 1; + do h = 3 * h + 1; while (h <= 256); + do { + h = h / 3; + for (i = h; i <= 255; i++) { + vv = runningOrder[i]; + j = i; + while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { + runningOrder[j] = runningOrder[j-h]; + j = j - h; + if (j <= (h - 1)) goto zero; + } + zero: + runningOrder[j] = vv; + } + } while (h != 1); + } + + /*-- + The main sorting loop. + --*/ + + numQSorted = 0; + + for (i = 0; i <= 255; i++) { + + /*-- + Process big buckets, starting with the least full. + Basically this is a 3-step process in which we call + mainQSort3 to sort the small buckets [ss, j], but + also make a big effort to avoid the calls if we can. + --*/ + ss = runningOrder[i]; + + /*-- + Step 1: + Complete the big bucket [ss] by quicksorting + any unsorted small buckets [ss, j], for j != ss. + Hopefully previous pointer-scanning phases have already + completed many of the small buckets [ss, j], so + we don't have to sort them at all. + --*/ + for (j = 0; j <= 255; j++) { + if (j != ss) { + sb = (ss << 8) + j; + if ( ! (ftab[sb] & SETMASK) ) { + Int32 lo = ftab[sb] & CLEARMASK; + Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; + if (hi > lo) { + if (verb >= 4) + VPrintf4 ( " qsort [0x%x, 0x%x] " + "done %d this %d\n", + ss, j, numQSorted, hi - lo + 1 ); + mainQSort3 ( + ptr, block, quadrant, nblock, + lo, hi, BZ_N_RADIX, budget + ); + numQSorted += (hi - lo + 1); + if (*budget < 0) return; + } + } + ftab[sb] |= SETMASK; + } + } + + AssertH ( !bigDone[ss], 1006 ); + + /*-- + Step 2: + Now scan this big bucket [ss] so as to synthesise the + sorted order for small buckets [t, ss] for all t, + including, magically, the bucket [ss,ss] too. + This will avoid doing Real Work in subsequent Step 1's. + --*/ + { + for (j = 0; j <= 255; j++) { + copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; + copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; + } + for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { + k = ptr[j]-1; if (k < 0) k += nblock; + c1 = block[k]; + if (!bigDone[c1]) + ptr[ copyStart[c1]++ ] = k; + } + for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { + k = ptr[j]-1; if (k < 0) k += nblock; + c1 = block[k]; + if (!bigDone[c1]) + ptr[ copyEnd[c1]-- ] = k; + } + } + + AssertH ( (copyStart[ss]-1 == copyEnd[ss]) + || + /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. + Necessity for this case is demonstrated by compressing + a sequence of approximately 48.5 million of character + 251; 1.0.0/1.0.1 will then die here. */ + (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), + 1007 ) + + for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; + + /*-- + Step 3: + The [ss] big bucket is now done. Record this fact, + and update the quadrant descriptors. Remember to + update quadrants in the overshoot area too, if + necessary. The "if (i < 255)" test merely skips + this updating for the last bucket processed, since + updating for the last bucket is pointless. + + The quadrant array provides a way to incrementally + cache sort orderings, as they appear, so as to + make subsequent comparisons in fullGtU() complete + faster. For repetitive blocks this makes a big + difference (but not big enough to be able to avoid + the fallback sorting mechanism, exponential radix sort). + + The precise meaning is: at all times: + + for 0 <= i < nblock and 0 <= j <= nblock + + if block[i] != block[j], + + then the relative values of quadrant[i] and + quadrant[j] are meaningless. + + else { + if quadrant[i] < quadrant[j] + then the string starting at i lexicographically + precedes the string starting at j + + else if quadrant[i] > quadrant[j] + then the string starting at j lexicographically + precedes the string starting at i + + else + the relative ordering of the strings starting + at i and j has not yet been determined. + } + --*/ + bigDone[ss] = True; + + if (i < 255) { + Int32 bbStart = ftab[ss << 8] & CLEARMASK; + Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; + Int32 shifts = 0; + + while ((bbSize >> shifts) > 65534) shifts++; + + for (j = bbSize-1; j >= 0; j--) { + Int32 a2update = ptr[bbStart + j]; + UInt16 qVal = (UInt16)(j >> shifts); + quadrant[a2update] = qVal; + if (a2update < BZ_N_OVERSHOOT) + quadrant[a2update + nblock] = qVal; + } + AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); + } + + } + + if (verb >= 4) + VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", + nblock, numQSorted, nblock - numQSorted ); +} + +#undef BIGFREQ +#undef SETMASK +#undef CLEARMASK + + +/*---------------------------------------------*/ +/* Pre: + nblock > 0 + arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] + ((UChar*)arr2) [0 .. nblock-1] holds block + arr1 exists for [0 .. nblock-1] + + Post: + ((UChar*)arr2) [0 .. nblock-1] holds block + All other areas of block destroyed + ftab [ 0 .. 65536 ] destroyed + arr1 [0 .. nblock-1] holds sorted order +*/ +void BZ2_blockSort ( EState* s ) +{ + UInt32* ptr = s->ptr; + UChar* block = s->block; + UInt32* ftab = s->ftab; + Int32 nblock = s->nblock; + Int32 verb = s->verbosity; + Int32 wfact = s->workFactor; + UInt16* quadrant; + Int32 budget; + Int32 budgetInit; + Int32 i; + + if (nblock < 10000) { + fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); + } else { + /* Calculate the location for quadrant, remembering to get + the alignment right. Assumes that &(block[0]) is at least + 2-byte aligned -- this should be ok since block is really + the first section of arr2. + */ + i = nblock+BZ_N_OVERSHOOT; + if (i & 1) i++; + quadrant = (UInt16*)(&(block[i])); + + /* (wfact-1) / 3 puts the default-factor-30 + transition point at very roughly the same place as + with v0.1 and v0.9.0. + Not that it particularly matters any more, since the + resulting compressed stream is now the same regardless + of whether or not we use the main sort or fallback sort. + */ + if (wfact < 1 ) wfact = 1; + if (wfact > 100) wfact = 100; + budgetInit = nblock * ((wfact-1) / 3); + budget = budgetInit; + + mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); + if (verb >= 3) + VPrintf3 ( " %d work, %d block, ratio %5.2f\n", + budgetInit - budget, + nblock, + (float)(budgetInit - budget) / + (float)(nblock==0 ? 1 : nblock) ); + if (budget < 0) { + if (verb >= 2) + VPrintf0 ( " too repetitive; using fallback" + " sorting algorithm\n" ); + fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); + } + } + + s->origPtr = -1; + for (i = 0; i < s->nblock; i++) + if (ptr[i] == 0) + { s->origPtr = i; break; }; + + AssertH( s->origPtr != -1, 1003 ); +} + + +/*-------------------------------------------------------------*/ +/*--- end blocksort.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/bzerror.c b/src/ZipLib/extlibs/bzip2/bzerror.c new file mode 100644 index 00000000..9ac32e1e --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzerror.c @@ -0,0 +1,8 @@ +/* Use when compiling with BZ_NO_STDIO */ + +#include + +void bz_internal_error(int errcode) +{ + assert(0); +} diff --git a/src/ZipLib/extlibs/bzip2/bzip2.vcxproj b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj new file mode 100644 index 00000000..ef45a432 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71} + Win32Proj + bzip2 + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + + + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + + + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + + + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + + + + + + Level3 + Disabled + WIN32;BZ_NO_STDIO;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreadedDebug + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;BZ_NO_STDIO;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreadedDebug + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;BZ_NO_STDIO;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreaded + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;BZ_NO_STDIO;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreaded + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/bzip2/bzip2.vcxproj.filters b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj.filters new file mode 100644 index 00000000..008919eb --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/bzip2/bzlib.c b/src/ZipLib/extlibs/bzip2/bzlib.c new file mode 100644 index 00000000..bd358a79 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzlib.c @@ -0,0 +1,1572 @@ + +/*-------------------------------------------------------------*/ +/*--- Library top-level functions. ---*/ +/*--- bzlib.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + +/* CHANGES + 0.9.0 -- original version. + 0.9.0a/b -- no changes in this file. + 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). + fixed bzWrite/bzRead to ignore zero-length requests. + fixed bzread to correctly handle read requests after EOF. + wrong parameter order in call to bzDecompressInit in + bzBuffToBuffDecompress. Fixed. +*/ + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +/*--- Compression stuff ---*/ +/*---------------------------------------------------*/ + + +/*---------------------------------------------------*/ +#ifndef BZ_NO_STDIO +void BZ2_bz__AssertH__fail ( int errcode ) +{ + fprintf(stderr, + "\n\nbzip2/libbzip2: internal error number %d.\n" + "This is a bug in bzip2/libbzip2, %s.\n" + "Please report it to me at: jseward@bzip.org. If this happened\n" + "when you were using some program which uses libbzip2 as a\n" + "component, you should also report this bug to the author(s)\n" + "of that program. Please make an effort to report this bug;\n" + "timely and accurate bug reports eventually lead to higher\n" + "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", + errcode, + BZ2_bzlibVersion() + ); + + if (errcode == 1007) { + fprintf(stderr, + "\n*** A special note about internal error number 1007 ***\n" + "\n" + "Experience suggests that a common cause of i.e. 1007\n" + "is unreliable memory or other hardware. The 1007 assertion\n" + "just happens to cross-check the results of huge numbers of\n" + "memory reads/writes, and so acts (unintendedly) as a stress\n" + "test of your memory system.\n" + "\n" + "I suggest the following: try compressing the file again,\n" + "possibly monitoring progress in detail with the -vv flag.\n" + "\n" + "* If the error cannot be reproduced, and/or happens at different\n" + " points in compression, you may have a flaky memory system.\n" + " Try a memory-test program. I have used Memtest86\n" + " (www.memtest86.com). At the time of writing it is free (GPLd).\n" + " Memtest86 tests memory much more thorougly than your BIOSs\n" + " power-on test, and may find failures that the BIOS doesn't.\n" + "\n" + "* If the error can be repeatably reproduced, this is a bug in\n" + " bzip2, and I would very much like to hear about it. Please\n" + " let me know, and, ideally, save a copy of the file causing the\n" + " problem -- without which I will be unable to investigate it.\n" + "\n" + ); + } + + exit(3); +} +#endif + + +/*---------------------------------------------------*/ +static +int bz_config_ok ( void ) +{ + if (sizeof(int) != 4) return 0; + if (sizeof(short) != 2) return 0; + if (sizeof(char) != 1) return 0; + return 1; +} + + +/*---------------------------------------------------*/ +static +void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) +{ + void* v = malloc ( items * size ); + return v; +} + +static +void default_bzfree ( void* opaque, void* addr ) +{ + if (addr != NULL) free ( addr ); +} + + +/*---------------------------------------------------*/ +static +void prepare_new_block ( EState* s ) +{ + Int32 i; + s->nblock = 0; + s->numZ = 0; + s->state_out_pos = 0; + BZ_INITIALISE_CRC ( s->blockCRC ); + for (i = 0; i < 256; i++) s->inUse[i] = False; + s->blockNo++; +} + + +/*---------------------------------------------------*/ +static +void init_RL ( EState* s ) +{ + s->state_in_ch = 256; + s->state_in_len = 0; +} + + +static +Bool isempty_RL ( EState* s ) +{ + if (s->state_in_ch < 256 && s->state_in_len > 0) + return False; else + return True; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompressInit) + ( bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor ) +{ + Int32 n; + EState* s; + + if (!bz_config_ok()) return BZ_CONFIG_ERROR; + + if (strm == NULL || + blockSize100k < 1 || blockSize100k > 9 || + workFactor < 0 || workFactor > 250) + return BZ_PARAM_ERROR; + + if (workFactor == 0) workFactor = 30; + if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; + if (strm->bzfree == NULL) strm->bzfree = default_bzfree; + + s = BZALLOC( sizeof(EState) ); + if (s == NULL) return BZ_MEM_ERROR; + s->strm = strm; + + s->arr1 = NULL; + s->arr2 = NULL; + s->ftab = NULL; + + n = 100000 * blockSize100k; + s->arr1 = BZALLOC( n * sizeof(UInt32) ); + s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); + s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); + + if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { + if (s->arr1 != NULL) BZFREE(s->arr1); + if (s->arr2 != NULL) BZFREE(s->arr2); + if (s->ftab != NULL) BZFREE(s->ftab); + if (s != NULL) BZFREE(s); + return BZ_MEM_ERROR; + } + + s->blockNo = 0; + s->state = BZ_S_INPUT; + s->mode = BZ_M_RUNNING; + s->combinedCRC = 0; + s->blockSize100k = blockSize100k; + s->nblockMAX = 100000 * blockSize100k - 19; + s->verbosity = verbosity; + s->workFactor = workFactor; + + s->block = (UChar*)s->arr2; + s->mtfv = (UInt16*)s->arr1; + s->zbits = NULL; + s->ptr = (UInt32*)s->arr1; + + strm->state = s; + strm->total_in_lo32 = 0; + strm->total_in_hi32 = 0; + strm->total_out_lo32 = 0; + strm->total_out_hi32 = 0; + init_RL ( s ); + prepare_new_block ( s ); + return BZ_OK; +} + + +/*---------------------------------------------------*/ +static +void add_pair_to_block ( EState* s ) +{ + Int32 i; + UChar ch = (UChar)(s->state_in_ch); + for (i = 0; i < s->state_in_len; i++) { + BZ_UPDATE_CRC( s->blockCRC, ch ); + } + s->inUse[s->state_in_ch] = True; + switch (s->state_in_len) { + case 1: + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + case 2: + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + case 3: + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + default: + s->inUse[s->state_in_len-4] = True; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = ((UChar)(s->state_in_len-4)); + s->nblock++; + break; + } +} + + +/*---------------------------------------------------*/ +static +void flush_RL ( EState* s ) +{ + if (s->state_in_ch < 256) add_pair_to_block ( s ); + init_RL ( s ); +} + + +/*---------------------------------------------------*/ +#define ADD_CHAR_TO_BLOCK(zs,zchh0) \ +{ \ + UInt32 zchh = (UInt32)(zchh0); \ + /*-- fast track the common case --*/ \ + if (zchh != zs->state_in_ch && \ + zs->state_in_len == 1) { \ + UChar ch = (UChar)(zs->state_in_ch); \ + BZ_UPDATE_CRC( zs->blockCRC, ch ); \ + zs->inUse[zs->state_in_ch] = True; \ + zs->block[zs->nblock] = (UChar)ch; \ + zs->nblock++; \ + zs->state_in_ch = zchh; \ + } \ + else \ + /*-- general, uncommon cases --*/ \ + if (zchh != zs->state_in_ch || \ + zs->state_in_len == 255) { \ + if (zs->state_in_ch < 256) \ + add_pair_to_block ( zs ); \ + zs->state_in_ch = zchh; \ + zs->state_in_len = 1; \ + } else { \ + zs->state_in_len++; \ + } \ +} + + +/*---------------------------------------------------*/ +static +Bool copy_input_until_stop ( EState* s ) +{ + Bool progress_in = False; + + if (s->mode == BZ_M_RUNNING) { + + /*-- fast track the common case --*/ + while (True) { + /*-- block full? --*/ + if (s->nblock >= s->nblockMAX) break; + /*-- no input? --*/ + if (s->strm->avail_in == 0) break; + progress_in = True; + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + s->strm->next_in++; + s->strm->avail_in--; + s->strm->total_in_lo32++; + if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; + } + + } else { + + /*-- general, uncommon case --*/ + while (True) { + /*-- block full? --*/ + if (s->nblock >= s->nblockMAX) break; + /*-- no input? --*/ + if (s->strm->avail_in == 0) break; + /*-- flush/finish end? --*/ + if (s->avail_in_expect == 0) break; + progress_in = True; + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + s->strm->next_in++; + s->strm->avail_in--; + s->strm->total_in_lo32++; + if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; + s->avail_in_expect--; + } + } + return progress_in; +} + + +/*---------------------------------------------------*/ +static +Bool copy_output_until_stop ( EState* s ) +{ + Bool progress_out = False; + + while (True) { + + /*-- no output space? --*/ + if (s->strm->avail_out == 0) break; + + /*-- block done? --*/ + if (s->state_out_pos >= s->numZ) break; + + progress_out = True; + *(s->strm->next_out) = s->zbits[s->state_out_pos]; + s->state_out_pos++; + s->strm->avail_out--; + s->strm->next_out++; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + return progress_out; +} + + +/*---------------------------------------------------*/ +static +Bool handle_compress ( bz_stream* strm ) +{ + Bool progress_in = False; + Bool progress_out = False; + EState* s = strm->state; + + while (True) { + + if (s->state == BZ_S_OUTPUT) { + progress_out |= copy_output_until_stop ( s ); + if (s->state_out_pos < s->numZ) break; + if (s->mode == BZ_M_FINISHING && + s->avail_in_expect == 0 && + isempty_RL(s)) break; + prepare_new_block ( s ); + s->state = BZ_S_INPUT; + if (s->mode == BZ_M_FLUSHING && + s->avail_in_expect == 0 && + isempty_RL(s)) break; + } + + if (s->state == BZ_S_INPUT) { + progress_in |= copy_input_until_stop ( s ); + if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { + flush_RL ( s ); + BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); + s->state = BZ_S_OUTPUT; + } + else + if (s->nblock >= s->nblockMAX) { + BZ2_compressBlock ( s, False ); + s->state = BZ_S_OUTPUT; + } + else + if (s->strm->avail_in == 0) { + break; + } + } + + } + + return progress_in || progress_out; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) +{ + Bool progress; + EState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + preswitch: + switch (s->mode) { + + case BZ_M_IDLE: + return BZ_SEQUENCE_ERROR; + + case BZ_M_RUNNING: + if (action == BZ_RUN) { + progress = handle_compress ( strm ); + return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; + } + else + if (action == BZ_FLUSH) { + s->avail_in_expect = strm->avail_in; + s->mode = BZ_M_FLUSHING; + goto preswitch; + } + else + if (action == BZ_FINISH) { + s->avail_in_expect = strm->avail_in; + s->mode = BZ_M_FINISHING; + goto preswitch; + } + else + return BZ_PARAM_ERROR; + + case BZ_M_FLUSHING: + if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect != s->strm->avail_in) + return BZ_SEQUENCE_ERROR; + progress = handle_compress ( strm ); + if (s->avail_in_expect > 0 || !isempty_RL(s) || + s->state_out_pos < s->numZ) return BZ_FLUSH_OK; + s->mode = BZ_M_RUNNING; + return BZ_RUN_OK; + + case BZ_M_FINISHING: + if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect != s->strm->avail_in) + return BZ_SEQUENCE_ERROR; + progress = handle_compress ( strm ); + if (!progress) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect > 0 || !isempty_RL(s) || + s->state_out_pos < s->numZ) return BZ_FINISH_OK; + s->mode = BZ_M_IDLE; + return BZ_STREAM_END; + } + return BZ_OK; /*--not reached--*/ +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) +{ + EState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + if (s->arr1 != NULL) BZFREE(s->arr1); + if (s->arr2 != NULL) BZFREE(s->arr2); + if (s->ftab != NULL) BZFREE(s->ftab); + BZFREE(strm->state); + + strm->state = NULL; + + return BZ_OK; +} + + +/*---------------------------------------------------*/ +/*--- Decompression stuff ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompressInit) + ( bz_stream* strm, + int verbosity, + int small ) +{ + DState* s; + + if (!bz_config_ok()) return BZ_CONFIG_ERROR; + + if (strm == NULL) return BZ_PARAM_ERROR; + if (small != 0 && small != 1) return BZ_PARAM_ERROR; + if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; + + if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; + if (strm->bzfree == NULL) strm->bzfree = default_bzfree; + + s = BZALLOC( sizeof(DState) ); + if (s == NULL) return BZ_MEM_ERROR; + s->strm = strm; + strm->state = s; + s->state = BZ_X_MAGIC_1; + s->bsLive = 0; + s->bsBuff = 0; + s->calculatedCombinedCRC = 0; + strm->total_in_lo32 = 0; + strm->total_in_hi32 = 0; + strm->total_out_lo32 = 0; + strm->total_out_hi32 = 0; + s->smallDecompress = (Bool)small; + s->ll4 = NULL; + s->ll16 = NULL; + s->tt = NULL; + s->currBlockNo = 0; + s->verbosity = verbosity; + + return BZ_OK; +} + + +/*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ +static +Bool unRLE_obuf_to_output_FAST ( DState* s ) +{ + UChar k1; + + if (s->blockRandomised) { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; + s->k0 ^= BZ_RAND_MASK; s->nblock_used++; + } + + } else { + + /* restore */ + UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; + UChar c_state_out_ch = s->state_out_ch; + Int32 c_state_out_len = s->state_out_len; + Int32 c_nblock_used = s->nblock_used; + Int32 c_k0 = s->k0; + UInt32* c_tt = s->tt; + UInt32 c_tPos = s->tPos; + char* cs_next_out = s->strm->next_out; + unsigned int cs_avail_out = s->strm->avail_out; + Int32 ro_blockSize100k = s->blockSize100k; + /* end restore */ + + UInt32 avail_out_INIT = cs_avail_out; + Int32 s_save_nblockPP = s->save_nblock+1; + unsigned int total_out_lo32_old; + + while (True) { + + /* try to finish existing run */ + if (c_state_out_len > 0) { + while (True) { + if (cs_avail_out == 0) goto return_notr; + if (c_state_out_len == 1) break; + *( (UChar*)(cs_next_out) ) = c_state_out_ch; + BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); + c_state_out_len--; + cs_next_out++; + cs_avail_out--; + } + s_state_out_len_eq_one: + { + if (cs_avail_out == 0) { + c_state_out_len = 1; goto return_notr; + }; + *( (UChar*)(cs_next_out) ) = c_state_out_ch; + BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); + cs_next_out++; + cs_avail_out--; + } + } + /* Only caused by corrupt data stream? */ + if (c_nblock_used > s_save_nblockPP) + return True; + + /* can a new run be started? */ + if (c_nblock_used == s_save_nblockPP) { + c_state_out_len = 0; goto return_notr; + }; + c_state_out_ch = c_k0; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (k1 != c_k0) { + c_k0 = k1; goto s_state_out_len_eq_one; + }; + if (c_nblock_used == s_save_nblockPP) + goto s_state_out_len_eq_one; + + c_state_out_len = 2; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (c_nblock_used == s_save_nblockPP) continue; + if (k1 != c_k0) { c_k0 = k1; continue; }; + + c_state_out_len = 3; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (c_nblock_used == s_save_nblockPP) continue; + if (k1 != c_k0) { c_k0 = k1; continue; }; + + BZ_GET_FAST_C(k1); c_nblock_used++; + c_state_out_len = ((Int32)k1) + 4; + BZ_GET_FAST_C(c_k0); c_nblock_used++; + } + + return_notr: + total_out_lo32_old = s->strm->total_out_lo32; + s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); + if (s->strm->total_out_lo32 < total_out_lo32_old) + s->strm->total_out_hi32++; + + /* save */ + s->calculatedBlockCRC = c_calculatedBlockCRC; + s->state_out_ch = c_state_out_ch; + s->state_out_len = c_state_out_len; + s->nblock_used = c_nblock_used; + s->k0 = c_k0; + s->tt = c_tt; + s->tPos = c_tPos; + s->strm->next_out = cs_next_out; + s->strm->avail_out = cs_avail_out; + /* end save */ + } + return False; +} + + + +/*---------------------------------------------------*/ +__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) +{ + Int32 nb, na, mid; + nb = 0; + na = 256; + do { + mid = (nb + na) >> 1; + if (indx >= cftab[mid]) nb = mid; else na = mid; + } + while (na - nb != 1); + return nb; +} + + +/*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ +static +Bool unRLE_obuf_to_output_SMALL ( DState* s ) +{ + UChar k1; + + if (s->blockRandomised) { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; + s->k0 ^= BZ_RAND_MASK; s->nblock_used++; + } + + } else { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_SMALL(k1); s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_SMALL(s->k0); s->nblock_used++; + } + + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) +{ + Bool corrupt; + DState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + while (True) { + if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; + if (s->state == BZ_X_OUTPUT) { + if (s->smallDecompress) + corrupt = unRLE_obuf_to_output_SMALL ( s ); else + corrupt = unRLE_obuf_to_output_FAST ( s ); + if (corrupt) return BZ_DATA_ERROR; + if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { + BZ_FINALISE_CRC ( s->calculatedBlockCRC ); + if (s->verbosity >= 3) + VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, + s->calculatedBlockCRC ); + if (s->verbosity >= 2) VPrintf0 ( "]" ); + if (s->calculatedBlockCRC != s->storedBlockCRC) + return BZ_DATA_ERROR; + s->calculatedCombinedCRC + = (s->calculatedCombinedCRC << 1) | + (s->calculatedCombinedCRC >> 31); + s->calculatedCombinedCRC ^= s->calculatedBlockCRC; + s->state = BZ_X_BLKHDR_1; + } else { + return BZ_OK; + } + } + if (s->state >= BZ_X_MAGIC_1) { + Int32 r = BZ2_decompress ( s ); + if (r == BZ_STREAM_END) { + if (s->verbosity >= 3) + VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", + s->storedCombinedCRC, s->calculatedCombinedCRC ); + if (s->calculatedCombinedCRC != s->storedCombinedCRC) + return BZ_DATA_ERROR; + return r; + } + if (s->state != BZ_X_OUTPUT) return r; + } + } + + AssertH ( 0, 6001 ); + + return 0; /*NOTREACHED*/ +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) +{ + DState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + if (s->tt != NULL) BZFREE(s->tt); + if (s->ll16 != NULL) BZFREE(s->ll16); + if (s->ll4 != NULL) BZFREE(s->ll4); + + BZFREE(strm->state); + strm->state = NULL; + + return BZ_OK; +} + + +#ifndef BZ_NO_STDIO +/*---------------------------------------------------*/ +/*--- File I/O stuff ---*/ +/*---------------------------------------------------*/ + +#define BZ_SETERR(eee) \ +{ \ + if (bzerror != NULL) *bzerror = eee; \ + if (bzf != NULL) bzf->lastErr = eee; \ +} + +typedef + struct { + FILE* handle; + Char buf[BZ_MAX_UNUSED]; + Int32 bufN; + Bool writing; + bz_stream strm; + Int32 lastErr; + Bool initialisedOk; + } + bzFile; + + +/*---------------------------------------------*/ +static Bool myfeof ( FILE* f ) +{ + Int32 c = fgetc ( f ); + if (c == EOF) return True; + ungetc ( c, f ); + return False; +} + + +/*---------------------------------------------------*/ +BZFILE* BZ_API(BZ2_bzWriteOpen) + ( int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor ) +{ + Int32 ret; + bzFile* bzf = NULL; + + BZ_SETERR(BZ_OK); + + if (f == NULL || + (blockSize100k < 1 || blockSize100k > 9) || + (workFactor < 0 || workFactor > 250) || + (verbosity < 0 || verbosity > 4)) + { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; + + if (ferror(f)) + { BZ_SETERR(BZ_IO_ERROR); return NULL; }; + + bzf = malloc ( sizeof(bzFile) ); + if (bzf == NULL) + { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; + + BZ_SETERR(BZ_OK); + bzf->initialisedOk = False; + bzf->bufN = 0; + bzf->handle = f; + bzf->writing = True; + bzf->strm.bzalloc = NULL; + bzf->strm.bzfree = NULL; + bzf->strm.opaque = NULL; + + if (workFactor == 0) workFactor = 30; + ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, + verbosity, workFactor ); + if (ret != BZ_OK) + { BZ_SETERR(ret); free(bzf); return NULL; }; + + bzf->strm.avail_in = 0; + bzf->initialisedOk = True; + return bzf; +} + + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzWrite) + ( int* bzerror, + BZFILE* b, + void* buf, + int len ) +{ + Int32 n, n2, ret; + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + if (bzf == NULL || buf == NULL || len < 0) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + if (!(bzf->writing)) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + + if (len == 0) + { BZ_SETERR(BZ_OK); return; }; + + bzf->strm.avail_in = len; + bzf->strm.next_in = buf; + + while (True) { + bzf->strm.avail_out = BZ_MAX_UNUSED; + bzf->strm.next_out = bzf->buf; + ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); + if (ret != BZ_RUN_OK) + { BZ_SETERR(ret); return; }; + + if (bzf->strm.avail_out < BZ_MAX_UNUSED) { + n = BZ_MAX_UNUSED - bzf->strm.avail_out; + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n, bzf->handle ); + if (n != n2 || ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (bzf->strm.avail_in == 0) + { BZ_SETERR(BZ_OK); return; }; + } +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzWriteClose) + ( int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out ) +{ + BZ2_bzWriteClose64 ( bzerror, b, abandon, + nbytes_in, NULL, nbytes_out, NULL ); +} + + +void BZ_API(BZ2_bzWriteClose64) + ( int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 ) +{ + Int32 n, n2, ret; + bzFile* bzf = (bzFile*)b; + + if (bzf == NULL) + { BZ_SETERR(BZ_OK); return; }; + if (!(bzf->writing)) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + + if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; + if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; + if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; + if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; + + if ((!abandon) && bzf->lastErr == BZ_OK) { + while (True) { + bzf->strm.avail_out = BZ_MAX_UNUSED; + bzf->strm.next_out = bzf->buf; + ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); + if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) + { BZ_SETERR(ret); return; }; + + if (bzf->strm.avail_out < BZ_MAX_UNUSED) { + n = BZ_MAX_UNUSED - bzf->strm.avail_out; + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n, bzf->handle ); + if (n != n2 || ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (ret == BZ_STREAM_END) break; + } + } + + if ( !abandon && !ferror ( bzf->handle ) ) { + fflush ( bzf->handle ); + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (nbytes_in_lo32 != NULL) + *nbytes_in_lo32 = bzf->strm.total_in_lo32; + if (nbytes_in_hi32 != NULL) + *nbytes_in_hi32 = bzf->strm.total_in_hi32; + if (nbytes_out_lo32 != NULL) + *nbytes_out_lo32 = bzf->strm.total_out_lo32; + if (nbytes_out_hi32 != NULL) + *nbytes_out_hi32 = bzf->strm.total_out_hi32; + + BZ_SETERR(BZ_OK); + BZ2_bzCompressEnd ( &(bzf->strm) ); + free ( bzf ); +} + + +/*---------------------------------------------------*/ +BZFILE* BZ_API(BZ2_bzReadOpen) + ( int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused ) +{ + bzFile* bzf = NULL; + int ret; + + BZ_SETERR(BZ_OK); + + if (f == NULL || + (small != 0 && small != 1) || + (verbosity < 0 || verbosity > 4) || + (unused == NULL && nUnused != 0) || + (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) + { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; + + if (ferror(f)) + { BZ_SETERR(BZ_IO_ERROR); return NULL; }; + + bzf = malloc ( sizeof(bzFile) ); + if (bzf == NULL) + { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; + + BZ_SETERR(BZ_OK); + + bzf->initialisedOk = False; + bzf->handle = f; + bzf->bufN = 0; + bzf->writing = False; + bzf->strm.bzalloc = NULL; + bzf->strm.bzfree = NULL; + bzf->strm.opaque = NULL; + + while (nUnused > 0) { + bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; + unused = ((void*)( 1 + ((UChar*)(unused)) )); + nUnused--; + } + + ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); + if (ret != BZ_OK) + { BZ_SETERR(ret); free(bzf); return NULL; }; + + bzf->strm.avail_in = bzf->bufN; + bzf->strm.next_in = bzf->buf; + + bzf->initialisedOk = True; + return bzf; +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) +{ + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + if (bzf == NULL) + { BZ_SETERR(BZ_OK); return; }; + + if (bzf->writing) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + + if (bzf->initialisedOk) + (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); + free ( bzf ); +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzRead) + ( int* bzerror, + BZFILE* b, + void* buf, + int len ) +{ + Int32 n, ret; + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + + if (bzf == NULL || buf == NULL || len < 0) + { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; + + if (bzf->writing) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; + + if (len == 0) + { BZ_SETERR(BZ_OK); return 0; }; + + bzf->strm.avail_out = len; + bzf->strm.next_out = buf; + + while (True) { + + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return 0; }; + + if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { + n = fread ( bzf->buf, sizeof(UChar), + BZ_MAX_UNUSED, bzf->handle ); + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return 0; }; + bzf->bufN = n; + bzf->strm.avail_in = bzf->bufN; + bzf->strm.next_in = bzf->buf; + } + + ret = BZ2_bzDecompress ( &(bzf->strm) ); + + if (ret != BZ_OK && ret != BZ_STREAM_END) + { BZ_SETERR(ret); return 0; }; + + if (ret == BZ_OK && myfeof(bzf->handle) && + bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) + { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; + + if (ret == BZ_STREAM_END) + { BZ_SETERR(BZ_STREAM_END); + return len - bzf->strm.avail_out; }; + if (bzf->strm.avail_out == 0) + { BZ_SETERR(BZ_OK); return len; }; + + } + + return 0; /*not reached*/ +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzReadGetUnused) + ( int* bzerror, + BZFILE* b, + void** unused, + int* nUnused ) +{ + bzFile* bzf = (bzFile*)b; + if (bzf == NULL) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + if (bzf->lastErr != BZ_STREAM_END) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (unused == NULL || nUnused == NULL) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + + BZ_SETERR(BZ_OK); + *nUnused = bzf->strm.avail_in; + *unused = bzf->strm.next_in; +} +#endif + + +/*---------------------------------------------------*/ +/*--- Misc convenience stuff ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzBuffToBuffCompress) + ( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor ) +{ + bz_stream strm; + int ret; + + if (dest == NULL || destLen == NULL || + source == NULL || + blockSize100k < 1 || blockSize100k > 9 || + verbosity < 0 || verbosity > 4 || + workFactor < 0 || workFactor > 250) + return BZ_PARAM_ERROR; + + if (workFactor == 0) workFactor = 30; + strm.bzalloc = NULL; + strm.bzfree = NULL; + strm.opaque = NULL; + ret = BZ2_bzCompressInit ( &strm, blockSize100k, + verbosity, workFactor ); + if (ret != BZ_OK) return ret; + + strm.next_in = source; + strm.next_out = dest; + strm.avail_in = sourceLen; + strm.avail_out = *destLen; + + ret = BZ2_bzCompress ( &strm, BZ_FINISH ); + if (ret == BZ_FINISH_OK) goto output_overflow; + if (ret != BZ_STREAM_END) goto errhandler; + + /* normal termination */ + *destLen -= strm.avail_out; + BZ2_bzCompressEnd ( &strm ); + return BZ_OK; + + output_overflow: + BZ2_bzCompressEnd ( &strm ); + return BZ_OUTBUFF_FULL; + + errhandler: + BZ2_bzCompressEnd ( &strm ); + return ret; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzBuffToBuffDecompress) + ( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity ) +{ + bz_stream strm; + int ret; + + if (dest == NULL || destLen == NULL || + source == NULL || + (small != 0 && small != 1) || + verbosity < 0 || verbosity > 4) + return BZ_PARAM_ERROR; + + strm.bzalloc = NULL; + strm.bzfree = NULL; + strm.opaque = NULL; + ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); + if (ret != BZ_OK) return ret; + + strm.next_in = source; + strm.next_out = dest; + strm.avail_in = sourceLen; + strm.avail_out = *destLen; + + ret = BZ2_bzDecompress ( &strm ); + if (ret == BZ_OK) goto output_overflow_or_eof; + if (ret != BZ_STREAM_END) goto errhandler; + + /* normal termination */ + *destLen -= strm.avail_out; + BZ2_bzDecompressEnd ( &strm ); + return BZ_OK; + + output_overflow_or_eof: + if (strm.avail_out > 0) { + BZ2_bzDecompressEnd ( &strm ); + return BZ_UNEXPECTED_EOF; + } else { + BZ2_bzDecompressEnd ( &strm ); + return BZ_OUTBUFF_FULL; + }; + + errhandler: + BZ2_bzDecompressEnd ( &strm ); + return ret; +} + + +/*---------------------------------------------------*/ +/*-- + Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +/*-- + return version like "0.9.5d, 4-Sept-1999". +--*/ +const char * BZ_API(BZ2_bzlibVersion)(void) +{ + return BZ_VERSION; +} + + +#ifndef BZ_NO_STDIO +/*---------------------------------------------------*/ + +#if defined(_WIN32) || defined(OS2) || defined(MSDOS) +# include +# include +# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif +static +BZFILE * bzopen_or_bzdopen + ( const char *path, /* no use when bzdopen */ + int fd, /* no use when bzdopen */ + const char *mode, + int open_mode) /* bzopen: 0, bzdopen:1 */ +{ + int bzerr; + char unused[BZ_MAX_UNUSED]; + int blockSize100k = 9; + int writing = 0; + char mode2[10] = ""; + FILE *fp = NULL; + BZFILE *bzfp = NULL; + int verbosity = 0; + int workFactor = 30; + int smallMode = 0; + int nUnused = 0; + + if (mode == NULL) return NULL; + while (*mode) { + switch (*mode) { + case 'r': + writing = 0; break; + case 'w': + writing = 1; break; + case 's': + smallMode = 1; break; + default: + if (isdigit((int)(*mode))) { + blockSize100k = *mode-BZ_HDR_0; + } + } + mode++; + } + strcat(mode2, writing ? "w" : "r" ); + strcat(mode2,"b"); /* binary mode */ + + if (open_mode==0) { + if (path==NULL || strcmp(path,"")==0) { + fp = (writing ? stdout : stdin); + SET_BINARY_MODE(fp); + } else { + fp = fopen(path,mode2); + } + } else { +#ifdef BZ_STRICT_ANSI + fp = NULL; +#else + fp = fdopen(fd,mode2); +#endif + } + if (fp == NULL) return NULL; + + if (writing) { + /* Guard against total chaos and anarchy -- JRS */ + if (blockSize100k < 1) blockSize100k = 1; + if (blockSize100k > 9) blockSize100k = 9; + bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, + verbosity,workFactor); + } else { + bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, + unused,nUnused); + } + if (bzfp == NULL) { + if (fp != stdin && fp != stdout) fclose(fp); + return NULL; + } + return bzfp; +} + + +/*---------------------------------------------------*/ +/*-- + open file for read or write. + ex) bzopen("file","w9") + case path="" or NULL => use stdin or stdout. +--*/ +BZFILE * BZ_API(BZ2_bzopen) + ( const char *path, + const char *mode ) +{ + return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); +} + + +/*---------------------------------------------------*/ +BZFILE * BZ_API(BZ2_bzdopen) + ( int fd, + const char *mode ) +{ + return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) +{ + int bzerr, nread; + if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; + nread = BZ2_bzRead(&bzerr,b,buf,len); + if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { + return nread; + } else { + return -1; + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) +{ + int bzerr; + + BZ2_bzWrite(&bzerr,b,buf,len); + if(bzerr == BZ_OK){ + return len; + }else{ + return -1; + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzflush) (BZFILE *b) +{ + /* do nothing now... */ + return 0; +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzclose) (BZFILE* b) +{ + int bzerr; + FILE *fp; + + if (b==NULL) {return;} + fp = ((bzFile *)b)->handle; + if(((bzFile*)b)->writing){ + BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); + if(bzerr != BZ_OK){ + BZ2_bzWriteClose(NULL,b,1,NULL,NULL); + } + }else{ + BZ2_bzReadClose(&bzerr,b); + } + if(fp!=stdin && fp!=stdout){ + fclose(fp); + } +} + + +/*---------------------------------------------------*/ +/*-- + return last error code +--*/ +static const char *bzerrorstrings[] = { + "OK" + ,"SEQUENCE_ERROR" + ,"PARAM_ERROR" + ,"MEM_ERROR" + ,"DATA_ERROR" + ,"DATA_ERROR_MAGIC" + ,"IO_ERROR" + ,"UNEXPECTED_EOF" + ,"OUTBUFF_FULL" + ,"CONFIG_ERROR" + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ +}; + + +const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) +{ + int err = ((bzFile *)b)->lastErr; + + if(err>0) err = 0; + *errnum = err; + return bzerrorstrings[err*-1]; +} +#endif + + +/*-------------------------------------------------------------*/ +/*--- end bzlib.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/bzlib.h b/src/ZipLib/extlibs/bzip2/bzlib.h new file mode 100644 index 00000000..8277123d --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzlib.h @@ -0,0 +1,282 @@ + +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +#ifndef BZ_NO_STDIO +/* Need a definitition for FILE */ +#include +#endif + +#ifdef _WIN32 +# include +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + +typedef void BZFILE; + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/bzlib_private.h b/src/ZipLib/extlibs/bzip2/bzlib_private.h new file mode 100644 index 00000000..5d0217f4 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/bzlib_private.h @@ -0,0 +1,509 @@ + +/*-------------------------------------------------------------*/ +/*--- Private header file for the library. ---*/ +/*--- bzlib_private.h ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_PRIVATE_H +#define _BZLIB_PRIVATE_H + +#include + +#ifndef BZ_NO_STDIO +#include +#include +#include +#endif + +#include "bzlib.h" + + + +/*-- General stuff. --*/ + +#define BZ_VERSION "1.0.6, 6-Sept-2010" + +typedef char Char; +typedef unsigned char Bool; +typedef unsigned char UChar; +typedef int Int32; +typedef unsigned int UInt32; +typedef short Int16; +typedef unsigned short UInt16; + +#define True ((Bool)1) +#define False ((Bool)0) + +#ifndef __GNUC__ +#define __inline__ /* */ +#endif + +#ifndef BZ_NO_STDIO + +extern void BZ2_bz__AssertH__fail ( int errcode ); +#define AssertH(cond,errcode) \ + { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } + +#if BZ_DEBUG +#define AssertD(cond,msg) \ + { if (!(cond)) { \ + fprintf ( stderr, \ + "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ + exit(1); \ + }} +#else +#define AssertD(cond,msg) /* */ +#endif + +#define VPrintf0(zf) \ + fprintf(stderr,zf) +#define VPrintf1(zf,za1) \ + fprintf(stderr,zf,za1) +#define VPrintf2(zf,za1,za2) \ + fprintf(stderr,zf,za1,za2) +#define VPrintf3(zf,za1,za2,za3) \ + fprintf(stderr,zf,za1,za2,za3) +#define VPrintf4(zf,za1,za2,za3,za4) \ + fprintf(stderr,zf,za1,za2,za3,za4) +#define VPrintf5(zf,za1,za2,za3,za4,za5) \ + fprintf(stderr,zf,za1,za2,za3,za4,za5) + +#else + +extern void bz_internal_error ( int errcode ); +#define AssertH(cond,errcode) \ + { if (!(cond)) bz_internal_error ( errcode ); } +#define AssertD(cond,msg) do { } while (0) +#define VPrintf0(zf) do { } while (0) +#define VPrintf1(zf,za1) do { } while (0) +#define VPrintf2(zf,za1,za2) do { } while (0) +#define VPrintf3(zf,za1,za2,za3) do { } while (0) +#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) +#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) + +#endif + + +#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) +#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) + + +/*-- Header bytes. --*/ + +#define BZ_HDR_B 0x42 /* 'B' */ +#define BZ_HDR_Z 0x5a /* 'Z' */ +#define BZ_HDR_h 0x68 /* 'h' */ +#define BZ_HDR_0 0x30 /* '0' */ + +/*-- Constants for the back end. --*/ + +#define BZ_MAX_ALPHA_SIZE 258 +#define BZ_MAX_CODE_LEN 23 + +#define BZ_RUNA 0 +#define BZ_RUNB 1 + +#define BZ_N_GROUPS 6 +#define BZ_G_SIZE 50 +#define BZ_N_ITERS 4 + +#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) + + + +/*-- Stuff for randomising repetitive blocks. --*/ + +extern Int32 BZ2_rNums[512]; + +#define BZ_RAND_DECLS \ + Int32 rNToGo; \ + Int32 rTPos \ + +#define BZ_RAND_INIT_MASK \ + s->rNToGo = 0; \ + s->rTPos = 0 \ + +#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) + +#define BZ_RAND_UPD_MASK \ + if (s->rNToGo == 0) { \ + s->rNToGo = BZ2_rNums[s->rTPos]; \ + s->rTPos++; \ + if (s->rTPos == 512) s->rTPos = 0; \ + } \ + s->rNToGo--; + + + +/*-- Stuff for doing CRCs. --*/ + +extern UInt32 BZ2_crc32Table[256]; + +#define BZ_INITIALISE_CRC(crcVar) \ +{ \ + crcVar = 0xffffffffL; \ +} + +#define BZ_FINALISE_CRC(crcVar) \ +{ \ + crcVar = ~(crcVar); \ +} + +#define BZ_UPDATE_CRC(crcVar,cha) \ +{ \ + crcVar = (crcVar << 8) ^ \ + BZ2_crc32Table[(crcVar >> 24) ^ \ + ((UChar)cha)]; \ +} + + + +/*-- States and modes for compression. --*/ + +#define BZ_M_IDLE 1 +#define BZ_M_RUNNING 2 +#define BZ_M_FLUSHING 3 +#define BZ_M_FINISHING 4 + +#define BZ_S_OUTPUT 1 +#define BZ_S_INPUT 2 + +#define BZ_N_RADIX 2 +#define BZ_N_QSORT 12 +#define BZ_N_SHELL 18 +#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) + + + + +/*-- Structure holding all the compression-side stuff. --*/ + +typedef + struct { + /* pointer back to the struct bz_stream */ + bz_stream* strm; + + /* mode this stream is in, and whether inputting */ + /* or outputting data */ + Int32 mode; + Int32 state; + + /* remembers avail_in when flush/finish requested */ + UInt32 avail_in_expect; + + /* for doing the block sorting */ + UInt32* arr1; + UInt32* arr2; + UInt32* ftab; + Int32 origPtr; + + /* aliases for arr1 and arr2 */ + UInt32* ptr; + UChar* block; + UInt16* mtfv; + UChar* zbits; + + /* for deciding when to use the fallback sorting algorithm */ + Int32 workFactor; + + /* run-length-encoding of the input */ + UInt32 state_in_ch; + Int32 state_in_len; + BZ_RAND_DECLS; + + /* input and output limits and current posns */ + Int32 nblock; + Int32 nblockMAX; + Int32 numZ; + Int32 state_out_pos; + + /* map of bytes used in block */ + Int32 nInUse; + Bool inUse[256]; + UChar unseqToSeq[256]; + + /* the buffer for bit stream creation */ + UInt32 bsBuff; + Int32 bsLive; + + /* block and combined CRCs */ + UInt32 blockCRC; + UInt32 combinedCRC; + + /* misc administratium */ + Int32 verbosity; + Int32 blockNo; + Int32 blockSize100k; + + /* stuff for coding the MTF values */ + Int32 nMTF; + Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; + UChar selector [BZ_MAX_SELECTORS]; + UChar selectorMtf[BZ_MAX_SELECTORS]; + + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + /* second dimension: only 3 needed; 4 makes index calculations faster */ + UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; + + } + EState; + + + +/*-- externs for compression. --*/ + +extern void +BZ2_blockSort ( EState* ); + +extern void +BZ2_compressBlock ( EState*, Bool ); + +extern void +BZ2_bsInitWrite ( EState* ); + +extern void +BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); + +extern void +BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); + + + +/*-- states for decompression. --*/ + +#define BZ_X_IDLE 1 +#define BZ_X_OUTPUT 2 + +#define BZ_X_MAGIC_1 10 +#define BZ_X_MAGIC_2 11 +#define BZ_X_MAGIC_3 12 +#define BZ_X_MAGIC_4 13 +#define BZ_X_BLKHDR_1 14 +#define BZ_X_BLKHDR_2 15 +#define BZ_X_BLKHDR_3 16 +#define BZ_X_BLKHDR_4 17 +#define BZ_X_BLKHDR_5 18 +#define BZ_X_BLKHDR_6 19 +#define BZ_X_BCRC_1 20 +#define BZ_X_BCRC_2 21 +#define BZ_X_BCRC_3 22 +#define BZ_X_BCRC_4 23 +#define BZ_X_RANDBIT 24 +#define BZ_X_ORIGPTR_1 25 +#define BZ_X_ORIGPTR_2 26 +#define BZ_X_ORIGPTR_3 27 +#define BZ_X_MAPPING_1 28 +#define BZ_X_MAPPING_2 29 +#define BZ_X_SELECTOR_1 30 +#define BZ_X_SELECTOR_2 31 +#define BZ_X_SELECTOR_3 32 +#define BZ_X_CODING_1 33 +#define BZ_X_CODING_2 34 +#define BZ_X_CODING_3 35 +#define BZ_X_MTF_1 36 +#define BZ_X_MTF_2 37 +#define BZ_X_MTF_3 38 +#define BZ_X_MTF_4 39 +#define BZ_X_MTF_5 40 +#define BZ_X_MTF_6 41 +#define BZ_X_ENDHDR_2 42 +#define BZ_X_ENDHDR_3 43 +#define BZ_X_ENDHDR_4 44 +#define BZ_X_ENDHDR_5 45 +#define BZ_X_ENDHDR_6 46 +#define BZ_X_CCRC_1 47 +#define BZ_X_CCRC_2 48 +#define BZ_X_CCRC_3 49 +#define BZ_X_CCRC_4 50 + + + +/*-- Constants for the fast MTF decoder. --*/ + +#define MTFA_SIZE 4096 +#define MTFL_SIZE 16 + + + +/*-- Structure holding all the decompression-side stuff. --*/ + +typedef + struct { + /* pointer back to the struct bz_stream */ + bz_stream* strm; + + /* state indicator for this stream */ + Int32 state; + + /* for doing the final run-length decoding */ + UChar state_out_ch; + Int32 state_out_len; + Bool blockRandomised; + BZ_RAND_DECLS; + + /* the buffer for bit stream reading */ + UInt32 bsBuff; + Int32 bsLive; + + /* misc administratium */ + Int32 blockSize100k; + Bool smallDecompress; + Int32 currBlockNo; + Int32 verbosity; + + /* for undoing the Burrows-Wheeler transform */ + Int32 origPtr; + UInt32 tPos; + Int32 k0; + Int32 unzftab[256]; + Int32 nblock_used; + Int32 cftab[257]; + Int32 cftabCopy[257]; + + /* for undoing the Burrows-Wheeler transform (FAST) */ + UInt32 *tt; + + /* for undoing the Burrows-Wheeler transform (SMALL) */ + UInt16 *ll16; + UChar *ll4; + + /* stored and calculated CRCs */ + UInt32 storedBlockCRC; + UInt32 storedCombinedCRC; + UInt32 calculatedBlockCRC; + UInt32 calculatedCombinedCRC; + + /* map of bytes used in block */ + Int32 nInUse; + Bool inUse[256]; + Bool inUse16[16]; + UChar seqToUnseq[256]; + + /* for decoding the MTF values */ + UChar mtfa [MTFA_SIZE]; + Int32 mtfbase[256 / MTFL_SIZE]; + UChar selector [BZ_MAX_SELECTORS]; + UChar selectorMtf[BZ_MAX_SELECTORS]; + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + + Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 minLens[BZ_N_GROUPS]; + + /* save area for scalars in the main decompress code */ + Int32 save_i; + Int32 save_j; + Int32 save_t; + Int32 save_alphaSize; + Int32 save_nGroups; + Int32 save_nSelectors; + Int32 save_EOB; + Int32 save_groupNo; + Int32 save_groupPos; + Int32 save_nextSym; + Int32 save_nblockMAX; + Int32 save_nblock; + Int32 save_es; + Int32 save_N; + Int32 save_curr; + Int32 save_zt; + Int32 save_zn; + Int32 save_zvec; + Int32 save_zj; + Int32 save_gSel; + Int32 save_gMinlen; + Int32* save_gLimit; + Int32* save_gBase; + Int32* save_gPerm; + + } + DState; + + + +/*-- Macros for decompression. --*/ + +#define BZ_GET_FAST(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + s->tPos = s->tt[s->tPos]; \ + cccc = (UChar)(s->tPos & 0xff); \ + s->tPos >>= 8; + +#define BZ_GET_FAST_C(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ + c_tPos = c_tt[c_tPos]; \ + cccc = (UChar)(c_tPos & 0xff); \ + c_tPos >>= 8; + +#define SET_LL4(i,n) \ + { if (((i) & 0x1) == 0) \ + s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ + s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ + } + +#define GET_LL4(i) \ + ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) + +#define SET_LL(i,n) \ + { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ + SET_LL4(i, n >> 16); \ + } + +#define GET_LL(i) \ + (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) + +#define BZ_GET_SMALL(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ + s->tPos = GET_LL(s->tPos); + + +/*-- externs for decompression. --*/ + +extern Int32 +BZ2_indexIntoF ( Int32, Int32* ); + +extern Int32 +BZ2_decompress ( DState* ); + +extern void +BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, + Int32, Int32, Int32 ); + + +#endif + + +/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ + +#ifdef BZ_NO_STDIO +#ifndef NULL +#define NULL 0 +#endif +#endif + + +/*-------------------------------------------------------------*/ +/*--- end bzlib_private.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/compress.c b/src/ZipLib/extlibs/bzip2/compress.c new file mode 100644 index 00000000..caf76960 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/compress.c @@ -0,0 +1,672 @@ + +/*-------------------------------------------------------------*/ +/*--- Compression machinery (not incl block sorting) ---*/ +/*--- compress.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +/* CHANGES + 0.9.0 -- original version. + 0.9.0a/b -- no changes in this file. + 0.9.0c -- changed setting of nGroups in sendMTFValues() + so as to do a bit better on small files +*/ + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +/*--- Bit stream I/O ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +void BZ2_bsInitWrite ( EState* s ) +{ + s->bsLive = 0; + s->bsBuff = 0; +} + + +/*---------------------------------------------------*/ +static +void bsFinishWrite ( EState* s ) +{ + while (s->bsLive > 0) { + s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); + s->numZ++; + s->bsBuff <<= 8; + s->bsLive -= 8; + } +} + + +/*---------------------------------------------------*/ +#define bsNEEDW(nz) \ +{ \ + while (s->bsLive >= 8) { \ + s->zbits[s->numZ] \ + = (UChar)(s->bsBuff >> 24); \ + s->numZ++; \ + s->bsBuff <<= 8; \ + s->bsLive -= 8; \ + } \ +} + + +/*---------------------------------------------------*/ +static +__inline__ +void bsW ( EState* s, Int32 n, UInt32 v ) +{ + bsNEEDW ( n ); + s->bsBuff |= (v << (32 - s->bsLive - n)); + s->bsLive += n; +} + + +/*---------------------------------------------------*/ +static +void bsPutUInt32 ( EState* s, UInt32 u ) +{ + bsW ( s, 8, (u >> 24) & 0xffL ); + bsW ( s, 8, (u >> 16) & 0xffL ); + bsW ( s, 8, (u >> 8) & 0xffL ); + bsW ( s, 8, u & 0xffL ); +} + + +/*---------------------------------------------------*/ +static +void bsPutUChar ( EState* s, UChar c ) +{ + bsW( s, 8, (UInt32)c ); +} + + +/*---------------------------------------------------*/ +/*--- The back end proper ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +static +void makeMaps_e ( EState* s ) +{ + Int32 i; + s->nInUse = 0; + for (i = 0; i < 256; i++) + if (s->inUse[i]) { + s->unseqToSeq[i] = s->nInUse; + s->nInUse++; + } +} + + +/*---------------------------------------------------*/ +static +void generateMTFValues ( EState* s ) +{ + UChar yy[256]; + Int32 i, j; + Int32 zPend; + Int32 wr; + Int32 EOB; + + /* + After sorting (eg, here), + s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, + and + ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] + holds the original block data. + + The first thing to do is generate the MTF values, + and put them in + ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. + Because there are strictly fewer or equal MTF values + than block values, ptr values in this area are overwritten + with MTF values only when they are no longer needed. + + The final compressed bitstream is generated into the + area starting at + (UChar*) (&((UChar*)s->arr2)[s->nblock]) + + These storage aliases are set up in bzCompressInit(), + except for the last one, which is arranged in + compressBlock(). + */ + UInt32* ptr = s->ptr; + UChar* block = s->block; + UInt16* mtfv = s->mtfv; + + makeMaps_e ( s ); + EOB = s->nInUse+1; + + for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; + + wr = 0; + zPend = 0; + for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; + + for (i = 0; i < s->nblock; i++) { + UChar ll_i; + AssertD ( wr <= i, "generateMTFValues(1)" ); + j = ptr[i]-1; if (j < 0) j += s->nblock; + ll_i = s->unseqToSeq[block[j]]; + AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); + + if (yy[0] == ll_i) { + zPend++; + } else { + + if (zPend > 0) { + zPend--; + while (True) { + if (zPend & 1) { + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; + } else { + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; + } + if (zPend < 2) break; + zPend = (zPend - 2) / 2; + }; + zPend = 0; + } + { + register UChar rtmp; + register UChar* ryy_j; + register UChar rll_i; + rtmp = yy[1]; + yy[1] = yy[0]; + ryy_j = &(yy[1]); + rll_i = ll_i; + while ( rll_i != rtmp ) { + register UChar rtmp2; + ryy_j++; + rtmp2 = rtmp; + rtmp = *ryy_j; + *ryy_j = rtmp2; + }; + yy[0] = rtmp; + j = ryy_j - &(yy[0]); + mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; + } + + } + } + + if (zPend > 0) { + zPend--; + while (True) { + if (zPend & 1) { + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; + } else { + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; + } + if (zPend < 2) break; + zPend = (zPend - 2) / 2; + }; + zPend = 0; + } + + mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; + + s->nMTF = wr; +} + + +/*---------------------------------------------------*/ +#define BZ_LESSER_ICOST 0 +#define BZ_GREATER_ICOST 15 + +static +void sendMTFValues ( EState* s ) +{ + Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; + Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; + Int32 nGroups, nBytes; + + /*-- + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + is a global since the decoder also needs it. + + Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + are also globals only used in this proc. + Made global to keep stack frame size small. + --*/ + + + UInt16 cost[BZ_N_GROUPS]; + Int32 fave[BZ_N_GROUPS]; + + UInt16* mtfv = s->mtfv; + + if (s->verbosity >= 3) + VPrintf3( " %d in block, %d after MTF & 1-2 coding, " + "%d+2 syms in use\n", + s->nblock, s->nMTF, s->nInUse ); + + alphaSize = s->nInUse+2; + for (t = 0; t < BZ_N_GROUPS; t++) + for (v = 0; v < alphaSize; v++) + s->len[t][v] = BZ_GREATER_ICOST; + + /*--- Decide how many coding tables to use ---*/ + AssertH ( s->nMTF > 0, 3001 ); + if (s->nMTF < 200) nGroups = 2; else + if (s->nMTF < 600) nGroups = 3; else + if (s->nMTF < 1200) nGroups = 4; else + if (s->nMTF < 2400) nGroups = 5; else + nGroups = 6; + + /*--- Generate an initial set of coding tables ---*/ + { + Int32 nPart, remF, tFreq, aFreq; + + nPart = nGroups; + remF = s->nMTF; + gs = 0; + while (nPart > 0) { + tFreq = remF / nPart; + ge = gs-1; + aFreq = 0; + while (aFreq < tFreq && ge < alphaSize-1) { + ge++; + aFreq += s->mtfFreq[ge]; + } + + if (ge > gs + && nPart != nGroups && nPart != 1 + && ((nGroups-nPart) % 2 == 1)) { + aFreq -= s->mtfFreq[ge]; + ge--; + } + + if (s->verbosity >= 3) + VPrintf5( " initial group %d, [%d .. %d], " + "has %d syms (%4.1f%%)\n", + nPart, gs, ge, aFreq, + (100.0 * (float)aFreq) / (float)(s->nMTF) ); + + for (v = 0; v < alphaSize; v++) + if (v >= gs && v <= ge) + s->len[nPart-1][v] = BZ_LESSER_ICOST; else + s->len[nPart-1][v] = BZ_GREATER_ICOST; + + nPart--; + gs = ge+1; + remF -= aFreq; + } + } + + /*--- + Iterate up to BZ_N_ITERS times to improve the tables. + ---*/ + for (iter = 0; iter < BZ_N_ITERS; iter++) { + + for (t = 0; t < nGroups; t++) fave[t] = 0; + + for (t = 0; t < nGroups; t++) + for (v = 0; v < alphaSize; v++) + s->rfreq[t][v] = 0; + + /*--- + Set up an auxiliary length table which is used to fast-track + the common case (nGroups == 6). + ---*/ + if (nGroups == 6) { + for (v = 0; v < alphaSize; v++) { + s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; + s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; + s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; + } + } + + nSelectors = 0; + totc = 0; + gs = 0; + while (True) { + + /*--- Set group start & end marks. --*/ + if (gs >= s->nMTF) break; + ge = gs + BZ_G_SIZE - 1; + if (ge >= s->nMTF) ge = s->nMTF-1; + + /*-- + Calculate the cost of this group as coded + by each of the coding tables. + --*/ + for (t = 0; t < nGroups; t++) cost[t] = 0; + + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + register UInt32 cost01, cost23, cost45; + register UInt16 icv; + cost01 = cost23 = cost45 = 0; + +# define BZ_ITER(nn) \ + icv = mtfv[gs+(nn)]; \ + cost01 += s->len_pack[icv][0]; \ + cost23 += s->len_pack[icv][1]; \ + cost45 += s->len_pack[icv][2]; \ + + BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); + BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); + BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); + BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); + BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); + BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); + BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); + BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); + BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); + BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); + +# undef BZ_ITER + + cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; + cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; + cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { + UInt16 icv = mtfv[i]; + for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; + } + } + + /*-- + Find the coding table which is best for this group, + and record its identity in the selector table. + --*/ + bc = 999999999; bt = -1; + for (t = 0; t < nGroups; t++) + if (cost[t] < bc) { bc = cost[t]; bt = t; }; + totc += bc; + fave[bt]++; + s->selector[nSelectors] = bt; + nSelectors++; + + /*-- + Increment the symbol frequencies for the selected table. + --*/ + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + +# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ + + BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); + BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); + BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); + BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); + BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); + BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); + BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); + BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); + BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); + BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); + +# undef BZ_ITUR + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) + s->rfreq[bt][ mtfv[i] ]++; + } + + gs = ge+1; + } + if (s->verbosity >= 3) { + VPrintf2 ( " pass %d: size is %d, grp uses are ", + iter+1, totc/8 ); + for (t = 0; t < nGroups; t++) + VPrintf1 ( "%d ", fave[t] ); + VPrintf0 ( "\n" ); + } + + /*-- + Recompute the tables based on the accumulated frequencies. + --*/ + /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See + comment in huffman.c for details. */ + for (t = 0; t < nGroups; t++) + BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), + alphaSize, 17 /*20*/ ); + } + + + AssertH( nGroups < 8, 3002 ); + AssertH( nSelectors < 32768 && + nSelectors <= (2 + (900000 / BZ_G_SIZE)), + 3003 ); + + + /*--- Compute MTF values for the selectors. ---*/ + { + UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; + for (i = 0; i < nGroups; i++) pos[i] = i; + for (i = 0; i < nSelectors; i++) { + ll_i = s->selector[i]; + j = 0; + tmp = pos[j]; + while ( ll_i != tmp ) { + j++; + tmp2 = tmp; + tmp = pos[j]; + pos[j] = tmp2; + }; + pos[0] = tmp; + s->selectorMtf[i] = j; + } + }; + + /*--- Assign actual codes for the tables. --*/ + for (t = 0; t < nGroups; t++) { + minLen = 32; + maxLen = 0; + for (i = 0; i < alphaSize; i++) { + if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; + if (s->len[t][i] < minLen) minLen = s->len[t][i]; + } + AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); + AssertH ( !(minLen < 1), 3005 ); + BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), + minLen, maxLen, alphaSize ); + } + + /*--- Transmit the mapping table. ---*/ + { + Bool inUse16[16]; + for (i = 0; i < 16; i++) { + inUse16[i] = False; + for (j = 0; j < 16; j++) + if (s->inUse[i * 16 + j]) inUse16[i] = True; + } + + nBytes = s->numZ; + for (i = 0; i < 16; i++) + if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); + + for (i = 0; i < 16; i++) + if (inUse16[i]) + for (j = 0; j < 16; j++) { + if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); + } + + if (s->verbosity >= 3) + VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); + } + + /*--- Now the selectors. ---*/ + nBytes = s->numZ; + bsW ( s, 3, nGroups ); + bsW ( s, 15, nSelectors ); + for (i = 0; i < nSelectors; i++) { + for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); + bsW(s,1,0); + } + if (s->verbosity >= 3) + VPrintf1( "selectors %d, ", s->numZ-nBytes ); + + /*--- Now the coding tables. ---*/ + nBytes = s->numZ; + + for (t = 0; t < nGroups; t++) { + Int32 curr = s->len[t][0]; + bsW ( s, 5, curr ); + for (i = 0; i < alphaSize; i++) { + while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; + while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; + bsW ( s, 1, 0 ); + } + } + + if (s->verbosity >= 3) + VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); + + /*--- And finally, the block data proper ---*/ + nBytes = s->numZ; + selCtr = 0; + gs = 0; + while (True) { + if (gs >= s->nMTF) break; + ge = gs + BZ_G_SIZE - 1; + if (ge >= s->nMTF) ge = s->nMTF-1; + AssertH ( s->selector[selCtr] < nGroups, 3006 ); + + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + UInt16 mtfv_i; + UChar* s_len_sel_selCtr + = &(s->len[s->selector[selCtr]][0]); + Int32* s_code_sel_selCtr + = &(s->code[s->selector[selCtr]][0]); + +# define BZ_ITAH(nn) \ + mtfv_i = mtfv[gs+(nn)]; \ + bsW ( s, \ + s_len_sel_selCtr[mtfv_i], \ + s_code_sel_selCtr[mtfv_i] ) + + BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); + BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); + BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); + BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); + BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); + BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); + BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); + BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); + BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); + BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); + +# undef BZ_ITAH + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { + bsW ( s, + s->len [s->selector[selCtr]] [mtfv[i]], + s->code [s->selector[selCtr]] [mtfv[i]] ); + } + } + + + gs = ge+1; + selCtr++; + } + AssertH( selCtr == nSelectors, 3007 ); + + if (s->verbosity >= 3) + VPrintf1( "codes %d\n", s->numZ-nBytes ); +} + + +/*---------------------------------------------------*/ +void BZ2_compressBlock ( EState* s, Bool is_last_block ) +{ + if (s->nblock > 0) { + + BZ_FINALISE_CRC ( s->blockCRC ); + s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); + s->combinedCRC ^= s->blockCRC; + if (s->blockNo > 1) s->numZ = 0; + + if (s->verbosity >= 2) + VPrintf4( " block %d: crc = 0x%08x, " + "combined CRC = 0x%08x, size = %d\n", + s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); + + BZ2_blockSort ( s ); + } + + s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); + + /*-- If this is the first block, create the stream header. --*/ + if (s->blockNo == 1) { + BZ2_bsInitWrite ( s ); + bsPutUChar ( s, BZ_HDR_B ); + bsPutUChar ( s, BZ_HDR_Z ); + bsPutUChar ( s, BZ_HDR_h ); + bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) ); + } + + if (s->nblock > 0) { + + bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); + bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); + bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); + + /*-- Now the block's CRC, so it is in a known place. --*/ + bsPutUInt32 ( s, s->blockCRC ); + + /*-- + Now a single bit indicating (non-)randomisation. + As of version 0.9.5, we use a better sorting algorithm + which makes randomisation unnecessary. So always set + the randomised bit to 'no'. Of course, the decoder + still needs to be able to handle randomised blocks + so as to maintain backwards compatibility with + older versions of bzip2. + --*/ + bsW(s,1,0); + + bsW ( s, 24, s->origPtr ); + generateMTFValues ( s ); + sendMTFValues ( s ); + } + + + /*-- If this is the last block, add the stream trailer. --*/ + if (is_last_block) { + + bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); + bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); + bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); + bsPutUInt32 ( s, s->combinedCRC ); + if (s->verbosity >= 2) + VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); + bsFinishWrite ( s ); + } +} + + +/*-------------------------------------------------------------*/ +/*--- end compress.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/crctable.c b/src/ZipLib/extlibs/bzip2/crctable.c new file mode 100644 index 00000000..1fea7e94 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/crctable.c @@ -0,0 +1,104 @@ + +/*-------------------------------------------------------------*/ +/*--- Table for doing CRCs ---*/ +/*--- crctable.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*-- + I think this is an implementation of the AUTODIN-II, + Ethernet & FDDI 32-bit CRC standard. Vaguely derived + from code by Rob Warnock, in Section 51 of the + comp.compression FAQ. +--*/ + +UInt32 BZ2_crc32Table[256] = { + + /*-- Ugly, innit? --*/ + + 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, + 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, + 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, + 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, + 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, + 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, + 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, + 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, + 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, + 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, + 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, + 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, + 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, + 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, + 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, + 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, + 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, + 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, + 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, + 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, + 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, + 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, + 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, + 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, + 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, + 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, + 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, + 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, + 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, + 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, + 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, + 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, + 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, + 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, + 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, + 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, + 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, + 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, + 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, + 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, + 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, + 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, + 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, + 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, + 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, + 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, + 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, + 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, + 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, + 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, + 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, + 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, + 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, + 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, + 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, + 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, + 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, + 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, + 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, + 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, + 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, + 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, + 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, + 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L +}; + + +/*-------------------------------------------------------------*/ +/*--- end crctable.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/decompress.c b/src/ZipLib/extlibs/bzip2/decompress.c new file mode 100644 index 00000000..311f5668 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/decompress.c @@ -0,0 +1,646 @@ + +/*-------------------------------------------------------------*/ +/*--- Decompression machinery ---*/ +/*--- decompress.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +static +void makeMaps_d ( DState* s ) +{ + Int32 i; + s->nInUse = 0; + for (i = 0; i < 256; i++) + if (s->inUse[i]) { + s->seqToUnseq[s->nInUse] = i; + s->nInUse++; + } +} + + +/*---------------------------------------------------*/ +#define RETURN(rrr) \ + { retVal = rrr; goto save_state_and_return; }; + +#define GET_BITS(lll,vvv,nnn) \ + case lll: s->state = lll; \ + while (True) { \ + if (s->bsLive >= nnn) { \ + UInt32 v; \ + v = (s->bsBuff >> \ + (s->bsLive-nnn)) & ((1 << nnn)-1); \ + s->bsLive -= nnn; \ + vvv = v; \ + break; \ + } \ + if (s->strm->avail_in == 0) RETURN(BZ_OK); \ + s->bsBuff \ + = (s->bsBuff << 8) | \ + ((UInt32) \ + (*((UChar*)(s->strm->next_in)))); \ + s->bsLive += 8; \ + s->strm->next_in++; \ + s->strm->avail_in--; \ + s->strm->total_in_lo32++; \ + if (s->strm->total_in_lo32 == 0) \ + s->strm->total_in_hi32++; \ + } + +#define GET_UCHAR(lll,uuu) \ + GET_BITS(lll,uuu,8) + +#define GET_BIT(lll,uuu) \ + GET_BITS(lll,uuu,1) + +/*---------------------------------------------------*/ +#define GET_MTF_VAL(label1,label2,lval) \ +{ \ + if (groupPos == 0) { \ + groupNo++; \ + if (groupNo >= nSelectors) \ + RETURN(BZ_DATA_ERROR); \ + groupPos = BZ_G_SIZE; \ + gSel = s->selector[groupNo]; \ + gMinlen = s->minLens[gSel]; \ + gLimit = &(s->limit[gSel][0]); \ + gPerm = &(s->perm[gSel][0]); \ + gBase = &(s->base[gSel][0]); \ + } \ + groupPos--; \ + zn = gMinlen; \ + GET_BITS(label1, zvec, zn); \ + while (1) { \ + if (zn > 20 /* the longest code */) \ + RETURN(BZ_DATA_ERROR); \ + if (zvec <= gLimit[zn]) break; \ + zn++; \ + GET_BIT(label2, zj); \ + zvec = (zvec << 1) | zj; \ + }; \ + if (zvec - gBase[zn] < 0 \ + || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ + RETURN(BZ_DATA_ERROR); \ + lval = gPerm[zvec - gBase[zn]]; \ +} + + +/*---------------------------------------------------*/ +Int32 BZ2_decompress ( DState* s ) +{ + UChar uc; + Int32 retVal; + Int32 minLen, maxLen; + bz_stream* strm = s->strm; + + /* stuff that needs to be saved/restored */ + Int32 i; + Int32 j; + Int32 t; + Int32 alphaSize; + Int32 nGroups; + Int32 nSelectors; + Int32 EOB; + Int32 groupNo; + Int32 groupPos; + Int32 nextSym; + Int32 nblockMAX; + Int32 nblock; + Int32 es; + Int32 N; + Int32 curr; + Int32 zt; + Int32 zn; + Int32 zvec; + Int32 zj; + Int32 gSel; + Int32 gMinlen; + Int32* gLimit; + Int32* gBase; + Int32* gPerm; + + if (s->state == BZ_X_MAGIC_1) { + /*initialise the save area*/ + s->save_i = 0; + s->save_j = 0; + s->save_t = 0; + s->save_alphaSize = 0; + s->save_nGroups = 0; + s->save_nSelectors = 0; + s->save_EOB = 0; + s->save_groupNo = 0; + s->save_groupPos = 0; + s->save_nextSym = 0; + s->save_nblockMAX = 0; + s->save_nblock = 0; + s->save_es = 0; + s->save_N = 0; + s->save_curr = 0; + s->save_zt = 0; + s->save_zn = 0; + s->save_zvec = 0; + s->save_zj = 0; + s->save_gSel = 0; + s->save_gMinlen = 0; + s->save_gLimit = NULL; + s->save_gBase = NULL; + s->save_gPerm = NULL; + } + + /*restore from the save area*/ + i = s->save_i; + j = s->save_j; + t = s->save_t; + alphaSize = s->save_alphaSize; + nGroups = s->save_nGroups; + nSelectors = s->save_nSelectors; + EOB = s->save_EOB; + groupNo = s->save_groupNo; + groupPos = s->save_groupPos; + nextSym = s->save_nextSym; + nblockMAX = s->save_nblockMAX; + nblock = s->save_nblock; + es = s->save_es; + N = s->save_N; + curr = s->save_curr; + zt = s->save_zt; + zn = s->save_zn; + zvec = s->save_zvec; + zj = s->save_zj; + gSel = s->save_gSel; + gMinlen = s->save_gMinlen; + gLimit = s->save_gLimit; + gBase = s->save_gBase; + gPerm = s->save_gPerm; + + retVal = BZ_OK; + + switch (s->state) { + + GET_UCHAR(BZ_X_MAGIC_1, uc); + if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_UCHAR(BZ_X_MAGIC_2, uc); + if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_UCHAR(BZ_X_MAGIC_3, uc) + if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) + if (s->blockSize100k < (BZ_HDR_0 + 1) || + s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); + s->blockSize100k -= BZ_HDR_0; + + if (s->smallDecompress) { + s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); + s->ll4 = BZALLOC( + ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) + ); + if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); + } else { + s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); + if (s->tt == NULL) RETURN(BZ_MEM_ERROR); + } + + GET_UCHAR(BZ_X_BLKHDR_1, uc); + + if (uc == 0x17) goto endhdr_2; + if (uc != 0x31) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_2, uc); + if (uc != 0x41) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_3, uc); + if (uc != 0x59) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_4, uc); + if (uc != 0x26) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_5, uc); + if (uc != 0x53) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_6, uc); + if (uc != 0x59) RETURN(BZ_DATA_ERROR); + + s->currBlockNo++; + if (s->verbosity >= 2) + VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); + + s->storedBlockCRC = 0; + GET_UCHAR(BZ_X_BCRC_1, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_2, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_3, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_4, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + + GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); + + s->origPtr = 0; + GET_UCHAR(BZ_X_ORIGPTR_1, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + GET_UCHAR(BZ_X_ORIGPTR_2, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + GET_UCHAR(BZ_X_ORIGPTR_3, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + + if (s->origPtr < 0) + RETURN(BZ_DATA_ERROR); + if (s->origPtr > 10 + 100000*s->blockSize100k) + RETURN(BZ_DATA_ERROR); + + /*--- Receive the mapping table ---*/ + for (i = 0; i < 16; i++) { + GET_BIT(BZ_X_MAPPING_1, uc); + if (uc == 1) + s->inUse16[i] = True; else + s->inUse16[i] = False; + } + + for (i = 0; i < 256; i++) s->inUse[i] = False; + + for (i = 0; i < 16; i++) + if (s->inUse16[i]) + for (j = 0; j < 16; j++) { + GET_BIT(BZ_X_MAPPING_2, uc); + if (uc == 1) s->inUse[i * 16 + j] = True; + } + makeMaps_d ( s ); + if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); + alphaSize = s->nInUse+2; + + /*--- Now the selectors ---*/ + GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); + if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); + GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); + if (nSelectors < 1) RETURN(BZ_DATA_ERROR); + for (i = 0; i < nSelectors; i++) { + j = 0; + while (True) { + GET_BIT(BZ_X_SELECTOR_3, uc); + if (uc == 0) break; + j++; + if (j >= nGroups) RETURN(BZ_DATA_ERROR); + } + s->selectorMtf[i] = j; + } + + /*--- Undo the MTF values for the selectors. ---*/ + { + UChar pos[BZ_N_GROUPS], tmp, v; + for (v = 0; v < nGroups; v++) pos[v] = v; + + for (i = 0; i < nSelectors; i++) { + v = s->selectorMtf[i]; + tmp = pos[v]; + while (v > 0) { pos[v] = pos[v-1]; v--; } + pos[0] = tmp; + s->selector[i] = tmp; + } + } + + /*--- Now the coding tables ---*/ + for (t = 0; t < nGroups; t++) { + GET_BITS(BZ_X_CODING_1, curr, 5); + for (i = 0; i < alphaSize; i++) { + while (True) { + if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); + GET_BIT(BZ_X_CODING_2, uc); + if (uc == 0) break; + GET_BIT(BZ_X_CODING_3, uc); + if (uc == 0) curr++; else curr--; + } + s->len[t][i] = curr; + } + } + + /*--- Create the Huffman decoding tables ---*/ + for (t = 0; t < nGroups; t++) { + minLen = 32; + maxLen = 0; + for (i = 0; i < alphaSize; i++) { + if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; + if (s->len[t][i] < minLen) minLen = s->len[t][i]; + } + BZ2_hbCreateDecodeTables ( + &(s->limit[t][0]), + &(s->base[t][0]), + &(s->perm[t][0]), + &(s->len[t][0]), + minLen, maxLen, alphaSize + ); + s->minLens[t] = minLen; + } + + /*--- Now the MTF values ---*/ + + EOB = s->nInUse+1; + nblockMAX = 100000 * s->blockSize100k; + groupNo = -1; + groupPos = 0; + + for (i = 0; i <= 255; i++) s->unzftab[i] = 0; + + /*-- MTF init --*/ + { + Int32 ii, jj, kk; + kk = MTFA_SIZE-1; + for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { + for (jj = MTFL_SIZE-1; jj >= 0; jj--) { + s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); + kk--; + } + s->mtfbase[ii] = kk + 1; + } + } + /*-- end MTF init --*/ + + nblock = 0; + GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); + + while (True) { + + if (nextSym == EOB) break; + + if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { + + es = -1; + N = 1; + do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); + if (nextSym == BZ_RUNA) es = es + (0+1) * N; else + if (nextSym == BZ_RUNB) es = es + (1+1) * N; + N = N * 2; + GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); + } + while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); + + es++; + uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; + s->unzftab[uc] += es; + + if (s->smallDecompress) + while (es > 0) { + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + s->ll16[nblock] = (UInt16)uc; + nblock++; + es--; + } + else + while (es > 0) { + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + s->tt[nblock] = (UInt32)uc; + nblock++; + es--; + }; + + continue; + + } else { + + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + + /*-- uc = MTF ( nextSym-1 ) --*/ + { + Int32 ii, jj, kk, pp, lno, off; + UInt32 nn; + nn = (UInt32)(nextSym - 1); + + if (nn < MTFL_SIZE) { + /* avoid general-case expense */ + pp = s->mtfbase[0]; + uc = s->mtfa[pp+nn]; + while (nn > 3) { + Int32 z = pp+nn; + s->mtfa[(z) ] = s->mtfa[(z)-1]; + s->mtfa[(z)-1] = s->mtfa[(z)-2]; + s->mtfa[(z)-2] = s->mtfa[(z)-3]; + s->mtfa[(z)-3] = s->mtfa[(z)-4]; + nn -= 4; + } + while (nn > 0) { + s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; + }; + s->mtfa[pp] = uc; + } else { + /* general case */ + lno = nn / MTFL_SIZE; + off = nn % MTFL_SIZE; + pp = s->mtfbase[lno] + off; + uc = s->mtfa[pp]; + while (pp > s->mtfbase[lno]) { + s->mtfa[pp] = s->mtfa[pp-1]; pp--; + }; + s->mtfbase[lno]++; + while (lno > 0) { + s->mtfbase[lno]--; + s->mtfa[s->mtfbase[lno]] + = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; + lno--; + } + s->mtfbase[0]--; + s->mtfa[s->mtfbase[0]] = uc; + if (s->mtfbase[0] == 0) { + kk = MTFA_SIZE-1; + for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { + for (jj = MTFL_SIZE-1; jj >= 0; jj--) { + s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; + kk--; + } + s->mtfbase[ii] = kk + 1; + } + } + } + } + /*-- end uc = MTF ( nextSym-1 ) --*/ + + s->unzftab[s->seqToUnseq[uc]]++; + if (s->smallDecompress) + s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else + s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); + nblock++; + + GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); + continue; + } + } + + /* Now we know what nblock is, we can do a better sanity + check on s->origPtr. + */ + if (s->origPtr < 0 || s->origPtr >= nblock) + RETURN(BZ_DATA_ERROR); + + /*-- Set up cftab to facilitate generation of T^(-1) --*/ + /* Check: unzftab entries in range. */ + for (i = 0; i <= 255; i++) { + if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) + RETURN(BZ_DATA_ERROR); + } + /* Actually generate cftab. */ + s->cftab[0] = 0; + for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; + for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; + /* Check: cftab entries in range. */ + for (i = 0; i <= 256; i++) { + if (s->cftab[i] < 0 || s->cftab[i] > nblock) { + /* s->cftab[i] can legitimately be == nblock */ + RETURN(BZ_DATA_ERROR); + } + } + /* Check: cftab entries non-descending. */ + for (i = 1; i <= 256; i++) { + if (s->cftab[i-1] > s->cftab[i]) { + RETURN(BZ_DATA_ERROR); + } + } + + s->state_out_len = 0; + s->state_out_ch = 0; + BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); + s->state = BZ_X_OUTPUT; + if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); + + if (s->smallDecompress) { + + /*-- Make a copy of cftab, used in generation of T --*/ + for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; + + /*-- compute the T vector --*/ + for (i = 0; i < nblock; i++) { + uc = (UChar)(s->ll16[i]); + SET_LL(i, s->cftabCopy[uc]); + s->cftabCopy[uc]++; + } + + /*-- Compute T^(-1) by pointer reversal on T --*/ + i = s->origPtr; + j = GET_LL(i); + do { + Int32 tmp = GET_LL(j); + SET_LL(j, i); + i = j; + j = tmp; + } + while (i != s->origPtr); + + s->tPos = s->origPtr; + s->nblock_used = 0; + if (s->blockRandomised) { + BZ_RAND_INIT_MASK; + BZ_GET_SMALL(s->k0); s->nblock_used++; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + } else { + BZ_GET_SMALL(s->k0); s->nblock_used++; + } + + } else { + + /*-- compute the T^(-1) vector --*/ + for (i = 0; i < nblock; i++) { + uc = (UChar)(s->tt[i] & 0xff); + s->tt[s->cftab[uc]] |= (i << 8); + s->cftab[uc]++; + } + + s->tPos = s->tt[s->origPtr] >> 8; + s->nblock_used = 0; + if (s->blockRandomised) { + BZ_RAND_INIT_MASK; + BZ_GET_FAST(s->k0); s->nblock_used++; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + } else { + BZ_GET_FAST(s->k0); s->nblock_used++; + } + + } + + RETURN(BZ_OK); + + + + endhdr_2: + + GET_UCHAR(BZ_X_ENDHDR_2, uc); + if (uc != 0x72) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_3, uc); + if (uc != 0x45) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_4, uc); + if (uc != 0x38) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_5, uc); + if (uc != 0x50) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_6, uc); + if (uc != 0x90) RETURN(BZ_DATA_ERROR); + + s->storedCombinedCRC = 0; + GET_UCHAR(BZ_X_CCRC_1, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_2, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_3, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_4, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + + s->state = BZ_X_IDLE; + RETURN(BZ_STREAM_END); + + default: AssertH ( False, 4001 ); + } + + AssertH ( False, 4002 ); + + save_state_and_return: + + s->save_i = i; + s->save_j = j; + s->save_t = t; + s->save_alphaSize = alphaSize; + s->save_nGroups = nGroups; + s->save_nSelectors = nSelectors; + s->save_EOB = EOB; + s->save_groupNo = groupNo; + s->save_groupPos = groupPos; + s->save_nextSym = nextSym; + s->save_nblockMAX = nblockMAX; + s->save_nblock = nblock; + s->save_es = es; + s->save_N = N; + s->save_curr = curr; + s->save_zt = zt; + s->save_zn = zn; + s->save_zvec = zvec; + s->save_zj = zj; + s->save_gSel = gSel; + s->save_gMinlen = gMinlen; + s->save_gLimit = gLimit; + s->save_gBase = gBase; + s->save_gPerm = gPerm; + + return retVal; +} + + +/*-------------------------------------------------------------*/ +/*--- end decompress.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/huffman.c b/src/ZipLib/extlibs/bzip2/huffman.c new file mode 100644 index 00000000..2283fdbc --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/huffman.c @@ -0,0 +1,205 @@ + +/*-------------------------------------------------------------*/ +/*--- Huffman coding low-level stuff ---*/ +/*--- huffman.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*---------------------------------------------------*/ +#define WEIGHTOF(zz0) ((zz0) & 0xffffff00) +#define DEPTHOF(zz1) ((zz1) & 0x000000ff) +#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) + +#define ADDWEIGHTS(zw1,zw2) \ + (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ + (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) + +#define UPHEAP(z) \ +{ \ + Int32 zz, tmp; \ + zz = z; tmp = heap[zz]; \ + while (weight[tmp] < weight[heap[zz >> 1]]) { \ + heap[zz] = heap[zz >> 1]; \ + zz >>= 1; \ + } \ + heap[zz] = tmp; \ +} + +#define DOWNHEAP(z) \ +{ \ + Int32 zz, yy, tmp; \ + zz = z; tmp = heap[zz]; \ + while (True) { \ + yy = zz << 1; \ + if (yy > nHeap) break; \ + if (yy < nHeap && \ + weight[heap[yy+1]] < weight[heap[yy]]) \ + yy++; \ + if (weight[tmp] < weight[heap[yy]]) break; \ + heap[zz] = heap[yy]; \ + zz = yy; \ + } \ + heap[zz] = tmp; \ +} + + +/*---------------------------------------------------*/ +void BZ2_hbMakeCodeLengths ( UChar *len, + Int32 *freq, + Int32 alphaSize, + Int32 maxLen ) +{ + /*-- + Nodes and heap entries run from 1. Entry 0 + for both the heap and nodes is a sentinel. + --*/ + Int32 nNodes, nHeap, n1, n2, i, j, k; + Bool tooLong; + + Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; + Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; + Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; + + for (i = 0; i < alphaSize; i++) + weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; + + while (True) { + + nNodes = alphaSize; + nHeap = 0; + + heap[0] = 0; + weight[0] = 0; + parent[0] = -2; + + for (i = 1; i <= alphaSize; i++) { + parent[i] = -1; + nHeap++; + heap[nHeap] = i; + UPHEAP(nHeap); + } + + AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); + + while (nHeap > 1) { + n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); + n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); + nNodes++; + parent[n1] = parent[n2] = nNodes; + weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); + parent[nNodes] = -1; + nHeap++; + heap[nHeap] = nNodes; + UPHEAP(nHeap); + } + + AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); + + tooLong = False; + for (i = 1; i <= alphaSize; i++) { + j = 0; + k = i; + while (parent[k] >= 0) { k = parent[k]; j++; } + len[i-1] = j; + if (j > maxLen) tooLong = True; + } + + if (! tooLong) break; + + /* 17 Oct 04: keep-going condition for the following loop used + to be 'i < alphaSize', which missed the last element, + theoretically leading to the possibility of the compressor + looping. However, this count-scaling step is only needed if + one of the generated Huffman code words is longer than + maxLen, which up to and including version 1.0.2 was 20 bits, + which is extremely unlikely. In version 1.0.3 maxLen was + changed to 17 bits, which has minimal effect on compression + ratio, but does mean this scaling step is used from time to + time, enough to verify that it works. + + This means that bzip2-1.0.3 and later will only produce + Huffman codes with a maximum length of 17 bits. However, in + order to preserve backwards compatibility with bitstreams + produced by versions pre-1.0.3, the decompressor must still + handle lengths of up to 20. */ + + for (i = 1; i <= alphaSize; i++) { + j = weight[i] >> 8; + j = 1 + (j / 2); + weight[i] = j << 8; + } + } +} + + +/*---------------------------------------------------*/ +void BZ2_hbAssignCodes ( Int32 *code, + UChar *length, + Int32 minLen, + Int32 maxLen, + Int32 alphaSize ) +{ + Int32 n, vec, i; + + vec = 0; + for (n = minLen; n <= maxLen; n++) { + for (i = 0; i < alphaSize; i++) + if (length[i] == n) { code[i] = vec; vec++; }; + vec <<= 1; + } +} + + +/*---------------------------------------------------*/ +void BZ2_hbCreateDecodeTables ( Int32 *limit, + Int32 *base, + Int32 *perm, + UChar *length, + Int32 minLen, + Int32 maxLen, + Int32 alphaSize ) +{ + Int32 pp, i, j, vec; + + pp = 0; + for (i = minLen; i <= maxLen; i++) + for (j = 0; j < alphaSize; j++) + if (length[j] == i) { perm[pp] = j; pp++; }; + + for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; + for (i = 0; i < alphaSize; i++) base[length[i]+1]++; + + for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; + + for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; + vec = 0; + + for (i = minLen; i <= maxLen; i++) { + vec += (base[i+1] - base[i]); + limit[i] = vec-1; + vec <<= 1; + } + for (i = minLen + 1; i <= maxLen; i++) + base[i] = ((limit[i-1] + 1) << 1) - base[i]; +} + + +/*-------------------------------------------------------------*/ +/*--- end huffman.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/bzip2/randtable.c b/src/ZipLib/extlibs/bzip2/randtable.c new file mode 100644 index 00000000..6d624599 --- /dev/null +++ b/src/ZipLib/extlibs/bzip2/randtable.c @@ -0,0 +1,84 @@ + +/*-------------------------------------------------------------*/ +/*--- Table for randomising repetitive blocks ---*/ +/*--- randtable.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + + +/*---------------------------------------------*/ +Int32 BZ2_rNums[512] = { + 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, + 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, + 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, + 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, + 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, + 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, + 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, + 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, + 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, + 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, + 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, + 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, + 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, + 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, + 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, + 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, + 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, + 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, + 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, + 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, + 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, + 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, + 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, + 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, + 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, + 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, + 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, + 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, + 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, + 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, + 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, + 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, + 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, + 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, + 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, + 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, + 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, + 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, + 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, + 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, + 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, + 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, + 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, + 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, + 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, + 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, + 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, + 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, + 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, + 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, + 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, + 936, 638 +}; + + +/*-------------------------------------------------------------*/ +/*--- end randtable.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/ZipLib/extlibs/lzma/7z.h b/src/ZipLib/extlibs/lzma/7z.h new file mode 100644 index 00000000..01c4cac6 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7z.h @@ -0,0 +1,203 @@ +/* 7z.h -- 7z interface +2010-03-11 : Igor Pavlov : Public domain */ + +#ifndef __7Z_H +#define __7Z_H + +#include "7zBuf.h" + +EXTERN_C_BEGIN + +#define k7zStartHeaderSize 0x20 +#define k7zSignatureSize 6 +extern Byte k7zSignature[k7zSignatureSize]; +#define k7zMajorVersion 0 + +enum EIdEnum +{ + k7zIdEnd, + k7zIdHeader, + k7zIdArchiveProperties, + k7zIdAdditionalStreamsInfo, + k7zIdMainStreamsInfo, + k7zIdFilesInfo, + k7zIdPackInfo, + k7zIdUnpackInfo, + k7zIdSubStreamsInfo, + k7zIdSize, + k7zIdCRC, + k7zIdFolder, + k7zIdCodersUnpackSize, + k7zIdNumUnpackStream, + k7zIdEmptyStream, + k7zIdEmptyFile, + k7zIdAnti, + k7zIdName, + k7zIdCTime, + k7zIdATime, + k7zIdMTime, + k7zIdWinAttributes, + k7zIdComment, + k7zIdEncodedHeader, + k7zIdStartPos, + k7zIdDummy +}; + +typedef struct +{ + UInt32 NumInStreams; + UInt32 NumOutStreams; + UInt64 MethodID; + CBuf Props; +} CSzCoderInfo; + +void SzCoderInfo_Init(CSzCoderInfo *p); +void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc); + +typedef struct +{ + UInt32 InIndex; + UInt32 OutIndex; +} CSzBindPair; + +typedef struct +{ + CSzCoderInfo *Coders; + CSzBindPair *BindPairs; + UInt32 *PackStreams; + UInt64 *UnpackSizes; + UInt32 NumCoders; + UInt32 NumBindPairs; + UInt32 NumPackStreams; + int UnpackCRCDefined; + UInt32 UnpackCRC; + + UInt32 NumUnpackStreams; +} CSzFolder; + +void SzFolder_Init(CSzFolder *p); +UInt64 SzFolder_GetUnpackSize(CSzFolder *p); +int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex); +UInt32 SzFolder_GetNumOutStreams(CSzFolder *p); +UInt64 SzFolder_GetUnpackSize(CSzFolder *p); + +SRes SzFolder_Decode(const CSzFolder *folder, const UInt64 *packSizes, + ILookInStream *stream, UInt64 startPos, + Byte *outBuffer, size_t outSize, ISzAlloc *allocMain); + +typedef struct +{ + UInt32 Low; + UInt32 High; +} CNtfsFileTime; + +typedef struct +{ + CNtfsFileTime MTime; + UInt64 Size; + UInt32 Crc; + UInt32 Attrib; + Byte HasStream; + Byte IsDir; + Byte IsAnti; + Byte CrcDefined; + Byte MTimeDefined; + Byte AttribDefined; +} CSzFileItem; + +void SzFile_Init(CSzFileItem *p); + +typedef struct +{ + UInt64 *PackSizes; + Byte *PackCRCsDefined; + UInt32 *PackCRCs; + CSzFolder *Folders; + CSzFileItem *Files; + UInt32 NumPackStreams; + UInt32 NumFolders; + UInt32 NumFiles; +} CSzAr; + +void SzAr_Init(CSzAr *p); +void SzAr_Free(CSzAr *p, ISzAlloc *alloc); + + +/* + SzExtract extracts file from archive + + *outBuffer must be 0 before first call for each new archive. + + Extracting cache: + If you need to decompress more than one file, you can send + these values from previous call: + *blockIndex, + *outBuffer, + *outBufferSize + You can consider "*outBuffer" as cache of solid block. If your archive is solid, + it will increase decompression speed. + + If you use external function, you can declare these 3 cache variables + (blockIndex, outBuffer, outBufferSize) as static in that external function. + + Free *outBuffer and set *outBuffer to 0, if you want to flush cache. +*/ + +typedef struct +{ + CSzAr db; + + UInt64 startPosAfterHeader; + UInt64 dataPos; + + UInt32 *FolderStartPackStreamIndex; + UInt64 *PackStreamStartPositions; + UInt32 *FolderStartFileIndex; + UInt32 *FileIndexToFolderIndexMap; + + size_t *FileNameOffsets; /* in 2-byte steps */ + CBuf FileNames; /* UTF-16-LE */ +} CSzArEx; + +void SzArEx_Init(CSzArEx *p); +void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc); +UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder); +int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize); + +/* +if dest == NULL, the return value specifies the required size of the buffer, + in 16-bit characters, including the null-terminating character. +if dest != NULL, the return value specifies the number of 16-bit characters that + are written to the dest, including the null-terminating character. */ + +size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest); + +SRes SzArEx_Extract( + const CSzArEx *db, + ILookInStream *inStream, + UInt32 fileIndex, /* index of file */ + UInt32 *blockIndex, /* index of solid block */ + Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */ + size_t *outBufferSize, /* buffer size for output buffer */ + size_t *offset, /* offset of stream for required file in *outBuffer */ + size_t *outSizeProcessed, /* size of file in *outBuffer */ + ISzAlloc *allocMain, + ISzAlloc *allocTemp); + + +/* +SzArEx_Open Errors: +SZ_ERROR_NO_ARCHIVE +SZ_ERROR_ARCHIVE +SZ_ERROR_UNSUPPORTED +SZ_ERROR_MEM +SZ_ERROR_CRC +SZ_ERROR_INPUT_EOF +SZ_ERROR_FAIL +*/ + +SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zAlloc.c b/src/ZipLib/extlibs/lzma/7zAlloc.c new file mode 100644 index 00000000..964b28db --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zAlloc.c @@ -0,0 +1,76 @@ +/* 7zAlloc.c -- Allocation functions +2010-10-29 : Igor Pavlov : Public domain */ + +#include "7zAlloc.h" + +/* #define _SZ_ALLOC_DEBUG */ +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ + +#ifdef _SZ_ALLOC_DEBUG + +#ifdef _WIN32 +#include +#endif + +#include +int g_allocCount = 0; +int g_allocCountTemp = 0; + +#endif + +void *SzAlloc(void *p, size_t size) +{ + p = p; + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); + g_allocCount++; + #endif + return malloc(size); +} + +void SzFree(void *p, void *address) +{ + p = p; + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + { + g_allocCount--; + fprintf(stderr, "\nFree; count = %10d", g_allocCount); + } + #endif + free(address); +} + +void *SzAllocTemp(void *p, size_t size) +{ + p = p; + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); + g_allocCountTemp++; + #ifdef _WIN32 + return HeapAlloc(GetProcessHeap(), 0, size); + #endif + #endif + return malloc(size); +} + +void SzFreeTemp(void *p, void *address) +{ + p = p; + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + { + g_allocCountTemp--; + fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); + } + #ifdef _WIN32 + HeapFree(GetProcessHeap(), 0, address); + return; + #endif + #endif + free(address); +} diff --git a/src/ZipLib/extlibs/lzma/7zAlloc.h b/src/ZipLib/extlibs/lzma/7zAlloc.h new file mode 100644 index 00000000..3344e937 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zAlloc.h @@ -0,0 +1,15 @@ +/* 7zAlloc.h -- Allocation functions +2010-10-29 : Igor Pavlov : Public domain */ + +#ifndef __7Z_ALLOC_H +#define __7Z_ALLOC_H + +#include + +void *SzAlloc(void *p, size_t size); +void SzFree(void *p, void *address); + +void *SzAllocTemp(void *p, size_t size); +void SzFreeTemp(void *p, void *address); + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zBuf.c b/src/ZipLib/extlibs/lzma/7zBuf.c new file mode 100644 index 00000000..14e7f4e2 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zBuf.c @@ -0,0 +1,36 @@ +/* 7zBuf.c -- Byte Buffer +2008-03-28 +Igor Pavlov +Public domain */ + +#include "7zBuf.h" + +void Buf_Init(CBuf *p) +{ + p->data = 0; + p->size = 0; +} + +int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) +{ + p->size = 0; + if (size == 0) + { + p->data = 0; + return 1; + } + p->data = (Byte *)alloc->Alloc(alloc, size); + if (p->data != 0) + { + p->size = size; + return 1; + } + return 0; +} + +void Buf_Free(CBuf *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->data); + p->data = 0; + p->size = 0; +} diff --git a/src/ZipLib/extlibs/lzma/7zBuf.h b/src/ZipLib/extlibs/lzma/7zBuf.h new file mode 100644 index 00000000..e9f2f316 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zBuf.h @@ -0,0 +1,39 @@ +/* 7zBuf.h -- Byte Buffer +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __7Z_BUF_H +#define __7Z_BUF_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + Byte *data; + size_t size; +} CBuf; + +void Buf_Init(CBuf *p); +int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); +void Buf_Free(CBuf *p, ISzAlloc *alloc); + +typedef struct +{ + Byte *data; + size_t size; + size_t pos; +} CDynBuf; + +void DynBuf_Construct(CDynBuf *p); +void DynBuf_SeekToBeg(CDynBuf *p); +int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); +void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zBuf2.c b/src/ZipLib/extlibs/lzma/7zBuf2.c new file mode 100644 index 00000000..8d17e0dc --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zBuf2.c @@ -0,0 +1,45 @@ +/* 7zBuf2.c -- Byte Buffer +2008-10-04 : Igor Pavlov : Public domain */ + +#include +#include "7zBuf.h" + +void DynBuf_Construct(CDynBuf *p) +{ + p->data = 0; + p->size = 0; + p->pos = 0; +} + +void DynBuf_SeekToBeg(CDynBuf *p) +{ + p->pos = 0; +} + +int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) +{ + if (size > p->size - p->pos) + { + size_t newSize = p->pos + size; + Byte *data; + newSize += newSize / 4; + data = (Byte *)alloc->Alloc(alloc, newSize); + if (data == 0) + return 0; + p->size = newSize; + memcpy(data, p->data, p->pos); + alloc->Free(alloc, p->data); + p->data = data; + } + memcpy(p->data + p->pos, buf, size); + p->pos += size; + return 1; +} + +void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->data); + p->data = 0; + p->size = 0; + p->pos = 0; +} diff --git a/src/ZipLib/extlibs/lzma/7zCrc.c b/src/ZipLib/extlibs/lzma/7zCrc.c new file mode 100644 index 00000000..cd94201b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zCrc.c @@ -0,0 +1,83 @@ +/* 7zCrc.c -- CRC32 init +2010-12-01 : Igor Pavlov : Public domain */ + +#include "7zCrc.h" +#include "CpuArch.h" + +#define kCrcPoly 0xEDB88320 + +#ifdef MY_CPU_X86_OR_AMD64 + #define CRC_NUM_TABLES 8 + UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table); +#elif defined(MY_CPU_LE) + #define CRC_NUM_TABLES 4 +#else + #define CRC_NUM_TABLES 5 + #define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24)) + UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table); +#endif + +#ifndef MY_CPU_BE + UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table); +#endif + +typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); + +static CRC_FUNC g_CrcUpdate; +UInt32 g_CrcTable[256 * CRC_NUM_TABLES]; + +UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size) +{ + return g_CrcUpdate(v, data, size, g_CrcTable); +} + +UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size) +{ + return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL; +} + +void MY_FAST_CALL CrcGenerateTable() +{ + UInt32 i; + for (i = 0; i < 256; i++) + { + UInt32 r = i; + unsigned j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); + g_CrcTable[i] = r; + } + for (; i < 256 * CRC_NUM_TABLES; i++) + { + UInt32 r = g_CrcTable[i - 256]; + g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); + } + + #ifdef MY_CPU_LE + + g_CrcUpdate = CrcUpdateT4; + + #if CRC_NUM_TABLES == 8 + if (!CPU_Is_InOrder()) + g_CrcUpdate = CrcUpdateT8; + #endif + + #else + { + #ifndef MY_CPU_BE + UInt32 k = 1; + if (*(const Byte *)&k == 1) + g_CrcUpdate = CrcUpdateT4; + else + #endif + { + for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--) + { + UInt32 x = g_CrcTable[i - 256]; + g_CrcTable[i] = CRC_UINT32_SWAP(x); + } + g_CrcUpdate = CrcUpdateT1_BeT4; + } + } + #endif +} diff --git a/src/ZipLib/extlibs/lzma/7zCrc.h b/src/ZipLib/extlibs/lzma/7zCrc.h new file mode 100644 index 00000000..38e3e5fb --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zCrc.h @@ -0,0 +1,25 @@ +/* 7zCrc.h -- CRC32 calculation +2009-11-21 : Igor Pavlov : Public domain */ + +#ifndef __7Z_CRC_H +#define __7Z_CRC_H + +#include "Types.h" + +EXTERN_C_BEGIN + +extern UInt32 g_CrcTable[]; + +/* Call CrcGenerateTable one time before other CRC functions */ +void MY_FAST_CALL CrcGenerateTable(void); + +#define CRC_INIT_VAL 0xFFFFFFFF +#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) +#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); +UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zCrcOpt.c b/src/ZipLib/extlibs/lzma/7zCrcOpt.c new file mode 100644 index 00000000..a8d42a80 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zCrcOpt.c @@ -0,0 +1,64 @@ +/* 7zCrcOpt.c -- CRC32 calculation +2010-12-01 : Igor Pavlov : Public domain */ + +#include "CpuArch.h" + +#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +#ifndef MY_CPU_BE + +UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + for (; size >= 4; size -= 4, p += 4) + { + v ^= *(const UInt32 *)p; + v = + table[0x300 + (v & 0xFF)] ^ + table[0x200 + ((v >> 8) & 0xFF)] ^ + table[0x100 + ((v >> 16) & 0xFF)] ^ + table[0x000 + ((v >> 24))]; + } + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + return v; +} + +UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + return CrcUpdateT4(v, data, size, table); +} + +#endif + + +#ifndef MY_CPU_LE + +#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24)) + +UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + v = CRC_UINT32_SWAP(v); + table += 0x100; + for (; size >= 4; size -= 4, p += 4) + { + v ^= *(const UInt32 *)p; + v = + table[0x000 + (v & 0xFF)] ^ + table[0x100 + ((v >> 8) & 0xFF)] ^ + table[0x200 + ((v >> 16) & 0xFF)] ^ + table[0x300 + ((v >> 24))]; + } + table -= 0x100; + v = CRC_UINT32_SWAP(v); + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + return v; +} + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zDec.c b/src/ZipLib/extlibs/lzma/7zDec.c new file mode 100644 index 00000000..b6d80995 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zDec.c @@ -0,0 +1,470 @@ +/* 7zDec.c -- Decoding from 7z folder +2010-11-02 : Igor Pavlov : Public domain */ + +#include + +/* #define _7ZIP_PPMD_SUPPPORT */ + +#include "7z.h" + +#include "Bcj2.h" +#include "Bra.h" +#include "CpuArch.h" +#include "LzmaDec.h" +#include "Lzma2Dec.h" +#ifdef _7ZIP_PPMD_SUPPPORT +#include "Ppmd7.h" +#endif + +#define k_Copy 0 +#define k_LZMA2 0x21 +#define k_LZMA 0x30101 +#define k_BCJ 0x03030103 +#define k_PPC 0x03030205 +#define k_ARM 0x03030501 +#define k_ARMT 0x03030701 +#define k_SPARC 0x03030805 +#define k_BCJ2 0x0303011B + +#ifdef _7ZIP_PPMD_SUPPPORT + +#define k_PPMD 0x30401 + +typedef struct +{ + IByteIn p; + const Byte *cur; + const Byte *end; + const Byte *begin; + UInt64 processed; + Bool extra; + SRes res; + ILookInStream *inStream; +} CByteInToLook; + +static Byte ReadByte(void *pp) +{ + CByteInToLook *p = (CByteInToLook *)pp; + if (p->cur != p->end) + return *p->cur++; + if (p->res == SZ_OK) + { + size_t size = p->cur - p->begin; + p->processed += size; + p->res = p->inStream->Skip(p->inStream, size); + size = (1 << 25); + p->res = p->inStream->Look(p->inStream, (const void **)&p->begin, &size); + p->cur = p->begin; + p->end = p->begin + size; + if (size != 0) + return *p->cur++;; + } + p->extra = True; + return 0; +} + +static SRes SzDecodePpmd(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inStream, + Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) +{ + CPpmd7 ppmd; + CByteInToLook s; + SRes res = SZ_OK; + + s.p.Read = ReadByte; + s.inStream = inStream; + s.begin = s.end = s.cur = NULL; + s.extra = False; + s.res = SZ_OK; + s.processed = 0; + + if (coder->Props.size != 5) + return SZ_ERROR_UNSUPPORTED; + + { + unsigned order = coder->Props.data[0]; + UInt32 memSize = GetUi32(coder->Props.data + 1); + if (order < PPMD7_MIN_ORDER || + order > PPMD7_MAX_ORDER || + memSize < PPMD7_MIN_MEM_SIZE || + memSize > PPMD7_MAX_MEM_SIZE) + return SZ_ERROR_UNSUPPORTED; + Ppmd7_Construct(&ppmd); + if (!Ppmd7_Alloc(&ppmd, memSize, allocMain)) + return SZ_ERROR_MEM; + Ppmd7_Init(&ppmd, order); + } + { + CPpmd7z_RangeDec rc; + Ppmd7z_RangeDec_CreateVTable(&rc); + rc.Stream = &s.p; + if (!Ppmd7z_RangeDec_Init(&rc)) + res = SZ_ERROR_DATA; + else if (s.extra) + res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA); + else + { + SizeT i; + for (i = 0; i < outSize; i++) + { + int sym = Ppmd7_DecodeSymbol(&ppmd, &rc.p); + if (s.extra || sym < 0) + break; + outBuffer[i] = (Byte)sym; + } + if (i != outSize) + res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA); + else if (s.processed + (s.cur - s.begin) != inSize || !Ppmd7z_RangeDec_IsFinishedOK(&rc)) + res = SZ_ERROR_DATA; + } + } + Ppmd7_Free(&ppmd, allocMain); + return res; +} + +#endif + + +static SRes SzDecodeLzma(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inStream, + Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) +{ + CLzmaDec state; + SRes res = SZ_OK; + + LzmaDec_Construct(&state); + RINOK(LzmaDec_AllocateProbs(&state, coder->Props.data, (unsigned)coder->Props.size, allocMain)); + state.dic = outBuffer; + state.dicBufSize = outSize; + LzmaDec_Init(&state); + + for (;;) + { + Byte *inBuf = NULL; + size_t lookahead = (1 << 18); + if (lookahead > inSize) + lookahead = (size_t)inSize; + res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead); + if (res != SZ_OK) + break; + + { + SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos; + ELzmaStatus status; + res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status); + lookahead -= inProcessed; + inSize -= inProcessed; + if (res != SZ_OK) + break; + if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos)) + { + if (state.dicBufSize != outSize || lookahead != 0 || + (status != LZMA_STATUS_FINISHED_WITH_MARK && + status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK)) + res = SZ_ERROR_DATA; + break; + } + res = inStream->Skip((void *)inStream, inProcessed); + if (res != SZ_OK) + break; + } + } + + LzmaDec_FreeProbs(&state, allocMain); + return res; +} + +static SRes SzDecodeLzma2(CSzCoderInfo *coder, UInt64 inSize, ILookInStream *inStream, + Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain) +{ + CLzma2Dec state; + SRes res = SZ_OK; + + Lzma2Dec_Construct(&state); + if (coder->Props.size != 1) + return SZ_ERROR_DATA; + RINOK(Lzma2Dec_AllocateProbs(&state, coder->Props.data[0], allocMain)); + state.decoder.dic = outBuffer; + state.decoder.dicBufSize = outSize; + Lzma2Dec_Init(&state); + + for (;;) + { + Byte *inBuf = NULL; + size_t lookahead = (1 << 18); + if (lookahead > inSize) + lookahead = (size_t)inSize; + res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead); + if (res != SZ_OK) + break; + + { + SizeT inProcessed = (SizeT)lookahead, dicPos = state.decoder.dicPos; + ELzmaStatus status; + res = Lzma2Dec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status); + lookahead -= inProcessed; + inSize -= inProcessed; + if (res != SZ_OK) + break; + if (state.decoder.dicPos == state.decoder.dicBufSize || (inProcessed == 0 && dicPos == state.decoder.dicPos)) + { + if (state.decoder.dicBufSize != outSize || lookahead != 0 || + (status != LZMA_STATUS_FINISHED_WITH_MARK)) + res = SZ_ERROR_DATA; + break; + } + res = inStream->Skip((void *)inStream, inProcessed); + if (res != SZ_OK) + break; + } + } + + Lzma2Dec_FreeProbs(&state, allocMain); + return res; +} + +static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer) +{ + while (inSize > 0) + { + void *inBuf; + size_t curSize = (1 << 18); + if (curSize > inSize) + curSize = (size_t)inSize; + RINOK(inStream->Look((void *)inStream, (const void **)&inBuf, &curSize)); + if (curSize == 0) + return SZ_ERROR_INPUT_EOF; + memcpy(outBuffer, inBuf, curSize); + outBuffer += curSize; + inSize -= curSize; + RINOK(inStream->Skip((void *)inStream, curSize)); + } + return SZ_OK; +} + +static Bool IS_MAIN_METHOD(UInt32 m) +{ + switch(m) + { + case k_Copy: + case k_LZMA: + case k_LZMA2: + #ifdef _7ZIP_PPMD_SUPPPORT + case k_PPMD: + #endif + return True; + } + return False; +} + +static Bool IS_SUPPORTED_CODER(const CSzCoderInfo *c) +{ + return + c->NumInStreams == 1 && + c->NumOutStreams == 1 && + c->MethodID <= (UInt32)0xFFFFFFFF && + IS_MAIN_METHOD((UInt32)c->MethodID); +} + +#define IS_BCJ2(c) ((c)->MethodID == k_BCJ2 && (c)->NumInStreams == 4 && (c)->NumOutStreams == 1) + +static SRes CheckSupportedFolder(const CSzFolder *f) +{ + if (f->NumCoders < 1 || f->NumCoders > 4) + return SZ_ERROR_UNSUPPORTED; + if (!IS_SUPPORTED_CODER(&f->Coders[0])) + return SZ_ERROR_UNSUPPORTED; + if (f->NumCoders == 1) + { + if (f->NumPackStreams != 1 || f->PackStreams[0] != 0 || f->NumBindPairs != 0) + return SZ_ERROR_UNSUPPORTED; + return SZ_OK; + } + if (f->NumCoders == 2) + { + CSzCoderInfo *c = &f->Coders[1]; + if (c->MethodID > (UInt32)0xFFFFFFFF || + c->NumInStreams != 1 || + c->NumOutStreams != 1 || + f->NumPackStreams != 1 || + f->PackStreams[0] != 0 || + f->NumBindPairs != 1 || + f->BindPairs[0].InIndex != 1 || + f->BindPairs[0].OutIndex != 0) + return SZ_ERROR_UNSUPPORTED; + switch ((UInt32)c->MethodID) + { + case k_BCJ: + case k_ARM: + break; + default: + return SZ_ERROR_UNSUPPORTED; + } + return SZ_OK; + } + if (f->NumCoders == 4) + { + if (!IS_SUPPORTED_CODER(&f->Coders[1]) || + !IS_SUPPORTED_CODER(&f->Coders[2]) || + !IS_BCJ2(&f->Coders[3])) + return SZ_ERROR_UNSUPPORTED; + if (f->NumPackStreams != 4 || + f->PackStreams[0] != 2 || + f->PackStreams[1] != 6 || + f->PackStreams[2] != 1 || + f->PackStreams[3] != 0 || + f->NumBindPairs != 3 || + f->BindPairs[0].InIndex != 5 || f->BindPairs[0].OutIndex != 0 || + f->BindPairs[1].InIndex != 4 || f->BindPairs[1].OutIndex != 1 || + f->BindPairs[2].InIndex != 3 || f->BindPairs[2].OutIndex != 2) + return SZ_ERROR_UNSUPPORTED; + return SZ_OK; + } + return SZ_ERROR_UNSUPPORTED; +} + +static UInt64 GetSum(const UInt64 *values, UInt32 index) +{ + UInt64 sum = 0; + UInt32 i; + for (i = 0; i < index; i++) + sum += values[i]; + return sum; +} + +#define CASE_BRA_CONV(isa) case k_ ## isa: isa ## _Convert(outBuffer, outSize, 0, 0); break; + +static SRes SzFolder_Decode2(const CSzFolder *folder, const UInt64 *packSizes, + ILookInStream *inStream, UInt64 startPos, + Byte *outBuffer, SizeT outSize, ISzAlloc *allocMain, + Byte *tempBuf[]) +{ + UInt32 ci; + SizeT tempSizes[3] = { 0, 0, 0}; + SizeT tempSize3 = 0; + Byte *tempBuf3 = 0; + + RINOK(CheckSupportedFolder(folder)); + + for (ci = 0; ci < folder->NumCoders; ci++) + { + CSzCoderInfo *coder = &folder->Coders[ci]; + + if (IS_MAIN_METHOD((UInt32)coder->MethodID)) + { + UInt32 si = 0; + UInt64 offset; + UInt64 inSize; + Byte *outBufCur = outBuffer; + SizeT outSizeCur = outSize; + if (folder->NumCoders == 4) + { + UInt32 indices[] = { 3, 2, 0 }; + UInt64 unpackSize = folder->UnpackSizes[ci]; + si = indices[ci]; + if (ci < 2) + { + Byte *temp; + outSizeCur = (SizeT)unpackSize; + if (outSizeCur != unpackSize) + return SZ_ERROR_MEM; + temp = (Byte *)IAlloc_Alloc(allocMain, outSizeCur); + if (temp == 0 && outSizeCur != 0) + return SZ_ERROR_MEM; + outBufCur = tempBuf[1 - ci] = temp; + tempSizes[1 - ci] = outSizeCur; + } + else if (ci == 2) + { + if (unpackSize > outSize) /* check it */ + return SZ_ERROR_PARAM; + tempBuf3 = outBufCur = outBuffer + (outSize - (size_t)unpackSize); + tempSize3 = outSizeCur = (SizeT)unpackSize; + } + else + return SZ_ERROR_UNSUPPORTED; + } + offset = GetSum(packSizes, si); + inSize = packSizes[si]; + RINOK(LookInStream_SeekTo(inStream, startPos + offset)); + + if (coder->MethodID == k_Copy) + { + if (inSize != outSizeCur) /* check it */ + return SZ_ERROR_DATA; + RINOK(SzDecodeCopy(inSize, inStream, outBufCur)); + } + else if (coder->MethodID == k_LZMA) + { + RINOK(SzDecodeLzma(coder, inSize, inStream, outBufCur, outSizeCur, allocMain)); + } + else if (coder->MethodID == k_LZMA2) + { + RINOK(SzDecodeLzma2(coder, inSize, inStream, outBufCur, outSizeCur, allocMain)); + } + else + { + #ifdef _7ZIP_PPMD_SUPPPORT + RINOK(SzDecodePpmd(coder, inSize, inStream, outBufCur, outSizeCur, allocMain)); + #else + return SZ_ERROR_UNSUPPORTED; + #endif + } + } + else if (coder->MethodID == k_BCJ2) + { + UInt64 offset = GetSum(packSizes, 1); + UInt64 s3Size = packSizes[1]; + SRes res; + if (ci != 3) + return SZ_ERROR_UNSUPPORTED; + RINOK(LookInStream_SeekTo(inStream, startPos + offset)); + tempSizes[2] = (SizeT)s3Size; + if (tempSizes[2] != s3Size) + return SZ_ERROR_MEM; + tempBuf[2] = (Byte *)IAlloc_Alloc(allocMain, tempSizes[2]); + if (tempBuf[2] == 0 && tempSizes[2] != 0) + return SZ_ERROR_MEM; + res = SzDecodeCopy(s3Size, inStream, tempBuf[2]); + RINOK(res) + + res = Bcj2_Decode( + tempBuf3, tempSize3, + tempBuf[0], tempSizes[0], + tempBuf[1], tempSizes[1], + tempBuf[2], tempSizes[2], + outBuffer, outSize); + RINOK(res) + } + else + { + if (ci != 1) + return SZ_ERROR_UNSUPPORTED; + switch(coder->MethodID) + { + case k_BCJ: + { + UInt32 state; + x86_Convert_Init(state); + x86_Convert(outBuffer, outSize, 0, &state, 0); + break; + } + CASE_BRA_CONV(ARM) + default: + return SZ_ERROR_UNSUPPORTED; + } + } + } + return SZ_OK; +} + +SRes SzFolder_Decode(const CSzFolder *folder, const UInt64 *packSizes, + ILookInStream *inStream, UInt64 startPos, + Byte *outBuffer, size_t outSize, ISzAlloc *allocMain) +{ + Byte *tempBuf[3] = { 0, 0, 0}; + int i; + SRes res = SzFolder_Decode2(folder, packSizes, inStream, startPos, + outBuffer, (SizeT)outSize, allocMain, tempBuf); + for (i = 0; i < 3; i++) + IAlloc_Free(allocMain, tempBuf[i]); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/7zFile.c b/src/ZipLib/extlibs/lzma/7zFile.c new file mode 100644 index 00000000..a66c9e9d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zFile.c @@ -0,0 +1,284 @@ +/* 7zFile.c -- File IO +2009-11-24 : Igor Pavlov : Public domain */ + +#include "7zFile.h" + +#ifndef USE_WINDOWS_FILE + +#ifndef UNDER_CE +#include +#endif + +#else + +/* + ReadFile and WriteFile functions in Windows have BUG: + If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1) + from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES + (Insufficient system resources exist to complete the requested service). + Probably in some version of Windows there are problems with other sizes: + for 32 MB (maybe also for 16 MB). + And message can be "Network connection was lost" +*/ + +#define kChunkSizeMax (1 << 22) + +#endif + +void File_Construct(CSzFile *p) +{ + #ifdef USE_WINDOWS_FILE + p->handle = INVALID_HANDLE_VALUE; + #else + p->file = NULL; + #endif +} + +#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE) +static WRes File_Open(CSzFile *p, const char *name, int writeMode) +{ + #ifdef USE_WINDOWS_FILE + p->handle = CreateFileA(name, + writeMode ? GENERIC_WRITE : GENERIC_READ, + FILE_SHARE_READ, NULL, + writeMode ? CREATE_ALWAYS : OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError(); + #else + p->file = fopen(name, writeMode ? "wb+" : "rb"); + return (p->file != 0) ? 0 : + #ifdef UNDER_CE + 2; /* ENOENT */ + #else + errno; + #endif + #endif +} + +WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); } +WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); } +#endif + +#ifdef USE_WINDOWS_FILE +static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode) +{ + p->handle = CreateFileW(name, + writeMode ? GENERIC_WRITE : GENERIC_READ, + FILE_SHARE_READ, NULL, + writeMode ? CREATE_ALWAYS : OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError(); +} +WRes InFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 0); } +WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1); } +#endif + +WRes File_Close(CSzFile *p) +{ + #ifdef USE_WINDOWS_FILE + if (p->handle != INVALID_HANDLE_VALUE) + { + if (!CloseHandle(p->handle)) + return GetLastError(); + p->handle = INVALID_HANDLE_VALUE; + } + #else + if (p->file != NULL) + { + int res = fclose(p->file); + if (res != 0) + return res; + p->file = NULL; + } + #endif + return 0; +} + +WRes File_Read(CSzFile *p, void *data, size_t *size) +{ + size_t originalSize = *size; + if (originalSize == 0) + return 0; + + #ifdef USE_WINDOWS_FILE + + *size = 0; + do + { + DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize; + DWORD processed = 0; + BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL); + data = (void *)((Byte *)data + processed); + originalSize -= processed; + *size += processed; + if (!res) + return GetLastError(); + if (processed == 0) + break; + } + while (originalSize > 0); + return 0; + + #else + + *size = fread(data, 1, originalSize, p->file); + if (*size == originalSize) + return 0; + return ferror(p->file); + + #endif +} + +WRes File_Write(CSzFile *p, const void *data, size_t *size) +{ + size_t originalSize = *size; + if (originalSize == 0) + return 0; + + #ifdef USE_WINDOWS_FILE + + *size = 0; + do + { + DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize; + DWORD processed = 0; + BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL); + data = (void *)((Byte *)data + processed); + originalSize -= processed; + *size += processed; + if (!res) + return GetLastError(); + if (processed == 0) + break; + } + while (originalSize > 0); + return 0; + + #else + + *size = fwrite(data, 1, originalSize, p->file); + if (*size == originalSize) + return 0; + return ferror(p->file); + + #endif +} + +WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin) +{ + #ifdef USE_WINDOWS_FILE + + LARGE_INTEGER value; + DWORD moveMethod; + value.LowPart = (DWORD)*pos; + value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */ + switch (origin) + { + case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break; + case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break; + case SZ_SEEK_END: moveMethod = FILE_END; break; + default: return ERROR_INVALID_PARAMETER; + } + value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod); + if (value.LowPart == 0xFFFFFFFF) + { + WRes res = GetLastError(); + if (res != NO_ERROR) + return res; + } + *pos = ((Int64)value.HighPart << 32) | value.LowPart; + return 0; + + #else + + int moveMethod; + int res; + switch (origin) + { + case SZ_SEEK_SET: moveMethod = SEEK_SET; break; + case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break; + case SZ_SEEK_END: moveMethod = SEEK_END; break; + default: return 1; + } + res = fseek(p->file, (long)*pos, moveMethod); + *pos = ftell(p->file); + return res; + + #endif +} + +WRes File_GetLength(CSzFile *p, UInt64 *length) +{ + #ifdef USE_WINDOWS_FILE + + DWORD sizeHigh; + DWORD sizeLow = GetFileSize(p->handle, &sizeHigh); + if (sizeLow == 0xFFFFFFFF) + { + DWORD res = GetLastError(); + if (res != NO_ERROR) + return res; + } + *length = (((UInt64)sizeHigh) << 32) + sizeLow; + return 0; + + #else + + long pos = ftell(p->file); + int res = fseek(p->file, 0, SEEK_END); + *length = ftell(p->file); + fseek(p->file, pos, SEEK_SET); + return res; + + #endif +} + + +/* ---------- FileSeqInStream ---------- */ + +static SRes FileSeqInStream_Read(void *pp, void *buf, size_t *size) +{ + CFileSeqInStream *p = (CFileSeqInStream *)pp; + return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ; +} + +void FileSeqInStream_CreateVTable(CFileSeqInStream *p) +{ + p->s.Read = FileSeqInStream_Read; +} + + +/* ---------- FileInStream ---------- */ + +static SRes FileInStream_Read(void *pp, void *buf, size_t *size) +{ + CFileInStream *p = (CFileInStream *)pp; + return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ; +} + +static SRes FileInStream_Seek(void *pp, Int64 *pos, ESzSeek origin) +{ + CFileInStream *p = (CFileInStream *)pp; + return File_Seek(&p->file, pos, origin); +} + +void FileInStream_CreateVTable(CFileInStream *p) +{ + p->s.Read = FileInStream_Read; + p->s.Seek = FileInStream_Seek; +} + + +/* ---------- FileOutStream ---------- */ + +static size_t FileOutStream_Write(void *pp, const void *data, size_t size) +{ + CFileOutStream *p = (CFileOutStream *)pp; + File_Write(&p->file, data, &size); + return size; +} + +void FileOutStream_CreateVTable(CFileOutStream *p) +{ + p->s.Write = FileOutStream_Write; +} diff --git a/src/ZipLib/extlibs/lzma/7zFile.h b/src/ZipLib/extlibs/lzma/7zFile.h new file mode 100644 index 00000000..84538c03 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zFile.h @@ -0,0 +1,83 @@ +/* 7zFile.h -- File IO +2009-11-24 : Igor Pavlov : Public domain */ + +#ifndef __7Z_FILE_H +#define __7Z_FILE_H + +#ifdef _WIN32 +#define USE_WINDOWS_FILE +#endif + +#ifdef USE_WINDOWS_FILE +#include +#else +#include +#endif + +#include "Types.h" + +EXTERN_C_BEGIN + +/* ---------- File ---------- */ + +typedef struct +{ + #ifdef USE_WINDOWS_FILE + HANDLE handle; + #else + FILE *file; + #endif +} CSzFile; + +void File_Construct(CSzFile *p); +#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE) +WRes InFile_Open(CSzFile *p, const char *name); +WRes OutFile_Open(CSzFile *p, const char *name); +#endif +#ifdef USE_WINDOWS_FILE +WRes InFile_OpenW(CSzFile *p, const WCHAR *name); +WRes OutFile_OpenW(CSzFile *p, const WCHAR *name); +#endif +WRes File_Close(CSzFile *p); + +/* reads max(*size, remain file's size) bytes */ +WRes File_Read(CSzFile *p, void *data, size_t *size); + +/* writes *size bytes */ +WRes File_Write(CSzFile *p, const void *data, size_t *size); + +WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin); +WRes File_GetLength(CSzFile *p, UInt64 *length); + + +/* ---------- FileInStream ---------- */ + +typedef struct +{ + ISeqInStream s; + CSzFile file; +} CFileSeqInStream; + +void FileSeqInStream_CreateVTable(CFileSeqInStream *p); + + +typedef struct +{ + ISeekInStream s; + CSzFile file; +} CFileInStream; + +void FileInStream_CreateVTable(CFileInStream *p); + + +typedef struct +{ + ISeqOutStream s; + CSzFile file; +} CFileOutStream; + +void FileOutStream_CreateVTable(CFileOutStream *p); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/7zIn.c b/src/ZipLib/extlibs/lzma/7zIn.c new file mode 100644 index 00000000..ec93a43f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zIn.c @@ -0,0 +1,1402 @@ +/* 7zIn.c -- 7z Input functions +2010-10-29 : Igor Pavlov : Public domain */ + +#include + +#include "7z.h" +#include "7zCrc.h" +#include "CpuArch.h" + +Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; + +#define RINOM(x) { if ((x) == 0) return SZ_ERROR_MEM; } + +#define NUM_FOLDER_CODERS_MAX 32 +#define NUM_CODER_STREAMS_MAX 32 + +void SzCoderInfo_Init(CSzCoderInfo *p) +{ + Buf_Init(&p->Props); +} + +void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc) +{ + Buf_Free(&p->Props, alloc); + SzCoderInfo_Init(p); +} + +void SzFolder_Init(CSzFolder *p) +{ + p->Coders = 0; + p->BindPairs = 0; + p->PackStreams = 0; + p->UnpackSizes = 0; + p->NumCoders = 0; + p->NumBindPairs = 0; + p->NumPackStreams = 0; + p->UnpackCRCDefined = 0; + p->UnpackCRC = 0; + p->NumUnpackStreams = 0; +} + +void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc) +{ + UInt32 i; + if (p->Coders) + for (i = 0; i < p->NumCoders; i++) + SzCoderInfo_Free(&p->Coders[i], alloc); + IAlloc_Free(alloc, p->Coders); + IAlloc_Free(alloc, p->BindPairs); + IAlloc_Free(alloc, p->PackStreams); + IAlloc_Free(alloc, p->UnpackSizes); + SzFolder_Init(p); +} + +UInt32 SzFolder_GetNumOutStreams(CSzFolder *p) +{ + UInt32 result = 0; + UInt32 i; + for (i = 0; i < p->NumCoders; i++) + result += p->Coders[i].NumOutStreams; + return result; +} + +int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex) +{ + UInt32 i; + for (i = 0; i < p->NumBindPairs; i++) + if (p->BindPairs[i].InIndex == inStreamIndex) + return i; + return -1; +} + + +int SzFolder_FindBindPairForOutStream(CSzFolder *p, UInt32 outStreamIndex) +{ + UInt32 i; + for (i = 0; i < p->NumBindPairs; i++) + if (p->BindPairs[i].OutIndex == outStreamIndex) + return i; + return -1; +} + +UInt64 SzFolder_GetUnpackSize(CSzFolder *p) +{ + int i = (int)SzFolder_GetNumOutStreams(p); + if (i == 0) + return 0; + for (i--; i >= 0; i--) + if (SzFolder_FindBindPairForOutStream(p, i) < 0) + return p->UnpackSizes[i]; + /* throw 1; */ + return 0; +} + +void SzFile_Init(CSzFileItem *p) +{ + p->HasStream = 1; + p->IsDir = 0; + p->IsAnti = 0; + p->CrcDefined = 0; + p->MTimeDefined = 0; +} + +void SzAr_Init(CSzAr *p) +{ + p->PackSizes = 0; + p->PackCRCsDefined = 0; + p->PackCRCs = 0; + p->Folders = 0; + p->Files = 0; + p->NumPackStreams = 0; + p->NumFolders = 0; + p->NumFiles = 0; +} + +void SzAr_Free(CSzAr *p, ISzAlloc *alloc) +{ + UInt32 i; + if (p->Folders) + for (i = 0; i < p->NumFolders; i++) + SzFolder_Free(&p->Folders[i], alloc); + + IAlloc_Free(alloc, p->PackSizes); + IAlloc_Free(alloc, p->PackCRCsDefined); + IAlloc_Free(alloc, p->PackCRCs); + IAlloc_Free(alloc, p->Folders); + IAlloc_Free(alloc, p->Files); + SzAr_Init(p); +} + + +void SzArEx_Init(CSzArEx *p) +{ + SzAr_Init(&p->db); + p->FolderStartPackStreamIndex = 0; + p->PackStreamStartPositions = 0; + p->FolderStartFileIndex = 0; + p->FileIndexToFolderIndexMap = 0; + p->FileNameOffsets = 0; + Buf_Init(&p->FileNames); +} + +void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc) +{ + IAlloc_Free(alloc, p->FolderStartPackStreamIndex); + IAlloc_Free(alloc, p->PackStreamStartPositions); + IAlloc_Free(alloc, p->FolderStartFileIndex); + IAlloc_Free(alloc, p->FileIndexToFolderIndexMap); + + IAlloc_Free(alloc, p->FileNameOffsets); + Buf_Free(&p->FileNames, alloc); + + SzAr_Free(&p->db, alloc); + SzArEx_Init(p); +} + +/* +UInt64 GetFolderPackStreamSize(int folderIndex, int streamIndex) const +{ + return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex]; +} + +UInt64 GetFilePackSize(int fileIndex) const +{ + int folderIndex = FileIndexToFolderIndexMap[fileIndex]; + if (folderIndex >= 0) + { + const CSzFolder &folderInfo = Folders[folderIndex]; + if (FolderStartFileIndex[folderIndex] == fileIndex) + return GetFolderFullPackSize(folderIndex); + } + return 0; +} +*/ + +#define MY_ALLOC(T, p, size, alloc) { if ((size) == 0) p = 0; else \ + if ((p = (T *)IAlloc_Alloc(alloc, (size) * sizeof(T))) == 0) return SZ_ERROR_MEM; } + +static SRes SzArEx_Fill(CSzArEx *p, ISzAlloc *alloc) +{ + UInt32 startPos = 0; + UInt64 startPosSize = 0; + UInt32 i; + UInt32 folderIndex = 0; + UInt32 indexInFolder = 0; + MY_ALLOC(UInt32, p->FolderStartPackStreamIndex, p->db.NumFolders, alloc); + for (i = 0; i < p->db.NumFolders; i++) + { + p->FolderStartPackStreamIndex[i] = startPos; + startPos += p->db.Folders[i].NumPackStreams; + } + + MY_ALLOC(UInt64, p->PackStreamStartPositions, p->db.NumPackStreams, alloc); + + for (i = 0; i < p->db.NumPackStreams; i++) + { + p->PackStreamStartPositions[i] = startPosSize; + startPosSize += p->db.PackSizes[i]; + } + + MY_ALLOC(UInt32, p->FolderStartFileIndex, p->db.NumFolders, alloc); + MY_ALLOC(UInt32, p->FileIndexToFolderIndexMap, p->db.NumFiles, alloc); + + for (i = 0; i < p->db.NumFiles; i++) + { + CSzFileItem *file = p->db.Files + i; + int emptyStream = !file->HasStream; + if (emptyStream && indexInFolder == 0) + { + p->FileIndexToFolderIndexMap[i] = (UInt32)-1; + continue; + } + if (indexInFolder == 0) + { + /* + v3.13 incorrectly worked with empty folders + v4.07: Loop for skipping empty folders + */ + for (;;) + { + if (folderIndex >= p->db.NumFolders) + return SZ_ERROR_ARCHIVE; + p->FolderStartFileIndex[folderIndex] = i; + if (p->db.Folders[folderIndex].NumUnpackStreams != 0) + break; + folderIndex++; + } + } + p->FileIndexToFolderIndexMap[i] = folderIndex; + if (emptyStream) + continue; + indexInFolder++; + if (indexInFolder >= p->db.Folders[folderIndex].NumUnpackStreams) + { + folderIndex++; + indexInFolder = 0; + } + } + return SZ_OK; +} + + +UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder) +{ + return p->dataPos + + p->PackStreamStartPositions[p->FolderStartPackStreamIndex[folderIndex] + indexInFolder]; +} + +int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize) +{ + UInt32 packStreamIndex = p->FolderStartPackStreamIndex[folderIndex]; + CSzFolder *folder = p->db.Folders + folderIndex; + UInt64 size = 0; + UInt32 i; + for (i = 0; i < folder->NumPackStreams; i++) + { + UInt64 t = size + p->db.PackSizes[packStreamIndex + i]; + if (t < size) /* check it */ + return SZ_ERROR_FAIL; + size = t; + } + *resSize = size; + return SZ_OK; +} + + +/* +SRes SzReadTime(const CObjectVector &dataVector, + CObjectVector &files, UInt64 type) +{ + CBoolVector boolVector; + RINOK(ReadBoolVector2(files.Size(), boolVector)) + + CStreamSwitch streamSwitch; + RINOK(streamSwitch.Set(this, &dataVector)); + + for (int i = 0; i < files.Size(); i++) + { + CSzFileItem &file = files[i]; + CArchiveFileTime fileTime; + bool defined = boolVector[i]; + if (defined) + { + UInt32 low, high; + RINOK(SzReadUInt32(low)); + RINOK(SzReadUInt32(high)); + fileTime.dwLowDateTime = low; + fileTime.dwHighDateTime = high; + } + switch(type) + { + case k7zIdCTime: file.IsCTimeDefined = defined; if (defined) file.CTime = fileTime; break; + case k7zIdATime: file.IsATimeDefined = defined; if (defined) file.ATime = fileTime; break; + case k7zIdMTime: file.IsMTimeDefined = defined; if (defined) file.MTime = fileTime; break; + } + } + return SZ_OK; +} +*/ + +static int TestSignatureCandidate(Byte *testBytes) +{ + size_t i; + for (i = 0; i < k7zSignatureSize; i++) + if (testBytes[i] != k7zSignature[i]) + return 0; + return 1; +} + +typedef struct _CSzState +{ + Byte *Data; + size_t Size; +}CSzData; + +static SRes SzReadByte(CSzData *sd, Byte *b) +{ + if (sd->Size == 0) + return SZ_ERROR_ARCHIVE; + sd->Size--; + *b = *sd->Data++; + return SZ_OK; +} + +static SRes SzReadBytes(CSzData *sd, Byte *data, size_t size) +{ + size_t i; + for (i = 0; i < size; i++) + { + RINOK(SzReadByte(sd, data + i)); + } + return SZ_OK; +} + +static SRes SzReadUInt32(CSzData *sd, UInt32 *value) +{ + int i; + *value = 0; + for (i = 0; i < 4; i++) + { + Byte b; + RINOK(SzReadByte(sd, &b)); + *value |= ((UInt32)(b) << (8 * i)); + } + return SZ_OK; +} + +static SRes SzReadNumber(CSzData *sd, UInt64 *value) +{ + Byte firstByte; + Byte mask = 0x80; + int i; + RINOK(SzReadByte(sd, &firstByte)); + *value = 0; + for (i = 0; i < 8; i++) + { + Byte b; + if ((firstByte & mask) == 0) + { + UInt64 highPart = firstByte & (mask - 1); + *value += (highPart << (8 * i)); + return SZ_OK; + } + RINOK(SzReadByte(sd, &b)); + *value |= ((UInt64)b << (8 * i)); + mask >>= 1; + } + return SZ_OK; +} + +static SRes SzReadNumber32(CSzData *sd, UInt32 *value) +{ + UInt64 value64; + RINOK(SzReadNumber(sd, &value64)); + if (value64 >= 0x80000000) + return SZ_ERROR_UNSUPPORTED; + if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 2))) + return SZ_ERROR_UNSUPPORTED; + *value = (UInt32)value64; + return SZ_OK; +} + +static SRes SzReadID(CSzData *sd, UInt64 *value) +{ + return SzReadNumber(sd, value); +} + +static SRes SzSkeepDataSize(CSzData *sd, UInt64 size) +{ + if (size > sd->Size) + return SZ_ERROR_ARCHIVE; + sd->Size -= (size_t)size; + sd->Data += (size_t)size; + return SZ_OK; +} + +static SRes SzSkeepData(CSzData *sd) +{ + UInt64 size; + RINOK(SzReadNumber(sd, &size)); + return SzSkeepDataSize(sd, size); +} + +static SRes SzReadArchiveProperties(CSzData *sd) +{ + for (;;) + { + UInt64 type; + RINOK(SzReadID(sd, &type)); + if (type == k7zIdEnd) + break; + SzSkeepData(sd); + } + return SZ_OK; +} + +static SRes SzWaitAttribute(CSzData *sd, UInt64 attribute) +{ + for (;;) + { + UInt64 type; + RINOK(SzReadID(sd, &type)); + if (type == attribute) + return SZ_OK; + if (type == k7zIdEnd) + return SZ_ERROR_ARCHIVE; + RINOK(SzSkeepData(sd)); + } +} + +static SRes SzReadBoolVector(CSzData *sd, size_t numItems, Byte **v, ISzAlloc *alloc) +{ + Byte b = 0; + Byte mask = 0; + size_t i; + MY_ALLOC(Byte, *v, numItems, alloc); + for (i = 0; i < numItems; i++) + { + if (mask == 0) + { + RINOK(SzReadByte(sd, &b)); + mask = 0x80; + } + (*v)[i] = (Byte)(((b & mask) != 0) ? 1 : 0); + mask >>= 1; + } + return SZ_OK; +} + +static SRes SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, ISzAlloc *alloc) +{ + Byte allAreDefined; + size_t i; + RINOK(SzReadByte(sd, &allAreDefined)); + if (allAreDefined == 0) + return SzReadBoolVector(sd, numItems, v, alloc); + MY_ALLOC(Byte, *v, numItems, alloc); + for (i = 0; i < numItems; i++) + (*v)[i] = 1; + return SZ_OK; +} + +static SRes SzReadHashDigests( + CSzData *sd, + size_t numItems, + Byte **digestsDefined, + UInt32 **digests, + ISzAlloc *alloc) +{ + size_t i; + RINOK(SzReadBoolVector2(sd, numItems, digestsDefined, alloc)); + MY_ALLOC(UInt32, *digests, numItems, alloc); + for (i = 0; i < numItems; i++) + if ((*digestsDefined)[i]) + { + RINOK(SzReadUInt32(sd, (*digests) + i)); + } + return SZ_OK; +} + +static SRes SzReadPackInfo( + CSzData *sd, + UInt64 *dataOffset, + UInt32 *numPackStreams, + UInt64 **packSizes, + Byte **packCRCsDefined, + UInt32 **packCRCs, + ISzAlloc *alloc) +{ + UInt32 i; + RINOK(SzReadNumber(sd, dataOffset)); + RINOK(SzReadNumber32(sd, numPackStreams)); + + RINOK(SzWaitAttribute(sd, k7zIdSize)); + + MY_ALLOC(UInt64, *packSizes, (size_t)*numPackStreams, alloc); + + for (i = 0; i < *numPackStreams; i++) + { + RINOK(SzReadNumber(sd, (*packSizes) + i)); + } + + for (;;) + { + UInt64 type; + RINOK(SzReadID(sd, &type)); + if (type == k7zIdEnd) + break; + if (type == k7zIdCRC) + { + RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, alloc)); + continue; + } + RINOK(SzSkeepData(sd)); + } + if (*packCRCsDefined == 0) + { + MY_ALLOC(Byte, *packCRCsDefined, (size_t)*numPackStreams, alloc); + MY_ALLOC(UInt32, *packCRCs, (size_t)*numPackStreams, alloc); + for (i = 0; i < *numPackStreams; i++) + { + (*packCRCsDefined)[i] = 0; + (*packCRCs)[i] = 0; + } + } + return SZ_OK; +} + +static SRes SzReadSwitch(CSzData *sd) +{ + Byte external; + RINOK(SzReadByte(sd, &external)); + return (external == 0) ? SZ_OK: SZ_ERROR_UNSUPPORTED; +} + +static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc) +{ + UInt32 numCoders, numBindPairs, numPackStreams, i; + UInt32 numInStreams = 0, numOutStreams = 0; + + RINOK(SzReadNumber32(sd, &numCoders)); + if (numCoders > NUM_FOLDER_CODERS_MAX) + return SZ_ERROR_UNSUPPORTED; + folder->NumCoders = numCoders; + + MY_ALLOC(CSzCoderInfo, folder->Coders, (size_t)numCoders, alloc); + + for (i = 0; i < numCoders; i++) + SzCoderInfo_Init(folder->Coders + i); + + for (i = 0; i < numCoders; i++) + { + Byte mainByte; + CSzCoderInfo *coder = folder->Coders + i; + { + unsigned idSize, j; + Byte longID[15]; + RINOK(SzReadByte(sd, &mainByte)); + idSize = (unsigned)(mainByte & 0xF); + RINOK(SzReadBytes(sd, longID, idSize)); + if (idSize > sizeof(coder->MethodID)) + return SZ_ERROR_UNSUPPORTED; + coder->MethodID = 0; + for (j = 0; j < idSize; j++) + coder->MethodID |= (UInt64)longID[idSize - 1 - j] << (8 * j); + + if ((mainByte & 0x10) != 0) + { + RINOK(SzReadNumber32(sd, &coder->NumInStreams)); + RINOK(SzReadNumber32(sd, &coder->NumOutStreams)); + if (coder->NumInStreams > NUM_CODER_STREAMS_MAX || + coder->NumOutStreams > NUM_CODER_STREAMS_MAX) + return SZ_ERROR_UNSUPPORTED; + } + else + { + coder->NumInStreams = 1; + coder->NumOutStreams = 1; + } + if ((mainByte & 0x20) != 0) + { + UInt64 propertiesSize = 0; + RINOK(SzReadNumber(sd, &propertiesSize)); + if (!Buf_Create(&coder->Props, (size_t)propertiesSize, alloc)) + return SZ_ERROR_MEM; + RINOK(SzReadBytes(sd, coder->Props.data, (size_t)propertiesSize)); + } + } + while ((mainByte & 0x80) != 0) + { + RINOK(SzReadByte(sd, &mainByte)); + RINOK(SzSkeepDataSize(sd, (mainByte & 0xF))); + if ((mainByte & 0x10) != 0) + { + UInt32 n; + RINOK(SzReadNumber32(sd, &n)); + RINOK(SzReadNumber32(sd, &n)); + } + if ((mainByte & 0x20) != 0) + { + UInt64 propertiesSize = 0; + RINOK(SzReadNumber(sd, &propertiesSize)); + RINOK(SzSkeepDataSize(sd, propertiesSize)); + } + } + numInStreams += coder->NumInStreams; + numOutStreams += coder->NumOutStreams; + } + + if (numOutStreams == 0) + return SZ_ERROR_UNSUPPORTED; + + folder->NumBindPairs = numBindPairs = numOutStreams - 1; + MY_ALLOC(CSzBindPair, folder->BindPairs, (size_t)numBindPairs, alloc); + + for (i = 0; i < numBindPairs; i++) + { + CSzBindPair *bp = folder->BindPairs + i; + RINOK(SzReadNumber32(sd, &bp->InIndex)); + RINOK(SzReadNumber32(sd, &bp->OutIndex)); + } + + if (numInStreams < numBindPairs) + return SZ_ERROR_UNSUPPORTED; + + folder->NumPackStreams = numPackStreams = numInStreams - numBindPairs; + MY_ALLOC(UInt32, folder->PackStreams, (size_t)numPackStreams, alloc); + + if (numPackStreams == 1) + { + for (i = 0; i < numInStreams ; i++) + if (SzFolder_FindBindPairForInStream(folder, i) < 0) + break; + if (i == numInStreams) + return SZ_ERROR_UNSUPPORTED; + folder->PackStreams[0] = i; + } + else + for (i = 0; i < numPackStreams; i++) + { + RINOK(SzReadNumber32(sd, folder->PackStreams + i)); + } + return SZ_OK; +} + +static SRes SzReadUnpackInfo( + CSzData *sd, + UInt32 *numFolders, + CSzFolder **folders, /* for alloc */ + ISzAlloc *alloc, + ISzAlloc *allocTemp) +{ + UInt32 i; + RINOK(SzWaitAttribute(sd, k7zIdFolder)); + RINOK(SzReadNumber32(sd, numFolders)); + { + RINOK(SzReadSwitch(sd)); + + MY_ALLOC(CSzFolder, *folders, (size_t)*numFolders, alloc); + + for (i = 0; i < *numFolders; i++) + SzFolder_Init((*folders) + i); + + for (i = 0; i < *numFolders; i++) + { + RINOK(SzGetNextFolderItem(sd, (*folders) + i, alloc)); + } + } + + RINOK(SzWaitAttribute(sd, k7zIdCodersUnpackSize)); + + for (i = 0; i < *numFolders; i++) + { + UInt32 j; + CSzFolder *folder = (*folders) + i; + UInt32 numOutStreams = SzFolder_GetNumOutStreams(folder); + + MY_ALLOC(UInt64, folder->UnpackSizes, (size_t)numOutStreams, alloc); + + for (j = 0; j < numOutStreams; j++) + { + RINOK(SzReadNumber(sd, folder->UnpackSizes + j)); + } + } + + for (;;) + { + UInt64 type; + RINOK(SzReadID(sd, &type)); + if (type == k7zIdEnd) + return SZ_OK; + if (type == k7zIdCRC) + { + SRes res; + Byte *crcsDefined = 0; + UInt32 *crcs = 0; + res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp); + if (res == SZ_OK) + { + for (i = 0; i < *numFolders; i++) + { + CSzFolder *folder = (*folders) + i; + folder->UnpackCRCDefined = crcsDefined[i]; + folder->UnpackCRC = crcs[i]; + } + } + IAlloc_Free(allocTemp, crcs); + IAlloc_Free(allocTemp, crcsDefined); + RINOK(res); + continue; + } + RINOK(SzSkeepData(sd)); + } +} + +static SRes SzReadSubStreamsInfo( + CSzData *sd, + UInt32 numFolders, + CSzFolder *folders, + UInt32 *numUnpackStreams, + UInt64 **unpackSizes, + Byte **digestsDefined, + UInt32 **digests, + ISzAlloc *allocTemp) +{ + UInt64 type = 0; + UInt32 i; + UInt32 si = 0; + UInt32 numDigests = 0; + + for (i = 0; i < numFolders; i++) + folders[i].NumUnpackStreams = 1; + *numUnpackStreams = numFolders; + + for (;;) + { + RINOK(SzReadID(sd, &type)); + if (type == k7zIdNumUnpackStream) + { + *numUnpackStreams = 0; + for (i = 0; i < numFolders; i++) + { + UInt32 numStreams; + RINOK(SzReadNumber32(sd, &numStreams)); + folders[i].NumUnpackStreams = numStreams; + *numUnpackStreams += numStreams; + } + continue; + } + if (type == k7zIdCRC || type == k7zIdSize) + break; + if (type == k7zIdEnd) + break; + RINOK(SzSkeepData(sd)); + } + + if (*numUnpackStreams == 0) + { + *unpackSizes = 0; + *digestsDefined = 0; + *digests = 0; + } + else + { + *unpackSizes = (UInt64 *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(UInt64)); + RINOM(*unpackSizes); + *digestsDefined = (Byte *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(Byte)); + RINOM(*digestsDefined); + *digests = (UInt32 *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(UInt32)); + RINOM(*digests); + } + + for (i = 0; i < numFolders; i++) + { + /* + v3.13 incorrectly worked with empty folders + v4.07: we check that folder is empty + */ + UInt64 sum = 0; + UInt32 j; + UInt32 numSubstreams = folders[i].NumUnpackStreams; + if (numSubstreams == 0) + continue; + if (type == k7zIdSize) + for (j = 1; j < numSubstreams; j++) + { + UInt64 size; + RINOK(SzReadNumber(sd, &size)); + (*unpackSizes)[si++] = size; + sum += size; + } + (*unpackSizes)[si++] = SzFolder_GetUnpackSize(folders + i) - sum; + } + if (type == k7zIdSize) + { + RINOK(SzReadID(sd, &type)); + } + + for (i = 0; i < *numUnpackStreams; i++) + { + (*digestsDefined)[i] = 0; + (*digests)[i] = 0; + } + + + for (i = 0; i < numFolders; i++) + { + UInt32 numSubstreams = folders[i].NumUnpackStreams; + if (numSubstreams != 1 || !folders[i].UnpackCRCDefined) + numDigests += numSubstreams; + } + + + si = 0; + for (;;) + { + if (type == k7zIdCRC) + { + int digestIndex = 0; + Byte *digestsDefined2 = 0; + UInt32 *digests2 = 0; + SRes res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp); + if (res == SZ_OK) + { + for (i = 0; i < numFolders; i++) + { + CSzFolder *folder = folders + i; + UInt32 numSubstreams = folder->NumUnpackStreams; + if (numSubstreams == 1 && folder->UnpackCRCDefined) + { + (*digestsDefined)[si] = 1; + (*digests)[si] = folder->UnpackCRC; + si++; + } + else + { + UInt32 j; + for (j = 0; j < numSubstreams; j++, digestIndex++) + { + (*digestsDefined)[si] = digestsDefined2[digestIndex]; + (*digests)[si] = digests2[digestIndex]; + si++; + } + } + } + } + IAlloc_Free(allocTemp, digestsDefined2); + IAlloc_Free(allocTemp, digests2); + RINOK(res); + } + else if (type == k7zIdEnd) + return SZ_OK; + else + { + RINOK(SzSkeepData(sd)); + } + RINOK(SzReadID(sd, &type)); + } +} + + +static SRes SzReadStreamsInfo( + CSzData *sd, + UInt64 *dataOffset, + CSzAr *p, + UInt32 *numUnpackStreams, + UInt64 **unpackSizes, /* allocTemp */ + Byte **digestsDefined, /* allocTemp */ + UInt32 **digests, /* allocTemp */ + ISzAlloc *alloc, + ISzAlloc *allocTemp) +{ + for (;;) + { + UInt64 type; + RINOK(SzReadID(sd, &type)); + if ((UInt64)(int)type != type) + return SZ_ERROR_UNSUPPORTED; + switch((int)type) + { + case k7zIdEnd: + return SZ_OK; + case k7zIdPackInfo: + { + RINOK(SzReadPackInfo(sd, dataOffset, &p->NumPackStreams, + &p->PackSizes, &p->PackCRCsDefined, &p->PackCRCs, alloc)); + break; + } + case k7zIdUnpackInfo: + { + RINOK(SzReadUnpackInfo(sd, &p->NumFolders, &p->Folders, alloc, allocTemp)); + break; + } + case k7zIdSubStreamsInfo: + { + RINOK(SzReadSubStreamsInfo(sd, p->NumFolders, p->Folders, + numUnpackStreams, unpackSizes, digestsDefined, digests, allocTemp)); + break; + } + default: + return SZ_ERROR_UNSUPPORTED; + } + } +} + +size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest) +{ + size_t len = p->FileNameOffsets[fileIndex + 1] - p->FileNameOffsets[fileIndex]; + if (dest != 0) + { + size_t i; + const Byte *src = p->FileNames.data + (p->FileNameOffsets[fileIndex] * 2); + for (i = 0; i < len; i++) + dest[i] = GetUi16(src + i * 2); + } + return len; +} + +static SRes SzReadFileNames(const Byte *p, size_t size, UInt32 numFiles, size_t *sizes) +{ + UInt32 i; + size_t pos = 0; + for (i = 0; i < numFiles; i++) + { + sizes[i] = pos; + for (;;) + { + if (pos >= size) + return SZ_ERROR_ARCHIVE; + if (p[pos * 2] == 0 && p[pos * 2 + 1] == 0) + break; + pos++; + } + pos++; + } + sizes[i] = pos; + return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE; +} + +static SRes SzReadHeader2( + CSzArEx *p, /* allocMain */ + CSzData *sd, + UInt64 **unpackSizes, /* allocTemp */ + Byte **digestsDefined, /* allocTemp */ + UInt32 **digests, /* allocTemp */ + Byte **emptyStreamVector, /* allocTemp */ + Byte **emptyFileVector, /* allocTemp */ + Byte **lwtVector, /* allocTemp */ + ISzAlloc *allocMain, + ISzAlloc *allocTemp) +{ + UInt64 type; + UInt32 numUnpackStreams = 0; + UInt32 numFiles = 0; + CSzFileItem *files = 0; + UInt32 numEmptyStreams = 0; + UInt32 i; + + RINOK(SzReadID(sd, &type)); + + if (type == k7zIdArchiveProperties) + { + RINOK(SzReadArchiveProperties(sd)); + RINOK(SzReadID(sd, &type)); + } + + + if (type == k7zIdMainStreamsInfo) + { + RINOK(SzReadStreamsInfo(sd, + &p->dataPos, + &p->db, + &numUnpackStreams, + unpackSizes, + digestsDefined, + digests, allocMain, allocTemp)); + p->dataPos += p->startPosAfterHeader; + RINOK(SzReadID(sd, &type)); + } + + if (type == k7zIdEnd) + return SZ_OK; + if (type != k7zIdFilesInfo) + return SZ_ERROR_ARCHIVE; + + RINOK(SzReadNumber32(sd, &numFiles)); + p->db.NumFiles = numFiles; + + MY_ALLOC(CSzFileItem, files, (size_t)numFiles, allocMain); + + p->db.Files = files; + for (i = 0; i < numFiles; i++) + SzFile_Init(files + i); + + for (;;) + { + UInt64 type; + UInt64 size; + RINOK(SzReadID(sd, &type)); + if (type == k7zIdEnd) + break; + RINOK(SzReadNumber(sd, &size)); + if (size > sd->Size) + return SZ_ERROR_ARCHIVE; + if ((UInt64)(int)type != type) + { + RINOK(SzSkeepDataSize(sd, size)); + } + else + switch((int)type) + { + case k7zIdName: + { + size_t namesSize; + RINOK(SzReadSwitch(sd)); + namesSize = (size_t)size - 1; + if ((namesSize & 1) != 0) + return SZ_ERROR_ARCHIVE; + if (!Buf_Create(&p->FileNames, namesSize, allocMain)) + return SZ_ERROR_MEM; + MY_ALLOC(size_t, p->FileNameOffsets, numFiles + 1, allocMain); + memcpy(p->FileNames.data, sd->Data, namesSize); + RINOK(SzReadFileNames(sd->Data, namesSize >> 1, numFiles, p->FileNameOffsets)) + RINOK(SzSkeepDataSize(sd, namesSize)); + break; + } + case k7zIdEmptyStream: + { + RINOK(SzReadBoolVector(sd, numFiles, emptyStreamVector, allocTemp)); + numEmptyStreams = 0; + for (i = 0; i < numFiles; i++) + if ((*emptyStreamVector)[i]) + numEmptyStreams++; + break; + } + case k7zIdEmptyFile: + { + RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp)); + break; + } + case k7zIdWinAttributes: + { + RINOK(SzReadBoolVector2(sd, numFiles, lwtVector, allocTemp)); + RINOK(SzReadSwitch(sd)); + for (i = 0; i < numFiles; i++) + { + CSzFileItem *f = &files[i]; + Byte defined = (*lwtVector)[i]; + f->AttribDefined = defined; + f->Attrib = 0; + if (defined) + { + RINOK(SzReadUInt32(sd, &f->Attrib)); + } + } + IAlloc_Free(allocTemp, *lwtVector); + *lwtVector = NULL; + break; + } + case k7zIdMTime: + { + RINOK(SzReadBoolVector2(sd, numFiles, lwtVector, allocTemp)); + RINOK(SzReadSwitch(sd)); + for (i = 0; i < numFiles; i++) + { + CSzFileItem *f = &files[i]; + Byte defined = (*lwtVector)[i]; + f->MTimeDefined = defined; + f->MTime.Low = f->MTime.High = 0; + if (defined) + { + RINOK(SzReadUInt32(sd, &f->MTime.Low)); + RINOK(SzReadUInt32(sd, &f->MTime.High)); + } + } + IAlloc_Free(allocTemp, *lwtVector); + *lwtVector = NULL; + break; + } + default: + { + RINOK(SzSkeepDataSize(sd, size)); + } + } + } + + { + UInt32 emptyFileIndex = 0; + UInt32 sizeIndex = 0; + for (i = 0; i < numFiles; i++) + { + CSzFileItem *file = files + i; + file->IsAnti = 0; + if (*emptyStreamVector == 0) + file->HasStream = 1; + else + file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1); + if (file->HasStream) + { + file->IsDir = 0; + file->Size = (*unpackSizes)[sizeIndex]; + file->Crc = (*digests)[sizeIndex]; + file->CrcDefined = (Byte)(*digestsDefined)[sizeIndex]; + sizeIndex++; + } + else + { + if (*emptyFileVector == 0) + file->IsDir = 1; + else + file->IsDir = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1); + emptyFileIndex++; + file->Size = 0; + file->Crc = 0; + file->CrcDefined = 0; + } + } + } + return SzArEx_Fill(p, allocMain); +} + +static SRes SzReadHeader( + CSzArEx *p, + CSzData *sd, + ISzAlloc *allocMain, + ISzAlloc *allocTemp) +{ + UInt64 *unpackSizes = 0; + Byte *digestsDefined = 0; + UInt32 *digests = 0; + Byte *emptyStreamVector = 0; + Byte *emptyFileVector = 0; + Byte *lwtVector = 0; + SRes res = SzReadHeader2(p, sd, + &unpackSizes, &digestsDefined, &digests, + &emptyStreamVector, &emptyFileVector, &lwtVector, + allocMain, allocTemp); + IAlloc_Free(allocTemp, unpackSizes); + IAlloc_Free(allocTemp, digestsDefined); + IAlloc_Free(allocTemp, digests); + IAlloc_Free(allocTemp, emptyStreamVector); + IAlloc_Free(allocTemp, emptyFileVector); + IAlloc_Free(allocTemp, lwtVector); + return res; +} + +static SRes SzReadAndDecodePackedStreams2( + ILookInStream *inStream, + CSzData *sd, + CBuf *outBuffer, + UInt64 baseOffset, + CSzAr *p, + UInt64 **unpackSizes, + Byte **digestsDefined, + UInt32 **digests, + ISzAlloc *allocTemp) +{ + + UInt32 numUnpackStreams = 0; + UInt64 dataStartPos; + CSzFolder *folder; + UInt64 unpackSize; + SRes res; + + RINOK(SzReadStreamsInfo(sd, &dataStartPos, p, + &numUnpackStreams, unpackSizes, digestsDefined, digests, + allocTemp, allocTemp)); + + dataStartPos += baseOffset; + if (p->NumFolders != 1) + return SZ_ERROR_ARCHIVE; + + folder = p->Folders; + unpackSize = SzFolder_GetUnpackSize(folder); + + RINOK(LookInStream_SeekTo(inStream, dataStartPos)); + + if (!Buf_Create(outBuffer, (size_t)unpackSize, allocTemp)) + return SZ_ERROR_MEM; + + res = SzFolder_Decode(folder, p->PackSizes, + inStream, dataStartPos, + outBuffer->data, (size_t)unpackSize, allocTemp); + RINOK(res); + if (folder->UnpackCRCDefined) + if (CrcCalc(outBuffer->data, (size_t)unpackSize) != folder->UnpackCRC) + return SZ_ERROR_CRC; + return SZ_OK; +} + +static SRes SzReadAndDecodePackedStreams( + ILookInStream *inStream, + CSzData *sd, + CBuf *outBuffer, + UInt64 baseOffset, + ISzAlloc *allocTemp) +{ + CSzAr p; + UInt64 *unpackSizes = 0; + Byte *digestsDefined = 0; + UInt32 *digests = 0; + SRes res; + SzAr_Init(&p); + res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset, + &p, &unpackSizes, &digestsDefined, &digests, + allocTemp); + SzAr_Free(&p, allocTemp); + IAlloc_Free(allocTemp, unpackSizes); + IAlloc_Free(allocTemp, digestsDefined); + IAlloc_Free(allocTemp, digests); + return res; +} + +static SRes SzArEx_Open2( + CSzArEx *p, + ILookInStream *inStream, + ISzAlloc *allocMain, + ISzAlloc *allocTemp) +{ + Byte header[k7zStartHeaderSize]; + Int64 startArcPos; + UInt64 nextHeaderOffset, nextHeaderSize; + size_t nextHeaderSizeT; + UInt32 nextHeaderCRC; + CBuf buffer; + SRes res; + + startArcPos = 0; + RINOK(inStream->Seek(inStream, &startArcPos, SZ_SEEK_CUR)); + + RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize, SZ_ERROR_NO_ARCHIVE)); + + if (!TestSignatureCandidate(header)) + return SZ_ERROR_NO_ARCHIVE; + if (header[6] != k7zMajorVersion) + return SZ_ERROR_UNSUPPORTED; + + nextHeaderOffset = GetUi64(header + 12); + nextHeaderSize = GetUi64(header + 20); + nextHeaderCRC = GetUi32(header + 28); + + p->startPosAfterHeader = startArcPos + k7zStartHeaderSize; + + if (CrcCalc(header + 12, 20) != GetUi32(header + 8)) + return SZ_ERROR_CRC; + + nextHeaderSizeT = (size_t)nextHeaderSize; + if (nextHeaderSizeT != nextHeaderSize) + return SZ_ERROR_MEM; + if (nextHeaderSizeT == 0) + return SZ_OK; + if (nextHeaderOffset > nextHeaderOffset + nextHeaderSize || + nextHeaderOffset > nextHeaderOffset + nextHeaderSize + k7zStartHeaderSize) + return SZ_ERROR_NO_ARCHIVE; + + { + Int64 pos = 0; + RINOK(inStream->Seek(inStream, &pos, SZ_SEEK_END)); + if ((UInt64)pos < startArcPos + nextHeaderOffset || + (UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset || + (UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize) + return SZ_ERROR_INPUT_EOF; + } + + RINOK(LookInStream_SeekTo(inStream, startArcPos + k7zStartHeaderSize + nextHeaderOffset)); + + if (!Buf_Create(&buffer, nextHeaderSizeT, allocTemp)) + return SZ_ERROR_MEM; + + res = LookInStream_Read(inStream, buffer.data, nextHeaderSizeT); + if (res == SZ_OK) + { + res = SZ_ERROR_ARCHIVE; + if (CrcCalc(buffer.data, nextHeaderSizeT) == nextHeaderCRC) + { + CSzData sd; + UInt64 type; + sd.Data = buffer.data; + sd.Size = buffer.size; + res = SzReadID(&sd, &type); + if (res == SZ_OK) + { + if (type == k7zIdEncodedHeader) + { + CBuf outBuffer; + Buf_Init(&outBuffer); + res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer, p->startPosAfterHeader, allocTemp); + if (res != SZ_OK) + Buf_Free(&outBuffer, allocTemp); + else + { + Buf_Free(&buffer, allocTemp); + buffer.data = outBuffer.data; + buffer.size = outBuffer.size; + sd.Data = buffer.data; + sd.Size = buffer.size; + res = SzReadID(&sd, &type); + } + } + } + if (res == SZ_OK) + { + if (type == k7zIdHeader) + res = SzReadHeader(p, &sd, allocMain, allocTemp); + else + res = SZ_ERROR_UNSUPPORTED; + } + } + } + Buf_Free(&buffer, allocTemp); + return res; +} + +SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp) +{ + SRes res = SzArEx_Open2(p, inStream, allocMain, allocTemp); + if (res != SZ_OK) + SzArEx_Free(p, allocMain); + return res; +} + +SRes SzArEx_Extract( + const CSzArEx *p, + ILookInStream *inStream, + UInt32 fileIndex, + UInt32 *blockIndex, + Byte **outBuffer, + size_t *outBufferSize, + size_t *offset, + size_t *outSizeProcessed, + ISzAlloc *allocMain, + ISzAlloc *allocTemp) +{ + UInt32 folderIndex = p->FileIndexToFolderIndexMap[fileIndex]; + SRes res = SZ_OK; + *offset = 0; + *outSizeProcessed = 0; + if (folderIndex == (UInt32)-1) + { + IAlloc_Free(allocMain, *outBuffer); + *blockIndex = folderIndex; + *outBuffer = 0; + *outBufferSize = 0; + return SZ_OK; + } + + if (*outBuffer == 0 || *blockIndex != folderIndex) + { + CSzFolder *folder = p->db.Folders + folderIndex; + UInt64 unpackSizeSpec = SzFolder_GetUnpackSize(folder); + size_t unpackSize = (size_t)unpackSizeSpec; + UInt64 startOffset = SzArEx_GetFolderStreamPos(p, folderIndex, 0); + + if (unpackSize != unpackSizeSpec) + return SZ_ERROR_MEM; + *blockIndex = folderIndex; + IAlloc_Free(allocMain, *outBuffer); + *outBuffer = 0; + + RINOK(LookInStream_SeekTo(inStream, startOffset)); + + if (res == SZ_OK) + { + *outBufferSize = unpackSize; + if (unpackSize != 0) + { + *outBuffer = (Byte *)IAlloc_Alloc(allocMain, unpackSize); + if (*outBuffer == 0) + res = SZ_ERROR_MEM; + } + if (res == SZ_OK) + { + res = SzFolder_Decode(folder, + p->db.PackSizes + p->FolderStartPackStreamIndex[folderIndex], + inStream, startOffset, + *outBuffer, unpackSize, allocTemp); + if (res == SZ_OK) + { + if (folder->UnpackCRCDefined) + { + if (CrcCalc(*outBuffer, unpackSize) != folder->UnpackCRC) + res = SZ_ERROR_CRC; + } + } + } + } + } + if (res == SZ_OK) + { + UInt32 i; + CSzFileItem *fileItem = p->db.Files + fileIndex; + *offset = 0; + for (i = p->FolderStartFileIndex[folderIndex]; i < fileIndex; i++) + *offset += (UInt32)p->db.Files[i].Size; + *outSizeProcessed = (size_t)fileItem->Size; + if (*offset + *outSizeProcessed > *outBufferSize) + return SZ_ERROR_FAIL; + if (fileItem->CrcDefined && CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->Crc) + res = SZ_ERROR_CRC; + } + return res; +} diff --git a/src/ZipLib/extlibs/lzma/7zStream.c b/src/ZipLib/extlibs/lzma/7zStream.c new file mode 100644 index 00000000..0ebb7b5f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zStream.c @@ -0,0 +1,169 @@ +/* 7zStream.c -- 7z Stream functions +2010-03-11 : Igor Pavlov : Public domain */ + +#include + +#include "Types.h" + +SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType) +{ + while (size != 0) + { + size_t processed = size; + RINOK(stream->Read(stream, buf, &processed)); + if (processed == 0) + return errorType; + buf = (void *)((Byte *)buf + processed); + size -= processed; + } + return SZ_OK; +} + +SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size) +{ + return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); +} + +SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf) +{ + size_t processed = 1; + RINOK(stream->Read(stream, buf, &processed)); + return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF; +} + +SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset) +{ + Int64 t = offset; + return stream->Seek(stream, &t, SZ_SEEK_SET); +} + +SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size) +{ + const void *lookBuf; + if (*size == 0) + return SZ_OK; + RINOK(stream->Look(stream, &lookBuf, size)); + memcpy(buf, lookBuf, *size); + return stream->Skip(stream, *size); +} + +SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType) +{ + while (size != 0) + { + size_t processed = size; + RINOK(stream->Read(stream, buf, &processed)); + if (processed == 0) + return errorType; + buf = (void *)((Byte *)buf + processed); + size -= processed; + } + return SZ_OK; +} + +SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size) +{ + return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); +} + +static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size) +{ + SRes res = SZ_OK; + CLookToRead *p = (CLookToRead *)pp; + size_t size2 = p->size - p->pos; + if (size2 == 0 && *size > 0) + { + p->pos = 0; + size2 = LookToRead_BUF_SIZE; + res = p->realStream->Read(p->realStream, p->buf, &size2); + p->size = size2; + } + if (size2 < *size) + *size = size2; + *buf = p->buf + p->pos; + return res; +} + +static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size) +{ + SRes res = SZ_OK; + CLookToRead *p = (CLookToRead *)pp; + size_t size2 = p->size - p->pos; + if (size2 == 0 && *size > 0) + { + p->pos = 0; + if (*size > LookToRead_BUF_SIZE) + *size = LookToRead_BUF_SIZE; + res = p->realStream->Read(p->realStream, p->buf, size); + size2 = p->size = *size; + } + if (size2 < *size) + *size = size2; + *buf = p->buf + p->pos; + return res; +} + +static SRes LookToRead_Skip(void *pp, size_t offset) +{ + CLookToRead *p = (CLookToRead *)pp; + p->pos += offset; + return SZ_OK; +} + +static SRes LookToRead_Read(void *pp, void *buf, size_t *size) +{ + CLookToRead *p = (CLookToRead *)pp; + size_t rem = p->size - p->pos; + if (rem == 0) + return p->realStream->Read(p->realStream, buf, size); + if (rem > *size) + rem = *size; + memcpy(buf, p->buf + p->pos, rem); + p->pos += rem; + *size = rem; + return SZ_OK; +} + +static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin) +{ + CLookToRead *p = (CLookToRead *)pp; + p->pos = p->size = 0; + return p->realStream->Seek(p->realStream, pos, origin); +} + +void LookToRead_CreateVTable(CLookToRead *p, int lookahead) +{ + p->s.Look = lookahead ? + LookToRead_Look_Lookahead : + LookToRead_Look_Exact; + p->s.Skip = LookToRead_Skip; + p->s.Read = LookToRead_Read; + p->s.Seek = LookToRead_Seek; +} + +void LookToRead_Init(CLookToRead *p) +{ + p->pos = p->size = 0; +} + +static SRes SecToLook_Read(void *pp, void *buf, size_t *size) +{ + CSecToLook *p = (CSecToLook *)pp; + return LookInStream_LookRead(p->realStream, buf, size); +} + +void SecToLook_CreateVTable(CSecToLook *p) +{ + p->s.Read = SecToLook_Read; +} + +static SRes SecToRead_Read(void *pp, void *buf, size_t *size) +{ + CSecToRead *p = (CSecToRead *)pp; + return p->realStream->Read(p->realStream, buf, size); +} + +void SecToRead_CreateVTable(CSecToRead *p) +{ + p->s.Read = SecToRead_Read; +} diff --git a/src/ZipLib/extlibs/lzma/7zVersion.h b/src/ZipLib/extlibs/lzma/7zVersion.h new file mode 100644 index 00000000..5a83e5f7 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/7zVersion.h @@ -0,0 +1,8 @@ +#define MY_VER_MAJOR 9 +#define MY_VER_MINOR 22 +#define MY_VER_BUILD 00 +#define MY_VERSION "9.22 beta" +#define MY_7ZIP_VERSION "9.22 beta" +#define MY_DATE "2011-04-18" +#define MY_COPYRIGHT ": Igor Pavlov : Public domain" +#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE diff --git a/src/ZipLib/extlibs/lzma/Alloc.c b/src/ZipLib/extlibs/lzma/Alloc.c new file mode 100644 index 00000000..358a7b52 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Alloc.c @@ -0,0 +1,127 @@ +/* Alloc.c -- Memory allocation functions +2008-09-24 +Igor Pavlov +Public domain */ + +#ifdef _WIN32 +#include +#endif +#include + +#include "Alloc.h" + +/* #define _SZ_ALLOC_DEBUG */ + +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ +#ifdef _SZ_ALLOC_DEBUG +#include +int g_allocCount = 0; +int g_allocCountMid = 0; +int g_allocCountBig = 0; +#endif + +void *MyAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + { + void *p = malloc(size); + fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p); + return p; + } + #else + return malloc(size); + #endif +} + +void MyFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address); + #endif + free(address); +} + +#ifdef _WIN32 + +void *MidAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++); + #endif + return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); +} + +void MidFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid); + #endif + if (address == 0) + return; + VirtualFree(address, 0, MEM_RELEASE); +} + +#ifndef MEM_LARGE_PAGES +#undef _7ZIP_LARGE_PAGES +#endif + +#ifdef _7ZIP_LARGE_PAGES +SIZE_T g_LargePageSize = 0; +typedef SIZE_T (WINAPI *GetLargePageMinimumP)(); +#endif + +void SetLargePageSize() +{ + #ifdef _7ZIP_LARGE_PAGES + SIZE_T size = 0; + GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP) + GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum"); + if (largePageMinimum == 0) + return; + size = largePageMinimum(); + if (size == 0 || (size & (size - 1)) != 0) + return; + g_LargePageSize = size; + #endif +} + + +void *BigAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); + #endif + + #ifdef _7ZIP_LARGE_PAGES + if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18)) + { + void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)), + MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE); + if (res != 0) + return res; + } + #endif + return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); +} + +void BigFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig); + #endif + + if (address == 0) + return; + VirtualFree(address, 0, MEM_RELEASE); +} + +#endif diff --git a/src/ZipLib/extlibs/lzma/Alloc.h b/src/ZipLib/extlibs/lzma/Alloc.h new file mode 100644 index 00000000..b8e41436 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Alloc.h @@ -0,0 +1,38 @@ +/* Alloc.h -- Memory allocation functions +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __COMMON_ALLOC_H +#define __COMMON_ALLOC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void *MyAlloc(size_t size); +void MyFree(void *address); + +#ifdef _WIN32 + +void SetLargePageSize(); + +void *MidAlloc(size_t size); +void MidFree(void *address); +void *BigAlloc(size_t size); +void BigFree(void *address); + +#else + +#define MidAlloc(size) MyAlloc(size) +#define MidFree(address) MyFree(address) +#define BigAlloc(size) MyAlloc(size) +#define BigFree(address) MyFree(address) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Bcj2.c b/src/ZipLib/extlibs/lzma/Bcj2.c new file mode 100644 index 00000000..20199ce5 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Bcj2.c @@ -0,0 +1,132 @@ +/* Bcj2.c -- Converter for x86 code (BCJ2) +2008-10-04 : Igor Pavlov : Public domain */ + +#include "Bcj2.h" + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define IsJcc(b0, b1) ((b0) == 0x0F && ((b1) & 0xF0) == 0x80) +#define IsJ(b0, b1) ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)) + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*buffer++) +#define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; } +#define RC_INIT2 code = 0; range = 0xFFFFFFFF; \ + { int i; for (i = 0; i < 5; i++) { RC_TEST; code = (code << 8) | RC_READ_BYTE; }} + +#define NORMALIZE if (range < kTopValue) { RC_TEST; range <<= 8; code = (code << 8) | RC_READ_BYTE; } + +#define IF_BIT_0(p) ttt = *(p); bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0(p) range = bound; *(p) = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); NORMALIZE; +#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CProb)(ttt - (ttt >> kNumMoveBits)); NORMALIZE; + +int Bcj2_Decode( + const Byte *buf0, SizeT size0, + const Byte *buf1, SizeT size1, + const Byte *buf2, SizeT size2, + const Byte *buf3, SizeT size3, + Byte *outBuf, SizeT outSize) +{ + CProb p[256 + 2]; + SizeT inPos = 0, outPos = 0; + + const Byte *buffer, *bufferLim; + UInt32 range, code; + Byte prevByte = 0; + + unsigned int i; + for (i = 0; i < sizeof(p) / sizeof(p[0]); i++) + p[i] = kBitModelTotal >> 1; + + buffer = buf3; + bufferLim = buffer + size3; + RC_INIT2 + + if (outSize == 0) + return SZ_OK; + + for (;;) + { + Byte b; + CProb *prob; + UInt32 bound; + UInt32 ttt; + + SizeT limit = size0 - inPos; + if (outSize - outPos < limit) + limit = outSize - outPos; + while (limit != 0) + { + Byte b = buf0[inPos]; + outBuf[outPos++] = b; + if (IsJ(prevByte, b)) + break; + inPos++; + prevByte = b; + limit--; + } + + if (limit == 0 || outPos == outSize) + break; + + b = buf0[inPos++]; + + if (b == 0xE8) + prob = p + prevByte; + else if (b == 0xE9) + prob = p + 256; + else + prob = p + 257; + + IF_BIT_0(prob) + { + UPDATE_0(prob) + prevByte = b; + } + else + { + UInt32 dest; + const Byte *v; + UPDATE_1(prob) + if (b == 0xE8) + { + v = buf1; + if (size1 < 4) + return SZ_ERROR_DATA; + buf1 += 4; + size1 -= 4; + } + else + { + v = buf2; + if (size2 < 4) + return SZ_ERROR_DATA; + buf2 += 4; + size2 -= 4; + } + dest = (((UInt32)v[0] << 24) | ((UInt32)v[1] << 16) | + ((UInt32)v[2] << 8) | ((UInt32)v[3])) - ((UInt32)outPos + 4); + outBuf[outPos++] = (Byte)dest; + if (outPos == outSize) + break; + outBuf[outPos++] = (Byte)(dest >> 8); + if (outPos == outSize) + break; + outBuf[outPos++] = (Byte)(dest >> 16); + if (outPos == outSize) + break; + outBuf[outPos++] = prevByte = (Byte)(dest >> 24); + } + } + return (outPos == outSize) ? SZ_OK : SZ_ERROR_DATA; +} diff --git a/src/ZipLib/extlibs/lzma/Bcj2.h b/src/ZipLib/extlibs/lzma/Bcj2.h new file mode 100644 index 00000000..dbc05414 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Bcj2.h @@ -0,0 +1,38 @@ +/* Bcj2.h -- Converter for x86 code (BCJ2) +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __BCJ2_H +#define __BCJ2_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Conditions: + outSize <= FullOutputSize, + where FullOutputSize is full size of output stream of x86_2 filter. + +If buf0 overlaps outBuf, there are two required conditions: + 1) (buf0 >= outBuf) + 2) (buf0 + size0 >= outBuf + FullOutputSize). + +Returns: + SZ_OK + SZ_ERROR_DATA - Data error +*/ + +int Bcj2_Decode( + const Byte *buf0, SizeT size0, + const Byte *buf1, SizeT size1, + const Byte *buf2, SizeT size2, + const Byte *buf3, SizeT size3, + Byte *outBuf, SizeT outSize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Bra.c b/src/ZipLib/extlibs/lzma/Bra.c new file mode 100644 index 00000000..2e47b141 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Bra.c @@ -0,0 +1,133 @@ +/* Bra.c -- Converters for RISC code +2010-04-16 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + ip += 8; + for (i = 0; i <= size; i += 4) + { + if (data[i + 3] == 0xEB) + { + UInt32 dest; + UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]); + src <<= 2; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + dest >>= 2; + data[i + 2] = (Byte)(dest >> 16); + data[i + 1] = (Byte)(dest >> 8); + data[i + 0] = (Byte)dest; + } + } + return i; +} + +SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + ip += 4; + for (i = 0; i <= size; i += 2) + { + if ((data[i + 1] & 0xF8) == 0xF0 && + (data[i + 3] & 0xF8) == 0xF8) + { + UInt32 dest; + UInt32 src = + (((UInt32)data[i + 1] & 0x7) << 19) | + ((UInt32)data[i + 0] << 11) | + (((UInt32)data[i + 3] & 0x7) << 8) | + (data[i + 2]); + + src <<= 1; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + dest >>= 1; + + data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7)); + data[i + 0] = (Byte)(dest >> 11); + data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7)); + data[i + 2] = (Byte)dest; + i += 2; + } + } + return i; +} + +SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + for (i = 0; i <= size; i += 4) + { + if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1) + { + UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) | + ((UInt32)data[i + 1] << 16) | + ((UInt32)data[i + 2] << 8) | + ((UInt32)data[i + 3] & (~3)); + + UInt32 dest; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3)); + data[i + 1] = (Byte)(dest >> 16); + data[i + 2] = (Byte)(dest >> 8); + data[i + 3] &= 0x3; + data[i + 3] |= dest; + } + } + return i; +} + +SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + UInt32 i; + if (size < 4) + return 0; + size -= 4; + for (i = 0; i <= size; i += 4) + { + if ((data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00) || + (data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)) + { + UInt32 src = + ((UInt32)data[i + 0] << 24) | + ((UInt32)data[i + 1] << 16) | + ((UInt32)data[i + 2] << 8) | + ((UInt32)data[i + 3]); + UInt32 dest; + + src <<= 2; + if (encoding) + dest = ip + i + src; + else + dest = src - (ip + i); + dest >>= 2; + + dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000; + + data[i + 0] = (Byte)(dest >> 24); + data[i + 1] = (Byte)(dest >> 16); + data[i + 2] = (Byte)(dest >> 8); + data[i + 3] = (Byte)dest; + } + } + return i; +} diff --git a/src/ZipLib/extlibs/lzma/Bra.h b/src/ZipLib/extlibs/lzma/Bra.h new file mode 100644 index 00000000..5748c1c0 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Bra.h @@ -0,0 +1,68 @@ +/* Bra.h -- Branch converters for executables +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __BRA_H +#define __BRA_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +These functions convert relative addresses to absolute addresses +in CALL instructions to increase the compression ratio. + + In: + data - data buffer + size - size of data + ip - current virtual Instruction Pinter (IP) value + state - state variable for x86 converter + encoding - 0 (for decoding), 1 (for encoding) + + Out: + state - state variable for x86 converter + + Returns: + The number of processed bytes. If you call these functions with multiple calls, + you must start next call with first byte after block of processed bytes. + + Type Endian Alignment LookAhead + + x86 little 1 4 + ARMT little 2 2 + ARM little 4 0 + PPC big 4 0 + SPARC big 4 0 + IA64 little 16 0 + + size must be >= Alignment + LookAhead, if it's not last block. + If (size < Alignment + LookAhead), converter returns 0. + + Example: + + UInt32 ip = 0; + for () + { + ; size must be >= Alignment + LookAhead, if it's not last block + SizeT processed = Convert(data, size, ip, 1); + data += processed; + size -= processed; + ip += processed; + } +*/ + +#define x86_Convert_Init(state) { state = 0; } +SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); +SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Bra86.c b/src/ZipLib/extlibs/lzma/Bra86.c new file mode 100644 index 00000000..1ee0e709 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Bra86.c @@ -0,0 +1,85 @@ +/* Bra86.c -- Converter for x86 code (BCJ) +2008-10-04 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) + +const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0}; +const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3}; + +SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) +{ + SizeT bufferPos = 0, prevPosT; + UInt32 prevMask = *state & 0x7; + if (size < 5) + return 0; + ip += 5; + prevPosT = (SizeT)0 - 1; + + for (;;) + { + Byte *p = data + bufferPos; + Byte *limit = data + size - 4; + for (; p < limit; p++) + if ((*p & 0xFE) == 0xE8) + break; + bufferPos = (SizeT)(p - data); + if (p >= limit) + break; + prevPosT = bufferPos - prevPosT; + if (prevPosT > 3) + prevMask = 0; + else + { + prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7; + if (prevMask != 0) + { + Byte b = p[4 - kMaskToBitNumber[prevMask]]; + if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b)) + { + prevPosT = bufferPos; + prevMask = ((prevMask << 1) & 0x7) | 1; + bufferPos++; + continue; + } + } + } + prevPosT = bufferPos; + + if (Test86MSByte(p[4])) + { + UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); + UInt32 dest; + for (;;) + { + Byte b; + int index; + if (encoding) + dest = (ip + (UInt32)bufferPos) + src; + else + dest = src - (ip + (UInt32)bufferPos); + if (prevMask == 0) + break; + index = kMaskToBitNumber[prevMask] * 8; + b = (Byte)(dest >> (24 - index)); + if (!Test86MSByte(b)) + break; + src = dest ^ ((1 << (32 - index)) - 1); + } + p[4] = (Byte)(~(((dest >> 24) & 1) - 1)); + p[3] = (Byte)(dest >> 16); + p[2] = (Byte)(dest >> 8); + p[1] = (Byte)dest; + bufferPos += 5; + } + else + { + prevMask = ((prevMask << 1) & 0x7) | 1; + bufferPos++; + } + } + prevPosT = bufferPos - prevPosT; + *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7)); + return bufferPos; +} diff --git a/src/ZipLib/extlibs/lzma/BraIA64.c b/src/ZipLib/extlibs/lzma/BraIA64.c new file mode 100644 index 00000000..0b4ee85b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/BraIA64.c @@ -0,0 +1,67 @@ +/* BraIA64.c -- Converter for IA-64 code +2008-10-04 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +static const Byte kBranchTable[32] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 6, 6, 0, 0, 7, 7, + 4, 4, 0, 0, 4, 4, 0, 0 +}; + +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 16) + return 0; + size -= 16; + for (i = 0; i <= size; i += 16) + { + UInt32 instrTemplate = data[i] & 0x1F; + UInt32 mask = kBranchTable[instrTemplate]; + UInt32 bitPos = 5; + int slot; + for (slot = 0; slot < 3; slot++, bitPos += 41) + { + UInt32 bytePos, bitRes; + UInt64 instruction, instNorm; + int j; + if (((mask >> slot) & 1) == 0) + continue; + bytePos = (bitPos >> 3); + bitRes = bitPos & 0x7; + instruction = 0; + for (j = 0; j < 6; j++) + instruction += (UInt64)data[i + j + bytePos] << (8 * j); + + instNorm = instruction >> bitRes; + if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0) + { + UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF); + UInt32 dest; + src |= ((UInt32)(instNorm >> 36) & 1) << 20; + + src <<= 4; + + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + + dest >>= 4; + + instNorm &= ~((UInt64)(0x8FFFFF) << 13); + instNorm |= ((UInt64)(dest & 0xFFFFF) << 13); + instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20)); + + instruction &= (1 << bitRes) - 1; + instruction |= (instNorm << bitRes); + for (j = 0; j < 6; j++) + data[i + j + bytePos] = (Byte)(instruction >> (8 * j)); + } + } + } + return i; +} diff --git a/src/ZipLib/extlibs/lzma/CpuArch.c b/src/ZipLib/extlibs/lzma/CpuArch.c new file mode 100644 index 00000000..260cc1f4 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/CpuArch.c @@ -0,0 +1,168 @@ +/* CpuArch.c -- CPU specific code +2010-10-26: Igor Pavlov : Public domain */ + +#include "CpuArch.h" + +#ifdef MY_CPU_X86_OR_AMD64 + +#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__) +#define USE_ASM +#endif + +#if defined(USE_ASM) && !defined(MY_CPU_AMD64) +static UInt32 CheckFlag(UInt32 flag) +{ + #ifdef _MSC_VER + __asm pushfd; + __asm pop EAX; + __asm mov EDX, EAX; + __asm xor EAX, flag; + __asm push EAX; + __asm popfd; + __asm pushfd; + __asm pop EAX; + __asm xor EAX, EDX; + __asm push EDX; + __asm popfd; + __asm and flag, EAX; + #else + __asm__ __volatile__ ( + "pushf\n\t" + "pop %%EAX\n\t" + "movl %%EAX,%%EDX\n\t" + "xorl %0,%%EAX\n\t" + "push %%EAX\n\t" + "popf\n\t" + "pushf\n\t" + "pop %%EAX\n\t" + "xorl %%EDX,%%EAX\n\t" + "push %%EDX\n\t" + "popf\n\t" + "andl %%EAX, %0\n\t": + "=c" (flag) : "c" (flag)); + #endif + return flag; +} +#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False; +#else +#define CHECK_CPUID_IS_SUPPORTED +#endif + +static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) +{ + #ifdef USE_ASM + + #ifdef _MSC_VER + + UInt32 a2, b2, c2, d2; + __asm xor EBX, EBX; + __asm xor ECX, ECX; + __asm xor EDX, EDX; + __asm mov EAX, function; + __asm cpuid; + __asm mov a2, EAX; + __asm mov b2, EBX; + __asm mov c2, ECX; + __asm mov d2, EDX; + + *a = a2; + *b = b2; + *c = c2; + *d = d2; + + #else + + __asm__ __volatile__ ( + "cpuid" + : "=a" (*a) , + "=b" (*b) , + "=c" (*c) , + "=d" (*d) + : "0" (function)) ; + + #endif + + #else + + int CPUInfo[4]; + __cpuid(CPUInfo, function); + *a = CPUInfo[0]; + *b = CPUInfo[1]; + *c = CPUInfo[2]; + *d = CPUInfo[3]; + + #endif +} + +Bool x86cpuid_CheckAndRead(Cx86cpuid *p) +{ + CHECK_CPUID_IS_SUPPORTED + MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]); + MyCPUID(1, &p->ver, &p->b, &p->c, &p->d); + return True; +} + +static UInt32 kVendors[][3] = +{ + { 0x756E6547, 0x49656E69, 0x6C65746E}, + { 0x68747541, 0x69746E65, 0x444D4163}, + { 0x746E6543, 0x48727561, 0x736C7561} +}; + +int x86cpuid_GetFirm(const Cx86cpuid *p) +{ + unsigned i; + for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++) + { + const UInt32 *v = kVendors[i]; + if (v[0] == p->vendor[0] && + v[1] == p->vendor[1] && + v[2] == p->vendor[2]) + return (int)i; + } + return -1; +} + +Bool CPU_Is_InOrder() +{ + Cx86cpuid p; + int firm; + UInt32 family, model; + if (!x86cpuid_CheckAndRead(&p)) + return True; + family = x86cpuid_GetFamily(&p); + model = x86cpuid_GetModel(&p); + firm = x86cpuid_GetFirm(&p); + switch (firm) + { + case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && model == 0x100C)); + case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA))); + case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF)); + } + return True; +} + +#if !defined(MY_CPU_AMD64) && defined(_WIN32) +static Bool CPU_Sys_Is_SSE_Supported() +{ + OSVERSIONINFO vi; + vi.dwOSVersionInfoSize = sizeof(vi); + if (!GetVersionEx(&vi)) + return False; + return (vi.dwMajorVersion >= 5); +} +#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False; +#else +#define CHECK_SYS_SSE_SUPPORT +#endif + +Bool CPU_Is_Aes_Supported() +{ + Cx86cpuid p; + CHECK_SYS_SSE_SUPPORT + if (!x86cpuid_CheckAndRead(&p)) + return False; + return (p.c >> 25) & 1; +} + +#endif diff --git a/src/ZipLib/extlibs/lzma/CpuArch.h b/src/ZipLib/extlibs/lzma/CpuArch.h new file mode 100644 index 00000000..e3d7af2e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/CpuArch.h @@ -0,0 +1,155 @@ +/* CpuArch.h -- CPU specific code +2010-12-01: Igor Pavlov : Public domain */ + +#ifndef __CPU_ARCH_H +#define __CPU_ARCH_H + +#include "Types.h" + +EXTERN_C_BEGIN + +/* +MY_CPU_LE means that CPU is LITTLE ENDIAN. +If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN). + +MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. +If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform. +*/ + +#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) +#define MY_CPU_AMD64 +#endif + +#if defined(MY_CPU_AMD64) || defined(_M_IA64) +#define MY_CPU_64BIT +#endif + +#if defined(_M_IX86) || defined(__i386__) +#define MY_CPU_X86 +#endif + +#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64) +#define MY_CPU_X86_OR_AMD64 +#endif + +#if defined(MY_CPU_X86) || defined(_M_ARM) +#define MY_CPU_32BIT +#endif + +#if defined(_WIN32) && defined(_M_ARM) +#define MY_CPU_ARM_LE +#endif + +#if defined(_WIN32) && defined(_M_IA64) +#define MY_CPU_IA64_LE +#endif + +#if defined(MY_CPU_X86_OR_AMD64) +#define MY_CPU_LE_UNALIGN +#endif + +#if defined(MY_CPU_X86_OR_AMD64) || defined(MY_CPU_ARM_LE) || defined(MY_CPU_IA64_LE) || defined(__ARMEL__) || defined(__MIPSEL__) || defined(__LITTLE_ENDIAN__) +#define MY_CPU_LE +#endif + +#if defined(__BIG_ENDIAN__) || defined(__m68k__) || defined(__ARMEB__) || defined(__MIPSEB__) +#define MY_CPU_BE +#endif + +#if defined(MY_CPU_LE) && defined(MY_CPU_BE) +Stop_Compiling_Bad_Endian +#endif + +#ifdef MY_CPU_LE_UNALIGN + +#define GetUi16(p) (*(const UInt16 *)(p)) +#define GetUi32(p) (*(const UInt32 *)(p)) +#define GetUi64(p) (*(const UInt64 *)(p)) +#define SetUi16(p, d) *(UInt16 *)(p) = (d); +#define SetUi32(p, d) *(UInt32 *)(p) = (d); +#define SetUi64(p, d) *(UInt64 *)(p) = (d); + +#else + +#define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8)) + +#define GetUi32(p) ( \ + ((const Byte *)(p))[0] | \ + ((UInt32)((const Byte *)(p))[1] << 8) | \ + ((UInt32)((const Byte *)(p))[2] << 16) | \ + ((UInt32)((const Byte *)(p))[3] << 24)) + +#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) + +#define SetUi16(p, d) { UInt32 _x_ = (d); \ + ((Byte *)(p))[0] = (Byte)_x_; \ + ((Byte *)(p))[1] = (Byte)(_x_ >> 8); } + +#define SetUi32(p, d) { UInt32 _x_ = (d); \ + ((Byte *)(p))[0] = (Byte)_x_; \ + ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \ + ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \ + ((Byte *)(p))[3] = (Byte)(_x_ >> 24); } + +#define SetUi64(p, d) { UInt64 _x64_ = (d); \ + SetUi32(p, (UInt32)_x64_); \ + SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); } + +#endif + +#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) + +#pragma intrinsic(_byteswap_ulong) +#pragma intrinsic(_byteswap_uint64) +#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) +#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) + +#else + +#define GetBe32(p) ( \ + ((UInt32)((const Byte *)(p))[0] << 24) | \ + ((UInt32)((const Byte *)(p))[1] << 16) | \ + ((UInt32)((const Byte *)(p))[2] << 8) | \ + ((const Byte *)(p))[3] ) + +#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) + +#endif + +#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1]) + + +#ifdef MY_CPU_X86_OR_AMD64 + +typedef struct +{ + UInt32 maxFunc; + UInt32 vendor[3]; + UInt32 ver; + UInt32 b; + UInt32 c; + UInt32 d; +} Cx86cpuid; + +enum +{ + CPU_FIRM_INTEL, + CPU_FIRM_AMD, + CPU_FIRM_VIA +}; + +Bool x86cpuid_CheckAndRead(Cx86cpuid *p); +int x86cpuid_GetFirm(const Cx86cpuid *p); + +#define x86cpuid_GetFamily(p) (((p)->ver >> 8) & 0xFF00F) +#define x86cpuid_GetModel(p) (((p)->ver >> 4) & 0xF00F) +#define x86cpuid_GetStepping(p) ((p)->ver & 0xF) + +Bool CPU_Is_InOrder(); +Bool CPU_Is_Aes_Supported(); + +#endif + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Delta.c b/src/ZipLib/extlibs/lzma/Delta.c new file mode 100644 index 00000000..2b327f15 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Delta.c @@ -0,0 +1,62 @@ +/* Delta.c -- Delta converter +2009-05-26 : Igor Pavlov : Public domain */ + +#include "Delta.h" + +void Delta_Init(Byte *state) +{ + unsigned i; + for (i = 0; i < DELTA_STATE_SIZE; i++) + state[i] = 0; +} + +static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) +{ + unsigned i; + for (i = 0; i < size; i++) + dest[i] = src[i]; +} + +void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) +{ + Byte buf[DELTA_STATE_SIZE]; + unsigned j = 0; + MyMemCpy(buf, state, delta); + { + SizeT i; + for (i = 0; i < size;) + { + for (j = 0; j < delta && i < size; i++, j++) + { + Byte b = data[i]; + data[i] = (Byte)(b - buf[j]); + buf[j] = b; + } + } + } + if (j == delta) + j = 0; + MyMemCpy(state, buf + j, delta - j); + MyMemCpy(state + delta - j, buf, j); +} + +void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) +{ + Byte buf[DELTA_STATE_SIZE]; + unsigned j = 0; + MyMemCpy(buf, state, delta); + { + SizeT i; + for (i = 0; i < size;) + { + for (j = 0; j < delta && i < size; i++, j++) + { + buf[j] = data[i] = (Byte)(buf[j] + data[i]); + } + } + } + if (j == delta) + j = 0; + MyMemCpy(state, buf + j, delta - j); + MyMemCpy(state + delta - j, buf, j); +} diff --git a/src/ZipLib/extlibs/lzma/Delta.h b/src/ZipLib/extlibs/lzma/Delta.h new file mode 100644 index 00000000..0d4cd627 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Delta.h @@ -0,0 +1,23 @@ +/* Delta.h -- Delta converter +2009-04-15 : Igor Pavlov : Public domain */ + +#ifndef __DELTA_H +#define __DELTA_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DELTA_STATE_SIZE 256 + +void Delta_Init(Byte *state); +void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); +void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/LzFind.c b/src/ZipLib/extlibs/lzma/LzFind.c new file mode 100644 index 00000000..e3ecb054 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzFind.c @@ -0,0 +1,761 @@ +/* LzFind.c -- Match finder for LZ algorithms +2009-04-22 : Igor Pavlov : Public domain */ + +#include + +#include "LzFind.h" +#include "LzHash.h" + +#define kEmptyHashValue 0 +#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) +#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ +#define kNormalizeMask (~(kNormalizeStepMin - 1)) +#define kMaxHistorySize ((UInt32)3 << 30) + +#define kStartMaxLen 3 + +static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + if (!p->directInput) + { + alloc->Free(alloc, p->bufferBase); + p->bufferBase = 0; + } +} + +/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ + +static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) +{ + UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; + if (p->directInput) + { + p->blockSize = blockSize; + return 1; + } + if (p->bufferBase == 0 || p->blockSize != blockSize) + { + LzInWindow_Free(p, alloc); + p->blockSize = blockSize; + p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); + } + return (p->bufferBase != 0); +} + +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } +Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } + +UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } + +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) +{ + p->posLimit -= subValue; + p->pos -= subValue; + p->streamPos -= subValue; +} + +static void MatchFinder_ReadBlock(CMatchFinder *p) +{ + if (p->streamEndWasReached || p->result != SZ_OK) + return; + if (p->directInput) + { + UInt32 curSize = 0xFFFFFFFF - p->streamPos; + if (curSize > p->directInputRem) + curSize = (UInt32)p->directInputRem; + p->directInputRem -= curSize; + p->streamPos += curSize; + if (p->directInputRem == 0) + p->streamEndWasReached = 1; + return; + } + for (;;) + { + Byte *dest = p->buffer + (p->streamPos - p->pos); + size_t size = (p->bufferBase + p->blockSize - dest); + if (size == 0) + return; + p->result = p->stream->Read(p->stream, dest, &size); + if (p->result != SZ_OK) + return; + if (size == 0) + { + p->streamEndWasReached = 1; + return; + } + p->streamPos += (UInt32)size; + if (p->streamPos - p->pos > p->keepSizeAfter) + return; + } +} + +void MatchFinder_MoveBlock(CMatchFinder *p) +{ + memmove(p->bufferBase, + p->buffer - p->keepSizeBefore, + (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); + p->buffer = p->bufferBase + p->keepSizeBefore; +} + +int MatchFinder_NeedMove(CMatchFinder *p) +{ + if (p->directInput) + return 0; + /* if (p->streamEndWasReached) return 0; */ + return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); +} + +void MatchFinder_ReadIfRequired(CMatchFinder *p) +{ + if (p->streamEndWasReached) + return; + if (p->keepSizeAfter >= p->streamPos - p->pos) + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) +{ + if (MatchFinder_NeedMove(p)) + MatchFinder_MoveBlock(p); + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_SetDefaultSettings(CMatchFinder *p) +{ + p->cutValue = 32; + p->btMode = 1; + p->numHashBytes = 4; + p->bigHash = 0; +} + +#define kCrcPoly 0xEDB88320 + +void MatchFinder_Construct(CMatchFinder *p) +{ + UInt32 i; + p->bufferBase = 0; + p->directInput = 0; + p->hash = 0; + MatchFinder_SetDefaultSettings(p); + + for (i = 0; i < 256; i++) + { + UInt32 r = i; + int j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); + p->crc[i] = r; + } +} + +static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->hash); + p->hash = 0; +} + +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + MatchFinder_FreeThisClassMemory(p, alloc); + LzInWindow_Free(p, alloc); +} + +static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) +{ + size_t sizeInBytes = (size_t)num * sizeof(CLzRef); + if (sizeInBytes / sizeof(CLzRef) != num) + return 0; + return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); +} + +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc) +{ + UInt32 sizeReserv; + if (historySize > kMaxHistorySize) + { + MatchFinder_Free(p, alloc); + return 0; + } + sizeReserv = historySize >> 1; + if (historySize > ((UInt32)2 << 30)) + sizeReserv = historySize >> 2; + sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); + + p->keepSizeBefore = historySize + keepAddBufferBefore + 1; + p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; + /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ + if (LzInWindow_Create(p, sizeReserv, alloc)) + { + UInt32 newCyclicBufferSize = historySize + 1; + UInt32 hs; + p->matchMaxLen = matchMaxLen; + { + p->fixedHashSize = 0; + if (p->numHashBytes == 2) + hs = (1 << 16) - 1; + else + { + hs = historySize - 1; + hs |= (hs >> 1); + hs |= (hs >> 2); + hs |= (hs >> 4); + hs |= (hs >> 8); + hs >>= 1; + hs |= 0xFFFF; /* don't change it! It's required for Deflate */ + if (hs > (1 << 24)) + { + if (p->numHashBytes == 3) + hs = (1 << 24) - 1; + else + hs >>= 1; + } + } + p->hashMask = hs; + hs++; + if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; + if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; + if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; + hs += p->fixedHashSize; + } + + { + UInt32 prevSize = p->hashSizeSum + p->numSons; + UInt32 newSize; + p->historySize = historySize; + p->hashSizeSum = hs; + p->cyclicBufferSize = newCyclicBufferSize; + p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); + newSize = p->hashSizeSum + p->numSons; + if (p->hash != 0 && prevSize == newSize) + return 1; + MatchFinder_FreeThisClassMemory(p, alloc); + p->hash = AllocRefs(newSize, alloc); + if (p->hash != 0) + { + p->son = p->hash + p->hashSizeSum; + return 1; + } + } + } + MatchFinder_Free(p, alloc); + return 0; +} + +static void MatchFinder_SetLimits(CMatchFinder *p) +{ + UInt32 limit = kMaxValForNormalize - p->pos; + UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; + if (limit2 < limit) + limit = limit2; + limit2 = p->streamPos - p->pos; + if (limit2 <= p->keepSizeAfter) + { + if (limit2 > 0) + limit2 = 1; + } + else + limit2 -= p->keepSizeAfter; + if (limit2 < limit) + limit = limit2; + { + UInt32 lenLimit = p->streamPos - p->pos; + if (lenLimit > p->matchMaxLen) + lenLimit = p->matchMaxLen; + p->lenLimit = lenLimit; + } + p->posLimit = p->pos + limit; +} + +void MatchFinder_Init(CMatchFinder *p) +{ + UInt32 i; + for (i = 0; i < p->hashSizeSum; i++) + p->hash[i] = kEmptyHashValue; + p->cyclicBufferPos = 0; + p->buffer = p->bufferBase; + p->pos = p->streamPos = p->cyclicBufferSize; + p->result = SZ_OK; + p->streamEndWasReached = 0; + MatchFinder_ReadBlock(p); + MatchFinder_SetLimits(p); +} + +static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) +{ + return (p->pos - p->historySize - 1) & kNormalizeMask; +} + +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) +{ + UInt32 i; + for (i = 0; i < numItems; i++) + { + UInt32 value = items[i]; + if (value <= subValue) + value = kEmptyHashValue; + else + value -= subValue; + items[i] = value; + } +} + +static void MatchFinder_Normalize(CMatchFinder *p) +{ + UInt32 subValue = MatchFinder_GetSubValue(p); + MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); + MatchFinder_ReduceOffsets(p, subValue); +} + +static void MatchFinder_CheckLimits(CMatchFinder *p) +{ + if (p->pos == kMaxValForNormalize) + MatchFinder_Normalize(p); + if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) + MatchFinder_CheckAndMoveAndRead(p); + if (p->cyclicBufferPos == p->cyclicBufferSize) + p->cyclicBufferPos = 0; + MatchFinder_SetLimits(p); +} + +static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + son[_cyclicBufferPos] = curMatch; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + return distances; + { + const Byte *pb = cur - delta; + curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; + if (pb[maxLen] == cur[maxLen] && *pb == *cur) + { + UInt32 len = 0; + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + return distances; + } + } + } + } +} + +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return distances; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + if (++len != lenLimit && pb[len] == cur[len]) + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return distances; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + { + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +#define MOVE_POS \ + ++p->cyclicBufferPos; \ + p->buffer++; \ + if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); + +#define MOVE_POS_RET MOVE_POS return offset; + +static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } + +#define GET_MATCHES_HEADER2(minLen, ret_op) \ + UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ + lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ + cur = p->buffer; + +#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) +#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) + +#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue + +#define GET_MATCHES_FOOTER(offset, maxLen) \ + offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ + distances + offset, maxLen) - distances); MOVE_POS_RET; + +#define SKIP_FOOTER \ + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; + +static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 1) +} + +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 2) +} + +static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, delta2, maxLen, offset; + GET_MATCHES_HEADER(3) + + HASH3_CALC; + + delta2 = p->pos - p->hash[hash2Value]; + curMatch = p->hash[kFix3HashSize + hashValue]; + + p->hash[hash2Value] = + p->hash[kFix3HashSize + hashValue] = p->pos; + + + maxLen = 2; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[0] = maxLen; + distances[1] = delta2 - 1; + offset = 2; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + GET_MATCHES_FOOTER(offset, maxLen) +} + +static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + delta2 = p->pos - p->hash[ hash2Value]; + delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; + curMatch = p->hash[kFix4HashSize + hashValue]; + + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + + maxLen = 1; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = delta2 - 1; + offset = 2; + } + if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) + { + maxLen = 3; + distances[offset + 1] = delta3 - 1; + offset += 2; + delta2 = delta3; + } + if (offset != 0) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + if (maxLen < 3) + maxLen = 3; + GET_MATCHES_FOOTER(offset, maxLen) +} + +static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + delta2 = p->pos - p->hash[ hash2Value]; + delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; + curMatch = p->hash[kFix4HashSize + hashValue]; + + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + + maxLen = 1; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = delta2 - 1; + offset = 2; + } + if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) + { + maxLen = 3; + distances[offset + 1] = delta3 - 1; + offset += 2; + delta2 = delta3; + } + if (offset != 0) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS_RET; + } + } + if (maxLen < 3) + maxLen = 3; + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances + offset, maxLen) - (distances)); + MOVE_POS_RET +} + +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances, 2) - (distances)); + MOVE_POS_RET +} + +static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value; + SKIP_HEADER(3) + HASH3_CALC; + curMatch = p->hash[kFix3HashSize + hashValue]; + p->hash[hash2Value] = + p->hash[kFix3HashSize + hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value, hash3Value; + SKIP_HEADER(4) + HASH4_CALC; + curMatch = p->hash[kFix4HashSize + hashValue]; + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = p->pos; + p->hash[kFix4HashSize + hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value, hash3Value; + SKIP_HEADER(4) + HASH4_CALC; + curMatch = p->hash[kFix4HashSize + hashValue]; + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) +{ + vTable->Init = (Mf_Init_Func)MatchFinder_Init; + vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; + if (!p->btMode) + { + vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; + } + else if (p->numHashBytes == 2) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; + } + else if (p->numHashBytes == 3) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; + } + else + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; + } +} diff --git a/src/ZipLib/extlibs/lzma/LzFind.h b/src/ZipLib/extlibs/lzma/LzFind.h new file mode 100644 index 00000000..010c4b92 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzFind.h @@ -0,0 +1,115 @@ +/* LzFind.h -- Match finder for LZ algorithms +2009-04-22 : Igor Pavlov : Public domain */ + +#ifndef __LZ_FIND_H +#define __LZ_FIND_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef UInt32 CLzRef; + +typedef struct _CMatchFinder +{ + Byte *buffer; + UInt32 pos; + UInt32 posLimit; + UInt32 streamPos; + UInt32 lenLimit; + + UInt32 cyclicBufferPos; + UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ + + UInt32 matchMaxLen; + CLzRef *hash; + CLzRef *son; + UInt32 hashMask; + UInt32 cutValue; + + Byte *bufferBase; + ISeqInStream *stream; + int streamEndWasReached; + + UInt32 blockSize; + UInt32 keepSizeBefore; + UInt32 keepSizeAfter; + + UInt32 numHashBytes; + int directInput; + size_t directInputRem; + int btMode; + int bigHash; + UInt32 historySize; + UInt32 fixedHashSize; + UInt32 hashSizeSum; + UInt32 numSons; + SRes result; + UInt32 crc[256]; +} CMatchFinder; + +#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) +#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) + +#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) + +int MatchFinder_NeedMove(CMatchFinder *p); +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); +void MatchFinder_MoveBlock(CMatchFinder *p); +void MatchFinder_ReadIfRequired(CMatchFinder *p); + +void MatchFinder_Construct(CMatchFinder *p); + +/* Conditions: + historySize <= 3 GB + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB +*/ +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc); +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); + +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, + UInt32 *distances, UInt32 maxLen); + +/* +Conditions: + Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. + Mf_GetPointerToCurrentPos_Func's result must be used only before any other function +*/ + +typedef void (*Mf_Init_Func)(void *object); +typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); +typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); +typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); +typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); +typedef void (*Mf_Skip_Func)(void *object, UInt32); + +typedef struct _IMatchFinder +{ + Mf_Init_Func Init; + Mf_GetIndexByte_Func GetIndexByte; + Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; + Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; + Mf_GetMatches_Func GetMatches; + Mf_Skip_Func Skip; +} IMatchFinder; + +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); + +void MatchFinder_Init(CMatchFinder *p); +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/LzFindMt.c b/src/ZipLib/extlibs/lzma/LzFindMt.c new file mode 100644 index 00000000..aa41ed98 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzFindMt.c @@ -0,0 +1,793 @@ +/* LzFindMt.c -- multithreaded Match finder for LZ algorithms +2009-09-20 : Igor Pavlov : Public domain */ + +#include "LzHash.h" + +#include "LzFindMt.h" + +void MtSync_Construct(CMtSync *p) +{ + p->wasCreated = False; + p->csWasInitialized = False; + p->csWasEntered = False; + Thread_Construct(&p->thread); + Event_Construct(&p->canStart); + Event_Construct(&p->wasStarted); + Event_Construct(&p->wasStopped); + Semaphore_Construct(&p->freeSemaphore); + Semaphore_Construct(&p->filledSemaphore); +} + +void MtSync_GetNextBlock(CMtSync *p) +{ + if (p->needStart) + { + p->numProcessedBlocks = 1; + p->needStart = False; + p->stopWriting = False; + p->exit = False; + Event_Reset(&p->wasStarted); + Event_Reset(&p->wasStopped); + + Event_Set(&p->canStart); + Event_Wait(&p->wasStarted); + } + else + { + CriticalSection_Leave(&p->cs); + p->csWasEntered = False; + p->numProcessedBlocks++; + Semaphore_Release1(&p->freeSemaphore); + } + Semaphore_Wait(&p->filledSemaphore); + CriticalSection_Enter(&p->cs); + p->csWasEntered = True; +} + +/* MtSync_StopWriting must be called if Writing was started */ + +void MtSync_StopWriting(CMtSync *p) +{ + UInt32 myNumBlocks = p->numProcessedBlocks; + if (!Thread_WasCreated(&p->thread) || p->needStart) + return; + p->stopWriting = True; + if (p->csWasEntered) + { + CriticalSection_Leave(&p->cs); + p->csWasEntered = False; + } + Semaphore_Release1(&p->freeSemaphore); + + Event_Wait(&p->wasStopped); + + while (myNumBlocks++ != p->numProcessedBlocks) + { + Semaphore_Wait(&p->filledSemaphore); + Semaphore_Release1(&p->freeSemaphore); + } + p->needStart = True; +} + +void MtSync_Destruct(CMtSync *p) +{ + if (Thread_WasCreated(&p->thread)) + { + MtSync_StopWriting(p); + p->exit = True; + if (p->needStart) + Event_Set(&p->canStart); + Thread_Wait(&p->thread); + Thread_Close(&p->thread); + } + if (p->csWasInitialized) + { + CriticalSection_Delete(&p->cs); + p->csWasInitialized = False; + } + + Event_Close(&p->canStart); + Event_Close(&p->wasStarted); + Event_Close(&p->wasStopped); + Semaphore_Close(&p->freeSemaphore); + Semaphore_Close(&p->filledSemaphore); + + p->wasCreated = False; +} + +#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; } + +static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks) +{ + if (p->wasCreated) + return SZ_OK; + + RINOK_THREAD(CriticalSection_Init(&p->cs)); + p->csWasInitialized = True; + + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped)); + + RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks)); + RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks)); + + p->needStart = True; + + RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj)); + p->wasCreated = True; + return SZ_OK; +} + +static SRes MtSync_Create(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks) +{ + SRes res = MtSync_Create2(p, startAddress, obj, numBlocks); + if (res != SZ_OK) + MtSync_Destruct(p); + return res; +} + +void MtSync_Init(CMtSync *p) { p->needStart = True; } + +#define kMtMaxValForNormalize 0xFFFFFFFF + +#define DEF_GetHeads2(name, v, action) \ +static void GetHeads ## name(const Byte *p, UInt32 pos, \ +UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \ +{ action; for (; numHeads != 0; numHeads--) { \ +const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } } + +#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;) + +DEF_GetHeads2(2, (p[0] | ((UInt32)p[1] << 8)), hashMask = hashMask; crc = crc; ) +DEF_GetHeads(3, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask) +DEF_GetHeads(4, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask) +DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask) +/* DEF_GetHeads(5, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask) */ + +void HashThreadFunc(CMatchFinderMt *mt) +{ + CMtSync *p = &mt->hashSync; + for (;;) + { + UInt32 numProcessedBlocks = 0; + Event_Wait(&p->canStart); + Event_Set(&p->wasStarted); + for (;;) + { + if (p->exit) + return; + if (p->stopWriting) + { + p->numProcessedBlocks = numProcessedBlocks; + Event_Set(&p->wasStopped); + break; + } + + { + CMatchFinder *mf = mt->MatchFinder; + if (MatchFinder_NeedMove(mf)) + { + CriticalSection_Enter(&mt->btSync.cs); + CriticalSection_Enter(&mt->hashSync.cs); + { + const Byte *beforePtr = MatchFinder_GetPointerToCurrentPos(mf); + const Byte *afterPtr; + MatchFinder_MoveBlock(mf); + afterPtr = MatchFinder_GetPointerToCurrentPos(mf); + mt->pointerToCurPos -= beforePtr - afterPtr; + mt->buffer -= beforePtr - afterPtr; + } + CriticalSection_Leave(&mt->btSync.cs); + CriticalSection_Leave(&mt->hashSync.cs); + continue; + } + + Semaphore_Wait(&p->freeSemaphore); + + MatchFinder_ReadIfRequired(mf); + if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize)) + { + UInt32 subValue = (mf->pos - mf->historySize - 1); + MatchFinder_ReduceOffsets(mf, subValue); + MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, mf->hashMask + 1); + } + { + UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize; + UInt32 num = mf->streamPos - mf->pos; + heads[0] = 2; + heads[1] = num; + if (num >= mf->numHashBytes) + { + num = num - mf->numHashBytes + 1; + if (num > kMtHashBlockSize - 2) + num = kMtHashBlockSize - 2; + mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc); + heads[0] += num; + } + mf->pos += num; + mf->buffer += num; + } + } + + Semaphore_Release1(&p->filledSemaphore); + } + } +} + +void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p) +{ + MtSync_GetNextBlock(&p->hashSync); + p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize; + p->hashBufPosLimit += p->hashBuf[p->hashBufPos++]; + p->hashNumAvail = p->hashBuf[p->hashBufPos++]; +} + +#define kEmptyHashValue 0 + +/* #define MFMT_GM_INLINE */ + +#ifdef MFMT_GM_INLINE + +#define NO_INLINE MY_FAST_CALL + +Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, + UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 limit, UInt32 size, UInt32 *posRes) +{ + do + { + UInt32 *distances = _distances + 1; + UInt32 curMatch = pos - *hash++; + + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + UInt32 cutValue = _cutValue; + UInt32 maxLen = _maxLen; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + break; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + if (++len != lenLimit && pb[len] == cur[len]) + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + break; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } + pos++; + _cyclicBufferPos++; + cur++; + { + UInt32 num = (UInt32)(distances - _distances); + *_distances = num - 1; + _distances += num; + limit -= num; + } + } + while (limit > 0 && --size != 0); + *posRes = pos; + return limit; +} + +#endif + +void BtGetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + UInt32 numProcessed = 0; + UInt32 curPos = 2; + UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2); + distances[1] = p->hashNumAvail; + while (curPos < limit) + { + if (p->hashBufPos == p->hashBufPosLimit) + { + MatchFinderMt_GetNextBlock_Hash(p); + distances[1] = numProcessed + p->hashNumAvail; + if (p->hashNumAvail >= p->numHashBytes) + continue; + for (; p->hashNumAvail != 0; p->hashNumAvail--) + distances[curPos++] = 0; + break; + } + { + UInt32 size = p->hashBufPosLimit - p->hashBufPos; + UInt32 lenLimit = p->matchMaxLen; + UInt32 pos = p->pos; + UInt32 cyclicBufferPos = p->cyclicBufferPos; + if (lenLimit >= p->hashNumAvail) + lenLimit = p->hashNumAvail; + { + UInt32 size2 = p->hashNumAvail - lenLimit + 1; + if (size2 < size) + size = size2; + size2 = p->cyclicBufferSize - cyclicBufferPos; + if (size2 < size) + size = size2; + } + #ifndef MFMT_GM_INLINE + while (curPos < limit && size-- != 0) + { + UInt32 *startDistances = distances + curPos; + UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++], + pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue, + startDistances + 1, p->numHashBytes - 1) - startDistances); + *startDistances = num - 1; + curPos += num; + cyclicBufferPos++; + pos++; + p->buffer++; + } + #else + { + UInt32 posRes; + curPos = limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue, + distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos, (Int32)(limit - curPos) , size, &posRes); + p->hashBufPos += posRes - pos; + cyclicBufferPos += posRes - pos; + p->buffer += posRes - pos; + pos = posRes; + } + #endif + + numProcessed += pos - p->pos; + p->hashNumAvail -= pos - p->pos; + p->pos = pos; + if (cyclicBufferPos == p->cyclicBufferSize) + cyclicBufferPos = 0; + p->cyclicBufferPos = cyclicBufferPos; + } + } + distances[0] = curPos; +} + +void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex) +{ + CMtSync *sync = &p->hashSync; + if (!sync->needStart) + { + CriticalSection_Enter(&sync->cs); + sync->csWasEntered = True; + } + + BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize); + + if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize) + { + UInt32 subValue = p->pos - p->cyclicBufferSize; + MatchFinder_Normalize3(subValue, p->son, p->cyclicBufferSize * 2); + p->pos -= subValue; + } + + if (!sync->needStart) + { + CriticalSection_Leave(&sync->cs); + sync->csWasEntered = False; + } +} + +void BtThreadFunc(CMatchFinderMt *mt) +{ + CMtSync *p = &mt->btSync; + for (;;) + { + UInt32 blockIndex = 0; + Event_Wait(&p->canStart); + Event_Set(&p->wasStarted); + for (;;) + { + if (p->exit) + return; + if (p->stopWriting) + { + p->numProcessedBlocks = blockIndex; + MtSync_StopWriting(&mt->hashSync); + Event_Set(&p->wasStopped); + break; + } + Semaphore_Wait(&p->freeSemaphore); + BtFillBlock(mt, blockIndex++); + Semaphore_Release1(&p->filledSemaphore); + } + } +} + +void MatchFinderMt_Construct(CMatchFinderMt *p) +{ + p->hashBuf = 0; + MtSync_Construct(&p->hashSync); + MtSync_Construct(&p->btSync); +} + +void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->hashBuf); + p->hashBuf = 0; +} + +void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc) +{ + MtSync_Destruct(&p->hashSync); + MtSync_Destruct(&p->btSync); + MatchFinderMt_FreeMem(p, alloc); +} + +#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks) +#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks) + +static unsigned MY_STD_CALL HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; } +static unsigned MY_STD_CALL BtThreadFunc2(void *p) +{ + Byte allocaDummy[0x180]; + int i = 0; + for (i = 0; i < 16; i++) + allocaDummy[i] = (Byte)i; + BtThreadFunc((CMatchFinderMt *)p); + return 0; +} + +SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore, + UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc) +{ + CMatchFinder *mf = p->MatchFinder; + p->historySize = historySize; + if (kMtBtBlockSize <= matchMaxLen * 4) + return SZ_ERROR_PARAM; + if (p->hashBuf == 0) + { + p->hashBuf = (UInt32 *)alloc->Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32)); + if (p->hashBuf == 0) + return SZ_ERROR_MEM; + p->btBuf = p->hashBuf + kHashBufferSize; + } + keepAddBufferBefore += (kHashBufferSize + kBtBufferSize); + keepAddBufferAfter += kMtHashBlockSize; + if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc)) + return SZ_ERROR_MEM; + + RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks)); + RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks)); + return SZ_OK; +} + +/* Call it after ReleaseStream / SetStream */ +void MatchFinderMt_Init(CMatchFinderMt *p) +{ + CMatchFinder *mf = p->MatchFinder; + p->btBufPos = p->btBufPosLimit = 0; + p->hashBufPos = p->hashBufPosLimit = 0; + MatchFinder_Init(mf); + p->pointerToCurPos = MatchFinder_GetPointerToCurrentPos(mf); + p->btNumAvailBytes = 0; + p->lzPos = p->historySize + 1; + + p->hash = mf->hash; + p->fixedHashSize = mf->fixedHashSize; + p->crc = mf->crc; + + p->son = mf->son; + p->matchMaxLen = mf->matchMaxLen; + p->numHashBytes = mf->numHashBytes; + p->pos = mf->pos; + p->buffer = mf->buffer; + p->cyclicBufferPos = mf->cyclicBufferPos; + p->cyclicBufferSize = mf->cyclicBufferSize; + p->cutValue = mf->cutValue; +} + +/* ReleaseStream is required to finish multithreading */ +void MatchFinderMt_ReleaseStream(CMatchFinderMt *p) +{ + MtSync_StopWriting(&p->btSync); + /* p->MatchFinder->ReleaseStream(); */ +} + +void MatchFinderMt_Normalize(CMatchFinderMt *p) +{ + MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize); + p->lzPos = p->historySize + 1; +} + +void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p) +{ + UInt32 blockIndex; + MtSync_GetNextBlock(&p->btSync); + blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask); + p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize; + p->btBufPosLimit += p->btBuf[p->btBufPos++]; + p->btNumAvailBytes = p->btBuf[p->btBufPos++]; + if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize) + MatchFinderMt_Normalize(p); +} + +const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p) +{ + return p->pointerToCurPos; +} + +#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p); + +UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p) +{ + GET_NEXT_BLOCK_IF_REQUIRED; + return p->btNumAvailBytes; +} + +Byte MatchFinderMt_GetIndexByte(CMatchFinderMt *p, Int32 index) +{ + return p->pointerToCurPos[index]; +} + +UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, curMatch2; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH2_CALC + + curMatch2 = hash[hash2Value]; + hash[hash2Value] = lzPos; + + if (curMatch2 >= matchMinPos) + if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + *distances++ = 2; + *distances++ = lzPos - curMatch2 - 1; + } + return distances; +} + +UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, curMatch2, curMatch3; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH3_CALC + + curMatch2 = hash[ hash2Value]; + curMatch3 = hash[kFix3HashSize + hash3Value]; + + hash[ hash2Value] = + hash[kFix3HashSize + hash3Value] = + lzPos; + + if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch2 - 1; + if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2]) + { + distances[0] = 3; + return distances + 2; + } + distances[0] = 2; + distances += 2; + } + if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0]) + { + *distances++ = 3; + *distances++ = lzPos - curMatch3 - 1; + } + return distances; +} + +/* +UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, hash4Value, curMatch2, curMatch3, curMatch4; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH4_CALC + + curMatch2 = hash[ hash2Value]; + curMatch3 = hash[kFix3HashSize + hash3Value]; + curMatch4 = hash[kFix4HashSize + hash4Value]; + + hash[ hash2Value] = + hash[kFix3HashSize + hash3Value] = + hash[kFix4HashSize + hash4Value] = + lzPos; + + if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch2 - 1; + if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2]) + { + distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3; + return distances + 2; + } + distances[0] = 2; + distances += 2; + } + if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch3 - 1; + if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3]) + { + distances[0] = 4; + return distances + 2; + } + distances[0] = 3; + distances += 2; + } + + if (curMatch4 >= matchMinPos) + if ( + cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] && + cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3] + ) + { + *distances++ = 4; + *distances++ = lzPos - curMatch4 - 1; + } + return distances; +} +*/ + +#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++; + +UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + const UInt32 *btBuf = p->btBuf + p->btBufPos; + UInt32 len = *btBuf++; + p->btBufPos += 1 + len; + p->btNumAvailBytes--; + { + UInt32 i; + for (i = 0; i < len; i += 2) + { + *distances++ = *btBuf++; + *distances++ = *btBuf++; + } + } + INCREASE_LZ_POS + return len; +} + +UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + const UInt32 *btBuf = p->btBuf + p->btBufPos; + UInt32 len = *btBuf++; + p->btBufPos += 1 + len; + + if (len == 0) + { + if (p->btNumAvailBytes-- >= 4) + len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances)); + } + else + { + /* Condition: there are matches in btBuf with length < p->numHashBytes */ + UInt32 *distances2; + p->btNumAvailBytes--; + distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances); + do + { + *distances2++ = *btBuf++; + *distances2++ = *btBuf++; + } + while ((len -= 2) != 0); + len = (UInt32)(distances2 - (distances)); + } + INCREASE_LZ_POS + return len; +} + +#define SKIP_HEADER2_MT do { GET_NEXT_BLOCK_IF_REQUIRED +#define SKIP_HEADER_MT(n) SKIP_HEADER2_MT if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash; +#define SKIP_FOOTER_MT } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0); + +void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER2_MT { p->btNumAvailBytes--; + SKIP_FOOTER_MT +} + +void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(2) + UInt32 hash2Value; + MT_HASH2_CALC + hash[hash2Value] = p->lzPos; + SKIP_FOOTER_MT +} + +void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(3) + UInt32 hash2Value, hash3Value; + MT_HASH3_CALC + hash[kFix3HashSize + hash3Value] = + hash[ hash2Value] = + p->lzPos; + SKIP_FOOTER_MT +} + +/* +void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(4) + UInt32 hash2Value, hash3Value, hash4Value; + MT_HASH4_CALC + hash[kFix4HashSize + hash4Value] = + hash[kFix3HashSize + hash3Value] = + hash[ hash2Value] = + p->lzPos; + SKIP_FOOTER_MT +} +*/ + +void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable) +{ + vTable->Init = (Mf_Init_Func)MatchFinderMt_Init; + vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinderMt_GetIndexByte; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos; + vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches; + switch(p->MatchFinder->numHashBytes) + { + case 2: + p->GetHeadsFunc = GetHeads2; + p->MixMatchesFunc = (Mf_Mix_Matches)0; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip; + vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches; + break; + case 3: + p->GetHeadsFunc = GetHeads3; + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip; + break; + default: + /* case 4: */ + p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4; + /* p->GetHeadsFunc = GetHeads4; */ + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip; + break; + /* + default: + p->GetHeadsFunc = GetHeads5; + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip; + break; + */ + } +} diff --git a/src/ZipLib/extlibs/lzma/LzFindMt.h b/src/ZipLib/extlibs/lzma/LzFindMt.h new file mode 100644 index 00000000..b985af5f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzFindMt.h @@ -0,0 +1,105 @@ +/* LzFindMt.h -- multithreaded Match finder for LZ algorithms +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZ_FIND_MT_H +#define __LZ_FIND_MT_H + +#include "LzFind.h" +#include "Threads.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define kMtHashBlockSize (1 << 13) +#define kMtHashNumBlocks (1 << 3) +#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1) + +#define kMtBtBlockSize (1 << 14) +#define kMtBtNumBlocks (1 << 6) +#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1) + +typedef struct _CMtSync +{ + Bool wasCreated; + Bool needStart; + Bool exit; + Bool stopWriting; + + CThread thread; + CAutoResetEvent canStart; + CAutoResetEvent wasStarted; + CAutoResetEvent wasStopped; + CSemaphore freeSemaphore; + CSemaphore filledSemaphore; + Bool csWasInitialized; + Bool csWasEntered; + CCriticalSection cs; + UInt32 numProcessedBlocks; +} CMtSync; + +typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances); + +/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */ +#define kMtCacheLineDummy 128 + +typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos, + UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc); + +typedef struct _CMatchFinderMt +{ + /* LZ */ + const Byte *pointerToCurPos; + UInt32 *btBuf; + UInt32 btBufPos; + UInt32 btBufPosLimit; + UInt32 lzPos; + UInt32 btNumAvailBytes; + + UInt32 *hash; + UInt32 fixedHashSize; + UInt32 historySize; + const UInt32 *crc; + + Mf_Mix_Matches MixMatchesFunc; + + /* LZ + BT */ + CMtSync btSync; + Byte btDummy[kMtCacheLineDummy]; + + /* BT */ + UInt32 *hashBuf; + UInt32 hashBufPos; + UInt32 hashBufPosLimit; + UInt32 hashNumAvail; + + CLzRef *son; + UInt32 matchMaxLen; + UInt32 numHashBytes; + UInt32 pos; + Byte *buffer; + UInt32 cyclicBufferPos; + UInt32 cyclicBufferSize; /* it must be historySize + 1 */ + UInt32 cutValue; + + /* BT + Hash */ + CMtSync hashSync; + /* Byte hashDummy[kMtCacheLineDummy]; */ + + /* Hash */ + Mf_GetHeads GetHeadsFunc; + CMatchFinder *MatchFinder; +} CMatchFinderMt; + +void MatchFinderMt_Construct(CMatchFinderMt *p); +void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc); +SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore, + UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc); +void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable); +void MatchFinderMt_ReleaseStream(CMatchFinderMt *p); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/LzHash.h b/src/ZipLib/extlibs/lzma/LzHash.h new file mode 100644 index 00000000..f3e89966 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzHash.h @@ -0,0 +1,54 @@ +/* LzHash.h -- HASH functions for LZ algorithms +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZ_HASH_H +#define __LZ_HASH_H + +#define kHash2Size (1 << 10) +#define kHash3Size (1 << 16) +#define kHash4Size (1 << 20) + +#define kFix3HashSize (kHash2Size) +#define kFix4HashSize (kHash2Size + kHash3Size) +#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) + +#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); + +#define HASH3_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } + +#define HASH4_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } + +#define HASH5_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ + hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ + hash4Value &= (kHash4Size - 1); } + +/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ +#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; + + +#define MT_HASH2_CALC \ + hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); + +#define MT_HASH3_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } + +#define MT_HASH4_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } + +#endif diff --git a/src/ZipLib/extlibs/lzma/Lzma2Dec.c b/src/ZipLib/extlibs/lzma/Lzma2Dec.c new file mode 100644 index 00000000..f3a6b821 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma2Dec.c @@ -0,0 +1,350 @@ +/* Lzma2Dec.c -- LZMA2 Decoder +2010-12-15 : Igor Pavlov : Public domain */ + +/* #define SHOW_DEBUG_INFO */ + +#ifdef SHOW_DEBUG_INFO +#include +#endif + +#include + +#include "Lzma2Dec.h" + +/* +00000000 - EOS +00000001 U U - Uncompressed Reset Dic +00000010 U U - Uncompressed No Reset +100uuuuu U U P P - LZMA no reset +101uuuuu U U P P - LZMA reset state +110uuuuu U U P P S - LZMA reset state + new prop +111uuuuu U U P P S - LZMA reset state + new prop + reset dic + + u, U - Unpack Size + P - Pack Size + S - Props +*/ + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & LZMA2_CONTROL_LZMA) == 0) + +#define LZMA2_GET_LZMA_MODE(p) (((p)->control >> 5) & 3) +#define LZMA2_IS_THERE_PROP(mode) ((mode) >= 2) + +#define LZMA2_LCLP_MAX 4 +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#ifdef SHOW_DEBUG_INFO +#define PRF(x) x +#else +#define PRF(x) +#endif + +typedef enum +{ + LZMA2_STATE_CONTROL, + LZMA2_STATE_UNPACK0, + LZMA2_STATE_UNPACK1, + LZMA2_STATE_PACK0, + LZMA2_STATE_PACK1, + LZMA2_STATE_PROP, + LZMA2_STATE_DATA, + LZMA2_STATE_DATA_CONT, + LZMA2_STATE_FINISHED, + LZMA2_STATE_ERROR +} ELzma2State; + +static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props) +{ + UInt32 dicSize; + if (prop > 40) + return SZ_ERROR_UNSUPPORTED; + dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop); + props[0] = (Byte)LZMA2_LCLP_MAX; + props[1] = (Byte)(dicSize); + props[2] = (Byte)(dicSize >> 8); + props[3] = (Byte)(dicSize >> 16); + props[4] = (Byte)(dicSize >> 24); + return SZ_OK; +} + +SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +void Lzma2Dec_Init(CLzma2Dec *p) +{ + p->state = LZMA2_STATE_CONTROL; + p->needInitDic = True; + p->needInitState = True; + p->needInitProp = True; + LzmaDec_Init(&p->decoder); +} + +static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b) +{ + switch(p->state) + { + case LZMA2_STATE_CONTROL: + p->control = b; + PRF(printf("\n %4X ", p->decoder.dicPos)); + PRF(printf(" %2X", b)); + if (p->control == 0) + return LZMA2_STATE_FINISHED; + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if ((p->control & 0x7F) > 2) + return LZMA2_STATE_ERROR; + p->unpackSize = 0; + } + else + p->unpackSize = (UInt32)(p->control & 0x1F) << 16; + return LZMA2_STATE_UNPACK0; + + case LZMA2_STATE_UNPACK0: + p->unpackSize |= (UInt32)b << 8; + return LZMA2_STATE_UNPACK1; + + case LZMA2_STATE_UNPACK1: + p->unpackSize |= (UInt32)b; + p->unpackSize++; + PRF(printf(" %8d", p->unpackSize)); + return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0; + + case LZMA2_STATE_PACK0: + p->packSize = (UInt32)b << 8; + return LZMA2_STATE_PACK1; + + case LZMA2_STATE_PACK1: + p->packSize |= (UInt32)b; + p->packSize++; + PRF(printf(" %8d", p->packSize)); + return LZMA2_IS_THERE_PROP(LZMA2_GET_LZMA_MODE(p)) ? LZMA2_STATE_PROP: + (p->needInitProp ? LZMA2_STATE_ERROR : LZMA2_STATE_DATA); + + case LZMA2_STATE_PROP: + { + int lc, lp; + if (b >= (9 * 5 * 5)) + return LZMA2_STATE_ERROR; + lc = b % 9; + b /= 9; + p->decoder.prop.pb = b / 5; + lp = b % 5; + if (lc + lp > LZMA2_LCLP_MAX) + return LZMA2_STATE_ERROR; + p->decoder.prop.lc = lc; + p->decoder.prop.lp = lp; + p->needInitProp = False; + return LZMA2_STATE_DATA; + } + } + return LZMA2_STATE_ERROR; +} + +static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size) +{ + memcpy(p->dic + p->dicPos, src, size); + p->dicPos += size; + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size) + p->checkDicSize = p->prop.dicSize; + p->processedPos += (UInt32)size; +} + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); + +SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->state != LZMA2_STATE_FINISHED) + { + SizeT dicPos = p->decoder.dicPos; + if (p->state == LZMA2_STATE_ERROR) + return SZ_ERROR_DATA; + if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + (*srcLen)++; + p->state = Lzma2Dec_UpdateState(p, *src++); + continue; + } + { + SizeT destSizeCur = dicLimit - dicPos; + SizeT srcSizeCur = inSize - *srcLen; + ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY; + + if (p->unpackSize <= destSizeCur) + { + destSizeCur = (SizeT)p->unpackSize; + curFinishMode = LZMA_FINISH_END; + } + + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + if (p->state == LZMA2_STATE_DATA) + { + Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC); + if (initDic) + p->needInitProp = p->needInitState = True; + else if (p->needInitDic) + return SZ_ERROR_DATA; + p->needInitDic = False; + LzmaDec_InitDicAndState(&p->decoder, initDic, False); + } + + if (srcSizeCur > destSizeCur) + srcSizeCur = destSizeCur; + + if (srcSizeCur == 0) + return SZ_ERROR_DATA; + + LzmaDec_UpdateWithUncompressed(&p->decoder, src, srcSizeCur); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->unpackSize -= (UInt32)srcSizeCur; + p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT; + } + else + { + SizeT outSizeProcessed; + SRes res; + + if (p->state == LZMA2_STATE_DATA) + { + int mode = LZMA2_GET_LZMA_MODE(p); + Bool initDic = (mode == 3); + Bool initState = (mode > 0); + if ((!initDic && p->needInitDic) || (!initState && p->needInitState)) + return SZ_ERROR_DATA; + + LzmaDec_InitDicAndState(&p->decoder, initDic, initState); + p->needInitDic = False; + p->needInitState = False; + p->state = LZMA2_STATE_DATA_CONT; + } + if (srcSizeCur > p->packSize) + srcSizeCur = (SizeT)p->packSize; + + res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->packSize -= (UInt32)srcSizeCur; + + outSizeProcessed = p->decoder.dicPos - dicPos; + p->unpackSize -= (UInt32)outSizeProcessed; + + RINOK(res); + if (*status == LZMA_STATUS_NEEDS_MORE_INPUT) + return res; + + if (srcSizeCur == 0 && outSizeProcessed == 0) + { + if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK || + p->unpackSize != 0 || p->packSize != 0) + return SZ_ERROR_DATA; + p->state = LZMA2_STATE_CONTROL; + } + if (*status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) + *status = LZMA_STATUS_NOT_FINISHED; + } + } + } + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen, inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT srcSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->decoder.dicPos == p->decoder.dicBufSize) + p->decoder.dicPos = 0; + dicPos = p->decoder.dicPos; + if (outSize > p->decoder.dicBufSize - dicPos) + { + outSizeCur = p->decoder.dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = Lzma2Dec_DecodeToDic(p, outSizeCur, src, &srcSizeCur, curFinishMode, status); + src += srcSizeCur; + inSize -= srcSizeCur; + *srcLen += srcSizeCur; + outSizeCur = p->decoder.dicPos - dicPos; + memcpy(dest, p->decoder.dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzma2Dec p; + SRes res; + SizeT outSize = *destLen, inSize = *srcLen; + *destLen = *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + Lzma2Dec_Construct(&p); + RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc)); + p.decoder.dic = dest; + p.decoder.dicBufSize = outSize; + Lzma2Dec_Init(&p); + *srcLen = inSize; + res = Lzma2Dec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); + *destLen = p.decoder.dicPos; + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + Lzma2Dec_FreeProbs(&p, alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/Lzma2Dec.h b/src/ZipLib/extlibs/lzma/Lzma2Dec.h new file mode 100644 index 00000000..6bc07bbc --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma2Dec.h @@ -0,0 +1,84 @@ +/* Lzma2Dec.h -- LZMA2 Decoder +2009-05-03 : Igor Pavlov : Public domain */ + +#ifndef __LZMA2_DEC_H +#define __LZMA2_DEC_H + +#include "LzmaDec.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ---------- State Interface ---------- */ + +typedef struct +{ + CLzmaDec decoder; + UInt32 packSize; + UInt32 unpackSize; + int state; + Byte control; + Bool needInitDic; + Bool needInitState; + Bool needInitProp; +} CLzma2Dec; + +#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder) +#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc); +#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc); + +SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); +SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); +void Lzma2Dec_Init(CLzma2Dec *p); + + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen or dicLimit). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NEEDS_MORE_INPUT + SZ_ERROR_DATA - Data error +*/ + +SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + +SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- One Call Interface ---------- */ + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + +SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Lzma2Enc.c b/src/ZipLib/extlibs/lzma/Lzma2Enc.c new file mode 100644 index 00000000..e97597f6 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma2Enc.c @@ -0,0 +1,477 @@ +/* Lzma2Enc.c -- LZMA2 Encoder +2010-09-24 : Igor Pavlov : Public domain */ + +/* #include */ +#include + +/* #define _7ZIP_ST */ + +#include "Lzma2Enc.h" + +#ifndef _7ZIP_ST +#include "MtCoder.h" +#else +#define NUM_MT_CODER_THREADS_MAX 1 +#endif + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_LCLP_MAX 4 + +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#define LZMA2_PACK_SIZE_MAX (1 << 16) +#define LZMA2_COPY_CHUNK_SIZE LZMA2_PACK_SIZE_MAX +#define LZMA2_UNPACK_SIZE_MAX (1 << 21) +#define LZMA2_KEEP_WINDOW_SIZE LZMA2_UNPACK_SIZE_MAX + +#define LZMA2_CHUNK_SIZE_COMPRESSED_MAX ((1 << 16) + 16) + + +#define PRF(x) /* x */ + +/* ---------- CLzma2EncInt ---------- */ + +typedef struct +{ + CLzmaEncHandle enc; + UInt64 srcPos; + Byte props; + Bool needInitState; + Bool needInitProp; +} CLzma2EncInt; + +static SRes Lzma2EncInt_Init(CLzma2EncInt *p, const CLzma2EncProps *props) +{ + Byte propsEncoded[LZMA_PROPS_SIZE]; + SizeT propsSize = LZMA_PROPS_SIZE; + RINOK(LzmaEnc_SetProps(p->enc, &props->lzmaProps)); + RINOK(LzmaEnc_WriteProperties(p->enc, propsEncoded, &propsSize)); + p->srcPos = 0; + p->props = propsEncoded[0]; + p->needInitState = True; + p->needInitProp = True; + return SZ_OK; +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp); +void LzmaEnc_Finish(CLzmaEncHandle pp); +void LzmaEnc_SaveState(CLzmaEncHandle pp); +void LzmaEnc_RestoreState(CLzmaEncHandle pp); + + +static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf, + size_t *packSizeRes, ISeqOutStream *outStream) +{ + size_t packSizeLimit = *packSizeRes; + size_t packSize = packSizeLimit; + UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX; + unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0); + Bool useCopyBlock; + SRes res; + + *packSizeRes = 0; + if (packSize < lzHeaderSize) + return SZ_ERROR_OUTPUT_EOF; + packSize -= lzHeaderSize; + + LzmaEnc_SaveState(p->enc); + res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState, + outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize); + + PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize)); + + if (unpackSize == 0) + return res; + + if (res == SZ_OK) + useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16)); + else + { + if (res != SZ_ERROR_OUTPUT_EOF) + return res; + res = SZ_OK; + useCopyBlock = True; + } + + if (useCopyBlock) + { + size_t destPos = 0; + PRF(printf("################# COPY ")); + while (unpackSize > 0) + { + UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE; + if (packSizeLimit - destPos < u + 3) + return SZ_ERROR_OUTPUT_EOF; + outBuf[destPos++] = (Byte)(p->srcPos == 0 ? LZMA2_CONTROL_COPY_RESET_DIC : LZMA2_CONTROL_COPY_NO_RESET); + outBuf[destPos++] = (Byte)((u - 1) >> 8); + outBuf[destPos++] = (Byte)(u - 1); + memcpy(outBuf + destPos, LzmaEnc_GetCurBuf(p->enc) - unpackSize, u); + unpackSize -= u; + destPos += u; + p->srcPos += u; + if (outStream) + { + *packSizeRes += destPos; + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + destPos = 0; + } + else + *packSizeRes = destPos; + /* needInitState = True; */ + } + LzmaEnc_RestoreState(p->enc); + return SZ_OK; + } + { + size_t destPos = 0; + UInt32 u = unpackSize - 1; + UInt32 pm = (UInt32)(packSize - 1); + unsigned mode = (p->srcPos == 0) ? 3 : (p->needInitState ? (p->needInitProp ? 2 : 1) : 0); + + PRF(printf(" ")); + + outBuf[destPos++] = (Byte)(LZMA2_CONTROL_LZMA | (mode << 5) | ((u >> 16) & 0x1F)); + outBuf[destPos++] = (Byte)(u >> 8); + outBuf[destPos++] = (Byte)u; + outBuf[destPos++] = (Byte)(pm >> 8); + outBuf[destPos++] = (Byte)pm; + + if (p->needInitProp) + outBuf[destPos++] = p->props; + + p->needInitProp = False; + p->needInitState = False; + destPos += packSize; + p->srcPos += unpackSize; + + if (outStream) + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + *packSizeRes = destPos; + return SZ_OK; + } +} + +/* ---------- Lzma2 Props ---------- */ + +void Lzma2EncProps_Init(CLzma2EncProps *p) +{ + LzmaEncProps_Init(&p->lzmaProps); + p->numTotalThreads = -1; + p->numBlockThreads = -1; + p->blockSize = 0; +} + +void Lzma2EncProps_Normalize(CLzma2EncProps *p) +{ + int t1, t1n, t2, t3; + { + CLzmaEncProps lzmaProps = p->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + t1n = lzmaProps.numThreads; + } + + t1 = p->lzmaProps.numThreads; + t2 = p->numBlockThreads; + t3 = p->numTotalThreads; + + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + + if (t3 <= 0) + { + if (t2 <= 0) + t2 = 1; + t3 = t1n * t2; + } + else if (t2 <= 0) + { + t2 = t3 / t1n; + if (t2 == 0) + { + t1 = 1; + t2 = t3; + } + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + } + else if (t1 <= 0) + { + t1 = t3 / t2; + if (t1 == 0) + t1 = 1; + } + else + t3 = t1n * t2; + + p->lzmaProps.numThreads = t1; + p->numBlockThreads = t2; + p->numTotalThreads = t3; + LzmaEncProps_Normalize(&p->lzmaProps); + + if (p->blockSize == 0) + { + UInt32 dictSize = p->lzmaProps.dictSize; + UInt64 blockSize = (UInt64)dictSize << 2; + const UInt32 kMinSize = (UInt32)1 << 20; + const UInt32 kMaxSize = (UInt32)1 << 28; + if (blockSize < kMinSize) blockSize = kMinSize; + if (blockSize > kMaxSize) blockSize = kMaxSize; + if (blockSize < dictSize) blockSize = dictSize; + p->blockSize = (size_t)blockSize; + } +} + +static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) +{ + return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; +} + +/* ---------- Lzma2 ---------- */ + +typedef struct +{ + Byte propEncoded; + CLzma2EncProps props; + + Byte *outBuf; + + ISzAlloc *alloc; + ISzAlloc *allocBig; + + CLzma2EncInt coders[NUM_MT_CODER_THREADS_MAX]; + + #ifndef _7ZIP_ST + CMtCoder mtCoder; + #endif + +} CLzma2Enc; + + +/* ---------- Lzma2EncThread ---------- */ + +static SRes Lzma2Enc_EncodeMt1(CLzma2EncInt *p, CLzma2Enc *mainEncoder, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + UInt64 packTotal = 0; + SRes res = SZ_OK; + + if (mainEncoder->outBuf == 0) + { + mainEncoder->outBuf = (Byte *)IAlloc_Alloc(mainEncoder->alloc, LZMA2_CHUNK_SIZE_COMPRESSED_MAX); + if (mainEncoder->outBuf == 0) + return SZ_ERROR_MEM; + } + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + RINOK(LzmaEnc_PrepareForLzma2(p->enc, inStream, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + for (;;) + { + size_t packSize = LZMA2_CHUNK_SIZE_COMPRESSED_MAX; + res = Lzma2EncInt_EncodeSubblock(p, mainEncoder->outBuf, &packSize, outStream); + if (res != SZ_OK) + break; + packTotal += packSize; + res = Progress(progress, p->srcPos, packTotal); + if (res != SZ_OK) + break; + if (packSize == 0) + break; + } + LzmaEnc_Finish(p->enc); + if (res == SZ_OK) + { + Byte b = 0; + if (outStream->Write(outStream, &b, 1) != 1) + return SZ_ERROR_WRITE; + } + return res; +} + +#ifndef _7ZIP_ST + +typedef struct +{ + IMtCoderCallback funcTable; + CLzma2Enc *lzma2Enc; +} CMtCallbackImp; + +static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *destSize, + const Byte *src, size_t srcSize, int finished) +{ + CMtCallbackImp *imp = (CMtCallbackImp *)pp; + CLzma2Enc *mainEncoder = imp->lzma2Enc; + CLzma2EncInt *p = &mainEncoder->coders[index]; + + SRes res = SZ_OK; + { + size_t destLim = *destSize; + *destSize = 0; + + if (srcSize != 0) + { + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + + RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + + while (p->srcPos < srcSize) + { + size_t packSize = destLim - *destSize; + res = Lzma2EncInt_EncodeSubblock(p, dest + *destSize, &packSize, NULL); + if (res != SZ_OK) + break; + *destSize += packSize; + + if (packSize == 0) + { + res = SZ_ERROR_FAIL; + break; + } + + if (MtProgress_Set(&mainEncoder->mtCoder.mtProgress, index, p->srcPos, *destSize) != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + LzmaEnc_Finish(p->enc); + if (res != SZ_OK) + return res; + } + if (finished) + { + if (*destSize == destLim) + return SZ_ERROR_OUTPUT_EOF; + dest[(*destSize)++] = 0; + } + } + return res; +} + +#endif + +/* ---------- Lzma2Enc ---------- */ + +CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzma2Enc *p = (CLzma2Enc *)alloc->Alloc(alloc, sizeof(CLzma2Enc)); + if (p == 0) + return NULL; + Lzma2EncProps_Init(&p->props); + Lzma2EncProps_Normalize(&p->props); + p->outBuf = 0; + p->alloc = alloc; + p->allocBig = allocBig; + { + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + p->coders[i].enc = 0; + } + #ifndef _7ZIP_ST + MtCoder_Construct(&p->mtCoder); + #endif + + return p; +} + +void Lzma2Enc_Destroy(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + { + CLzma2EncInt *t = &p->coders[i]; + if (t->enc) + { + LzmaEnc_Destroy(t->enc, p->alloc, p->allocBig); + t->enc = 0; + } + } + + #ifndef _7ZIP_ST + MtCoder_Destruct(&p->mtCoder); + #endif + + IAlloc_Free(p->alloc, p->outBuf); + IAlloc_Free(p->alloc, pp); +} + +SRes Lzma2Enc_SetProps(CLzma2EncHandle pp, const CLzma2EncProps *props) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + CLzmaEncProps lzmaProps = props->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + if (lzmaProps.lc + lzmaProps.lp > LZMA2_LCLP_MAX) + return SZ_ERROR_PARAM; + p->props = *props; + Lzma2EncProps_Normalize(&p->props); + return SZ_OK; +} + +Byte Lzma2Enc_WriteProperties(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + UInt32 dicSize = LzmaEncProps_GetDictSize(&p->props.lzmaProps); + for (i = 0; i < 40; i++) + if (dicSize <= LZMA2_DIC_SIZE_FROM_PROP(i)) + break; + return (Byte)i; +} + +SRes Lzma2Enc_Encode(CLzma2EncHandle pp, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + int i; + + for (i = 0; i < p->props.numBlockThreads; i++) + { + CLzma2EncInt *t = &p->coders[i]; + if (t->enc == NULL) + { + t->enc = LzmaEnc_Create(p->alloc); + if (t->enc == NULL) + return SZ_ERROR_MEM; + } + } + + #ifndef _7ZIP_ST + if (p->props.numBlockThreads <= 1) + #endif + return Lzma2Enc_EncodeMt1(&p->coders[0], p, outStream, inStream, progress); + + #ifndef _7ZIP_ST + + { + CMtCallbackImp mtCallback; + + mtCallback.funcTable.Code = MtCallbackImp_Code; + mtCallback.lzma2Enc = p; + + p->mtCoder.progress = progress; + p->mtCoder.inStream = inStream; + p->mtCoder.outStream = outStream; + p->mtCoder.alloc = p->alloc; + p->mtCoder.mtCallback = &mtCallback.funcTable; + + p->mtCoder.blockSize = p->props.blockSize; + p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16; + p->mtCoder.numThreads = p->props.numBlockThreads; + + return MtCoder_Code(&p->mtCoder); + } + #endif +} diff --git a/src/ZipLib/extlibs/lzma/Lzma2Enc.h b/src/ZipLib/extlibs/lzma/Lzma2Enc.h new file mode 100644 index 00000000..28352558 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma2Enc.h @@ -0,0 +1,66 @@ +/* Lzma2Enc.h -- LZMA2 Encoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA2_ENC_H +#define __LZMA2_ENC_H + +#include "LzmaEnc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + CLzmaEncProps lzmaProps; + size_t blockSize; + int numBlockThreads; + int numTotalThreads; +} CLzma2EncProps; + +void Lzma2EncProps_Init(CLzma2EncProps *p); +void Lzma2EncProps_Normalize(CLzma2EncProps *p); + +/* ---------- CLzmaEnc2Handle Interface ---------- */ + +/* Lzma2Enc_* functions can return the following exit codes: +Returns: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater in props + SZ_ERROR_WRITE - Write callback error + SZ_ERROR_PROGRESS - some break from progress callback + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +typedef void * CLzma2EncHandle; + +CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig); +void Lzma2Enc_Destroy(CLzma2EncHandle p); +SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props); +Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p); +SRes Lzma2Enc_Encode(CLzma2EncHandle p, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress); + +/* ---------- One Call Interface ---------- */ + +/* Lzma2Encode +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +/* +SRes Lzma2Encode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); +*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Lzma86.h b/src/ZipLib/extlibs/lzma/Lzma86.h new file mode 100644 index 00000000..6acbd888 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma86.h @@ -0,0 +1,111 @@ +/* Lzma86.h -- LZMA + x86 (BCJ) Filter +2009-08-14 : Igor Pavlov : Public domain */ + +#ifndef __LZMA86_H +#define __LZMA86_H + +#include "Types.h" + +EXTERN_C_BEGIN + +#define LZMA86_SIZE_OFFSET (1 + 5) +#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8) + +/* +It's an example for LZMA + x86 Filter use. +You can use .lzma86 extension, if you write that stream to file. +.lzma86 header adds one additional byte to standard .lzma header. +.lzma86 header (14 bytes): + Offset Size Description + 0 1 = 0 - no filter, pure LZMA + = 1 - x86 filter + LZMA + 1 1 lc, lp and pb in encoded form + 2 4 dictSize (little endian) + 6 8 uncompressed size (little endian) + + +Lzma86_Encode +------------- +level - compression level: 0 <= level <= 9, the default value for "level" is 5. + +dictSize - The dictionary size in bytes. The maximum value is + 128 MB = (1 << 27) bytes for 32-bit version + 1 GB = (1 << 30) bytes for 64-bit version + The default value is 16 MB = (1 << 24) bytes, for level = 5. + It's recommended to use the dictionary that is larger than 4 KB and + that can be calculated as (1 << N) or (3 << N) sizes. + For better compression ratio dictSize must be >= inSize. + +filterMode: + SZ_FILTER_NO - no Filter + SZ_FILTER_YES - x86 Filter + SZ_FILTER_AUTO - it tries both alternatives to select best. + Encoder will use 2 or 3 passes: + 2 passes when FILTER_NO provides better compression. + 3 passes when FILTER_YES provides better compression. + +Lzma86Encode allocates Data with MyAlloc functions. +RAM Requirements for compressing: + RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize + filterMode FilterBlockSize + SZ_FILTER_NO 0 + SZ_FILTER_YES inSize + SZ_FILTER_AUTO inSize + + +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +enum ESzFilterMode +{ + SZ_FILTER_NO, + SZ_FILTER_YES, + SZ_FILTER_AUTO +}; + +SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, + int level, UInt32 dictSize, int filterMode); + + +/* +Lzma86_GetUnpackSize: + In: + src - input data + srcLen - input data size + Out: + unpackSize - size of uncompressed stream + Return code: + SZ_OK - OK + SZ_ERROR_INPUT_EOF - Error in headers +*/ + +SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize); + +/* +Lzma86_Decode: + In: + dest - output data + destLen - output data size + src - input data + srcLen - input data size + Out: + destLen - processed output size + srcLen - processed input size + Return code: + SZ_OK - OK + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - unsupported file + SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer +*/ + +SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Lzma86Dec.c b/src/ZipLib/extlibs/lzma/Lzma86Dec.c new file mode 100644 index 00000000..fe772609 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma86Dec.c @@ -0,0 +1,56 @@ +/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder +2009-08-14 : Igor Pavlov : Public domain */ + +#include "Lzma86.h" + +#include "Alloc.h" +#include "Bra.h" +#include "LzmaDec.h" + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } + +SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) +{ + unsigned i; + if (srcLen < LZMA86_HEADER_SIZE) + return SZ_ERROR_INPUT_EOF; + *unpackSize = 0; + for (i = 0; i < sizeof(UInt64); i++) + *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); + return SZ_OK; +} + +SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) +{ + ISzAlloc g_Alloc = { SzAlloc, SzFree }; + SRes res; + int useFilter; + SizeT inSizePure; + ELzmaStatus status; + + if (*srcLen < LZMA86_HEADER_SIZE) + return SZ_ERROR_INPUT_EOF; + + useFilter = src[0]; + + if (useFilter > 1) + { + *destLen = 0; + return SZ_ERROR_UNSUPPORTED; + } + + inSizePure = *srcLen - LZMA86_HEADER_SIZE; + res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, + src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); + *srcLen = inSizePure + LZMA86_HEADER_SIZE; + if (res != SZ_OK) + return res; + if (useFilter == 1) + { + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(dest, *destLen, 0, &x86State, 0); + } + return SZ_OK; +} diff --git a/src/ZipLib/extlibs/lzma/Lzma86Enc.c b/src/ZipLib/extlibs/lzma/Lzma86Enc.c new file mode 100644 index 00000000..2ea4ac2d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Lzma86Enc.c @@ -0,0 +1,108 @@ +/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder +2009-08-14 : Igor Pavlov : Public domain */ + +#include + +#include "Lzma86.h" + +#include "Alloc.h" +#include "Bra.h" +#include "LzmaEnc.h" + +#define SZE_OUT_OVERFLOW SZE_DATA_ERROR + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } + +int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, + int level, UInt32 dictSize, int filterMode) +{ + ISzAlloc g_Alloc = { SzAlloc, SzFree }; + size_t outSize2 = *destLen; + Byte *filteredStream; + Bool useFilter; + int mainResult = SZ_ERROR_OUTPUT_EOF; + CLzmaEncProps props; + LzmaEncProps_Init(&props); + props.level = level; + props.dictSize = dictSize; + + *destLen = 0; + if (outSize2 < LZMA86_HEADER_SIZE) + return SZ_ERROR_OUTPUT_EOF; + + { + int i; + UInt64 t = srcLen; + for (i = 0; i < 8; i++, t >>= 8) + dest[LZMA86_SIZE_OFFSET + i] = (Byte)t; + } + + filteredStream = 0; + useFilter = (filterMode != SZ_FILTER_NO); + if (useFilter) + { + if (srcLen != 0) + { + filteredStream = (Byte *)MyAlloc(srcLen); + if (filteredStream == 0) + return SZ_ERROR_MEM; + memcpy(filteredStream, src, srcLen); + } + { + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(filteredStream, srcLen, 0, &x86State, 1); + } + } + + { + size_t minSize = 0; + Bool bestIsFiltered = False; + + /* passes for SZ_FILTER_AUTO: + 0 - BCJ + LZMA + 1 - LZMA + 2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better. + */ + int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1; + + int i; + for (i = 0; i < numPasses; i++) + { + size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE; + size_t outPropsSize = 5; + SRes curRes; + Bool curModeIsFiltered = (numPasses > 1 && i == numPasses - 1); + if (curModeIsFiltered && !bestIsFiltered) + break; + if (useFilter && i == 0) + curModeIsFiltered = True; + + curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed, + curModeIsFiltered ? filteredStream : src, srcLen, + &props, dest + 1, &outPropsSize, 0, + NULL, &g_Alloc, &g_Alloc); + + if (curRes != SZ_ERROR_OUTPUT_EOF) + { + if (curRes != SZ_OK) + { + mainResult = curRes; + break; + } + if (outSizeProcessed <= minSize || mainResult != SZ_OK) + { + minSize = outSizeProcessed; + bestIsFiltered = curModeIsFiltered; + mainResult = SZ_OK; + } + } + } + dest[0] = (bestIsFiltered ? 1 : 0); + *destLen = LZMA86_HEADER_SIZE + minSize; + } + if (useFilter) + MyFree(filteredStream); + return mainResult; +} diff --git a/src/ZipLib/extlibs/lzma/LzmaDec.c b/src/ZipLib/extlibs/lzma/LzmaDec.c new file mode 100644 index 00000000..8c1a1486 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaDec.c @@ -0,0 +1,993 @@ +/* LzmaDec.c -- LZMA Decoder +2010-12-15 : Igor Pavlov : Public domain */ + +#include "LzmaDec.h" + +#include + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_INIT_SIZE 5 + +#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); +#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); +#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ + { UPDATE_0(p); i = (i + i); A0; } else \ + { UPDATE_1(p); i = (i + i) + 1; A1; } +#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) + +#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } +#define TREE_DECODE(probs, limit, i) \ + { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } + +/* #define _LZMA_SIZE_OPT */ + +#ifdef _LZMA_SIZE_OPT +#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) +#else +#define TREE_6_DECODE(probs, i) \ + { i = 1; \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + i -= 0x40; } +#endif + +#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0_CHECK range = bound; +#define UPDATE_1_CHECK range -= bound; code -= bound; +#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ + { UPDATE_0_CHECK; i = (i + i); A0; } else \ + { UPDATE_1_CHECK; i = (i + i) + 1; A1; } +#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) +#define TREE_DECODE_CHECK(probs, limit, i) \ + { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 +#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +#define LZMA_DIC_MIN (1 << 12) + +/* First LZMA-symbol is always decoded. +And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization +Out: + Result: + SZ_OK - OK + SZ_ERROR_DATA - Error + p->remainLen: + < kMatchSpecLenStart : normal remain + = kMatchSpecLenStart : finished + = kMatchSpecLenStart + 1 : Flush marker + = kMatchSpecLenStart + 2 : State Init Marker +*/ + +static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + CLzmaProb *probs = p->probs; + + unsigned state = p->state; + UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; + unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; + unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; + unsigned lc = p->prop.lc; + + Byte *dic = p->dic; + SizeT dicBufSize = p->dicBufSize; + SizeT dicPos = p->dicPos; + + UInt32 processedPos = p->processedPos; + UInt32 checkDicSize = p->checkDicSize; + unsigned len = 0; + + const Byte *buf = p->buf; + UInt32 range = p->range; + UInt32 code = p->code; + + do + { + CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = processedPos & pbMask; + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + unsigned symbol; + UPDATE_0(prob); + prob = probs + Literal; + if (checkDicSize != 0 || processedPos != 0) + prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + + (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); + + if (state < kNumLitStates) + { + state -= (state < 4) ? state : 3; + symbol = 1; + do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); + } + else + { + unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + unsigned offs = 0x100; + state -= (state < 10) ? 3 : 6; + symbol = 1; + do + { + unsigned bit; + CLzmaProb *probLit; + matchByte <<= 1; + bit = (matchByte & offs); + probLit = prob + offs + bit + symbol; + GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) + } + while (symbol < 0x100); + } + dic[dicPos++] = (Byte)symbol; + processedPos++; + continue; + } + else + { + UPDATE_1(prob); + prob = probs + IsRep + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + state += kNumStates; + prob = probs + LenCoder; + } + else + { + UPDATE_1(prob); + if (checkDicSize == 0 && processedPos == 0) + return SZ_ERROR_DATA; + prob = probs + IsRepG0 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + UPDATE_0(prob); + dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + dicPos++; + processedPos++; + state = state < kNumLitStates ? 9 : 11; + continue; + } + UPDATE_1(prob); + } + else + { + UInt32 distance; + UPDATE_1(prob); + prob = probs + IsRepG1 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep1; + } + else + { + UPDATE_1(prob); + prob = probs + IsRepG2 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep2; + } + else + { + UPDATE_1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = probs + RepLenCoder; + } + { + unsigned limit, offset; + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + limit = (1 << kLenNumLowBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenChoice2; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + limit = (1 << kLenNumMidBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + limit = (1 << kLenNumHighBits); + } + } + TREE_DECODE(probLen, limit, len); + len += offset; + } + + if (state >= kNumStates) + { + UInt32 distance; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); + TREE_6_DECODE(prob, distance); + if (distance >= kStartPosModelIndex) + { + unsigned posSlot = (unsigned)distance; + int numDirectBits = (int)(((distance >> 1) - 1)); + distance = (2 | (distance & 1)); + if (posSlot < kEndPosModelIndex) + { + distance <<= numDirectBits; + prob = probs + SpecPos + distance - posSlot - 1; + { + UInt32 mask = 1; + unsigned i = 1; + do + { + GET_BIT2(prob + i, i, ; , distance |= mask); + mask <<= 1; + } + while (--numDirectBits != 0); + } + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE + range >>= 1; + + { + UInt32 t; + code -= range; + t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ + distance = (distance << 1) + (t + 1); + code += range & t; + } + /* + distance <<= 1; + if (code >= range) + { + code -= range; + distance |= 1; + } + */ + } + while (--numDirectBits != 0); + prob = probs + Align; + distance <<= kNumAlignBits; + { + unsigned i = 1; + GET_BIT2(prob + i, i, ; , distance |= 1); + GET_BIT2(prob + i, i, ; , distance |= 2); + GET_BIT2(prob + i, i, ; , distance |= 4); + GET_BIT2(prob + i, i, ; , distance |= 8); + } + if (distance == (UInt32)0xFFFFFFFF) + { + len += kMatchSpecLenStart; + state -= kNumStates; + break; + } + } + } + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + rep0 = distance + 1; + if (checkDicSize == 0) + { + if (distance >= processedPos) + return SZ_ERROR_DATA; + } + else if (distance >= checkDicSize) + return SZ_ERROR_DATA; + state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; + } + + len += kMatchMinLen; + + if (limit == dicPos) + return SZ_ERROR_DATA; + { + SizeT rem = limit - dicPos; + unsigned curLen = ((rem < len) ? (unsigned)rem : len); + SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); + + processedPos += curLen; + + len -= curLen; + if (pos + curLen <= dicBufSize) + { + Byte *dest = dic + dicPos; + ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; + const Byte *lim = dest + curLen; + dicPos += curLen; + do + *(dest) = (Byte)*(dest + src); + while (++dest != lim); + } + else + { + do + { + dic[dicPos++] = dic[pos]; + if (++pos == dicBufSize) + pos = 0; + } + while (--curLen != 0); + } + } + } + } + while (dicPos < limit && buf < bufLimit); + NORMALIZE; + p->buf = buf; + p->range = range; + p->code = code; + p->remainLen = len; + p->dicPos = dicPos; + p->processedPos = processedPos; + p->reps[0] = rep0; + p->reps[1] = rep1; + p->reps[2] = rep2; + p->reps[3] = rep3; + p->state = state; + + return SZ_OK; +} + +static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) +{ + if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) + { + Byte *dic = p->dic; + SizeT dicPos = p->dicPos; + SizeT dicBufSize = p->dicBufSize; + unsigned len = p->remainLen; + UInt32 rep0 = p->reps[0]; + if (limit - dicPos < len) + len = (unsigned)(limit - dicPos); + + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) + p->checkDicSize = p->prop.dicSize; + + p->processedPos += len; + p->remainLen -= len; + while (len != 0) + { + len--; + dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + dicPos++; + } + p->dicPos = dicPos; + } +} + +static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + do + { + SizeT limit2 = limit; + if (p->checkDicSize == 0) + { + UInt32 rem = p->prop.dicSize - p->processedPos; + if (limit - p->dicPos > rem) + limit2 = p->dicPos + rem; + } + RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); + if (p->processedPos >= p->prop.dicSize) + p->checkDicSize = p->prop.dicSize; + LzmaDec_WriteRem(p, limit); + } + while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); + + if (p->remainLen > kMatchSpecLenStart) + { + p->remainLen = kMatchSpecLenStart; + } + return 0; +} + +typedef enum +{ + DUMMY_ERROR, /* unexpected end of input stream */ + DUMMY_LIT, + DUMMY_MATCH, + DUMMY_REP +} ELzmaDummy; + +static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) +{ + UInt32 range = p->range; + UInt32 code = p->code; + const Byte *bufLimit = buf + inSize; + CLzmaProb *probs = p->probs; + unsigned state = p->state; + ELzmaDummy res; + + { + CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK + + /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ + + prob = probs + Literal; + if (p->checkDicSize != 0 || p->processedPos != 0) + prob += (LZMA_LIT_SIZE * + ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + + (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); + + if (state < kNumLitStates) + { + unsigned symbol = 1; + do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); + } + else + { + unsigned matchByte = p->dic[p->dicPos - p->reps[0] + + ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; + unsigned offs = 0x100; + unsigned symbol = 1; + do + { + unsigned bit; + CLzmaProb *probLit; + matchByte <<= 1; + bit = (matchByte & offs); + probLit = prob + offs + bit + symbol; + GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) + } + while (symbol < 0x100); + } + res = DUMMY_LIT; + } + else + { + unsigned len; + UPDATE_1_CHECK; + + prob = probs + IsRep + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + state = 0; + prob = probs + LenCoder; + res = DUMMY_MATCH; + } + else + { + UPDATE_1_CHECK; + res = DUMMY_REP; + prob = probs + IsRepG0 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + NORMALIZE_CHECK; + return DUMMY_REP; + } + else + { + UPDATE_1_CHECK; + } + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG1 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG2 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + } + } + } + state = kNumStates; + prob = probs + RepLenCoder; + } + { + unsigned limit, offset; + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + limit = 1 << kLenNumLowBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenChoice2; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + limit = 1 << kLenNumMidBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + limit = 1 << kLenNumHighBits; + } + } + TREE_DECODE_CHECK(probLen, limit, len); + len += offset; + } + + if (state < 4) + { + unsigned posSlot; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + + /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ + + if (posSlot < kEndPosModelIndex) + { + prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE_CHECK + range >>= 1; + code -= range & (((code - range) >> 31) - 1); + /* if (code >= range) code -= range; */ + } + while (--numDirectBits != 0); + prob = probs + Align; + numDirectBits = kNumAlignBits; + } + { + unsigned i = 1; + do + { + GET_BIT_CHECK(prob + i, i); + } + while (--numDirectBits != 0); + } + } + } + } + } + NORMALIZE_CHECK; + return res; +} + + +static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) +{ + p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); + p->range = 0xFFFFFFFF; + p->needFlush = 0; +} + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) +{ + p->needFlush = 1; + p->remainLen = 0; + p->tempBufSize = 0; + + if (initDic) + { + p->processedPos = 0; + p->checkDicSize = 0; + p->needInitState = 1; + } + if (initState) + p->needInitState = 1; +} + +void LzmaDec_Init(CLzmaDec *p) +{ + p->dicPos = 0; + LzmaDec_InitDicAndState(p, True, True); +} + +static void LzmaDec_InitStateReal(CLzmaDec *p) +{ + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); + UInt32 i; + CLzmaProb *probs = p->probs; + for (i = 0; i < numProbs; i++) + probs[i] = kBitModelTotal >> 1; + p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; + p->state = 0; + p->needInitState = 0; +} + +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, + ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + (*srcLen) = 0; + LzmaDec_WriteRem(p, dicLimit); + + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->remainLen != kMatchSpecLenStart) + { + int checkEndMarkNow; + + if (p->needFlush != 0) + { + for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) + p->tempBuf[p->tempBufSize++] = *src++; + if (p->tempBufSize < RC_INIT_SIZE) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (p->tempBuf[0] != 0) + return SZ_ERROR_DATA; + + LzmaDec_InitRc(p, p->tempBuf); + p->tempBufSize = 0; + } + + checkEndMarkNow = 0; + if (p->dicPos >= dicLimit) + { + if (p->remainLen == 0 && p->code == 0) + { + *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; + return SZ_OK; + } + if (finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + if (p->remainLen != 0) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + checkEndMarkNow = 1; + } + + if (p->needInitState) + LzmaDec_InitStateReal(p); + + if (p->tempBufSize == 0) + { + SizeT processed; + const Byte *bufLimit; + if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, src, inSize); + if (dummyRes == DUMMY_ERROR) + { + memcpy(p->tempBuf, src, inSize); + p->tempBufSize = (unsigned)inSize; + (*srcLen) += inSize; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + bufLimit = src; + } + else + bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; + p->buf = src; + if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) + return SZ_ERROR_DATA; + processed = (SizeT)(p->buf - src); + (*srcLen) += processed; + src += processed; + inSize -= processed; + } + else + { + unsigned rem = p->tempBufSize, lookAhead = 0; + while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) + p->tempBuf[rem++] = src[lookAhead++]; + p->tempBufSize = rem; + if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); + if (dummyRes == DUMMY_ERROR) + { + (*srcLen) += lookAhead; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + } + p->buf = p->tempBuf; + if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) + return SZ_ERROR_DATA; + lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); + (*srcLen) += lookAhead; + src += lookAhead; + inSize -= lookAhead; + p->tempBufSize = 0; + } + } + if (p->code == 0) + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; +} + +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen; + SizeT inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT inSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->dicPos == p->dicBufSize) + p->dicPos = 0; + dicPos = p->dicPos; + if (outSize > p->dicBufSize - dicPos) + { + outSizeCur = p->dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); + src += inSizeCur; + inSize -= inSizeCur; + *srcLen += inSizeCur; + outSizeCur = p->dicPos - dicPos; + memcpy(dest, p->dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->probs); + p->probs = 0; +} + +static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->dic); + p->dic = 0; +} + +void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) +{ + LzmaDec_FreeProbs(p, alloc); + LzmaDec_FreeDict(p, alloc); +} + +SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) +{ + UInt32 dicSize; + Byte d; + + if (size < LZMA_PROPS_SIZE) + return SZ_ERROR_UNSUPPORTED; + else + dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); + + if (dicSize < LZMA_DIC_MIN) + dicSize = LZMA_DIC_MIN; + p->dicSize = dicSize; + + d = data[0]; + if (d >= (9 * 5 * 5)) + return SZ_ERROR_UNSUPPORTED; + + p->lc = d % 9; + d /= 9; + p->pb = d / 5; + p->lp = d % 5; + + return SZ_OK; +} + +static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) +{ + UInt32 numProbs = LzmaProps_GetNumProbs(propNew); + if (p->probs == 0 || numProbs != p->numProbs) + { + LzmaDec_FreeProbs(p, alloc); + p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); + p->numProbs = numProbs; + if (p->probs == 0) + return SZ_ERROR_MEM; + } + return SZ_OK; +} + +SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + SizeT dicBufSize; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + dicBufSize = propNew.dicSize; + if (p->dic == 0 || dicBufSize != p->dicBufSize) + { + LzmaDec_FreeDict(p, alloc); + p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); + if (p->dic == 0) + { + LzmaDec_FreeProbs(p, alloc); + return SZ_ERROR_MEM; + } + } + p->dicBufSize = dicBufSize; + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzmaDec p; + SRes res; + SizeT outSize = *destLen, inSize = *srcLen; + *destLen = *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + if (inSize < RC_INIT_SIZE) + return SZ_ERROR_INPUT_EOF; + LzmaDec_Construct(&p); + RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc)); + p.dic = dest; + p.dicBufSize = outSize; + LzmaDec_Init(&p); + *srcLen = inSize; + res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); + *destLen = p.dicPos; + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + LzmaDec_FreeProbs(&p, alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/LzmaDec.h b/src/ZipLib/extlibs/lzma/LzmaDec.h new file mode 100644 index 00000000..bf7f084b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaDec.h @@ -0,0 +1,231 @@ +/* LzmaDec.h -- LZMA Decoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA_DEC_H +#define __LZMA_DEC_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* #define _LZMA_PROB32 */ +/* _LZMA_PROB32 can increase the speed on some CPUs, + but memory usage for CLzmaDec::probs will be doubled in that case */ + +#ifdef _LZMA_PROB32 +#define CLzmaProb UInt32 +#else +#define CLzmaProb UInt16 +#endif + + +/* ---------- LZMA Properties ---------- */ + +#define LZMA_PROPS_SIZE 5 + +typedef struct _CLzmaProps +{ + unsigned lc, lp, pb; + UInt32 dicSize; +} CLzmaProps; + +/* LzmaProps_Decode - decodes properties +Returns: + SZ_OK + SZ_ERROR_UNSUPPORTED - Unsupported properties +*/ + +SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); + + +/* ---------- LZMA Decoder state ---------- */ + +/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. + Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ + +#define LZMA_REQUIRED_INPUT_MAX 20 + +typedef struct +{ + CLzmaProps prop; + CLzmaProb *probs; + Byte *dic; + const Byte *buf; + UInt32 range, code; + SizeT dicPos; + SizeT dicBufSize; + UInt32 processedPos; + UInt32 checkDicSize; + unsigned state; + UInt32 reps[4]; + unsigned remainLen; + int needFlush; + int needInitState; + UInt32 numProbs; + unsigned tempBufSize; + Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; +} CLzmaDec; + +#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } + +void LzmaDec_Init(CLzmaDec *p); + +/* There are two types of LZMA streams: + 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. + 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ + +typedef enum +{ + LZMA_FINISH_ANY, /* finish at any point */ + LZMA_FINISH_END /* block must be finished at the end */ +} ELzmaFinishMode; + +/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! + + You must use LZMA_FINISH_END, when you know that current output buffer + covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. + + If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, + and output value of destLen will be less than output buffer size limit. + You can check status result also. + + You can use multiple checks to test data integrity after full decompression: + 1) Check Result and "status" variable. + 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. + 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. + You must use correct finish mode in that case. */ + +typedef enum +{ + LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ + LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ + LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ + LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ +} ELzmaStatus; + +/* ELzmaStatus is used only as output value for function call */ + + +/* ---------- Interfaces ---------- */ + +/* There are 3 levels of interfaces: + 1) Dictionary Interface + 2) Buffer Interface + 3) One Call Interface + You can select any of these interfaces, but don't mix functions from different + groups for same object. */ + + +/* There are two variants to allocate state for Dictionary Interface: + 1) LzmaDec_Allocate / LzmaDec_Free + 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs + You can use variant 2, if you set dictionary buffer manually. + For Buffer Interface you must always use variant 1. + +LzmaDec_Allocate* can return: + SZ_OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties +*/ + +SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); +void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); + +SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); +void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); + +/* ---------- Dictionary Interface ---------- */ + +/* You can use it, if you want to eliminate the overhead for data copying from + dictionary to some other external buffer. + You must work with CLzmaDec variables directly in this interface. + + STEPS: + LzmaDec_Constr() + LzmaDec_Allocate() + for (each new stream) + { + LzmaDec_Init() + while (it needs more decompression) + { + LzmaDec_DecodeToDic() + use data from CLzmaDec::dic and update CLzmaDec::dicPos + } + } + LzmaDec_Free() +*/ + +/* LzmaDec_DecodeToDic + + The decoding to internal dictionary buffer (CLzmaDec::dic). + You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! + +finishMode: + It has meaning only if the decoding reaches output limit (dicLimit). + LZMA_FINISH_ANY - Decode just dicLimit bytes. + LZMA_FINISH_END - Stream must be finished after dicLimit. + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NEEDS_MORE_INPUT + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + SZ_ERROR_DATA - Data error +*/ + +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- Buffer Interface ---------- */ + +/* It's zlib-like interface. + See LzmaDec_DecodeToDic description for information about STEPS and return results, + but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need + to work with CLzmaDec variables manually. + +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - Decode just destLen bytes. + LZMA_FINISH_END - Stream must be finished after (*destLen). +*/ + +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- One Call Interface ---------- */ + +/* LzmaDecode + +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - Decode just destLen bytes. + LZMA_FINISH_END - Stream must be finished after (*destLen). + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + +SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + ELzmaStatus *status, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/LzmaEnc.c b/src/ZipLib/extlibs/lzma/LzmaEnc.c new file mode 100644 index 00000000..ef26e0cf --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaEnc.c @@ -0,0 +1,2276 @@ +/* LzmaEnc.c -- LZMA Encoder +2011-01-27 : Igor Pavlov : Public domain */ + +#include + +/* #define SHOW_STAT */ +/* #define SHOW_STAT2 */ + +#if defined(SHOW_STAT) || defined(SHOW_STAT2) +#include +#endif + +#include "LzmaEnc.h" + +#include "LzFind.h" +#ifndef _7ZIP_ST +#include "LzFindMt.h" +#endif + +#ifdef SHOW_STAT +static int ttt = 0; +#endif + +#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) + +#define kBlockSize (9 << 10) +#define kUnpackBlockSize (1 << 18) +#define kMatchArraySize (1 << 21) +#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) + +#define kNumMaxDirectBits (31) + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 +#define kProbInitValue (kBitModelTotal >> 1) + +#define kNumMoveReducingBits 4 +#define kNumBitPriceShiftBits 4 +#define kBitPrice (1 << kNumBitPriceShiftBits) + +void LzmaEncProps_Init(CLzmaEncProps *p) +{ + p->level = 5; + p->dictSize = p->mc = 0; + p->reduceSize = (UInt32)(Int32)-1; + p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; + p->writeEndMark = 0; +} + +void LzmaEncProps_Normalize(CLzmaEncProps *p) +{ + int level = p->level; + if (level < 0) level = 5; + p->level = level; + if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); + if (p->dictSize > p->reduceSize) + { + unsigned i; + for (i = 15; i <= 30; i++) + { + if (p->reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; } + if (p->reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; } + } + } + if (p->lc < 0) p->lc = 3; + if (p->lp < 0) p->lp = 0; + if (p->pb < 0) p->pb = 2; + if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); + if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); + if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); + if (p->numHashBytes < 0) p->numHashBytes = 4; + if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); + if (p->numThreads < 0) + p->numThreads = + #ifndef _7ZIP_ST + ((p->btMode && p->algo) ? 2 : 1); + #else + 1; + #endif +} + +UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) +{ + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + return props.dictSize; +} + +/* #define LZMA_LOG_BSR */ +/* Define it for Intel's CPU */ + + +#ifdef LZMA_LOG_BSR + +#define kDicLogSizeMaxCompress 30 + +#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } + +UInt32 GetPosSlot1(UInt32 pos) +{ + UInt32 res; + BSR2_RET(pos, res); + return res; +} +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } + +#else + +#define kNumLogBits (9 + (int)sizeof(size_t) / 2) +#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) + +void LzmaEnc_FastPosInit(Byte *g_FastPos) +{ + int c = 2, slotFast; + g_FastPos[0] = 0; + g_FastPos[1] = 1; + + for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) + { + UInt32 k = (1 << ((slotFast >> 1) - 1)); + UInt32 j; + for (j = 0; j < k; j++, c++) + g_FastPos[c] = (Byte)slotFast; + } +} + +#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ + (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ + res = p->g_FastPos[pos >> i] + (i * 2); } +/* +#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ + p->g_FastPos[pos >> 6] + 12 : \ + p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } +*/ + +#define GetPosSlot1(pos) p->g_FastPos[pos] +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } + +#endif + + +#define LZMA_NUM_REPS 4 + +typedef unsigned CState; + +typedef struct +{ + UInt32 price; + + CState state; + int prev1IsChar; + int prev2; + + UInt32 posPrev2; + UInt32 backPrev2; + + UInt32 posPrev; + UInt32 backPrev; + UInt32 backs[LZMA_NUM_REPS]; +} COptimal; + +#define kNumOpts (1 << 12) + +#define kNumLenToPosStates 4 +#define kNumPosSlotBits 6 +#define kDicLogSizeMin 0 +#define kDicLogSizeMax 32 +#define kDistTableSizeMax (kDicLogSizeMax * 2) + + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) +#define kAlignMask (kAlignTableSize - 1) + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) + +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#ifdef _LZMA_PROB32 +#define CLzmaProb UInt32 +#else +#define CLzmaProb UInt16 +#endif + +#define LZMA_PB_MAX 4 +#define LZMA_LC_MAX 8 +#define LZMA_LP_MAX 4 + +#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) + + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define LZMA_MATCH_LEN_MIN 2 +#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) + +#define kNumStates 12 + +typedef struct +{ + CLzmaProb choice; + CLzmaProb choice2; + CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; + CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; + CLzmaProb high[kLenNumHighSymbols]; +} CLenEnc; + +typedef struct +{ + CLenEnc p; + UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; + UInt32 tableSize; + UInt32 counters[LZMA_NUM_PB_STATES_MAX]; +} CLenPriceEnc; + +typedef struct +{ + UInt32 range; + Byte cache; + UInt64 low; + UInt64 cacheSize; + Byte *buf; + Byte *bufLim; + Byte *bufBase; + ISeqOutStream *outStream; + UInt64 processed; + SRes res; +} CRangeEnc; + +typedef struct +{ + CLzmaProb *litProbs; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; + + UInt32 reps[LZMA_NUM_REPS]; + UInt32 state; +} CSaveState; + +typedef struct +{ + IMatchFinder matchFinder; + void *matchFinderObj; + + #ifndef _7ZIP_ST + Bool mtMode; + CMatchFinderMt matchFinderMt; + #endif + + CMatchFinder matchFinderBase; + + #ifndef _7ZIP_ST + Byte pad[128]; + #endif + + UInt32 optimumEndIndex; + UInt32 optimumCurrentIndex; + + UInt32 longestMatchLength; + UInt32 numPairs; + UInt32 numAvail; + COptimal opt[kNumOpts]; + + #ifndef LZMA_LOG_BSR + Byte g_FastPos[1 << kNumLogBits]; + #endif + + UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; + UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; + UInt32 numFastBytes; + UInt32 additionalOffset; + UInt32 reps[LZMA_NUM_REPS]; + UInt32 state; + + UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; + UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; + UInt32 alignPrices[kAlignTableSize]; + UInt32 alignPriceCount; + + UInt32 distTableSize; + + unsigned lc, lp, pb; + unsigned lpMask, pbMask; + + CLzmaProb *litProbs; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; + + unsigned lclp; + + Bool fastMode; + + CRangeEnc rc; + + Bool writeEndMark; + UInt64 nowPos64; + UInt32 matchPriceCount; + Bool finished; + Bool multiThread; + + SRes result; + UInt32 dictSize; + + int needInit; + + CSaveState saveState; +} CLzmaEnc; + +void LzmaEnc_SaveState(CLzmaEncHandle pp) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CSaveState *dest = &p->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); +} + +void LzmaEnc_RestoreState(CLzmaEncHandle pp) +{ + CLzmaEnc *dest = (CLzmaEnc *)pp; + const CSaveState *p = &dest->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); +} + +SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + + if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || + props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30)) + return SZ_ERROR_PARAM; + p->dictSize = props.dictSize; + { + unsigned fb = props.fb; + if (fb < 5) + fb = 5; + if (fb > LZMA_MATCH_LEN_MAX) + fb = LZMA_MATCH_LEN_MAX; + p->numFastBytes = fb; + } + p->lc = props.lc; + p->lp = props.lp; + p->pb = props.pb; + p->fastMode = (props.algo == 0); + p->matchFinderBase.btMode = props.btMode; + { + UInt32 numHashBytes = 4; + if (props.btMode) + { + if (props.numHashBytes < 2) + numHashBytes = 2; + else if (props.numHashBytes < 4) + numHashBytes = props.numHashBytes; + } + p->matchFinderBase.numHashBytes = numHashBytes; + } + + p->matchFinderBase.cutValue = props.mc; + + p->writeEndMark = props.writeEndMark; + + #ifndef _7ZIP_ST + /* + if (newMultiThread != _multiThread) + { + ReleaseMatchFinder(); + _multiThread = newMultiThread; + } + */ + p->multiThread = (props.numThreads > 1); + #endif + + return SZ_OK; +} + +static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; +static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; +static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; +static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; + +#define IsCharState(s) ((s) < 7) + +#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) + +#define kInfinityPrice (1 << 30) + +static void RangeEnc_Construct(CRangeEnc *p) +{ + p->outStream = 0; + p->bufBase = 0; +} + +#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) + +#define RC_BUF_SIZE (1 << 16) +static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) +{ + if (p->bufBase == 0) + { + p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); + if (p->bufBase == 0) + return 0; + p->bufLim = p->bufBase + RC_BUF_SIZE; + } + return 1; +} + +static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->bufBase); + p->bufBase = 0; +} + +static void RangeEnc_Init(CRangeEnc *p) +{ + /* Stream.Init(); */ + p->low = 0; + p->range = 0xFFFFFFFF; + p->cacheSize = 1; + p->cache = 0; + + p->buf = p->bufBase; + + p->processed = 0; + p->res = SZ_OK; +} + +static void RangeEnc_FlushStream(CRangeEnc *p) +{ + size_t num; + if (p->res != SZ_OK) + return; + num = p->buf - p->bufBase; + if (num != p->outStream->Write(p->outStream, p->bufBase, num)) + p->res = SZ_ERROR_WRITE; + p->processed += num; + p->buf = p->bufBase; +} + +static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) +{ + if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) + { + Byte temp = p->cache; + do + { + Byte *buf = p->buf; + *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); + p->buf = buf; + if (buf == p->bufLim) + RangeEnc_FlushStream(p); + temp = 0xFF; + } + while (--p->cacheSize != 0); + p->cache = (Byte)((UInt32)p->low >> 24); + } + p->cacheSize++; + p->low = (UInt32)p->low << 8; +} + +static void RangeEnc_FlushData(CRangeEnc *p) +{ + int i; + for (i = 0; i < 5; i++) + RangeEnc_ShiftLow(p); +} + +static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) +{ + do + { + p->range >>= 1; + p->low += p->range & (0 - ((value >> --numBits) & 1)); + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } + } + while (numBits != 0); +} + +static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) +{ + UInt32 ttt = *prob; + UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; + if (symbol == 0) + { + p->range = newBound; + ttt += (kBitModelTotal - ttt) >> kNumMoveBits; + } + else + { + p->low += newBound; + p->range -= newBound; + ttt -= ttt >> kNumMoveBits; + } + *prob = (CLzmaProb)ttt; + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) +{ + symbol |= 0x100; + do + { + RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); +} + +static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) +{ + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); +} + +void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) +{ + UInt32 i; + for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) + { + const int kCyclesBits = kNumBitPriceShiftBits; + UInt32 w = i; + UInt32 bitCount = 0; + int j; + for (j = 0; j < kCyclesBits; j++) + { + w = w * w; + bitCount <<= 1; + while (w >= ((UInt32)1 << 16)) + { + w >>= 1; + bitCount++; + } + } + ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); + } +} + + +#define GET_PRICE(prob, symbol) \ + p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICEa(prob, symbol) \ + ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= 0x100; + do + { + price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); + return price; +} + +static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); + return price; +} + + +static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0;) + { + UInt32 bit; + i--; + bit = (symbol >> i) & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + } +} + +static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = 0; i < numBitLevels; i++) + { + UInt32 bit = symbol & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + symbol >>= 1; + } +} + +static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= (1 << numBitLevels); + while (symbol != 1) + { + price += GET_PRICEa(probs[symbol >> 1], symbol & 1); + symbol >>= 1; + } + return price; +} + +static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0; i--) + { + UInt32 bit = symbol & 1; + symbol >>= 1; + price += GET_PRICEa(probs[m], bit); + m = (m << 1) | bit; + } + return price; +} + + +static void LenEnc_Init(CLenEnc *p) +{ + unsigned i; + p->choice = p->choice2 = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) + p->low[i] = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) + p->mid[i] = kProbInitValue; + for (i = 0; i < kLenNumHighSymbols; i++) + p->high[i] = kProbInitValue; +} + +static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) +{ + if (symbol < kLenNumLowSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice, 0); + RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice, 1); + if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice2, 0); + RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice2, 1); + RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); + } + } +} + +static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) +{ + UInt32 a0 = GET_PRICE_0a(p->choice); + UInt32 a1 = GET_PRICE_1a(p->choice); + UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); + UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); + UInt32 i = 0; + for (i = 0; i < kLenNumLowSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); + } + for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); + } + for (; i < numSymbols; i++) + prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); +} + +static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) +{ + LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); + p->counters[posState] = p->tableSize; +} + +static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) +{ + UInt32 posState; + for (posState = 0; posState < numPosStates; posState++) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + +static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) +{ + LenEnc_Encode(&p->p, rc, symbol, posState); + if (updatePrice) + if (--p->counters[posState] == 0) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + + + + +static void MovePos(CLzmaEnc *p, UInt32 num) +{ + #ifdef SHOW_STAT + ttt += num; + printf("\n MovePos %d", num); + #endif + if (num != 0) + { + p->additionalOffset += num; + p->matchFinder.Skip(p->matchFinderObj, num); + } +} + +static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) +{ + UInt32 lenRes = 0, numPairs; + p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); + numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); + #ifdef SHOW_STAT + printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); + ttt++; + { + UInt32 i; + for (i = 0; i < numPairs; i += 2) + printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); + } + #endif + if (numPairs > 0) + { + lenRes = p->matches[numPairs - 2]; + if (lenRes == p->numFastBytes) + { + const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + UInt32 distance = p->matches[numPairs - 1] + 1; + UInt32 numAvail = p->numAvail; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + { + const Byte *pby2 = pby - distance; + for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); + } + } + } + p->additionalOffset++; + *numDistancePairsRes = numPairs; + return lenRes; +} + + +#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; +#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; +#define IsShortRep(p) ((p)->backPrev == 0) + +static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) +{ + return + GET_PRICE_0(p->isRepG0[state]) + + GET_PRICE_0(p->isRep0Long[state][posState]); +} + +static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) +{ + UInt32 price; + if (repIndex == 0) + { + price = GET_PRICE_0(p->isRepG0[state]); + price += GET_PRICE_1(p->isRep0Long[state][posState]); + } + else + { + price = GET_PRICE_1(p->isRepG0[state]); + if (repIndex == 1) + price += GET_PRICE_0(p->isRepG1[state]); + else + { + price += GET_PRICE_1(p->isRepG1[state]); + price += GET_PRICE(p->isRepG2[state], repIndex - 2); + } + } + return price; +} + +static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) +{ + return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + + GetPureRepPrice(p, repIndex, state, posState); +} + +static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) +{ + UInt32 posMem = p->opt[cur].posPrev; + UInt32 backMem = p->opt[cur].backPrev; + p->optimumEndIndex = cur; + do + { + if (p->opt[cur].prev1IsChar) + { + MakeAsChar(&p->opt[posMem]) + p->opt[posMem].posPrev = posMem - 1; + if (p->opt[cur].prev2) + { + p->opt[posMem - 1].prev1IsChar = False; + p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; + p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; + } + } + { + UInt32 posPrev = posMem; + UInt32 backCur = backMem; + + backMem = p->opt[posPrev].backPrev; + posMem = p->opt[posPrev].posPrev; + + p->opt[posPrev].backPrev = backCur; + p->opt[posPrev].posPrev = cur; + cur = posPrev; + } + } + while (cur != 0); + *backRes = p->opt[0].backPrev; + p->optimumCurrentIndex = p->opt[0].posPrev; + return p->optimumCurrentIndex; +} + +#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) + +static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) +{ + UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; + UInt32 matchPrice, repMatchPrice, normalMatchPrice; + UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; + UInt32 *matches; + const Byte *data; + Byte curByte, matchByte; + if (p->optimumEndIndex != p->optimumCurrentIndex) + { + const COptimal *opt = &p->opt[p->optimumCurrentIndex]; + UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; + *backRes = opt->backPrev; + p->optimumCurrentIndex = opt->posPrev; + return lenRes; + } + p->optimumCurrentIndex = p->optimumEndIndex = 0; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + if (numAvail < 2) + { + *backRes = (UInt32)(-1); + return 1; + } + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + repMaxIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 lenTest; + const Byte *data2; + reps[i] = p->reps[i]; + data2 = data - (reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + { + repLens[i] = 0; + continue; + } + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + repLens[i] = lenTest; + if (lenTest > repLens[repMaxIndex]) + repMaxIndex = i; + } + if (repLens[repMaxIndex] >= p->numFastBytes) + { + UInt32 lenRes; + *backRes = repMaxIndex; + lenRes = repLens[repMaxIndex]; + MovePos(p, lenRes - 1); + return lenRes; + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) + { + *backRes = (UInt32)-1; + return 1; + } + + p->opt[0].state = (CState)p->state; + + posState = (position & p->pbMask); + + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + + (!IsCharState(p->state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + MakeAsChar(&p->opt[1]); + + matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); + + if (matchByte == curByte) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); + if (shortRepPrice < p->opt[1].price) + { + p->opt[1].price = shortRepPrice; + MakeAsShortRep(&p->opt[1]); + } + } + lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); + + if (lenEnd < 2) + { + *backRes = p->opt[1].backPrev; + return 1; + } + + p->opt[1].posPrev = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + p->opt[0].backs[i] = reps[i]; + + len = lenEnd; + do + p->opt[len--].price = kInfinityPrice; + while (len >= 2); + + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 repLen = repLens[i]; + UInt32 price; + if (repLen < 2) + continue; + price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; + COptimal *opt = &p->opt[repLen]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = i; + opt->prev1IsChar = False; + } + } + while (--repLen >= 2); + } + + normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); + + len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); + if (len <= mainLen) + { + UInt32 offs = 0; + while (len > matches[offs]) + offs += 2; + for (; ; len++) + { + COptimal *opt; + UInt32 distance = matches[offs + 1]; + + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; + UInt32 lenToPosState = GetLenToPosState(len); + if (distance < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][distance]; + else + { + UInt32 slot; + GetPosSlot2(distance, slot); + curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; + } + opt = &p->opt[len]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = distance + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + if (len == matches[offs]) + { + offs += 2; + if (offs == numPairs) + break; + } + } + } + + cur = 0; + + #ifdef SHOW_STAT2 + if (position >= 0) + { + unsigned i; + printf("\n pos = %4X", position); + for (i = cur; i <= lenEnd; i++) + printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); + } + #endif + + for (;;) + { + UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; + UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; + Bool nextIsChar; + Byte curByte, matchByte; + const Byte *data; + COptimal *curOpt; + COptimal *nextOpt; + + cur++; + if (cur == lenEnd) + return Backward(p, backRes, cur); + + newLen = ReadMatchDistances(p, &numPairs); + if (newLen >= p->numFastBytes) + { + p->numPairs = numPairs; + p->longestMatchLength = newLen; + return Backward(p, backRes, cur); + } + position++; + curOpt = &p->opt[cur]; + posPrev = curOpt->posPrev; + if (curOpt->prev1IsChar) + { + posPrev--; + if (curOpt->prev2) + { + state = p->opt[curOpt->posPrev2].state; + if (curOpt->backPrev2 < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + else + state = p->opt[posPrev].state; + state = kLiteralNextStates[state]; + } + else + state = p->opt[posPrev].state; + if (posPrev == cur - 1) + { + if (IsShortRep(curOpt)) + state = kShortRepNextStates[state]; + else + state = kLiteralNextStates[state]; + } + else + { + UInt32 pos; + const COptimal *prevOpt; + if (curOpt->prev1IsChar && curOpt->prev2) + { + posPrev = curOpt->posPrev2; + pos = curOpt->backPrev2; + state = kRepNextStates[state]; + } + else + { + pos = curOpt->backPrev; + if (pos < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + prevOpt = &p->opt[posPrev]; + if (pos < LZMA_NUM_REPS) + { + UInt32 i; + reps[0] = prevOpt->backs[pos]; + for (i = 1; i <= pos; i++) + reps[i] = prevOpt->backs[i - 1]; + for (; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i]; + } + else + { + UInt32 i; + reps[0] = (pos - LZMA_NUM_REPS); + for (i = 1; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i - 1]; + } + } + curOpt->state = (CState)state; + + curOpt->backs[0] = reps[0]; + curOpt->backs[1] = reps[1]; + curOpt->backs[2] = reps[2]; + curOpt->backs[3] = reps[3]; + + curPrice = curOpt->price; + nextIsChar = False; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + posState = (position & p->pbMask); + + curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + curAnd1Price += + (!IsCharState(state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + nextOpt = &p->opt[cur + 1]; + + if (curAnd1Price < nextOpt->price) + { + nextOpt->price = curAnd1Price; + nextOpt->posPrev = cur; + MakeAsChar(nextOpt); + nextIsChar = True; + } + + matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); + + if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); + if (shortRepPrice <= nextOpt->price) + { + nextOpt->price = shortRepPrice; + nextOpt->posPrev = cur; + MakeAsShortRep(nextOpt); + nextIsChar = True; + } + } + numAvailFull = p->numAvail; + { + UInt32 temp = kNumOpts - 1 - cur; + if (temp < numAvailFull) + numAvailFull = temp; + } + + if (numAvailFull < 2) + continue; + numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); + + if (!nextIsChar && matchByte != curByte) /* speed optimization */ + { + /* try Literal + rep0 */ + UInt32 temp; + UInt32 lenTest2; + const Byte *data2 = data - (reps[0] + 1); + UInt32 limit = p->numFastBytes + 1; + if (limit > numAvailFull) + limit = numAvailFull; + + for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); + lenTest2 = temp - 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kLiteralNextStates[state]; + UInt32 posStateNext = (position + 1) & p->pbMask; + UInt32 nextRepMatchPrice = curAnd1Price + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = False; + } + } + } + } + + startLen = 2; /* speed optimization */ + { + UInt32 repIndex; + for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) + { + UInt32 lenTest; + UInt32 lenTestTemp; + UInt32 price; + const Byte *data2 = data - (reps[repIndex] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + while (lenEnd < cur + lenTest) + p->opt[++lenEnd].price = kInfinityPrice; + lenTestTemp = lenTest; + price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; + COptimal *opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = repIndex; + opt->prev1IsChar = False; + } + } + while (--lenTest >= 2); + lenTest = lenTestTemp; + + if (repIndex == 0) + startLen = lenTest + 1; + + /* if (_maxMode) */ + { + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + UInt32 nextRepMatchPrice; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kRepNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = + price + p->repLenEnc.prices[posState][lenTest - 2] + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (position + lenTest + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + lenTest + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = repIndex; + } + } + } + } + } + } + /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ + if (newLen > numAvail) + { + newLen = numAvail; + for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); + matches[numPairs] = newLen; + numPairs += 2; + } + if (newLen >= startLen) + { + UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); + UInt32 offs, curBack, posSlot; + UInt32 lenTest; + while (lenEnd < cur + newLen) + p->opt[++lenEnd].price = kInfinityPrice; + + offs = 0; + while (startLen > matches[offs]) + offs += 2; + curBack = matches[offs + 1]; + GetPosSlot2(curBack, posSlot); + for (lenTest = /*2*/ startLen; ; lenTest++) + { + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; + UInt32 lenToPosState = GetLenToPosState(lenTest); + COptimal *opt; + if (curBack < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; + else + curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; + + opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = curBack + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + + if (/*_maxMode && */lenTest == matches[offs]) + { + /* Try Match + Literal + Rep0 */ + const Byte *data2 = data - (curBack + 1); + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + UInt32 nextRepMatchPrice; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kMatchNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = curAndLenPrice + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (posStateNext + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 offset = cur + lenTest + 1 + lenTest2; + UInt32 curAndLenPrice; + COptimal *opt; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = curBack + LZMA_NUM_REPS; + } + } + } + offs += 2; + if (offs == numPairs) + break; + curBack = matches[offs + 1]; + if (curBack >= kNumFullDistances) + GetPosSlot2(curBack, posSlot); + } + } + } + } +} + +#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) + +static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) +{ + UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; + const Byte *data; + const UInt32 *matches; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + *backRes = (UInt32)-1; + if (numAvail < 2) + return 1; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + + repLen = repIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len; + const Byte *data2 = data - (p->reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (len = 2; len < numAvail && data[len] == data2[len]; len++); + if (len >= p->numFastBytes) + { + *backRes = i; + MovePos(p, len - 1); + return len; + } + if (len > repLen) + { + repIndex = i; + repLen = len; + } + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + + mainDist = 0; /* for GCC */ + if (mainLen >= 2) + { + mainDist = matches[numPairs - 1]; + while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) + { + if (!ChangePair(matches[numPairs - 3], mainDist)) + break; + numPairs -= 2; + mainLen = matches[numPairs - 2]; + mainDist = matches[numPairs - 1]; + } + if (mainLen == 2 && mainDist >= 0x80) + mainLen = 1; + } + + if (repLen >= 2 && ( + (repLen + 1 >= mainLen) || + (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || + (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) + { + *backRes = repIndex; + MovePos(p, repLen - 1); + return repLen; + } + + if (mainLen < 2 || numAvail <= 2) + return 1; + + p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); + if (p->longestMatchLength >= 2) + { + UInt32 newDistance = matches[p->numPairs - 1]; + if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || + (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || + (p->longestMatchLength > mainLen + 1) || + (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) + return 1; + } + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len, limit; + const Byte *data2 = data - (p->reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + limit = mainLen - 1; + for (len = 2; len < limit && data[len] == data2[len]; len++); + if (len >= limit) + return 1; + } + *backRes = mainDist + LZMA_NUM_REPS; + MovePos(p, mainLen - 2); + return mainLen; +} + +static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) +{ + UInt32 len; + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + len = LZMA_MATCH_LEN_MIN; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); + RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); +} + +static SRes CheckErrors(CLzmaEnc *p) +{ + if (p->result != SZ_OK) + return p->result; + if (p->rc.res != SZ_OK) + p->result = SZ_ERROR_WRITE; + if (p->matchFinderBase.result != SZ_OK) + p->result = SZ_ERROR_READ; + if (p->result != SZ_OK) + p->finished = True; + return p->result; +} + +static SRes Flush(CLzmaEnc *p, UInt32 nowPos) +{ + /* ReleaseMFStream(); */ + p->finished = True; + if (p->writeEndMark) + WriteEndMarker(p, nowPos & p->pbMask); + RangeEnc_FlushData(&p->rc); + RangeEnc_FlushStream(&p->rc); + return CheckErrors(p); +} + +static void FillAlignPrices(CLzmaEnc *p) +{ + UInt32 i; + for (i = 0; i < kAlignTableSize; i++) + p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); + p->alignPriceCount = 0; +} + +static void FillDistancesPrices(CLzmaEnc *p) +{ + UInt32 tempPrices[kNumFullDistances]; + UInt32 i, lenToPosState; + for (i = kStartPosModelIndex; i < kNumFullDistances; i++) + { + UInt32 posSlot = GetPosSlot1(i); + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); + } + + for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) + { + UInt32 posSlot; + const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; + UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; + for (posSlot = 0; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); + for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); + + { + UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; + UInt32 i; + for (i = 0; i < kStartPosModelIndex; i++) + distancesPrices[i] = posSlotPrices[i]; + for (; i < kNumFullDistances; i++) + distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; + } + } + p->matchPriceCount = 0; +} + +void LzmaEnc_Construct(CLzmaEnc *p) +{ + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); + #ifndef _7ZIP_ST + MatchFinderMt_Construct(&p->matchFinderMt); + p->matchFinderMt.MatchFinder = &p->matchFinderBase; + #endif + + { + CLzmaEncProps props; + LzmaEncProps_Init(&props); + LzmaEnc_SetProps(p, &props); + } + + #ifndef LZMA_LOG_BSR + LzmaEnc_FastPosInit(p->g_FastPos); + #endif + + LzmaEnc_InitPriceTables(p->ProbPrices); + p->litProbs = 0; + p->saveState.litProbs = 0; +} + +CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) +{ + void *p; + p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); + if (p != 0) + LzmaEnc_Construct((CLzmaEnc *)p); + return p; +} + +void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->litProbs); + alloc->Free(alloc, p->saveState.litProbs); + p->litProbs = 0; + p->saveState.litProbs = 0; +} + +void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + #ifndef _7ZIP_ST + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); + #endif + MatchFinder_Free(&p->matchFinderBase, allocBig); + LzmaEnc_FreeLits(p, alloc); + RangeEnc_Free(&p->rc, alloc); +} + +void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); + alloc->Free(alloc, p); +} + +static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) +{ + UInt32 nowPos32, startPos32; + if (p->needInit) + { + p->matchFinder.Init(p->matchFinderObj); + p->needInit = 0; + } + + if (p->finished) + return p->result; + RINOK(CheckErrors(p)); + + nowPos32 = (UInt32)p->nowPos64; + startPos32 = nowPos32; + + if (p->nowPos64 == 0) + { + UInt32 numPairs; + Byte curByte; + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + return Flush(p, nowPos32); + ReadMatchDistances(p, &numPairs); + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); + p->state = kLiteralNextStates[p->state]; + curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); + LitEnc_Encode(&p->rc, p->litProbs, curByte); + p->additionalOffset--; + nowPos32++; + } + + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) + for (;;) + { + UInt32 pos, len, posState; + + if (p->fastMode) + len = GetOptimumFast(p, &pos); + else + len = GetOptimum(p, nowPos32, &pos); + + #ifdef SHOW_STAT2 + printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); + #endif + + posState = nowPos32 & p->pbMask; + if (len == 1 && pos == (UInt32)-1) + { + Byte curByte; + CLzmaProb *probs; + const Byte *data; + + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; + curByte = *data; + probs = LIT_PROBS(nowPos32, *(data - 1)); + if (IsCharState(p->state)) + LitEnc_Encode(&p->rc, probs, curByte); + else + LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); + p->state = kLiteralNextStates[p->state]; + } + else + { + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + if (pos < LZMA_NUM_REPS) + { + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); + if (pos == 0) + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); + RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); + } + else + { + UInt32 distance = p->reps[pos]; + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); + if (pos == 1) + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); + else + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); + if (pos == 3) + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + } + p->reps[1] = p->reps[0]; + p->reps[0] = distance; + } + if (len == 1) + p->state = kShortRepNextStates[p->state]; + else + { + LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + p->state = kRepNextStates[p->state]; + } + } + else + { + UInt32 posSlot; + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + pos -= LZMA_NUM_REPS; + GetPosSlot(pos, posSlot); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); + + if (posSlot >= kStartPosModelIndex) + { + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + UInt32 posReduced = pos - base; + + if (posSlot < kEndPosModelIndex) + RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); + else + { + RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); + p->alignPriceCount++; + } + } + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + p->reps[1] = p->reps[0]; + p->reps[0] = pos; + p->matchPriceCount++; + } + } + p->additionalOffset -= len; + nowPos32 += len; + if (p->additionalOffset == 0) + { + UInt32 processed; + if (!p->fastMode) + { + if (p->matchPriceCount >= (1 << 7)) + FillDistancesPrices(p); + if (p->alignPriceCount >= kAlignTableSize) + FillAlignPrices(p); + } + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + break; + processed = nowPos32 - startPos32; + if (useLimits) + { + if (processed + kNumOpts + 300 >= maxUnpackSize || + RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) + break; + } + else if (processed >= (1 << 15)) + { + p->nowPos64 += nowPos32 - startPos32; + return CheckErrors(p); + } + } + } + p->nowPos64 += nowPos32 - startPos32; + return Flush(p, nowPos32); +} + +#define kBigHashDicLimit ((UInt32)1 << 24) + +static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 beforeSize = kNumOpts; + Bool btMode; + if (!RangeEnc_Alloc(&p->rc, alloc)) + return SZ_ERROR_MEM; + btMode = (p->matchFinderBase.btMode != 0); + #ifndef _7ZIP_ST + p->mtMode = (p->multiThread && !p->fastMode && btMode); + #endif + + { + unsigned lclp = p->lc + p->lp; + if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) + { + LzmaEnc_FreeLits(p, alloc); + p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); + p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); + if (p->litProbs == 0 || p->saveState.litProbs == 0) + { + LzmaEnc_FreeLits(p, alloc); + return SZ_ERROR_MEM; + } + p->lclp = lclp; + } + } + + p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); + + if (beforeSize + p->dictSize < keepWindowSize) + beforeSize = keepWindowSize - p->dictSize; + + #ifndef _7ZIP_ST + if (p->mtMode) + { + RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); + p->matchFinderObj = &p->matchFinderMt; + MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); + } + else + #endif + { + if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) + return SZ_ERROR_MEM; + p->matchFinderObj = &p->matchFinderBase; + MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); + } + return SZ_OK; +} + +void LzmaEnc_Init(CLzmaEnc *p) +{ + UInt32 i; + p->state = 0; + for (i = 0 ; i < LZMA_NUM_REPS; i++) + p->reps[i] = 0; + + RangeEnc_Init(&p->rc); + + + for (i = 0; i < kNumStates; i++) + { + UInt32 j; + for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) + { + p->isMatch[i][j] = kProbInitValue; + p->isRep0Long[i][j] = kProbInitValue; + } + p->isRep[i] = kProbInitValue; + p->isRepG0[i] = kProbInitValue; + p->isRepG1[i] = kProbInitValue; + p->isRepG2[i] = kProbInitValue; + } + + { + UInt32 num = 0x300 << (p->lp + p->lc); + for (i = 0; i < num; i++) + p->litProbs[i] = kProbInitValue; + } + + { + for (i = 0; i < kNumLenToPosStates; i++) + { + CLzmaProb *probs = p->posSlotEncoder[i]; + UInt32 j; + for (j = 0; j < (1 << kNumPosSlotBits); j++) + probs[j] = kProbInitValue; + } + } + { + for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) + p->posEncoders[i] = kProbInitValue; + } + + LenEnc_Init(&p->lenEnc.p); + LenEnc_Init(&p->repLenEnc.p); + + for (i = 0; i < (1 << kNumAlignBits); i++) + p->posAlignEncoder[i] = kProbInitValue; + + p->optimumEndIndex = 0; + p->optimumCurrentIndex = 0; + p->additionalOffset = 0; + + p->pbMask = (1 << p->pb) - 1; + p->lpMask = (1 << p->lp) - 1; +} + +void LzmaEnc_InitPrices(CLzmaEnc *p) +{ + if (!p->fastMode) + { + FillDistancesPrices(p); + FillAlignPrices(p); + } + + p->lenEnc.tableSize = + p->repLenEnc.tableSize = + p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; + LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); + LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); +} + +static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 i; + for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) + if (p->dictSize <= ((UInt32)1 << i)) + break; + p->distTableSize = i * 2; + + p->finished = False; + p->result = SZ_OK; + RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + p->nowPos64 = 0; + return SZ_OK; +} + +static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + p->rc.outStream = outStream; + return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, + ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) +{ + p->matchFinderBase.directInput = 1; + p->matchFinderBase.bufferBase = (Byte *)src; + p->matchFinderBase.directInputRem = srcLen; +} + +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + LzmaEnc_SetInputBuf(p, src, srcLen); + p->needInit = 1; + + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +void LzmaEnc_Finish(CLzmaEncHandle pp) +{ + #ifndef _7ZIP_ST + CLzmaEnc *p = (CLzmaEnc *)pp; + if (p->mtMode) + MatchFinderMt_ReleaseStream(&p->matchFinderMt); + #else + pp = pp; + #endif +} + +typedef struct +{ + ISeqOutStream funcTable; + Byte *data; + SizeT rem; + Bool overflow; +} CSeqOutStreamBuf; + +static size_t MyWrite(void *pp, const void *data, size_t size) +{ + CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; + if (p->rem < size) + { + size = p->rem; + p->overflow = True; + } + memcpy(p->data, data, size); + p->rem -= size; + p->data += size; + return size; +} + + +UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +} + +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; +} + +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + UInt64 nowPos64; + SRes res; + CSeqOutStreamBuf outStream; + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = False; + p->finished = False; + p->result = SZ_OK; + + if (reInit) + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + nowPos64 = p->nowPos64; + RangeEnc_Init(&p->rc); + p->rc.outStream = &outStream.funcTable; + + res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); + + *unpackSize = (UInt32)(p->nowPos64 - nowPos64); + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + + return res; +} + +static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) +{ + SRes res = SZ_OK; + + #ifndef _7ZIP_ST + Byte allocaDummy[0x300]; + int i = 0; + for (i = 0; i < 16; i++) + allocaDummy[i] = (Byte)i; + #endif + + for (;;) + { + res = LzmaEnc_CodeOneBlock(p, False, 0, 0); + if (res != SZ_OK || p->finished != 0) + break; + if (progress != 0) + { + res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); + if (res != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + } + LzmaEnc_Finish(p); + return res; +} + +SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); + return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); +} + +SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + int i; + UInt32 dictSize = p->dictSize; + if (*size < LZMA_PROPS_SIZE) + return SZ_ERROR_PARAM; + *size = LZMA_PROPS_SIZE; + props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); + + for (i = 11; i <= 30; i++) + { + if (dictSize <= ((UInt32)2 << i)) + { + dictSize = (2 << i); + break; + } + if (dictSize <= ((UInt32)3 << i)) + { + dictSize = (3 << i); + break; + } + } + + for (i = 0; i < 4; i++) + props[1 + i] = (Byte)(dictSize >> (8 * i)); + return SZ_OK; +} + +SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + SRes res; + CLzmaEnc *p = (CLzmaEnc *)pp; + + CSeqOutStreamBuf outStream; + + LzmaEnc_SetInputBuf(p, src, srcLen); + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = writeEndMark; + + p->rc.outStream = &outStream.funcTable; + res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); + if (res == SZ_OK) + res = LzmaEnc_Encode2(p, progress); + + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + return res; +} + +SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); + SRes res; + if (p == 0) + return SZ_ERROR_MEM; + + res = LzmaEnc_SetProps(p, props); + if (res == SZ_OK) + { + res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); + if (res == SZ_OK) + res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, + writeEndMark, progress, alloc, allocBig); + } + + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/LzmaEnc.h b/src/ZipLib/extlibs/lzma/LzmaEnc.h new file mode 100644 index 00000000..b8d9ce77 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaEnc.h @@ -0,0 +1,78 @@ +/* LzmaEnc.h -- LZMA Encoder +2011-01-27 : Igor Pavlov : Public domain */ + +#ifndef __LZMA_ENC_H +#define __LZMA_ENC_H + +#include "Types.h" + +EXTERN_C_BEGIN + +#define LZMA_PROPS_SIZE 5 + +typedef struct _CLzmaEncProps +{ + int level; /* 0 <= level <= 9 */ + UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version + (1 << 12) <= dictSize <= (1 << 30) for 64-bit version + default = (1 << 24) */ + UInt32 reduceSize; /* estimated size of data that will be compressed. default = 0xFFFFFFFF. + Encoder uses this value to reduce dictionary size */ + int lc; /* 0 <= lc <= 8, default = 3 */ + int lp; /* 0 <= lp <= 4, default = 0 */ + int pb; /* 0 <= pb <= 4, default = 2 */ + int algo; /* 0 - fast, 1 - normal, default = 1 */ + int fb; /* 5 <= fb <= 273, default = 32 */ + int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ + int numHashBytes; /* 2, 3 or 4, default = 4 */ + UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ + unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ + int numThreads; /* 1 or 2, default = 2 */ +} CLzmaEncProps; + +void LzmaEncProps_Init(CLzmaEncProps *p); +void LzmaEncProps_Normalize(CLzmaEncProps *p); +UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); + + +/* ---------- CLzmaEncHandle Interface ---------- */ + +/* LzmaEnc_* functions can return the following exit codes: +Returns: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater in props + SZ_ERROR_WRITE - Write callback error. + SZ_ERROR_PROGRESS - some break from progress callback + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +typedef void * CLzmaEncHandle; + +CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); +void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); +SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); +SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + +/* ---------- One Call Interface ---------- */ + +/* LzmaEncode +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/LzmaLib.c b/src/ZipLib/extlibs/lzma/LzmaLib.c new file mode 100644 index 00000000..02a51185 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaLib.c @@ -0,0 +1,46 @@ +/* LzmaLib.c -- LZMA library wrapper +2008-08-05 +Igor Pavlov +Public domain */ + +#include "LzmaEnc.h" +#include "LzmaDec.h" +#include "Alloc.h" +#include "LzmaLib.h" + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } +static ISzAlloc g_Alloc = { SzAlloc, SzFree }; + +MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, + unsigned char *outProps, size_t *outPropsSize, + int level, /* 0 <= level <= 9, default = 5 */ + unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ + int lc, /* 0 <= lc <= 8, default = 3 */ + int lp, /* 0 <= lp <= 4, default = 0 */ + int pb, /* 0 <= pb <= 4, default = 2 */ + int fb, /* 5 <= fb <= 273, default = 32 */ + int numThreads /* 1 or 2, default = 2 */ +) +{ + CLzmaEncProps props; + LzmaEncProps_Init(&props); + props.level = level; + props.dictSize = dictSize; + props.lc = lc; + props.lp = lp; + props.pb = pb; + props.fb = fb; + props.numThreads = numThreads; + + return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, + NULL, &g_Alloc, &g_Alloc); +} + + +MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, + const unsigned char *props, size_t propsSize) +{ + ELzmaStatus status; + return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); +} diff --git a/src/ZipLib/extlibs/lzma/LzmaLib.h b/src/ZipLib/extlibs/lzma/LzmaLib.h new file mode 100644 index 00000000..76c99ce7 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/LzmaLib.h @@ -0,0 +1,135 @@ +/* LzmaLib.h -- LZMA library interface +2009-04-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA_LIB_H +#define __LZMA_LIB_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define MY_STDAPI int MY_STD_CALL + +#define LZMA_PROPS_SIZE 5 + +/* +RAM requirements for LZMA: + for compression: (dictSize * 11.5 + 6 MB) + state_size + for decompression: dictSize + state_size + state_size = (4 + (1.5 << (lc + lp))) KB + by default (lc=3, lp=0), state_size = 16 KB. + +LZMA properties (5 bytes) format + Offset Size Description + 0 1 lc, lp and pb in encoded form. + 1 4 dictSize (little endian). +*/ + +/* +LzmaCompress +------------ + +outPropsSize - + In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5. + Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5. + + LZMA Encoder will use defult values for any parameter, if it is + -1 for any from: level, loc, lp, pb, fb, numThreads + 0 for dictSize + +level - compression level: 0 <= level <= 9; + + level dictSize algo fb + 0: 16 KB 0 32 + 1: 64 KB 0 32 + 2: 256 KB 0 32 + 3: 1 MB 0 32 + 4: 4 MB 0 32 + 5: 16 MB 1 32 + 6: 32 MB 1 32 + 7+: 64 MB 1 64 + + The default value for "level" is 5. + + algo = 0 means fast method + algo = 1 means normal method + +dictSize - The dictionary size in bytes. The maximum value is + 128 MB = (1 << 27) bytes for 32-bit version + 1 GB = (1 << 30) bytes for 64-bit version + The default value is 16 MB = (1 << 24) bytes. + It's recommended to use the dictionary that is larger than 4 KB and + that can be calculated as (1 << N) or (3 << N) sizes. + +lc - The number of literal context bits (high bits of previous literal). + It can be in the range from 0 to 8. The default value is 3. + Sometimes lc=4 gives the gain for big files. + +lp - The number of literal pos bits (low bits of current position for literals). + It can be in the range from 0 to 4. The default value is 0. + The lp switch is intended for periodical data when the period is equal to 2^lp. + For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's + better to set lc=0, if you change lp switch. + +pb - The number of pos bits (low bits of current position). + It can be in the range from 0 to 4. The default value is 2. + The pb switch is intended for periodical data when the period is equal 2^pb. + +fb - Word size (the number of fast bytes). + It can be in the range from 5 to 273. The default value is 32. + Usually, a big number gives a little bit better compression ratio and + slower compression process. + +numThreads - The number of thereads. 1 or 2. The default value is 2. + Fast mode (algo = 0) can use only 1 thread. + +Out: + destLen - processed output size +Returns: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, + unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */ + int level, /* 0 <= level <= 9, default = 5 */ + unsigned dictSize, /* default = (1 << 24) */ + int lc, /* 0 <= lc <= 8, default = 3 */ + int lp, /* 0 <= lp <= 4, default = 0 */ + int pb, /* 0 <= pb <= 4, default = 2 */ + int fb, /* 5 <= fb <= 273, default = 32 */ + int numThreads /* 1 or 2, default = 2 */ + ); + +/* +LzmaUncompress +-------------- +In: + dest - output data + destLen - output data size + src - input data + srcLen - input data size +Out: + destLen - processed output size + srcLen - processed input size +Returns: + SZ_OK - OK + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation arror + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src) +*/ + +MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen, + const unsigned char *props, size_t propsSize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/MtCoder.c b/src/ZipLib/extlibs/lzma/MtCoder.c new file mode 100644 index 00000000..946fbbc7 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/MtCoder.c @@ -0,0 +1,327 @@ +/* MtCoder.c -- Multi-thread Coder +2010-09-24 : Igor Pavlov : Public domain */ + +#include + +#include "MtCoder.h" + +void LoopThread_Construct(CLoopThread *p) +{ + Thread_Construct(&p->thread); + Event_Construct(&p->startEvent); + Event_Construct(&p->finishedEvent); +} + +void LoopThread_Close(CLoopThread *p) +{ + Thread_Close(&p->thread); + Event_Close(&p->startEvent); + Event_Close(&p->finishedEvent); +} + +static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE LoopThreadFunc(void *pp) +{ + CLoopThread *p = (CLoopThread *)pp; + for (;;) + { + if (Event_Wait(&p->startEvent) != 0) + return SZ_ERROR_THREAD; + if (p->stop) + return 0; + p->res = p->func(p->param); + if (Event_Set(&p->finishedEvent) != 0) + return SZ_ERROR_THREAD; + } +} + +WRes LoopThread_Create(CLoopThread *p) +{ + p->stop = 0; + RINOK(AutoResetEvent_CreateNotSignaled(&p->startEvent)); + RINOK(AutoResetEvent_CreateNotSignaled(&p->finishedEvent)); + return Thread_Create(&p->thread, LoopThreadFunc, p); +} + +WRes LoopThread_StopAndWait(CLoopThread *p) +{ + p->stop = 1; + if (Event_Set(&p->startEvent) != 0) + return SZ_ERROR_THREAD; + return Thread_Wait(&p->thread); +} + +WRes LoopThread_StartSubThread(CLoopThread *p) { return Event_Set(&p->startEvent); } +WRes LoopThread_WaitSubThread(CLoopThread *p) { return Event_Wait(&p->finishedEvent); } + +static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) +{ + return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; +} + +static void MtProgress_Init(CMtProgress *p, ICompressProgress *progress) +{ + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + p->inSizes[i] = p->outSizes[i] = 0; + p->totalInSize = p->totalOutSize = 0; + p->progress = progress; + p->res = SZ_OK; +} + +static void MtProgress_Reinit(CMtProgress *p, unsigned index) +{ + p->inSizes[index] = 0; + p->outSizes[index] = 0; +} + +#define UPDATE_PROGRESS(size, prev, total) \ + if (size != (UInt64)(Int64)-1) { total += size - prev; prev = size; } + +SRes MtProgress_Set(CMtProgress *p, unsigned index, UInt64 inSize, UInt64 outSize) +{ + SRes res; + CriticalSection_Enter(&p->cs); + UPDATE_PROGRESS(inSize, p->inSizes[index], p->totalInSize) + UPDATE_PROGRESS(outSize, p->outSizes[index], p->totalOutSize) + if (p->res == SZ_OK) + p->res = Progress(p->progress, p->totalInSize, p->totalOutSize); + res = p->res; + CriticalSection_Leave(&p->cs); + return res; +} + +static void MtProgress_SetError(CMtProgress *p, SRes res) +{ + CriticalSection_Enter(&p->cs); + if (p->res == SZ_OK) + p->res = res; + CriticalSection_Leave(&p->cs); +} + +static void MtCoder_SetError(CMtCoder* p, SRes res) +{ + CriticalSection_Enter(&p->cs); + if (p->res == SZ_OK) + p->res = res; + CriticalSection_Leave(&p->cs); +} + +/* ---------- MtThread ---------- */ + +void CMtThread_Construct(CMtThread *p, CMtCoder *mtCoder) +{ + p->mtCoder = mtCoder; + p->outBuf = 0; + p->inBuf = 0; + Event_Construct(&p->canRead); + Event_Construct(&p->canWrite); + LoopThread_Construct(&p->thread); +} + +#define RINOK_THREAD(x) { if((x) != 0) return SZ_ERROR_THREAD; } + +static void CMtThread_CloseEvents(CMtThread *p) +{ + Event_Close(&p->canRead); + Event_Close(&p->canWrite); +} + +static void CMtThread_Destruct(CMtThread *p) +{ + CMtThread_CloseEvents(p); + + if (Thread_WasCreated(&p->thread.thread)) + { + LoopThread_StopAndWait(&p->thread); + LoopThread_Close(&p->thread); + } + + if (p->mtCoder->alloc) + IAlloc_Free(p->mtCoder->alloc, p->outBuf); + p->outBuf = 0; + + if (p->mtCoder->alloc) + IAlloc_Free(p->mtCoder->alloc, p->inBuf); + p->inBuf = 0; +} + +#define MY_BUF_ALLOC(buf, size, newSize) \ + if (buf == 0 || size != newSize) \ + { IAlloc_Free(p->mtCoder->alloc, buf); \ + size = newSize; buf = (Byte *)IAlloc_Alloc(p->mtCoder->alloc, size); \ + if (buf == 0) return SZ_ERROR_MEM; } + +static SRes CMtThread_Prepare(CMtThread *p) +{ + MY_BUF_ALLOC(p->inBuf, p->inBufSize, p->mtCoder->blockSize) + MY_BUF_ALLOC(p->outBuf, p->outBufSize, p->mtCoder->destBlockSize) + + p->stopReading = False; + p->stopWriting = False; + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canRead)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canWrite)); + + return SZ_OK; +} + +static SRes FullRead(ISeqInStream *stream, Byte *data, size_t *processedSize) +{ + size_t size = *processedSize; + *processedSize = 0; + while (size != 0) + { + size_t curSize = size; + SRes res = stream->Read(stream, data, &curSize); + *processedSize += curSize; + data += curSize; + size -= curSize; + RINOK(res); + if (curSize == 0) + return SZ_OK; + } + return SZ_OK; +} + +#define GET_NEXT_THREAD(p) &p->mtCoder->threads[p->index == p->mtCoder->numThreads - 1 ? 0 : p->index + 1] + +static SRes MtThread_Process(CMtThread *p, Bool *stop) +{ + CMtThread *next; + *stop = True; + if (Event_Wait(&p->canRead) != 0) + return SZ_ERROR_THREAD; + + next = GET_NEXT_THREAD(p); + + if (p->stopReading) + { + next->stopReading = True; + return Event_Set(&next->canRead) == 0 ? SZ_OK : SZ_ERROR_THREAD; + } + + { + size_t size = p->mtCoder->blockSize; + size_t destSize = p->outBufSize; + + RINOK(FullRead(p->mtCoder->inStream, p->inBuf, &size)); + next->stopReading = *stop = (size != p->mtCoder->blockSize); + if (Event_Set(&next->canRead) != 0) + return SZ_ERROR_THREAD; + + RINOK(p->mtCoder->mtCallback->Code(p->mtCoder->mtCallback, p->index, + p->outBuf, &destSize, p->inBuf, size, *stop)); + + MtProgress_Reinit(&p->mtCoder->mtProgress, p->index); + + if (Event_Wait(&p->canWrite) != 0) + return SZ_ERROR_THREAD; + if (p->stopWriting) + return SZ_ERROR_FAIL; + if (p->mtCoder->outStream->Write(p->mtCoder->outStream, p->outBuf, destSize) != destSize) + return SZ_ERROR_WRITE; + return Event_Set(&next->canWrite) == 0 ? SZ_OK : SZ_ERROR_THREAD; + } +} + +static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE ThreadFunc(void *pp) +{ + CMtThread *p = (CMtThread *)pp; + for (;;) + { + Bool stop; + CMtThread *next = GET_NEXT_THREAD(p); + SRes res = MtThread_Process(p, &stop); + if (res != SZ_OK) + { + MtCoder_SetError(p->mtCoder, res); + MtProgress_SetError(&p->mtCoder->mtProgress, res); + next->stopReading = True; + next->stopWriting = True; + Event_Set(&next->canRead); + Event_Set(&next->canWrite); + return res; + } + if (stop) + return 0; + } +} + +void MtCoder_Construct(CMtCoder* p) +{ + unsigned i; + p->alloc = 0; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + { + CMtThread *t = &p->threads[i]; + t->index = i; + CMtThread_Construct(t, p); + } + CriticalSection_Init(&p->cs); + CriticalSection_Init(&p->mtProgress.cs); +} + +void MtCoder_Destruct(CMtCoder* p) +{ + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + CMtThread_Destruct(&p->threads[i]); + CriticalSection_Delete(&p->cs); + CriticalSection_Delete(&p->mtProgress.cs); +} + +SRes MtCoder_Code(CMtCoder *p) +{ + unsigned i, numThreads = p->numThreads; + SRes res = SZ_OK; + p->res = SZ_OK; + + MtProgress_Init(&p->mtProgress, p->progress); + + for (i = 0; i < numThreads; i++) + { + RINOK(CMtThread_Prepare(&p->threads[i])); + } + + for (i = 0; i < numThreads; i++) + { + CMtThread *t = &p->threads[i]; + CLoopThread *lt = &t->thread; + + if (!Thread_WasCreated(<->thread)) + { + lt->func = ThreadFunc; + lt->param = t; + + if (LoopThread_Create(lt) != SZ_OK) + { + res = SZ_ERROR_THREAD; + break; + } + } + } + + if (res == SZ_OK) + { + unsigned j; + for (i = 0; i < numThreads; i++) + { + CMtThread *t = &p->threads[i]; + if (LoopThread_StartSubThread(&t->thread) != SZ_OK) + { + res = SZ_ERROR_THREAD; + p->threads[0].stopReading = True; + break; + } + } + + Event_Set(&p->threads[0].canWrite); + Event_Set(&p->threads[0].canRead); + + for (j = 0; j < i; j++) + LoopThread_WaitSubThread(&p->threads[j].thread); + } + + for (i = 0; i < numThreads; i++) + CMtThread_CloseEvents(&p->threads[i]); + return (res == SZ_OK) ? p->res : res; +} diff --git a/src/ZipLib/extlibs/lzma/MtCoder.h b/src/ZipLib/extlibs/lzma/MtCoder.h new file mode 100644 index 00000000..f0f06da2 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/MtCoder.h @@ -0,0 +1,98 @@ +/* MtCoder.h -- Multi-thread Coder +2009-11-19 : Igor Pavlov : Public domain */ + +#ifndef __MT_CODER_H +#define __MT_CODER_H + +#include "Threads.h" + +EXTERN_C_BEGIN + +typedef struct +{ + CThread thread; + CAutoResetEvent startEvent; + CAutoResetEvent finishedEvent; + int stop; + + THREAD_FUNC_TYPE func; + LPVOID param; + THREAD_FUNC_RET_TYPE res; +} CLoopThread; + +void LoopThread_Construct(CLoopThread *p); +void LoopThread_Close(CLoopThread *p); +WRes LoopThread_Create(CLoopThread *p); +WRes LoopThread_StopAndWait(CLoopThread *p); +WRes LoopThread_StartSubThread(CLoopThread *p); +WRes LoopThread_WaitSubThread(CLoopThread *p); + +#ifndef _7ZIP_ST +#define NUM_MT_CODER_THREADS_MAX 32 +#else +#define NUM_MT_CODER_THREADS_MAX 1 +#endif + +typedef struct +{ + UInt64 totalInSize; + UInt64 totalOutSize; + ICompressProgress *progress; + SRes res; + CCriticalSection cs; + UInt64 inSizes[NUM_MT_CODER_THREADS_MAX]; + UInt64 outSizes[NUM_MT_CODER_THREADS_MAX]; +} CMtProgress; + +SRes MtProgress_Set(CMtProgress *p, unsigned index, UInt64 inSize, UInt64 outSize); + +struct _CMtCoder; + +typedef struct +{ + struct _CMtCoder *mtCoder; + Byte *outBuf; + size_t outBufSize; + Byte *inBuf; + size_t inBufSize; + unsigned index; + CLoopThread thread; + + Bool stopReading; + Bool stopWriting; + CAutoResetEvent canRead; + CAutoResetEvent canWrite; +} CMtThread; + +typedef struct +{ + SRes (*Code)(void *p, unsigned index, Byte *dest, size_t *destSize, + const Byte *src, size_t srcSize, int finished); +} IMtCoderCallback; + +typedef struct _CMtCoder +{ + size_t blockSize; + size_t destBlockSize; + unsigned numThreads; + + ISeqInStream *inStream; + ISeqOutStream *outStream; + ICompressProgress *progress; + ISzAlloc *alloc; + + IMtCoderCallback *mtCallback; + CCriticalSection cs; + SRes res; + + CMtProgress mtProgress; + CMtThread threads[NUM_MT_CODER_THREADS_MAX]; +} CMtCoder; + +void MtCoder_Construct(CMtCoder* p); +void MtCoder_Destruct(CMtCoder* p); +SRes MtCoder_Code(CMtCoder *p); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Ppmd.h b/src/ZipLib/extlibs/lzma/Ppmd.h new file mode 100644 index 00000000..9cbc4664 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Ppmd.h @@ -0,0 +1,86 @@ +/* Ppmd.h -- PPMD codec common code +2011-01-27 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#ifndef __PPMD_H +#define __PPMD_H + +#include "Types.h" +#include "CpuArch.h" + +EXTERN_C_BEGIN + +#ifdef MY_CPU_32BIT + #define PPMD_32BIT +#endif + +#define PPMD_INT_BITS 7 +#define PPMD_PERIOD_BITS 7 +#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS)) + +#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift)) +#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2) +#define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob)) +#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob)) + +#define PPMD_N1 4 +#define PPMD_N2 4 +#define PPMD_N3 4 +#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4) +#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4) + +#pragma pack(push, 1) +/* Most compilers works OK here even without #pragma pack(push, 1), but some GCC compilers need it. */ + +/* SEE-contexts for PPM-contexts with masked symbols */ +typedef struct +{ + UInt16 Summ; /* Freq */ + Byte Shift; /* Speed of Freq change; low Shift is for fast change */ + Byte Count; /* Count to next change of Shift */ +} CPpmd_See; + +#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \ + { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); } + +typedef struct +{ + Byte Symbol; + Byte Freq; + UInt16 SuccessorLow; + UInt16 SuccessorHigh; +} CPpmd_State; + +#pragma pack(pop) + +typedef + #ifdef PPMD_32BIT + CPpmd_State * + #else + UInt32 + #endif + CPpmd_State_Ref; + +typedef + #ifdef PPMD_32BIT + void * + #else + UInt32 + #endif + CPpmd_Void_Ref; + +typedef + #ifdef PPMD_32BIT + Byte * + #else + UInt32 + #endif + CPpmd_Byte_Ref; + +#define PPMD_SetAllBitsIn256Bytes(p) \ + { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \ + p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }} + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Ppmd7.c b/src/ZipLib/extlibs/lzma/Ppmd7.c new file mode 100644 index 00000000..060d86d2 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Ppmd7.c @@ -0,0 +1,708 @@ +/* Ppmd7.c -- PPMdH codec +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include + +#include "Ppmd7.h" + +const Byte PPMD7_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 }; +static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051}; + +#define MAX_FREQ 124 +#define UNIT_SIZE 12 + +#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE) +#define U2I(nu) (p->Units2Indx[(nu) - 1]) +#define I2U(indx) (p->Indx2Units[indx]) + +#ifdef PPMD_32BIT + #define REF(ptr) (ptr) +#else + #define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base)) +#endif + +#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr)) + +#define CTX(ref) ((CPpmd7_Context *)Ppmd7_GetContext(p, ref)) +#define STATS(ctx) Ppmd7_GetStats(p, ctx) +#define ONE_STATE(ctx) Ppmd7Context_OneState(ctx) +#define SUFFIX(ctx) CTX((ctx)->Suffix) + +typedef CPpmd7_Context * CTX_PTR; + +struct CPpmd7_Node_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd7_Node_ * + #else + UInt32 + #endif + CPpmd7_Node_Ref; + +typedef struct CPpmd7_Node_ +{ + UInt16 Stamp; /* must be at offset 0 as CPpmd7_Context::NumStats. Stamp=0 means free */ + UInt16 NU; + CPpmd7_Node_Ref Next; /* must be at offset >= 4 */ + CPpmd7_Node_Ref Prev; +} CPpmd7_Node; + +#ifdef PPMD_32BIT + #define NODE(ptr) (ptr) +#else + #define NODE(offs) ((CPpmd7_Node *)(p->Base + (offs))) +#endif + +void Ppmd7_Construct(CPpmd7 *p) +{ + unsigned i, k, m; + + p->Base = 0; + + for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) + { + unsigned step = (i >= 12 ? 4 : (i >> 2) + 1); + do { p->Units2Indx[k++] = (Byte)i; } while(--step); + p->Indx2Units[i] = (Byte)k; + } + + p->NS2BSIndx[0] = (0 << 1); + p->NS2BSIndx[1] = (1 << 1); + memset(p->NS2BSIndx + 2, (2 << 1), 9); + memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); + + for (i = 0; i < 3; i++) + p->NS2Indx[i] = (Byte)i; + for (m = i, k = 1; i < 256; i++) + { + p->NS2Indx[i] = (Byte)m; + if (--k == 0) + k = (++m) - 2; + } + + memset(p->HB2Flag, 0, 0x40); + memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); +} + +void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->Base); + p->Size = 0; + p->Base = 0; +} + +Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +{ + if (p->Base == 0 || p->Size != size) + { + Ppmd7_Free(p, alloc); + p->AlignOffset = + #ifdef PPMD_32BIT + (4 - size) & 3; + #else + 4 - (size & 3); + #endif + if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + #ifndef PPMD_32BIT + + UNIT_SIZE + #endif + )) == 0) + return False; + p->Size = size; + } + return True; +} + +static void InsertNode(CPpmd7 *p, void *node, unsigned indx) +{ + *((CPpmd_Void_Ref *)node) = p->FreeList[indx]; + p->FreeList[indx] = REF(node); +} + +static void *RemoveNode(CPpmd7 *p, unsigned indx) +{ + CPpmd_Void_Ref *node = (CPpmd_Void_Ref *)Ppmd7_GetPtr(p, p->FreeList[indx]); + p->FreeList[indx] = *node; + return node; +} + +static void SplitBlock(CPpmd7 *p, void *ptr, unsigned oldIndx, unsigned newIndx) +{ + unsigned i, nu = I2U(oldIndx) - I2U(newIndx); + ptr = (Byte *)ptr + U2B(I2U(newIndx)); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1); + } + InsertNode(p, ptr, i); +} + +static void GlueFreeBlocks(CPpmd7 *p) +{ + #ifdef PPMD_32BIT + CPpmd7_Node headItem; + CPpmd7_Node_Ref head = &headItem; + #else + CPpmd7_Node_Ref head = p->AlignOffset + p->Size; + #endif + + CPpmd7_Node_Ref n = head; + unsigned i; + + p->GlueCount = 255; + + /* create doubly-linked list of free blocks */ + for (i = 0; i < PPMD_NUM_INDEXES; i++) + { + UInt16 nu = I2U(i); + CPpmd7_Node_Ref next = (CPpmd7_Node_Ref)p->FreeList[i]; + p->FreeList[i] = 0; + while (next != 0) + { + CPpmd7_Node *node = NODE(next); + node->Next = n; + n = NODE(n)->Prev = next; + next = *(const CPpmd7_Node_Ref *)node; + node->Stamp = 0; + node->NU = (UInt16)nu; + } + } + NODE(head)->Stamp = 1; + NODE(head)->Next = n; + NODE(n)->Prev = head; + if (p->LoUnit != p->HiUnit) + ((CPpmd7_Node *)p->LoUnit)->Stamp = 1; + + /* Glue free blocks */ + while (n != head) + { + CPpmd7_Node *node = NODE(n); + UInt32 nu = (UInt32)node->NU; + for (;;) + { + CPpmd7_Node *node2 = NODE(n) + nu; + nu += node2->NU; + if (node2->Stamp != 0 || nu >= 0x10000) + break; + NODE(node2->Prev)->Next = node2->Next; + NODE(node2->Next)->Prev = node2->Prev; + node->NU = (UInt16)nu; + } + n = node->Next; + } + + /* Fill lists of free blocks */ + for (n = NODE(head)->Next; n != head;) + { + CPpmd7_Node *node = NODE(n); + unsigned nu; + CPpmd7_Node_Ref next = node->Next; + for (nu = node->NU; nu > 128; nu -= 128, node += 128) + InsertNode(p, node, PPMD_NUM_INDEXES - 1); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, node + k, nu - k - 1); + } + InsertNode(p, node, i); + n = next; + } +} + +static void *AllocUnitsRare(CPpmd7 *p, unsigned indx) +{ + unsigned i; + void *retVal; + if (p->GlueCount == 0) + { + GlueFreeBlocks(p); + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + } + i = indx; + do + { + if (++i == PPMD_NUM_INDEXES) + { + UInt32 numBytes = U2B(I2U(indx)); + p->GlueCount--; + return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL); + } + } + while (p->FreeList[i] == 0); + retVal = RemoveNode(p, i); + SplitBlock(p, retVal, i, indx); + return retVal; +} + +static void *AllocUnits(CPpmd7 *p, unsigned indx) +{ + UInt32 numBytes; + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + numBytes = U2B(I2U(indx)); + if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit)) + { + void *retVal = p->LoUnit; + p->LoUnit += numBytes; + return retVal; + } + return AllocUnitsRare(p, indx); +} + +#define MyMem12Cpy(dest, src, num) \ + { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \ + do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); } + +static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU) +{ + unsigned i0 = U2I(oldNU); + unsigned i1 = U2I(newNU); + if (i0 == i1) + return oldPtr; + if (p->FreeList[i1] != 0) + { + void *ptr = RemoveNode(p, i1); + MyMem12Cpy(ptr, oldPtr, newNU); + InsertNode(p, oldPtr, i0); + return ptr; + } + SplitBlock(p, oldPtr, i0, i1); + return oldPtr; +} + +#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16))) + +static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v) +{ + (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF); + (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF); +} + +static void RestartModel(CPpmd7 *p) +{ + unsigned i, k, m; + + memset(p->FreeList, 0, sizeof(p->FreeList)); + p->Text = p->Base + p->AlignOffset; + p->HiUnit = p->Text + p->Size; + p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE; + p->GlueCount = 0; + + p->OrderFall = p->MaxOrder; + p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1; + p->PrevSuccess = 0; + + p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */ + p->MinContext->Suffix = 0; + p->MinContext->NumStats = 256; + p->MinContext->SummFreq = 256 + 1; + p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */ + p->LoUnit += U2B(256 / 2); + p->MinContext->Stats = REF(p->FoundState); + for (i = 0; i < 256; i++) + { + CPpmd_State *s = &p->FoundState[i]; + s->Symbol = (Byte)i; + s->Freq = 1; + SetSuccessor(s, 0); + } + + for (i = 0; i < 128; i++) + for (k = 0; k < 8; k++) + { + UInt16 *dest = p->BinSumm[i] + k; + UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 2)); + for (m = 0; m < 64; m += 8) + dest[m] = val; + } + + for (i = 0; i < 25; i++) + for (k = 0; k < 16; k++) + { + CPpmd_See *s = &p->See[i][k]; + s->Summ = (UInt16)((5 * i + 10) << (s->Shift = PPMD_PERIOD_BITS - 4)); + s->Count = 4; + } +} + +void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder) +{ + p->MaxOrder = maxOrder; + RestartModel(p); + p->DummySee.Shift = PPMD_PERIOD_BITS; + p->DummySee.Summ = 0; /* unused */ + p->DummySee.Count = 64; /* unused */ +} + +static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip) +{ + CPpmd_State upState; + CTX_PTR c = p->MinContext; + CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); + CPpmd_State *ps[PPMD7_MAX_ORDER]; + unsigned numPs = 0; + + if (!skip) + ps[numPs++] = p->FoundState; + + while (c->Suffix) + { + CPpmd_Void_Ref successor; + CPpmd_State *s; + c = SUFFIX(c); + if (c->NumStats != 1) + { + for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); + } + else + s = ONE_STATE(c); + successor = SUCCESSOR(s); + if (successor != upBranch) + { + c = CTX(successor); + if (numPs == 0) + return c; + break; + } + ps[numPs++] = s; + } + + upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch); + SetSuccessor(&upState, upBranch + 1); + + if (c->NumStats == 1) + upState.Freq = ONE_STATE(c)->Freq; + else + { + UInt32 cf, s0; + CPpmd_State *s; + for (s = STATS(c); s->Symbol != upState.Symbol; s++); + cf = s->Freq - 1; + s0 = c->SummFreq - c->NumStats - cf; + upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0)))); + } + + do + { + /* Create Child */ + CTX_PTR c1; /* = AllocContext(p); */ + if (p->HiUnit != p->LoUnit) + c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); + else if (p->FreeList[0] != 0) + c1 = (CTX_PTR)RemoveNode(p, 0); + else + { + c1 = (CTX_PTR)AllocUnitsRare(p, 0); + if (!c1) + return NULL; + } + c1->NumStats = 1; + *ONE_STATE(c1) = upState; + c1->Suffix = REF(c); + SetSuccessor(ps[--numPs], REF(c1)); + c = c1; + } + while (numPs != 0); + + return c; +} + +static void SwapStates(CPpmd_State *t1, CPpmd_State *t2) +{ + CPpmd_State tmp = *t1; + *t1 = *t2; + *t2 = tmp; +} + +static void UpdateModel(CPpmd7 *p) +{ + CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState); + CTX_PTR c; + unsigned s0, ns; + + if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0) + { + c = SUFFIX(p->MinContext); + + if (c->NumStats == 1) + { + CPpmd_State *s = ONE_STATE(c); + if (s->Freq < 32) + s->Freq++; + } + else + { + CPpmd_State *s = STATS(c); + if (s->Symbol != p->FoundState->Symbol) + { + do { s++; } while (s->Symbol != p->FoundState->Symbol); + if (s[0].Freq >= s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + s--; + } + } + if (s->Freq < MAX_FREQ - 9) + { + s->Freq += 2; + c->SummFreq += 2; + } + } + } + + if (p->OrderFall == 0) + { + p->MinContext = p->MaxContext = CreateSuccessors(p, True); + if (p->MinContext == 0) + { + RestartModel(p); + return; + } + SetSuccessor(p->FoundState, REF(p->MinContext)); + return; + } + + *p->Text++ = p->FoundState->Symbol; + successor = REF(p->Text); + if (p->Text >= p->UnitsStart) + { + RestartModel(p); + return; + } + + if (fSuccessor) + { + if (fSuccessor <= successor) + { + CTX_PTR cs = CreateSuccessors(p, False); + if (cs == NULL) + { + RestartModel(p); + return; + } + fSuccessor = REF(cs); + } + if (--p->OrderFall == 0) + { + successor = fSuccessor; + p->Text -= (p->MaxContext != p->MinContext); + } + } + else + { + SetSuccessor(p->FoundState, successor); + fSuccessor = REF(p->MinContext); + } + + s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - (p->FoundState->Freq - 1); + + for (c = p->MaxContext; c != p->MinContext; c = SUFFIX(c)) + { + unsigned ns1; + UInt32 cf, sf; + if ((ns1 = c->NumStats) != 1) + { + if ((ns1 & 1) == 0) + { + /* Expand for one UNIT */ + unsigned oldNU = ns1 >> 1; + unsigned i = U2I(oldNU); + if (i != U2I(oldNU + 1)) + { + void *ptr = AllocUnits(p, i + 1); + void *oldPtr; + if (!ptr) + { + RestartModel(p); + return; + } + oldPtr = STATS(c); + MyMem12Cpy(ptr, oldPtr, oldNU); + InsertNode(p, oldPtr, i); + c->Stats = STATS_REF(ptr); + } + } + c->SummFreq = (UInt16)(c->SummFreq + (2 * ns1 < ns) + 2 * ((4 * ns1 <= ns) & (c->SummFreq <= 8 * ns1))); + } + else + { + CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0); + if (!s) + { + RestartModel(p); + return; + } + *s = *ONE_STATE(c); + c->Stats = REF(s); + if (s->Freq < MAX_FREQ / 4 - 1) + s->Freq <<= 1; + else + s->Freq = MAX_FREQ - 4; + c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 3)); + } + cf = 2 * (UInt32)p->FoundState->Freq * (c->SummFreq + 6); + sf = (UInt32)s0 + c->SummFreq; + if (cf < 6 * sf) + { + cf = 1 + (cf > sf) + (cf >= 4 * sf); + c->SummFreq += 3; + } + else + { + cf = 4 + (cf >= 9 * sf) + (cf >= 12 * sf) + (cf >= 15 * sf); + c->SummFreq = (UInt16)(c->SummFreq + cf); + } + { + CPpmd_State *s = STATS(c) + ns1; + SetSuccessor(s, successor); + s->Symbol = p->FoundState->Symbol; + s->Freq = (Byte)cf; + c->NumStats = (UInt16)(ns1 + 1); + } + } + p->MaxContext = p->MinContext = CTX(fSuccessor); +} + +static void Rescale(CPpmd7 *p) +{ + unsigned i, adder, sumFreq, escFreq; + CPpmd_State *stats = STATS(p->MinContext); + CPpmd_State *s = p->FoundState; + { + CPpmd_State tmp = *s; + for (; s != stats; s--) + s[0] = s[-1]; + *s = tmp; + } + escFreq = p->MinContext->SummFreq - s->Freq; + s->Freq += 4; + adder = (p->OrderFall != 0); + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq = s->Freq; + + i = p->MinContext->NumStats - 1; + do + { + escFreq -= (++s)->Freq; + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq += s->Freq; + if (s[0].Freq > s[-1].Freq) + { + CPpmd_State *s1 = s; + CPpmd_State tmp = *s1; + do + s1[0] = s1[-1]; + while (--s1 != stats && tmp.Freq > s1[-1].Freq); + *s1 = tmp; + } + } + while (--i); + + if (s->Freq == 0) + { + unsigned numStats = p->MinContext->NumStats; + unsigned n0, n1; + do { i++; } while ((--s)->Freq == 0); + escFreq += i; + p->MinContext->NumStats = (UInt16)(p->MinContext->NumStats - i); + if (p->MinContext->NumStats == 1) + { + CPpmd_State tmp = *stats; + do + { + tmp.Freq = (Byte)(tmp.Freq - (tmp.Freq >> 1)); + escFreq >>= 1; + } + while (escFreq > 1); + InsertNode(p, stats, U2I(((numStats + 1) >> 1))); + *(p->FoundState = ONE_STATE(p->MinContext)) = tmp; + return; + } + n0 = (numStats + 1) >> 1; + n1 = (p->MinContext->NumStats + 1) >> 1; + if (n0 != n1) + p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1)); + } + p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1)); + p->FoundState = STATS(p->MinContext); +} + +CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *escFreq) +{ + CPpmd_See *see; + unsigned nonMasked = p->MinContext->NumStats - numMasked; + if (p->MinContext->NumStats != 256) + { + see = p->See[p->NS2Indx[nonMasked - 1]] + + (nonMasked < (unsigned)SUFFIX(p->MinContext)->NumStats - p->MinContext->NumStats) + + 2 * (p->MinContext->SummFreq < 11 * p->MinContext->NumStats) + + 4 * (numMasked > nonMasked) + + p->HiBitsFlag; + { + unsigned r = (see->Summ >> see->Shift); + see->Summ = (UInt16)(see->Summ - r); + *escFreq = r + (r == 0); + } + } + else + { + see = &p->DummySee; + *escFreq = 1; + } + return see; +} + +static void NextContext(CPpmd7 *p) +{ + CTX_PTR c = CTX(SUCCESSOR(p->FoundState)); + if (p->OrderFall == 0 && (Byte *)c > p->Text) + p->MinContext = p->MaxContext = c; + else + UpdateModel(p); +} + +void Ppmd7_Update1(CPpmd7 *p) +{ + CPpmd_State *s = p->FoundState; + s->Freq += 4; + p->MinContext->SummFreq += 4; + if (s[0].Freq > s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + p->FoundState = --s; + if (s->Freq > MAX_FREQ) + Rescale(p); + } + NextContext(p); +} + +void Ppmd7_Update1_0(CPpmd7 *p) +{ + p->PrevSuccess = (2 * p->FoundState->Freq > p->MinContext->SummFreq); + p->RunLength += p->PrevSuccess; + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + NextContext(p); +} + +void Ppmd7_UpdateBin(CPpmd7 *p) +{ + p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 128 ? 1: 0)); + p->PrevSuccess = 1; + p->RunLength++; + NextContext(p); +} + +void Ppmd7_Update2(CPpmd7 *p) +{ + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + p->RunLength = p->InitRL; + UpdateModel(p); +} diff --git a/src/ZipLib/extlibs/lzma/Ppmd7.h b/src/ZipLib/extlibs/lzma/Ppmd7.h new file mode 100644 index 00000000..96521c31 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Ppmd7.h @@ -0,0 +1,140 @@ +/* Ppmd7.h -- PPMdH compression codec +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +/* This code supports virtual RangeDecoder and includes the implementation +of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H. +If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */ + +#ifndef __PPMD7_H +#define __PPMD7_H + +#include "Ppmd.h" + +EXTERN_C_BEGIN + +#define PPMD7_MIN_ORDER 2 +#define PPMD7_MAX_ORDER 64 + +#define PPMD7_MIN_MEM_SIZE (1 << 11) +#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) + +struct CPpmd7_Context_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd7_Context_ * + #else + UInt32 + #endif + CPpmd7_Context_Ref; + +typedef struct CPpmd7_Context_ +{ + UInt16 NumStats; + UInt16 SummFreq; + CPpmd_State_Ref Stats; + CPpmd7_Context_Ref Suffix; +} CPpmd7_Context; + +#define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) + +typedef struct +{ + CPpmd7_Context *MinContext, *MaxContext; + CPpmd_State *FoundState; + unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag; + Int32 RunLength, InitRL; /* must be 32-bit at least */ + + UInt32 Size; + UInt32 GlueCount; + Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; + UInt32 AlignOffset; + + Byte Indx2Units[PPMD_NUM_INDEXES]; + Byte Units2Indx[128]; + CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; + Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256]; + CPpmd_See DummySee, See[25][16]; + UInt16 BinSumm[128][64]; +} CPpmd7; + +void Ppmd7_Construct(CPpmd7 *p); +Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); +void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc); +void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder); +#define Ppmd7_WasAllocated(p) ((p)->Base != NULL) + + +/* ---------- Internal Functions ---------- */ + +extern const Byte PPMD7_kExpEscape[16]; + +#ifdef PPMD_32BIT + #define Ppmd7_GetPtr(p, ptr) (ptr) + #define Ppmd7_GetContext(p, ptr) (ptr) + #define Ppmd7_GetStats(p, ctx) ((ctx)->Stats) +#else + #define Ppmd7_GetPtr(p, offs) ((void *)((p)->Base + (offs))) + #define Ppmd7_GetContext(p, offs) ((CPpmd7_Context *)Ppmd7_GetPtr((p), (offs))) + #define Ppmd7_GetStats(p, ctx) ((CPpmd_State *)Ppmd7_GetPtr((p), ((ctx)->Stats))) +#endif + +void Ppmd7_Update1(CPpmd7 *p); +void Ppmd7_Update1_0(CPpmd7 *p); +void Ppmd7_Update2(CPpmd7 *p); +void Ppmd7_UpdateBin(CPpmd7 *p); + +#define Ppmd7_GetBinSumm(p) \ + &p->BinSumm[Ppmd7Context_OneState(p->MinContext)->Freq - 1][p->PrevSuccess + \ + p->NS2BSIndx[Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] + \ + (p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]) + \ + 2 * p->HB2Flag[Ppmd7Context_OneState(p->MinContext)->Symbol] + \ + ((p->RunLength >> 26) & 0x20)] + +CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale); + + +/* ---------- Decode ---------- */ + +typedef struct +{ + UInt32 (*GetThreshold)(void *p, UInt32 total); + void (*Decode)(void *p, UInt32 start, UInt32 size); + UInt32 (*DecodeBit)(void *p, UInt32 size0); +} IPpmd7_RangeDec; + +typedef struct +{ + IPpmd7_RangeDec p; + UInt32 Range; + UInt32 Code; + IByteIn *Stream; +} CPpmd7z_RangeDec; + +void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p); +Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p); +#define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0) + +int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc); + + +/* ---------- Encode ---------- */ + +typedef struct +{ + UInt64 Low; + UInt32 Range; + Byte Cache; + UInt64 CacheSize; + IByteOut *Stream; +} CPpmd7z_RangeEnc; + +void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p); +void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p); + +void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Ppmd7Dec.c b/src/ZipLib/extlibs/lzma/Ppmd7Dec.c new file mode 100644 index 00000000..68438d5c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Ppmd7Dec.c @@ -0,0 +1,187 @@ +/* Ppmd7Dec.c -- PPMdH Decoder +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include "Ppmd7.h" + +#define kTopValue (1 << 24) + +Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p) +{ + unsigned i; + p->Code = 0; + p->Range = 0xFFFFFFFF; + if (p->Stream->Read((void *)p->Stream) != 0) + return False; + for (i = 0; i < 4; i++) + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + return (p->Code < 0xFFFFFFFF); +} + +static UInt32 Range_GetThreshold(void *pp, UInt32 total) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + return (p->Code) / (p->Range /= total); +} + +static void Range_Normalize(CPpmd7z_RangeDec *p) +{ + if (p->Range < kTopValue) + { + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + p->Range <<= 8; + if (p->Range < kTopValue) + { + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + p->Range <<= 8; + } + } +} + +static void Range_Decode(void *pp, UInt32 start, UInt32 size) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + p->Code -= start * p->Range; + p->Range *= size; + Range_Normalize(p); +} + +static UInt32 Range_DecodeBit(void *pp, UInt32 size0) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + UInt32 newBound = (p->Range >> 14) * size0; + UInt32 symbol; + if (p->Code < newBound) + { + symbol = 0; + p->Range = newBound; + } + else + { + symbol = 1; + p->Code -= newBound; + p->Range -= newBound; + } + Range_Normalize(p); + return symbol; +} + +void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p) +{ + p->p.GetThreshold = Range_GetThreshold; + p->p.Decode = Range_Decode; + p->p.DecodeBit = Range_DecodeBit; +} + + +#define MASK(sym) ((signed char *)charMask)[sym] + +int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 1) + { + CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext); + unsigned i; + UInt32 count, hiCnt; + if ((count = rc->GetThreshold(rc, p->MinContext->SummFreq)) < (hiCnt = s->Freq)) + { + Byte symbol; + rc->Decode(rc, 0, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update1_0(p); + return symbol; + } + p->PrevSuccess = 0; + i = p->MinContext->NumStats - 1; + do + { + if ((hiCnt += (++s)->Freq) > count) + { + Byte symbol; + rc->Decode(rc, hiCnt - s->Freq, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update1(p); + return symbol; + } + } + while (--i); + if (count >= p->MinContext->SummFreq) + return -2; + p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]; + rc->Decode(rc, hiCnt, p->MinContext->SummFreq - hiCnt); + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats - 1; + do { MASK((--s)->Symbol) = 0; } while (--i); + } + else + { + UInt16 *prob = Ppmd7_GetBinSumm(p); + if (rc->DecodeBit(rc, *prob) == 0) + { + Byte symbol; + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + symbol = (p->FoundState = Ppmd7Context_OneState(p->MinContext))->Symbol; + Ppmd7_UpdateBin(p); + return symbol; + } + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD7_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(Ppmd7Context_OneState(p->MinContext)->Symbol) = 0; + p->PrevSuccess = 0; + } + for (;;) + { + CPpmd_State *ps[256], *s; + UInt32 freqSum, count, hiCnt; + CPpmd_See *see; + unsigned i, num, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return -1; + p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + hiCnt = 0; + s = Ppmd7_GetStats(p, p->MinContext); + i = 0; + num = p->MinContext->NumStats - numMasked; + do + { + int k = (int)(MASK(s->Symbol)); + hiCnt += (s->Freq & k); + ps[i] = s++; + i -= k; + } + while (i != num); + + see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum); + freqSum += hiCnt; + count = rc->GetThreshold(rc, freqSum); + + if (count < hiCnt) + { + Byte symbol; + CPpmd_State **pps = ps; + for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++); + s = *pps; + rc->Decode(rc, hiCnt - s->Freq, s->Freq); + Ppmd_See_Update(see); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update2(p); + return symbol; + } + if (count >= freqSum) + return -2; + rc->Decode(rc, hiCnt, freqSum - hiCnt); + see->Summ = (UInt16)(see->Summ + freqSum); + do { MASK(ps[--i]->Symbol) = 0; } while (i != 0); + } +} diff --git a/src/ZipLib/extlibs/lzma/Ppmd7Enc.c b/src/ZipLib/extlibs/lzma/Ppmd7Enc.c new file mode 100644 index 00000000..8247757d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Ppmd7Enc.c @@ -0,0 +1,185 @@ +/* Ppmd7Enc.c -- PPMdH Encoder +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include "Ppmd7.h" + +#define kTopValue (1 << 24) + +void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p) +{ + p->Low = 0; + p->Range = 0xFFFFFFFF; + p->Cache = 0; + p->CacheSize = 1; +} + +static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p) +{ + if ((UInt32)p->Low < (UInt32)0xFF000000 || (unsigned)(p->Low >> 32) != 0) + { + Byte temp = p->Cache; + do + { + p->Stream->Write(p->Stream, (Byte)(temp + (Byte)(p->Low >> 32))); + temp = 0xFF; + } + while(--p->CacheSize != 0); + p->Cache = (Byte)((UInt32)p->Low >> 24); + } + p->CacheSize++; + p->Low = (UInt32)p->Low << 8; +} + +static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total) +{ + p->Low += start * (p->Range /= total); + p->Range *= size; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void RangeEnc_EncodeBit_0(CPpmd7z_RangeEnc *p, UInt32 size0) +{ + p->Range = (p->Range >> 14) * size0; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void RangeEnc_EncodeBit_1(CPpmd7z_RangeEnc *p, UInt32 size0) +{ + UInt32 newBound = (p->Range >> 14) * size0; + p->Low += newBound; + p->Range -= newBound; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p) +{ + unsigned i; + for (i = 0; i < 5; i++) + RangeEnc_ShiftLow(p); +} + + +#define MASK(sym) ((signed char *)charMask)[sym] + +void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 1) + { + CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext); + UInt32 sum; + unsigned i; + if (s->Symbol == symbol) + { + RangeEnc_Encode(rc, 0, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd7_Update1_0(p); + return; + } + p->PrevSuccess = 0; + sum = s->Freq; + i = p->MinContext->NumStats - 1; + do + { + if ((++s)->Symbol == symbol) + { + RangeEnc_Encode(rc, sum, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd7_Update1(p); + return; + } + sum += s->Freq; + } + while (--i); + + p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats - 1; + do { MASK((--s)->Symbol) = 0; } while (--i); + RangeEnc_Encode(rc, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq); + } + else + { + UInt16 *prob = Ppmd7_GetBinSumm(p); + CPpmd_State *s = Ppmd7Context_OneState(p->MinContext); + if (s->Symbol == symbol) + { + RangeEnc_EncodeBit_0(rc, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + p->FoundState = s; + Ppmd7_UpdateBin(p); + return; + } + else + { + RangeEnc_EncodeBit_1(rc, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD7_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + p->PrevSuccess = 0; + } + } + for (;;) + { + UInt32 escFreq; + CPpmd_See *see; + CPpmd_State *s; + UInt32 sum; + unsigned i, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return; /* EndMarker (symbol = -1) */ + p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + + see = Ppmd7_MakeEscFreq(p, numMasked, &escFreq); + s = Ppmd7_GetStats(p, p->MinContext); + sum = 0; + i = p->MinContext->NumStats; + do + { + int cur = s->Symbol; + if (cur == symbol) + { + UInt32 low = sum; + CPpmd_State *s1 = s; + do + { + sum += (s->Freq & (int)(MASK(s->Symbol))); + s++; + } + while (--i); + RangeEnc_Encode(rc, low, s1->Freq, sum + escFreq); + Ppmd_See_Update(see); + p->FoundState = s1; + Ppmd7_Update2(p); + return; + } + sum += (s->Freq & (int)(MASK(cur))); + MASK(cur) = 0; + s++; + } + while (--i); + + RangeEnc_Encode(rc, sum, escFreq, sum + escFreq); + see->Summ = (UInt16)(see->Summ + sum + escFreq); + } +} diff --git a/src/ZipLib/extlibs/lzma/RotateDefs.h b/src/ZipLib/extlibs/lzma/RotateDefs.h new file mode 100644 index 00000000..c3a1385c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/RotateDefs.h @@ -0,0 +1,20 @@ +/* RotateDefs.h -- Rotate functions +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __ROTATE_DEFS_H +#define __ROTATE_DEFS_H + +#ifdef _MSC_VER + +#include +#define rotlFixed(x, n) _rotl((x), (n)) +#define rotrFixed(x, n) _rotr((x), (n)) + +#else + +#define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Sha256.c b/src/ZipLib/extlibs/lzma/Sha256.c new file mode 100644 index 00000000..eb4fc61f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Sha256.c @@ -0,0 +1,204 @@ +/* Crypto/Sha256.c -- SHA-256 Hash +2010-06-11 : Igor Pavlov : Public domain +This code is based on public domain code from Wei Dai's Crypto++ library. */ + +#include "RotateDefs.h" +#include "Sha256.h" + +/* define it for speed optimization */ +/* #define _SHA256_UNROLL */ +/* #define _SHA256_UNROLL2 */ + +void Sha256_Init(CSha256 *p) +{ + p->state[0] = 0x6a09e667; + p->state[1] = 0xbb67ae85; + p->state[2] = 0x3c6ef372; + p->state[3] = 0xa54ff53a; + p->state[4] = 0x510e527f; + p->state[5] = 0x9b05688c; + p->state[6] = 0x1f83d9ab; + p->state[7] = 0x5be0cd19; + p->count = 0; +} + +#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x, 22)) +#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x, 25)) +#define s0(x) (rotrFixed(x, 7) ^ rotrFixed(x,18) ^ (x >> 3)) +#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >> 10)) + +#define blk0(i) (W[i] = data[i]) +#define blk2(i) (W[i&15] += s1(W[(i-2)&15]) + W[(i-7)&15] + s0(W[(i-15)&15])) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) ((x&y)|(z&(x|y))) + +#define a(i) T[(0-(i))&7] +#define b(i) T[(1-(i))&7] +#define c(i) T[(2-(i))&7] +#define d(i) T[(3-(i))&7] +#define e(i) T[(4-(i))&7] +#define f(i) T[(5-(i))&7] +#define g(i) T[(6-(i))&7] +#define h(i) T[(7-(i))&7] + + +#ifdef _SHA256_UNROLL2 + +#define R(a,b,c,d,e,f,g,h, i) h += S1(e) + Ch(e,f,g) + K[i+j] + (j?blk2(i):blk0(i));\ + d += h; h += S0(a) + Maj(a, b, c) + +#define RX_8(i) \ + R(a,b,c,d,e,f,g,h, i); \ + R(h,a,b,c,d,e,f,g, i+1); \ + R(g,h,a,b,c,d,e,f, i+2); \ + R(f,g,h,a,b,c,d,e, i+3); \ + R(e,f,g,h,a,b,c,d, i+4); \ + R(d,e,f,g,h,a,b,c, i+5); \ + R(c,d,e,f,g,h,a,b, i+6); \ + R(b,c,d,e,f,g,h,a, i+7) + +#else + +#define R(i) h(i) += S1(e(i)) + Ch(e(i),f(i),g(i)) + K[i+j] + (j?blk2(i):blk0(i));\ + d(i) += h(i); h(i) += S0(a(i)) + Maj(a(i), b(i), c(i)) + +#ifdef _SHA256_UNROLL + +#define RX_8(i) R(i+0); R(i+1); R(i+2); R(i+3); R(i+4); R(i+5); R(i+6); R(i+7); + +#endif + +#endif + +static const UInt32 K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void Sha256_Transform(UInt32 *state, const UInt32 *data) +{ + UInt32 W[16]; + unsigned j; + #ifdef _SHA256_UNROLL2 + UInt32 a,b,c,d,e,f,g,h; + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + f = state[5]; + g = state[6]; + h = state[7]; + #else + UInt32 T[8]; + for (j = 0; j < 8; j++) + T[j] = state[j]; + #endif + + for (j = 0; j < 64; j += 16) + { + #if defined(_SHA256_UNROLL) || defined(_SHA256_UNROLL2) + RX_8(0); RX_8(8); + #else + unsigned i; + for (i = 0; i < 16; i++) { R(i); } + #endif + } + + #ifdef _SHA256_UNROLL2 + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; + #else + for (j = 0; j < 8; j++) + state[j] += T[j]; + #endif + + /* Wipe variables */ + /* memset(W, 0, sizeof(W)); */ + /* memset(T, 0, sizeof(T)); */ +} + +#undef S0 +#undef S1 +#undef s0 +#undef s1 + +static void Sha256_WriteByteBlock(CSha256 *p) +{ + UInt32 data32[16]; + unsigned i; + for (i = 0; i < 16; i++) + data32[i] = + ((UInt32)(p->buffer[i * 4 ]) << 24) + + ((UInt32)(p->buffer[i * 4 + 1]) << 16) + + ((UInt32)(p->buffer[i * 4 + 2]) << 8) + + ((UInt32)(p->buffer[i * 4 + 3])); + Sha256_Transform(p->state, data32); +} + +void Sha256_Update(CSha256 *p, const Byte *data, size_t size) +{ + UInt32 curBufferPos = (UInt32)p->count & 0x3F; + while (size > 0) + { + p->buffer[curBufferPos++] = *data++; + p->count++; + size--; + if (curBufferPos == 64) + { + curBufferPos = 0; + Sha256_WriteByteBlock(p); + } + } +} + +void Sha256_Final(CSha256 *p, Byte *digest) +{ + UInt64 lenInBits = (p->count << 3); + UInt32 curBufferPos = (UInt32)p->count & 0x3F; + unsigned i; + p->buffer[curBufferPos++] = 0x80; + while (curBufferPos != (64 - 8)) + { + curBufferPos &= 0x3F; + if (curBufferPos == 0) + Sha256_WriteByteBlock(p); + p->buffer[curBufferPos++] = 0; + } + for (i = 0; i < 8; i++) + { + p->buffer[curBufferPos++] = (Byte)(lenInBits >> 56); + lenInBits <<= 8; + } + Sha256_WriteByteBlock(p); + + for (i = 0; i < 8; i++) + { + *digest++ = (Byte)(p->state[i] >> 24); + *digest++ = (Byte)(p->state[i] >> 16); + *digest++ = (Byte)(p->state[i] >> 8); + *digest++ = (Byte)(p->state[i]); + } + Sha256_Init(p); +} diff --git a/src/ZipLib/extlibs/lzma/Sha256.h b/src/ZipLib/extlibs/lzma/Sha256.h new file mode 100644 index 00000000..530f513e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Sha256.h @@ -0,0 +1,26 @@ +/* Sha256.h -- SHA-256 Hash +2010-06-11 : Igor Pavlov : Public domain */ + +#ifndef __CRYPTO_SHA256_H +#define __CRYPTO_SHA256_H + +#include "Types.h" + +EXTERN_C_BEGIN + +#define SHA256_DIGEST_SIZE 32 + +typedef struct +{ + UInt32 state[8]; + UInt64 count; + Byte buffer[64]; +} CSha256; + +void Sha256_Init(CSha256 *p); +void Sha256_Update(CSha256 *p, const Byte *data, size_t size); +void Sha256_Final(CSha256 *p, Byte *digest); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Threads.c b/src/ZipLib/extlibs/lzma/Threads.c new file mode 100644 index 00000000..7af1da2e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Threads.c @@ -0,0 +1,84 @@ +/* Threads.c -- multithreading library +2009-09-20 : Igor Pavlov : Public domain */ + +#ifndef _WIN32_WCE +#include +#endif + +#include "Threads.h" + +static WRes GetError() +{ + DWORD res = GetLastError(); + return (res) ? (WRes)(res) : 1; +} + +WRes HandleToWRes(HANDLE h) { return (h != 0) ? 0 : GetError(); } +WRes BOOLToWRes(BOOL v) { return v ? 0 : GetError(); } + +WRes HandlePtr_Close(HANDLE *p) +{ + if (*p != NULL) + if (!CloseHandle(*p)) + return GetError(); + *p = NULL; + return 0; +} + +WRes Handle_WaitObject(HANDLE h) { return (WRes)WaitForSingleObject(h, INFINITE); } + +WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param) +{ + unsigned threadId; /* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */ + *p = + #ifdef UNDER_CE + CreateThread(0, 0, func, param, 0, &threadId); + #else + (HANDLE)_beginthreadex(NULL, 0, func, param, 0, &threadId); + #endif + /* maybe we must use errno here, but probably GetLastError() is also OK. */ + return HandleToWRes(*p); +} + +WRes Event_Create(CEvent *p, BOOL manualReset, int signaled) +{ + *p = CreateEvent(NULL, manualReset, (signaled ? TRUE : FALSE), NULL); + return HandleToWRes(*p); +} + +WRes Event_Set(CEvent *p) { return BOOLToWRes(SetEvent(*p)); } +WRes Event_Reset(CEvent *p) { return BOOLToWRes(ResetEvent(*p)); } + +WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled) { return Event_Create(p, TRUE, signaled); } +WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled) { return Event_Create(p, FALSE, signaled); } +WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p) { return ManualResetEvent_Create(p, 0); } +WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p) { return AutoResetEvent_Create(p, 0); } + + +WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount) +{ + *p = CreateSemaphore(NULL, (LONG)initCount, (LONG)maxCount, NULL); + return HandleToWRes(*p); +} + +static WRes Semaphore_Release(CSemaphore *p, LONG releaseCount, LONG *previousCount) + { return BOOLToWRes(ReleaseSemaphore(*p, releaseCount, previousCount)); } +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num) + { return Semaphore_Release(p, (LONG)num, NULL); } +WRes Semaphore_Release1(CSemaphore *p) { return Semaphore_ReleaseN(p, 1); } + +WRes CriticalSection_Init(CCriticalSection *p) +{ + /* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */ + #ifdef _MSC_VER + __try + #endif + { + InitializeCriticalSection(p); + /* InitializeCriticalSectionAndSpinCount(p, 0); */ + } + #ifdef _MSC_VER + __except (EXCEPTION_EXECUTE_HANDLER) { return 1; } + #endif + return 0; +} diff --git a/src/ZipLib/extlibs/lzma/Threads.h b/src/ZipLib/extlibs/lzma/Threads.h new file mode 100644 index 00000000..d0ddd80e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Threads.h @@ -0,0 +1,59 @@ +/* Threads.h -- multithreading library +2009-03-27 : Igor Pavlov : Public domain */ + +#ifndef __7Z_THREADS_H +#define __7Z_THREADS_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +WRes HandlePtr_Close(HANDLE *h); +WRes Handle_WaitObject(HANDLE h); + +typedef HANDLE CThread; +#define Thread_Construct(p) *(p) = NULL +#define Thread_WasCreated(p) (*(p) != NULL) +#define Thread_Close(p) HandlePtr_Close(p) +#define Thread_Wait(p) Handle_WaitObject(*(p)) +typedef unsigned THREAD_FUNC_RET_TYPE; +#define THREAD_FUNC_CALL_TYPE MY_STD_CALL +#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE +typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *); +WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param); + +typedef HANDLE CEvent; +typedef CEvent CAutoResetEvent; +typedef CEvent CManualResetEvent; +#define Event_Construct(p) *(p) = NULL +#define Event_IsCreated(p) (*(p) != NULL) +#define Event_Close(p) HandlePtr_Close(p) +#define Event_Wait(p) Handle_WaitObject(*(p)) +WRes Event_Set(CEvent *p); +WRes Event_Reset(CEvent *p); +WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled); +WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p); +WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled); +WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p); + +typedef HANDLE CSemaphore; +#define Semaphore_Construct(p) (*p) = NULL +#define Semaphore_Close(p) HandlePtr_Close(p) +#define Semaphore_Wait(p) Handle_WaitObject(*(p)) +WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount); +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num); +WRes Semaphore_Release1(CSemaphore *p); + +typedef CRITICAL_SECTION CCriticalSection; +WRes CriticalSection_Init(CCriticalSection *p); +#define CriticalSection_Delete(p) DeleteCriticalSection(p) +#define CriticalSection_Enter(p) EnterCriticalSection(p) +#define CriticalSection_Leave(p) LeaveCriticalSection(p) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/Types.h b/src/ZipLib/extlibs/lzma/Types.h new file mode 100644 index 00000000..7732c240 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Types.h @@ -0,0 +1,254 @@ +/* Types.h -- Basic types +2010-10-09 : Igor Pavlov : Public domain */ + +#ifndef __7Z_TYPES_H +#define __7Z_TYPES_H + +#include + +#ifdef _WIN32 +#include +#endif + +#ifndef EXTERN_C_BEGIN +#ifdef __cplusplus +#define EXTERN_C_BEGIN extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_BEGIN +#define EXTERN_C_END +#endif +#endif + +EXTERN_C_BEGIN + +#define SZ_OK 0 + +#define SZ_ERROR_DATA 1 +#define SZ_ERROR_MEM 2 +#define SZ_ERROR_CRC 3 +#define SZ_ERROR_UNSUPPORTED 4 +#define SZ_ERROR_PARAM 5 +#define SZ_ERROR_INPUT_EOF 6 +#define SZ_ERROR_OUTPUT_EOF 7 +#define SZ_ERROR_READ 8 +#define SZ_ERROR_WRITE 9 +#define SZ_ERROR_PROGRESS 10 +#define SZ_ERROR_FAIL 11 +#define SZ_ERROR_THREAD 12 + +#define SZ_ERROR_ARCHIVE 16 +#define SZ_ERROR_NO_ARCHIVE 17 + +typedef int SRes; + +#ifdef _WIN32 +typedef DWORD WRes; +#else +typedef int WRes; +#endif + +#ifndef RINOK +#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } +#endif + +typedef unsigned char Byte; +typedef short Int16; +typedef unsigned short UInt16; + +#ifdef _LZMA_UINT32_IS_ULONG +typedef long Int32; +typedef unsigned long UInt32; +#else +typedef int Int32; +typedef unsigned int UInt32; +#endif + +#ifdef _SZ_NO_INT_64 + +/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. + NOTES: Some code will work incorrectly in that case! */ + +typedef long Int64; +typedef unsigned long UInt64; + +#else + +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#define UINT64_CONST(n) n +#else +typedef long long int Int64; +typedef unsigned long long int UInt64; +#define UINT64_CONST(n) n ## ULL +#endif + +#endif + +#ifdef _LZMA_NO_SYSTEM_SIZE_T +typedef UInt32 SizeT; +#else +typedef size_t SizeT; +#endif + +typedef int Bool; +#define True 1 +#define False 0 + + +#ifdef _WIN32 +#define MY_STD_CALL __stdcall +#else +#define MY_STD_CALL +#endif + +#ifdef _MSC_VER + +#if _MSC_VER >= 1300 +#define MY_NO_INLINE __declspec(noinline) +#else +#define MY_NO_INLINE +#endif + +#define MY_CDECL __cdecl +#define MY_FAST_CALL __fastcall + +#else + +#define MY_CDECL +#define MY_FAST_CALL + +#endif + + +/* The following interfaces use first parameter as pointer to structure */ + +typedef struct +{ + Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ +} IByteIn; + +typedef struct +{ + void (*Write)(void *p, Byte b); +} IByteOut; + +typedef struct +{ + SRes (*Read)(void *p, void *buf, size_t *size); + /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. + (output(*size) < input(*size)) is allowed */ +} ISeqInStream; + +/* it can return SZ_ERROR_INPUT_EOF */ +SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); +SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); +SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); + +typedef struct +{ + size_t (*Write)(void *p, const void *buf, size_t size); + /* Returns: result - the number of actually written bytes. + (result < size) means error */ +} ISeqOutStream; + +typedef enum +{ + SZ_SEEK_SET = 0, + SZ_SEEK_CUR = 1, + SZ_SEEK_END = 2 +} ESzSeek; + +typedef struct +{ + SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ + SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); +} ISeekInStream; + +typedef struct +{ + SRes (*Look)(void *p, const void **buf, size_t *size); + /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. + (output(*size) > input(*size)) is not allowed + (output(*size) < input(*size)) is allowed */ + SRes (*Skip)(void *p, size_t offset); + /* offset must be <= output(*size) of Look */ + + SRes (*Read)(void *p, void *buf, size_t *size); + /* reads directly (without buffer). It's same as ISeqInStream::Read */ + SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); +} ILookInStream; + +SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); +SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); + +/* reads via ILookInStream::Read */ +SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); +SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); + +#define LookToRead_BUF_SIZE (1 << 14) + +typedef struct +{ + ILookInStream s; + ISeekInStream *realStream; + size_t pos; + size_t size; + Byte buf[LookToRead_BUF_SIZE]; +} CLookToRead; + +void LookToRead_CreateVTable(CLookToRead *p, int lookahead); +void LookToRead_Init(CLookToRead *p); + +typedef struct +{ + ISeqInStream s; + ILookInStream *realStream; +} CSecToLook; + +void SecToLook_CreateVTable(CSecToLook *p); + +typedef struct +{ + ISeqInStream s; + ILookInStream *realStream; +} CSecToRead; + +void SecToRead_CreateVTable(CSecToRead *p); + +typedef struct +{ + SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); + /* Returns: result. (result != SZ_OK) means break. + Value (UInt64)(Int64)-1 for size means unknown value. */ +} ICompressProgress; + +typedef struct +{ + void *(*Alloc)(void *p, size_t size); + void (*Free)(void *p, void *address); /* address can be 0 */ +} ISzAlloc; + +#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) +#define IAlloc_Free(p, a) (p)->Free((p), a) + +#ifdef _WIN32 + +#define CHAR_PATH_SEPARATOR '\\' +#define WCHAR_PATH_SEPARATOR L'\\' +#define STRING_PATH_SEPARATOR "\\" +#define WSTRING_PATH_SEPARATOR L"\\" + +#else + +#define CHAR_PATH_SEPARATOR '/' +#define WCHAR_PATH_SEPARATOR L'/' +#define STRING_PATH_SEPARATOR "/" +#define WSTRING_PATH_SEPARATOR L"/" + +#endif + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/Xz.c b/src/ZipLib/extlibs/lzma/Xz.c new file mode 100644 index 00000000..18caba2c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Xz.c @@ -0,0 +1,88 @@ +/* Xz.c - Xz +2009-04-15 : Igor Pavlov : Public domain */ + +#include "7zCrc.h" +#include "CpuArch.h" +#include "Xz.h" +#include "XzCrc64.h" + +Byte XZ_SIG[XZ_SIG_SIZE] = { 0xFD, '7', 'z', 'X', 'Z', 0 }; +Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE] = { 'Y', 'Z' }; + +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v) +{ + unsigned i = 0; + do + { + buf[i++] = (Byte)((v & 0x7F) | 0x80); + v >>= 7; + } + while (v != 0); + buf[i - 1] &= 0x7F; + return i; +} + +void Xz_Construct(CXzStream *p) +{ + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; + p->flags = 0; +} + +void Xz_Free(CXzStream *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->blocks); + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; +} + +unsigned XzFlags_GetCheckSize(CXzStreamFlags f) +{ + int t = XzFlags_GetCheckType(f); + return (t == 0) ? 0 : (4 << ((t - 1) / 3)); +} + +void XzCheck_Init(CXzCheck *p, int mode) +{ + p->mode = mode; + switch (mode) + { + case XZ_CHECK_CRC32: p->crc = CRC_INIT_VAL; break; + case XZ_CHECK_CRC64: p->crc64 = CRC64_INIT_VAL; break; + case XZ_CHECK_SHA256: Sha256_Init(&p->sha); break; + } +} + +void XzCheck_Update(CXzCheck *p, const void *data, size_t size) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: p->crc = CrcUpdate(p->crc, data, size); break; + case XZ_CHECK_CRC64: p->crc64 = Crc64Update(p->crc64, data, size); break; + case XZ_CHECK_SHA256: Sha256_Update(&p->sha, (const Byte *)data, size); break; + } +} + +int XzCheck_Final(CXzCheck *p, Byte *digest) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: + SetUi32(digest, CRC_GET_DIGEST(p->crc)); + break; + case XZ_CHECK_CRC64: + { + int i; + UInt64 v = CRC64_GET_DIGEST(p->crc64); + for (i = 0; i < 8; i++, v >>= 8) + digest[i] = (Byte)(v & 0xFF); + break; + } + case XZ_CHECK_SHA256: + Sha256_Final(&p->sha, digest); + break; + default: + return 0; + } + return 1; +} diff --git a/src/ZipLib/extlibs/lzma/Xz.h b/src/ZipLib/extlibs/lzma/Xz.h new file mode 100644 index 00000000..0f7a822c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/Xz.h @@ -0,0 +1,254 @@ +/* Xz.h - Xz interface +2011-01-09 : Igor Pavlov : Public domain */ + +#ifndef __XZ_H +#define __XZ_H + +#include "Sha256.h" + +EXTERN_C_BEGIN + +#define XZ_ID_Subblock 1 +#define XZ_ID_Delta 3 +#define XZ_ID_X86 4 +#define XZ_ID_PPC 5 +#define XZ_ID_IA64 6 +#define XZ_ID_ARM 7 +#define XZ_ID_ARMT 8 +#define XZ_ID_SPARC 9 +#define XZ_ID_LZMA2 0x21 + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value); +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v); + +/* ---------- xz block ---------- */ + +#define XZ_BLOCK_HEADER_SIZE_MAX 1024 + +#define XZ_NUM_FILTERS_MAX 4 +#define XZ_BF_NUM_FILTERS_MASK 3 +#define XZ_BF_PACK_SIZE (1 << 6) +#define XZ_BF_UNPACK_SIZE (1 << 7) + +#define XZ_FILTER_PROPS_SIZE_MAX 20 + +typedef struct +{ + UInt64 id; + UInt32 propsSize; + Byte props[XZ_FILTER_PROPS_SIZE_MAX]; +} CXzFilter; + +typedef struct +{ + UInt64 packSize; + UInt64 unpackSize; + Byte flags; + CXzFilter filters[XZ_NUM_FILTERS_MAX]; +} CXzBlock; + +#define XzBlock_GetNumFilters(p) (((p)->flags & XZ_BF_NUM_FILTERS_MASK) + 1) +#define XzBlock_HasPackSize(p) (((p)->flags & XZ_BF_PACK_SIZE) != 0) +#define XzBlock_HasUnpackSize(p) (((p)->flags & XZ_BF_UNPACK_SIZE) != 0) + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header); +SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes); + +/* ---------- xz stream ---------- */ + +#define XZ_SIG_SIZE 6 +#define XZ_FOOTER_SIG_SIZE 2 + +extern Byte XZ_SIG[XZ_SIG_SIZE]; +extern Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE]; + +#define XZ_STREAM_FLAGS_SIZE 2 +#define XZ_STREAM_CRC_SIZE 4 + +#define XZ_STREAM_HEADER_SIZE (XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE) +#define XZ_STREAM_FOOTER_SIZE (XZ_FOOTER_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE + 4) + +#define XZ_CHECK_MASK 0xF +#define XZ_CHECK_NO 0 +#define XZ_CHECK_CRC32 1 +#define XZ_CHECK_CRC64 4 +#define XZ_CHECK_SHA256 10 + +typedef struct +{ + int mode; + UInt32 crc; + UInt64 crc64; + CSha256 sha; +} CXzCheck; + +void XzCheck_Init(CXzCheck *p, int mode); +void XzCheck_Update(CXzCheck *p, const void *data, size_t size); +int XzCheck_Final(CXzCheck *p, Byte *digest); + +typedef UInt16 CXzStreamFlags; + +#define XzFlags_IsSupported(f) ((f) <= XZ_CHECK_MASK) +#define XzFlags_GetCheckType(f) ((f) & XZ_CHECK_MASK) +#define XzFlags_HasDataCrc32(f) (Xz_GetCheckType(f) == XZ_CHECK_CRC32) +unsigned XzFlags_GetCheckSize(CXzStreamFlags f); + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf); +SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream); + +typedef struct +{ + UInt64 unpackSize; + UInt64 totalSize; +} CXzBlockSizes; + +typedef struct +{ + CXzStreamFlags flags; + size_t numBlocks; + size_t numBlocksAllocated; + CXzBlockSizes *blocks; + UInt64 startOffset; +} CXzStream; + +void Xz_Construct(CXzStream *p); +void Xz_Free(CXzStream *p, ISzAlloc *alloc); + +#define XZ_SIZE_OVERFLOW ((UInt64)(Int64)-1) + +UInt64 Xz_GetUnpackSize(const CXzStream *p); +UInt64 Xz_GetPackSize(const CXzStream *p); + +typedef struct +{ + size_t num; + size_t numAllocated; + CXzStream *streams; +} CXzs; + +void Xzs_Construct(CXzs *p); +void Xzs_Free(CXzs *p, ISzAlloc *alloc); +SRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc); + +UInt64 Xzs_GetNumBlocks(const CXzs *p); +UInt64 Xzs_GetUnpackSize(const CXzs *p); + +typedef enum +{ + CODER_STATUS_NOT_SPECIFIED, /* use main error code instead */ + CODER_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ + CODER_STATUS_NOT_FINISHED, /* stream was not finished */ + CODER_STATUS_NEEDS_MORE_INPUT /* you must provide more input bytes */ +} ECoderStatus; + +typedef enum +{ + CODER_FINISH_ANY, /* finish at any point */ + CODER_FINISH_END /* block must be finished at the end */ +} ECoderFinishMode; + +typedef struct _IStateCoder +{ + void *p; + void (*Free)(void *p, ISzAlloc *alloc); + SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAlloc *alloc); + void (*Init)(void *p); + SRes (*Code)(void *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished); +} IStateCoder; + +#define MIXCODER_NUM_FILTERS_MAX 4 + +typedef struct +{ + ISzAlloc *alloc; + Byte *buf; + int numCoders; + int finished[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t pos[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t size[MIXCODER_NUM_FILTERS_MAX - 1]; + UInt64 ids[MIXCODER_NUM_FILTERS_MAX]; + IStateCoder coders[MIXCODER_NUM_FILTERS_MAX]; +} CMixCoder; + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc); +void MixCoder_Free(CMixCoder *p); +void MixCoder_Init(CMixCoder *p); +SRes MixCoder_SetFromMethod(CMixCoder *p, int coderIndex, UInt64 methodId); +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status); + +typedef enum +{ + XZ_STATE_STREAM_HEADER, + XZ_STATE_STREAM_INDEX, + XZ_STATE_STREAM_INDEX_CRC, + XZ_STATE_STREAM_FOOTER, + XZ_STATE_STREAM_PADDING, + XZ_STATE_BLOCK_HEADER, + XZ_STATE_BLOCK, + XZ_STATE_BLOCK_FOOTER +} EXzState; + +typedef struct +{ + EXzState state; + UInt32 pos; + unsigned alignPos; + unsigned indexPreSize; + + CXzStreamFlags streamFlags; + + UInt32 blockHeaderSize; + UInt64 packSize; + UInt64 unpackSize; + + UInt64 numBlocks; + UInt64 indexSize; + UInt64 indexPos; + UInt64 padSize; + + UInt64 numStreams; + + UInt32 crc; + CMixCoder decoder; + CXzBlock block; + CXzCheck check; + CSha256 sha; + Byte shaDigest[SHA256_DIGEST_SIZE]; + Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; +} CXzUnpacker; + +void XzUnpacker_Construct(CXzUnpacker *p, ISzAlloc *alloc); +void XzUnpacker_Init(CXzUnpacker *p); +void XzUnpacker_Free(CXzUnpacker *p); + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + CODER_STATUS_NOT_FINISHED, + CODER_STATUS_NEEDS_MORE_INPUT - maybe there are more xz streams, + call XzUnpacker_IsStreamWasFinished to check that current stream was finished + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, /* int srcWasFinished, */ int finishMode, + ECoderStatus *status); + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/XzCrc64.c b/src/ZipLib/extlibs/lzma/XzCrc64.c new file mode 100644 index 00000000..0369554b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzCrc64.c @@ -0,0 +1,33 @@ +/* XzCrc64.c -- CRC64 calculation +2010-04-16 : Igor Pavlov : Public domain */ + +#include "XzCrc64.h" + +#define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42) +UInt64 g_Crc64Table[256]; + +void MY_FAST_CALL Crc64GenerateTable(void) +{ + UInt32 i; + for (i = 0; i < 256; i++) + { + UInt64 r = i; + int j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ ((UInt64)kCrc64Poly & ~((r & 1) - 1)); + g_Crc64Table[i] = r; + } +} + +UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 ; size--, p++) + v = CRC64_UPDATE_BYTE(v, *p); + return v; +} + +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size) +{ + return CRC64_GET_DIGEST(Crc64Update(CRC64_INIT_VAL, data, size)); +} diff --git a/src/ZipLib/extlibs/lzma/XzCrc64.h b/src/ZipLib/extlibs/lzma/XzCrc64.h new file mode 100644 index 00000000..0e8efd7e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzCrc64.h @@ -0,0 +1,26 @@ +/* XzCrc64.h -- CRC64 calculation +2010-04-16 : Igor Pavlov : Public domain */ + +#ifndef __XZ_CRC64_H +#define __XZ_CRC64_H + +#include + +#include "Types.h" + +EXTERN_C_BEGIN + +extern UInt64 g_Crc64Table[]; + +void MY_FAST_CALL Crc64GenerateTable(void); + +#define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) +#define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) +#define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size); +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/XzDec.c b/src/ZipLib/extlibs/lzma/XzDec.c new file mode 100644 index 00000000..113e2cdf --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzDec.c @@ -0,0 +1,889 @@ +/* XzDec.c -- Xz Decode +2011-02-07 : Igor Pavlov : Public domain */ + +/* #define XZ_DUMP */ + +#ifdef XZ_DUMP +#include +#endif + +#include +#include + +#include "7zCrc.h" +#include "Alloc.h" +#include "Bra.h" +#include "CpuArch.h" +#include "Delta.h" +#include "Lzma2Dec.h" + +#ifdef USE_SUBBLOCK +#include "Bcj3Dec.c" +#include "SbDec.c" +#endif + +#include "Xz.h" + +#define XZ_CHECK_SIZE_MAX 64 + +#define CODER_BUF_SIZE (1 << 17) + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value) +{ + int i, limit; + *value = 0; + limit = (maxSize > 9) ? 9 : (int)maxSize; + + for (i = 0; i < limit;) + { + Byte b = p[i]; + *value |= (UInt64)(b & 0x7F) << (7 * i++); + if ((b & 0x80) == 0) + return (b == 0 && i != 1) ? 0 : i; + } + return 0; +} + +/* ---------- BraState ---------- */ + +#define BRA_BUF_SIZE (1 << 14) + +typedef struct +{ + size_t bufPos; + size_t bufConv; + size_t bufTotal; + + UInt32 methodId; + int encodeMode; + UInt32 delta; + UInt32 ip; + UInt32 x86State; + Byte deltaState[DELTA_STATE_SIZE]; + + Byte buf[BRA_BUF_SIZE]; +} CBraState; + +void BraState_Free(void *pp, ISzAlloc *alloc) +{ + alloc->Free(alloc, pp); +} + +SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + CBraState *p = ((CBraState *)pp); + alloc = alloc; + p->ip = 0; + if (p->methodId == XZ_ID_Delta) + { + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + p->delta = (unsigned)props[0] + 1; + } + else + { + if (propSize == 4) + { + UInt32 v = GetUi32(props); + switch(p->methodId) + { + case XZ_ID_PPC: + case XZ_ID_ARM: + case XZ_ID_SPARC: + if ((v & 3) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_ARMT: + if ((v & 1) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_IA64: + if ((v & 0xF) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + } + p->ip = v; + } + else if (propSize != 0) + return SZ_ERROR_UNSUPPORTED; + } + return SZ_OK; +} + +void BraState_Init(void *pp) +{ + CBraState *p = ((CBraState *)pp); + p->bufPos = p->bufConv = p->bufTotal = 0; + x86_Convert_Init(p->x86State); + if (p->methodId == XZ_ID_Delta) + Delta_Init(p->deltaState); +} + +#define CASE_BRA_CONV(isa) case XZ_ID_ ## isa: p->bufConv = isa ## _Convert(p->buf, p->bufTotal, p->ip, p->encodeMode); break; + +static SRes BraState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + CBraState *p = ((CBraState *)pp); + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + *destLen = 0; + *srcLen = 0; + finishMode = finishMode; + *wasFinished = 0; + while (destLenOrig > 0) + { + if (p->bufPos != p->bufConv) + { + size_t curSize = p->bufConv - p->bufPos; + if (curSize > destLenOrig) + curSize = destLenOrig; + memcpy(dest, p->buf + p->bufPos, curSize); + p->bufPos += curSize; + *destLen += curSize; + dest += curSize; + destLenOrig -= curSize; + continue; + } + p->bufTotal -= p->bufPos; + memmove(p->buf, p->buf + p->bufPos, p->bufTotal); + p->bufPos = 0; + p->bufConv = 0; + { + size_t curSize = BRA_BUF_SIZE - p->bufTotal; + if (curSize > srcLenOrig) + curSize = srcLenOrig; + memcpy(p->buf + p->bufTotal, src, curSize); + *srcLen += curSize; + src += curSize; + srcLenOrig -= curSize; + p->bufTotal += curSize; + } + if (p->bufTotal == 0) + break; + switch(p->methodId) + { + case XZ_ID_Delta: + if (p->encodeMode) + Delta_Encode(p->deltaState, p->delta, p->buf, p->bufTotal); + else + Delta_Decode(p->deltaState, p->delta, p->buf, p->bufTotal); + p->bufConv = p->bufTotal; + break; + case XZ_ID_X86: + p->bufConv = x86_Convert(p->buf, p->bufTotal, p->ip, &p->x86State, p->encodeMode); + break; + CASE_BRA_CONV(PPC) + CASE_BRA_CONV(IA64) + CASE_BRA_CONV(ARM) + CASE_BRA_CONV(ARMT) + CASE_BRA_CONV(SPARC) + default: + return SZ_ERROR_UNSUPPORTED; + } + p->ip += (UInt32)p->bufConv; + + if (p->bufConv == 0) + { + if (!srcWasFinished) + break; + p->bufConv = p->bufTotal; + } + } + if (p->bufTotal == p->bufPos && srcLenOrig == 0 && srcWasFinished) + *wasFinished = 1; + return SZ_OK; +} + +SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAlloc *alloc) +{ + CBraState *decoder; + if (id != XZ_ID_Delta && + id != XZ_ID_X86 && + id != XZ_ID_PPC && + id != XZ_ID_IA64 && + id != XZ_ID_ARM && + id != XZ_ID_ARMT && + id != XZ_ID_SPARC) + return SZ_ERROR_UNSUPPORTED; + p->p = 0; + decoder = alloc->Alloc(alloc, sizeof(CBraState)); + if (decoder == 0) + return SZ_ERROR_MEM; + decoder->methodId = (UInt32)id; + decoder->encodeMode = encodeMode; + p->p = decoder; + p->Free = BraState_Free; + p->SetProps = BraState_SetProps; + p->Init = BraState_Init; + p->Code = BraState_Code; + return SZ_OK; +} + +/* ---------- SbState ---------- */ + +#ifdef USE_SUBBLOCK + +static void SbState_Free(void *pp, ISzAlloc *alloc) +{ + CSbDec *p = (CSbDec *)pp; + SbDec_Free(p); + alloc->Free(alloc, pp); +} + +static SRes SbState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + pp = pp; + props = props; + alloc = alloc; + return (propSize == 0) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static void SbState_Init(void *pp) +{ + SbDec_Init((CSbDec *)pp); +} + +static SRes SbState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + CSbDec *p = (CSbDec *)pp; + SRes res; + srcWasFinished = srcWasFinished; + p->dest = dest; + p->destLen = *destLen; + p->src = src; + p->srcLen = *srcLen; + p->finish = finishMode; /* change it */ + res = SbDec_Decode((CSbDec *)pp); + *destLen -= p->destLen; + *srcLen -= p->srcLen; + *wasFinished = (*destLen == 0 && *srcLen == 0); /* change it */ + return res; +} + +SRes SbState_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CSbDec *decoder; + p->p = 0; + decoder = alloc->Alloc(alloc, sizeof(CSbDec)); + if (decoder == 0) + return SZ_ERROR_MEM; + p->p = decoder; + p->Free = SbState_Free; + p->SetProps = SbState_SetProps; + p->Init = SbState_Init; + p->Code = SbState_Code; + SbDec_Construct(decoder); + SbDec_SetAlloc(decoder, alloc); + return SZ_OK; +} +#endif + +/* ---------- Lzma2State ---------- */ + +static void Lzma2State_Free(void *pp, ISzAlloc *alloc) +{ + Lzma2Dec_Free((CLzma2Dec *)pp, alloc); + alloc->Free(alloc, pp); +} + +static SRes Lzma2State_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + return Lzma2Dec_Allocate((CLzma2Dec *)pp, props[0], alloc); +} + +static void Lzma2State_Init(void *pp) +{ + Lzma2Dec_Init((CLzma2Dec *)pp); +} + +static SRes Lzma2State_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + ELzmaStatus status; + /* ELzmaFinishMode fm = (finishMode == LZMA_FINISH_ANY) ? LZMA_FINISH_ANY : LZMA_FINISH_END; */ + SRes res = Lzma2Dec_DecodeToBuf((CLzma2Dec *)pp, dest, destLen, src, srcLen, finishMode, &status); + srcWasFinished = srcWasFinished; + *wasFinished = (status == LZMA_STATUS_FINISHED_WITH_MARK); + return res; +} + +static SRes Lzma2State_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CLzma2Dec *decoder = alloc->Alloc(alloc, sizeof(CLzma2Dec)); + p->p = decoder; + if (decoder == 0) + return SZ_ERROR_MEM; + p->Free = Lzma2State_Free; + p->SetProps = Lzma2State_SetProps; + p->Init = Lzma2State_Init; + p->Code = Lzma2State_Code; + Lzma2Dec_Construct(decoder); + return SZ_OK; +} + + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc) +{ + int i; + p->alloc = alloc; + p->buf = 0; + p->numCoders = 0; + for (i = 0; i < MIXCODER_NUM_FILTERS_MAX; i++) + p->coders[i].p = NULL; +} + +void MixCoder_Free(CMixCoder *p) +{ + int i; + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *sc = &p->coders[i]; + if (p->alloc && sc->p) + sc->Free(sc->p, p->alloc); + } + p->numCoders = 0; + if (p->buf) + p->alloc->Free(p->alloc, p->buf); +} + +void MixCoder_Init(CMixCoder *p) +{ + int i; + for (i = 0; i < p->numCoders - 1; i++) + { + p->size[i] = 0; + p->pos[i] = 0; + p->finished[i] = 0; + } + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *coder = &p->coders[i]; + coder->Init(coder->p); + } +} + +SRes MixCoder_SetFromMethod(CMixCoder *p, int coderIndex, UInt64 methodId) +{ + IStateCoder *sc = &p->coders[coderIndex]; + p->ids[coderIndex] = methodId; + switch(methodId) + { + case XZ_ID_LZMA2: return Lzma2State_SetFromMethod(sc, p->alloc); + #ifdef USE_SUBBLOCK + case XZ_ID_Subblock: return SbState_SetFromMethod(sc, p->alloc); + #endif + } + if (coderIndex == 0) + return SZ_ERROR_UNSUPPORTED; + return BraState_SetFromMethod(sc, methodId, 0, p->alloc); +} + +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + Bool allFinished = True; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_FINISHED; + + if (p->buf == 0) + { + p->buf = p->alloc->Alloc(p->alloc, CODER_BUF_SIZE * (MIXCODER_NUM_FILTERS_MAX - 1)); + if (p->buf == 0) + return SZ_ERROR_MEM; + } + + if (p->numCoders != 1) + finishMode = CODER_FINISH_ANY; + + for (;;) + { + Bool processed = False; + int i; + /* + if (p->numCoders == 1 && *destLen == destLenOrig && finishMode == LZMA_FINISH_ANY) + break; + */ + + for (i = 0; i < p->numCoders; i++) + { + SRes res; + IStateCoder *coder = &p->coders[i]; + Byte *destCur; + SizeT destLenCur, srcLenCur; + const Byte *srcCur; + int srcFinishedCur; + int encodingWasFinished; + + if (i == 0) + { + srcCur = src; + srcLenCur = srcLenOrig - *srcLen; + srcFinishedCur = srcWasFinished; + } + else + { + srcCur = p->buf + (CODER_BUF_SIZE * (i - 1)) + p->pos[i - 1]; + srcLenCur = p->size[i - 1] - p->pos[i - 1]; + srcFinishedCur = p->finished[i - 1]; + } + + if (i == p->numCoders - 1) + { + destCur = dest; + destLenCur = destLenOrig - *destLen; + } + else + { + if (p->pos[i] != p->size[i]) + continue; + destCur = p->buf + (CODER_BUF_SIZE * i); + destLenCur = CODER_BUF_SIZE; + } + + res = coder->Code(coder->p, destCur, &destLenCur, srcCur, &srcLenCur, srcFinishedCur, finishMode, &encodingWasFinished); + + if (!encodingWasFinished) + allFinished = False; + + if (i == 0) + { + *srcLen += srcLenCur; + src += srcLenCur; + } + else + { + p->pos[i - 1] += srcLenCur; + } + + if (i == p->numCoders - 1) + { + *destLen += destLenCur; + dest += destLenCur; + } + else + { + p->size[i] = destLenCur; + p->pos[i] = 0; + p->finished[i] = encodingWasFinished; + } + + if (res != SZ_OK) + return res; + + if (destLenCur != 0 || srcLenCur != 0) + processed = True; + } + if (!processed) + break; + } + if (allFinished) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf) +{ + *p = (CXzStreamFlags)GetBe16(buf + XZ_SIG_SIZE); + if (CrcCalc(buf + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE) != + GetUi32(buf + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE)) + return SZ_ERROR_NO_ARCHIVE; + return XzFlags_IsSupported(*p) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static Bool Xz_CheckFooter(CXzStreamFlags flags, UInt64 indexSize, const Byte *buf) +{ + return + indexSize == (((UInt64)GetUi32(buf + 4) + 1) << 2) && + (GetUi32(buf) == CrcCalc(buf + 4, 6) && + flags == GetBe16(buf + 8) && + memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) == 0); +} + +#define READ_VARINT_AND_CHECK(buf, pos, size, res) \ + { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \ + if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; } + + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header) +{ + unsigned pos; + int numFilters, i; + UInt32 headerSize = (UInt32)header[0] << 2; + + if (CrcCalc(header, headerSize) != GetUi32(header + headerSize)) + return SZ_ERROR_ARCHIVE; + + pos = 1; + if (pos == headerSize) + return SZ_ERROR_ARCHIVE; + p->flags = header[pos++]; + + if (XzBlock_HasPackSize(p)) + { + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize); + if (p->packSize == 0 || p->packSize + headerSize >= (UInt64)1 << 63) + return SZ_ERROR_ARCHIVE; + } + + if (XzBlock_HasUnpackSize(p)) + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize); + + numFilters = XzBlock_GetNumFilters(p); + for (i = 0; i < numFilters; i++) + { + CXzFilter *filter = p->filters + i; + UInt64 size; + READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id); + READ_VARINT_AND_CHECK(header, pos, headerSize, &size); + if (size > headerSize - pos || size > XZ_FILTER_PROPS_SIZE_MAX) + return SZ_ERROR_ARCHIVE; + filter->propsSize = (UInt32)size; + memcpy(filter->props, header + pos, (size_t)size); + pos += (unsigned)size; + + #ifdef XZ_DUMP + printf("\nf[%d] = %2X: ", i, filter->id); + { + int i; + for (i = 0; i < size; i++) + printf(" %2X", filter->props[i]); + } + #endif + } + + while (pos < headerSize) + if (header[pos++] != 0) + return SZ_ERROR_ARCHIVE; + return SZ_OK; +} + +SRes XzDec_Init(CMixCoder *p, const CXzBlock *block) +{ + int i; + Bool needReInit = True; + int numFilters = XzBlock_GetNumFilters(block); + if (numFilters == p->numCoders) + { + for (i = 0; i < numFilters; i++) + if (p->ids[i] != block->filters[numFilters - 1 - i].id) + break; + needReInit = (i != numFilters); + } + if (needReInit) + { + MixCoder_Free(p); + p->numCoders = numFilters; + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + RINOK(MixCoder_SetFromMethod(p, i, f->id)); + } + } + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + IStateCoder *sc = &p->coders[i]; + RINOK(sc->SetProps(sc->p, f->props, f->propsSize, p->alloc)); + } + MixCoder_Init(p); + return SZ_OK; +} + +void XzUnpacker_Init(CXzUnpacker *p) +{ + p->state = XZ_STATE_STREAM_HEADER; + p->pos = 0; + p->numStreams = 0; +} + +void XzUnpacker_Construct(CXzUnpacker *p, ISzAlloc *alloc) +{ + MixCoder_Construct(&p->decoder, alloc); + XzUnpacker_Init(p); +} + +void XzUnpacker_Free(CXzUnpacker *p) +{ + MixCoder_Free(&p->decoder); +} + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_SPECIFIED; + for (;;) + { + SizeT srcRem = srcLenOrig - *srcLen; + + if (p->state == XZ_STATE_BLOCK) + { + SizeT destLen2 = destLenOrig - *destLen; + SizeT srcLen2 = srcLenOrig - *srcLen; + SRes res; + if (srcLen2 == 0 && destLen2 == 0) + { + *status = CODER_STATUS_NOT_FINISHED; + return SZ_OK; + } + + res = MixCoder_Code(&p->decoder, dest, &destLen2, src, &srcLen2, False, finishMode, status); + XzCheck_Update(&p->check, dest, destLen2); + + (*srcLen) += srcLen2; + src += srcLen2; + p->packSize += srcLen2; + + (*destLen) += destLen2; + dest += destLen2; + p->unpackSize += destLen2; + + RINOK(res); + + if (*status == CODER_STATUS_FINISHED_WITH_MARK) + { + Byte temp[32]; + unsigned num = Xz_WriteVarInt(temp, p->packSize + p->blockHeaderSize + XzFlags_GetCheckSize(p->streamFlags)); + num += Xz_WriteVarInt(temp + num, p->unpackSize); + Sha256_Update(&p->sha, temp, num); + p->indexSize += num; + p->numBlocks++; + + p->state = XZ_STATE_BLOCK_FOOTER; + p->pos = 0; + p->alignPos = 0; + } + else if (srcLen2 == 0 && destLen2 == 0) + return SZ_OK; + + continue; + } + + if (srcRem == 0) + { + *status = CODER_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + switch(p->state) + { + case XZ_STATE_STREAM_HEADER: + { + if (p->pos < XZ_STREAM_HEADER_SIZE) + { + if (p->pos < XZ_SIG_SIZE && *src != XZ_SIG[p->pos]) + return SZ_ERROR_NO_ARCHIVE; + p->buf[p->pos++] = *src++; + (*srcLen)++; + } + else + { + RINOK(Xz_ParseHeader(&p->streamFlags, p->buf)); + p->state = XZ_STATE_BLOCK_HEADER; + Sha256_Init(&p->sha); + p->indexSize = 0; + p->numBlocks = 0; + p->pos = 0; + } + break; + } + + case XZ_STATE_BLOCK_HEADER: + { + if (p->pos == 0) + { + p->buf[p->pos++] = *src++; + (*srcLen)++; + if (p->buf[0] == 0) + { + p->indexPreSize = 1 + Xz_WriteVarInt(p->buf + 1, p->numBlocks); + p->indexPos = p->indexPreSize; + p->indexSize += p->indexPreSize; + Sha256_Final(&p->sha, p->shaDigest); + Sha256_Init(&p->sha); + p->crc = CrcUpdate(CRC_INIT_VAL, p->buf, p->indexPreSize); + p->state = XZ_STATE_STREAM_INDEX; + } + p->blockHeaderSize = ((UInt32)p->buf[0] << 2) + 4; + } + else if (p->pos != p->blockHeaderSize) + { + UInt32 cur = p->blockHeaderSize - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + RINOK(XzBlock_Parse(&p->block, p->buf)); + p->state = XZ_STATE_BLOCK; + p->packSize = 0; + p->unpackSize = 0; + XzCheck_Init(&p->check, XzFlags_GetCheckType(p->streamFlags)); + RINOK(XzDec_Init(&p->decoder, &p->block)); + } + break; + } + + case XZ_STATE_BLOCK_FOOTER: + { + if (((p->packSize + p->alignPos) & 3) != 0) + { + (*srcLen)++; + p->alignPos++; + if (*src++ != 0) + return SZ_ERROR_CRC; + } + else + { + UInt32 checkSize = XzFlags_GetCheckSize(p->streamFlags); + UInt32 cur = checkSize - p->pos; + if (cur != 0) + { + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + Byte digest[XZ_CHECK_SIZE_MAX]; + p->state = XZ_STATE_BLOCK_HEADER; + p->pos = 0; + if (XzCheck_Final(&p->check, digest) && memcmp(digest, p->buf, checkSize) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX: + { + if (p->pos < p->indexPreSize) + { + (*srcLen)++; + if (*src++ != p->buf[p->pos++]) + return SZ_ERROR_CRC; + } + else + { + if (p->indexPos < p->indexSize) + { + UInt64 cur = p->indexSize - p->indexPos; + if (srcRem > cur) + srcRem = (SizeT)cur; + p->crc = CrcUpdate(p->crc, src, srcRem); + Sha256_Update(&p->sha, src, srcRem); + (*srcLen) += srcRem; + src += srcRem; + p->indexPos += srcRem; + } + else if ((p->indexPos & 3) != 0) + { + Byte b = *src++; + p->crc = CRC_UPDATE_BYTE(p->crc, b); + (*srcLen)++; + p->indexPos++; + p->indexSize++; + if (b != 0) + return SZ_ERROR_CRC; + } + else + { + Byte digest[SHA256_DIGEST_SIZE]; + p->state = XZ_STATE_STREAM_INDEX_CRC; + p->indexSize += 4; + p->pos = 0; + Sha256_Final(&p->sha, digest); + if (memcmp(digest, p->shaDigest, SHA256_DIGEST_SIZE) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX_CRC: + { + if (p->pos < 4) + { + (*srcLen)++; + p->buf[p->pos++] = *src++; + } + else + { + p->state = XZ_STATE_STREAM_FOOTER; + p->pos = 0; + if (CRC_GET_DIGEST(p->crc) != GetUi32(p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_FOOTER: + { + UInt32 cur = XZ_STREAM_FOOTER_SIZE - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + if (p->pos == XZ_STREAM_FOOTER_SIZE) + { + p->state = XZ_STATE_STREAM_PADDING; + p->numStreams++; + p->padSize = 0; + if (!Xz_CheckFooter(p->streamFlags, p->indexSize, p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_PADDING: + { + if (*src != 0) + { + if (((UInt32)p->padSize & 3) != 0) + return SZ_ERROR_NO_ARCHIVE; + p->pos = 0; + p->state = XZ_STATE_STREAM_HEADER; + } + else + { + (*srcLen)++; + src++; + p->padSize++; + } + break; + } + + case XZ_STATE_BLOCK: break; /* to disable GCC warning */ + } + } + /* + if (p->state == XZ_STATE_FINISHED) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; + */ +} + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p) +{ + return (p->state == XZ_STATE_STREAM_PADDING) && (((UInt32)p->padSize & 3) == 0); +} diff --git a/src/ZipLib/extlibs/lzma/XzEnc.c b/src/ZipLib/extlibs/lzma/XzEnc.c new file mode 100644 index 00000000..56cfd579 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzEnc.c @@ -0,0 +1,520 @@ +/* XzEnc.c -- Xz Encode +2011-02-07 : Igor Pavlov : Public domain */ + +#include +#include + +#include "7zCrc.h" +#include "Alloc.h" +#include "Bra.h" +#include "CpuArch.h" +#ifdef USE_SUBBLOCK +#include "Bcj3Enc.c" +#include "SbFind.c" +#include "SbEnc.c" +#endif + +#include "XzEnc.h" + +static void *SzBigAlloc(void *p, size_t size) { p = p; return BigAlloc(size); } +static void SzBigFree(void *p, void *address) { p = p; BigFree(address); } +static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree }; + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } +static ISzAlloc g_Alloc = { SzAlloc, SzFree }; + +#define XzBlock_ClearFlags(p) (p)->flags = 0; +#define XzBlock_SetNumFilters(p, n) (p)->flags |= ((n) - 1); +#define XzBlock_SetHasPackSize(p) (p)->flags |= XZ_BF_PACK_SIZE; +#define XzBlock_SetHasUnpackSize(p) (p)->flags |= XZ_BF_UNPACK_SIZE; + +static SRes WriteBytes(ISeqOutStream *s, const void *buf, UInt32 size) +{ + return (s->Write(s, buf, size) == size) ? SZ_OK : SZ_ERROR_WRITE; +} + +static SRes WriteBytesAndCrc(ISeqOutStream *s, const void *buf, UInt32 size, UInt32 *crc) +{ + *crc = CrcUpdate(*crc, buf, size); + return WriteBytes(s, buf, size); +} + +SRes Xz_WriteHeader(CXzStreamFlags f, ISeqOutStream *s) +{ + UInt32 crc; + Byte header[XZ_STREAM_HEADER_SIZE]; + memcpy(header, XZ_SIG, XZ_SIG_SIZE); + header[XZ_SIG_SIZE] = (Byte)(f >> 8); + header[XZ_SIG_SIZE + 1] = (Byte)(f & 0xFF); + crc = CrcCalc(header + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE); + SetUi32(header + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE, crc); + return WriteBytes(s, header, XZ_STREAM_HEADER_SIZE); +} + +SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s) +{ + Byte header[XZ_BLOCK_HEADER_SIZE_MAX]; + + unsigned pos = 1; + int numFilters, i; + header[pos++] = p->flags; + + if (XzBlock_HasPackSize(p)) pos += Xz_WriteVarInt(header + pos, p->packSize); + if (XzBlock_HasUnpackSize(p)) pos += Xz_WriteVarInt(header + pos, p->unpackSize); + numFilters = XzBlock_GetNumFilters(p); + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &p->filters[i]; + pos += Xz_WriteVarInt(header + pos, f->id); + pos += Xz_WriteVarInt(header + pos, f->propsSize); + memcpy(header + pos, f->props, f->propsSize); + pos += f->propsSize; + } + while((pos & 3) != 0) + header[pos++] = 0; + header[0] = (Byte)(pos >> 2); + SetUi32(header + pos, CrcCalc(header, pos)); + return WriteBytes(s, header, pos + 4); +} + +SRes Xz_WriteFooter(CXzStream *p, ISeqOutStream *s) +{ + Byte buf[32]; + UInt64 globalPos; + { + UInt32 crc = CRC_INIT_VAL; + unsigned pos = 1 + Xz_WriteVarInt(buf + 1, p->numBlocks); + size_t i; + + globalPos = pos; + buf[0] = 0; + RINOK(WriteBytesAndCrc(s, buf, pos, &crc)); + for (i = 0; i < p->numBlocks; i++) + { + const CXzBlockSizes *block = &p->blocks[i]; + pos = Xz_WriteVarInt(buf, block->totalSize); + pos += Xz_WriteVarInt(buf + pos, block->unpackSize); + globalPos += pos; + RINOK(WriteBytesAndCrc(s, buf, pos, &crc)); + } + pos = ((unsigned)globalPos & 3); + if (pos != 0) + { + buf[0] = buf[1] = buf[2] = 0; + RINOK(WriteBytesAndCrc(s, buf, 4 - pos, &crc)); + globalPos += 4 - pos; + } + { + SetUi32(buf, CRC_GET_DIGEST(crc)); + RINOK(WriteBytes(s, buf, 4)); + globalPos += 4; + } + } + + { + UInt32 indexSize = (UInt32)((globalPos >> 2) - 1); + SetUi32(buf + 4, indexSize); + buf[8] = (Byte)(p->flags >> 8); + buf[9] = (Byte)(p->flags & 0xFF); + SetUi32(buf, CrcCalc(buf + 4, 6)); + memcpy(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE); + return WriteBytes(s, buf, 12); + } +} + +SRes Xz_AddIndexRecord(CXzStream *p, UInt64 unpackSize, UInt64 totalSize, ISzAlloc *alloc) +{ + if (p->blocks == 0 || p->numBlocksAllocated == p->numBlocks) + { + size_t num = (p->numBlocks + 1) * 2; + size_t newSize = sizeof(CXzBlockSizes) * num; + CXzBlockSizes *blocks; + if (newSize / sizeof(CXzBlockSizes) != num) + return SZ_ERROR_MEM; + blocks = alloc->Alloc(alloc, newSize); + if (blocks == 0) + return SZ_ERROR_MEM; + if (p->numBlocks != 0) + { + memcpy(blocks, p->blocks, p->numBlocks * sizeof(CXzBlockSizes)); + Xz_Free(p, alloc); + } + p->blocks = blocks; + p->numBlocksAllocated = num; + } + { + CXzBlockSizes *block = &p->blocks[p->numBlocks++]; + block->totalSize = totalSize; + block->unpackSize = unpackSize; + } + return SZ_OK; +} + +/* ---------- CSeqCheckInStream ---------- */ + +typedef struct +{ + ISeqInStream p; + ISeqInStream *realStream; + UInt64 processed; + CXzCheck check; +} CSeqCheckInStream; + +void SeqCheckInStream_Init(CSeqCheckInStream *p, int mode) +{ + p->processed = 0; + XzCheck_Init(&p->check, mode); +} + +void SeqCheckInStream_GetDigest(CSeqCheckInStream *p, Byte *digest) +{ + XzCheck_Final(&p->check, digest); +} + +static SRes SeqCheckInStream_Read(void *pp, void *data, size_t *size) +{ + CSeqCheckInStream *p = (CSeqCheckInStream *)pp; + SRes res = p->realStream->Read(p->realStream, data, size); + XzCheck_Update(&p->check, data, *size); + p->processed += *size; + return res; +} + +/* ---------- CSeqSizeOutStream ---------- */ + +typedef struct +{ + ISeqOutStream p; + ISeqOutStream *realStream; + UInt64 processed; +} CSeqSizeOutStream; + +static size_t MyWrite(void *pp, const void *data, size_t size) +{ + CSeqSizeOutStream *p = (CSeqSizeOutStream *)pp; + size = p->realStream->Write(p->realStream, data, size); + p->processed += size; + return size; +} + +/* ---------- CSeqInFilter ---------- */ + +#define FILTER_BUF_SIZE (1 << 20) + +typedef struct +{ + ISeqInStream p; + ISeqInStream *realStream; + IStateCoder StateCoder; + Byte *buf; + size_t curPos; + size_t endPos; + int srcWasFinished; +} CSeqInFilter; + +static SRes SeqInFilter_Read(void *pp, void *data, size_t *size) +{ + CSeqInFilter *p = (CSeqInFilter *)pp; + size_t sizeOriginal = *size; + if (sizeOriginal == 0) + return S_OK; + *size = 0; + for (;;) + { + if (!p->srcWasFinished && p->curPos == p->endPos) + { + p->curPos = 0; + p->endPos = FILTER_BUF_SIZE; + RINOK(p->realStream->Read(p->realStream, p->buf, &p->endPos)); + if (p->endPos == 0) + p->srcWasFinished = 1; + } + { + SizeT srcLen = p->endPos - p->curPos; + int wasFinished; + SRes res; + *size = sizeOriginal; + res = p->StateCoder.Code(p->StateCoder.p, data, size, p->buf + p->curPos, &srcLen, + p->srcWasFinished, CODER_FINISH_ANY, &wasFinished); + p->curPos += srcLen; + if (*size != 0 || srcLen == 0 || res != 0) + return res; + } + } +} + +static void SeqInFilter_Construct(CSeqInFilter *p) +{ + p->buf = NULL; + p->p.Read = SeqInFilter_Read; +} + +static void SeqInFilter_Free(CSeqInFilter *p) +{ + if (p->buf) + { + g_Alloc.Free(&g_Alloc, p->buf); + p->buf = NULL; + } +} + +SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAlloc *alloc); + +static SRes SeqInFilter_Init(CSeqInFilter *p, const CXzFilter *props) +{ + if (!p->buf) + { + p->buf = g_Alloc.Alloc(&g_Alloc, FILTER_BUF_SIZE); + if (!p->buf) + return SZ_ERROR_MEM; + } + p->curPos = p->endPos = 0; + p->srcWasFinished = 0; + RINOK(BraState_SetFromMethod(&p->StateCoder, props->id, 1, &g_Alloc)); + RINOK(p->StateCoder.SetProps(p->StateCoder.p, props->props, props->propsSize, &g_Alloc)); + p->StateCoder.Init(p->StateCoder.p); + return S_OK; +} + +/* ---------- CSbEncInStream ---------- */ + +#ifdef USE_SUBBLOCK + +typedef struct +{ + ISeqInStream p; + ISeqInStream *inStream; + CSbEnc enc; +} CSbEncInStream; + +static SRes SbEncInStream_Read(void *pp, void *data, size_t *size) +{ + CSbEncInStream *p = (CSbEncInStream *)pp; + size_t sizeOriginal = *size; + if (sizeOriginal == 0) + return S_OK; + for (;;) + { + if (p->enc.needRead && !p->enc.readWasFinished) + { + size_t processed = p->enc.needReadSizeMax; + RINOK(p->inStream->Read(p->inStream, p->enc.buf + p->enc.readPos, &processed)); + p->enc.readPos += processed; + if (processed == 0) + { + p->enc.readWasFinished = True; + p->enc.isFinalFinished = True; + } + p->enc.needRead = False; + } + *size = sizeOriginal; + RINOK(SbEnc_Read(&p->enc, data, size)); + if (*size != 0 || !p->enc.needRead) + return S_OK; + } +} + +void SbEncInStream_Construct(CSbEncInStream *p, ISzAlloc *alloc) +{ + SbEnc_Construct(&p->enc, alloc); + p->p.Read = SbEncInStream_Read; +} + +SRes SbEncInStream_Init(CSbEncInStream *p) +{ + return SbEnc_Init(&p->enc); +} + +void SbEncInStream_Free(CSbEncInStream *p) +{ + SbEnc_Free(&p->enc); +} + +#endif + + +typedef struct +{ + CLzma2EncHandle lzma2; + #ifdef USE_SUBBLOCK + CSbEncInStream sb; + #endif + CSeqInFilter filter; + ISzAlloc *alloc; + ISzAlloc *bigAlloc; +} CLzma2WithFilters; + + +static void Lzma2WithFilters_Construct(CLzma2WithFilters *p, ISzAlloc *alloc, ISzAlloc *bigAlloc) +{ + p->alloc = alloc; + p->bigAlloc = bigAlloc; + p->lzma2 = NULL; + #ifdef USE_SUBBLOCK + SbEncInStream_Construct(&p->sb, alloc); + #endif + SeqInFilter_Construct(&p->filter); +} + +static SRes Lzma2WithFilters_Create(CLzma2WithFilters *p) +{ + p->lzma2 = Lzma2Enc_Create(p->alloc, p->bigAlloc); + if (p->lzma2 == 0) + return SZ_ERROR_MEM; + return SZ_OK; +} + +static void Lzma2WithFilters_Free(CLzma2WithFilters *p) +{ + SeqInFilter_Free(&p->filter); + #ifdef USE_SUBBLOCK + SbEncInStream_Free(&p->sb); + #endif + if (p->lzma2) + { + Lzma2Enc_Destroy(p->lzma2); + p->lzma2 = NULL; + } +} + +void XzProps_Init(CXzProps *p) +{ + p->lzma2Props = 0; + p->filterProps = 0; + p->checkId = XZ_CHECK_CRC32; +} + +void XzFilterProps_Init(CXzFilterProps *p) +{ + p->id = 0; + p->delta = 0; + p->ip= 0; + p->ipDefined = False; +} + +static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf, + ISeqOutStream *outStream, ISeqInStream *inStream, + const CXzProps *props, ICompressProgress *progress) +{ + xz->flags = (Byte)props->checkId; + + RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, props->lzma2Props)); + RINOK(Xz_WriteHeader(xz->flags, outStream)); + + { + CSeqCheckInStream checkInStream; + CSeqSizeOutStream seqSizeOutStream; + CXzBlock block; + int filterIndex = 0; + CXzFilter *filter = NULL; + const CXzFilterProps *fp = props->filterProps; + + XzBlock_ClearFlags(&block); + XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0)); + + if (fp) + { + filter = &block.filters[filterIndex++]; + filter->id = fp->id; + filter->propsSize = 0; + if (fp->id == XZ_ID_Delta) + { + filter->props[0] = (Byte)(fp->delta - 1); + filter->propsSize = 1; + } + else if (fp->ipDefined) + { + SetUi32(filter->props, fp->ip); + filter->propsSize = 4; + } + } + + { + CXzFilter *f = &block.filters[filterIndex++]; + f->id = XZ_ID_LZMA2; + f->propsSize = 1; + f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2); + } + + seqSizeOutStream.p.Write = MyWrite; + seqSizeOutStream.realStream = outStream; + seqSizeOutStream.processed = 0; + + RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p)); + + checkInStream.p.Read = SeqCheckInStream_Read; + checkInStream.realStream = inStream; + SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags)); + + if (fp) + { + #ifdef USE_SUBBLOCK + if (fp->id == XZ_ID_Subblock) + { + lzmaf->sb.inStream = &checkInStream.p; + RINOK(SbEncInStream_Init(&lzmaf->sb)); + } + else + #endif + { + lzmaf->filter.realStream = &checkInStream.p; + RINOK(SeqInFilter_Init(&lzmaf->filter, filter)); + } + } + + { + UInt64 packPos = seqSizeOutStream.processed; + SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p, + fp ? + #ifdef USE_SUBBLOCK + (fp->id == XZ_ID_Subblock) ? &lzmaf->sb.p: + #endif + &lzmaf->filter.p: + &checkInStream.p, + progress); + RINOK(res); + block.unpackSize = checkInStream.processed; + block.packSize = seqSizeOutStream.processed - packPos; + } + + { + unsigned padSize = 0; + Byte buf[128]; + while((((unsigned)block.packSize + padSize) & 3) != 0) + buf[padSize++] = 0; + SeqCheckInStream_GetDigest(&checkInStream, buf + padSize); + RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags))); + RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc)); + } + } + return Xz_WriteFooter(xz, outStream); +} + +SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, + const CXzProps *props, ICompressProgress *progress) +{ + SRes res; + CXzStream xz; + CLzma2WithFilters lzmaf; + Xz_Construct(&xz); + Lzma2WithFilters_Construct(&lzmaf, &g_Alloc, &g_BigAlloc); + res = Lzma2WithFilters_Create(&lzmaf); + if (res == SZ_OK) + res = Xz_Compress(&xz, &lzmaf, outStream, inStream, props, progress); + Lzma2WithFilters_Free(&lzmaf); + Xz_Free(&xz, &g_Alloc); + return res; +} + +SRes Xz_EncodeEmpty(ISeqOutStream *outStream) +{ + SRes res; + CXzStream xz; + Xz_Construct(&xz); + res = Xz_WriteHeader(xz.flags, outStream); + if (res == SZ_OK) + res = Xz_WriteFooter(&xz, outStream); + Xz_Free(&xz, &g_Alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/XzEnc.h b/src/ZipLib/extlibs/lzma/XzEnc.h new file mode 100644 index 00000000..c3c19eca --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzEnc.h @@ -0,0 +1,39 @@ +/* XzEnc.h -- Xz Encode +2011-02-07 : Igor Pavlov : Public domain */ + +#ifndef __XZ_ENC_H +#define __XZ_ENC_H + +#include "Lzma2Enc.h" + +#include "Xz.h" + +EXTERN_C_BEGIN + +typedef struct +{ + UInt32 id; + UInt32 delta; + UInt32 ip; + int ipDefined; +} CXzFilterProps; + +void XzFilterProps_Init(CXzFilterProps *p); + +typedef struct +{ + const CLzma2EncProps *lzma2Props; + const CXzFilterProps *filterProps; + unsigned checkId; +} CXzProps; + +void XzProps_Init(CXzProps *p); + +SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, + const CXzProps *props, ICompressProgress *progress); + +SRes Xz_EncodeEmpty(ISeqOutStream *outStream); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/XzIn.c b/src/ZipLib/extlibs/lzma/XzIn.c new file mode 100644 index 00000000..4ba87a2c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/XzIn.c @@ -0,0 +1,305 @@ +/* XzIn.c - Xz input +2011-02-01 : Igor Pavlov : Public domain */ + +#include + +#include "7zCrc.h" +#include "CpuArch.h" +#include "Xz.h" + +SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream) +{ + Byte sig[XZ_STREAM_HEADER_SIZE]; + RINOK(SeqInStream_Read2(inStream, sig, XZ_STREAM_HEADER_SIZE, SZ_ERROR_NO_ARCHIVE)); + if (memcmp(sig, XZ_SIG, XZ_SIG_SIZE) != 0) + return SZ_ERROR_NO_ARCHIVE; + return Xz_ParseHeader(p, sig); +} + +#define READ_VARINT_AND_CHECK(buf, pos, size, res) \ + { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \ + if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; } + +SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes) +{ + Byte header[XZ_BLOCK_HEADER_SIZE_MAX]; + unsigned headerSize; + *headerSizeRes = 0; + RINOK(SeqInStream_ReadByte(inStream, &header[0])); + headerSize = ((unsigned)header[0] << 2) + 4; + if (headerSize == 0) + { + *headerSizeRes = 1; + *isIndex = True; + return SZ_OK; + } + + *isIndex = False; + *headerSizeRes = headerSize; + RINOK(SeqInStream_Read(inStream, header + 1, headerSize - 1)); + return XzBlock_Parse(p, header); +} + +#define ADD_SIZE_CHECH(size, val) \ + { UInt64 newSize = size + (val); if (newSize < size) return XZ_SIZE_OVERFLOW; size = newSize; } + +UInt64 Xz_GetUnpackSize(const CXzStream *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->numBlocks; i++) + ADD_SIZE_CHECH(size, p->blocks[i].unpackSize); + return size; +} + +UInt64 Xz_GetPackSize(const CXzStream *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->numBlocks; i++) + ADD_SIZE_CHECH(size, (p->blocks[i].totalSize + 3) & ~(UInt64)3); + return size; +} + +/* +SRes XzBlock_ReadFooter(CXzBlock *p, CXzStreamFlags f, ISeqInStream *inStream) +{ + return SeqInStream_Read(inStream, p->check, XzFlags_GetCheckSize(f)); +} +*/ + +static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc) +{ + size_t i, numBlocks, crcStartPos, pos = 1; + UInt32 crc; + + if (size < 5 || buf[0] != 0) + return SZ_ERROR_ARCHIVE; + + size -= 4; + crc = CrcCalc(buf, size); + if (crc != GetUi32(buf + size)) + return SZ_ERROR_ARCHIVE; + + { + UInt64 numBlocks64; + READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64); + numBlocks = (size_t)numBlocks64; + if (numBlocks != numBlocks64 || numBlocks * 2 > size) + return SZ_ERROR_ARCHIVE; + } + + crcStartPos = pos; + Xz_Free(p, alloc); + if (numBlocks != 0) + { + p->numBlocks = numBlocks; + p->numBlocksAllocated = numBlocks; + p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks); + if (p->blocks == 0) + return SZ_ERROR_MEM; + for (i = 0; i < numBlocks; i++) + { + CXzBlockSizes *block = &p->blocks[i]; + READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize); + READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize); + if (block->totalSize == 0) + return SZ_ERROR_ARCHIVE; + } + } + while ((pos & 3) != 0) + if (buf[pos++] != 0) + return SZ_ERROR_ARCHIVE; + return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE; +} + +static SRes Xz_ReadIndex(CXzStream *p, ILookInStream *stream, UInt64 indexSize, ISzAlloc *alloc) +{ + SRes res; + size_t size; + Byte *buf; + if (indexSize > ((UInt32)1 << 31)) + return SZ_ERROR_UNSUPPORTED; + size = (size_t)indexSize; + if (size != indexSize) + return SZ_ERROR_UNSUPPORTED; + buf = alloc->Alloc(alloc, size); + if (buf == 0) + return SZ_ERROR_MEM; + res = LookInStream_Read2(stream, buf, size, SZ_ERROR_UNSUPPORTED); + if (res == SZ_OK) + res = Xz_ReadIndex2(p, buf, size, alloc); + alloc->Free(alloc, buf); + return res; +} + +static SRes SeekFromCur(ILookInStream *inStream, Int64 *res) +{ + return inStream->Seek(inStream, res, SZ_SEEK_CUR); +} + +static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOffset, ISzAlloc *alloc) +{ + UInt64 indexSize; + Byte buf[XZ_STREAM_FOOTER_SIZE]; + + if ((*startOffset & 3) != 0 || *startOffset < XZ_STREAM_FOOTER_SIZE) + return SZ_ERROR_NO_ARCHIVE; + *startOffset = -XZ_STREAM_FOOTER_SIZE; + RINOK(SeekFromCur(stream, startOffset)); + + RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE)); + + if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0) + { + UInt32 total = 0; + *startOffset += XZ_STREAM_FOOTER_SIZE; + for (;;) + { + size_t i; + #define TEMP_BUF_SIZE (1 << 10) + Byte tempBuf[TEMP_BUF_SIZE]; + if (*startOffset < XZ_STREAM_FOOTER_SIZE || total > (1 << 16)) + return SZ_ERROR_NO_ARCHIVE; + i = (*startOffset > TEMP_BUF_SIZE) ? TEMP_BUF_SIZE : (size_t)*startOffset; + total += (UInt32)i; + *startOffset = -(Int64)i; + RINOK(SeekFromCur(stream, startOffset)); + RINOK(LookInStream_Read2(stream, tempBuf, i, SZ_ERROR_NO_ARCHIVE)); + for (; i != 0; i--) + if (tempBuf[i - 1] != 0) + break; + if (i != 0) + { + if ((i & 3) != 0) + return SZ_ERROR_NO_ARCHIVE; + *startOffset += i; + break; + } + } + if (*startOffset < XZ_STREAM_FOOTER_SIZE) + return SZ_ERROR_NO_ARCHIVE; + *startOffset -= XZ_STREAM_FOOTER_SIZE; + RINOK(stream->Seek(stream, startOffset, SZ_SEEK_SET)); + RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE)); + if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0) + return SZ_ERROR_NO_ARCHIVE; + } + + p->flags = (CXzStreamFlags)GetBe16(buf + 8); + + if (!XzFlags_IsSupported(p->flags)) + return SZ_ERROR_UNSUPPORTED; + + if (GetUi32(buf) != CrcCalc(buf + 4, 6)) + return SZ_ERROR_ARCHIVE; + + indexSize = ((UInt64)GetUi32(buf + 4) + 1) << 2; + + *startOffset = -(Int64)(indexSize + XZ_STREAM_FOOTER_SIZE); + RINOK(SeekFromCur(stream, startOffset)); + + RINOK(Xz_ReadIndex(p, stream, indexSize, alloc)); + + { + UInt64 totalSize = Xz_GetPackSize(p); + UInt64 sum = XZ_STREAM_HEADER_SIZE + totalSize + indexSize; + if (totalSize == XZ_SIZE_OVERFLOW || + sum >= ((UInt64)1 << 63) || + totalSize >= ((UInt64)1 << 63)) + return SZ_ERROR_ARCHIVE; + *startOffset = -(Int64)sum; + RINOK(SeekFromCur(stream, startOffset)); + } + { + CXzStreamFlags headerFlags; + CSecToRead secToRead; + SecToRead_CreateVTable(&secToRead); + secToRead.realStream = stream; + + RINOK(Xz_ReadHeader(&headerFlags, &secToRead.s)); + return (p->flags == headerFlags) ? SZ_OK : SZ_ERROR_ARCHIVE; + } +} + + +/* ---------- Xz Streams ---------- */ + +void Xzs_Construct(CXzs *p) +{ + p->num = p->numAllocated = 0; + p->streams = 0; +} + +void Xzs_Free(CXzs *p, ISzAlloc *alloc) +{ + size_t i; + for (i = 0; i < p->num; i++) + Xz_Free(&p->streams[i], alloc); + alloc->Free(alloc, p->streams); + p->num = p->numAllocated = 0; + p->streams = 0; +} + +UInt64 Xzs_GetNumBlocks(const CXzs *p) +{ + UInt64 num = 0; + size_t i; + for (i = 0; i < p->num; i++) + num += p->streams[i].numBlocks; + return num; +} + +UInt64 Xzs_GetUnpackSize(const CXzs *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->num; i++) + ADD_SIZE_CHECH(size, Xz_GetUnpackSize(&p->streams[i])); + return size; +} + +/* +UInt64 Xzs_GetPackSize(const CXzs *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->num; i++) + ADD_SIZE_CHECH(size, Xz_GetTotalSize(&p->streams[i])); + return size; +} +*/ + +SRes Xzs_ReadBackward(CXzs *p, ILookInStream *stream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc) +{ + Int64 endOffset = 0; + RINOK(stream->Seek(stream, &endOffset, SZ_SEEK_END)); + *startOffset = endOffset; + for (;;) + { + CXzStream st; + SRes res; + Xz_Construct(&st); + res = Xz_ReadBackward(&st, stream, startOffset, alloc); + st.startOffset = *startOffset; + RINOK(res); + if (p->num == p->numAllocated) + { + size_t newNum = p->num + p->num / 4 + 1; + Byte *data = (Byte *)alloc->Alloc(alloc, newNum * sizeof(CXzStream)); + if (data == 0) + return SZ_ERROR_MEM; + p->numAllocated = newNum; + memcpy(data, p->streams, p->num * sizeof(CXzStream)); + alloc->Free(alloc, p->streams); + p->streams = (CXzStream *)data; + } + p->streams[p->num++] = st; + if (*startOffset == 0) + break; + RINOK(stream->Seek(stream, startOffset, SZ_SEEK_SET)); + if (progress && progress->Progress(progress, endOffset - *startOffset, (UInt64)(Int64)-1) != SZ_OK) + return SZ_ERROR_PROGRESS; + } + return SZ_OK; +} diff --git a/src/ZipLib/extlibs/lzma/lzma.vcxproj b/src/ZipLib/extlibs/lzma/lzma.vcxproj new file mode 100644 index 00000000..ec9caa4a --- /dev/null +++ b/src/ZipLib/extlibs/lzma/lzma.vcxproj @@ -0,0 +1,226 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9} + Win32Proj + lzma + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/lzma/lzma.vcxproj.filters b/src/ZipLib/extlibs/lzma/lzma.vcxproj.filters new file mode 100644 index 00000000..a11100bc --- /dev/null +++ b/src/ZipLib/extlibs/lzma/lzma.vcxproj.filters @@ -0,0 +1,219 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/lzma/unix/7zBuf.h b/src/ZipLib/extlibs/lzma/unix/7zBuf.h new file mode 100644 index 00000000..e9f2f316 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zBuf.h @@ -0,0 +1,39 @@ +/* 7zBuf.h -- Byte Buffer +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __7Z_BUF_H +#define __7Z_BUF_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + Byte *data; + size_t size; +} CBuf; + +void Buf_Init(CBuf *p); +int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); +void Buf_Free(CBuf *p, ISzAlloc *alloc); + +typedef struct +{ + Byte *data; + size_t size; + size_t pos; +} CDynBuf; + +void DynBuf_Construct(CDynBuf *p); +void DynBuf_SeekToBeg(CDynBuf *p); +int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); +void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/7zBuf2.c b/src/ZipLib/extlibs/lzma/unix/7zBuf2.c new file mode 100644 index 00000000..8d17e0dc --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zBuf2.c @@ -0,0 +1,45 @@ +/* 7zBuf2.c -- Byte Buffer +2008-10-04 : Igor Pavlov : Public domain */ + +#include +#include "7zBuf.h" + +void DynBuf_Construct(CDynBuf *p) +{ + p->data = 0; + p->size = 0; + p->pos = 0; +} + +void DynBuf_SeekToBeg(CDynBuf *p) +{ + p->pos = 0; +} + +int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) +{ + if (size > p->size - p->pos) + { + size_t newSize = p->pos + size; + Byte *data; + newSize += newSize / 4; + data = (Byte *)alloc->Alloc(alloc, newSize); + if (data == 0) + return 0; + p->size = newSize; + memcpy(data, p->data, p->pos); + alloc->Free(alloc, p->data); + p->data = data; + } + memcpy(p->data + p->pos, buf, size); + p->pos += size; + return 1; +} + +void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->data); + p->data = 0; + p->size = 0; + p->pos = 0; +} diff --git a/src/ZipLib/extlibs/lzma/unix/7zCrc.c b/src/ZipLib/extlibs/lzma/unix/7zCrc.c new file mode 100644 index 00000000..404090ef --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zCrc.c @@ -0,0 +1,76 @@ +/* 7zCrc.c -- CRC32 calculation +2009-11-23 : Igor Pavlov : Public domain */ + +#include "7zCrc.h" +#include "CpuArch.h" + +#define kCrcPoly 0xEDB88320 + +#ifdef MY_CPU_LE +#define CRC_NUM_TABLES 8 +#else +#define CRC_NUM_TABLES 1 +#endif + +typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table); + +static CRC_FUNC g_CrcUpdate; +UInt32 g_CrcTable[256 * CRC_NUM_TABLES]; + +#if CRC_NUM_TABLES == 1 + +#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +static UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + const Byte *p = (const Byte *)data; + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + return v; +} + +#else + +UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table); +UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table); + +#endif + +UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size) +{ + return g_CrcUpdate(v, data, size, g_CrcTable); +} + +UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size) +{ + return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL; +} + +void MY_FAST_CALL CrcGenerateTable() +{ + UInt32 i; + for (i = 0; i < 256; i++) + { + UInt32 r = i; + unsigned j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); + g_CrcTable[i] = r; + } + #if CRC_NUM_TABLES == 1 + g_CrcUpdate = CrcUpdateT1; + #else + for (; i < 256 * CRC_NUM_TABLES; i++) + { + UInt32 r = g_CrcTable[i - 256]; + g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8); + } + g_CrcUpdate = CrcUpdateT4; +/* FIXME + #ifdef MY_CPU_X86_OR_AMD64 + if (!CPU_Is_InOrder()) + g_CrcUpdate = CrcUpdateT8; + #endif +*/ + #endif +} diff --git a/src/ZipLib/extlibs/lzma/unix/7zCrc.h b/src/ZipLib/extlibs/lzma/unix/7zCrc.h new file mode 100644 index 00000000..38e3e5fb --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zCrc.h @@ -0,0 +1,25 @@ +/* 7zCrc.h -- CRC32 calculation +2009-11-21 : Igor Pavlov : Public domain */ + +#ifndef __7Z_CRC_H +#define __7Z_CRC_H + +#include "Types.h" + +EXTERN_C_BEGIN + +extern UInt32 g_CrcTable[]; + +/* Call CrcGenerateTable one time before other CRC functions */ +void MY_FAST_CALL CrcGenerateTable(void); + +#define CRC_INIT_VAL 0xFFFFFFFF +#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) +#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); +UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/7zCrcOpt.c b/src/ZipLib/extlibs/lzma/unix/7zCrcOpt.c new file mode 100644 index 00000000..6c766a20 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zCrcOpt.c @@ -0,0 +1,34 @@ +/* 7zCrcOpt.c -- CRC32 calculation : optimized version +2009-11-23 : Igor Pavlov : Public domain */ + +#include "CpuArch.h" + +#ifdef MY_CPU_LE + +#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + for (; size >= 4; size -= 4, p += 4) + { + v ^= *(const UInt32 *)p; + v = + table[0x300 + (v & 0xFF)] ^ + table[0x200 + ((v >> 8) & 0xFF)] ^ + table[0x100 + ((v >> 16) & 0xFF)] ^ + table[0x000 + ((v >> 24))]; + } + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + return v; +} + +UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) +{ + return CrcUpdateT4(v, data, size, table); +} + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/7zStream.c b/src/ZipLib/extlibs/lzma/unix/7zStream.c new file mode 100644 index 00000000..0ebb7b5f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zStream.c @@ -0,0 +1,169 @@ +/* 7zStream.c -- 7z Stream functions +2010-03-11 : Igor Pavlov : Public domain */ + +#include + +#include "Types.h" + +SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType) +{ + while (size != 0) + { + size_t processed = size; + RINOK(stream->Read(stream, buf, &processed)); + if (processed == 0) + return errorType; + buf = (void *)((Byte *)buf + processed); + size -= processed; + } + return SZ_OK; +} + +SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size) +{ + return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); +} + +SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf) +{ + size_t processed = 1; + RINOK(stream->Read(stream, buf, &processed)); + return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF; +} + +SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset) +{ + Int64 t = offset; + return stream->Seek(stream, &t, SZ_SEEK_SET); +} + +SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size) +{ + const void *lookBuf; + if (*size == 0) + return SZ_OK; + RINOK(stream->Look(stream, &lookBuf, size)); + memcpy(buf, lookBuf, *size); + return stream->Skip(stream, *size); +} + +SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType) +{ + while (size != 0) + { + size_t processed = size; + RINOK(stream->Read(stream, buf, &processed)); + if (processed == 0) + return errorType; + buf = (void *)((Byte *)buf + processed); + size -= processed; + } + return SZ_OK; +} + +SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size) +{ + return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF); +} + +static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size) +{ + SRes res = SZ_OK; + CLookToRead *p = (CLookToRead *)pp; + size_t size2 = p->size - p->pos; + if (size2 == 0 && *size > 0) + { + p->pos = 0; + size2 = LookToRead_BUF_SIZE; + res = p->realStream->Read(p->realStream, p->buf, &size2); + p->size = size2; + } + if (size2 < *size) + *size = size2; + *buf = p->buf + p->pos; + return res; +} + +static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size) +{ + SRes res = SZ_OK; + CLookToRead *p = (CLookToRead *)pp; + size_t size2 = p->size - p->pos; + if (size2 == 0 && *size > 0) + { + p->pos = 0; + if (*size > LookToRead_BUF_SIZE) + *size = LookToRead_BUF_SIZE; + res = p->realStream->Read(p->realStream, p->buf, size); + size2 = p->size = *size; + } + if (size2 < *size) + *size = size2; + *buf = p->buf + p->pos; + return res; +} + +static SRes LookToRead_Skip(void *pp, size_t offset) +{ + CLookToRead *p = (CLookToRead *)pp; + p->pos += offset; + return SZ_OK; +} + +static SRes LookToRead_Read(void *pp, void *buf, size_t *size) +{ + CLookToRead *p = (CLookToRead *)pp; + size_t rem = p->size - p->pos; + if (rem == 0) + return p->realStream->Read(p->realStream, buf, size); + if (rem > *size) + rem = *size; + memcpy(buf, p->buf + p->pos, rem); + p->pos += rem; + *size = rem; + return SZ_OK; +} + +static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin) +{ + CLookToRead *p = (CLookToRead *)pp; + p->pos = p->size = 0; + return p->realStream->Seek(p->realStream, pos, origin); +} + +void LookToRead_CreateVTable(CLookToRead *p, int lookahead) +{ + p->s.Look = lookahead ? + LookToRead_Look_Lookahead : + LookToRead_Look_Exact; + p->s.Skip = LookToRead_Skip; + p->s.Read = LookToRead_Read; + p->s.Seek = LookToRead_Seek; +} + +void LookToRead_Init(CLookToRead *p) +{ + p->pos = p->size = 0; +} + +static SRes SecToLook_Read(void *pp, void *buf, size_t *size) +{ + CSecToLook *p = (CSecToLook *)pp; + return LookInStream_LookRead(p->realStream, buf, size); +} + +void SecToLook_CreateVTable(CSecToLook *p) +{ + p->s.Read = SecToLook_Read; +} + +static SRes SecToRead_Read(void *pp, void *buf, size_t *size) +{ + CSecToRead *p = (CSecToRead *)pp; + return p->realStream->Read(p->realStream, buf, size); +} + +void SecToRead_CreateVTable(CSecToRead *p) +{ + p->s.Read = SecToRead_Read; +} diff --git a/src/ZipLib/extlibs/lzma/unix/7zVersion.h b/src/ZipLib/extlibs/lzma/unix/7zVersion.h new file mode 100644 index 00000000..9d99c5df --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/7zVersion.h @@ -0,0 +1,7 @@ +#define MY_VER_MAJOR 9 +#define MY_VER_MINOR 20 +#define MY_VER_BUILD 0 +#define MY_VERSION "9.20" +#define MY_DATE "2010-11-18" +#define MY_COPYRIGHT ": Igor Pavlov : Public domain" +#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE diff --git a/src/ZipLib/extlibs/lzma/unix/Aes.c b/src/ZipLib/extlibs/lzma/unix/Aes.c new file mode 100644 index 00000000..1bb65879 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Aes.c @@ -0,0 +1,284 @@ +/* Aes.c -- AES encryption / decryption +2009-11-23 : Igor Pavlov : Public domain */ + +#include "Aes.h" +#include "CpuArch.h" + +static UInt32 T[256 * 4]; +static Byte Sbox[256] = { + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; + +void MY_FAST_CALL AesCbc_Encode(UInt32 *ivAes, Byte *data, size_t numBlocks); +void MY_FAST_CALL AesCbc_Decode(UInt32 *ivAes, Byte *data, size_t numBlocks); +void MY_FAST_CALL AesCtr_Code(UInt32 *ivAes, Byte *data, size_t numBlocks); + +void MY_FAST_CALL AesCbc_Encode_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks); +void MY_FAST_CALL AesCbc_Decode_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks); +void MY_FAST_CALL AesCtr_Code_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks); + +AES_CODE_FUNC g_AesCbc_Encode; +AES_CODE_FUNC g_AesCbc_Decode; +AES_CODE_FUNC g_AesCtr_Code; + +static UInt32 D[256 * 4]; +static Byte InvS[256]; + +static Byte Rcon[11] = { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 }; + +#define xtime(x) ((((x) << 1) ^ (((x) & 0x80) != 0 ? 0x1B : 0)) & 0xFF) + +#define Ui32(a0, a1, a2, a3) ((UInt32)(a0) | ((UInt32)(a1) << 8) | ((UInt32)(a2) << 16) | ((UInt32)(a3) << 24)) + +#define gb0(x) ( (x) & 0xFF) +#define gb1(x) (((x) >> ( 8)) & 0xFF) +#define gb2(x) (((x) >> (16)) & 0xFF) +#define gb3(x) (((x) >> (24)) & 0xFF) + +void AesGenTables(void) +{ + unsigned i; + for (i = 0; i < 256; i++) + InvS[Sbox[i]] = (Byte)i; + for (i = 0; i < 256; i++) + { + { + UInt32 a1 = Sbox[i]; + UInt32 a2 = xtime(a1); + UInt32 a3 = a2 ^ a1; + T[ i] = Ui32(a2, a1, a1, a3); + T[0x100 + i] = Ui32(a3, a2, a1, a1); + T[0x200 + i] = Ui32(a1, a3, a2, a1); + T[0x300 + i] = Ui32(a1, a1, a3, a2); + } + { + UInt32 a1 = InvS[i]; + UInt32 a2 = xtime(a1); + UInt32 a4 = xtime(a2); + UInt32 a8 = xtime(a4); + UInt32 a9 = a8 ^ a1; + UInt32 aB = a8 ^ a2 ^ a1; + UInt32 aD = a8 ^ a4 ^ a1; + UInt32 aE = a8 ^ a4 ^ a2; + D[ i] = Ui32(aE, a9, aD, aB); + D[0x100 + i] = Ui32(aB, aE, a9, aD); + D[0x200 + i] = Ui32(aD, aB, aE, a9); + D[0x300 + i] = Ui32(a9, aD, aB, aE); + } + } + g_AesCbc_Encode = AesCbc_Encode; + g_AesCbc_Decode = AesCbc_Decode; + g_AesCtr_Code = AesCtr_Code; +/* FIXME + #ifdef MY_CPU_X86_OR_AMD64 + if (CPU_Is_Aes_Supported()) + { + g_AesCbc_Encode = AesCbc_Encode_Intel; + g_AesCbc_Decode = AesCbc_Decode_Intel; + g_AesCtr_Code = AesCtr_Code_Intel; + } + #endif +*/ +} + +#define HT(i, x, s) (T + (x << 8))[gb ## x(s[(i + x) & 3])] +#define HT4(m, i, s, p) m[i] = \ + HT(i, 0, s) ^ \ + HT(i, 1, s) ^ \ + HT(i, 2, s) ^ \ + HT(i, 3, s) ^ w[p + i] +/* such order (2031) in HT16 is for VC6/K8 speed optimization) */ +#define HT16(m, s, p) \ + HT4(m, 2, s, p); \ + HT4(m, 0, s, p); \ + HT4(m, 3, s, p); \ + HT4(m, 1, s, p); \ + +#define FT(i, x) Sbox[gb ## x(m[(i + x) & 3])] +#define FT4(i) dest[i] = Ui32(FT(i, 0), FT(i, 1), FT(i, 2), FT(i, 3)) ^ w[i]; + +#define HD(i, x, s) (D + (x << 8))[gb ## x(s[(i - x) & 3])] +#define HD4(m, i, s, p) m[i] = \ + HD(i, 0, s) ^ \ + HD(i, 1, s) ^ \ + HD(i, 2, s) ^ \ + HD(i, 3, s) ^ w[p + i]; +/* such order (0231) in HD16 is for VC6/K8 speed optimization) */ +#define HD16(m, s, p) \ + HD4(m, 0, s, p); \ + HD4(m, 2, s, p); \ + HD4(m, 3, s, p); \ + HD4(m, 1, s, p); \ + +#define FD(i, x) InvS[gb ## x(m[(i - x) & 3])] +#define FD4(i) dest[i] = Ui32(FD(i, 0), FD(i, 1), FD(i, 2), FD(i, 3)) ^ w[i]; + +void MY_FAST_CALL Aes_SetKey_Enc(UInt32 *w, const Byte *key, unsigned keySize) +{ + unsigned i, wSize; + wSize = keySize + 28; + keySize /= 4; + w[0] = ((UInt32)keySize / 2) + 3; + w += 4; + + for (i = 0; i < keySize; i++, key += 4) + w[i] = GetUi32(key); + + for (; i < wSize; i++) + { + UInt32 t = w[i - 1]; + unsigned rem = i % keySize; + if (rem == 0) + t = Ui32(Sbox[gb1(t)] ^ Rcon[i / keySize], Sbox[gb2(t)], Sbox[gb3(t)], Sbox[gb0(t)]); + else if (keySize > 6 && rem == 4) + t = Ui32(Sbox[gb0(t)], Sbox[gb1(t)], Sbox[gb2(t)], Sbox[gb3(t)]); + w[i] = w[i - keySize] ^ t; + } +} + +void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize) +{ + unsigned i, num; + Aes_SetKey_Enc(w, key, keySize); + num = keySize + 20; + w += 8; + for (i = 0; i < num; i++) + { + UInt32 r = w[i]; + w[i] = + D[ Sbox[gb0(r)]] ^ + D[0x100 + Sbox[gb1(r)]] ^ + D[0x200 + Sbox[gb2(r)]] ^ + D[0x300 + Sbox[gb3(r)]]; + } +} + +/* Aes_Encode and Aes_Decode functions work with little-endian words. + src and dest are pointers to 4 UInt32 words. + arc and dest can point to same block */ + +static void Aes_Encode(const UInt32 *w, UInt32 *dest, const UInt32 *src) +{ + UInt32 s[4]; + UInt32 m[4]; + UInt32 numRounds2 = w[0]; + w += 4; + s[0] = src[0] ^ w[0]; + s[1] = src[1] ^ w[1]; + s[2] = src[2] ^ w[2]; + s[3] = src[3] ^ w[3]; + w += 4; + for (;;) + { + HT16(m, s, 0); + if (--numRounds2 == 0) + break; + HT16(s, m, 4); + w += 8; + } + w += 4; + FT4(0); FT4(1); FT4(2); FT4(3); +} + +static void Aes_Decode(const UInt32 *w, UInt32 *dest, const UInt32 *src) +{ + UInt32 s[4]; + UInt32 m[4]; + UInt32 numRounds2 = w[0]; + w += 4 + numRounds2 * 8; + s[0] = src[0] ^ w[0]; + s[1] = src[1] ^ w[1]; + s[2] = src[2] ^ w[2]; + s[3] = src[3] ^ w[3]; + for (;;) + { + w -= 8; + HD16(m, s, 4); + if (--numRounds2 == 0) + break; + HD16(s, m, 0); + } + FD4(0); FD4(1); FD4(2); FD4(3); +} + +void AesCbc_Init(UInt32 *p, const Byte *iv) +{ + unsigned i; + for (i = 0; i < 4; i++) + p[i] = GetUi32(iv + i * 4); +} + +void MY_FAST_CALL AesCbc_Encode(UInt32 *p, Byte *data, size_t numBlocks) +{ + for (; numBlocks != 0; numBlocks--, data += AES_BLOCK_SIZE) + { + p[0] ^= GetUi32(data); + p[1] ^= GetUi32(data + 4); + p[2] ^= GetUi32(data + 8); + p[3] ^= GetUi32(data + 12); + + Aes_Encode(p + 4, p, p); + + SetUi32(data, p[0]); + SetUi32(data + 4, p[1]); + SetUi32(data + 8, p[2]); + SetUi32(data + 12, p[3]); + } +} + +void MY_FAST_CALL AesCbc_Decode(UInt32 *p, Byte *data, size_t numBlocks) +{ + UInt32 in[4], out[4]; + for (; numBlocks != 0; numBlocks--, data += AES_BLOCK_SIZE) + { + in[0] = GetUi32(data); + in[1] = GetUi32(data + 4); + in[2] = GetUi32(data + 8); + in[3] = GetUi32(data + 12); + + Aes_Decode(p + 4, out, in); + + SetUi32(data, p[0] ^ out[0]); + SetUi32(data + 4, p[1] ^ out[1]); + SetUi32(data + 8, p[2] ^ out[2]); + SetUi32(data + 12, p[3] ^ out[3]); + + p[0] = in[0]; + p[1] = in[1]; + p[2] = in[2]; + p[3] = in[3]; + } +} + +void MY_FAST_CALL AesCtr_Code(UInt32 *p, Byte *data, size_t numBlocks) +{ + for (; numBlocks != 0; numBlocks--) + { + UInt32 temp[4]; + Byte buf[16]; + int i; + if (++p[0] == 0) + p[1]++; + Aes_Encode(p + 4, temp, p); + SetUi32(buf, temp[0]); + SetUi32(buf + 4, temp[1]); + SetUi32(buf + 8, temp[2]); + SetUi32(buf + 12, temp[3]); + for (i = 0; i < 16; i++) + *data++ ^= buf[i]; + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/Aes.h b/src/ZipLib/extlibs/lzma/unix/Aes.h new file mode 100644 index 00000000..c9b0677c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Aes.h @@ -0,0 +1,38 @@ +/* Aes.h -- AES encryption / decryption +2009-11-23 : Igor Pavlov : Public domain */ + +#ifndef __AES_H +#define __AES_H + +#include "Types.h" + +EXTERN_C_BEGIN + +#define AES_BLOCK_SIZE 16 + +/* Call AesGenTables one time before other AES functions */ +void AesGenTables(void); + +/* UInt32 pointers must be 16-byte aligned */ + +/* 16-byte (4 * 32-bit words) blocks: 1 (IV) + 1 (keyMode) + 15 (AES-256 roundKeys) */ +#define AES_NUM_IVMRK_WORDS ((1 + 1 + 15) * 4) + +/* aes - 16-byte aligned pointer to keyMode+roundKeys sequence */ +/* keySize = 16 or 24 or 32 (bytes) */ +typedef void (MY_FAST_CALL *AES_SET_KEY_FUNC)(UInt32 *aes, const Byte *key, unsigned keySize); +void MY_FAST_CALL Aes_SetKey_Enc(UInt32 *aes, const Byte *key, unsigned keySize); +void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *aes, const Byte *key, unsigned keySize); + +/* ivAes - 16-byte aligned pointer to iv+keyMode+roundKeys sequence: UInt32[AES_NUM_IVMRK_WORDS] */ +void AesCbc_Init(UInt32 *ivAes, const Byte *iv); /* iv size is AES_BLOCK_SIZE */ +/* data - 16-byte aligned pointer to data */ +/* numBlocks - the number of 16-byte blocks in data array */ +typedef void (MY_FAST_CALL *AES_CODE_FUNC)(UInt32 *ivAes, Byte *data, size_t numBlocks); +extern AES_CODE_FUNC g_AesCbc_Encode; +extern AES_CODE_FUNC g_AesCbc_Decode; +extern AES_CODE_FUNC g_AesCtr_Code; + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Alloc.back3 b/src/ZipLib/extlibs/lzma/unix/Alloc.back3 new file mode 100644 index 00000000..a0cf8270 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Alloc.back3 @@ -0,0 +1,238 @@ +/* Alloc.c -- Memory allocation functions +2008-09-24 +Igor Pavlov +Public domain */ + +#include +#include +#include +#include + +#ifdef _7ZIP_LARGE_PAGES + +#ifdef __linux__ + +#ifndef _7ZIP_ST +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifndef SHM_HUGETLB +#warning SHM_HUGETLB undefined ? +#define SHM_HUGETLB 04000 +#endif + +/* Only ia64 requires this */ +#ifdef __ia64__ +#define ADDR (void *)(0x8000000000000000UL) +#define SHMAT_FLAGS (SHM_RND) +#else +#define ADDR (void *)(0x0UL) +#define SHMAT_FLAGS (0) +#endif + + +#endif /* __linux__ */ + +#endif /* _7ZIP_LARGE_PAGES */ + +#include "Alloc.h" + +/* #define _SZ_ALLOC_DEBUG */ + +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ +#ifdef _SZ_ALLOC_DEBUG +#include +int g_allocCount = 0; +int g_allocCountMid = 0; +int g_allocCountBig = 0; +#endif + +void *MyAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + { + void *p = malloc(size); + fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p); + return p; + } + #else + return malloc(size); + #endif +} + +void MyFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address); + #endif + free(address); +} + +#ifdef __linux__ +#define _7ZIP_MAX_HUGE_ALLOCS 64 +static void *g_HugePageAddr[_7ZIP_MAX_HUGE_ALLOCS] = { NULL }; +static void *g_HugePageShmid[_7ZIP_MAX_HUGE_ALLOCS]; +static size_t g_HugePageLen[_7ZIP_MAX_HUGE_ALLOCS]; +#endif + +static void *VirtualAlloc(void *address, size_t size, int AllocLargePages) +{ + #ifdef _7ZIP_LARGE_PAGES + if (AllocLargePages) + { + #ifdef __linux__ + /* huge pages support for Linux; added by Joachim Henke */ + #ifndef _7ZIP_ST + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + #endif + int i; + + address = NULL; + #ifndef _7ZIP_ST + pthread_mutex_lock(&mutex); + #endif + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == NULL) + { + char *shmaddr; + int shmid = shmget(2, size, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W); + if (shmid < 0) + { + fprintf(stderr,"Warning shmget : %s\n",strerror(errno)); + address = NULL; + break; + } + shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS); + if (shmaddr == (char *)-1) + { + fprintf(stderr,"Warning shmat : %s\n",strerror(errno)); + shmctl(shmid, IPC_RMID, NULL); + address = NULL; + break; + } + + g_HugePageShmid[i] = shmid; + g_HugePageLen[i] = size; + g_HugePageAddr[i] = address; +printf("HUGE[%d]=%ld %p\n",i,(long)size,address); + break; + } + } + #ifndef _7ZIP_ST + pthread_mutex_unlock(&mutex); + #endif + return address; + #endif + } + #endif + return malloc(size); +} + +static int VirtualFree(void *address) +{ + #ifdef _7ZIP_LARGE_PAGES + #ifdef __linux__ + int i; + + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == address) + { + shmdt(g_HugePageAddr[i]); + shmctl(g_HugePageLen[i], IPC_RMID, NULL); + g_HugePageAddr[i] = NULL; + return 1; + } + } + #endif + #endif + free(address); + return 1; +} + +void *MidAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++); + #endif + return VirtualAlloc(0, size, 0); +} + +void MidFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid); + #endif + if (address == 0) + return; + VirtualFree(address); +} + +#ifdef _7ZIP_LARGE_PAGES +size_t g_LargePageSize = 0; +#endif + +void SetLargePageSize() +{ +printf("SetLargePageSize : <>\n"); + #ifdef _7ZIP_LARGE_PAGES + size_t size = 0; + +#if defined(__linux__) + size = sysconf(_SC_PAGESIZE); +printf("SetLargePageSize : size=%ld\n",(long)size); + if (size == -1) size = 0; +#endif + + if (size == 0 || (size & (size - 1)) != 0) + return; + g_LargePageSize = size; +printf("SetLargePageSize : %ld\n",(long)g_LargePageSize); + #endif +} + + +void *BigAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); + #endif + + #ifdef _7ZIP_LARGE_PAGES + if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18)) + { + void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),1); +printf("BigAlloc : %ld %ld => %p\n",(long)g_LargePageSize,(long)size,res); + if (res != 0) + return res; + } + #endif + return VirtualAlloc(0, size, 0); +} + +void BigFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig); + #endif + + if (address == 0) + return; + VirtualFree(address); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Alloc.c b/src/ZipLib/extlibs/lzma/unix/Alloc.c new file mode 100644 index 00000000..be02a929 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Alloc.c @@ -0,0 +1,280 @@ +/* Alloc.c -- Memory allocation functions +2008-09-24 +Igor Pavlov +Public domain */ + +#ifdef _WIN32 +#include +#endif +#include +#include + +#ifdef _7ZIP_LARGE_PAGES +#ifdef __linux__ +#ifndef _7ZIP_ST +#include +#endif +#include +#include +#include +#include +#include +#endif +#endif + +#include "Alloc.h" + +/* #define _SZ_ALLOC_DEBUG */ + +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ +#ifdef _SZ_ALLOC_DEBUG +#include +int g_allocCount = 0; +int g_allocCountMid = 0; +int g_allocCountBig = 0; +#endif + +void *MyAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + { + void *p = malloc(size); + fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p); + return p; + } + #else + return malloc(size); + #endif +} + +void MyFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address); + #endif + free(address); +} + +#ifndef _WIN32 + +#ifdef _7ZIP_LARGE_PAGES + +#ifdef __linux__ +#define _7ZIP_MAX_HUGE_ALLOCS 64 +static void *g_HugePageAddr[_7ZIP_MAX_HUGE_ALLOCS] = { NULL }; +static size_t g_HugePageLen[_7ZIP_MAX_HUGE_ALLOCS]; +static char *g_HugetlbPath; +#endif + +#endif + +static void *VirtualAlloc(size_t size, int memLargePages) +{ + #ifdef _7ZIP_LARGE_PAGES + if (memLargePages) + { + #ifdef __linux__ + /* huge pages support for Linux; added by Joachim Henke */ + #ifndef _7ZIP_ST + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + #endif + int i; + + void * address = NULL; + #ifndef _7ZIP_ST + pthread_mutex_lock(&mutex); + #endif + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == NULL) + { + int fd, pathlen = strlen(g_HugetlbPath); + char tempname[pathlen+12]; + + memcpy(tempname, g_HugetlbPath, pathlen); + memcpy(tempname + pathlen, "/7z-XXXXXX", 11); + fd = mkstemp(tempname); + unlink(tempname); + if (fd < 0) + { + fprintf(stderr,"cant't open %s (%s)\n",tempname,strerror(errno)); + break; + } + address = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + close(fd); + if (address == MAP_FAILED) + { + address = NULL; + break; + } + g_HugePageLen[i] = size; + g_HugePageAddr[i] = address; +// fprintf(stderr,"HUGE[%d]=%ld %p\n",i,(long)size,address); + break; + } + } + #ifndef _7ZIP_ST + pthread_mutex_unlock(&mutex); + #endif + return address; + #endif + } + #endif + return malloc(size); +} + +static int VirtualFree(void *address) +{ + #ifdef _7ZIP_LARGE_PAGES + #ifdef __linux__ + int i; + + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == address) + { + munmap(address, g_HugePageLen[i]); + g_HugePageAddr[i] = NULL; + return 1; + } + } + #endif + #endif + free(address); + return 1; +} + +#endif + +void *MidAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++); + #endif + return VirtualAlloc(size, 0); +} + +void MidFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid); + #endif + if (address == 0) + return; + VirtualFree(address); +} + +#ifdef _7ZIP_LARGE_PAGES +size_t g_LargePageSize = 0; +#ifdef _WIN32 +typedef SIZE_T (WINAPI *GetLargePageMinimumP)(); +#elif defined(__linux__) +size_t largePageMinimum() +{ + size_t size; + + g_HugetlbPath = getenv("HUGETLB_PATH"); + + if (g_HugetlbPath == NULL) + { + // not defined => try to find out the directory + static char dir_hugetlbfs[1024]; + const char * filename = "/etc/mtab"; // mounted filesystems + FILE *fp; + struct mntent * info; + + dir_hugetlbfs[0]=0; + + fp = setmntent(filename,"r"); + if (fp) + { + info = getmntent(fp); + while(info) + { +/* + printf("%s:\n",info->mnt_fsname); + printf(" dir='%s'\n",info->mnt_dir); + printf(" type='%s'\n",info->mnt_type); +*/ + + if (strcmp(info->mnt_type,"hugetlbfs") == 0) + { + strcpy(dir_hugetlbfs,info->mnt_dir); + break; + } + + info = getmntent(fp); + } + endmntent(fp); + } + + if (dir_hugetlbfs[0]) + { + g_HugetlbPath = dir_hugetlbfs; + // fprintf(stderr," Found hugetlbfs = '%s'\n",g_HugetlbPath); + } + } + if (g_HugetlbPath == NULL || (size = pathconf(g_HugetlbPath, _PC_REC_MIN_XFER_SIZE)) <= getpagesize()) + return 0; + return size; +} +#else +#define largePageMinimum() 0 +#endif +#endif + +void SetLargePageSize() +{ + #ifdef _7ZIP_LARGE_PAGES + size_t size; + #ifdef _WIN32 + GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP) + GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum"); + if (largePageMinimum == 0) + return; + #endif + size = largePageMinimum(); + if (size == 0 || (size & (size - 1)) != 0) + return; + g_LargePageSize = size; + // fprintf(stderr,"SetLargePageSize : %ld\n",(long)g_LargePageSize); + #endif +} + + +void *BigAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); + #endif + + #ifdef _7ZIP_LARGE_PAGES + if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18)) + { + void *res = VirtualAlloc( (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)), 1); + if (res != 0) + return res; + } + #endif + return VirtualAlloc(size, 0); +} + +void BigFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig); + #endif + + if (address == 0) + return; + VirtualFree(address); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Alloc.c.back b/src/ZipLib/extlibs/lzma/unix/Alloc.c.back new file mode 100644 index 00000000..1916b475 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Alloc.c.back @@ -0,0 +1,243 @@ +/* Alloc.c -- Memory allocation functions +2008-09-24 +Igor Pavlov +Public domain */ + +#ifdef _WIN32 +#include +#endif +#include + +#ifdef _7ZIP_LARGE_PAGES +#ifdef __linux__ +#ifndef _7ZIP_ST +#include +#endif +#include +#include +#include +#endif +#endif + +#include "Alloc.h" + +/* #define _SZ_ALLOC_DEBUG */ + +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ +#ifdef _SZ_ALLOC_DEBUG +#include +int g_allocCount = 0; +int g_allocCountMid = 0; +int g_allocCountBig = 0; +#endif + +void *MyAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + { + void *p = malloc(size); + fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p); + return p; + } + #else + return malloc(size); + #endif +} + +void MyFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address); + #endif + free(address); +} + +#ifndef _WIN32 + +#define PAGE_READWRITE 0x04 +#define MEM_COMMIT 0x1000 +#define MEM_RELEASE 0x8000 +#ifdef _7ZIP_LARGE_PAGES +#define MEM_LARGE_PAGES 0x20000000 +#ifdef __linux__ +#define _7ZIP_MAX_HUGE_ALLOCS 64 +static void *g_HugePageAddr[_7ZIP_MAX_HUGE_ALLOCS] = { NULL }; +static size_t g_HugePageLen[_7ZIP_MAX_HUGE_ALLOCS]; +static char *g_HugetlbPath; +#endif +#endif + +static void *VirtualAlloc(void *address, size_t size, unsigned int type, unsigned int protect) +{ + #ifdef _7ZIP_LARGE_PAGES + if (type & MEM_LARGE_PAGES) + { + #ifdef __linux__ + /* huge pages support for Linux; added by Joachim Henke */ + #ifndef _7ZIP_ST + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + #endif + int i; + + address = NULL; + #ifndef _7ZIP_ST + pthread_mutex_lock(&mutex); + #endif + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == NULL) + { + int fd, pathlen = strlen(g_HugetlbPath); + char tempname[pathlen+12]; + + memcpy(tempname, g_HugetlbPath, pathlen); + memcpy(tempname + pathlen, "/7z-XXXXXX", 11); + fd = mkstemp(tempname); +printf("BigAlloc(%s)=>%d\n",tempname,fd); + unlink(tempname); + if (fd < 0) + break; + address = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + close(fd); + if (address == MAP_FAILED) + { + address = NULL; + break; + } + g_HugePageLen[i] = size; + g_HugePageAddr[i] = address; +printf("HUGE[%d]=%ld %p\n",i,(long)size,address); + break; + } + } + #ifndef _7ZIP_ST + pthread_mutex_unlock(&mutex); + #endif + return address; + #endif + } + #endif + return malloc(size); +} + +static int VirtualFree(void *address, size_t size, unsigned int type) +{ + #ifdef _7ZIP_LARGE_PAGES + #ifdef __linux__ + int i; + + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == address) + { + munmap(address, g_HugePageLen[i]); + g_HugePageAddr[i] = NULL; + return 1; + } + } + #endif + #endif + free(address); + return 1; +} + +#endif + +void *MidAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++); + #endif + return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); +} + +void MidFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid); + #endif + if (address == 0) + return; + VirtualFree(address, 0, MEM_RELEASE); +} + +#ifndef MEM_LARGE_PAGES +#undef _7ZIP_LARGE_PAGES +#endif + +#ifdef _7ZIP_LARGE_PAGES +size_t g_LargePageSize = 0; +#ifdef _WIN32 +typedef SIZE_T (WINAPI *GetLargePageMinimumP)(); +#elif defined(__linux__) +size_t largePageMinimum() +{ + size_t size; + + g_HugetlbPath = getenv("HUGETLB_PATH"); + if (g_HugetlbPath == NULL || (size = pathconf(g_HugetlbPath, _PC_REC_MIN_XFER_SIZE)) <= getpagesize()) + return 0; + return size; +} +#else +#define largePageMinimum() 0 +#endif +#endif + +void SetLargePageSize() +{ + #ifdef _7ZIP_LARGE_PAGES + size_t size; + #ifdef _WIN32 + GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP) + GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum"); + if (largePageMinimum == 0) + return; + #endif + size = largePageMinimum(); + if (size == 0 || (size & (size - 1)) != 0) + return; + g_LargePageSize = size; +printf("SetLargePageSize : %ld\n",(long)g_LargePageSize); + #endif +} + + +void *BigAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); + #endif + + #ifdef _7ZIP_LARGE_PAGES + if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18)) + { + void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)), + MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE); +printf("BigAlloc : %ld %ld => %p\n",(long)g_LargePageSize,(long)size,res); + if (res != 0) + return res; + } + #endif + return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE); +} + +void BigFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig); + #endif + + if (address == 0) + return; + VirtualFree(address, 0, MEM_RELEASE); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Alloc.c.back2 b/src/ZipLib/extlibs/lzma/unix/Alloc.c.back2 new file mode 100644 index 00000000..1ba57113 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Alloc.c.back2 @@ -0,0 +1,222 @@ +/* Alloc.c -- Memory allocation functions +2008-09-24 +Igor Pavlov +Public domain */ + +#include +#include + +#ifdef _7ZIP_LARGE_PAGES + +#ifdef __linux__ + + + +#ifndef _7ZIP_ST +#include +#endif +#include +#include +#include +#define PROTECTION (PROT_READ | PROT_WRITE) + +#ifndef MAP_HUGETLB +#error 1 +#define MAP_HUGETLB 0x40 +#endif + +/* Only ia64 requires this */ +#ifdef __ia64__ +#define ADDR (void *)(0x8000000000000000UL) +#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED) +#else +#define ADDR (void *)(0x0UL) +#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB) +#endif + + +#endif /* __linux__ */ + +#endif /* _7ZIP_LARGE_PAGES */ + +#include "Alloc.h" + +/* #define _SZ_ALLOC_DEBUG */ + +/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ +#ifdef _SZ_ALLOC_DEBUG +#include +int g_allocCount = 0; +int g_allocCountMid = 0; +int g_allocCountBig = 0; +#endif + +void *MyAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + { + void *p = malloc(size); + fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p); + return p; + } + #else + return malloc(size); + #endif +} + +void MyFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address); + #endif + free(address); +} + +#ifdef __linux__ +#define _7ZIP_MAX_HUGE_ALLOCS 64 +static void *g_HugePageAddr[_7ZIP_MAX_HUGE_ALLOCS] = { NULL }; +static size_t g_HugePageLen[_7ZIP_MAX_HUGE_ALLOCS]; +#endif + +static void *VirtualAlloc(void *address, size_t size, int AllocLargePages) +{ + #ifdef _7ZIP_LARGE_PAGES + if (AllocLargePages) + { + #ifdef __linux__ + /* huge pages support for Linux; added by Joachim Henke */ + #ifndef _7ZIP_ST + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + #endif + int i; + + address = NULL; + #ifndef _7ZIP_ST + pthread_mutex_lock(&mutex); + #endif + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == NULL) + { + address = mmap(ADDR, size, PROTECTION, FLAGS, 0, 0); + if (address == MAP_FAILED) + { + address = NULL; + break; + } + g_HugePageLen[i] = size; + g_HugePageAddr[i] = address; +printf("HUGE[%d]=%ld %p\n",i,(long)size,address); + break; + } + } + #ifndef _7ZIP_ST + pthread_mutex_unlock(&mutex); + #endif + return address; + #endif + } + #endif + return malloc(size); +} + +static int VirtualFree(void *address) +{ + #ifdef _7ZIP_LARGE_PAGES + #ifdef __linux__ + int i; + + for (i = 0; i < _7ZIP_MAX_HUGE_ALLOCS; ++i) + { + if (g_HugePageAddr[i] == address) + { + munmap(address, g_HugePageLen[i]); + g_HugePageAddr[i] = NULL; + return 1; + } + } + #endif + #endif + free(address); + return 1; +} + +void *MidAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++); + #endif + return VirtualAlloc(0, size, 0); +} + +void MidFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid); + #endif + if (address == 0) + return; + VirtualFree(address); +} + +#ifdef _7ZIP_LARGE_PAGES +size_t g_LargePageSize = 0; +#endif + +void SetLargePageSize() +{ +printf("SetLargePageSize : <>\n"); + #ifdef _7ZIP_LARGE_PAGES + size_t size = 0; + +#if defined(__linux__) + size = sysconf(_SC_PAGESIZE); +printf("SetLargePageSize : size=%ld\n",(long)size); + if (size == -1) size = 0; +#endif + + if (size == 0 || (size & (size - 1)) != 0) + return; + g_LargePageSize = size; +printf("SetLargePageSize : %ld\n",(long)g_LargePageSize); + #endif +} + + +void *BigAlloc(size_t size) +{ + if (size == 0) + return 0; + #ifdef _SZ_ALLOC_DEBUG + fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); + #endif + + #ifdef _7ZIP_LARGE_PAGES + if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18)) + { + void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),1); +printf("BigAlloc : %ld %ld => %p\n",(long)g_LargePageSize,(long)size,res); + if (res != 0) + return res; + } + #endif + return VirtualAlloc(0, size, 0); +} + +void BigFree(void *address) +{ + #ifdef _SZ_ALLOC_DEBUG + if (address != 0) + fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig); + #endif + + if (address == 0) + return; + VirtualFree(address); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Alloc.h b/src/ZipLib/extlibs/lzma/unix/Alloc.h new file mode 100644 index 00000000..7ef372e3 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Alloc.h @@ -0,0 +1,27 @@ +/* Alloc.h -- Memory allocation functions +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __COMMON_ALLOC_H +#define __COMMON_ALLOC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void *MyAlloc(size_t size); +void MyFree(void *address); + +void SetLargePageSize(); + +void *MidAlloc(size_t size); +void MidFree(void *address); +void *BigAlloc(size_t size); +void BigFree(void *address); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Bra.c b/src/ZipLib/extlibs/lzma/unix/Bra.c new file mode 100644 index 00000000..2e47b141 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Bra.c @@ -0,0 +1,133 @@ +/* Bra.c -- Converters for RISC code +2010-04-16 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + ip += 8; + for (i = 0; i <= size; i += 4) + { + if (data[i + 3] == 0xEB) + { + UInt32 dest; + UInt32 src = ((UInt32)data[i + 2] << 16) | ((UInt32)data[i + 1] << 8) | (data[i + 0]); + src <<= 2; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + dest >>= 2; + data[i + 2] = (Byte)(dest >> 16); + data[i + 1] = (Byte)(dest >> 8); + data[i + 0] = (Byte)dest; + } + } + return i; +} + +SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + ip += 4; + for (i = 0; i <= size; i += 2) + { + if ((data[i + 1] & 0xF8) == 0xF0 && + (data[i + 3] & 0xF8) == 0xF8) + { + UInt32 dest; + UInt32 src = + (((UInt32)data[i + 1] & 0x7) << 19) | + ((UInt32)data[i + 0] << 11) | + (((UInt32)data[i + 3] & 0x7) << 8) | + (data[i + 2]); + + src <<= 1; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + dest >>= 1; + + data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7)); + data[i + 0] = (Byte)(dest >> 11); + data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7)); + data[i + 2] = (Byte)dest; + i += 2; + } + } + return i; +} + +SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 4) + return 0; + size -= 4; + for (i = 0; i <= size; i += 4) + { + if ((data[i] >> 2) == 0x12 && (data[i + 3] & 3) == 1) + { + UInt32 src = ((UInt32)(data[i + 0] & 3) << 24) | + ((UInt32)data[i + 1] << 16) | + ((UInt32)data[i + 2] << 8) | + ((UInt32)data[i + 3] & (~3)); + + UInt32 dest; + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + data[i + 0] = (Byte)(0x48 | ((dest >> 24) & 0x3)); + data[i + 1] = (Byte)(dest >> 16); + data[i + 2] = (Byte)(dest >> 8); + data[i + 3] &= 0x3; + data[i + 3] |= dest; + } + } + return i; +} + +SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + UInt32 i; + if (size < 4) + return 0; + size -= 4; + for (i = 0; i <= size; i += 4) + { + if ((data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00) || + (data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)) + { + UInt32 src = + ((UInt32)data[i + 0] << 24) | + ((UInt32)data[i + 1] << 16) | + ((UInt32)data[i + 2] << 8) | + ((UInt32)data[i + 3]); + UInt32 dest; + + src <<= 2; + if (encoding) + dest = ip + i + src; + else + dest = src - (ip + i); + dest >>= 2; + + dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000; + + data[i + 0] = (Byte)(dest >> 24); + data[i + 1] = (Byte)(dest >> 16); + data[i + 2] = (Byte)(dest >> 8); + data[i + 3] = (Byte)dest; + } + } + return i; +} diff --git a/src/ZipLib/extlibs/lzma/unix/Bra.h b/src/ZipLib/extlibs/lzma/unix/Bra.h new file mode 100644 index 00000000..5748c1c0 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Bra.h @@ -0,0 +1,68 @@ +/* Bra.h -- Branch converters for executables +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __BRA_H +#define __BRA_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +These functions convert relative addresses to absolute addresses +in CALL instructions to increase the compression ratio. + + In: + data - data buffer + size - size of data + ip - current virtual Instruction Pinter (IP) value + state - state variable for x86 converter + encoding - 0 (for decoding), 1 (for encoding) + + Out: + state - state variable for x86 converter + + Returns: + The number of processed bytes. If you call these functions with multiple calls, + you must start next call with first byte after block of processed bytes. + + Type Endian Alignment LookAhead + + x86 little 1 4 + ARMT little 2 2 + ARM little 4 0 + PPC big 4 0 + SPARC big 4 0 + IA64 little 16 0 + + size must be >= Alignment + LookAhead, if it's not last block. + If (size < Alignment + LookAhead), converter returns 0. + + Example: + + UInt32 ip = 0; + for () + { + ; size must be >= Alignment + LookAhead, if it's not last block + SizeT processed = Convert(data, size, ip, 1); + data += processed; + size -= processed; + ip += processed; + } +*/ + +#define x86_Convert_Init(state) { state = 0; } +SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); +SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Bra86.c b/src/ZipLib/extlibs/lzma/unix/Bra86.c new file mode 100644 index 00000000..1ee0e709 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Bra86.c @@ -0,0 +1,85 @@ +/* Bra86.c -- Converter for x86 code (BCJ) +2008-10-04 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF) + +const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0}; +const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3}; + +SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) +{ + SizeT bufferPos = 0, prevPosT; + UInt32 prevMask = *state & 0x7; + if (size < 5) + return 0; + ip += 5; + prevPosT = (SizeT)0 - 1; + + for (;;) + { + Byte *p = data + bufferPos; + Byte *limit = data + size - 4; + for (; p < limit; p++) + if ((*p & 0xFE) == 0xE8) + break; + bufferPos = (SizeT)(p - data); + if (p >= limit) + break; + prevPosT = bufferPos - prevPosT; + if (prevPosT > 3) + prevMask = 0; + else + { + prevMask = (prevMask << ((int)prevPosT - 1)) & 0x7; + if (prevMask != 0) + { + Byte b = p[4 - kMaskToBitNumber[prevMask]]; + if (!kMaskToAllowedStatus[prevMask] || Test86MSByte(b)) + { + prevPosT = bufferPos; + prevMask = ((prevMask << 1) & 0x7) | 1; + bufferPos++; + continue; + } + } + } + prevPosT = bufferPos; + + if (Test86MSByte(p[4])) + { + UInt32 src = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); + UInt32 dest; + for (;;) + { + Byte b; + int index; + if (encoding) + dest = (ip + (UInt32)bufferPos) + src; + else + dest = src - (ip + (UInt32)bufferPos); + if (prevMask == 0) + break; + index = kMaskToBitNumber[prevMask] * 8; + b = (Byte)(dest >> (24 - index)); + if (!Test86MSByte(b)) + break; + src = dest ^ ((1 << (32 - index)) - 1); + } + p[4] = (Byte)(~(((dest >> 24) & 1) - 1)); + p[3] = (Byte)(dest >> 16); + p[2] = (Byte)(dest >> 8); + p[1] = (Byte)dest; + bufferPos += 5; + } + else + { + prevMask = ((prevMask << 1) & 0x7) | 1; + bufferPos++; + } + } + prevPosT = bufferPos - prevPosT; + *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7)); + return bufferPos; +} diff --git a/src/ZipLib/extlibs/lzma/unix/BraIA64.c b/src/ZipLib/extlibs/lzma/unix/BraIA64.c new file mode 100644 index 00000000..0b4ee85b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/BraIA64.c @@ -0,0 +1,67 @@ +/* BraIA64.c -- Converter for IA-64 code +2008-10-04 : Igor Pavlov : Public domain */ + +#include "Bra.h" + +static const Byte kBranchTable[32] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 6, 6, 0, 0, 7, 7, + 4, 4, 0, 0, 4, 4, 0, 0 +}; + +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 16) + return 0; + size -= 16; + for (i = 0; i <= size; i += 16) + { + UInt32 instrTemplate = data[i] & 0x1F; + UInt32 mask = kBranchTable[instrTemplate]; + UInt32 bitPos = 5; + int slot; + for (slot = 0; slot < 3; slot++, bitPos += 41) + { + UInt32 bytePos, bitRes; + UInt64 instruction, instNorm; + int j; + if (((mask >> slot) & 1) == 0) + continue; + bytePos = (bitPos >> 3); + bitRes = bitPos & 0x7; + instruction = 0; + for (j = 0; j < 6; j++) + instruction += (UInt64)data[i + j + bytePos] << (8 * j); + + instNorm = instruction >> bitRes; + if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0) + { + UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF); + UInt32 dest; + src |= ((UInt32)(instNorm >> 36) & 1) << 20; + + src <<= 4; + + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + + dest >>= 4; + + instNorm &= ~((UInt64)(0x8FFFFF) << 13); + instNorm |= ((UInt64)(dest & 0xFFFFF) << 13); + instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20)); + + instruction &= (1 << bitRes) - 1; + instruction |= (instNorm << bitRes); + for (j = 0; j < 6; j++) + data[i + j + bytePos] = (Byte)(instruction >> (8 * j)); + } + } + } + return i; +} diff --git a/src/ZipLib/extlibs/lzma/unix/BwtSort.c b/src/ZipLib/extlibs/lzma/unix/BwtSort.c new file mode 100644 index 00000000..20730507 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/BwtSort.c @@ -0,0 +1,516 @@ +/* BwtSort.c -- BWT block sorting +2008-08-17 +Igor Pavlov +Public domain */ + +#include "BwtSort.h" +#include "Sort.h" + +/* #define BLOCK_SORT_USE_HEAP_SORT */ + +#define NO_INLINE MY_FAST_CALL + +/* Don't change it !!! */ +#define kNumHashBytes 2 +#define kNumHashValues (1 << (kNumHashBytes * 8)) + +/* kNumRefBitsMax must be < (kNumHashBytes * 8) = 16 */ +#define kNumRefBitsMax 12 + +#define BS_TEMP_SIZE kNumHashValues + +#ifdef BLOCK_SORT_EXTERNAL_FLAGS + +/* 32 Flags in UInt32 word */ +#define kNumFlagsBits 5 +#define kNumFlagsInWord (1 << kNumFlagsBits) +#define kFlagsMask (kNumFlagsInWord - 1) +#define kAllFlags 0xFFFFFFFF + +#else + +#define kNumBitsMax 20 +#define kIndexMask ((1 << kNumBitsMax) - 1) +#define kNumExtraBits (32 - kNumBitsMax) +#define kNumExtra0Bits (kNumExtraBits - 2) +#define kNumExtra0Mask ((1 << kNumExtra0Bits) - 1) + +#define SetFinishedGroupSize(p, size) \ + { *(p) |= ((((size) - 1) & kNumExtra0Mask) << kNumBitsMax); \ + if ((size) > (1 << kNumExtra0Bits)) { \ + *(p) |= 0x40000000; *((p) + 1) |= ((((size) - 1)>> kNumExtra0Bits) << kNumBitsMax); } } \ + +static void SetGroupSize(UInt32 *p, UInt32 size) +{ + if (--size == 0) + return; + *p |= 0x80000000 | ((size & kNumExtra0Mask) << kNumBitsMax); + if (size >= (1 << kNumExtra0Bits)) + { + *p |= 0x40000000; + p[1] |= ((size >> kNumExtra0Bits) << kNumBitsMax); + } +} + +#endif + +/* +SortGroup - is recursive Range-Sort function with HeapSort optimization for small blocks + "range" is not real range. It's only for optimization. +returns: 1 - if there are groups, 0 - no more groups +*/ + +UInt32 NO_INLINE SortGroup(UInt32 BlockSize, UInt32 NumSortedBytes, UInt32 groupOffset, UInt32 groupSize, int NumRefBits, UInt32 *Indices + #ifndef BLOCK_SORT_USE_HEAP_SORT + , UInt32 left, UInt32 range + #endif + ) +{ + UInt32 *ind2 = Indices + groupOffset; + UInt32 *Groups; + if (groupSize <= 1) + { + /* + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetFinishedGroupSize(ind2, 1); + #endif + */ + return 0; + } + Groups = Indices + BlockSize + BS_TEMP_SIZE; + if (groupSize <= ((UInt32)1 << NumRefBits) + #ifndef BLOCK_SORT_USE_HEAP_SORT + && groupSize <= range + #endif + ) + { + UInt32 *temp = Indices + BlockSize; + UInt32 j; + UInt32 mask, thereAreGroups, group, cg; + { + UInt32 gPrev; + UInt32 gRes = 0; + { + UInt32 sp = ind2[0] + NumSortedBytes; + if (sp >= BlockSize) sp -= BlockSize; + gPrev = Groups[sp]; + temp[0] = (gPrev << NumRefBits); + } + + for (j = 1; j < groupSize; j++) + { + UInt32 sp = ind2[j] + NumSortedBytes; + UInt32 g; + if (sp >= BlockSize) sp -= BlockSize; + g = Groups[sp]; + temp[j] = (g << NumRefBits) | j; + gRes |= (gPrev ^ g); + } + if (gRes == 0) + { + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetGroupSize(ind2, groupSize); + #endif + return 1; + } + } + + HeapSort(temp, groupSize); + mask = ((1 << NumRefBits) - 1); + thereAreGroups = 0; + + group = groupOffset; + cg = (temp[0] >> NumRefBits); + temp[0] = ind2[temp[0] & mask]; + + { + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 *Flags = Groups + BlockSize; + #else + UInt32 prevGroupStart = 0; + #endif + + for (j = 1; j < groupSize; j++) + { + UInt32 val = temp[j]; + UInt32 cgCur = (val >> NumRefBits); + + if (cgCur != cg) + { + cg = cgCur; + group = groupOffset + j; + + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + { + UInt32 t = group - 1; + Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); + } + #else + SetGroupSize(temp + prevGroupStart, j - prevGroupStart); + prevGroupStart = j; + #endif + } + else + thereAreGroups = 1; + { + UInt32 ind = ind2[val & mask]; + temp[j] = ind; + Groups[ind] = group; + } + } + + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetGroupSize(temp + prevGroupStart, j - prevGroupStart); + #endif + } + + for (j = 0; j < groupSize; j++) + ind2[j] = temp[j]; + return thereAreGroups; + } + + /* Check that all strings are in one group (cannot sort) */ + { + UInt32 group, j; + UInt32 sp = ind2[0] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize; + group = Groups[sp]; + for (j = 1; j < groupSize; j++) + { + sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize; + if (Groups[sp] != group) + break; + } + if (j == groupSize) + { + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetGroupSize(ind2, groupSize); + #endif + return 1; + } + } + + #ifndef BLOCK_SORT_USE_HEAP_SORT + { + /* ---------- Range Sort ---------- */ + UInt32 i; + UInt32 mid; + for (;;) + { + UInt32 j; + if (range <= 1) + { + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetGroupSize(ind2, groupSize); + #endif + return 1; + } + mid = left + ((range + 1) >> 1); + j = groupSize; + i = 0; + do + { + UInt32 sp = ind2[i] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize; + if (Groups[sp] >= mid) + { + for (j--; j > i; j--) + { + sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize; + if (Groups[sp] < mid) + { + UInt32 temp = ind2[i]; ind2[i] = ind2[j]; ind2[j] = temp; + break; + } + } + if (i >= j) + break; + } + } + while (++i < j); + if (i == 0) + { + range = range - (mid - left); + left = mid; + } + else if (i == groupSize) + range = (mid - left); + else + break; + } + + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + { + UInt32 t = (groupOffset + i - 1); + UInt32 *Flags = Groups + BlockSize; + Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); + } + #endif + + { + UInt32 j; + for (j = i; j < groupSize; j++) + Groups[ind2[j]] = groupOffset + i; + } + + { + UInt32 res = SortGroup(BlockSize, NumSortedBytes, groupOffset, i, NumRefBits, Indices, left, mid - left); + return res | SortGroup(BlockSize, NumSortedBytes, groupOffset + i, groupSize - i, NumRefBits, Indices, mid, range - (mid - left)); + } + + } + + #else + + /* ---------- Heap Sort ---------- */ + + { + UInt32 j; + for (j = 0; j < groupSize; j++) + { + UInt32 sp = ind2[j] + NumSortedBytes; if (sp >= BlockSize) sp -= BlockSize; + ind2[j] = sp; + } + + HeapSortRef(ind2, Groups, groupSize); + + /* Write Flags */ + { + UInt32 sp = ind2[0]; + UInt32 group = Groups[sp]; + + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 *Flags = Groups + BlockSize; + #else + UInt32 prevGroupStart = 0; + #endif + + for (j = 1; j < groupSize; j++) + { + sp = ind2[j]; + if (Groups[sp] != group) + { + group = Groups[sp]; + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + { + UInt32 t = groupOffset + j - 1; + Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); + } + #else + SetGroupSize(ind2 + prevGroupStart, j - prevGroupStart); + prevGroupStart = j; + #endif + } + } + + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + SetGroupSize(ind2 + prevGroupStart, j - prevGroupStart); + #endif + } + { + /* Write new Groups values and Check that there are groups */ + UInt32 thereAreGroups = 0; + for (j = 0; j < groupSize; j++) + { + UInt32 group = groupOffset + j; + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 subGroupSize = ((ind2[j] & ~0xC0000000) >> kNumBitsMax); + if ((ind2[j] & 0x40000000) != 0) + subGroupSize += ((ind2[j + 1] >> kNumBitsMax) << kNumExtra0Bits); + subGroupSize++; + for (;;) + { + UInt32 original = ind2[j]; + UInt32 sp = original & kIndexMask; + if (sp < NumSortedBytes) sp += BlockSize; sp -= NumSortedBytes; + ind2[j] = sp | (original & ~kIndexMask); + Groups[sp] = group; + if (--subGroupSize == 0) + break; + j++; + thereAreGroups = 1; + } + #else + UInt32 *Flags = Groups + BlockSize; + for (;;) + { + UInt32 sp = ind2[j]; if (sp < NumSortedBytes) sp += BlockSize; sp -= NumSortedBytes; + ind2[j] = sp; + Groups[sp] = group; + if ((Flags[(groupOffset + j) >> kNumFlagsBits] & (1 << ((groupOffset + j) & kFlagsMask))) == 0) + break; + j++; + thereAreGroups = 1; + } + #endif + } + return thereAreGroups; + } + } + #endif +} + +/* conditions: blockSize > 0 */ +UInt32 BlockSort(UInt32 *Indices, const Byte *data, UInt32 blockSize) +{ + UInt32 *counters = Indices + blockSize; + UInt32 i; + UInt32 *Groups; + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 *Flags; + #endif + + /* Radix-Sort for 2 bytes */ + for (i = 0; i < kNumHashValues; i++) + counters[i] = 0; + for (i = 0; i < blockSize - 1; i++) + counters[((UInt32)data[i] << 8) | data[i + 1]]++; + counters[((UInt32)data[i] << 8) | data[0]]++; + + Groups = counters + BS_TEMP_SIZE; + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + Flags = Groups + blockSize; + { + UInt32 numWords = (blockSize + kFlagsMask) >> kNumFlagsBits; + for (i = 0; i < numWords; i++) + Flags[i] = kAllFlags; + } + #endif + + { + UInt32 sum = 0; + for (i = 0; i < kNumHashValues; i++) + { + UInt32 groupSize = counters[i]; + if (groupSize > 0) + { + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 t = sum + groupSize - 1; + Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); + #endif + sum += groupSize; + } + counters[i] = sum - groupSize; + } + + for (i = 0; i < blockSize - 1; i++) + Groups[i] = counters[((UInt32)data[i] << 8) | data[i + 1]]; + Groups[i] = counters[((UInt32)data[i] << 8) | data[0]]; + + for (i = 0; i < blockSize - 1; i++) + Indices[counters[((UInt32)data[i] << 8) | data[i + 1]]++] = i; + Indices[counters[((UInt32)data[i] << 8) | data[0]]++] = i; + + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + { + UInt32 prev = 0; + for (i = 0; i < kNumHashValues; i++) + { + UInt32 prevGroupSize = counters[i] - prev; + if (prevGroupSize == 0) + continue; + SetGroupSize(Indices + prev, prevGroupSize); + prev = counters[i]; + } + } + #endif + } + + { + int NumRefBits; + UInt32 NumSortedBytes; + for (NumRefBits = 0; ((blockSize - 1) >> NumRefBits) != 0; NumRefBits++); + NumRefBits = 32 - NumRefBits; + if (NumRefBits > kNumRefBitsMax) + NumRefBits = kNumRefBitsMax; + + for (NumSortedBytes = kNumHashBytes; ; NumSortedBytes <<= 1) + { + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + UInt32 finishedGroupSize = 0; + #endif + UInt32 newLimit = 0; + for (i = 0; i < blockSize;) + { + UInt32 groupSize; + #ifdef BLOCK_SORT_EXTERNAL_FLAGS + + if ((Flags[i >> kNumFlagsBits] & (1 << (i & kFlagsMask))) == 0) + { + i++; + continue; + } + for (groupSize = 1; + (Flags[(i + groupSize) >> kNumFlagsBits] & (1 << ((i + groupSize) & kFlagsMask))) != 0; + groupSize++); + + groupSize++; + + #else + + groupSize = ((Indices[i] & ~0xC0000000) >> kNumBitsMax); + { + Bool finishedGroup = ((Indices[i] & 0x80000000) == 0); + if ((Indices[i] & 0x40000000) != 0) + { + groupSize += ((Indices[i + 1] >> kNumBitsMax) << kNumExtra0Bits); + Indices[i + 1] &= kIndexMask; + } + Indices[i] &= kIndexMask; + groupSize++; + if (finishedGroup || groupSize == 1) + { + Indices[i - finishedGroupSize] &= kIndexMask; + if (finishedGroupSize > 1) + Indices[i - finishedGroupSize + 1] &= kIndexMask; + { + UInt32 newGroupSize = groupSize + finishedGroupSize; + SetFinishedGroupSize(Indices + i - finishedGroupSize, newGroupSize); + finishedGroupSize = newGroupSize; + } + i += groupSize; + continue; + } + finishedGroupSize = 0; + } + + #endif + + if (NumSortedBytes >= blockSize) + { + UInt32 j; + for (j = 0; j < groupSize; j++) + { + UInt32 t = (i + j); + /* Flags[t >> kNumFlagsBits] &= ~(1 << (t & kFlagsMask)); */ + Groups[Indices[t]] = t; + } + } + else + if (SortGroup(blockSize, NumSortedBytes, i, groupSize, NumRefBits, Indices + #ifndef BLOCK_SORT_USE_HEAP_SORT + , 0, blockSize + #endif + ) != 0) + newLimit = i + groupSize; + i += groupSize; + } + if (newLimit == 0) + break; + } + } + #ifndef BLOCK_SORT_EXTERNAL_FLAGS + for (i = 0; i < blockSize;) + { + UInt32 groupSize = ((Indices[i] & ~0xC0000000) >> kNumBitsMax); + if ((Indices[i] & 0x40000000) != 0) + { + groupSize += ((Indices[i + 1] >> kNumBitsMax) << kNumExtra0Bits); + Indices[i + 1] &= kIndexMask; + } + Indices[i] &= kIndexMask; + groupSize++; + i += groupSize; + } + #endif + return Groups[0]; +} + diff --git a/src/ZipLib/extlibs/lzma/unix/BwtSort.h b/src/ZipLib/extlibs/lzma/unix/BwtSort.h new file mode 100644 index 00000000..ce5598f0 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/BwtSort.h @@ -0,0 +1,30 @@ +/* BwtSort.h -- BWT block sorting +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __BWT_SORT_H +#define __BWT_SORT_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* use BLOCK_SORT_EXTERNAL_FLAGS if blockSize can be > 1M */ +/* #define BLOCK_SORT_EXTERNAL_FLAGS */ + +#ifdef BLOCK_SORT_EXTERNAL_FLAGS +#define BLOCK_SORT_EXTERNAL_SIZE(blockSize) ((((blockSize) + 31) >> 5)) +#else +#define BLOCK_SORT_EXTERNAL_SIZE(blockSize) 0 +#endif + +#define BLOCK_SORT_BUF_SIZE(blockSize) ((blockSize) * 2 + BLOCK_SORT_EXTERNAL_SIZE(blockSize) + (1 << 16)) + +UInt32 BlockSort(UInt32 *indices, const Byte *data, UInt32 blockSize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/CpuArch.c b/src/ZipLib/extlibs/lzma/unix/CpuArch.c new file mode 100644 index 00000000..260cc1f4 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/CpuArch.c @@ -0,0 +1,168 @@ +/* CpuArch.c -- CPU specific code +2010-10-26: Igor Pavlov : Public domain */ + +#include "CpuArch.h" + +#ifdef MY_CPU_X86_OR_AMD64 + +#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__) +#define USE_ASM +#endif + +#if defined(USE_ASM) && !defined(MY_CPU_AMD64) +static UInt32 CheckFlag(UInt32 flag) +{ + #ifdef _MSC_VER + __asm pushfd; + __asm pop EAX; + __asm mov EDX, EAX; + __asm xor EAX, flag; + __asm push EAX; + __asm popfd; + __asm pushfd; + __asm pop EAX; + __asm xor EAX, EDX; + __asm push EDX; + __asm popfd; + __asm and flag, EAX; + #else + __asm__ __volatile__ ( + "pushf\n\t" + "pop %%EAX\n\t" + "movl %%EAX,%%EDX\n\t" + "xorl %0,%%EAX\n\t" + "push %%EAX\n\t" + "popf\n\t" + "pushf\n\t" + "pop %%EAX\n\t" + "xorl %%EDX,%%EAX\n\t" + "push %%EDX\n\t" + "popf\n\t" + "andl %%EAX, %0\n\t": + "=c" (flag) : "c" (flag)); + #endif + return flag; +} +#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False; +#else +#define CHECK_CPUID_IS_SUPPORTED +#endif + +static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) +{ + #ifdef USE_ASM + + #ifdef _MSC_VER + + UInt32 a2, b2, c2, d2; + __asm xor EBX, EBX; + __asm xor ECX, ECX; + __asm xor EDX, EDX; + __asm mov EAX, function; + __asm cpuid; + __asm mov a2, EAX; + __asm mov b2, EBX; + __asm mov c2, ECX; + __asm mov d2, EDX; + + *a = a2; + *b = b2; + *c = c2; + *d = d2; + + #else + + __asm__ __volatile__ ( + "cpuid" + : "=a" (*a) , + "=b" (*b) , + "=c" (*c) , + "=d" (*d) + : "0" (function)) ; + + #endif + + #else + + int CPUInfo[4]; + __cpuid(CPUInfo, function); + *a = CPUInfo[0]; + *b = CPUInfo[1]; + *c = CPUInfo[2]; + *d = CPUInfo[3]; + + #endif +} + +Bool x86cpuid_CheckAndRead(Cx86cpuid *p) +{ + CHECK_CPUID_IS_SUPPORTED + MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]); + MyCPUID(1, &p->ver, &p->b, &p->c, &p->d); + return True; +} + +static UInt32 kVendors[][3] = +{ + { 0x756E6547, 0x49656E69, 0x6C65746E}, + { 0x68747541, 0x69746E65, 0x444D4163}, + { 0x746E6543, 0x48727561, 0x736C7561} +}; + +int x86cpuid_GetFirm(const Cx86cpuid *p) +{ + unsigned i; + for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++) + { + const UInt32 *v = kVendors[i]; + if (v[0] == p->vendor[0] && + v[1] == p->vendor[1] && + v[2] == p->vendor[2]) + return (int)i; + } + return -1; +} + +Bool CPU_Is_InOrder() +{ + Cx86cpuid p; + int firm; + UInt32 family, model; + if (!x86cpuid_CheckAndRead(&p)) + return True; + family = x86cpuid_GetFamily(&p); + model = x86cpuid_GetModel(&p); + firm = x86cpuid_GetFirm(&p); + switch (firm) + { + case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && model == 0x100C)); + case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA))); + case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF)); + } + return True; +} + +#if !defined(MY_CPU_AMD64) && defined(_WIN32) +static Bool CPU_Sys_Is_SSE_Supported() +{ + OSVERSIONINFO vi; + vi.dwOSVersionInfoSize = sizeof(vi); + if (!GetVersionEx(&vi)) + return False; + return (vi.dwMajorVersion >= 5); +} +#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False; +#else +#define CHECK_SYS_SSE_SUPPORT +#endif + +Bool CPU_Is_Aes_Supported() +{ + Cx86cpuid p; + CHECK_SYS_SSE_SUPPORT + if (!x86cpuid_CheckAndRead(&p)) + return False; + return (p.c >> 25) & 1; +} + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/CpuArch.h b/src/ZipLib/extlibs/lzma/unix/CpuArch.h new file mode 100644 index 00000000..01930c7e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/CpuArch.h @@ -0,0 +1,155 @@ +/* CpuArch.h -- CPU specific code +2010-10-26: Igor Pavlov : Public domain */ + +#ifndef __CPU_ARCH_H +#define __CPU_ARCH_H + +#include "Types.h" + +EXTERN_C_BEGIN + +/* +MY_CPU_LE means that CPU is LITTLE ENDIAN. +If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN). + +MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses. +If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform. +*/ + +#if defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) +#define MY_CPU_AMD64 +#endif + +#if defined(MY_CPU_AMD64) || defined(_M_IA64) +#define MY_CPU_64BIT +#endif + +#if defined(_M_IX86) || defined(__i386__) +#define MY_CPU_X86 +#endif + +#if defined(MY_CPU_X86) || defined(MY_CPU_AMD64) +#define MY_CPU_X86_OR_AMD64 +#endif + +#if defined(MY_CPU_X86) || defined(_M_ARM) +#define MY_CPU_32BIT +#endif + +#if defined(_WIN32) && defined(_M_ARM) +#define MY_CPU_ARM_LE +#endif + +#if defined(_WIN32) && defined(_M_IA64) +#define MY_CPU_IA64_LE +#endif + +#if defined(MY_CPU_X86_OR_AMD64) +#define MY_CPU_LE_UNALIGN +#endif + +#if defined(MY_CPU_X86_OR_AMD64) || defined(MY_CPU_ARM_LE) || defined(MY_CPU_IA64_LE) || defined(__ARMEL__) || defined(__MIPSEL__) || defined(__LITTLE_ENDIAN__) +#define MY_CPU_LE +#endif + +#if defined(__BIG_ENDIAN__) +#define MY_CPU_BE +#endif + +#if defined(MY_CPU_LE) && defined(MY_CPU_BE) +Stop_Compiling_Bad_Endian +#endif + +#ifdef MY_CPU_LE_UNALIGN + +#define GetUi16(p) (*(const UInt16 *)(p)) +#define GetUi32(p) (*(const UInt32 *)(p)) +#define GetUi64(p) (*(const UInt64 *)(p)) +#define SetUi16(p, d) *(UInt16 *)(p) = (d); +#define SetUi32(p, d) *(UInt32 *)(p) = (d); +#define SetUi64(p, d) *(UInt64 *)(p) = (d); + +#else + +#define GetUi16(p) (((const Byte *)(p))[0] | ((UInt16)((const Byte *)(p))[1] << 8)) + +#define GetUi32(p) ( \ + ((const Byte *)(p))[0] | \ + ((UInt32)((const Byte *)(p))[1] << 8) | \ + ((UInt32)((const Byte *)(p))[2] << 16) | \ + ((UInt32)((const Byte *)(p))[3] << 24)) + +#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32)) + +#define SetUi16(p, d) { UInt32 _x_ = (d); \ + ((Byte *)(p))[0] = (Byte)_x_; \ + ((Byte *)(p))[1] = (Byte)(_x_ >> 8); } + +#define SetUi32(p, d) { UInt32 _x_ = (d); \ + ((Byte *)(p))[0] = (Byte)_x_; \ + ((Byte *)(p))[1] = (Byte)(_x_ >> 8); \ + ((Byte *)(p))[2] = (Byte)(_x_ >> 16); \ + ((Byte *)(p))[3] = (Byte)(_x_ >> 24); } + +#define SetUi64(p, d) { UInt64 _x64_ = (d); \ + SetUi32(p, (UInt32)_x64_); \ + SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); } + +#endif + +#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) + +#pragma intrinsic(_byteswap_ulong) +#pragma intrinsic(_byteswap_uint64) +#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) +#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p)) + +#else + +#define GetBe32(p) ( \ + ((UInt32)((const Byte *)(p))[0] << 24) | \ + ((UInt32)((const Byte *)(p))[1] << 16) | \ + ((UInt32)((const Byte *)(p))[2] << 8) | \ + ((const Byte *)(p))[3] ) + +#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4)) + +#endif + +#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1]) + + +#ifdef MY_CPU_X86_OR_AMD64 + +typedef struct +{ + UInt32 maxFunc; + UInt32 vendor[3]; + UInt32 ver; + UInt32 b; + UInt32 c; + UInt32 d; +} Cx86cpuid; + +enum +{ + CPU_FIRM_INTEL, + CPU_FIRM_AMD, + CPU_FIRM_VIA +}; + +Bool x86cpuid_CheckAndRead(Cx86cpuid *p); +int x86cpuid_GetFirm(const Cx86cpuid *p); + +#define x86cpuid_GetFamily(p) (((p)->ver >> 8) & 0xFF00F) +#define x86cpuid_GetModel(p) (((p)->ver >> 4) & 0xF00F) +#define x86cpuid_GetStepping(p) ((p)->ver & 0xF) + +Bool CPU_Is_InOrder(); +Bool CPU_Is_Aes_Supported(); + +#endif + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Delta.c b/src/ZipLib/extlibs/lzma/unix/Delta.c new file mode 100644 index 00000000..2b327f15 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Delta.c @@ -0,0 +1,62 @@ +/* Delta.c -- Delta converter +2009-05-26 : Igor Pavlov : Public domain */ + +#include "Delta.h" + +void Delta_Init(Byte *state) +{ + unsigned i; + for (i = 0; i < DELTA_STATE_SIZE; i++) + state[i] = 0; +} + +static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) +{ + unsigned i; + for (i = 0; i < size; i++) + dest[i] = src[i]; +} + +void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) +{ + Byte buf[DELTA_STATE_SIZE]; + unsigned j = 0; + MyMemCpy(buf, state, delta); + { + SizeT i; + for (i = 0; i < size;) + { + for (j = 0; j < delta && i < size; i++, j++) + { + Byte b = data[i]; + data[i] = (Byte)(b - buf[j]); + buf[j] = b; + } + } + } + if (j == delta) + j = 0; + MyMemCpy(state, buf + j, delta - j); + MyMemCpy(state + delta - j, buf, j); +} + +void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) +{ + Byte buf[DELTA_STATE_SIZE]; + unsigned j = 0; + MyMemCpy(buf, state, delta); + { + SizeT i; + for (i = 0; i < size;) + { + for (j = 0; j < delta && i < size; i++, j++) + { + buf[j] = data[i] = (Byte)(buf[j] + data[i]); + } + } + } + if (j == delta) + j = 0; + MyMemCpy(state, buf + j, delta - j); + MyMemCpy(state + delta - j, buf, j); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Delta.h b/src/ZipLib/extlibs/lzma/unix/Delta.h new file mode 100644 index 00000000..0d4cd627 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Delta.h @@ -0,0 +1,23 @@ +/* Delta.h -- Delta converter +2009-04-15 : Igor Pavlov : Public domain */ + +#ifndef __DELTA_H +#define __DELTA_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DELTA_STATE_SIZE 256 + +void Delta_Init(Byte *state); +void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); +void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/HuffEnc.c b/src/ZipLib/extlibs/lzma/unix/HuffEnc.c new file mode 100644 index 00000000..561c7e5d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/HuffEnc.c @@ -0,0 +1,146 @@ +/* HuffEnc.c -- functions for Huffman encoding +2009-09-02 : Igor Pavlov : Public domain */ + +#include "HuffEnc.h" +#include "Sort.h" + +#define kMaxLen 16 +#define NUM_BITS 10 +#define MASK ((1 << NUM_BITS) - 1) + +#define NUM_COUNTERS 64 + +#define HUFFMAN_SPEED_OPT + +void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 numSymbols, UInt32 maxLen) +{ + UInt32 num = 0; + /* if (maxLen > 10) maxLen = 10; */ + { + UInt32 i; + + #ifdef HUFFMAN_SPEED_OPT + + UInt32 counters[NUM_COUNTERS]; + for (i = 0; i < NUM_COUNTERS; i++) + counters[i] = 0; + for (i = 0; i < numSymbols; i++) + { + UInt32 freq = freqs[i]; + counters[(freq < NUM_COUNTERS - 1) ? freq : NUM_COUNTERS - 1]++; + } + + for (i = 1; i < NUM_COUNTERS; i++) + { + UInt32 temp = counters[i]; + counters[i] = num; + num += temp; + } + + for (i = 0; i < numSymbols; i++) + { + UInt32 freq = freqs[i]; + if (freq == 0) + lens[i] = 0; + else + p[counters[((freq < NUM_COUNTERS - 1) ? freq : NUM_COUNTERS - 1)]++] = i | (freq << NUM_BITS); + } + counters[0] = 0; + HeapSort(p + counters[NUM_COUNTERS - 2], counters[NUM_COUNTERS - 1] - counters[NUM_COUNTERS - 2]); + + #else + + for (i = 0; i < numSymbols; i++) + { + UInt32 freq = freqs[i]; + if (freq == 0) + lens[i] = 0; + else + p[num++] = i | (freq << NUM_BITS); + } + HeapSort(p, num); + + #endif + } + + if (num < 2) + { + unsigned minCode = 0; + unsigned maxCode = 1; + if (num == 1) + { + maxCode = (unsigned)p[0] & MASK; + if (maxCode == 0) + maxCode++; + } + p[minCode] = 0; + p[maxCode] = 1; + lens[minCode] = lens[maxCode] = 1; + return; + } + + { + UInt32 b, e, i; + + i = b = e = 0; + do + { + UInt32 n, m, freq; + n = (i != num && (b == e || (p[i] >> NUM_BITS) <= (p[b] >> NUM_BITS))) ? i++ : b++; + freq = (p[n] & ~MASK); + p[n] = (p[n] & MASK) | (e << NUM_BITS); + m = (i != num && (b == e || (p[i] >> NUM_BITS) <= (p[b] >> NUM_BITS))) ? i++ : b++; + freq += (p[m] & ~MASK); + p[m] = (p[m] & MASK) | (e << NUM_BITS); + p[e] = (p[e] & MASK) | freq; + e++; + } + while (num - e > 1); + + { + UInt32 lenCounters[kMaxLen + 1]; + for (i = 0; i <= kMaxLen; i++) + lenCounters[i] = 0; + + p[--e] &= MASK; + lenCounters[1] = 2; + while (e > 0) + { + UInt32 len = (p[p[--e] >> NUM_BITS] >> NUM_BITS) + 1; + p[e] = (p[e] & MASK) | (len << NUM_BITS); + if (len >= maxLen) + for (len = maxLen - 1; lenCounters[len] == 0; len--); + lenCounters[len]--; + lenCounters[len + 1] += 2; + } + + { + UInt32 len; + i = 0; + for (len = maxLen; len != 0; len--) + { + UInt32 num; + for (num = lenCounters[len]; num != 0; num--) + lens[p[i++] & MASK] = (Byte)len; + } + } + + { + UInt32 nextCodes[kMaxLen + 1]; + { + UInt32 code = 0; + UInt32 len; + for (len = 1; len <= kMaxLen; len++) + nextCodes[len] = code = (code + lenCounters[len - 1]) << 1; + } + /* if (code + lenCounters[kMaxLen] - 1 != (1 << kMaxLen) - 1) throw 1; */ + + { + UInt32 i; + for (i = 0; i < numSymbols; i++) + p[i] = nextCodes[lens[i]]++; + } + } + } + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/HuffEnc.h b/src/ZipLib/extlibs/lzma/unix/HuffEnc.h new file mode 100644 index 00000000..9cf4bfde --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/HuffEnc.h @@ -0,0 +1,27 @@ +/* HuffEnc.h -- Huffman encoding +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __HUFF_ENC_H +#define __HUFF_ENC_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Conditions: + num <= 1024 = 2 ^ NUM_BITS + Sum(freqs) < 4M = 2 ^ (32 - NUM_BITS) + maxLen <= 16 = kMaxLen + Num_Items(p) >= HUFFMAN_TEMP_SIZE(num) +*/ + +void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 num, UInt32 maxLen); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzFind.c b/src/ZipLib/extlibs/lzma/unix/LzFind.c new file mode 100644 index 00000000..e3ecb054 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzFind.c @@ -0,0 +1,761 @@ +/* LzFind.c -- Match finder for LZ algorithms +2009-04-22 : Igor Pavlov : Public domain */ + +#include + +#include "LzFind.h" +#include "LzHash.h" + +#define kEmptyHashValue 0 +#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) +#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ +#define kNormalizeMask (~(kNormalizeStepMin - 1)) +#define kMaxHistorySize ((UInt32)3 << 30) + +#define kStartMaxLen 3 + +static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + if (!p->directInput) + { + alloc->Free(alloc, p->bufferBase); + p->bufferBase = 0; + } +} + +/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ + +static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) +{ + UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; + if (p->directInput) + { + p->blockSize = blockSize; + return 1; + } + if (p->bufferBase == 0 || p->blockSize != blockSize) + { + LzInWindow_Free(p, alloc); + p->blockSize = blockSize; + p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); + } + return (p->bufferBase != 0); +} + +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } +Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } + +UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } + +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) +{ + p->posLimit -= subValue; + p->pos -= subValue; + p->streamPos -= subValue; +} + +static void MatchFinder_ReadBlock(CMatchFinder *p) +{ + if (p->streamEndWasReached || p->result != SZ_OK) + return; + if (p->directInput) + { + UInt32 curSize = 0xFFFFFFFF - p->streamPos; + if (curSize > p->directInputRem) + curSize = (UInt32)p->directInputRem; + p->directInputRem -= curSize; + p->streamPos += curSize; + if (p->directInputRem == 0) + p->streamEndWasReached = 1; + return; + } + for (;;) + { + Byte *dest = p->buffer + (p->streamPos - p->pos); + size_t size = (p->bufferBase + p->blockSize - dest); + if (size == 0) + return; + p->result = p->stream->Read(p->stream, dest, &size); + if (p->result != SZ_OK) + return; + if (size == 0) + { + p->streamEndWasReached = 1; + return; + } + p->streamPos += (UInt32)size; + if (p->streamPos - p->pos > p->keepSizeAfter) + return; + } +} + +void MatchFinder_MoveBlock(CMatchFinder *p) +{ + memmove(p->bufferBase, + p->buffer - p->keepSizeBefore, + (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); + p->buffer = p->bufferBase + p->keepSizeBefore; +} + +int MatchFinder_NeedMove(CMatchFinder *p) +{ + if (p->directInput) + return 0; + /* if (p->streamEndWasReached) return 0; */ + return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); +} + +void MatchFinder_ReadIfRequired(CMatchFinder *p) +{ + if (p->streamEndWasReached) + return; + if (p->keepSizeAfter >= p->streamPos - p->pos) + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) +{ + if (MatchFinder_NeedMove(p)) + MatchFinder_MoveBlock(p); + MatchFinder_ReadBlock(p); +} + +static void MatchFinder_SetDefaultSettings(CMatchFinder *p) +{ + p->cutValue = 32; + p->btMode = 1; + p->numHashBytes = 4; + p->bigHash = 0; +} + +#define kCrcPoly 0xEDB88320 + +void MatchFinder_Construct(CMatchFinder *p) +{ + UInt32 i; + p->bufferBase = 0; + p->directInput = 0; + p->hash = 0; + MatchFinder_SetDefaultSettings(p); + + for (i = 0; i < 256; i++) + { + UInt32 r = i; + int j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); + p->crc[i] = r; + } +} + +static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->hash); + p->hash = 0; +} + +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) +{ + MatchFinder_FreeThisClassMemory(p, alloc); + LzInWindow_Free(p, alloc); +} + +static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) +{ + size_t sizeInBytes = (size_t)num * sizeof(CLzRef); + if (sizeInBytes / sizeof(CLzRef) != num) + return 0; + return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); +} + +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc) +{ + UInt32 sizeReserv; + if (historySize > kMaxHistorySize) + { + MatchFinder_Free(p, alloc); + return 0; + } + sizeReserv = historySize >> 1; + if (historySize > ((UInt32)2 << 30)) + sizeReserv = historySize >> 2; + sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); + + p->keepSizeBefore = historySize + keepAddBufferBefore + 1; + p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; + /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ + if (LzInWindow_Create(p, sizeReserv, alloc)) + { + UInt32 newCyclicBufferSize = historySize + 1; + UInt32 hs; + p->matchMaxLen = matchMaxLen; + { + p->fixedHashSize = 0; + if (p->numHashBytes == 2) + hs = (1 << 16) - 1; + else + { + hs = historySize - 1; + hs |= (hs >> 1); + hs |= (hs >> 2); + hs |= (hs >> 4); + hs |= (hs >> 8); + hs >>= 1; + hs |= 0xFFFF; /* don't change it! It's required for Deflate */ + if (hs > (1 << 24)) + { + if (p->numHashBytes == 3) + hs = (1 << 24) - 1; + else + hs >>= 1; + } + } + p->hashMask = hs; + hs++; + if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; + if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; + if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; + hs += p->fixedHashSize; + } + + { + UInt32 prevSize = p->hashSizeSum + p->numSons; + UInt32 newSize; + p->historySize = historySize; + p->hashSizeSum = hs; + p->cyclicBufferSize = newCyclicBufferSize; + p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); + newSize = p->hashSizeSum + p->numSons; + if (p->hash != 0 && prevSize == newSize) + return 1; + MatchFinder_FreeThisClassMemory(p, alloc); + p->hash = AllocRefs(newSize, alloc); + if (p->hash != 0) + { + p->son = p->hash + p->hashSizeSum; + return 1; + } + } + } + MatchFinder_Free(p, alloc); + return 0; +} + +static void MatchFinder_SetLimits(CMatchFinder *p) +{ + UInt32 limit = kMaxValForNormalize - p->pos; + UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; + if (limit2 < limit) + limit = limit2; + limit2 = p->streamPos - p->pos; + if (limit2 <= p->keepSizeAfter) + { + if (limit2 > 0) + limit2 = 1; + } + else + limit2 -= p->keepSizeAfter; + if (limit2 < limit) + limit = limit2; + { + UInt32 lenLimit = p->streamPos - p->pos; + if (lenLimit > p->matchMaxLen) + lenLimit = p->matchMaxLen; + p->lenLimit = lenLimit; + } + p->posLimit = p->pos + limit; +} + +void MatchFinder_Init(CMatchFinder *p) +{ + UInt32 i; + for (i = 0; i < p->hashSizeSum; i++) + p->hash[i] = kEmptyHashValue; + p->cyclicBufferPos = 0; + p->buffer = p->bufferBase; + p->pos = p->streamPos = p->cyclicBufferSize; + p->result = SZ_OK; + p->streamEndWasReached = 0; + MatchFinder_ReadBlock(p); + MatchFinder_SetLimits(p); +} + +static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) +{ + return (p->pos - p->historySize - 1) & kNormalizeMask; +} + +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) +{ + UInt32 i; + for (i = 0; i < numItems; i++) + { + UInt32 value = items[i]; + if (value <= subValue) + value = kEmptyHashValue; + else + value -= subValue; + items[i] = value; + } +} + +static void MatchFinder_Normalize(CMatchFinder *p) +{ + UInt32 subValue = MatchFinder_GetSubValue(p); + MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); + MatchFinder_ReduceOffsets(p, subValue); +} + +static void MatchFinder_CheckLimits(CMatchFinder *p) +{ + if (p->pos == kMaxValForNormalize) + MatchFinder_Normalize(p); + if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) + MatchFinder_CheckAndMoveAndRead(p); + if (p->cyclicBufferPos == p->cyclicBufferSize) + p->cyclicBufferPos = 0; + MatchFinder_SetLimits(p); +} + +static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + son[_cyclicBufferPos] = curMatch; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + return distances; + { + const Byte *pb = cur - delta; + curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; + if (pb[maxLen] == cur[maxLen] && *pb == *cur) + { + UInt32 len = 0; + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + return distances; + } + } + } + } +} + +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, + UInt32 *distances, UInt32 maxLen) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return distances; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + if (++len != lenLimit && pb[len] == cur[len]) + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return distances; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) +{ + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + return; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + { + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + return; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } +} + +#define MOVE_POS \ + ++p->cyclicBufferPos; \ + p->buffer++; \ + if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); + +#define MOVE_POS_RET MOVE_POS return offset; + +static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } + +#define GET_MATCHES_HEADER2(minLen, ret_op) \ + UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ + lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ + cur = p->buffer; + +#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) +#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) + +#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue + +#define GET_MATCHES_FOOTER(offset, maxLen) \ + offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ + distances + offset, maxLen) - distances); MOVE_POS_RET; + +#define SKIP_FOOTER \ + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; + +static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 1) +} + +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = 0; + GET_MATCHES_FOOTER(offset, 2) +} + +static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, delta2, maxLen, offset; + GET_MATCHES_HEADER(3) + + HASH3_CALC; + + delta2 = p->pos - p->hash[hash2Value]; + curMatch = p->hash[kFix3HashSize + hashValue]; + + p->hash[hash2Value] = + p->hash[kFix3HashSize + hashValue] = p->pos; + + + maxLen = 2; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[0] = maxLen; + distances[1] = delta2 - 1; + offset = 2; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + GET_MATCHES_FOOTER(offset, maxLen) +} + +static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + delta2 = p->pos - p->hash[ hash2Value]; + delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; + curMatch = p->hash[kFix4HashSize + hashValue]; + + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + + maxLen = 1; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = delta2 - 1; + offset = 2; + } + if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) + { + maxLen = 3; + distances[offset + 1] = delta3 - 1; + offset += 2; + delta2 = delta3; + } + if (offset != 0) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); + MOVE_POS_RET; + } + } + if (maxLen < 3) + maxLen = 3; + GET_MATCHES_FOOTER(offset, maxLen) +} + +static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; + GET_MATCHES_HEADER(4) + + HASH4_CALC; + + delta2 = p->pos - p->hash[ hash2Value]; + delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; + curMatch = p->hash[kFix4HashSize + hashValue]; + + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + + maxLen = 1; + offset = 0; + if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) + { + distances[0] = maxLen = 2; + distances[1] = delta2 - 1; + offset = 2; + } + if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) + { + maxLen = 3; + distances[offset + 1] = delta3 - 1; + offset += 2; + delta2 = delta3; + } + if (offset != 0) + { + for (; maxLen != lenLimit; maxLen++) + if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) + break; + distances[offset - 2] = maxLen; + if (maxLen == lenLimit) + { + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS_RET; + } + } + if (maxLen < 3) + maxLen = 3; + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances + offset, maxLen) - (distances)); + MOVE_POS_RET +} + +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) +{ + UInt32 offset; + GET_MATCHES_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), + distances, 2) - (distances)); + MOVE_POS_RET +} + +static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(2) + HASH2_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value; + SKIP_HEADER(3) + HASH3_CALC; + curMatch = p->hash[kFix3HashSize + hashValue]; + p->hash[hash2Value] = + p->hash[kFix3HashSize + hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value, hash3Value; + SKIP_HEADER(4) + HASH4_CALC; + curMatch = p->hash[kFix4HashSize + hashValue]; + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = p->pos; + p->hash[kFix4HashSize + hashValue] = p->pos; + SKIP_FOOTER + } + while (--num != 0); +} + +static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + UInt32 hash2Value, hash3Value; + SKIP_HEADER(4) + HASH4_CALC; + curMatch = p->hash[kFix4HashSize + hashValue]; + p->hash[ hash2Value] = + p->hash[kFix3HashSize + hash3Value] = + p->hash[kFix4HashSize + hashValue] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) +{ + do + { + SKIP_HEADER(3) + HASH_ZIP_CALC; + curMatch = p->hash[hashValue]; + p->hash[hashValue] = p->pos; + p->son[p->cyclicBufferPos] = curMatch; + MOVE_POS + } + while (--num != 0); +} + +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) +{ + vTable->Init = (Mf_Init_Func)MatchFinder_Init; + vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; + if (!p->btMode) + { + vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; + } + else if (p->numHashBytes == 2) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; + } + else if (p->numHashBytes == 3) + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; + } + else + { + vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; + vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzFind.h b/src/ZipLib/extlibs/lzma/unix/LzFind.h new file mode 100644 index 00000000..010c4b92 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzFind.h @@ -0,0 +1,115 @@ +/* LzFind.h -- Match finder for LZ algorithms +2009-04-22 : Igor Pavlov : Public domain */ + +#ifndef __LZ_FIND_H +#define __LZ_FIND_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef UInt32 CLzRef; + +typedef struct _CMatchFinder +{ + Byte *buffer; + UInt32 pos; + UInt32 posLimit; + UInt32 streamPos; + UInt32 lenLimit; + + UInt32 cyclicBufferPos; + UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */ + + UInt32 matchMaxLen; + CLzRef *hash; + CLzRef *son; + UInt32 hashMask; + UInt32 cutValue; + + Byte *bufferBase; + ISeqInStream *stream; + int streamEndWasReached; + + UInt32 blockSize; + UInt32 keepSizeBefore; + UInt32 keepSizeAfter; + + UInt32 numHashBytes; + int directInput; + size_t directInputRem; + int btMode; + int bigHash; + UInt32 historySize; + UInt32 fixedHashSize; + UInt32 hashSizeSum; + UInt32 numSons; + SRes result; + UInt32 crc[256]; +} CMatchFinder; + +#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer) +#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)]) + +#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos) + +int MatchFinder_NeedMove(CMatchFinder *p); +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); +void MatchFinder_MoveBlock(CMatchFinder *p); +void MatchFinder_ReadIfRequired(CMatchFinder *p); + +void MatchFinder_Construct(CMatchFinder *p); + +/* Conditions: + historySize <= 3 GB + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB +*/ +int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, + UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, + ISzAlloc *alloc); +void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc); +void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems); +void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue); + +UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, + UInt32 *distances, UInt32 maxLen); + +/* +Conditions: + Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func. + Mf_GetPointerToCurrentPos_Func's result must be used only before any other function +*/ + +typedef void (*Mf_Init_Func)(void *object); +typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index); +typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object); +typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object); +typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances); +typedef void (*Mf_Skip_Func)(void *object, UInt32); + +typedef struct _IMatchFinder +{ + Mf_Init_Func Init; + Mf_GetIndexByte_Func GetIndexByte; + Mf_GetNumAvailableBytes_Func GetNumAvailableBytes; + Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos; + Mf_GetMatches_Func GetMatches; + Mf_Skip_Func Skip; +} IMatchFinder; + +void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable); + +void MatchFinder_Init(CMatchFinder *p); +UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances); +void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); +void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzFindMt.c b/src/ZipLib/extlibs/lzma/unix/LzFindMt.c new file mode 100644 index 00000000..aa41ed98 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzFindMt.c @@ -0,0 +1,793 @@ +/* LzFindMt.c -- multithreaded Match finder for LZ algorithms +2009-09-20 : Igor Pavlov : Public domain */ + +#include "LzHash.h" + +#include "LzFindMt.h" + +void MtSync_Construct(CMtSync *p) +{ + p->wasCreated = False; + p->csWasInitialized = False; + p->csWasEntered = False; + Thread_Construct(&p->thread); + Event_Construct(&p->canStart); + Event_Construct(&p->wasStarted); + Event_Construct(&p->wasStopped); + Semaphore_Construct(&p->freeSemaphore); + Semaphore_Construct(&p->filledSemaphore); +} + +void MtSync_GetNextBlock(CMtSync *p) +{ + if (p->needStart) + { + p->numProcessedBlocks = 1; + p->needStart = False; + p->stopWriting = False; + p->exit = False; + Event_Reset(&p->wasStarted); + Event_Reset(&p->wasStopped); + + Event_Set(&p->canStart); + Event_Wait(&p->wasStarted); + } + else + { + CriticalSection_Leave(&p->cs); + p->csWasEntered = False; + p->numProcessedBlocks++; + Semaphore_Release1(&p->freeSemaphore); + } + Semaphore_Wait(&p->filledSemaphore); + CriticalSection_Enter(&p->cs); + p->csWasEntered = True; +} + +/* MtSync_StopWriting must be called if Writing was started */ + +void MtSync_StopWriting(CMtSync *p) +{ + UInt32 myNumBlocks = p->numProcessedBlocks; + if (!Thread_WasCreated(&p->thread) || p->needStart) + return; + p->stopWriting = True; + if (p->csWasEntered) + { + CriticalSection_Leave(&p->cs); + p->csWasEntered = False; + } + Semaphore_Release1(&p->freeSemaphore); + + Event_Wait(&p->wasStopped); + + while (myNumBlocks++ != p->numProcessedBlocks) + { + Semaphore_Wait(&p->filledSemaphore); + Semaphore_Release1(&p->freeSemaphore); + } + p->needStart = True; +} + +void MtSync_Destruct(CMtSync *p) +{ + if (Thread_WasCreated(&p->thread)) + { + MtSync_StopWriting(p); + p->exit = True; + if (p->needStart) + Event_Set(&p->canStart); + Thread_Wait(&p->thread); + Thread_Close(&p->thread); + } + if (p->csWasInitialized) + { + CriticalSection_Delete(&p->cs); + p->csWasInitialized = False; + } + + Event_Close(&p->canStart); + Event_Close(&p->wasStarted); + Event_Close(&p->wasStopped); + Semaphore_Close(&p->freeSemaphore); + Semaphore_Close(&p->filledSemaphore); + + p->wasCreated = False; +} + +#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; } + +static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks) +{ + if (p->wasCreated) + return SZ_OK; + + RINOK_THREAD(CriticalSection_Init(&p->cs)); + p->csWasInitialized = True; + + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped)); + + RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks)); + RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks)); + + p->needStart = True; + + RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj)); + p->wasCreated = True; + return SZ_OK; +} + +static SRes MtSync_Create(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void *), void *obj, UInt32 numBlocks) +{ + SRes res = MtSync_Create2(p, startAddress, obj, numBlocks); + if (res != SZ_OK) + MtSync_Destruct(p); + return res; +} + +void MtSync_Init(CMtSync *p) { p->needStart = True; } + +#define kMtMaxValForNormalize 0xFFFFFFFF + +#define DEF_GetHeads2(name, v, action) \ +static void GetHeads ## name(const Byte *p, UInt32 pos, \ +UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \ +{ action; for (; numHeads != 0; numHeads--) { \ +const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } } + +#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;) + +DEF_GetHeads2(2, (p[0] | ((UInt32)p[1] << 8)), hashMask = hashMask; crc = crc; ) +DEF_GetHeads(3, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask) +DEF_GetHeads(4, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask) +DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask) +/* DEF_GetHeads(5, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask) */ + +void HashThreadFunc(CMatchFinderMt *mt) +{ + CMtSync *p = &mt->hashSync; + for (;;) + { + UInt32 numProcessedBlocks = 0; + Event_Wait(&p->canStart); + Event_Set(&p->wasStarted); + for (;;) + { + if (p->exit) + return; + if (p->stopWriting) + { + p->numProcessedBlocks = numProcessedBlocks; + Event_Set(&p->wasStopped); + break; + } + + { + CMatchFinder *mf = mt->MatchFinder; + if (MatchFinder_NeedMove(mf)) + { + CriticalSection_Enter(&mt->btSync.cs); + CriticalSection_Enter(&mt->hashSync.cs); + { + const Byte *beforePtr = MatchFinder_GetPointerToCurrentPos(mf); + const Byte *afterPtr; + MatchFinder_MoveBlock(mf); + afterPtr = MatchFinder_GetPointerToCurrentPos(mf); + mt->pointerToCurPos -= beforePtr - afterPtr; + mt->buffer -= beforePtr - afterPtr; + } + CriticalSection_Leave(&mt->btSync.cs); + CriticalSection_Leave(&mt->hashSync.cs); + continue; + } + + Semaphore_Wait(&p->freeSemaphore); + + MatchFinder_ReadIfRequired(mf); + if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize)) + { + UInt32 subValue = (mf->pos - mf->historySize - 1); + MatchFinder_ReduceOffsets(mf, subValue); + MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, mf->hashMask + 1); + } + { + UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize; + UInt32 num = mf->streamPos - mf->pos; + heads[0] = 2; + heads[1] = num; + if (num >= mf->numHashBytes) + { + num = num - mf->numHashBytes + 1; + if (num > kMtHashBlockSize - 2) + num = kMtHashBlockSize - 2; + mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc); + heads[0] += num; + } + mf->pos += num; + mf->buffer += num; + } + } + + Semaphore_Release1(&p->filledSemaphore); + } + } +} + +void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p) +{ + MtSync_GetNextBlock(&p->hashSync); + p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize; + p->hashBufPosLimit += p->hashBuf[p->hashBufPos++]; + p->hashNumAvail = p->hashBuf[p->hashBufPos++]; +} + +#define kEmptyHashValue 0 + +/* #define MFMT_GM_INLINE */ + +#ifdef MFMT_GM_INLINE + +#define NO_INLINE MY_FAST_CALL + +Int32 NO_INLINE GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son, + UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, + UInt32 *_distances, UInt32 _maxLen, const UInt32 *hash, Int32 limit, UInt32 size, UInt32 *posRes) +{ + do + { + UInt32 *distances = _distances + 1; + UInt32 curMatch = pos - *hash++; + + CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; + CLzRef *ptr1 = son + (_cyclicBufferPos << 1); + UInt32 len0 = 0, len1 = 0; + UInt32 cutValue = _cutValue; + UInt32 maxLen = _maxLen; + for (;;) + { + UInt32 delta = pos - curMatch; + if (cutValue-- == 0 || delta >= _cyclicBufferSize) + { + *ptr0 = *ptr1 = kEmptyHashValue; + break; + } + { + CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); + const Byte *pb = cur - delta; + UInt32 len = (len0 < len1 ? len0 : len1); + if (pb[len] == cur[len]) + { + if (++len != lenLimit && pb[len] == cur[len]) + while (++len != lenLimit) + if (pb[len] != cur[len]) + break; + if (maxLen < len) + { + *distances++ = maxLen = len; + *distances++ = delta - 1; + if (len == lenLimit) + { + *ptr1 = pair[0]; + *ptr0 = pair[1]; + break; + } + } + } + if (pb[len] < cur[len]) + { + *ptr1 = curMatch; + ptr1 = pair + 1; + curMatch = *ptr1; + len1 = len; + } + else + { + *ptr0 = curMatch; + ptr0 = pair; + curMatch = *ptr0; + len0 = len; + } + } + } + pos++; + _cyclicBufferPos++; + cur++; + { + UInt32 num = (UInt32)(distances - _distances); + *_distances = num - 1; + _distances += num; + limit -= num; + } + } + while (limit > 0 && --size != 0); + *posRes = pos; + return limit; +} + +#endif + +void BtGetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + UInt32 numProcessed = 0; + UInt32 curPos = 2; + UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2); + distances[1] = p->hashNumAvail; + while (curPos < limit) + { + if (p->hashBufPos == p->hashBufPosLimit) + { + MatchFinderMt_GetNextBlock_Hash(p); + distances[1] = numProcessed + p->hashNumAvail; + if (p->hashNumAvail >= p->numHashBytes) + continue; + for (; p->hashNumAvail != 0; p->hashNumAvail--) + distances[curPos++] = 0; + break; + } + { + UInt32 size = p->hashBufPosLimit - p->hashBufPos; + UInt32 lenLimit = p->matchMaxLen; + UInt32 pos = p->pos; + UInt32 cyclicBufferPos = p->cyclicBufferPos; + if (lenLimit >= p->hashNumAvail) + lenLimit = p->hashNumAvail; + { + UInt32 size2 = p->hashNumAvail - lenLimit + 1; + if (size2 < size) + size = size2; + size2 = p->cyclicBufferSize - cyclicBufferPos; + if (size2 < size) + size = size2; + } + #ifndef MFMT_GM_INLINE + while (curPos < limit && size-- != 0) + { + UInt32 *startDistances = distances + curPos; + UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++], + pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue, + startDistances + 1, p->numHashBytes - 1) - startDistances); + *startDistances = num - 1; + curPos += num; + cyclicBufferPos++; + pos++; + p->buffer++; + } + #else + { + UInt32 posRes; + curPos = limit - GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue, + distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos, (Int32)(limit - curPos) , size, &posRes); + p->hashBufPos += posRes - pos; + cyclicBufferPos += posRes - pos; + p->buffer += posRes - pos; + pos = posRes; + } + #endif + + numProcessed += pos - p->pos; + p->hashNumAvail -= pos - p->pos; + p->pos = pos; + if (cyclicBufferPos == p->cyclicBufferSize) + cyclicBufferPos = 0; + p->cyclicBufferPos = cyclicBufferPos; + } + } + distances[0] = curPos; +} + +void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex) +{ + CMtSync *sync = &p->hashSync; + if (!sync->needStart) + { + CriticalSection_Enter(&sync->cs); + sync->csWasEntered = True; + } + + BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize); + + if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize) + { + UInt32 subValue = p->pos - p->cyclicBufferSize; + MatchFinder_Normalize3(subValue, p->son, p->cyclicBufferSize * 2); + p->pos -= subValue; + } + + if (!sync->needStart) + { + CriticalSection_Leave(&sync->cs); + sync->csWasEntered = False; + } +} + +void BtThreadFunc(CMatchFinderMt *mt) +{ + CMtSync *p = &mt->btSync; + for (;;) + { + UInt32 blockIndex = 0; + Event_Wait(&p->canStart); + Event_Set(&p->wasStarted); + for (;;) + { + if (p->exit) + return; + if (p->stopWriting) + { + p->numProcessedBlocks = blockIndex; + MtSync_StopWriting(&mt->hashSync); + Event_Set(&p->wasStopped); + break; + } + Semaphore_Wait(&p->freeSemaphore); + BtFillBlock(mt, blockIndex++); + Semaphore_Release1(&p->filledSemaphore); + } + } +} + +void MatchFinderMt_Construct(CMatchFinderMt *p) +{ + p->hashBuf = 0; + MtSync_Construct(&p->hashSync); + MtSync_Construct(&p->btSync); +} + +void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->hashBuf); + p->hashBuf = 0; +} + +void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc) +{ + MtSync_Destruct(&p->hashSync); + MtSync_Destruct(&p->btSync); + MatchFinderMt_FreeMem(p, alloc); +} + +#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks) +#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks) + +static unsigned MY_STD_CALL HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; } +static unsigned MY_STD_CALL BtThreadFunc2(void *p) +{ + Byte allocaDummy[0x180]; + int i = 0; + for (i = 0; i < 16; i++) + allocaDummy[i] = (Byte)i; + BtThreadFunc((CMatchFinderMt *)p); + return 0; +} + +SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore, + UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc) +{ + CMatchFinder *mf = p->MatchFinder; + p->historySize = historySize; + if (kMtBtBlockSize <= matchMaxLen * 4) + return SZ_ERROR_PARAM; + if (p->hashBuf == 0) + { + p->hashBuf = (UInt32 *)alloc->Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32)); + if (p->hashBuf == 0) + return SZ_ERROR_MEM; + p->btBuf = p->hashBuf + kHashBufferSize; + } + keepAddBufferBefore += (kHashBufferSize + kBtBufferSize); + keepAddBufferAfter += kMtHashBlockSize; + if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc)) + return SZ_ERROR_MEM; + + RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks)); + RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks)); + return SZ_OK; +} + +/* Call it after ReleaseStream / SetStream */ +void MatchFinderMt_Init(CMatchFinderMt *p) +{ + CMatchFinder *mf = p->MatchFinder; + p->btBufPos = p->btBufPosLimit = 0; + p->hashBufPos = p->hashBufPosLimit = 0; + MatchFinder_Init(mf); + p->pointerToCurPos = MatchFinder_GetPointerToCurrentPos(mf); + p->btNumAvailBytes = 0; + p->lzPos = p->historySize + 1; + + p->hash = mf->hash; + p->fixedHashSize = mf->fixedHashSize; + p->crc = mf->crc; + + p->son = mf->son; + p->matchMaxLen = mf->matchMaxLen; + p->numHashBytes = mf->numHashBytes; + p->pos = mf->pos; + p->buffer = mf->buffer; + p->cyclicBufferPos = mf->cyclicBufferPos; + p->cyclicBufferSize = mf->cyclicBufferSize; + p->cutValue = mf->cutValue; +} + +/* ReleaseStream is required to finish multithreading */ +void MatchFinderMt_ReleaseStream(CMatchFinderMt *p) +{ + MtSync_StopWriting(&p->btSync); + /* p->MatchFinder->ReleaseStream(); */ +} + +void MatchFinderMt_Normalize(CMatchFinderMt *p) +{ + MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize); + p->lzPos = p->historySize + 1; +} + +void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p) +{ + UInt32 blockIndex; + MtSync_GetNextBlock(&p->btSync); + blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask); + p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize; + p->btBufPosLimit += p->btBuf[p->btBufPos++]; + p->btNumAvailBytes = p->btBuf[p->btBufPos++]; + if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize) + MatchFinderMt_Normalize(p); +} + +const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p) +{ + return p->pointerToCurPos; +} + +#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p); + +UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p) +{ + GET_NEXT_BLOCK_IF_REQUIRED; + return p->btNumAvailBytes; +} + +Byte MatchFinderMt_GetIndexByte(CMatchFinderMt *p, Int32 index) +{ + return p->pointerToCurPos[index]; +} + +UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, curMatch2; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH2_CALC + + curMatch2 = hash[hash2Value]; + hash[hash2Value] = lzPos; + + if (curMatch2 >= matchMinPos) + if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + *distances++ = 2; + *distances++ = lzPos - curMatch2 - 1; + } + return distances; +} + +UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, curMatch2, curMatch3; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH3_CALC + + curMatch2 = hash[ hash2Value]; + curMatch3 = hash[kFix3HashSize + hash3Value]; + + hash[ hash2Value] = + hash[kFix3HashSize + hash3Value] = + lzPos; + + if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch2 - 1; + if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2]) + { + distances[0] = 3; + return distances + 2; + } + distances[0] = 2; + distances += 2; + } + if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0]) + { + *distances++ = 3; + *distances++ = lzPos - curMatch3 - 1; + } + return distances; +} + +/* +UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances) +{ + UInt32 hash2Value, hash3Value, hash4Value, curMatch2, curMatch3, curMatch4; + UInt32 *hash = p->hash; + const Byte *cur = p->pointerToCurPos; + UInt32 lzPos = p->lzPos; + MT_HASH4_CALC + + curMatch2 = hash[ hash2Value]; + curMatch3 = hash[kFix3HashSize + hash3Value]; + curMatch4 = hash[kFix4HashSize + hash4Value]; + + hash[ hash2Value] = + hash[kFix3HashSize + hash3Value] = + hash[kFix4HashSize + hash4Value] = + lzPos; + + if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch2 - 1; + if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2]) + { + distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3; + return distances + 2; + } + distances[0] = 2; + distances += 2; + } + if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0]) + { + distances[1] = lzPos - curMatch3 - 1; + if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3]) + { + distances[0] = 4; + return distances + 2; + } + distances[0] = 3; + distances += 2; + } + + if (curMatch4 >= matchMinPos) + if ( + cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] && + cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3] + ) + { + *distances++ = 4; + *distances++ = lzPos - curMatch4 - 1; + } + return distances; +} +*/ + +#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++; + +UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + const UInt32 *btBuf = p->btBuf + p->btBufPos; + UInt32 len = *btBuf++; + p->btBufPos += 1 + len; + p->btNumAvailBytes--; + { + UInt32 i; + for (i = 0; i < len; i += 2) + { + *distances++ = *btBuf++; + *distances++ = *btBuf++; + } + } + INCREASE_LZ_POS + return len; +} + +UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances) +{ + const UInt32 *btBuf = p->btBuf + p->btBufPos; + UInt32 len = *btBuf++; + p->btBufPos += 1 + len; + + if (len == 0) + { + if (p->btNumAvailBytes-- >= 4) + len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances)); + } + else + { + /* Condition: there are matches in btBuf with length < p->numHashBytes */ + UInt32 *distances2; + p->btNumAvailBytes--; + distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances); + do + { + *distances2++ = *btBuf++; + *distances2++ = *btBuf++; + } + while ((len -= 2) != 0); + len = (UInt32)(distances2 - (distances)); + } + INCREASE_LZ_POS + return len; +} + +#define SKIP_HEADER2_MT do { GET_NEXT_BLOCK_IF_REQUIRED +#define SKIP_HEADER_MT(n) SKIP_HEADER2_MT if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash; +#define SKIP_FOOTER_MT } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0); + +void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER2_MT { p->btNumAvailBytes--; + SKIP_FOOTER_MT +} + +void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(2) + UInt32 hash2Value; + MT_HASH2_CALC + hash[hash2Value] = p->lzPos; + SKIP_FOOTER_MT +} + +void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(3) + UInt32 hash2Value, hash3Value; + MT_HASH3_CALC + hash[kFix3HashSize + hash3Value] = + hash[ hash2Value] = + p->lzPos; + SKIP_FOOTER_MT +} + +/* +void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num) +{ + SKIP_HEADER_MT(4) + UInt32 hash2Value, hash3Value, hash4Value; + MT_HASH4_CALC + hash[kFix4HashSize + hash4Value] = + hash[kFix3HashSize + hash3Value] = + hash[ hash2Value] = + p->lzPos; + SKIP_FOOTER_MT +} +*/ + +void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable) +{ + vTable->Init = (Mf_Init_Func)MatchFinderMt_Init; + vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinderMt_GetIndexByte; + vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes; + vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos; + vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches; + switch(p->MatchFinder->numHashBytes) + { + case 2: + p->GetHeadsFunc = GetHeads2; + p->MixMatchesFunc = (Mf_Mix_Matches)0; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip; + vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches; + break; + case 3: + p->GetHeadsFunc = GetHeads3; + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip; + break; + default: + /* case 4: */ + p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4; + /* p->GetHeadsFunc = GetHeads4; */ + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip; + break; + /* + default: + p->GetHeadsFunc = GetHeads5; + p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4; + vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip; + break; + */ + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzFindMt.h b/src/ZipLib/extlibs/lzma/unix/LzFindMt.h new file mode 100644 index 00000000..b985af5f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzFindMt.h @@ -0,0 +1,105 @@ +/* LzFindMt.h -- multithreaded Match finder for LZ algorithms +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZ_FIND_MT_H +#define __LZ_FIND_MT_H + +#include "LzFind.h" +#include "Threads.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define kMtHashBlockSize (1 << 13) +#define kMtHashNumBlocks (1 << 3) +#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1) + +#define kMtBtBlockSize (1 << 14) +#define kMtBtNumBlocks (1 << 6) +#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1) + +typedef struct _CMtSync +{ + Bool wasCreated; + Bool needStart; + Bool exit; + Bool stopWriting; + + CThread thread; + CAutoResetEvent canStart; + CAutoResetEvent wasStarted; + CAutoResetEvent wasStopped; + CSemaphore freeSemaphore; + CSemaphore filledSemaphore; + Bool csWasInitialized; + Bool csWasEntered; + CCriticalSection cs; + UInt32 numProcessedBlocks; +} CMtSync; + +typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances); + +/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */ +#define kMtCacheLineDummy 128 + +typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos, + UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc); + +typedef struct _CMatchFinderMt +{ + /* LZ */ + const Byte *pointerToCurPos; + UInt32 *btBuf; + UInt32 btBufPos; + UInt32 btBufPosLimit; + UInt32 lzPos; + UInt32 btNumAvailBytes; + + UInt32 *hash; + UInt32 fixedHashSize; + UInt32 historySize; + const UInt32 *crc; + + Mf_Mix_Matches MixMatchesFunc; + + /* LZ + BT */ + CMtSync btSync; + Byte btDummy[kMtCacheLineDummy]; + + /* BT */ + UInt32 *hashBuf; + UInt32 hashBufPos; + UInt32 hashBufPosLimit; + UInt32 hashNumAvail; + + CLzRef *son; + UInt32 matchMaxLen; + UInt32 numHashBytes; + UInt32 pos; + Byte *buffer; + UInt32 cyclicBufferPos; + UInt32 cyclicBufferSize; /* it must be historySize + 1 */ + UInt32 cutValue; + + /* BT + Hash */ + CMtSync hashSync; + /* Byte hashDummy[kMtCacheLineDummy]; */ + + /* Hash */ + Mf_GetHeads GetHeadsFunc; + CMatchFinder *MatchFinder; +} CMatchFinderMt; + +void MatchFinderMt_Construct(CMatchFinderMt *p); +void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc); +SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore, + UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc); +void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable); +void MatchFinderMt_ReleaseStream(CMatchFinderMt *p); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzHash.h b/src/ZipLib/extlibs/lzma/unix/LzHash.h new file mode 100644 index 00000000..f3e89966 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzHash.h @@ -0,0 +1,54 @@ +/* LzHash.h -- HASH functions for LZ algorithms +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZ_HASH_H +#define __LZ_HASH_H + +#define kHash2Size (1 << 10) +#define kHash3Size (1 << 16) +#define kHash4Size (1 << 20) + +#define kFix3HashSize (kHash2Size) +#define kFix4HashSize (kHash2Size + kHash3Size) +#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) + +#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8); + +#define HASH3_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } + +#define HASH4_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; } + +#define HASH5_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \ + hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \ + hash4Value &= (kHash4Size - 1); } + +/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ +#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; + + +#define MT_HASH2_CALC \ + hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); + +#define MT_HASH3_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } + +#define MT_HASH4_CALC { \ + UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ + hash2Value = temp & (kHash2Size - 1); \ + hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \ + hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.c b/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.c new file mode 100644 index 00000000..7ea1cc95 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.c @@ -0,0 +1,356 @@ +/* Lzma2Dec.c -- LZMA2 Decoder +2009-05-03 : Igor Pavlov : Public domain */ + +/* #define SHOW_DEBUG_INFO */ + +#ifdef SHOW_DEBUG_INFO +#include +#endif + +#include + +#include "Lzma2Dec.h" + +/* +00000000 - EOS +00000001 U U - Uncompressed Reset Dic +00000010 U U - Uncompressed No Reset +100uuuuu U U P P - LZMA no reset +101uuuuu U U P P - LZMA reset state +110uuuuu U U P P S - LZMA reset state + new prop +111uuuuu U U P P S - LZMA reset state + new prop + reset dic + + u, U - Unpack Size + P - Pack Size + S - Props +*/ + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_IS_UNCOMPRESSED_STATE(p) (((p)->control & LZMA2_CONTROL_LZMA) == 0) + +#define LZMA2_GET_LZMA_MODE(p) (((p)->control >> 5) & 3) +#define LZMA2_IS_THERE_PROP(mode) ((mode) >= 2) + +#define LZMA2_LCLP_MAX 4 +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#ifdef SHOW_DEBUG_INFO +#define PRF(x) x +#else +#define PRF(x) +#endif + +typedef enum +{ + LZMA2_STATE_CONTROL, + LZMA2_STATE_UNPACK0, + LZMA2_STATE_UNPACK1, + LZMA2_STATE_PACK0, + LZMA2_STATE_PACK1, + LZMA2_STATE_PROP, + LZMA2_STATE_DATA, + LZMA2_STATE_DATA_CONT, + LZMA2_STATE_FINISHED, + LZMA2_STATE_ERROR +} ELzma2State; + +static SRes Lzma2Dec_GetOldProps(Byte prop, Byte *props) +{ + UInt32 dicSize; + if (prop > 40) + return SZ_ERROR_UNSUPPORTED; + dicSize = (prop == 40) ? 0xFFFFFFFF : LZMA2_DIC_SIZE_FROM_PROP(prop); + props[0] = (Byte)LZMA2_LCLP_MAX; + props[1] = (Byte)(dicSize); + props[2] = (Byte)(dicSize >> 8); + props[3] = (Byte)(dicSize >> 16); + props[4] = (Byte)(dicSize >> 24); + return SZ_OK; +} + +SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc) +{ + Byte props[LZMA_PROPS_SIZE]; + RINOK(Lzma2Dec_GetOldProps(prop, props)); + return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc); +} + +void Lzma2Dec_Init(CLzma2Dec *p) +{ + p->state = LZMA2_STATE_CONTROL; + p->needInitDic = True; + p->needInitState = True; + p->needInitProp = True; + LzmaDec_Init(&p->decoder); +} + +static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b) +{ + switch(p->state) + { + case LZMA2_STATE_CONTROL: + p->control = b; + PRF(printf("\n %4X ", p->decoder.dicPos)); + PRF(printf(" %2X", b)); + if (p->control == 0) + return LZMA2_STATE_FINISHED; + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if ((p->control & 0x7F) > 2) + return LZMA2_STATE_ERROR; + p->unpackSize = 0; + } + else + p->unpackSize = (UInt32)(p->control & 0x1F) << 16; + return LZMA2_STATE_UNPACK0; + + case LZMA2_STATE_UNPACK0: + p->unpackSize |= (UInt32)b << 8; + return LZMA2_STATE_UNPACK1; + + case LZMA2_STATE_UNPACK1: + p->unpackSize |= (UInt32)b; + p->unpackSize++; + PRF(printf(" %8d", p->unpackSize)); + return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0; + + case LZMA2_STATE_PACK0: + p->packSize = (UInt32)b << 8; + return LZMA2_STATE_PACK1; + + case LZMA2_STATE_PACK1: + p->packSize |= (UInt32)b; + p->packSize++; + PRF(printf(" %8d", p->packSize)); + return LZMA2_IS_THERE_PROP(LZMA2_GET_LZMA_MODE(p)) ? LZMA2_STATE_PROP: + (p->needInitProp ? LZMA2_STATE_ERROR : LZMA2_STATE_DATA); + + case LZMA2_STATE_PROP: + { + int lc, lp; + if (b >= (9 * 5 * 5)) + return LZMA2_STATE_ERROR; + lc = b % 9; + b /= 9; + p->decoder.prop.pb = b / 5; + lp = b % 5; + if (lc + lp > LZMA2_LCLP_MAX) + return LZMA2_STATE_ERROR; + p->decoder.prop.lc = lc; + p->decoder.prop.lp = lp; + p->needInitProp = False; + return LZMA2_STATE_DATA; + } + } + return LZMA2_STATE_ERROR; +} + +static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size) +{ + memcpy(p->dic + p->dicPos, src, size); + p->dicPos += size; + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= size) + p->checkDicSize = p->prop.dicSize; + p->processedPos += (UInt32)size; +} + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState); + +SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->state != LZMA2_STATE_FINISHED) + { + SizeT dicPos = p->decoder.dicPos; + if (p->state == LZMA2_STATE_ERROR) + return SZ_ERROR_DATA; + if (dicPos == dicLimit && finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + (*srcLen)++; + p->state = Lzma2Dec_UpdateState(p, *src++); + continue; + } + { + SizeT destSizeCur = dicLimit - dicPos; + SizeT srcSizeCur = inSize - *srcLen; + ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY; + + if (p->unpackSize <= destSizeCur) + { + destSizeCur = (SizeT)p->unpackSize; + curFinishMode = LZMA_FINISH_END; + } + + if (LZMA2_IS_UNCOMPRESSED_STATE(p)) + { + if (*srcLen == inSize) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + if (p->state == LZMA2_STATE_DATA) + { + Bool initDic = (p->control == LZMA2_CONTROL_COPY_RESET_DIC); + if (initDic) + p->needInitProp = p->needInitState = True; + else if (p->needInitDic) + return SZ_ERROR_DATA; + p->needInitDic = False; + LzmaDec_InitDicAndState(&p->decoder, initDic, False); + } + + if (srcSizeCur > destSizeCur) + srcSizeCur = destSizeCur; + + if (srcSizeCur == 0) + return SZ_ERROR_DATA; + + LzmaDec_UpdateWithUncompressed(&p->decoder, src, srcSizeCur); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->unpackSize -= (UInt32)srcSizeCur; + p->state = (p->unpackSize == 0) ? LZMA2_STATE_CONTROL : LZMA2_STATE_DATA_CONT; + } + else + { + SizeT outSizeProcessed; + SRes res; + + if (p->state == LZMA2_STATE_DATA) + { + int mode = LZMA2_GET_LZMA_MODE(p); + Bool initDic = (mode == 3); + Bool initState = (mode > 0); + if ((!initDic && p->needInitDic) || (!initState && p->needInitState)) + return SZ_ERROR_DATA; + + LzmaDec_InitDicAndState(&p->decoder, initDic, initState); + p->needInitDic = False; + p->needInitState = False; + p->state = LZMA2_STATE_DATA_CONT; + } + if (srcSizeCur > p->packSize) + srcSizeCur = (SizeT)p->packSize; + + res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status); + + src += srcSizeCur; + *srcLen += srcSizeCur; + p->packSize -= (UInt32)srcSizeCur; + + outSizeProcessed = p->decoder.dicPos - dicPos; + p->unpackSize -= (UInt32)outSizeProcessed; + + RINOK(res); + if (*status == LZMA_STATUS_NEEDS_MORE_INPUT) + return res; + + if (srcSizeCur == 0 && outSizeProcessed == 0) + { + if (*status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK || + p->unpackSize != 0 || p->packSize != 0) + return SZ_ERROR_DATA; + p->state = LZMA2_STATE_CONTROL; + } + if (*status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK) + *status = LZMA_STATUS_NOT_FINISHED; + } + } + } + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen, inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT srcSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->decoder.dicPos == p->decoder.dicBufSize) + p->decoder.dicPos = 0; + dicPos = p->decoder.dicPos; + if (outSize > p->decoder.dicBufSize - dicPos) + { + outSizeCur = p->decoder.dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = Lzma2Dec_DecodeToDic(p, outSizeCur, src, &srcSizeCur, curFinishMode, status); + src += srcSizeCur; + inSize -= srcSizeCur; + *srcLen += srcSizeCur; + outSizeCur = p->decoder.dicPos - dicPos; + memcpy(dest, p->decoder.dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzma2Dec decoder; + SRes res; + SizeT outSize = *destLen, inSize = *srcLen; + Byte props[LZMA_PROPS_SIZE]; + + Lzma2Dec_Construct(&decoder); + + *destLen = *srcLen = 0; + *status = LZMA_STATUS_NOT_SPECIFIED; + decoder.decoder.dic = dest; + decoder.decoder.dicBufSize = outSize; + + RINOK(Lzma2Dec_GetOldProps(prop, props)); + RINOK(LzmaDec_AllocateProbs(&decoder.decoder, props, LZMA_PROPS_SIZE, alloc)); + + *srcLen = inSize; + res = Lzma2Dec_DecodeToDic(&decoder, outSize, src, srcLen, finishMode, status); + *destLen = decoder.decoder.dicPos; + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + + LzmaDec_FreeProbs(&decoder.decoder, alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.h b/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.h new file mode 100644 index 00000000..6bc07bbc --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Lzma2Dec.h @@ -0,0 +1,84 @@ +/* Lzma2Dec.h -- LZMA2 Decoder +2009-05-03 : Igor Pavlov : Public domain */ + +#ifndef __LZMA2_DEC_H +#define __LZMA2_DEC_H + +#include "LzmaDec.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ---------- State Interface ---------- */ + +typedef struct +{ + CLzmaDec decoder; + UInt32 packSize; + UInt32 unpackSize; + int state; + Byte control; + Bool needInitDic; + Bool needInitState; + Bool needInitProp; +} CLzma2Dec; + +#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder) +#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc); +#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc); + +SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); +SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc); +void Lzma2Dec_Init(CLzma2Dec *p); + + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen or dicLimit). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NEEDS_MORE_INPUT + SZ_ERROR_DATA - Data error +*/ + +SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + +SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- One Call Interface ---------- */ + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + +SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.c b/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.c new file mode 100644 index 00000000..e97597f6 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.c @@ -0,0 +1,477 @@ +/* Lzma2Enc.c -- LZMA2 Encoder +2010-09-24 : Igor Pavlov : Public domain */ + +/* #include */ +#include + +/* #define _7ZIP_ST */ + +#include "Lzma2Enc.h" + +#ifndef _7ZIP_ST +#include "MtCoder.h" +#else +#define NUM_MT_CODER_THREADS_MAX 1 +#endif + +#define LZMA2_CONTROL_LZMA (1 << 7) +#define LZMA2_CONTROL_COPY_NO_RESET 2 +#define LZMA2_CONTROL_COPY_RESET_DIC 1 +#define LZMA2_CONTROL_EOF 0 + +#define LZMA2_LCLP_MAX 4 + +#define LZMA2_DIC_SIZE_FROM_PROP(p) (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11)) + +#define LZMA2_PACK_SIZE_MAX (1 << 16) +#define LZMA2_COPY_CHUNK_SIZE LZMA2_PACK_SIZE_MAX +#define LZMA2_UNPACK_SIZE_MAX (1 << 21) +#define LZMA2_KEEP_WINDOW_SIZE LZMA2_UNPACK_SIZE_MAX + +#define LZMA2_CHUNK_SIZE_COMPRESSED_MAX ((1 << 16) + 16) + + +#define PRF(x) /* x */ + +/* ---------- CLzma2EncInt ---------- */ + +typedef struct +{ + CLzmaEncHandle enc; + UInt64 srcPos; + Byte props; + Bool needInitState; + Bool needInitProp; +} CLzma2EncInt; + +static SRes Lzma2EncInt_Init(CLzma2EncInt *p, const CLzma2EncProps *props) +{ + Byte propsEncoded[LZMA_PROPS_SIZE]; + SizeT propsSize = LZMA_PROPS_SIZE; + RINOK(LzmaEnc_SetProps(p->enc, &props->lzmaProps)); + RINOK(LzmaEnc_WriteProperties(p->enc, propsEncoded, &propsSize)); + p->srcPos = 0; + p->props = propsEncoded[0]; + p->needInitState = True; + p->needInitProp = True; + return SZ_OK; +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp); +void LzmaEnc_Finish(CLzmaEncHandle pp); +void LzmaEnc_SaveState(CLzmaEncHandle pp); +void LzmaEnc_RestoreState(CLzmaEncHandle pp); + + +static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf, + size_t *packSizeRes, ISeqOutStream *outStream) +{ + size_t packSizeLimit = *packSizeRes; + size_t packSize = packSizeLimit; + UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX; + unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0); + Bool useCopyBlock; + SRes res; + + *packSizeRes = 0; + if (packSize < lzHeaderSize) + return SZ_ERROR_OUTPUT_EOF; + packSize -= lzHeaderSize; + + LzmaEnc_SaveState(p->enc); + res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState, + outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize); + + PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize)); + + if (unpackSize == 0) + return res; + + if (res == SZ_OK) + useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16)); + else + { + if (res != SZ_ERROR_OUTPUT_EOF) + return res; + res = SZ_OK; + useCopyBlock = True; + } + + if (useCopyBlock) + { + size_t destPos = 0; + PRF(printf("################# COPY ")); + while (unpackSize > 0) + { + UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE; + if (packSizeLimit - destPos < u + 3) + return SZ_ERROR_OUTPUT_EOF; + outBuf[destPos++] = (Byte)(p->srcPos == 0 ? LZMA2_CONTROL_COPY_RESET_DIC : LZMA2_CONTROL_COPY_NO_RESET); + outBuf[destPos++] = (Byte)((u - 1) >> 8); + outBuf[destPos++] = (Byte)(u - 1); + memcpy(outBuf + destPos, LzmaEnc_GetCurBuf(p->enc) - unpackSize, u); + unpackSize -= u; + destPos += u; + p->srcPos += u; + if (outStream) + { + *packSizeRes += destPos; + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + destPos = 0; + } + else + *packSizeRes = destPos; + /* needInitState = True; */ + } + LzmaEnc_RestoreState(p->enc); + return SZ_OK; + } + { + size_t destPos = 0; + UInt32 u = unpackSize - 1; + UInt32 pm = (UInt32)(packSize - 1); + unsigned mode = (p->srcPos == 0) ? 3 : (p->needInitState ? (p->needInitProp ? 2 : 1) : 0); + + PRF(printf(" ")); + + outBuf[destPos++] = (Byte)(LZMA2_CONTROL_LZMA | (mode << 5) | ((u >> 16) & 0x1F)); + outBuf[destPos++] = (Byte)(u >> 8); + outBuf[destPos++] = (Byte)u; + outBuf[destPos++] = (Byte)(pm >> 8); + outBuf[destPos++] = (Byte)pm; + + if (p->needInitProp) + outBuf[destPos++] = p->props; + + p->needInitProp = False; + p->needInitState = False; + destPos += packSize; + p->srcPos += unpackSize; + + if (outStream) + if (outStream->Write(outStream, outBuf, destPos) != destPos) + return SZ_ERROR_WRITE; + *packSizeRes = destPos; + return SZ_OK; + } +} + +/* ---------- Lzma2 Props ---------- */ + +void Lzma2EncProps_Init(CLzma2EncProps *p) +{ + LzmaEncProps_Init(&p->lzmaProps); + p->numTotalThreads = -1; + p->numBlockThreads = -1; + p->blockSize = 0; +} + +void Lzma2EncProps_Normalize(CLzma2EncProps *p) +{ + int t1, t1n, t2, t3; + { + CLzmaEncProps lzmaProps = p->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + t1n = lzmaProps.numThreads; + } + + t1 = p->lzmaProps.numThreads; + t2 = p->numBlockThreads; + t3 = p->numTotalThreads; + + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + + if (t3 <= 0) + { + if (t2 <= 0) + t2 = 1; + t3 = t1n * t2; + } + else if (t2 <= 0) + { + t2 = t3 / t1n; + if (t2 == 0) + { + t1 = 1; + t2 = t3; + } + if (t2 > NUM_MT_CODER_THREADS_MAX) + t2 = NUM_MT_CODER_THREADS_MAX; + } + else if (t1 <= 0) + { + t1 = t3 / t2; + if (t1 == 0) + t1 = 1; + } + else + t3 = t1n * t2; + + p->lzmaProps.numThreads = t1; + p->numBlockThreads = t2; + p->numTotalThreads = t3; + LzmaEncProps_Normalize(&p->lzmaProps); + + if (p->blockSize == 0) + { + UInt32 dictSize = p->lzmaProps.dictSize; + UInt64 blockSize = (UInt64)dictSize << 2; + const UInt32 kMinSize = (UInt32)1 << 20; + const UInt32 kMaxSize = (UInt32)1 << 28; + if (blockSize < kMinSize) blockSize = kMinSize; + if (blockSize > kMaxSize) blockSize = kMaxSize; + if (blockSize < dictSize) blockSize = dictSize; + p->blockSize = (size_t)blockSize; + } +} + +static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) +{ + return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; +} + +/* ---------- Lzma2 ---------- */ + +typedef struct +{ + Byte propEncoded; + CLzma2EncProps props; + + Byte *outBuf; + + ISzAlloc *alloc; + ISzAlloc *allocBig; + + CLzma2EncInt coders[NUM_MT_CODER_THREADS_MAX]; + + #ifndef _7ZIP_ST + CMtCoder mtCoder; + #endif + +} CLzma2Enc; + + +/* ---------- Lzma2EncThread ---------- */ + +static SRes Lzma2Enc_EncodeMt1(CLzma2EncInt *p, CLzma2Enc *mainEncoder, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + UInt64 packTotal = 0; + SRes res = SZ_OK; + + if (mainEncoder->outBuf == 0) + { + mainEncoder->outBuf = (Byte *)IAlloc_Alloc(mainEncoder->alloc, LZMA2_CHUNK_SIZE_COMPRESSED_MAX); + if (mainEncoder->outBuf == 0) + return SZ_ERROR_MEM; + } + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + RINOK(LzmaEnc_PrepareForLzma2(p->enc, inStream, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + for (;;) + { + size_t packSize = LZMA2_CHUNK_SIZE_COMPRESSED_MAX; + res = Lzma2EncInt_EncodeSubblock(p, mainEncoder->outBuf, &packSize, outStream); + if (res != SZ_OK) + break; + packTotal += packSize; + res = Progress(progress, p->srcPos, packTotal); + if (res != SZ_OK) + break; + if (packSize == 0) + break; + } + LzmaEnc_Finish(p->enc); + if (res == SZ_OK) + { + Byte b = 0; + if (outStream->Write(outStream, &b, 1) != 1) + return SZ_ERROR_WRITE; + } + return res; +} + +#ifndef _7ZIP_ST + +typedef struct +{ + IMtCoderCallback funcTable; + CLzma2Enc *lzma2Enc; +} CMtCallbackImp; + +static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *destSize, + const Byte *src, size_t srcSize, int finished) +{ + CMtCallbackImp *imp = (CMtCallbackImp *)pp; + CLzma2Enc *mainEncoder = imp->lzma2Enc; + CLzma2EncInt *p = &mainEncoder->coders[index]; + + SRes res = SZ_OK; + { + size_t destLim = *destSize; + *destSize = 0; + + if (srcSize != 0) + { + RINOK(Lzma2EncInt_Init(p, &mainEncoder->props)); + + RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE, + mainEncoder->alloc, mainEncoder->allocBig)); + + while (p->srcPos < srcSize) + { + size_t packSize = destLim - *destSize; + res = Lzma2EncInt_EncodeSubblock(p, dest + *destSize, &packSize, NULL); + if (res != SZ_OK) + break; + *destSize += packSize; + + if (packSize == 0) + { + res = SZ_ERROR_FAIL; + break; + } + + if (MtProgress_Set(&mainEncoder->mtCoder.mtProgress, index, p->srcPos, *destSize) != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + LzmaEnc_Finish(p->enc); + if (res != SZ_OK) + return res; + } + if (finished) + { + if (*destSize == destLim) + return SZ_ERROR_OUTPUT_EOF; + dest[(*destSize)++] = 0; + } + } + return res; +} + +#endif + +/* ---------- Lzma2Enc ---------- */ + +CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzma2Enc *p = (CLzma2Enc *)alloc->Alloc(alloc, sizeof(CLzma2Enc)); + if (p == 0) + return NULL; + Lzma2EncProps_Init(&p->props); + Lzma2EncProps_Normalize(&p->props); + p->outBuf = 0; + p->alloc = alloc; + p->allocBig = allocBig; + { + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + p->coders[i].enc = 0; + } + #ifndef _7ZIP_ST + MtCoder_Construct(&p->mtCoder); + #endif + + return p; +} + +void Lzma2Enc_Destroy(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + { + CLzma2EncInt *t = &p->coders[i]; + if (t->enc) + { + LzmaEnc_Destroy(t->enc, p->alloc, p->allocBig); + t->enc = 0; + } + } + + #ifndef _7ZIP_ST + MtCoder_Destruct(&p->mtCoder); + #endif + + IAlloc_Free(p->alloc, p->outBuf); + IAlloc_Free(p->alloc, pp); +} + +SRes Lzma2Enc_SetProps(CLzma2EncHandle pp, const CLzma2EncProps *props) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + CLzmaEncProps lzmaProps = props->lzmaProps; + LzmaEncProps_Normalize(&lzmaProps); + if (lzmaProps.lc + lzmaProps.lp > LZMA2_LCLP_MAX) + return SZ_ERROR_PARAM; + p->props = *props; + Lzma2EncProps_Normalize(&p->props); + return SZ_OK; +} + +Byte Lzma2Enc_WriteProperties(CLzma2EncHandle pp) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + unsigned i; + UInt32 dicSize = LzmaEncProps_GetDictSize(&p->props.lzmaProps); + for (i = 0; i < 40; i++) + if (dicSize <= LZMA2_DIC_SIZE_FROM_PROP(i)) + break; + return (Byte)i; +} + +SRes Lzma2Enc_Encode(CLzma2EncHandle pp, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress) +{ + CLzma2Enc *p = (CLzma2Enc *)pp; + int i; + + for (i = 0; i < p->props.numBlockThreads; i++) + { + CLzma2EncInt *t = &p->coders[i]; + if (t->enc == NULL) + { + t->enc = LzmaEnc_Create(p->alloc); + if (t->enc == NULL) + return SZ_ERROR_MEM; + } + } + + #ifndef _7ZIP_ST + if (p->props.numBlockThreads <= 1) + #endif + return Lzma2Enc_EncodeMt1(&p->coders[0], p, outStream, inStream, progress); + + #ifndef _7ZIP_ST + + { + CMtCallbackImp mtCallback; + + mtCallback.funcTable.Code = MtCallbackImp_Code; + mtCallback.lzma2Enc = p; + + p->mtCoder.progress = progress; + p->mtCoder.inStream = inStream; + p->mtCoder.outStream = outStream; + p->mtCoder.alloc = p->alloc; + p->mtCoder.mtCallback = &mtCallback.funcTable; + + p->mtCoder.blockSize = p->props.blockSize; + p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16; + p->mtCoder.numThreads = p->props.numBlockThreads; + + return MtCoder_Code(&p->mtCoder); + } + #endif +} diff --git a/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.h b/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.h new file mode 100644 index 00000000..28352558 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Lzma2Enc.h @@ -0,0 +1,66 @@ +/* Lzma2Enc.h -- LZMA2 Encoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA2_ENC_H +#define __LZMA2_ENC_H + +#include "LzmaEnc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + CLzmaEncProps lzmaProps; + size_t blockSize; + int numBlockThreads; + int numTotalThreads; +} CLzma2EncProps; + +void Lzma2EncProps_Init(CLzma2EncProps *p); +void Lzma2EncProps_Normalize(CLzma2EncProps *p); + +/* ---------- CLzmaEnc2Handle Interface ---------- */ + +/* Lzma2Enc_* functions can return the following exit codes: +Returns: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater in props + SZ_ERROR_WRITE - Write callback error + SZ_ERROR_PROGRESS - some break from progress callback + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +typedef void * CLzma2EncHandle; + +CLzma2EncHandle Lzma2Enc_Create(ISzAlloc *alloc, ISzAlloc *allocBig); +void Lzma2Enc_Destroy(CLzma2EncHandle p); +SRes Lzma2Enc_SetProps(CLzma2EncHandle p, const CLzma2EncProps *props); +Byte Lzma2Enc_WriteProperties(CLzma2EncHandle p); +SRes Lzma2Enc_Encode(CLzma2EncHandle p, + ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress); + +/* ---------- One Call Interface ---------- */ + +/* Lzma2Encode +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +/* +SRes Lzma2Encode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); +*/ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaDec.c b/src/ZipLib/extlibs/lzma/unix/LzmaDec.c new file mode 100644 index 00000000..2036761b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaDec.c @@ -0,0 +1,999 @@ +/* LzmaDec.c -- LZMA Decoder +2009-09-20 : Igor Pavlov : Public domain */ + +#include "LzmaDec.h" + +#include + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_INIT_SIZE 5 + +#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); +#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); +#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ + { UPDATE_0(p); i = (i + i); A0; } else \ + { UPDATE_1(p); i = (i + i) + 1; A1; } +#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) + +#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } +#define TREE_DECODE(probs, limit, i) \ + { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } + +/* #define _LZMA_SIZE_OPT */ + +#ifdef _LZMA_SIZE_OPT +#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) +#else +#define TREE_6_DECODE(probs, i) \ + { i = 1; \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + TREE_GET_BIT(probs, i); \ + i -= 0x40; } +#endif + +#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } + +#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) +#define UPDATE_0_CHECK range = bound; +#define UPDATE_1_CHECK range -= bound; code -= bound; +#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ + { UPDATE_0_CHECK; i = (i + i); A0; } else \ + { UPDATE_1_CHECK; i = (i + i) + 1; A1; } +#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) +#define TREE_DECODE_CHECK(probs, limit, i) \ + { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 +#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +#define LZMA_DIC_MIN (1 << 12) + +/* First LZMA-symbol is always decoded. +And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization +Out: + Result: + SZ_OK - OK + SZ_ERROR_DATA - Error + p->remainLen: + < kMatchSpecLenStart : normal remain + = kMatchSpecLenStart : finished + = kMatchSpecLenStart + 1 : Flush marker + = kMatchSpecLenStart + 2 : State Init Marker +*/ + +static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + CLzmaProb *probs = p->probs; + + unsigned state = p->state; + UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; + unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; + unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; + unsigned lc = p->prop.lc; + + Byte *dic = p->dic; + SizeT dicBufSize = p->dicBufSize; + SizeT dicPos = p->dicPos; + + UInt32 processedPos = p->processedPos; + UInt32 checkDicSize = p->checkDicSize; + unsigned len = 0; + + const Byte *buf = p->buf; + UInt32 range = p->range; + UInt32 code = p->code; + + do + { + CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = processedPos & pbMask; + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + unsigned symbol; + UPDATE_0(prob); + prob = probs + Literal; + if (checkDicSize != 0 || processedPos != 0) + prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + + (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); + + if (state < kNumLitStates) + { + state -= (state < 4) ? state : 3; + symbol = 1; + do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); + } + else + { + unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + unsigned offs = 0x100; + state -= (state < 10) ? 3 : 6; + symbol = 1; + do + { + unsigned bit; + CLzmaProb *probLit; + matchByte <<= 1; + bit = (matchByte & offs); + probLit = prob + offs + bit + symbol; + GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) + } + while (symbol < 0x100); + } + dic[dicPos++] = (Byte)symbol; + processedPos++; + continue; + } + else + { + UPDATE_1(prob); + prob = probs + IsRep + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + state += kNumStates; + prob = probs + LenCoder; + } + else + { + UPDATE_1(prob); + if (checkDicSize == 0 && processedPos == 0) + return SZ_ERROR_DATA; + prob = probs + IsRepG0 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0(prob) + { + UPDATE_0(prob); + dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + dicPos++; + processedPos++; + state = state < kNumLitStates ? 9 : 11; + continue; + } + UPDATE_1(prob); + } + else + { + UInt32 distance; + UPDATE_1(prob); + prob = probs + IsRepG1 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep1; + } + else + { + UPDATE_1(prob); + prob = probs + IsRepG2 + state; + IF_BIT_0(prob) + { + UPDATE_0(prob); + distance = rep2; + } + else + { + UPDATE_1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = probs + RepLenCoder; + } + { + unsigned limit, offset; + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + limit = (1 << kLenNumLowBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenChoice2; + IF_BIT_0(probLen) + { + UPDATE_0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + limit = (1 << kLenNumMidBits); + } + else + { + UPDATE_1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + limit = (1 << kLenNumHighBits); + } + } + TREE_DECODE(probLen, limit, len); + len += offset; + } + + if (state >= kNumStates) + { + UInt32 distance; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); + TREE_6_DECODE(prob, distance); + if (distance >= kStartPosModelIndex) + { + unsigned posSlot = (unsigned)distance; + int numDirectBits = (int)(((distance >> 1) - 1)); + distance = (2 | (distance & 1)); + if (posSlot < kEndPosModelIndex) + { + distance <<= numDirectBits; + prob = probs + SpecPos + distance - posSlot - 1; + { + UInt32 mask = 1; + unsigned i = 1; + do + { + GET_BIT2(prob + i, i, ; , distance |= mask); + mask <<= 1; + } + while (--numDirectBits != 0); + } + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE + range >>= 1; + + { + UInt32 t; + code -= range; + t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ + distance = (distance << 1) + (t + 1); + code += range & t; + } + /* + distance <<= 1; + if (code >= range) + { + code -= range; + distance |= 1; + } + */ + } + while (--numDirectBits != 0); + prob = probs + Align; + distance <<= kNumAlignBits; + { + unsigned i = 1; + GET_BIT2(prob + i, i, ; , distance |= 1); + GET_BIT2(prob + i, i, ; , distance |= 2); + GET_BIT2(prob + i, i, ; , distance |= 4); + GET_BIT2(prob + i, i, ; , distance |= 8); + } + if (distance == (UInt32)0xFFFFFFFF) + { + len += kMatchSpecLenStart; + state -= kNumStates; + break; + } + } + } + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + rep0 = distance + 1; + if (checkDicSize == 0) + { + if (distance >= processedPos) + return SZ_ERROR_DATA; + } + else if (distance >= checkDicSize) + return SZ_ERROR_DATA; + state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; + } + + len += kMatchMinLen; + + if (limit == dicPos) + return SZ_ERROR_DATA; + { + SizeT rem = limit - dicPos; + unsigned curLen = ((rem < len) ? (unsigned)rem : len); + SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); + + processedPos += curLen; + + len -= curLen; + if (pos + curLen <= dicBufSize) + { + Byte *dest = dic + dicPos; + ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; + const Byte *lim = dest + curLen; + dicPos += curLen; + do + *(dest) = (Byte)*(dest + src); + while (++dest != lim); + } + else + { + do + { + dic[dicPos++] = dic[pos]; + if (++pos == dicBufSize) + pos = 0; + } + while (--curLen != 0); + } + } + } + } + while (dicPos < limit && buf < bufLimit); + NORMALIZE; + p->buf = buf; + p->range = range; + p->code = code; + p->remainLen = len; + p->dicPos = dicPos; + p->processedPos = processedPos; + p->reps[0] = rep0; + p->reps[1] = rep1; + p->reps[2] = rep2; + p->reps[3] = rep3; + p->state = state; + + return SZ_OK; +} + +static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) +{ + if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) + { + Byte *dic = p->dic; + SizeT dicPos = p->dicPos; + SizeT dicBufSize = p->dicBufSize; + unsigned len = p->remainLen; + UInt32 rep0 = p->reps[0]; + if (limit - dicPos < len) + len = (unsigned)(limit - dicPos); + + if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) + p->checkDicSize = p->prop.dicSize; + + p->processedPos += len; + p->remainLen -= len; + while (len-- != 0) + { + dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; + dicPos++; + } + p->dicPos = dicPos; + } +} + +static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) +{ + do + { + SizeT limit2 = limit; + if (p->checkDicSize == 0) + { + UInt32 rem = p->prop.dicSize - p->processedPos; + if (limit - p->dicPos > rem) + limit2 = p->dicPos + rem; + } + RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); + if (p->processedPos >= p->prop.dicSize) + p->checkDicSize = p->prop.dicSize; + LzmaDec_WriteRem(p, limit); + } + while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); + + if (p->remainLen > kMatchSpecLenStart) + { + p->remainLen = kMatchSpecLenStart; + } + return 0; +} + +typedef enum +{ + DUMMY_ERROR, /* unexpected end of input stream */ + DUMMY_LIT, + DUMMY_MATCH, + DUMMY_REP +} ELzmaDummy; + +static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) +{ + UInt32 range = p->range; + UInt32 code = p->code; + const Byte *bufLimit = buf + inSize; + CLzmaProb *probs = p->probs; + unsigned state = p->state; + ELzmaDummy res; + + { + CLzmaProb *prob; + UInt32 bound; + unsigned ttt; + unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); + + prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK + + /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ + + prob = probs + Literal; + if (p->checkDicSize != 0 || p->processedPos != 0) + prob += (LZMA_LIT_SIZE * + ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + + (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); + + if (state < kNumLitStates) + { + unsigned symbol = 1; + do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); + } + else + { + unsigned matchByte = p->dic[p->dicPos - p->reps[0] + + ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; + unsigned offs = 0x100; + unsigned symbol = 1; + do + { + unsigned bit; + CLzmaProb *probLit; + matchByte <<= 1; + bit = (matchByte & offs); + probLit = prob + offs + bit + symbol; + GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) + } + while (symbol < 0x100); + } + res = DUMMY_LIT; + } + else + { + unsigned len; + UPDATE_1_CHECK; + + prob = probs + IsRep + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + state = 0; + prob = probs + LenCoder; + res = DUMMY_MATCH; + } + else + { + UPDATE_1_CHECK; + res = DUMMY_REP; + prob = probs + IsRepG0 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + NORMALIZE_CHECK; + return DUMMY_REP; + } + else + { + UPDATE_1_CHECK; + } + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG1 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + prob = probs + IsRepG2 + state; + IF_BIT_0_CHECK(prob) + { + UPDATE_0_CHECK; + } + else + { + UPDATE_1_CHECK; + } + } + } + state = kNumStates; + prob = probs + RepLenCoder; + } + { + unsigned limit, offset; + CLzmaProb *probLen = prob + LenChoice; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + limit = 1 << kLenNumLowBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenChoice2; + IF_BIT_0_CHECK(probLen) + { + UPDATE_0_CHECK; + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + limit = 1 << kLenNumMidBits; + } + else + { + UPDATE_1_CHECK; + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + limit = 1 << kLenNumHighBits; + } + } + TREE_DECODE_CHECK(probLen, limit, len); + len += offset; + } + + if (state < 4) + { + unsigned posSlot; + prob = probs + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + + /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ + + if (posSlot < kEndPosModelIndex) + { + prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + NORMALIZE_CHECK + range >>= 1; + code -= range & (((code - range) >> 31) - 1); + /* if (code >= range) code -= range; */ + } + while (--numDirectBits != 0); + prob = probs + Align; + numDirectBits = kNumAlignBits; + } + { + unsigned i = 1; + do + { + GET_BIT_CHECK(prob + i, i); + } + while (--numDirectBits != 0); + } + } + } + } + } + NORMALIZE_CHECK; + return res; +} + + +static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) +{ + p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); + p->range = 0xFFFFFFFF; + p->needFlush = 0; +} + +void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) +{ + p->needFlush = 1; + p->remainLen = 0; + p->tempBufSize = 0; + + if (initDic) + { + p->processedPos = 0; + p->checkDicSize = 0; + p->needInitState = 1; + } + if (initState) + p->needInitState = 1; +} + +void LzmaDec_Init(CLzmaDec *p) +{ + p->dicPos = 0; + LzmaDec_InitDicAndState(p, True, True); +} + +static void LzmaDec_InitStateReal(CLzmaDec *p) +{ + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); + UInt32 i; + CLzmaProb *probs = p->probs; + for (i = 0; i < numProbs; i++) + probs[i] = kBitModelTotal >> 1; + p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; + p->state = 0; + p->needInitState = 0; +} + +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, + ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT inSize = *srcLen; + (*srcLen) = 0; + LzmaDec_WriteRem(p, dicLimit); + + *status = LZMA_STATUS_NOT_SPECIFIED; + + while (p->remainLen != kMatchSpecLenStart) + { + int checkEndMarkNow; + + if (p->needFlush != 0) + { + for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) + p->tempBuf[p->tempBufSize++] = *src++; + if (p->tempBufSize < RC_INIT_SIZE) + { + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (p->tempBuf[0] != 0) + return SZ_ERROR_DATA; + + LzmaDec_InitRc(p, p->tempBuf); + p->tempBufSize = 0; + } + + checkEndMarkNow = 0; + if (p->dicPos >= dicLimit) + { + if (p->remainLen == 0 && p->code == 0) + { + *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; + return SZ_OK; + } + if (finishMode == LZMA_FINISH_ANY) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_OK; + } + if (p->remainLen != 0) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + checkEndMarkNow = 1; + } + + if (p->needInitState) + LzmaDec_InitStateReal(p); + + if (p->tempBufSize == 0) + { + SizeT processed; + const Byte *bufLimit; + if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, src, inSize); + if (dummyRes == DUMMY_ERROR) + { + memcpy(p->tempBuf, src, inSize); + p->tempBufSize = (unsigned)inSize; + (*srcLen) += inSize; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + bufLimit = src; + } + else + bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; + p->buf = src; + if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) + return SZ_ERROR_DATA; + processed = (SizeT)(p->buf - src); + (*srcLen) += processed; + src += processed; + inSize -= processed; + } + else + { + unsigned rem = p->tempBufSize, lookAhead = 0; + while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) + p->tempBuf[rem++] = src[lookAhead++]; + p->tempBufSize = rem; + if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) + { + int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); + if (dummyRes == DUMMY_ERROR) + { + (*srcLen) += lookAhead; + *status = LZMA_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + if (checkEndMarkNow && dummyRes != DUMMY_MATCH) + { + *status = LZMA_STATUS_NOT_FINISHED; + return SZ_ERROR_DATA; + } + } + p->buf = p->tempBuf; + if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) + return SZ_ERROR_DATA; + lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); + (*srcLen) += lookAhead; + src += lookAhead; + inSize -= lookAhead; + p->tempBufSize = 0; + } + } + if (p->code == 0) + *status = LZMA_STATUS_FINISHED_WITH_MARK; + return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; +} + +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) +{ + SizeT outSize = *destLen; + SizeT inSize = *srcLen; + *srcLen = *destLen = 0; + for (;;) + { + SizeT inSizeCur = inSize, outSizeCur, dicPos; + ELzmaFinishMode curFinishMode; + SRes res; + if (p->dicPos == p->dicBufSize) + p->dicPos = 0; + dicPos = p->dicPos; + if (outSize > p->dicBufSize - dicPos) + { + outSizeCur = p->dicBufSize; + curFinishMode = LZMA_FINISH_ANY; + } + else + { + outSizeCur = dicPos + outSize; + curFinishMode = finishMode; + } + + res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); + src += inSizeCur; + inSize -= inSizeCur; + *srcLen += inSizeCur; + outSizeCur = p->dicPos - dicPos; + memcpy(dest, p->dic + dicPos, outSizeCur); + dest += outSizeCur; + outSize -= outSizeCur; + *destLen += outSizeCur; + if (res != 0) + return res; + if (outSizeCur == 0 || outSize == 0) + return SZ_OK; + } +} + +void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->probs); + p->probs = 0; +} + +static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->dic); + p->dic = 0; +} + +void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) +{ + LzmaDec_FreeProbs(p, alloc); + LzmaDec_FreeDict(p, alloc); +} + +SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) +{ + UInt32 dicSize; + Byte d; + + if (size < LZMA_PROPS_SIZE) + return SZ_ERROR_UNSUPPORTED; + else + dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); + + if (dicSize < LZMA_DIC_MIN) + dicSize = LZMA_DIC_MIN; + p->dicSize = dicSize; + + d = data[0]; + if (d >= (9 * 5 * 5)) + return SZ_ERROR_UNSUPPORTED; + + p->lc = d % 9; + d /= 9; + p->pb = d / 5; + p->lp = d % 5; + + return SZ_OK; +} + +static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) +{ + UInt32 numProbs = LzmaProps_GetNumProbs(propNew); + if (p->probs == 0 || numProbs != p->numProbs) + { + LzmaDec_FreeProbs(p, alloc); + p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); + p->numProbs = numProbs; + if (p->probs == 0) + return SZ_ERROR_MEM; + } + return SZ_OK; +} + +SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) +{ + CLzmaProps propNew; + SizeT dicBufSize; + RINOK(LzmaProps_Decode(&propNew, props, propsSize)); + RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); + dicBufSize = propNew.dicSize; + if (p->dic == 0 || dicBufSize != p->dicBufSize) + { + LzmaDec_FreeDict(p, alloc); + p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); + if (p->dic == 0) + { + LzmaDec_FreeProbs(p, alloc); + return SZ_ERROR_MEM; + } + } + p->dicBufSize = dicBufSize; + p->prop = propNew; + return SZ_OK; +} + +SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + ELzmaStatus *status, ISzAlloc *alloc) +{ + CLzmaDec p; + SRes res; + SizeT inSize = *srcLen; + SizeT outSize = *destLen; + *srcLen = *destLen = 0; + if (inSize < RC_INIT_SIZE) + return SZ_ERROR_INPUT_EOF; + + LzmaDec_Construct(&p); + res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); + if (res != 0) + return res; + p.dic = dest; + p.dicBufSize = outSize; + + LzmaDec_Init(&p); + + *srcLen = inSize; + res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); + + if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) + res = SZ_ERROR_INPUT_EOF; + + (*destLen) = p.dicPos; + LzmaDec_FreeProbs(&p, alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaDec.h b/src/ZipLib/extlibs/lzma/unix/LzmaDec.h new file mode 100644 index 00000000..bf7f084b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaDec.h @@ -0,0 +1,231 @@ +/* LzmaDec.h -- LZMA Decoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA_DEC_H +#define __LZMA_DEC_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* #define _LZMA_PROB32 */ +/* _LZMA_PROB32 can increase the speed on some CPUs, + but memory usage for CLzmaDec::probs will be doubled in that case */ + +#ifdef _LZMA_PROB32 +#define CLzmaProb UInt32 +#else +#define CLzmaProb UInt16 +#endif + + +/* ---------- LZMA Properties ---------- */ + +#define LZMA_PROPS_SIZE 5 + +typedef struct _CLzmaProps +{ + unsigned lc, lp, pb; + UInt32 dicSize; +} CLzmaProps; + +/* LzmaProps_Decode - decodes properties +Returns: + SZ_OK + SZ_ERROR_UNSUPPORTED - Unsupported properties +*/ + +SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size); + + +/* ---------- LZMA Decoder state ---------- */ + +/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case. + Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */ + +#define LZMA_REQUIRED_INPUT_MAX 20 + +typedef struct +{ + CLzmaProps prop; + CLzmaProb *probs; + Byte *dic; + const Byte *buf; + UInt32 range, code; + SizeT dicPos; + SizeT dicBufSize; + UInt32 processedPos; + UInt32 checkDicSize; + unsigned state; + UInt32 reps[4]; + unsigned remainLen; + int needFlush; + int needInitState; + UInt32 numProbs; + unsigned tempBufSize; + Byte tempBuf[LZMA_REQUIRED_INPUT_MAX]; +} CLzmaDec; + +#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; } + +void LzmaDec_Init(CLzmaDec *p); + +/* There are two types of LZMA streams: + 0) Stream with end mark. That end mark adds about 6 bytes to compressed size. + 1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */ + +typedef enum +{ + LZMA_FINISH_ANY, /* finish at any point */ + LZMA_FINISH_END /* block must be finished at the end */ +} ELzmaFinishMode; + +/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!! + + You must use LZMA_FINISH_END, when you know that current output buffer + covers last bytes of block. In other cases you must use LZMA_FINISH_ANY. + + If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK, + and output value of destLen will be less than output buffer size limit. + You can check status result also. + + You can use multiple checks to test data integrity after full decompression: + 1) Check Result and "status" variable. + 2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize. + 3) Check that output(srcLen) = compressedSize, if you know real compressedSize. + You must use correct finish mode in that case. */ + +typedef enum +{ + LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */ + LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ + LZMA_STATUS_NOT_FINISHED, /* stream was not finished */ + LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */ + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */ +} ELzmaStatus; + +/* ELzmaStatus is used only as output value for function call */ + + +/* ---------- Interfaces ---------- */ + +/* There are 3 levels of interfaces: + 1) Dictionary Interface + 2) Buffer Interface + 3) One Call Interface + You can select any of these interfaces, but don't mix functions from different + groups for same object. */ + + +/* There are two variants to allocate state for Dictionary Interface: + 1) LzmaDec_Allocate / LzmaDec_Free + 2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs + You can use variant 2, if you set dictionary buffer manually. + For Buffer Interface you must always use variant 1. + +LzmaDec_Allocate* can return: + SZ_OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties +*/ + +SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc); +void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc); + +SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc); +void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc); + +/* ---------- Dictionary Interface ---------- */ + +/* You can use it, if you want to eliminate the overhead for data copying from + dictionary to some other external buffer. + You must work with CLzmaDec variables directly in this interface. + + STEPS: + LzmaDec_Constr() + LzmaDec_Allocate() + for (each new stream) + { + LzmaDec_Init() + while (it needs more decompression) + { + LzmaDec_DecodeToDic() + use data from CLzmaDec::dic and update CLzmaDec::dicPos + } + } + LzmaDec_Free() +*/ + +/* LzmaDec_DecodeToDic + + The decoding to internal dictionary buffer (CLzmaDec::dic). + You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! + +finishMode: + It has meaning only if the decoding reaches output limit (dicLimit). + LZMA_FINISH_ANY - Decode just dicLimit bytes. + LZMA_FINISH_END - Stream must be finished after dicLimit. + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_NEEDS_MORE_INPUT + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + SZ_ERROR_DATA - Data error +*/ + +SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- Buffer Interface ---------- */ + +/* It's zlib-like interface. + See LzmaDec_DecodeToDic description for information about STEPS and return results, + but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need + to work with CLzmaDec variables manually. + +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - Decode just destLen bytes. + LZMA_FINISH_END - Stream must be finished after (*destLen). +*/ + +SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status); + + +/* ---------- One Call Interface ---------- */ + +/* LzmaDecode + +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - Decode just destLen bytes. + LZMA_FINISH_END - Stream must be finished after (*destLen). + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + +SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, + ELzmaStatus *status, ISzAlloc *alloc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaEnc.c b/src/ZipLib/extlibs/lzma/unix/LzmaEnc.c new file mode 100644 index 00000000..cf131388 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaEnc.c @@ -0,0 +1,2268 @@ +/* LzmaEnc.c -- LZMA Encoder +2010-04-16 : Igor Pavlov : Public domain */ + +#include + +/* #define SHOW_STAT */ +/* #define SHOW_STAT2 */ + +#if defined(SHOW_STAT) || defined(SHOW_STAT2) +#include +#endif + +#include "LzmaEnc.h" + +#include "LzFind.h" +#ifndef _7ZIP_ST +#include "LzFindMt.h" +#endif + +#ifdef SHOW_STAT +static int ttt = 0; +#endif + +#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) + +#define kBlockSize (9 << 10) +#define kUnpackBlockSize (1 << 18) +#define kMatchArraySize (1 << 21) +#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) + +#define kNumMaxDirectBits (31) + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 +#define kProbInitValue (kBitModelTotal >> 1) + +#define kNumMoveReducingBits 4 +#define kNumBitPriceShiftBits 4 +#define kBitPrice (1 << kNumBitPriceShiftBits) + +void LzmaEncProps_Init(CLzmaEncProps *p) +{ + p->level = 5; + p->dictSize = p->mc = 0; + p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; + p->writeEndMark = 0; +} + +void LzmaEncProps_Normalize(CLzmaEncProps *p) +{ + int level = p->level; + if (level < 0) level = 5; + p->level = level; + if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); + if (p->lc < 0) p->lc = 3; + if (p->lp < 0) p->lp = 0; + if (p->pb < 0) p->pb = 2; + if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); + if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); + if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); + if (p->numHashBytes < 0) p->numHashBytes = 4; + if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); + if (p->numThreads < 0) + p->numThreads = + #ifndef _7ZIP_ST + ((p->btMode && p->algo) ? 2 : 1); + #else + 1; + #endif +} + +UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) +{ + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + return props.dictSize; +} + +/* #define LZMA_LOG_BSR */ +/* Define it for Intel's CPU */ + + +#ifdef LZMA_LOG_BSR + +#define kDicLogSizeMaxCompress 30 + +#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } + +UInt32 GetPosSlot1(UInt32 pos) +{ + UInt32 res; + BSR2_RET(pos, res); + return res; +} +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } + +#else + +#define kNumLogBits (9 + (int)sizeof(size_t) / 2) +#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) + +void LzmaEnc_FastPosInit(Byte *g_FastPos) +{ + int c = 2, slotFast; + g_FastPos[0] = 0; + g_FastPos[1] = 1; + + for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) + { + UInt32 k = (1 << ((slotFast >> 1) - 1)); + UInt32 j; + for (j = 0; j < k; j++, c++) + g_FastPos[c] = (Byte)slotFast; + } +} + +#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ + (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ + res = p->g_FastPos[pos >> i] + (i * 2); } +/* +#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ + p->g_FastPos[pos >> 6] + 12 : \ + p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } +*/ + +#define GetPosSlot1(pos) p->g_FastPos[pos] +#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } +#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } + +#endif + + +#define LZMA_NUM_REPS 4 + +typedef unsigned CState; + +typedef struct +{ + UInt32 price; + + CState state; + int prev1IsChar; + int prev2; + + UInt32 posPrev2; + UInt32 backPrev2; + + UInt32 posPrev; + UInt32 backPrev; + UInt32 backs[LZMA_NUM_REPS]; +} COptimal; + +#define kNumOpts (1 << 12) + +#define kNumLenToPosStates 4 +#define kNumPosSlotBits 6 +#define kDicLogSizeMin 0 +#define kDicLogSizeMax 32 +#define kDistTableSizeMax (kDicLogSizeMax * 2) + + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) +#define kAlignMask (kAlignTableSize - 1) + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) + +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#ifdef _LZMA_PROB32 +#define CLzmaProb UInt32 +#else +#define CLzmaProb UInt16 +#endif + +#define LZMA_PB_MAX 4 +#define LZMA_LC_MAX 8 +#define LZMA_LP_MAX 4 + +#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) + + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) + +#define LZMA_MATCH_LEN_MIN 2 +#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) + +#define kNumStates 12 + +typedef struct +{ + CLzmaProb choice; + CLzmaProb choice2; + CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; + CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; + CLzmaProb high[kLenNumHighSymbols]; +} CLenEnc; + +typedef struct +{ + CLenEnc p; + UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; + UInt32 tableSize; + UInt32 counters[LZMA_NUM_PB_STATES_MAX]; +} CLenPriceEnc; + +typedef struct +{ + UInt32 range; + Byte cache; + UInt64 low; + UInt64 cacheSize; + Byte *buf; + Byte *bufLim; + Byte *bufBase; + ISeqOutStream *outStream; + UInt64 processed; + SRes res; +} CRangeEnc; + +typedef struct +{ + CLzmaProb *litProbs; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; + + UInt32 reps[LZMA_NUM_REPS]; + UInt32 state; +} CSaveState; + +typedef struct +{ + IMatchFinder matchFinder; + void *matchFinderObj; + + #ifndef _7ZIP_ST + Bool mtMode; + CMatchFinderMt matchFinderMt; + #endif + + CMatchFinder matchFinderBase; + + #ifndef _7ZIP_ST + Byte pad[128]; + #endif + + UInt32 optimumEndIndex; + UInt32 optimumCurrentIndex; + + UInt32 longestMatchLength; + UInt32 numPairs; + UInt32 numAvail; + COptimal opt[kNumOpts]; + + #ifndef LZMA_LOG_BSR + Byte g_FastPos[1 << kNumLogBits]; + #endif + + UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; + UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; + UInt32 numFastBytes; + UInt32 additionalOffset; + UInt32 reps[LZMA_NUM_REPS]; + UInt32 state; + + UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; + UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; + UInt32 alignPrices[kAlignTableSize]; + UInt32 alignPriceCount; + + UInt32 distTableSize; + + unsigned lc, lp, pb; + unsigned lpMask, pbMask; + + CLzmaProb *litProbs; + + CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; + CLzmaProb isRep[kNumStates]; + CLzmaProb isRepG0[kNumStates]; + CLzmaProb isRepG1[kNumStates]; + CLzmaProb isRepG2[kNumStates]; + CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; + + CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; + CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; + CLzmaProb posAlignEncoder[1 << kNumAlignBits]; + + CLenPriceEnc lenEnc; + CLenPriceEnc repLenEnc; + + unsigned lclp; + + Bool fastMode; + + CRangeEnc rc; + + Bool writeEndMark; + UInt64 nowPos64; + UInt32 matchPriceCount; + Bool finished; + Bool multiThread; + + SRes result; + UInt32 dictSize; + UInt32 matchFinderCycles; + + int needInit; + + CSaveState saveState; +} CLzmaEnc; + +void LzmaEnc_SaveState(CLzmaEncHandle pp) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CSaveState *dest = &p->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); +} + +void LzmaEnc_RestoreState(CLzmaEncHandle pp) +{ + CLzmaEnc *dest = (CLzmaEnc *)pp; + const CSaveState *p = &dest->saveState; + int i; + dest->lenEnc = p->lenEnc; + dest->repLenEnc = p->repLenEnc; + dest->state = p->state; + + for (i = 0; i < kNumStates; i++) + { + memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); + memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); + } + for (i = 0; i < kNumLenToPosStates; i++) + memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); + memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); + memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); + memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); + memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); + memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); + memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); + memcpy(dest->reps, p->reps, sizeof(p->reps)); + memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); +} + +SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CLzmaEncProps props = *props2; + LzmaEncProps_Normalize(&props); + + if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || + props.dictSize > ((UInt32)1 << kDicLogSizeMaxCompress) || props.dictSize > ((UInt32)1 << 30)) + return SZ_ERROR_PARAM; + p->dictSize = props.dictSize; + p->matchFinderCycles = props.mc; + { + unsigned fb = props.fb; + if (fb < 5) + fb = 5; + if (fb > LZMA_MATCH_LEN_MAX) + fb = LZMA_MATCH_LEN_MAX; + p->numFastBytes = fb; + } + p->lc = props.lc; + p->lp = props.lp; + p->pb = props.pb; + p->fastMode = (props.algo == 0); + p->matchFinderBase.btMode = props.btMode; + { + UInt32 numHashBytes = 4; + if (props.btMode) + { + if (props.numHashBytes < 2) + numHashBytes = 2; + else if (props.numHashBytes < 4) + numHashBytes = props.numHashBytes; + } + p->matchFinderBase.numHashBytes = numHashBytes; + } + + p->matchFinderBase.cutValue = props.mc; + + p->writeEndMark = props.writeEndMark; + + #ifndef _7ZIP_ST + /* + if (newMultiThread != _multiThread) + { + ReleaseMatchFinder(); + _multiThread = newMultiThread; + } + */ + p->multiThread = (props.numThreads > 1); + #endif + + return SZ_OK; +} + +static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; +static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; +static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; +static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; + +#define IsCharState(s) ((s) < 7) + +#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) + +#define kInfinityPrice (1 << 30) + +static void RangeEnc_Construct(CRangeEnc *p) +{ + p->outStream = 0; + p->bufBase = 0; +} + +#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) + +#define RC_BUF_SIZE (1 << 16) +static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) +{ + if (p->bufBase == 0) + { + p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); + if (p->bufBase == 0) + return 0; + p->bufLim = p->bufBase + RC_BUF_SIZE; + } + return 1; +} + +static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->bufBase); + p->bufBase = 0; +} + +static void RangeEnc_Init(CRangeEnc *p) +{ + /* Stream.Init(); */ + p->low = 0; + p->range = 0xFFFFFFFF; + p->cacheSize = 1; + p->cache = 0; + + p->buf = p->bufBase; + + p->processed = 0; + p->res = SZ_OK; +} + +static void RangeEnc_FlushStream(CRangeEnc *p) +{ + size_t num; + if (p->res != SZ_OK) + return; + num = p->buf - p->bufBase; + if (num != p->outStream->Write(p->outStream, p->bufBase, num)) + p->res = SZ_ERROR_WRITE; + p->processed += num; + p->buf = p->bufBase; +} + +static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) +{ + if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) + { + Byte temp = p->cache; + do + { + Byte *buf = p->buf; + *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); + p->buf = buf; + if (buf == p->bufLim) + RangeEnc_FlushStream(p); + temp = 0xFF; + } + while (--p->cacheSize != 0); + p->cache = (Byte)((UInt32)p->low >> 24); + } + p->cacheSize++; + p->low = (UInt32)p->low << 8; +} + +static void RangeEnc_FlushData(CRangeEnc *p) +{ + int i; + for (i = 0; i < 5; i++) + RangeEnc_ShiftLow(p); +} + +static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) +{ + do + { + p->range >>= 1; + p->low += p->range & (0 - ((value >> --numBits) & 1)); + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } + } + while (numBits != 0); +} + +static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) +{ + UInt32 ttt = *prob; + UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; + if (symbol == 0) + { + p->range = newBound; + ttt += (kBitModelTotal - ttt) >> kNumMoveBits; + } + else + { + p->low += newBound; + p->range -= newBound; + ttt -= ttt >> kNumMoveBits; + } + *prob = (CLzmaProb)ttt; + if (p->range < kTopValue) + { + p->range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) +{ + symbol |= 0x100; + do + { + RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); +} + +static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) +{ + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); +} + +void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) +{ + UInt32 i; + for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) + { + const int kCyclesBits = kNumBitPriceShiftBits; + UInt32 w = i; + UInt32 bitCount = 0; + int j; + for (j = 0; j < kCyclesBits; j++) + { + w = w * w; + bitCount <<= 1; + while (w >= ((UInt32)1 << 16)) + { + w >>= 1; + bitCount++; + } + } + ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); + } +} + + +#define GET_PRICE(prob, symbol) \ + p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICEa(prob, symbol) \ + ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; + +#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] +#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] + +static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= 0x100; + do + { + price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); + symbol <<= 1; + } + while (symbol < 0x10000); + return price; +} + +static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 offs = 0x100; + symbol |= 0x100; + do + { + matchByte <<= 1; + price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); + symbol <<= 1; + offs &= ~(matchByte ^ symbol); + } + while (symbol < 0x10000); + return price; +} + + +static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0;) + { + UInt32 bit; + i--; + bit = (symbol >> i) & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + } +} + +static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) +{ + UInt32 m = 1; + int i; + for (i = 0; i < numBitLevels; i++) + { + UInt32 bit = symbol & 1; + RangeEnc_EncodeBit(rc, probs + m, bit); + m = (m << 1) | bit; + symbol >>= 1; + } +} + +static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + symbol |= (1 << numBitLevels); + while (symbol != 1) + { + price += GET_PRICEa(probs[symbol >> 1], symbol & 1); + symbol >>= 1; + } + return price; +} + +static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) +{ + UInt32 price = 0; + UInt32 m = 1; + int i; + for (i = numBitLevels; i != 0; i--) + { + UInt32 bit = symbol & 1; + symbol >>= 1; + price += GET_PRICEa(probs[m], bit); + m = (m << 1) | bit; + } + return price; +} + + +static void LenEnc_Init(CLenEnc *p) +{ + unsigned i; + p->choice = p->choice2 = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) + p->low[i] = kProbInitValue; + for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) + p->mid[i] = kProbInitValue; + for (i = 0; i < kLenNumHighSymbols; i++) + p->high[i] = kProbInitValue; +} + +static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) +{ + if (symbol < kLenNumLowSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice, 0); + RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice, 1); + if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) + { + RangeEnc_EncodeBit(rc, &p->choice2, 0); + RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); + } + else + { + RangeEnc_EncodeBit(rc, &p->choice2, 1); + RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); + } + } +} + +static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) +{ + UInt32 a0 = GET_PRICE_0a(p->choice); + UInt32 a1 = GET_PRICE_1a(p->choice); + UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); + UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); + UInt32 i = 0; + for (i = 0; i < kLenNumLowSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); + } + for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) + { + if (i >= numSymbols) + return; + prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); + } + for (; i < numSymbols; i++) + prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); +} + +static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) +{ + LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); + p->counters[posState] = p->tableSize; +} + +static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) +{ + UInt32 posState; + for (posState = 0; posState < numPosStates; posState++) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + +static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) +{ + LenEnc_Encode(&p->p, rc, symbol, posState); + if (updatePrice) + if (--p->counters[posState] == 0) + LenPriceEnc_UpdateTable(p, posState, ProbPrices); +} + + + + +static void MovePos(CLzmaEnc *p, UInt32 num) +{ + #ifdef SHOW_STAT + ttt += num; + printf("\n MovePos %d", num); + #endif + if (num != 0) + { + p->additionalOffset += num; + p->matchFinder.Skip(p->matchFinderObj, num); + } +} + +static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) +{ + UInt32 lenRes = 0, numPairs; + p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); + numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); + #ifdef SHOW_STAT + printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); + ttt++; + { + UInt32 i; + for (i = 0; i < numPairs; i += 2) + printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); + } + #endif + if (numPairs > 0) + { + lenRes = p->matches[numPairs - 2]; + if (lenRes == p->numFastBytes) + { + const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + UInt32 distance = p->matches[numPairs - 1] + 1; + UInt32 numAvail = p->numAvail; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + { + const Byte *pby2 = pby - distance; + for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); + } + } + } + p->additionalOffset++; + *numDistancePairsRes = numPairs; + return lenRes; +} + + +#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; +#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; +#define IsShortRep(p) ((p)->backPrev == 0) + +static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) +{ + return + GET_PRICE_0(p->isRepG0[state]) + + GET_PRICE_0(p->isRep0Long[state][posState]); +} + +static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) +{ + UInt32 price; + if (repIndex == 0) + { + price = GET_PRICE_0(p->isRepG0[state]); + price += GET_PRICE_1(p->isRep0Long[state][posState]); + } + else + { + price = GET_PRICE_1(p->isRepG0[state]); + if (repIndex == 1) + price += GET_PRICE_0(p->isRepG1[state]); + else + { + price += GET_PRICE_1(p->isRepG1[state]); + price += GET_PRICE(p->isRepG2[state], repIndex - 2); + } + } + return price; +} + +static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) +{ + return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + + GetPureRepPrice(p, repIndex, state, posState); +} + +static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) +{ + UInt32 posMem = p->opt[cur].posPrev; + UInt32 backMem = p->opt[cur].backPrev; + p->optimumEndIndex = cur; + do + { + if (p->opt[cur].prev1IsChar) + { + MakeAsChar(&p->opt[posMem]) + p->opt[posMem].posPrev = posMem - 1; + if (p->opt[cur].prev2) + { + p->opt[posMem - 1].prev1IsChar = False; + p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; + p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; + } + } + { + UInt32 posPrev = posMem; + UInt32 backCur = backMem; + + backMem = p->opt[posPrev].backPrev; + posMem = p->opt[posPrev].posPrev; + + p->opt[posPrev].backPrev = backCur; + p->opt[posPrev].posPrev = cur; + cur = posPrev; + } + } + while (cur != 0); + *backRes = p->opt[0].backPrev; + p->optimumCurrentIndex = p->opt[0].posPrev; + return p->optimumCurrentIndex; +} + +#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) + +static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) +{ + UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; + UInt32 matchPrice, repMatchPrice, normalMatchPrice; + UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; + UInt32 *matches; + const Byte *data; + Byte curByte, matchByte; + if (p->optimumEndIndex != p->optimumCurrentIndex) + { + const COptimal *opt = &p->opt[p->optimumCurrentIndex]; + UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; + *backRes = opt->backPrev; + p->optimumCurrentIndex = opt->posPrev; + return lenRes; + } + p->optimumCurrentIndex = p->optimumEndIndex = 0; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + if (numAvail < 2) + { + *backRes = (UInt32)(-1); + return 1; + } + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + repMaxIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 lenTest; + const Byte *data2; + reps[i] = p->reps[i]; + data2 = data - (reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + { + repLens[i] = 0; + continue; + } + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + repLens[i] = lenTest; + if (lenTest > repLens[repMaxIndex]) + repMaxIndex = i; + } + if (repLens[repMaxIndex] >= p->numFastBytes) + { + UInt32 lenRes; + *backRes = repMaxIndex; + lenRes = repLens[repMaxIndex]; + MovePos(p, lenRes - 1); + return lenRes; + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) + { + *backRes = (UInt32)-1; + return 1; + } + + p->opt[0].state = (CState)p->state; + + posState = (position & p->pbMask); + + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + + (!IsCharState(p->state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + MakeAsChar(&p->opt[1]); + + matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); + + if (matchByte == curByte) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); + if (shortRepPrice < p->opt[1].price) + { + p->opt[1].price = shortRepPrice; + MakeAsShortRep(&p->opt[1]); + } + } + lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); + + if (lenEnd < 2) + { + *backRes = p->opt[1].backPrev; + return 1; + } + + p->opt[1].posPrev = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + p->opt[0].backs[i] = reps[i]; + + len = lenEnd; + do + p->opt[len--].price = kInfinityPrice; + while (len >= 2); + + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 repLen = repLens[i]; + UInt32 price; + if (repLen < 2) + continue; + price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; + COptimal *opt = &p->opt[repLen]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = i; + opt->prev1IsChar = False; + } + } + while (--repLen >= 2); + } + + normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); + + len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); + if (len <= mainLen) + { + UInt32 offs = 0; + while (len > matches[offs]) + offs += 2; + for (; ; len++) + { + COptimal *opt; + UInt32 distance = matches[offs + 1]; + + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; + UInt32 lenToPosState = GetLenToPosState(len); + if (distance < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][distance]; + else + { + UInt32 slot; + GetPosSlot2(distance, slot); + curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; + } + opt = &p->opt[len]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = 0; + opt->backPrev = distance + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + if (len == matches[offs]) + { + offs += 2; + if (offs == numPairs) + break; + } + } + } + + cur = 0; + + #ifdef SHOW_STAT2 + if (position >= 0) + { + unsigned i; + printf("\n pos = %4X", position); + for (i = cur; i <= lenEnd; i++) + printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); + } + #endif + + for (;;) + { + UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; + UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; + Bool nextIsChar; + Byte curByte, matchByte; + const Byte *data; + COptimal *curOpt; + COptimal *nextOpt; + + cur++; + if (cur == lenEnd) + return Backward(p, backRes, cur); + + newLen = ReadMatchDistances(p, &numPairs); + if (newLen >= p->numFastBytes) + { + p->numPairs = numPairs; + p->longestMatchLength = newLen; + return Backward(p, backRes, cur); + } + position++; + curOpt = &p->opt[cur]; + posPrev = curOpt->posPrev; + if (curOpt->prev1IsChar) + { + posPrev--; + if (curOpt->prev2) + { + state = p->opt[curOpt->posPrev2].state; + if (curOpt->backPrev2 < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + else + state = p->opt[posPrev].state; + state = kLiteralNextStates[state]; + } + else + state = p->opt[posPrev].state; + if (posPrev == cur - 1) + { + if (IsShortRep(curOpt)) + state = kShortRepNextStates[state]; + else + state = kLiteralNextStates[state]; + } + else + { + UInt32 pos; + const COptimal *prevOpt; + if (curOpt->prev1IsChar && curOpt->prev2) + { + posPrev = curOpt->posPrev2; + pos = curOpt->backPrev2; + state = kRepNextStates[state]; + } + else + { + pos = curOpt->backPrev; + if (pos < LZMA_NUM_REPS) + state = kRepNextStates[state]; + else + state = kMatchNextStates[state]; + } + prevOpt = &p->opt[posPrev]; + if (pos < LZMA_NUM_REPS) + { + UInt32 i; + reps[0] = prevOpt->backs[pos]; + for (i = 1; i <= pos; i++) + reps[i] = prevOpt->backs[i - 1]; + for (; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i]; + } + else + { + UInt32 i; + reps[0] = (pos - LZMA_NUM_REPS); + for (i = 1; i < LZMA_NUM_REPS; i++) + reps[i] = prevOpt->backs[i - 1]; + } + } + curOpt->state = (CState)state; + + curOpt->backs[0] = reps[0]; + curOpt->backs[1] = reps[1]; + curOpt->backs[2] = reps[2]; + curOpt->backs[3] = reps[3]; + + curPrice = curOpt->price; + nextIsChar = False; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + curByte = *data; + matchByte = *(data - (reps[0] + 1)); + + posState = (position & p->pbMask); + + curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); + { + const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); + curAnd1Price += + (!IsCharState(state) ? + LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : + LitEnc_GetPrice(probs, curByte, p->ProbPrices)); + } + + nextOpt = &p->opt[cur + 1]; + + if (curAnd1Price < nextOpt->price) + { + nextOpt->price = curAnd1Price; + nextOpt->posPrev = cur; + MakeAsChar(nextOpt); + nextIsChar = True; + } + + matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); + repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); + + if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) + { + UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); + if (shortRepPrice <= nextOpt->price) + { + nextOpt->price = shortRepPrice; + nextOpt->posPrev = cur; + MakeAsShortRep(nextOpt); + nextIsChar = True; + } + } + numAvailFull = p->numAvail; + { + UInt32 temp = kNumOpts - 1 - cur; + if (temp < numAvailFull) + numAvailFull = temp; + } + + if (numAvailFull < 2) + continue; + numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); + + if (!nextIsChar && matchByte != curByte) /* speed optimization */ + { + /* try Literal + rep0 */ + UInt32 temp; + UInt32 lenTest2; + const Byte *data2 = data - (reps[0] + 1); + UInt32 limit = p->numFastBytes + 1; + if (limit > numAvailFull) + limit = numAvailFull; + + for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); + lenTest2 = temp - 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kLiteralNextStates[state]; + UInt32 posStateNext = (position + 1) & p->pbMask; + UInt32 nextRepMatchPrice = curAnd1Price + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = False; + } + } + } + } + + startLen = 2; /* speed optimization */ + { + UInt32 repIndex; + for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) + { + UInt32 lenTest; + UInt32 lenTestTemp; + UInt32 price; + const Byte *data2 = data - (reps[repIndex] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); + while (lenEnd < cur + lenTest) + p->opt[++lenEnd].price = kInfinityPrice; + lenTestTemp = lenTest; + price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); + do + { + UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; + COptimal *opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = repIndex; + opt->prev1IsChar = False; + } + } + while (--lenTest >= 2); + lenTest = lenTestTemp; + + if (repIndex == 0) + startLen = lenTest + 1; + + /* if (_maxMode) */ + { + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + UInt32 nextRepMatchPrice; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kRepNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = + price + p->repLenEnc.prices[posState][lenTest - 2] + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (position + lenTest + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 curAndLenPrice; + COptimal *opt; + UInt32 offset = cur + lenTest + 1 + lenTest2; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = repIndex; + } + } + } + } + } + } + /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ + if (newLen > numAvail) + { + newLen = numAvail; + for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); + matches[numPairs] = newLen; + numPairs += 2; + } + if (newLen >= startLen) + { + UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); + UInt32 offs, curBack, posSlot; + UInt32 lenTest; + while (lenEnd < cur + newLen) + p->opt[++lenEnd].price = kInfinityPrice; + + offs = 0; + while (startLen > matches[offs]) + offs += 2; + curBack = matches[offs + 1]; + GetPosSlot2(curBack, posSlot); + for (lenTest = /*2*/ startLen; ; lenTest++) + { + UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; + UInt32 lenToPosState = GetLenToPosState(lenTest); + COptimal *opt; + if (curBack < kNumFullDistances) + curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; + else + curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; + + opt = &p->opt[cur + lenTest]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur; + opt->backPrev = curBack + LZMA_NUM_REPS; + opt->prev1IsChar = False; + } + + if (/*_maxMode && */lenTest == matches[offs]) + { + /* Try Match + Literal + Rep0 */ + const Byte *data2 = data - (curBack + 1); + UInt32 lenTest2 = lenTest + 1; + UInt32 limit = lenTest2 + p->numFastBytes; + UInt32 nextRepMatchPrice; + if (limit > numAvailFull) + limit = numAvailFull; + for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); + lenTest2 -= lenTest + 1; + if (lenTest2 >= 2) + { + UInt32 state2 = kMatchNextStates[state]; + UInt32 posStateNext = (position + lenTest) & p->pbMask; + UInt32 curAndLenCharPrice = curAndLenPrice + + GET_PRICE_0(p->isMatch[state2][posStateNext]) + + LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), + data[lenTest], data2[lenTest], p->ProbPrices); + state2 = kLiteralNextStates[state2]; + posStateNext = (posStateNext + 1) & p->pbMask; + nextRepMatchPrice = curAndLenCharPrice + + GET_PRICE_1(p->isMatch[state2][posStateNext]) + + GET_PRICE_1(p->isRep[state2]); + + /* for (; lenTest2 >= 2; lenTest2--) */ + { + UInt32 offset = cur + lenTest + 1 + lenTest2; + UInt32 curAndLenPrice; + COptimal *opt; + while (lenEnd < offset) + p->opt[++lenEnd].price = kInfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); + opt = &p->opt[offset]; + if (curAndLenPrice < opt->price) + { + opt->price = curAndLenPrice; + opt->posPrev = cur + lenTest + 1; + opt->backPrev = 0; + opt->prev1IsChar = True; + opt->prev2 = True; + opt->posPrev2 = cur; + opt->backPrev2 = curBack + LZMA_NUM_REPS; + } + } + } + offs += 2; + if (offs == numPairs) + break; + curBack = matches[offs + 1]; + if (curBack >= kNumFullDistances) + GetPosSlot2(curBack, posSlot); + } + } + } + } +} + +#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) + +static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) +{ + UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; + const Byte *data; + const UInt32 *matches; + + if (p->additionalOffset == 0) + mainLen = ReadMatchDistances(p, &numPairs); + else + { + mainLen = p->longestMatchLength; + numPairs = p->numPairs; + } + + numAvail = p->numAvail; + *backRes = (UInt32)-1; + if (numAvail < 2) + return 1; + if (numAvail > LZMA_MATCH_LEN_MAX) + numAvail = LZMA_MATCH_LEN_MAX; + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + + repLen = repIndex = 0; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len; + const Byte *data2 = data - (p->reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + for (len = 2; len < numAvail && data[len] == data2[len]; len++); + if (len >= p->numFastBytes) + { + *backRes = i; + MovePos(p, len - 1); + return len; + } + if (len > repLen) + { + repIndex = i; + repLen = len; + } + } + + matches = p->matches; + if (mainLen >= p->numFastBytes) + { + *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; + MovePos(p, mainLen - 1); + return mainLen; + } + + mainDist = 0; /* for GCC */ + if (mainLen >= 2) + { + mainDist = matches[numPairs - 1]; + while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) + { + if (!ChangePair(matches[numPairs - 3], mainDist)) + break; + numPairs -= 2; + mainLen = matches[numPairs - 2]; + mainDist = matches[numPairs - 1]; + } + if (mainLen == 2 && mainDist >= 0x80) + mainLen = 1; + } + + if (repLen >= 2 && ( + (repLen + 1 >= mainLen) || + (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || + (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) + { + *backRes = repIndex; + MovePos(p, repLen - 1); + return repLen; + } + + if (mainLen < 2 || numAvail <= 2) + return 1; + + p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); + if (p->longestMatchLength >= 2) + { + UInt32 newDistance = matches[p->numPairs - 1]; + if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || + (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || + (p->longestMatchLength > mainLen + 1) || + (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) + return 1; + } + + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; + for (i = 0; i < LZMA_NUM_REPS; i++) + { + UInt32 len, limit; + const Byte *data2 = data - (p->reps[i] + 1); + if (data[0] != data2[0] || data[1] != data2[1]) + continue; + limit = mainLen - 1; + for (len = 2; len < limit && data[len] == data2[len]; len++); + if (len >= limit) + return 1; + } + *backRes = mainDist + LZMA_NUM_REPS; + MovePos(p, mainLen - 2); + return mainLen; +} + +static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) +{ + UInt32 len; + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + len = LZMA_MATCH_LEN_MIN; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); + RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); +} + +static SRes CheckErrors(CLzmaEnc *p) +{ + if (p->result != SZ_OK) + return p->result; + if (p->rc.res != SZ_OK) + p->result = SZ_ERROR_WRITE; + if (p->matchFinderBase.result != SZ_OK) + p->result = SZ_ERROR_READ; + if (p->result != SZ_OK) + p->finished = True; + return p->result; +} + +static SRes Flush(CLzmaEnc *p, UInt32 nowPos) +{ + /* ReleaseMFStream(); */ + p->finished = True; + if (p->writeEndMark) + WriteEndMarker(p, nowPos & p->pbMask); + RangeEnc_FlushData(&p->rc); + RangeEnc_FlushStream(&p->rc); + return CheckErrors(p); +} + +static void FillAlignPrices(CLzmaEnc *p) +{ + UInt32 i; + for (i = 0; i < kAlignTableSize; i++) + p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); + p->alignPriceCount = 0; +} + +static void FillDistancesPrices(CLzmaEnc *p) +{ + UInt32 tempPrices[kNumFullDistances]; + UInt32 i, lenToPosState; + for (i = kStartPosModelIndex; i < kNumFullDistances; i++) + { + UInt32 posSlot = GetPosSlot1(i); + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); + } + + for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) + { + UInt32 posSlot; + const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; + UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; + for (posSlot = 0; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); + for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) + posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); + + { + UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; + UInt32 i; + for (i = 0; i < kStartPosModelIndex; i++) + distancesPrices[i] = posSlotPrices[i]; + for (; i < kNumFullDistances; i++) + distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; + } + } + p->matchPriceCount = 0; +} + +void LzmaEnc_Construct(CLzmaEnc *p) +{ + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); + #ifndef _7ZIP_ST + MatchFinderMt_Construct(&p->matchFinderMt); + p->matchFinderMt.MatchFinder = &p->matchFinderBase; + #endif + + { + CLzmaEncProps props; + LzmaEncProps_Init(&props); + LzmaEnc_SetProps(p, &props); + } + + #ifndef LZMA_LOG_BSR + LzmaEnc_FastPosInit(p->g_FastPos); + #endif + + LzmaEnc_InitPriceTables(p->ProbPrices); + p->litProbs = 0; + p->saveState.litProbs = 0; +} + +CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) +{ + void *p; + p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); + if (p != 0) + LzmaEnc_Construct((CLzmaEnc *)p); + return p; +} + +void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->litProbs); + alloc->Free(alloc, p->saveState.litProbs); + p->litProbs = 0; + p->saveState.litProbs = 0; +} + +void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + #ifndef _7ZIP_ST + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); + #endif + MatchFinder_Free(&p->matchFinderBase, allocBig); + LzmaEnc_FreeLits(p, alloc); + RangeEnc_Free(&p->rc, alloc); +} + +void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); + alloc->Free(alloc, p); +} + +static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) +{ + UInt32 nowPos32, startPos32; + if (p->needInit) + { + p->matchFinder.Init(p->matchFinderObj); + p->needInit = 0; + } + + if (p->finished) + return p->result; + RINOK(CheckErrors(p)); + + nowPos32 = (UInt32)p->nowPos64; + startPos32 = nowPos32; + + if (p->nowPos64 == 0) + { + UInt32 numPairs; + Byte curByte; + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + return Flush(p, nowPos32); + ReadMatchDistances(p, &numPairs); + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); + p->state = kLiteralNextStates[p->state]; + curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); + LitEnc_Encode(&p->rc, p->litProbs, curByte); + p->additionalOffset--; + nowPos32++; + } + + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) + for (;;) + { + UInt32 pos, len, posState; + + if (p->fastMode) + len = GetOptimumFast(p, &pos); + else + len = GetOptimum(p, nowPos32, &pos); + + #ifdef SHOW_STAT2 + printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); + #endif + + posState = nowPos32 & p->pbMask; + if (len == 1 && pos == (UInt32)-1) + { + Byte curByte; + CLzmaProb *probs; + const Byte *data; + + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); + data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; + curByte = *data; + probs = LIT_PROBS(nowPos32, *(data - 1)); + if (IsCharState(p->state)) + LitEnc_Encode(&p->rc, probs, curByte); + else + LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); + p->state = kLiteralNextStates[p->state]; + } + else + { + RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); + if (pos < LZMA_NUM_REPS) + { + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); + if (pos == 0) + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); + RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); + } + else + { + UInt32 distance = p->reps[pos]; + RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); + if (pos == 1) + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); + else + { + RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); + RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); + if (pos == 3) + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + } + p->reps[1] = p->reps[0]; + p->reps[0] = distance; + } + if (len == 1) + p->state = kShortRepNextStates[p->state]; + else + { + LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + p->state = kRepNextStates[p->state]; + } + } + else + { + UInt32 posSlot; + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + pos -= LZMA_NUM_REPS; + GetPosSlot(pos, posSlot); + RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); + + if (posSlot >= kStartPosModelIndex) + { + UInt32 footerBits = ((posSlot >> 1) - 1); + UInt32 base = ((2 | (posSlot & 1)) << footerBits); + UInt32 posReduced = pos - base; + + if (posSlot < kEndPosModelIndex) + RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); + else + { + RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); + RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); + p->alignPriceCount++; + } + } + p->reps[3] = p->reps[2]; + p->reps[2] = p->reps[1]; + p->reps[1] = p->reps[0]; + p->reps[0] = pos; + p->matchPriceCount++; + } + } + p->additionalOffset -= len; + nowPos32 += len; + if (p->additionalOffset == 0) + { + UInt32 processed; + if (!p->fastMode) + { + if (p->matchPriceCount >= (1 << 7)) + FillDistancesPrices(p); + if (p->alignPriceCount >= kAlignTableSize) + FillAlignPrices(p); + } + if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) + break; + processed = nowPos32 - startPos32; + if (useLimits) + { + if (processed + kNumOpts + 300 >= maxUnpackSize || + RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) + break; + } + else if (processed >= (1 << 15)) + { + p->nowPos64 += nowPos32 - startPos32; + return CheckErrors(p); + } + } + } + p->nowPos64 += nowPos32 - startPos32; + return Flush(p, nowPos32); +} + +#define kBigHashDicLimit ((UInt32)1 << 24) + +static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 beforeSize = kNumOpts; + Bool btMode; + if (!RangeEnc_Alloc(&p->rc, alloc)) + return SZ_ERROR_MEM; + btMode = (p->matchFinderBase.btMode != 0); + #ifndef _7ZIP_ST + p->mtMode = (p->multiThread && !p->fastMode && btMode); + #endif + + { + unsigned lclp = p->lc + p->lp; + if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) + { + LzmaEnc_FreeLits(p, alloc); + p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); + p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); + if (p->litProbs == 0 || p->saveState.litProbs == 0) + { + LzmaEnc_FreeLits(p, alloc); + return SZ_ERROR_MEM; + } + p->lclp = lclp; + } + } + + p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); + + if (beforeSize + p->dictSize < keepWindowSize) + beforeSize = keepWindowSize - p->dictSize; + + #ifndef _7ZIP_ST + if (p->mtMode) + { + RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); + p->matchFinderObj = &p->matchFinderMt; + MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); + } + else + #endif + { + if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) + return SZ_ERROR_MEM; + p->matchFinderObj = &p->matchFinderBase; + MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); + } + return SZ_OK; +} + +void LzmaEnc_Init(CLzmaEnc *p) +{ + UInt32 i; + p->state = 0; + for (i = 0 ; i < LZMA_NUM_REPS; i++) + p->reps[i] = 0; + + RangeEnc_Init(&p->rc); + + + for (i = 0; i < kNumStates; i++) + { + UInt32 j; + for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) + { + p->isMatch[i][j] = kProbInitValue; + p->isRep0Long[i][j] = kProbInitValue; + } + p->isRep[i] = kProbInitValue; + p->isRepG0[i] = kProbInitValue; + p->isRepG1[i] = kProbInitValue; + p->isRepG2[i] = kProbInitValue; + } + + { + UInt32 num = 0x300 << (p->lp + p->lc); + for (i = 0; i < num; i++) + p->litProbs[i] = kProbInitValue; + } + + { + for (i = 0; i < kNumLenToPosStates; i++) + { + CLzmaProb *probs = p->posSlotEncoder[i]; + UInt32 j; + for (j = 0; j < (1 << kNumPosSlotBits); j++) + probs[j] = kProbInitValue; + } + } + { + for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) + p->posEncoders[i] = kProbInitValue; + } + + LenEnc_Init(&p->lenEnc.p); + LenEnc_Init(&p->repLenEnc.p); + + for (i = 0; i < (1 << kNumAlignBits); i++) + p->posAlignEncoder[i] = kProbInitValue; + + p->optimumEndIndex = 0; + p->optimumCurrentIndex = 0; + p->additionalOffset = 0; + + p->pbMask = (1 << p->pb) - 1; + p->lpMask = (1 << p->lp) - 1; +} + +void LzmaEnc_InitPrices(CLzmaEnc *p) +{ + if (!p->fastMode) + { + FillDistancesPrices(p); + FillAlignPrices(p); + } + + p->lenEnc.tableSize = + p->repLenEnc.tableSize = + p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; + LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); + LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); +} + +static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + UInt32 i; + for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) + if (p->dictSize <= ((UInt32)1 << i)) + break; + p->distTableSize = i * 2; + + p->finished = False; + p->result = SZ_OK; + RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + p->nowPos64 = 0; + return SZ_OK; +} + +static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + p->rc.outStream = outStream; + return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +} + +SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, + ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + p->matchFinderBase.stream = inStream; + p->needInit = 1; + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) +{ + p->matchFinderBase.directInput = 1; + p->matchFinderBase.bufferBase = (Byte *)src; + p->matchFinderBase.directInputRem = srcLen; +} + +SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, + UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + LzmaEnc_SetInputBuf(p, src, srcLen); + p->needInit = 1; + + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + +void LzmaEnc_Finish(CLzmaEncHandle pp) +{ + #ifndef _7ZIP_ST + CLzmaEnc *p = (CLzmaEnc *)pp; + if (p->mtMode) + MatchFinderMt_ReleaseStream(&p->matchFinderMt); + #else + pp = pp; + #endif +} + +typedef struct +{ + ISeqOutStream funcTable; + Byte *data; + SizeT rem; + Bool overflow; +} CSeqOutStreamBuf; + +static size_t MyWrite(void *pp, const void *data, size_t size) +{ + CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; + if (p->rem < size) + { + size = p->rem; + p->overflow = True; + } + memcpy(p->data, data, size); + p->rem -= size; + p->data += size; + return size; +} + + +UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +} + +const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; +} + +SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + UInt64 nowPos64; + SRes res; + CSeqOutStreamBuf outStream; + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = False; + p->finished = False; + p->result = SZ_OK; + + if (reInit) + LzmaEnc_Init(p); + LzmaEnc_InitPrices(p); + nowPos64 = p->nowPos64; + RangeEnc_Init(&p->rc); + p->rc.outStream = &outStream.funcTable; + + res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); + + *unpackSize = (UInt32)(p->nowPos64 - nowPos64); + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + + return res; +} + +static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) +{ + SRes res = SZ_OK; + + #ifndef _7ZIP_ST + Byte allocaDummy[0x300]; + int i = 0; + for (i = 0; i < 16; i++) + allocaDummy[i] = (Byte)i; + #endif + + for (;;) + { + res = LzmaEnc_CodeOneBlock(p, False, 0, 0); + if (res != SZ_OK || p->finished != 0) + break; + if (progress != 0) + { + res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); + if (res != SZ_OK) + { + res = SZ_ERROR_PROGRESS; + break; + } + } + } + LzmaEnc_Finish(p); + return res; +} + +SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ + RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); + return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); +} + +SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + int i; + UInt32 dictSize = p->dictSize; + if (*size < LZMA_PROPS_SIZE) + return SZ_ERROR_PARAM; + *size = LZMA_PROPS_SIZE; + props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); + + for (i = 11; i <= 30; i++) + { + if (dictSize <= ((UInt32)2 << i)) + { + dictSize = (2 << i); + break; + } + if (dictSize <= ((UInt32)3 << i)) + { + dictSize = (3 << i); + break; + } + } + + for (i = 0; i < 4; i++) + props[1 + i] = (Byte)(dictSize >> (8 * i)); + return SZ_OK; +} + +SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + SRes res; + CLzmaEnc *p = (CLzmaEnc *)pp; + + CSeqOutStreamBuf outStream; + + LzmaEnc_SetInputBuf(p, src, srcLen); + + outStream.funcTable.Write = MyWrite; + outStream.data = dest; + outStream.rem = *destLen; + outStream.overflow = False; + + p->writeEndMark = writeEndMark; + + p->rc.outStream = &outStream.funcTable; + res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); + if (res == SZ_OK) + res = LzmaEnc_Encode2(p, progress); + + *destLen -= outStream.rem; + if (outStream.overflow) + return SZ_ERROR_OUTPUT_EOF; + return res; +} + +SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); + SRes res; + if (p == 0) + return SZ_ERROR_MEM; + + res = LzmaEnc_SetProps(p, props); + if (res == SZ_OK) + { + res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); + if (res == SZ_OK) + res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, + writeEndMark, progress, alloc, allocBig); + } + + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaEnc.h b/src/ZipLib/extlibs/lzma/unix/LzmaEnc.h new file mode 100644 index 00000000..200d60eb --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaEnc.h @@ -0,0 +1,80 @@ +/* LzmaEnc.h -- LZMA Encoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA_ENC_H +#define __LZMA_ENC_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LZMA_PROPS_SIZE 5 + +typedef struct _CLzmaEncProps +{ + int level; /* 0 <= level <= 9 */ + UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version + (1 << 12) <= dictSize <= (1 << 30) for 64-bit version + default = (1 << 24) */ + int lc; /* 0 <= lc <= 8, default = 3 */ + int lp; /* 0 <= lp <= 4, default = 0 */ + int pb; /* 0 <= pb <= 4, default = 2 */ + int algo; /* 0 - fast, 1 - normal, default = 1 */ + int fb; /* 5 <= fb <= 273, default = 32 */ + int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */ + int numHashBytes; /* 2, 3 or 4, default = 4 */ + UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */ + unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */ + int numThreads; /* 1 or 2, default = 2 */ +} CLzmaEncProps; + +void LzmaEncProps_Init(CLzmaEncProps *p); +void LzmaEncProps_Normalize(CLzmaEncProps *p); +UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2); + + +/* ---------- CLzmaEncHandle Interface ---------- */ + +/* LzmaEnc_* functions can return the following exit codes: +Returns: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater in props + SZ_ERROR_WRITE - Write callback error. + SZ_ERROR_PROGRESS - some break from progress callback + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +typedef void * CLzmaEncHandle; + +CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc); +void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props); +SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size); +SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); +SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + +/* ---------- One Call Interface ---------- */ + +/* LzmaEncode +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, + const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, + ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.c b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.c new file mode 100644 index 00000000..b801dd1c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.c @@ -0,0 +1,61 @@ +/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder +2008-04-07 +Igor Pavlov +Public domain */ + +#include "Lzma86Dec.h" + +#include "../Alloc.h" +#include "../Bra.h" +#include "../LzmaDec.h" + +#define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE) +#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8) + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } +static ISzAlloc g_Alloc = { SzAlloc, SzFree }; + +SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) +{ + unsigned i; + if (srcLen < LZMA86_HEADER_SIZE) + return SZ_ERROR_INPUT_EOF; + *unpackSize = 0; + for (i = 0; i < sizeof(UInt64); i++) + *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); + return SZ_OK; +} + +SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) +{ + SRes res; + int useFilter; + SizeT inSizePure; + ELzmaStatus status; + + if (*srcLen < LZMA86_HEADER_SIZE) + return SZ_ERROR_INPUT_EOF; + + useFilter = src[0]; + + if (useFilter > 1) + { + *destLen = 0; + return SZ_ERROR_UNSUPPORTED; + } + + inSizePure = *srcLen - LZMA86_HEADER_SIZE; + res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, + src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); + *srcLen = inSizePure + LZMA86_HEADER_SIZE; + if (res != SZ_OK) + return res; + if (useFilter == 1) + { + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(dest, *destLen, 0, &x86State, 0); + } + return SZ_OK; +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.h b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.h new file mode 100644 index 00000000..138ce1ff --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Dec.h @@ -0,0 +1,51 @@ +/* Lzma86Dec.h -- LZMA + x86 (BCJ) Filter Decoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA86_DEC_H +#define __LZMA86_DEC_H + +#include "../Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Lzma86_GetUnpackSize: + In: + src - input data + srcLen - input data size + Out: + unpackSize - size of uncompressed stream + Return code: + SZ_OK - OK + SZ_ERROR_INPUT_EOF - Error in headers +*/ + +SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize); + +/* +Lzma86_Decode: + In: + dest - output data + destLen - output data size + src - input data + srcLen - input data size + Out: + destLen - processed output size + srcLen - processed input size + Return code: + SZ_OK - OK + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - unsupported file + SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer +*/ + +SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.c b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.c new file mode 100644 index 00000000..efc81ea3 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.c @@ -0,0 +1,113 @@ +/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder +2008-08-05 +Igor Pavlov +Public domain */ + +#include + +#include "Lzma86Enc.h" + +#include "../Alloc.h" +#include "../Bra.h" +#include "../LzmaEnc.h" + +#define SZE_OUT_OVERFLOW SZE_DATA_ERROR + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } +static ISzAlloc g_Alloc = { SzAlloc, SzFree }; + +#define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE) +#define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8) + +int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, + int level, UInt32 dictSize, int filterMode) +{ + size_t outSize2 = *destLen; + Byte *filteredStream; + Bool useFilter; + int mainResult = SZ_ERROR_OUTPUT_EOF; + CLzmaEncProps props; + LzmaEncProps_Init(&props); + props.level = level; + props.dictSize = dictSize; + + *destLen = 0; + if (outSize2 < LZMA86_HEADER_SIZE) + return SZ_ERROR_OUTPUT_EOF; + + { + int i; + UInt64 t = srcLen; + for (i = 0; i < 8; i++, t >>= 8) + dest[LZMA86_SIZE_OFFSET + i] = (Byte)t; + } + + filteredStream = 0; + useFilter = (filterMode != SZ_FILTER_NO); + if (useFilter) + { + if (srcLen != 0) + { + filteredStream = (Byte *)MyAlloc(srcLen); + if (filteredStream == 0) + return SZ_ERROR_MEM; + memcpy(filteredStream, src, srcLen); + } + { + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(filteredStream, srcLen, 0, &x86State, 1); + } + } + + { + size_t minSize = 0; + Bool bestIsFiltered = False; + + /* passes for SZ_FILTER_AUTO: + 0 - BCJ + LZMA + 1 - LZMA + 2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better. + */ + int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1; + + int i; + for (i = 0; i < numPasses; i++) + { + size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE; + size_t outPropsSize = 5; + SRes curRes; + Bool curModeIsFiltered = (numPasses > 1 && i == numPasses - 1); + if (curModeIsFiltered && !bestIsFiltered) + break; + if (useFilter && i == 0) + curModeIsFiltered = True; + + curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed, + curModeIsFiltered ? filteredStream : src, srcLen, + &props, dest + 1, &outPropsSize, 0, + NULL, &g_Alloc, &g_Alloc); + + if (curRes != SZ_ERROR_OUTPUT_EOF) + { + if (curRes != SZ_OK) + { + mainResult = curRes; + break; + } + if (outSizeProcessed <= minSize || mainResult != SZ_OK) + { + minSize = outSizeProcessed; + bestIsFiltered = curModeIsFiltered; + mainResult = SZ_OK; + } + } + } + dest[0] = (bestIsFiltered ? 1 : 0); + *destLen = LZMA86_HEADER_SIZE + minSize; + } + if (useFilter) + MyFree(filteredStream); + return mainResult; +} diff --git a/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.h b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.h new file mode 100644 index 00000000..355bf343 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/LzmaUtil/Lzma86Enc.h @@ -0,0 +1,78 @@ +/* Lzma86Enc.h -- LZMA + x86 (BCJ) Filter Encoder +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __LZMA86_ENC_H +#define __LZMA86_ENC_H + +#include "../Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +It's an example for LZMA + x86 Filter use. +You can use .lzma86 extension, if you write that stream to file. +.lzma86 header adds one additional byte to standard .lzma header. +.lzma86 header (14 bytes): + Offset Size Description + 0 1 = 0 - no filter, + = 1 - x86 filter + 1 1 lc, lp and pb in encoded form + 2 4 dictSize (little endian) + 6 8 uncompressed size (little endian) + + +Lzma86_Encode +------------- +level - compression level: 0 <= level <= 9, the default value for "level" is 5. + + +dictSize - The dictionary size in bytes. The maximum value is + 128 MB = (1 << 27) bytes for 32-bit version + 1 GB = (1 << 30) bytes for 64-bit version + The default value is 16 MB = (1 << 24) bytes, for level = 5. + It's recommended to use the dictionary that is larger than 4 KB and + that can be calculated as (1 << N) or (3 << N) sizes. + For better compression ratio dictSize must be >= inSize. + +filterMode: + SZ_FILTER_NO - no Filter + SZ_FILTER_YES - x86 Filter + SZ_FILTER_AUTO - it tries both alternatives to select best. + Encoder will use 2 or 3 passes: + 2 passes when FILTER_NO provides better compression. + 3 passes when FILTER_YES provides better compression. + +Lzma86Encode allocates Data with MyAlloc functions. +RAM Requirements for compressing: + RamSize = dictionarySize * 11.5 + 6MB + FilterBlockSize + filterMode FilterBlockSize + SZ_FILTER_NO 0 + SZ_FILTER_YES inSize + SZ_FILTER_AUTO inSize + + +Return code: + SZ_OK - OK + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_PARAM - Incorrect paramater + SZ_ERROR_OUTPUT_EOF - output buffer overflow + SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version) +*/ + +enum ESzFilterMode +{ + SZ_FILTER_NO, + SZ_FILTER_YES, + SZ_FILTER_AUTO +}; + +SRes Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, + int level, UInt32 dictSize, int filterMode); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/MtCoder.c b/src/ZipLib/extlibs/lzma/unix/MtCoder.c new file mode 100644 index 00000000..946fbbc7 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/MtCoder.c @@ -0,0 +1,327 @@ +/* MtCoder.c -- Multi-thread Coder +2010-09-24 : Igor Pavlov : Public domain */ + +#include + +#include "MtCoder.h" + +void LoopThread_Construct(CLoopThread *p) +{ + Thread_Construct(&p->thread); + Event_Construct(&p->startEvent); + Event_Construct(&p->finishedEvent); +} + +void LoopThread_Close(CLoopThread *p) +{ + Thread_Close(&p->thread); + Event_Close(&p->startEvent); + Event_Close(&p->finishedEvent); +} + +static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE LoopThreadFunc(void *pp) +{ + CLoopThread *p = (CLoopThread *)pp; + for (;;) + { + if (Event_Wait(&p->startEvent) != 0) + return SZ_ERROR_THREAD; + if (p->stop) + return 0; + p->res = p->func(p->param); + if (Event_Set(&p->finishedEvent) != 0) + return SZ_ERROR_THREAD; + } +} + +WRes LoopThread_Create(CLoopThread *p) +{ + p->stop = 0; + RINOK(AutoResetEvent_CreateNotSignaled(&p->startEvent)); + RINOK(AutoResetEvent_CreateNotSignaled(&p->finishedEvent)); + return Thread_Create(&p->thread, LoopThreadFunc, p); +} + +WRes LoopThread_StopAndWait(CLoopThread *p) +{ + p->stop = 1; + if (Event_Set(&p->startEvent) != 0) + return SZ_ERROR_THREAD; + return Thread_Wait(&p->thread); +} + +WRes LoopThread_StartSubThread(CLoopThread *p) { return Event_Set(&p->startEvent); } +WRes LoopThread_WaitSubThread(CLoopThread *p) { return Event_Wait(&p->finishedEvent); } + +static SRes Progress(ICompressProgress *p, UInt64 inSize, UInt64 outSize) +{ + return (p && p->Progress(p, inSize, outSize) != SZ_OK) ? SZ_ERROR_PROGRESS : SZ_OK; +} + +static void MtProgress_Init(CMtProgress *p, ICompressProgress *progress) +{ + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + p->inSizes[i] = p->outSizes[i] = 0; + p->totalInSize = p->totalOutSize = 0; + p->progress = progress; + p->res = SZ_OK; +} + +static void MtProgress_Reinit(CMtProgress *p, unsigned index) +{ + p->inSizes[index] = 0; + p->outSizes[index] = 0; +} + +#define UPDATE_PROGRESS(size, prev, total) \ + if (size != (UInt64)(Int64)-1) { total += size - prev; prev = size; } + +SRes MtProgress_Set(CMtProgress *p, unsigned index, UInt64 inSize, UInt64 outSize) +{ + SRes res; + CriticalSection_Enter(&p->cs); + UPDATE_PROGRESS(inSize, p->inSizes[index], p->totalInSize) + UPDATE_PROGRESS(outSize, p->outSizes[index], p->totalOutSize) + if (p->res == SZ_OK) + p->res = Progress(p->progress, p->totalInSize, p->totalOutSize); + res = p->res; + CriticalSection_Leave(&p->cs); + return res; +} + +static void MtProgress_SetError(CMtProgress *p, SRes res) +{ + CriticalSection_Enter(&p->cs); + if (p->res == SZ_OK) + p->res = res; + CriticalSection_Leave(&p->cs); +} + +static void MtCoder_SetError(CMtCoder* p, SRes res) +{ + CriticalSection_Enter(&p->cs); + if (p->res == SZ_OK) + p->res = res; + CriticalSection_Leave(&p->cs); +} + +/* ---------- MtThread ---------- */ + +void CMtThread_Construct(CMtThread *p, CMtCoder *mtCoder) +{ + p->mtCoder = mtCoder; + p->outBuf = 0; + p->inBuf = 0; + Event_Construct(&p->canRead); + Event_Construct(&p->canWrite); + LoopThread_Construct(&p->thread); +} + +#define RINOK_THREAD(x) { if((x) != 0) return SZ_ERROR_THREAD; } + +static void CMtThread_CloseEvents(CMtThread *p) +{ + Event_Close(&p->canRead); + Event_Close(&p->canWrite); +} + +static void CMtThread_Destruct(CMtThread *p) +{ + CMtThread_CloseEvents(p); + + if (Thread_WasCreated(&p->thread.thread)) + { + LoopThread_StopAndWait(&p->thread); + LoopThread_Close(&p->thread); + } + + if (p->mtCoder->alloc) + IAlloc_Free(p->mtCoder->alloc, p->outBuf); + p->outBuf = 0; + + if (p->mtCoder->alloc) + IAlloc_Free(p->mtCoder->alloc, p->inBuf); + p->inBuf = 0; +} + +#define MY_BUF_ALLOC(buf, size, newSize) \ + if (buf == 0 || size != newSize) \ + { IAlloc_Free(p->mtCoder->alloc, buf); \ + size = newSize; buf = (Byte *)IAlloc_Alloc(p->mtCoder->alloc, size); \ + if (buf == 0) return SZ_ERROR_MEM; } + +static SRes CMtThread_Prepare(CMtThread *p) +{ + MY_BUF_ALLOC(p->inBuf, p->inBufSize, p->mtCoder->blockSize) + MY_BUF_ALLOC(p->outBuf, p->outBufSize, p->mtCoder->destBlockSize) + + p->stopReading = False; + p->stopWriting = False; + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canRead)); + RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canWrite)); + + return SZ_OK; +} + +static SRes FullRead(ISeqInStream *stream, Byte *data, size_t *processedSize) +{ + size_t size = *processedSize; + *processedSize = 0; + while (size != 0) + { + size_t curSize = size; + SRes res = stream->Read(stream, data, &curSize); + *processedSize += curSize; + data += curSize; + size -= curSize; + RINOK(res); + if (curSize == 0) + return SZ_OK; + } + return SZ_OK; +} + +#define GET_NEXT_THREAD(p) &p->mtCoder->threads[p->index == p->mtCoder->numThreads - 1 ? 0 : p->index + 1] + +static SRes MtThread_Process(CMtThread *p, Bool *stop) +{ + CMtThread *next; + *stop = True; + if (Event_Wait(&p->canRead) != 0) + return SZ_ERROR_THREAD; + + next = GET_NEXT_THREAD(p); + + if (p->stopReading) + { + next->stopReading = True; + return Event_Set(&next->canRead) == 0 ? SZ_OK : SZ_ERROR_THREAD; + } + + { + size_t size = p->mtCoder->blockSize; + size_t destSize = p->outBufSize; + + RINOK(FullRead(p->mtCoder->inStream, p->inBuf, &size)); + next->stopReading = *stop = (size != p->mtCoder->blockSize); + if (Event_Set(&next->canRead) != 0) + return SZ_ERROR_THREAD; + + RINOK(p->mtCoder->mtCallback->Code(p->mtCoder->mtCallback, p->index, + p->outBuf, &destSize, p->inBuf, size, *stop)); + + MtProgress_Reinit(&p->mtCoder->mtProgress, p->index); + + if (Event_Wait(&p->canWrite) != 0) + return SZ_ERROR_THREAD; + if (p->stopWriting) + return SZ_ERROR_FAIL; + if (p->mtCoder->outStream->Write(p->mtCoder->outStream, p->outBuf, destSize) != destSize) + return SZ_ERROR_WRITE; + return Event_Set(&next->canWrite) == 0 ? SZ_OK : SZ_ERROR_THREAD; + } +} + +static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE ThreadFunc(void *pp) +{ + CMtThread *p = (CMtThread *)pp; + for (;;) + { + Bool stop; + CMtThread *next = GET_NEXT_THREAD(p); + SRes res = MtThread_Process(p, &stop); + if (res != SZ_OK) + { + MtCoder_SetError(p->mtCoder, res); + MtProgress_SetError(&p->mtCoder->mtProgress, res); + next->stopReading = True; + next->stopWriting = True; + Event_Set(&next->canRead); + Event_Set(&next->canWrite); + return res; + } + if (stop) + return 0; + } +} + +void MtCoder_Construct(CMtCoder* p) +{ + unsigned i; + p->alloc = 0; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + { + CMtThread *t = &p->threads[i]; + t->index = i; + CMtThread_Construct(t, p); + } + CriticalSection_Init(&p->cs); + CriticalSection_Init(&p->mtProgress.cs); +} + +void MtCoder_Destruct(CMtCoder* p) +{ + unsigned i; + for (i = 0; i < NUM_MT_CODER_THREADS_MAX; i++) + CMtThread_Destruct(&p->threads[i]); + CriticalSection_Delete(&p->cs); + CriticalSection_Delete(&p->mtProgress.cs); +} + +SRes MtCoder_Code(CMtCoder *p) +{ + unsigned i, numThreads = p->numThreads; + SRes res = SZ_OK; + p->res = SZ_OK; + + MtProgress_Init(&p->mtProgress, p->progress); + + for (i = 0; i < numThreads; i++) + { + RINOK(CMtThread_Prepare(&p->threads[i])); + } + + for (i = 0; i < numThreads; i++) + { + CMtThread *t = &p->threads[i]; + CLoopThread *lt = &t->thread; + + if (!Thread_WasCreated(<->thread)) + { + lt->func = ThreadFunc; + lt->param = t; + + if (LoopThread_Create(lt) != SZ_OK) + { + res = SZ_ERROR_THREAD; + break; + } + } + } + + if (res == SZ_OK) + { + unsigned j; + for (i = 0; i < numThreads; i++) + { + CMtThread *t = &p->threads[i]; + if (LoopThread_StartSubThread(&t->thread) != SZ_OK) + { + res = SZ_ERROR_THREAD; + p->threads[0].stopReading = True; + break; + } + } + + Event_Set(&p->threads[0].canWrite); + Event_Set(&p->threads[0].canRead); + + for (j = 0; j < i; j++) + LoopThread_WaitSubThread(&p->threads[j].thread); + } + + for (i = 0; i < numThreads; i++) + CMtThread_CloseEvents(&p->threads[i]); + return (res == SZ_OK) ? p->res : res; +} diff --git a/src/ZipLib/extlibs/lzma/unix/MtCoder.h b/src/ZipLib/extlibs/lzma/unix/MtCoder.h new file mode 100644 index 00000000..f0f06da2 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/MtCoder.h @@ -0,0 +1,98 @@ +/* MtCoder.h -- Multi-thread Coder +2009-11-19 : Igor Pavlov : Public domain */ + +#ifndef __MT_CODER_H +#define __MT_CODER_H + +#include "Threads.h" + +EXTERN_C_BEGIN + +typedef struct +{ + CThread thread; + CAutoResetEvent startEvent; + CAutoResetEvent finishedEvent; + int stop; + + THREAD_FUNC_TYPE func; + LPVOID param; + THREAD_FUNC_RET_TYPE res; +} CLoopThread; + +void LoopThread_Construct(CLoopThread *p); +void LoopThread_Close(CLoopThread *p); +WRes LoopThread_Create(CLoopThread *p); +WRes LoopThread_StopAndWait(CLoopThread *p); +WRes LoopThread_StartSubThread(CLoopThread *p); +WRes LoopThread_WaitSubThread(CLoopThread *p); + +#ifndef _7ZIP_ST +#define NUM_MT_CODER_THREADS_MAX 32 +#else +#define NUM_MT_CODER_THREADS_MAX 1 +#endif + +typedef struct +{ + UInt64 totalInSize; + UInt64 totalOutSize; + ICompressProgress *progress; + SRes res; + CCriticalSection cs; + UInt64 inSizes[NUM_MT_CODER_THREADS_MAX]; + UInt64 outSizes[NUM_MT_CODER_THREADS_MAX]; +} CMtProgress; + +SRes MtProgress_Set(CMtProgress *p, unsigned index, UInt64 inSize, UInt64 outSize); + +struct _CMtCoder; + +typedef struct +{ + struct _CMtCoder *mtCoder; + Byte *outBuf; + size_t outBufSize; + Byte *inBuf; + size_t inBufSize; + unsigned index; + CLoopThread thread; + + Bool stopReading; + Bool stopWriting; + CAutoResetEvent canRead; + CAutoResetEvent canWrite; +} CMtThread; + +typedef struct +{ + SRes (*Code)(void *p, unsigned index, Byte *dest, size_t *destSize, + const Byte *src, size_t srcSize, int finished); +} IMtCoderCallback; + +typedef struct _CMtCoder +{ + size_t blockSize; + size_t destBlockSize; + unsigned numThreads; + + ISeqInStream *inStream; + ISeqOutStream *outStream; + ICompressProgress *progress; + ISzAlloc *alloc; + + IMtCoderCallback *mtCallback; + CCriticalSection cs; + SRes res; + + CMtProgress mtProgress; + CMtThread threads[NUM_MT_CODER_THREADS_MAX]; +} CMtCoder; + +void MtCoder_Construct(CMtCoder* p); +void MtCoder_Destruct(CMtCoder* p); +SRes MtCoder_Code(CMtCoder *p); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd.h b/src/ZipLib/extlibs/lzma/unix/Ppmd.h new file mode 100644 index 00000000..621d9270 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd.h @@ -0,0 +1,85 @@ +/* Ppmd.h -- PPMD codec common code +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#ifndef __PPMD_H +#define __PPMD_H + +#include "Types.h" +#include "CpuArch.h" + +EXTERN_C_BEGIN + +#ifdef MY_CPU_32BIT + #define PPMD_32BIT +#endif + +#define PPMD_INT_BITS 7 +#define PPMD_PERIOD_BITS 7 +#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS)) + +#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift)) +#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2) +#define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob)) +#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob)) + +#define PPMD_N1 4 +#define PPMD_N2 4 +#define PPMD_N3 4 +#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4) +#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4) + +#pragma pack(push,1) + +/* SEE-contexts for PPM-contexts with masked symbols */ +typedef struct +{ + UInt16 Summ; /* Freq */ + Byte Shift; /* Speed of Freq change; low Shift is for fast change */ + Byte Count; /* Count to next change of Shift */ +} CPpmd_See; + +#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \ + { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); } + +typedef struct +{ + Byte Symbol; + Byte Freq; + UInt16 SuccessorLow; + UInt16 SuccessorHigh; +} CPpmd_State; + +#pragma pack(pop) + +typedef + #ifdef PPMD_32BIT + CPpmd_State * + #else + UInt32 + #endif + CPpmd_State_Ref; + +typedef + #ifdef PPMD_32BIT + void * + #else + UInt32 + #endif + CPpmd_Void_Ref; + +typedef + #ifdef PPMD_32BIT + Byte * + #else + UInt32 + #endif + CPpmd_Byte_Ref; + +#define PPMD_SetAllBitsIn256Bytes(p) \ + { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \ + p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }} + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd7.c b/src/ZipLib/extlibs/lzma/unix/Ppmd7.c new file mode 100644 index 00000000..060d86d2 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd7.c @@ -0,0 +1,708 @@ +/* Ppmd7.c -- PPMdH codec +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include + +#include "Ppmd7.h" + +const Byte PPMD7_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 }; +static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051}; + +#define MAX_FREQ 124 +#define UNIT_SIZE 12 + +#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE) +#define U2I(nu) (p->Units2Indx[(nu) - 1]) +#define I2U(indx) (p->Indx2Units[indx]) + +#ifdef PPMD_32BIT + #define REF(ptr) (ptr) +#else + #define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base)) +#endif + +#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr)) + +#define CTX(ref) ((CPpmd7_Context *)Ppmd7_GetContext(p, ref)) +#define STATS(ctx) Ppmd7_GetStats(p, ctx) +#define ONE_STATE(ctx) Ppmd7Context_OneState(ctx) +#define SUFFIX(ctx) CTX((ctx)->Suffix) + +typedef CPpmd7_Context * CTX_PTR; + +struct CPpmd7_Node_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd7_Node_ * + #else + UInt32 + #endif + CPpmd7_Node_Ref; + +typedef struct CPpmd7_Node_ +{ + UInt16 Stamp; /* must be at offset 0 as CPpmd7_Context::NumStats. Stamp=0 means free */ + UInt16 NU; + CPpmd7_Node_Ref Next; /* must be at offset >= 4 */ + CPpmd7_Node_Ref Prev; +} CPpmd7_Node; + +#ifdef PPMD_32BIT + #define NODE(ptr) (ptr) +#else + #define NODE(offs) ((CPpmd7_Node *)(p->Base + (offs))) +#endif + +void Ppmd7_Construct(CPpmd7 *p) +{ + unsigned i, k, m; + + p->Base = 0; + + for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) + { + unsigned step = (i >= 12 ? 4 : (i >> 2) + 1); + do { p->Units2Indx[k++] = (Byte)i; } while(--step); + p->Indx2Units[i] = (Byte)k; + } + + p->NS2BSIndx[0] = (0 << 1); + p->NS2BSIndx[1] = (1 << 1); + memset(p->NS2BSIndx + 2, (2 << 1), 9); + memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); + + for (i = 0; i < 3; i++) + p->NS2Indx[i] = (Byte)i; + for (m = i, k = 1; i < 256; i++) + { + p->NS2Indx[i] = (Byte)m; + if (--k == 0) + k = (++m) - 2; + } + + memset(p->HB2Flag, 0, 0x40); + memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40); +} + +void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->Base); + p->Size = 0; + p->Base = 0; +} + +Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc) +{ + if (p->Base == 0 || p->Size != size) + { + Ppmd7_Free(p, alloc); + p->AlignOffset = + #ifdef PPMD_32BIT + (4 - size) & 3; + #else + 4 - (size & 3); + #endif + if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size + #ifndef PPMD_32BIT + + UNIT_SIZE + #endif + )) == 0) + return False; + p->Size = size; + } + return True; +} + +static void InsertNode(CPpmd7 *p, void *node, unsigned indx) +{ + *((CPpmd_Void_Ref *)node) = p->FreeList[indx]; + p->FreeList[indx] = REF(node); +} + +static void *RemoveNode(CPpmd7 *p, unsigned indx) +{ + CPpmd_Void_Ref *node = (CPpmd_Void_Ref *)Ppmd7_GetPtr(p, p->FreeList[indx]); + p->FreeList[indx] = *node; + return node; +} + +static void SplitBlock(CPpmd7 *p, void *ptr, unsigned oldIndx, unsigned newIndx) +{ + unsigned i, nu = I2U(oldIndx) - I2U(newIndx); + ptr = (Byte *)ptr + U2B(I2U(newIndx)); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1); + } + InsertNode(p, ptr, i); +} + +static void GlueFreeBlocks(CPpmd7 *p) +{ + #ifdef PPMD_32BIT + CPpmd7_Node headItem; + CPpmd7_Node_Ref head = &headItem; + #else + CPpmd7_Node_Ref head = p->AlignOffset + p->Size; + #endif + + CPpmd7_Node_Ref n = head; + unsigned i; + + p->GlueCount = 255; + + /* create doubly-linked list of free blocks */ + for (i = 0; i < PPMD_NUM_INDEXES; i++) + { + UInt16 nu = I2U(i); + CPpmd7_Node_Ref next = (CPpmd7_Node_Ref)p->FreeList[i]; + p->FreeList[i] = 0; + while (next != 0) + { + CPpmd7_Node *node = NODE(next); + node->Next = n; + n = NODE(n)->Prev = next; + next = *(const CPpmd7_Node_Ref *)node; + node->Stamp = 0; + node->NU = (UInt16)nu; + } + } + NODE(head)->Stamp = 1; + NODE(head)->Next = n; + NODE(n)->Prev = head; + if (p->LoUnit != p->HiUnit) + ((CPpmd7_Node *)p->LoUnit)->Stamp = 1; + + /* Glue free blocks */ + while (n != head) + { + CPpmd7_Node *node = NODE(n); + UInt32 nu = (UInt32)node->NU; + for (;;) + { + CPpmd7_Node *node2 = NODE(n) + nu; + nu += node2->NU; + if (node2->Stamp != 0 || nu >= 0x10000) + break; + NODE(node2->Prev)->Next = node2->Next; + NODE(node2->Next)->Prev = node2->Prev; + node->NU = (UInt16)nu; + } + n = node->Next; + } + + /* Fill lists of free blocks */ + for (n = NODE(head)->Next; n != head;) + { + CPpmd7_Node *node = NODE(n); + unsigned nu; + CPpmd7_Node_Ref next = node->Next; + for (nu = node->NU; nu > 128; nu -= 128, node += 128) + InsertNode(p, node, PPMD_NUM_INDEXES - 1); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, node + k, nu - k - 1); + } + InsertNode(p, node, i); + n = next; + } +} + +static void *AllocUnitsRare(CPpmd7 *p, unsigned indx) +{ + unsigned i; + void *retVal; + if (p->GlueCount == 0) + { + GlueFreeBlocks(p); + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + } + i = indx; + do + { + if (++i == PPMD_NUM_INDEXES) + { + UInt32 numBytes = U2B(I2U(indx)); + p->GlueCount--; + return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL); + } + } + while (p->FreeList[i] == 0); + retVal = RemoveNode(p, i); + SplitBlock(p, retVal, i, indx); + return retVal; +} + +static void *AllocUnits(CPpmd7 *p, unsigned indx) +{ + UInt32 numBytes; + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + numBytes = U2B(I2U(indx)); + if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit)) + { + void *retVal = p->LoUnit; + p->LoUnit += numBytes; + return retVal; + } + return AllocUnitsRare(p, indx); +} + +#define MyMem12Cpy(dest, src, num) \ + { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \ + do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); } + +static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU) +{ + unsigned i0 = U2I(oldNU); + unsigned i1 = U2I(newNU); + if (i0 == i1) + return oldPtr; + if (p->FreeList[i1] != 0) + { + void *ptr = RemoveNode(p, i1); + MyMem12Cpy(ptr, oldPtr, newNU); + InsertNode(p, oldPtr, i0); + return ptr; + } + SplitBlock(p, oldPtr, i0, i1); + return oldPtr; +} + +#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16))) + +static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v) +{ + (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF); + (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF); +} + +static void RestartModel(CPpmd7 *p) +{ + unsigned i, k, m; + + memset(p->FreeList, 0, sizeof(p->FreeList)); + p->Text = p->Base + p->AlignOffset; + p->HiUnit = p->Text + p->Size; + p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE; + p->GlueCount = 0; + + p->OrderFall = p->MaxOrder; + p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1; + p->PrevSuccess = 0; + + p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */ + p->MinContext->Suffix = 0; + p->MinContext->NumStats = 256; + p->MinContext->SummFreq = 256 + 1; + p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */ + p->LoUnit += U2B(256 / 2); + p->MinContext->Stats = REF(p->FoundState); + for (i = 0; i < 256; i++) + { + CPpmd_State *s = &p->FoundState[i]; + s->Symbol = (Byte)i; + s->Freq = 1; + SetSuccessor(s, 0); + } + + for (i = 0; i < 128; i++) + for (k = 0; k < 8; k++) + { + UInt16 *dest = p->BinSumm[i] + k; + UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 2)); + for (m = 0; m < 64; m += 8) + dest[m] = val; + } + + for (i = 0; i < 25; i++) + for (k = 0; k < 16; k++) + { + CPpmd_See *s = &p->See[i][k]; + s->Summ = (UInt16)((5 * i + 10) << (s->Shift = PPMD_PERIOD_BITS - 4)); + s->Count = 4; + } +} + +void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder) +{ + p->MaxOrder = maxOrder; + RestartModel(p); + p->DummySee.Shift = PPMD_PERIOD_BITS; + p->DummySee.Summ = 0; /* unused */ + p->DummySee.Count = 64; /* unused */ +} + +static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip) +{ + CPpmd_State upState; + CTX_PTR c = p->MinContext; + CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); + CPpmd_State *ps[PPMD7_MAX_ORDER]; + unsigned numPs = 0; + + if (!skip) + ps[numPs++] = p->FoundState; + + while (c->Suffix) + { + CPpmd_Void_Ref successor; + CPpmd_State *s; + c = SUFFIX(c); + if (c->NumStats != 1) + { + for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); + } + else + s = ONE_STATE(c); + successor = SUCCESSOR(s); + if (successor != upBranch) + { + c = CTX(successor); + if (numPs == 0) + return c; + break; + } + ps[numPs++] = s; + } + + upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch); + SetSuccessor(&upState, upBranch + 1); + + if (c->NumStats == 1) + upState.Freq = ONE_STATE(c)->Freq; + else + { + UInt32 cf, s0; + CPpmd_State *s; + for (s = STATS(c); s->Symbol != upState.Symbol; s++); + cf = s->Freq - 1; + s0 = c->SummFreq - c->NumStats - cf; + upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0)))); + } + + do + { + /* Create Child */ + CTX_PTR c1; /* = AllocContext(p); */ + if (p->HiUnit != p->LoUnit) + c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); + else if (p->FreeList[0] != 0) + c1 = (CTX_PTR)RemoveNode(p, 0); + else + { + c1 = (CTX_PTR)AllocUnitsRare(p, 0); + if (!c1) + return NULL; + } + c1->NumStats = 1; + *ONE_STATE(c1) = upState; + c1->Suffix = REF(c); + SetSuccessor(ps[--numPs], REF(c1)); + c = c1; + } + while (numPs != 0); + + return c; +} + +static void SwapStates(CPpmd_State *t1, CPpmd_State *t2) +{ + CPpmd_State tmp = *t1; + *t1 = *t2; + *t2 = tmp; +} + +static void UpdateModel(CPpmd7 *p) +{ + CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState); + CTX_PTR c; + unsigned s0, ns; + + if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0) + { + c = SUFFIX(p->MinContext); + + if (c->NumStats == 1) + { + CPpmd_State *s = ONE_STATE(c); + if (s->Freq < 32) + s->Freq++; + } + else + { + CPpmd_State *s = STATS(c); + if (s->Symbol != p->FoundState->Symbol) + { + do { s++; } while (s->Symbol != p->FoundState->Symbol); + if (s[0].Freq >= s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + s--; + } + } + if (s->Freq < MAX_FREQ - 9) + { + s->Freq += 2; + c->SummFreq += 2; + } + } + } + + if (p->OrderFall == 0) + { + p->MinContext = p->MaxContext = CreateSuccessors(p, True); + if (p->MinContext == 0) + { + RestartModel(p); + return; + } + SetSuccessor(p->FoundState, REF(p->MinContext)); + return; + } + + *p->Text++ = p->FoundState->Symbol; + successor = REF(p->Text); + if (p->Text >= p->UnitsStart) + { + RestartModel(p); + return; + } + + if (fSuccessor) + { + if (fSuccessor <= successor) + { + CTX_PTR cs = CreateSuccessors(p, False); + if (cs == NULL) + { + RestartModel(p); + return; + } + fSuccessor = REF(cs); + } + if (--p->OrderFall == 0) + { + successor = fSuccessor; + p->Text -= (p->MaxContext != p->MinContext); + } + } + else + { + SetSuccessor(p->FoundState, successor); + fSuccessor = REF(p->MinContext); + } + + s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - (p->FoundState->Freq - 1); + + for (c = p->MaxContext; c != p->MinContext; c = SUFFIX(c)) + { + unsigned ns1; + UInt32 cf, sf; + if ((ns1 = c->NumStats) != 1) + { + if ((ns1 & 1) == 0) + { + /* Expand for one UNIT */ + unsigned oldNU = ns1 >> 1; + unsigned i = U2I(oldNU); + if (i != U2I(oldNU + 1)) + { + void *ptr = AllocUnits(p, i + 1); + void *oldPtr; + if (!ptr) + { + RestartModel(p); + return; + } + oldPtr = STATS(c); + MyMem12Cpy(ptr, oldPtr, oldNU); + InsertNode(p, oldPtr, i); + c->Stats = STATS_REF(ptr); + } + } + c->SummFreq = (UInt16)(c->SummFreq + (2 * ns1 < ns) + 2 * ((4 * ns1 <= ns) & (c->SummFreq <= 8 * ns1))); + } + else + { + CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0); + if (!s) + { + RestartModel(p); + return; + } + *s = *ONE_STATE(c); + c->Stats = REF(s); + if (s->Freq < MAX_FREQ / 4 - 1) + s->Freq <<= 1; + else + s->Freq = MAX_FREQ - 4; + c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 3)); + } + cf = 2 * (UInt32)p->FoundState->Freq * (c->SummFreq + 6); + sf = (UInt32)s0 + c->SummFreq; + if (cf < 6 * sf) + { + cf = 1 + (cf > sf) + (cf >= 4 * sf); + c->SummFreq += 3; + } + else + { + cf = 4 + (cf >= 9 * sf) + (cf >= 12 * sf) + (cf >= 15 * sf); + c->SummFreq = (UInt16)(c->SummFreq + cf); + } + { + CPpmd_State *s = STATS(c) + ns1; + SetSuccessor(s, successor); + s->Symbol = p->FoundState->Symbol; + s->Freq = (Byte)cf; + c->NumStats = (UInt16)(ns1 + 1); + } + } + p->MaxContext = p->MinContext = CTX(fSuccessor); +} + +static void Rescale(CPpmd7 *p) +{ + unsigned i, adder, sumFreq, escFreq; + CPpmd_State *stats = STATS(p->MinContext); + CPpmd_State *s = p->FoundState; + { + CPpmd_State tmp = *s; + for (; s != stats; s--) + s[0] = s[-1]; + *s = tmp; + } + escFreq = p->MinContext->SummFreq - s->Freq; + s->Freq += 4; + adder = (p->OrderFall != 0); + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq = s->Freq; + + i = p->MinContext->NumStats - 1; + do + { + escFreq -= (++s)->Freq; + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq += s->Freq; + if (s[0].Freq > s[-1].Freq) + { + CPpmd_State *s1 = s; + CPpmd_State tmp = *s1; + do + s1[0] = s1[-1]; + while (--s1 != stats && tmp.Freq > s1[-1].Freq); + *s1 = tmp; + } + } + while (--i); + + if (s->Freq == 0) + { + unsigned numStats = p->MinContext->NumStats; + unsigned n0, n1; + do { i++; } while ((--s)->Freq == 0); + escFreq += i; + p->MinContext->NumStats = (UInt16)(p->MinContext->NumStats - i); + if (p->MinContext->NumStats == 1) + { + CPpmd_State tmp = *stats; + do + { + tmp.Freq = (Byte)(tmp.Freq - (tmp.Freq >> 1)); + escFreq >>= 1; + } + while (escFreq > 1); + InsertNode(p, stats, U2I(((numStats + 1) >> 1))); + *(p->FoundState = ONE_STATE(p->MinContext)) = tmp; + return; + } + n0 = (numStats + 1) >> 1; + n1 = (p->MinContext->NumStats + 1) >> 1; + if (n0 != n1) + p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1)); + } + p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1)); + p->FoundState = STATS(p->MinContext); +} + +CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *escFreq) +{ + CPpmd_See *see; + unsigned nonMasked = p->MinContext->NumStats - numMasked; + if (p->MinContext->NumStats != 256) + { + see = p->See[p->NS2Indx[nonMasked - 1]] + + (nonMasked < (unsigned)SUFFIX(p->MinContext)->NumStats - p->MinContext->NumStats) + + 2 * (p->MinContext->SummFreq < 11 * p->MinContext->NumStats) + + 4 * (numMasked > nonMasked) + + p->HiBitsFlag; + { + unsigned r = (see->Summ >> see->Shift); + see->Summ = (UInt16)(see->Summ - r); + *escFreq = r + (r == 0); + } + } + else + { + see = &p->DummySee; + *escFreq = 1; + } + return see; +} + +static void NextContext(CPpmd7 *p) +{ + CTX_PTR c = CTX(SUCCESSOR(p->FoundState)); + if (p->OrderFall == 0 && (Byte *)c > p->Text) + p->MinContext = p->MaxContext = c; + else + UpdateModel(p); +} + +void Ppmd7_Update1(CPpmd7 *p) +{ + CPpmd_State *s = p->FoundState; + s->Freq += 4; + p->MinContext->SummFreq += 4; + if (s[0].Freq > s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + p->FoundState = --s; + if (s->Freq > MAX_FREQ) + Rescale(p); + } + NextContext(p); +} + +void Ppmd7_Update1_0(CPpmd7 *p) +{ + p->PrevSuccess = (2 * p->FoundState->Freq > p->MinContext->SummFreq); + p->RunLength += p->PrevSuccess; + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + NextContext(p); +} + +void Ppmd7_UpdateBin(CPpmd7 *p) +{ + p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 128 ? 1: 0)); + p->PrevSuccess = 1; + p->RunLength++; + NextContext(p); +} + +void Ppmd7_Update2(CPpmd7 *p) +{ + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + p->RunLength = p->InitRL; + UpdateModel(p); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd7.h b/src/ZipLib/extlibs/lzma/unix/Ppmd7.h new file mode 100644 index 00000000..96521c31 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd7.h @@ -0,0 +1,140 @@ +/* Ppmd7.h -- PPMdH compression codec +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +/* This code supports virtual RangeDecoder and includes the implementation +of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H. +If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */ + +#ifndef __PPMD7_H +#define __PPMD7_H + +#include "Ppmd.h" + +EXTERN_C_BEGIN + +#define PPMD7_MIN_ORDER 2 +#define PPMD7_MAX_ORDER 64 + +#define PPMD7_MIN_MEM_SIZE (1 << 11) +#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3) + +struct CPpmd7_Context_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd7_Context_ * + #else + UInt32 + #endif + CPpmd7_Context_Ref; + +typedef struct CPpmd7_Context_ +{ + UInt16 NumStats; + UInt16 SummFreq; + CPpmd_State_Ref Stats; + CPpmd7_Context_Ref Suffix; +} CPpmd7_Context; + +#define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) + +typedef struct +{ + CPpmd7_Context *MinContext, *MaxContext; + CPpmd_State *FoundState; + unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag; + Int32 RunLength, InitRL; /* must be 32-bit at least */ + + UInt32 Size; + UInt32 GlueCount; + Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; + UInt32 AlignOffset; + + Byte Indx2Units[PPMD_NUM_INDEXES]; + Byte Units2Indx[128]; + CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; + Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256]; + CPpmd_See DummySee, See[25][16]; + UInt16 BinSumm[128][64]; +} CPpmd7; + +void Ppmd7_Construct(CPpmd7 *p); +Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc); +void Ppmd7_Free(CPpmd7 *p, ISzAlloc *alloc); +void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder); +#define Ppmd7_WasAllocated(p) ((p)->Base != NULL) + + +/* ---------- Internal Functions ---------- */ + +extern const Byte PPMD7_kExpEscape[16]; + +#ifdef PPMD_32BIT + #define Ppmd7_GetPtr(p, ptr) (ptr) + #define Ppmd7_GetContext(p, ptr) (ptr) + #define Ppmd7_GetStats(p, ctx) ((ctx)->Stats) +#else + #define Ppmd7_GetPtr(p, offs) ((void *)((p)->Base + (offs))) + #define Ppmd7_GetContext(p, offs) ((CPpmd7_Context *)Ppmd7_GetPtr((p), (offs))) + #define Ppmd7_GetStats(p, ctx) ((CPpmd_State *)Ppmd7_GetPtr((p), ((ctx)->Stats))) +#endif + +void Ppmd7_Update1(CPpmd7 *p); +void Ppmd7_Update1_0(CPpmd7 *p); +void Ppmd7_Update2(CPpmd7 *p); +void Ppmd7_UpdateBin(CPpmd7 *p); + +#define Ppmd7_GetBinSumm(p) \ + &p->BinSumm[Ppmd7Context_OneState(p->MinContext)->Freq - 1][p->PrevSuccess + \ + p->NS2BSIndx[Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] + \ + (p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]) + \ + 2 * p->HB2Flag[Ppmd7Context_OneState(p->MinContext)->Symbol] + \ + ((p->RunLength >> 26) & 0x20)] + +CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale); + + +/* ---------- Decode ---------- */ + +typedef struct +{ + UInt32 (*GetThreshold)(void *p, UInt32 total); + void (*Decode)(void *p, UInt32 start, UInt32 size); + UInt32 (*DecodeBit)(void *p, UInt32 size0); +} IPpmd7_RangeDec; + +typedef struct +{ + IPpmd7_RangeDec p; + UInt32 Range; + UInt32 Code; + IByteIn *Stream; +} CPpmd7z_RangeDec; + +void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p); +Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p); +#define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0) + +int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc); + + +/* ---------- Encode ---------- */ + +typedef struct +{ + UInt64 Low; + UInt32 Range; + Byte Cache; + UInt64 CacheSize; + IByteOut *Stream; +} CPpmd7z_RangeEnc; + +void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p); +void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p); + +void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd7Dec.c b/src/ZipLib/extlibs/lzma/unix/Ppmd7Dec.c new file mode 100644 index 00000000..68438d5c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd7Dec.c @@ -0,0 +1,187 @@ +/* Ppmd7Dec.c -- PPMdH Decoder +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include "Ppmd7.h" + +#define kTopValue (1 << 24) + +Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p) +{ + unsigned i; + p->Code = 0; + p->Range = 0xFFFFFFFF; + if (p->Stream->Read((void *)p->Stream) != 0) + return False; + for (i = 0; i < 4; i++) + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + return (p->Code < 0xFFFFFFFF); +} + +static UInt32 Range_GetThreshold(void *pp, UInt32 total) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + return (p->Code) / (p->Range /= total); +} + +static void Range_Normalize(CPpmd7z_RangeDec *p) +{ + if (p->Range < kTopValue) + { + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + p->Range <<= 8; + if (p->Range < kTopValue) + { + p->Code = (p->Code << 8) | p->Stream->Read((void *)p->Stream); + p->Range <<= 8; + } + } +} + +static void Range_Decode(void *pp, UInt32 start, UInt32 size) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + p->Code -= start * p->Range; + p->Range *= size; + Range_Normalize(p); +} + +static UInt32 Range_DecodeBit(void *pp, UInt32 size0) +{ + CPpmd7z_RangeDec *p = (CPpmd7z_RangeDec *)pp; + UInt32 newBound = (p->Range >> 14) * size0; + UInt32 symbol; + if (p->Code < newBound) + { + symbol = 0; + p->Range = newBound; + } + else + { + symbol = 1; + p->Code -= newBound; + p->Range -= newBound; + } + Range_Normalize(p); + return symbol; +} + +void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p) +{ + p->p.GetThreshold = Range_GetThreshold; + p->p.Decode = Range_Decode; + p->p.DecodeBit = Range_DecodeBit; +} + + +#define MASK(sym) ((signed char *)charMask)[sym] + +int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 1) + { + CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext); + unsigned i; + UInt32 count, hiCnt; + if ((count = rc->GetThreshold(rc, p->MinContext->SummFreq)) < (hiCnt = s->Freq)) + { + Byte symbol; + rc->Decode(rc, 0, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update1_0(p); + return symbol; + } + p->PrevSuccess = 0; + i = p->MinContext->NumStats - 1; + do + { + if ((hiCnt += (++s)->Freq) > count) + { + Byte symbol; + rc->Decode(rc, hiCnt - s->Freq, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update1(p); + return symbol; + } + } + while (--i); + if (count >= p->MinContext->SummFreq) + return -2; + p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]; + rc->Decode(rc, hiCnt, p->MinContext->SummFreq - hiCnt); + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats - 1; + do { MASK((--s)->Symbol) = 0; } while (--i); + } + else + { + UInt16 *prob = Ppmd7_GetBinSumm(p); + if (rc->DecodeBit(rc, *prob) == 0) + { + Byte symbol; + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + symbol = (p->FoundState = Ppmd7Context_OneState(p->MinContext))->Symbol; + Ppmd7_UpdateBin(p); + return symbol; + } + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD7_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(Ppmd7Context_OneState(p->MinContext)->Symbol) = 0; + p->PrevSuccess = 0; + } + for (;;) + { + CPpmd_State *ps[256], *s; + UInt32 freqSum, count, hiCnt; + CPpmd_See *see; + unsigned i, num, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return -1; + p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + hiCnt = 0; + s = Ppmd7_GetStats(p, p->MinContext); + i = 0; + num = p->MinContext->NumStats - numMasked; + do + { + int k = (int)(MASK(s->Symbol)); + hiCnt += (s->Freq & k); + ps[i] = s++; + i -= k; + } + while (i != num); + + see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum); + freqSum += hiCnt; + count = rc->GetThreshold(rc, freqSum); + + if (count < hiCnt) + { + Byte symbol; + CPpmd_State **pps = ps; + for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++); + s = *pps; + rc->Decode(rc, hiCnt - s->Freq, s->Freq); + Ppmd_See_Update(see); + p->FoundState = s; + symbol = s->Symbol; + Ppmd7_Update2(p); + return symbol; + } + if (count >= freqSum) + return -2; + rc->Decode(rc, hiCnt, freqSum - hiCnt); + see->Summ = (UInt16)(see->Summ + freqSum); + do { MASK(ps[--i]->Symbol) = 0; } while (i != 0); + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd7Enc.c b/src/ZipLib/extlibs/lzma/unix/Ppmd7Enc.c new file mode 100644 index 00000000..8247757d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd7Enc.c @@ -0,0 +1,185 @@ +/* Ppmd7Enc.c -- PPMdH Encoder +2010-03-12 : Igor Pavlov : Public domain +This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ + +#include "Ppmd7.h" + +#define kTopValue (1 << 24) + +void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p) +{ + p->Low = 0; + p->Range = 0xFFFFFFFF; + p->Cache = 0; + p->CacheSize = 1; +} + +static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p) +{ + if ((UInt32)p->Low < (UInt32)0xFF000000 || (unsigned)(p->Low >> 32) != 0) + { + Byte temp = p->Cache; + do + { + p->Stream->Write(p->Stream, (Byte)(temp + (Byte)(p->Low >> 32))); + temp = 0xFF; + } + while(--p->CacheSize != 0); + p->Cache = (Byte)((UInt32)p->Low >> 24); + } + p->CacheSize++; + p->Low = (UInt32)p->Low << 8; +} + +static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total) +{ + p->Low += start * (p->Range /= total); + p->Range *= size; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void RangeEnc_EncodeBit_0(CPpmd7z_RangeEnc *p, UInt32 size0) +{ + p->Range = (p->Range >> 14) * size0; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +static void RangeEnc_EncodeBit_1(CPpmd7z_RangeEnc *p, UInt32 size0) +{ + UInt32 newBound = (p->Range >> 14) * size0; + p->Low += newBound; + p->Range -= newBound; + while (p->Range < kTopValue) + { + p->Range <<= 8; + RangeEnc_ShiftLow(p); + } +} + +void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p) +{ + unsigned i; + for (i = 0; i < 5; i++) + RangeEnc_ShiftLow(p); +} + + +#define MASK(sym) ((signed char *)charMask)[sym] + +void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 1) + { + CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext); + UInt32 sum; + unsigned i; + if (s->Symbol == symbol) + { + RangeEnc_Encode(rc, 0, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd7_Update1_0(p); + return; + } + p->PrevSuccess = 0; + sum = s->Freq; + i = p->MinContext->NumStats - 1; + do + { + if ((++s)->Symbol == symbol) + { + RangeEnc_Encode(rc, sum, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd7_Update1(p); + return; + } + sum += s->Freq; + } + while (--i); + + p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats - 1; + do { MASK((--s)->Symbol) = 0; } while (--i); + RangeEnc_Encode(rc, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq); + } + else + { + UInt16 *prob = Ppmd7_GetBinSumm(p); + CPpmd_State *s = Ppmd7Context_OneState(p->MinContext); + if (s->Symbol == symbol) + { + RangeEnc_EncodeBit_0(rc, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + p->FoundState = s; + Ppmd7_UpdateBin(p); + return; + } + else + { + RangeEnc_EncodeBit_1(rc, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD7_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + p->PrevSuccess = 0; + } + } + for (;;) + { + UInt32 escFreq; + CPpmd_See *see; + CPpmd_State *s; + UInt32 sum; + unsigned i, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return; /* EndMarker (symbol = -1) */ + p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + + see = Ppmd7_MakeEscFreq(p, numMasked, &escFreq); + s = Ppmd7_GetStats(p, p->MinContext); + sum = 0; + i = p->MinContext->NumStats; + do + { + int cur = s->Symbol; + if (cur == symbol) + { + UInt32 low = sum; + CPpmd_State *s1 = s; + do + { + sum += (s->Freq & (int)(MASK(s->Symbol))); + s++; + } + while (--i); + RangeEnc_Encode(rc, low, s1->Freq, sum + escFreq); + Ppmd_See_Update(see); + p->FoundState = s1; + Ppmd7_Update2(p); + return; + } + sum += (s->Freq & (int)(MASK(cur))); + MASK(cur) = 0; + s++; + } + while (--i); + + RangeEnc_Encode(rc, sum, escFreq, sum + escFreq); + see->Summ = (UInt16)(see->Summ + sum + escFreq); + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd8.c b/src/ZipLib/extlibs/lzma/unix/Ppmd8.c new file mode 100644 index 00000000..9187a88e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd8.c @@ -0,0 +1,1120 @@ +/* Ppmd8.c -- PPMdI codec +2010-03-24 : Igor Pavlov : Public domain +This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */ + +#include + +#include "Ppmd8.h" + +const Byte PPMD8_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 }; +static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051}; + +#define MAX_FREQ 124 +#define UNIT_SIZE 12 + +#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE) +#define U2I(nu) (p->Units2Indx[(nu) - 1]) +#define I2U(indx) (p->Indx2Units[indx]) + +#ifdef PPMD_32BIT + #define REF(ptr) (ptr) +#else + #define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base)) +#endif + +#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr)) + +#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref)) +#define STATS(ctx) Ppmd8_GetStats(p, ctx) +#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx) +#define SUFFIX(ctx) CTX((ctx)->Suffix) + +typedef CPpmd8_Context * CTX_PTR; + +struct CPpmd8_Node_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd8_Node_ * + #else + UInt32 + #endif + CPpmd8_Node_Ref; + +typedef struct CPpmd8_Node_ +{ + UInt32 Stamp; + CPpmd8_Node_Ref Next; + UInt32 NU; +} CPpmd8_Node; + +#ifdef PPMD_32BIT + #define NODE(ptr) (ptr) +#else + #define NODE(offs) ((CPpmd8_Node *)(p->Base + (offs))) +#endif + +#define EMPTY_NODE 0xFFFFFFFF + +void Ppmd8_Construct(CPpmd8 *p) +{ + unsigned i, k, m; + + p->Base = 0; + + for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) + { + unsigned step = (i >= 12 ? 4 : (i >> 2) + 1); + do { p->Units2Indx[k++] = (Byte)i; } while(--step); + p->Indx2Units[i] = (Byte)k; + } + + p->NS2BSIndx[0] = (0 << 1); + p->NS2BSIndx[1] = (1 << 1); + memset(p->NS2BSIndx + 2, (2 << 1), 9); + memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); + + for (i = 0; i < 5; i++) + p->NS2Indx[i] = (Byte)i; + for (m = i, k = 1; i < 260; i++) + { + p->NS2Indx[i] = (Byte)m; + if (--k == 0) + k = (++m) - 4; + } +} + +void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->Base); + p->Size = 0; + p->Base = 0; +} + +Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc) +{ + if (p->Base == 0 || p->Size != size) + { + Ppmd8_Free(p, alloc); + p->AlignOffset = + #ifdef PPMD_32BIT + (4 - size) & 3; + #else + 4 - (size & 3); + #endif + if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size)) == 0) + return False; + p->Size = size; + } + return True; +} + +static void InsertNode(CPpmd8 *p, void *node, unsigned indx) +{ + ((CPpmd8_Node *)node)->Stamp = EMPTY_NODE; + ((CPpmd8_Node *)node)->Next = (CPpmd8_Node_Ref)p->FreeList[indx]; + ((CPpmd8_Node *)node)->NU = I2U(indx); + p->FreeList[indx] = REF(node); + p->Stamps[indx]++; +} + +static void *RemoveNode(CPpmd8 *p, unsigned indx) +{ + CPpmd8_Node *node = NODE((CPpmd8_Node_Ref)p->FreeList[indx]); + p->FreeList[indx] = node->Next; + p->Stamps[indx]--; + return node; +} + +static void SplitBlock(CPpmd8 *p, void *ptr, unsigned oldIndx, unsigned newIndx) +{ + unsigned i, nu = I2U(oldIndx) - I2U(newIndx); + ptr = (Byte *)ptr + U2B(I2U(newIndx)); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1); + } + InsertNode(p, ptr, i); +} + +static void GlueFreeBlocks(CPpmd8 *p) +{ + CPpmd8_Node_Ref head = 0; + CPpmd8_Node_Ref *prev = &head; + unsigned i; + + p->GlueCount = 1 << 13; + memset(p->Stamps, 0, sizeof(p->Stamps)); + + /* Order-0 context is always at top UNIT, so we don't need guard NODE at the end. + All blocks up to p->LoUnit can be free, so we need guard NODE at LoUnit. */ + if (p->LoUnit != p->HiUnit) + ((CPpmd8_Node *)p->LoUnit)->Stamp = 0; + + /* Glue free blocks */ + for (i = 0; i < PPMD_NUM_INDEXES; i++) + { + CPpmd8_Node_Ref next = (CPpmd8_Node_Ref)p->FreeList[i]; + p->FreeList[i] = 0; + while (next != 0) + { + CPpmd8_Node *node = NODE(next); + if (node->NU != 0) + { + CPpmd8_Node *node2; + *prev = next; + prev = &(node->Next); + while ((node2 = node + node->NU)->Stamp == EMPTY_NODE) + { + node->NU += node2->NU; + node2->NU = 0; + } + } + next = node->Next; + } + } + *prev = 0; + + /* Fill lists of free blocks */ + while (head != 0) + { + CPpmd8_Node *node = NODE(head); + unsigned nu; + head = node->Next; + nu = node->NU; + if (nu == 0) + continue; + for (; nu > 128; nu -= 128, node += 128) + InsertNode(p, node, PPMD_NUM_INDEXES - 1); + if (I2U(i = U2I(nu)) != nu) + { + unsigned k = I2U(--i); + InsertNode(p, node + k, nu - k - 1); + } + InsertNode(p, node, i); + } +} + +static void *AllocUnitsRare(CPpmd8 *p, unsigned indx) +{ + unsigned i; + void *retVal; + if (p->GlueCount == 0) + { + GlueFreeBlocks(p); + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + } + i = indx; + do + { + if (++i == PPMD_NUM_INDEXES) + { + UInt32 numBytes = U2B(I2U(indx)); + p->GlueCount--; + return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL); + } + } + while (p->FreeList[i] == 0); + retVal = RemoveNode(p, i); + SplitBlock(p, retVal, i, indx); + return retVal; +} + +static void *AllocUnits(CPpmd8 *p, unsigned indx) +{ + UInt32 numBytes; + if (p->FreeList[indx] != 0) + return RemoveNode(p, indx); + numBytes = U2B(I2U(indx)); + if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit)) + { + void *retVal = p->LoUnit; + p->LoUnit += numBytes; + return retVal; + } + return AllocUnitsRare(p, indx); +} + +#define MyMem12Cpy(dest, src, num) \ + { UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \ + do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while(--n); } + +static void *ShrinkUnits(CPpmd8 *p, void *oldPtr, unsigned oldNU, unsigned newNU) +{ + unsigned i0 = U2I(oldNU); + unsigned i1 = U2I(newNU); + if (i0 == i1) + return oldPtr; + if (p->FreeList[i1] != 0) + { + void *ptr = RemoveNode(p, i1); + MyMem12Cpy(ptr, oldPtr, newNU); + InsertNode(p, oldPtr, i0); + return ptr; + } + SplitBlock(p, oldPtr, i0, i1); + return oldPtr; +} + +static void FreeUnits(CPpmd8 *p, void *ptr, unsigned nu) +{ + InsertNode(p, ptr, U2I(nu)); +} + +static void SpecialFreeUnit(CPpmd8 *p, void *ptr) +{ + if ((Byte *)ptr != p->UnitsStart) + InsertNode(p, ptr, 0); + else + { + #ifdef PPMD8_FREEZE_SUPPORT + *(UInt32 *)ptr = EMPTY_NODE; /* it's used for (Flags == 0xFF) check in RemoveBinContexts */ + #endif + p->UnitsStart += UNIT_SIZE; + } +} + +static void *MoveUnitsUp(CPpmd8 *p, void *oldPtr, unsigned nu) +{ + unsigned indx = U2I(nu); + void *ptr; + if ((Byte *)oldPtr > p->UnitsStart + 16 * 1024 || REF(oldPtr) > p->FreeList[indx]) + return oldPtr; + ptr = RemoveNode(p, indx); + MyMem12Cpy(ptr, oldPtr, nu); + if ((Byte*)oldPtr != p->UnitsStart) + InsertNode(p, oldPtr, indx); + else + p->UnitsStart += U2B(I2U(indx)); + return ptr; +} + +static void ExpandTextArea(CPpmd8 *p) +{ + UInt32 count[PPMD_NUM_INDEXES]; + unsigned i; + memset(count, 0, sizeof(count)); + if (p->LoUnit != p->HiUnit) + ((CPpmd8_Node *)p->LoUnit)->Stamp = 0; + + { + CPpmd8_Node *node = (CPpmd8_Node *)p->UnitsStart; + for (; node->Stamp == EMPTY_NODE; node += node->NU) + { + node->Stamp = 0; + count[U2I(node->NU)]++; + } + p->UnitsStart = (Byte *)node; + } + + for (i = 0; i < PPMD_NUM_INDEXES; i++) + { + CPpmd8_Node_Ref *next = (CPpmd8_Node_Ref *)&p->FreeList[i]; + while (count[i] != 0) + { + CPpmd8_Node *node = NODE(*next); + while (node->Stamp == 0) + { + *next = node->Next; + node = NODE(*next); + p->Stamps[i]--; + if (--count[i] == 0) + break; + } + next = &node->Next; + } + } +} + +#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16))) + +static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v) +{ + (p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF); + (p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF); +} + +#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); } + +static void RestartModel(CPpmd8 *p) +{ + unsigned i, k, m, r; + + memset(p->FreeList, 0, sizeof(p->FreeList)); + memset(p->Stamps, 0, sizeof(p->Stamps)); + RESET_TEXT(0); + p->HiUnit = p->Text + p->Size; + p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE; + p->GlueCount = 0; + + p->OrderFall = p->MaxOrder; + p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1; + p->PrevSuccess = 0; + + p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */ + p->MinContext->Suffix = 0; + p->MinContext->NumStats = 255; + p->MinContext->Flags = 0; + p->MinContext->SummFreq = 256 + 1; + p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */ + p->LoUnit += U2B(256 / 2); + p->MinContext->Stats = REF(p->FoundState); + for (i = 0; i < 256; i++) + { + CPpmd_State *s = &p->FoundState[i]; + s->Symbol = (Byte)i; + s->Freq = 1; + SetSuccessor(s, 0); + } + + for (i = m = 0; m < 25; m++) + { + while (p->NS2Indx[i] == m) + i++; + for (k = 0; k < 8; k++) + { + UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 1)); + UInt16 *dest = p->BinSumm[m] + k; + for (r = 0; r < 64; r += 8) + dest[r] = val; + } + } + + for (i = m = 0; m < 24; m++) + { + while (p->NS2Indx[i + 3] == m + 3) + i++; + for (k = 0; k < 32; k++) + { + CPpmd_See *s = &p->See[m][k]; + s->Summ = (UInt16)((2 * i + 5) << (s->Shift = PPMD_PERIOD_BITS - 4)); + s->Count = 7; + } + } +} + +void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod) +{ + p->MaxOrder = maxOrder; + p->RestoreMethod = restoreMethod; + RestartModel(p); + p->DummySee.Shift = PPMD_PERIOD_BITS; + p->DummySee.Summ = 0; /* unused */ + p->DummySee.Count = 64; /* unused */ +} + +static void Refresh(CPpmd8 *p, CTX_PTR ctx, unsigned oldNU, unsigned scale) +{ + unsigned i = ctx->NumStats, escFreq, sumFreq, flags; + CPpmd_State *s = (CPpmd_State *)ShrinkUnits(p, STATS(ctx), oldNU, (i + 2) >> 1); + ctx->Stats = REF(s); + #ifdef PPMD8_FREEZE_SUPPORT + /* fixed over Shkarin's code. Fixed code is not compatible with original code for some files in FREEZE mode. */ + scale |= (ctx->SummFreq >= ((UInt32)1 << 15)); + #endif + flags = (ctx->Flags & (0x10 + 0x04 * scale)) + 0x08 * (s->Symbol >= 0x40); + escFreq = ctx->SummFreq - s->Freq; + sumFreq = (s->Freq = (Byte)((s->Freq + scale) >> scale)); + do + { + escFreq -= (++s)->Freq; + sumFreq += (s->Freq = (Byte)((s->Freq + scale) >> scale)); + flags |= 0x08 * (s->Symbol >= 0x40); + } + while (--i); + ctx->SummFreq = (UInt16)(sumFreq + ((escFreq + scale) >> scale)); + ctx->Flags = (Byte)flags; +} + +static void SwapStates(CPpmd_State *t1, CPpmd_State *t2) +{ + CPpmd_State tmp = *t1; + *t1 = *t2; + *t2 = tmp; +} + +static CPpmd_Void_Ref CutOff(CPpmd8 *p, CTX_PTR ctx, unsigned order) +{ + int i; + unsigned tmp; + CPpmd_State *s; + + if (!ctx->NumStats) + { + s = ONE_STATE(ctx); + if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart) + { + if (order < p->MaxOrder) + SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1)); + else + SetSuccessor(s, 0); + if (SUCCESSOR(s) || order <= 9) /* O_BOUND */ + return REF(ctx); + } + SpecialFreeUnit(p, ctx); + return 0; + } + + ctx->Stats = STATS_REF(MoveUnitsUp(p, STATS(ctx), tmp = ((unsigned)ctx->NumStats + 2) >> 1)); + + for (s = STATS(ctx) + (i = ctx->NumStats); s >= STATS(ctx); s--) + if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) < p->UnitsStart) + { + CPpmd_State *s2 = STATS(ctx) + (i--); + SetSuccessor(s, 0); + SwapStates(s, s2); + } + else if (order < p->MaxOrder) + SetSuccessor(s, CutOff(p, CTX(SUCCESSOR(s)), order + 1)); + else + SetSuccessor(s, 0); + + if (i != ctx->NumStats && order) + { + ctx->NumStats = (Byte)i; + s = STATS(ctx); + if (i < 0) + { + FreeUnits(p, s, tmp); + SpecialFreeUnit(p, ctx); + return 0; + } + if (i == 0) + { + ctx->Flags = (ctx->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40); + *ONE_STATE(ctx) = *s; + FreeUnits(p, s, tmp); + ONE_STATE(ctx)->Freq = (Byte)((unsigned)ONE_STATE(ctx)->Freq + 11) >> 3; + } + else + Refresh(p, ctx, tmp, ctx->SummFreq > 16 * i); + } + return REF(ctx); +} + +#ifdef PPMD8_FREEZE_SUPPORT +static CPpmd_Void_Ref RemoveBinContexts(CPpmd8 *p, CTX_PTR ctx, unsigned order) +{ + CPpmd_State *s; + if (!ctx->NumStats) + { + s = ONE_STATE(ctx); + if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder) + SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1)); + else + SetSuccessor(s, 0); + /* Suffix context can be removed already, since different (high-order) + Successors may refer to same context. So we check Flags == 0xFF (Stamp == EMPTY_NODE) */ + if (!SUCCESSOR(s) && (!SUFFIX(ctx)->NumStats || SUFFIX(ctx)->Flags == 0xFF)) + { + FreeUnits(p, ctx, 1); + return 0; + } + else + return REF(ctx); + } + + for (s = STATS(ctx) + ctx->NumStats; s >= STATS(ctx); s--) + if ((Byte *)Ppmd8_GetPtr(p, SUCCESSOR(s)) >= p->UnitsStart && order < p->MaxOrder) + SetSuccessor(s, RemoveBinContexts(p, CTX(SUCCESSOR(s)), order + 1)); + else + SetSuccessor(s, 0); + + return REF(ctx); +} +#endif + +static UInt32 GetUsedMemory(const CPpmd8 *p) +{ + UInt32 v = 0; + unsigned i; + for (i = 0; i < PPMD_NUM_INDEXES; i++) + v += p->Stamps[i] * I2U(i); + return p->Size - (UInt32)(p->HiUnit - p->LoUnit) - (UInt32)(p->UnitsStart - p->Text) - U2B(v); +} + +#ifdef PPMD8_FREEZE_SUPPORT + #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1, fSuccessor) +#else + #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1) +#endif + +static void RestoreModel(CPpmd8 *p, CTX_PTR c1 + #ifdef PPMD8_FREEZE_SUPPORT + , CTX_PTR fSuccessor + #endif + ) +{ + CTX_PTR c; + CPpmd_State *s; + RESET_TEXT(0); + for (c = p->MaxContext; c != c1; c = SUFFIX(c)) + if (--(c->NumStats) == 0) + { + s = STATS(c); + c->Flags = (c->Flags & 0x10) + 0x08 * (s->Symbol >= 0x40); + *ONE_STATE(c) = *s; + SpecialFreeUnit(p, s); + ONE_STATE(c)->Freq = (ONE_STATE(c)->Freq + 11) >> 3; + } + else + Refresh(p, c, (c->NumStats+3) >> 1, 0); + + for (; c != p->MinContext; c = SUFFIX(c)) + if (!c->NumStats) + ONE_STATE(c)->Freq -= ONE_STATE(c)->Freq >> 1; + else if ((c->SummFreq += 4) > 128 + 4 * c->NumStats) + Refresh(p, c, (c->NumStats + 2) >> 1, 1); + + #ifdef PPMD8_FREEZE_SUPPORT + if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) + { + p->MaxContext = fSuccessor; + p->GlueCount += !(p->Stamps[1] & 1); + } + else if (p->RestoreMethod == PPMD8_RESTORE_METHOD_FREEZE) + { + while (p->MaxContext->Suffix) + p->MaxContext = SUFFIX(p->MaxContext); + RemoveBinContexts(p, p->MaxContext, 0); + p->RestoreMethod++; + p->GlueCount = 0; + p->OrderFall = p->MaxOrder; + } + else + #endif + if (p->RestoreMethod == PPMD8_RESTORE_METHOD_RESTART || GetUsedMemory(p) < (p->Size >> 1)) + RestartModel(p); + else + { + while (p->MaxContext->Suffix) + p->MaxContext = SUFFIX(p->MaxContext); + do + { + CutOff(p, p->MaxContext, 0); + ExpandTextArea(p); + } + while (GetUsedMemory(p) > 3 * (p->Size >> 2)); + p->GlueCount = 0; + p->OrderFall = p->MaxOrder; + } +} + +static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c) +{ + CPpmd_State upState; + Byte flags; + CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState); + /* fixed over Shkarin's code. Maybe it could work without + 1 too. */ + CPpmd_State *ps[PPMD8_MAX_ORDER + 1]; + unsigned numPs = 0; + + if (!skip) + ps[numPs++] = p->FoundState; + + while (c->Suffix) + { + CPpmd_Void_Ref successor; + CPpmd_State *s; + c = SUFFIX(c); + if (s1) + { + s = s1; + s1 = NULL; + } + else if (c->NumStats != 0) + { + for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++); + if (s->Freq < MAX_FREQ - 9) + { + s->Freq++; + c->SummFreq++; + } + } + else + { + s = ONE_STATE(c); + s->Freq += (!SUFFIX(c)->NumStats & (s->Freq < 24)); + } + successor = SUCCESSOR(s); + if (successor != upBranch) + { + c = CTX(successor); + if (numPs == 0) + return c; + break; + } + ps[numPs++] = s; + } + + upState.Symbol = *(const Byte *)Ppmd8_GetPtr(p, upBranch); + SetSuccessor(&upState, upBranch + 1); + flags = 0x10 * (p->FoundState->Symbol >= 0x40) + 0x08 * (upState.Symbol >= 0x40); + + if (c->NumStats == 0) + upState.Freq = ONE_STATE(c)->Freq; + else + { + UInt32 cf, s0; + CPpmd_State *s; + for (s = STATS(c); s->Symbol != upState.Symbol; s++); + cf = s->Freq - 1; + s0 = c->SummFreq - c->NumStats - cf; + upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0))); + } + + do + { + /* Create Child */ + CTX_PTR c1; /* = AllocContext(p); */ + if (p->HiUnit != p->LoUnit) + c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); + else if (p->FreeList[0] != 0) + c1 = (CTX_PTR)RemoveNode(p, 0); + else + { + c1 = (CTX_PTR)AllocUnitsRare(p, 0); + if (!c1) + return NULL; + } + c1->NumStats = 0; + c1->Flags = flags; + *ONE_STATE(c1) = upState; + c1->Suffix = REF(c); + SetSuccessor(ps[--numPs], REF(c1)); + c = c1; + } + while (numPs != 0); + + return c; +} + +static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c) +{ + CPpmd_State *s = NULL; + CTX_PTR c1 = c; + CPpmd_Void_Ref upBranch = REF(p->Text); + + #ifdef PPMD8_FREEZE_SUPPORT + /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */ + CPpmd_State *ps[PPMD8_MAX_ORDER + 1]; + unsigned numPs = 0; + ps[numPs++] = p->FoundState; + #endif + + SetSuccessor(p->FoundState, upBranch); + p->OrderFall++; + + for (;;) + { + if (s1) + { + c = SUFFIX(c); + s = s1; + s1 = NULL; + } + else + { + if (!c->Suffix) + { + #ifdef PPMD8_FREEZE_SUPPORT + if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) + { + do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); + RESET_TEXT(1); + p->OrderFall = 1; + } + #endif + return c; + } + c = SUFFIX(c); + if (c->NumStats) + { + if ((s = STATS(c))->Symbol != p->FoundState->Symbol) + do { s++; } while (s->Symbol != p->FoundState->Symbol); + if (s->Freq < MAX_FREQ - 9) + { + s->Freq += 2; + c->SummFreq += 2; + } + } + else + { + s = ONE_STATE(c); + s->Freq += (s->Freq < 32); + } + } + if (SUCCESSOR(s)) + break; + #ifdef PPMD8_FREEZE_SUPPORT + ps[numPs++] = s; + #endif + SetSuccessor(s, upBranch); + p->OrderFall++; + } + + #ifdef PPMD8_FREEZE_SUPPORT + if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) + { + c = CTX(SUCCESSOR(s)); + do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs); + RESET_TEXT(1); + p->OrderFall = 1; + return c; + } + else + #endif + if (SUCCESSOR(s) <= upBranch) + { + CTX_PTR successor; + CPpmd_State *s1 = p->FoundState; + p->FoundState = s; + + successor = CreateSuccessors(p, False, NULL, c); + if (successor == NULL) + SetSuccessor(s, 0); + else + SetSuccessor(s, REF(successor)); + p->FoundState = s1; + } + + if (p->OrderFall == 1 && c1 == p->MaxContext) + { + SetSuccessor(p->FoundState, SUCCESSOR(s)); + p->Text--; + } + if (SUCCESSOR(s) == 0) + return NULL; + return CTX(SUCCESSOR(s)); +} + +static void UpdateModel(CPpmd8 *p) +{ + CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState); + CTX_PTR c; + unsigned s0, ns, fFreq = p->FoundState->Freq; + Byte flag, fSymbol = p->FoundState->Symbol; + CPpmd_State *s = NULL; + + if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0) + { + c = SUFFIX(p->MinContext); + + if (c->NumStats == 0) + { + s = ONE_STATE(c); + if (s->Freq < 32) + s->Freq++; + } + else + { + s = STATS(c); + if (s->Symbol != p->FoundState->Symbol) + { + do { s++; } while (s->Symbol != p->FoundState->Symbol); + if (s[0].Freq >= s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + s--; + } + } + if (s->Freq < MAX_FREQ - 9) + { + s->Freq += 2; + c->SummFreq += 2; + } + } + } + + c = p->MaxContext; + if (p->OrderFall == 0 && fSuccessor) + { + CTX_PTR cs = CreateSuccessors(p, True, s, p->MinContext); + if (cs == 0) + { + SetSuccessor(p->FoundState, 0); + RESTORE_MODEL(c, CTX(fSuccessor)); + } + else + { + SetSuccessor(p->FoundState, REF(cs)); + p->MaxContext = cs; + } + return; + } + + *p->Text++ = p->FoundState->Symbol; + successor = REF(p->Text); + if (p->Text >= p->UnitsStart) + { + RESTORE_MODEL(c, CTX(fSuccessor)); /* check it */ + return; + } + + if (!fSuccessor) + { + CTX_PTR cs = ReduceOrder(p, s, p->MinContext); + if (cs == NULL) + { + RESTORE_MODEL(c, 0); + return; + } + fSuccessor = REF(cs); + } + else if ((Byte *)Ppmd8_GetPtr(p, fSuccessor) < p->UnitsStart) + { + CTX_PTR cs = CreateSuccessors(p, False, s, p->MinContext); + if (cs == NULL) + { + RESTORE_MODEL(c, 0); + return; + } + fSuccessor = REF(cs); + } + + if (--p->OrderFall == 0) + { + successor = fSuccessor; + p->Text -= (p->MaxContext != p->MinContext); + } + #ifdef PPMD8_FREEZE_SUPPORT + else if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE) + { + successor = fSuccessor; + RESET_TEXT(0); + p->OrderFall = 0; + } + #endif + + s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - fFreq; + flag = 0x08 * (fSymbol >= 0x40); + + for (; c != p->MinContext; c = SUFFIX(c)) + { + unsigned ns1; + UInt32 cf, sf; + if ((ns1 = c->NumStats) != 0) + { + if ((ns1 & 1) != 0) + { + /* Expand for one UNIT */ + unsigned oldNU = (ns1 + 1) >> 1; + unsigned i = U2I(oldNU); + if (i != U2I(oldNU + 1)) + { + void *ptr = AllocUnits(p, i + 1); + void *oldPtr; + if (!ptr) + { + RESTORE_MODEL(c, CTX(fSuccessor)); + return; + } + oldPtr = STATS(c); + MyMem12Cpy(ptr, oldPtr, oldNU); + InsertNode(p, oldPtr, i); + c->Stats = STATS_REF(ptr); + } + } + c->SummFreq = (UInt16)(c->SummFreq + (3 * ns1 + 1 < ns)); + } + else + { + CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0); + if (!s) + { + RESTORE_MODEL(c, CTX(fSuccessor)); + return; + } + *s = *ONE_STATE(c); + c->Stats = REF(s); + if (s->Freq < MAX_FREQ / 4 - 1) + s->Freq <<= 1; + else + s->Freq = MAX_FREQ - 4; + c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 2)); + } + cf = 2 * fFreq * (c->SummFreq + 6); + sf = (UInt32)s0 + c->SummFreq; + if (cf < 6 * sf) + { + cf = 1 + (cf > sf) + (cf >= 4 * sf); + c->SummFreq += 4; + } + else + { + cf = 4 + (cf > 9 * sf) + (cf > 12 * sf) + (cf > 15 * sf); + c->SummFreq = (UInt16)(c->SummFreq + cf); + } + { + CPpmd_State *s = STATS(c) + ns1 + 1; + SetSuccessor(s, successor); + s->Symbol = fSymbol; + s->Freq = (Byte)cf; + c->Flags |= flag; + c->NumStats = (Byte)(ns1 + 1); + } + } + p->MaxContext = p->MinContext = CTX(fSuccessor); +} + +static void Rescale(CPpmd8 *p) +{ + unsigned i, adder, sumFreq, escFreq; + CPpmd_State *stats = STATS(p->MinContext); + CPpmd_State *s = p->FoundState; + { + CPpmd_State tmp = *s; + for (; s != stats; s--) + s[0] = s[-1]; + *s = tmp; + } + escFreq = p->MinContext->SummFreq - s->Freq; + s->Freq += 4; + adder = (p->OrderFall != 0 + #ifdef PPMD8_FREEZE_SUPPORT + || p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE + #endif + ); + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq = s->Freq; + + i = p->MinContext->NumStats; + do + { + escFreq -= (++s)->Freq; + s->Freq = (Byte)((s->Freq + adder) >> 1); + sumFreq += s->Freq; + if (s[0].Freq > s[-1].Freq) + { + CPpmd_State *s1 = s; + CPpmd_State tmp = *s1; + do + s1[0] = s1[-1]; + while (--s1 != stats && tmp.Freq > s1[-1].Freq); + *s1 = tmp; + } + } + while (--i); + + if (s->Freq == 0) + { + unsigned numStats = p->MinContext->NumStats; + unsigned n0, n1; + do { i++; } while ((--s)->Freq == 0); + escFreq += i; + p->MinContext->NumStats = (Byte)(p->MinContext->NumStats - i); + if (p->MinContext->NumStats == 0) + { + CPpmd_State tmp = *stats; + tmp.Freq = (Byte)((2 * tmp.Freq + escFreq - 1) / escFreq); + if (tmp.Freq > MAX_FREQ / 3) + tmp.Freq = MAX_FREQ / 3; + InsertNode(p, stats, U2I((numStats + 2) >> 1)); + p->MinContext->Flags = (p->MinContext->Flags & 0x10) + 0x08 * (tmp.Symbol >= 0x40); + *(p->FoundState = ONE_STATE(p->MinContext)) = tmp; + return; + } + n0 = (numStats + 2) >> 1; + n1 = (p->MinContext->NumStats + 2) >> 1; + if (n0 != n1) + p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1)); + p->MinContext->Flags &= ~0x08; + p->MinContext->Flags |= 0x08 * ((s = STATS(p->MinContext))->Symbol >= 0x40); + i = p->MinContext->NumStats; + do { p->MinContext->Flags |= 0x08*((++s)->Symbol >= 0x40); } while (--i); + } + p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1)); + p->MinContext->Flags |= 0x4; + p->FoundState = STATS(p->MinContext); +} + +CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked1, UInt32 *escFreq) +{ + CPpmd_See *see; + if (p->MinContext->NumStats != 0xFF) + { + see = p->See[p->NS2Indx[p->MinContext->NumStats + 2] - 3] + + (p->MinContext->SummFreq > 11 * ((unsigned)p->MinContext->NumStats + 1)) + + 2 * (2 * (unsigned)p->MinContext->NumStats < + ((unsigned)SUFFIX(p->MinContext)->NumStats + numMasked1)) + + p->MinContext->Flags; + { + unsigned r = (see->Summ >> see->Shift); + see->Summ = (UInt16)(see->Summ - r); + *escFreq = r + (r == 0); + } + } + else + { + see = &p->DummySee; + *escFreq = 1; + } + return see; +} + +static void NextContext(CPpmd8 *p) +{ + CTX_PTR c = CTX(SUCCESSOR(p->FoundState)); + if (p->OrderFall == 0 && (Byte *)c >= p->UnitsStart) + p->MinContext = p->MaxContext = c; + else + { + UpdateModel(p); + p->MinContext = p->MaxContext; + } +} + +void Ppmd8_Update1(CPpmd8 *p) +{ + CPpmd_State *s = p->FoundState; + s->Freq += 4; + p->MinContext->SummFreq += 4; + if (s[0].Freq > s[-1].Freq) + { + SwapStates(&s[0], &s[-1]); + p->FoundState = --s; + if (s->Freq > MAX_FREQ) + Rescale(p); + } + NextContext(p); +} + +void Ppmd8_Update1_0(CPpmd8 *p) +{ + p->PrevSuccess = (2 * p->FoundState->Freq >= p->MinContext->SummFreq); + p->RunLength += p->PrevSuccess; + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + NextContext(p); +} + +void Ppmd8_UpdateBin(CPpmd8 *p) +{ + p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 196)); + p->PrevSuccess = 1; + p->RunLength++; + NextContext(p); +} + +void Ppmd8_Update2(CPpmd8 *p) +{ + p->MinContext->SummFreq += 4; + if ((p->FoundState->Freq += 4) > MAX_FREQ) + Rescale(p); + p->RunLength = p->InitRL; + UpdateModel(p); + p->MinContext = p->MaxContext; +} + +/* H->I changes: + NS2Indx + GlewCount, and Glue method + BinSum + See / EscFreq + CreateSuccessors updates more suffix contexts + UpdateModel consts. + PrevSuccess Update +*/ diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd8.h b/src/ZipLib/extlibs/lzma/unix/Ppmd8.h new file mode 100644 index 00000000..870dc9dd --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd8.h @@ -0,0 +1,133 @@ +/* Ppmd8.h -- PPMdI codec +2010-03-24 : Igor Pavlov : Public domain +This code is based on: + PPMd var.I (2002): Dmitry Shkarin : Public domain + Carryless rangecoder (1999): Dmitry Subbotin : Public domain */ + +#ifndef __PPMD8_H +#define __PPMD8_H + +#include "Ppmd.h" + +EXTERN_C_BEGIN + +#define PPMD8_MIN_ORDER 2 +#define PPMD8_MAX_ORDER 16 + +struct CPpmd8_Context_; + +typedef + #ifdef PPMD_32BIT + struct CPpmd8_Context_ * + #else + UInt32 + #endif + CPpmd8_Context_Ref; + +typedef struct CPpmd8_Context_ +{ + Byte NumStats; + Byte Flags; + UInt16 SummFreq; + CPpmd_State_Ref Stats; + CPpmd8_Context_Ref Suffix; +} CPpmd8_Context; + +#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) + +/* The BUG in Shkarin's code for FREEZE mode was fixed, but that fixed + code is not compatible with original code for some files compressed + in FREEZE mode. So we disable FREEZE mode support. */ + +enum +{ + PPMD8_RESTORE_METHOD_RESTART, + PPMD8_RESTORE_METHOD_CUT_OFF + #ifdef PPMD8_FREEZE_SUPPORT + , PPMD8_RESTORE_METHOD_FREEZE + #endif +}; + +typedef struct +{ + CPpmd8_Context *MinContext, *MaxContext; + CPpmd_State *FoundState; + unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder; + Int32 RunLength, InitRL; /* must be 32-bit at least */ + + UInt32 Size; + UInt32 GlueCount; + Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; + UInt32 AlignOffset; + unsigned RestoreMethod; + + /* Range Coder */ + UInt32 Range; + UInt32 Code; + UInt32 Low; + union + { + IByteIn *In; + IByteOut *Out; + } Stream; + + Byte Indx2Units[PPMD_NUM_INDEXES]; + Byte Units2Indx[128]; + CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; + UInt32 Stamps[PPMD_NUM_INDEXES]; + + Byte NS2BSIndx[256], NS2Indx[260]; + CPpmd_See DummySee, See[24][32]; + UInt16 BinSumm[25][64]; +} CPpmd8; + +void Ppmd8_Construct(CPpmd8 *p); +Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc); +void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc); +void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod); +#define Ppmd8_WasAllocated(p) ((p)->Base != NULL) + + +/* ---------- Internal Functions ---------- */ + +extern const Byte PPMD8_kExpEscape[16]; + +#ifdef PPMD_32BIT + #define Ppmd8_GetPtr(p, ptr) (ptr) + #define Ppmd8_GetContext(p, ptr) (ptr) + #define Ppmd8_GetStats(p, ctx) ((ctx)->Stats) +#else + #define Ppmd8_GetPtr(p, offs) ((void *)((p)->Base + (offs))) + #define Ppmd8_GetContext(p, offs) ((CPpmd8_Context *)Ppmd8_GetPtr((p), (offs))) + #define Ppmd8_GetStats(p, ctx) ((CPpmd_State *)Ppmd8_GetPtr((p), ((ctx)->Stats))) +#endif + +void Ppmd8_Update1(CPpmd8 *p); +void Ppmd8_Update1_0(CPpmd8 *p); +void Ppmd8_Update2(CPpmd8 *p); +void Ppmd8_UpdateBin(CPpmd8 *p); + +#define Ppmd8_GetBinSumm(p) \ + &p->BinSumm[p->NS2Indx[Ppmd8Context_OneState(p->MinContext)->Freq - 1]][ \ + p->NS2BSIndx[Ppmd8_GetContext(p, p->MinContext->Suffix)->NumStats] + \ + p->PrevSuccess + p->MinContext->Flags + ((p->RunLength >> 26) & 0x20)] + +CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked, UInt32 *scale); + + +/* ---------- Decode ---------- */ + +Bool Ppmd8_RangeDec_Init(CPpmd8 *p); +#define Ppmd8_RangeDec_IsFinishedOK(p) ((p)->Code == 0) +int Ppmd8_DecodeSymbol(CPpmd8 *p); /* returns: -1 as EndMarker, -2 as DataError */ + + +/* ---------- Encode ---------- */ + +#define Ppmd8_RangeEnc_Init(p) { (p)->Low = 0; (p)->Range = 0xFFFFFFFF; } +void Ppmd8_RangeEnc_FlushData(CPpmd8 *p); +void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol); /* symbol = -1 means EndMarker */ + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd8Dec.c b/src/ZipLib/extlibs/lzma/unix/Ppmd8Dec.c new file mode 100644 index 00000000..c54e02ab --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd8Dec.c @@ -0,0 +1,155 @@ +/* Ppmd8Dec.c -- PPMdI Decoder +2010-04-16 : Igor Pavlov : Public domain +This code is based on: + PPMd var.I (2002): Dmitry Shkarin : Public domain + Carryless rangecoder (1999): Dmitry Subbotin : Public domain */ + +#include "Ppmd8.h" + +#define kTop (1 << 24) +#define kBot (1 << 15) + +Bool Ppmd8_RangeDec_Init(CPpmd8 *p) +{ + unsigned i; + p->Low = 0; + p->Range = 0xFFFFFFFF; + p->Code = 0; + for (i = 0; i < 4; i++) + p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In); + return (p->Code < 0xFFFFFFFF); +} + +static UInt32 RangeDec_GetThreshold(CPpmd8 *p, UInt32 total) +{ + return p->Code / (p->Range /= total); +} + +static void RangeDec_Decode(CPpmd8 *p, UInt32 start, UInt32 size) +{ + start *= p->Range; + p->Low += start; + p->Code -= start; + p->Range *= size; + + while ((p->Low ^ (p->Low + p->Range)) < kTop || + (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) + { + p->Code = (p->Code << 8) | p->Stream.In->Read(p->Stream.In); + p->Range <<= 8; + p->Low <<= 8; + } +} + +#define MASK(sym) ((signed char *)charMask)[sym] + +int Ppmd8_DecodeSymbol(CPpmd8 *p) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 0) + { + CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext); + unsigned i; + UInt32 count, hiCnt; + if ((count = RangeDec_GetThreshold(p, p->MinContext->SummFreq)) < (hiCnt = s->Freq)) + { + Byte symbol; + RangeDec_Decode(p, 0, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd8_Update1_0(p); + return symbol; + } + p->PrevSuccess = 0; + i = p->MinContext->NumStats; + do + { + if ((hiCnt += (++s)->Freq) > count) + { + Byte symbol; + RangeDec_Decode(p, hiCnt - s->Freq, s->Freq); + p->FoundState = s; + symbol = s->Symbol; + Ppmd8_Update1(p); + return symbol; + } + } + while (--i); + if (count >= p->MinContext->SummFreq) + return -2; + RangeDec_Decode(p, hiCnt, p->MinContext->SummFreq - hiCnt); + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats; + do { MASK((--s)->Symbol) = 0; } while (--i); + } + else + { + UInt16 *prob = Ppmd8_GetBinSumm(p); + if (((p->Code / (p->Range >>= 14)) < *prob)) + { + Byte symbol; + RangeDec_Decode(p, 0, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + symbol = (p->FoundState = Ppmd8Context_OneState(p->MinContext))->Symbol; + Ppmd8_UpdateBin(p); + return symbol; + } + RangeDec_Decode(p, *prob, (1 << 14) - *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD8_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(Ppmd8Context_OneState(p->MinContext)->Symbol) = 0; + p->PrevSuccess = 0; + } + for (;;) + { + CPpmd_State *ps[256], *s; + UInt32 freqSum, count, hiCnt; + CPpmd_See *see; + unsigned i, num, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return -1; + p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + hiCnt = 0; + s = Ppmd8_GetStats(p, p->MinContext); + i = 0; + num = p->MinContext->NumStats - numMasked; + do + { + int k = (int)(MASK(s->Symbol)); + hiCnt += (s->Freq & k); + ps[i] = s++; + i -= k; + } + while (i != num); + + see = Ppmd8_MakeEscFreq(p, numMasked, &freqSum); + freqSum += hiCnt; + count = RangeDec_GetThreshold(p, freqSum); + + if (count < hiCnt) + { + Byte symbol; + CPpmd_State **pps = ps; + for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++); + s = *pps; + RangeDec_Decode(p, hiCnt - s->Freq, s->Freq); + Ppmd_See_Update(see); + p->FoundState = s; + symbol = s->Symbol; + Ppmd8_Update2(p); + return symbol; + } + if (count >= freqSum) + return -2; + RangeDec_Decode(p, hiCnt, freqSum - hiCnt); + see->Summ = (UInt16)(see->Summ + freqSum); + do { MASK(ps[--i]->Symbol) = 0; } while (i != 0); + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/Ppmd8Enc.c b/src/ZipLib/extlibs/lzma/unix/Ppmd8Enc.c new file mode 100644 index 00000000..8da727eb --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Ppmd8Enc.c @@ -0,0 +1,161 @@ +/* Ppmd8Enc.c -- PPMdI Encoder +2010-04-16 : Igor Pavlov : Public domain +This code is based on: + PPMd var.I (2002): Dmitry Shkarin : Public domain + Carryless rangecoder (1999): Dmitry Subbotin : Public domain */ + +#include "Ppmd8.h" + +#define kTop (1 << 24) +#define kBot (1 << 15) + +void Ppmd8_RangeEnc_FlushData(CPpmd8 *p) +{ + unsigned i; + for (i = 0; i < 4; i++, p->Low <<= 8 ) + p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24)); +} + +static void RangeEnc_Normalize(CPpmd8 *p) +{ + while ((p->Low ^ (p->Low + p->Range)) < kTop || + (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) + { + p->Stream.Out->Write(p->Stream.Out, (Byte)(p->Low >> 24)); + p->Range <<= 8; + p->Low <<= 8; + } +} + +static void RangeEnc_Encode(CPpmd8 *p, UInt32 start, UInt32 size, UInt32 total) +{ + p->Low += start * (p->Range /= total); + p->Range *= size; + RangeEnc_Normalize(p); +} + +static void RangeEnc_EncodeBit_0(CPpmd8 *p, UInt32 size0) +{ + p->Range >>= 14; + p->Range *= size0; + RangeEnc_Normalize(p); +} + +static void RangeEnc_EncodeBit_1(CPpmd8 *p, UInt32 size0) +{ + p->Low += size0 * (p->Range >>= 14); + p->Range *= ((1 << 14) - size0); + RangeEnc_Normalize(p); +} + + +#define MASK(sym) ((signed char *)charMask)[sym] + +void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol) +{ + size_t charMask[256 / sizeof(size_t)]; + if (p->MinContext->NumStats != 0) + { + CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext); + UInt32 sum; + unsigned i; + if (s->Symbol == symbol) + { + RangeEnc_Encode(p, 0, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd8_Update1_0(p); + return; + } + p->PrevSuccess = 0; + sum = s->Freq; + i = p->MinContext->NumStats; + do + { + if ((++s)->Symbol == symbol) + { + RangeEnc_Encode(p, sum, s->Freq, p->MinContext->SummFreq); + p->FoundState = s; + Ppmd8_Update1(p); + return; + } + sum += s->Freq; + } + while (--i); + + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + i = p->MinContext->NumStats; + do { MASK((--s)->Symbol) = 0; } while (--i); + RangeEnc_Encode(p, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq); + } + else + { + UInt16 *prob = Ppmd8_GetBinSumm(p); + CPpmd_State *s = Ppmd8Context_OneState(p->MinContext); + if (s->Symbol == symbol) + { + RangeEnc_EncodeBit_0(p, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_0(*prob); + p->FoundState = s; + Ppmd8_UpdateBin(p); + return; + } + else + { + RangeEnc_EncodeBit_1(p, *prob); + *prob = (UInt16)PPMD_UPDATE_PROB_1(*prob); + p->InitEsc = PPMD8_kExpEscape[*prob >> 10]; + PPMD_SetAllBitsIn256Bytes(charMask); + MASK(s->Symbol) = 0; + p->PrevSuccess = 0; + } + } + for (;;) + { + UInt32 escFreq; + CPpmd_See *see; + CPpmd_State *s; + UInt32 sum; + unsigned i, numMasked = p->MinContext->NumStats; + do + { + p->OrderFall++; + if (!p->MinContext->Suffix) + return; /* EndMarker (symbol = -1) */ + p->MinContext = Ppmd8_GetContext(p, p->MinContext->Suffix); + } + while (p->MinContext->NumStats == numMasked); + + see = Ppmd8_MakeEscFreq(p, numMasked, &escFreq); + s = Ppmd8_GetStats(p, p->MinContext); + sum = 0; + i = p->MinContext->NumStats + 1; + do + { + int cur = s->Symbol; + if (cur == symbol) + { + UInt32 low = sum; + CPpmd_State *s1 = s; + do + { + sum += (s->Freq & (int)(MASK(s->Symbol))); + s++; + } + while (--i); + RangeEnc_Encode(p, low, s1->Freq, sum + escFreq); + Ppmd_See_Update(see); + p->FoundState = s1; + Ppmd8_Update2(p); + return; + } + sum += (s->Freq & (int)(MASK(cur))); + MASK(cur) = 0; + s++; + } + while (--i); + + RangeEnc_Encode(p, sum, escFreq, sum + escFreq); + see->Summ = (UInt16)(see->Summ + sum + escFreq); + } +} diff --git a/src/ZipLib/extlibs/lzma/unix/RotateDefs.h b/src/ZipLib/extlibs/lzma/unix/RotateDefs.h new file mode 100644 index 00000000..c3a1385c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/RotateDefs.h @@ -0,0 +1,20 @@ +/* RotateDefs.h -- Rotate functions +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __ROTATE_DEFS_H +#define __ROTATE_DEFS_H + +#ifdef _MSC_VER + +#include +#define rotlFixed(x, n) _rotl((x), (n)) +#define rotrFixed(x, n) _rotr((x), (n)) + +#else + +#define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Sha256.c b/src/ZipLib/extlibs/lzma/unix/Sha256.c new file mode 100644 index 00000000..eb4fc61f --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Sha256.c @@ -0,0 +1,204 @@ +/* Crypto/Sha256.c -- SHA-256 Hash +2010-06-11 : Igor Pavlov : Public domain +This code is based on public domain code from Wei Dai's Crypto++ library. */ + +#include "RotateDefs.h" +#include "Sha256.h" + +/* define it for speed optimization */ +/* #define _SHA256_UNROLL */ +/* #define _SHA256_UNROLL2 */ + +void Sha256_Init(CSha256 *p) +{ + p->state[0] = 0x6a09e667; + p->state[1] = 0xbb67ae85; + p->state[2] = 0x3c6ef372; + p->state[3] = 0xa54ff53a; + p->state[4] = 0x510e527f; + p->state[5] = 0x9b05688c; + p->state[6] = 0x1f83d9ab; + p->state[7] = 0x5be0cd19; + p->count = 0; +} + +#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x, 22)) +#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x, 25)) +#define s0(x) (rotrFixed(x, 7) ^ rotrFixed(x,18) ^ (x >> 3)) +#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >> 10)) + +#define blk0(i) (W[i] = data[i]) +#define blk2(i) (W[i&15] += s1(W[(i-2)&15]) + W[(i-7)&15] + s0(W[(i-15)&15])) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) ((x&y)|(z&(x|y))) + +#define a(i) T[(0-(i))&7] +#define b(i) T[(1-(i))&7] +#define c(i) T[(2-(i))&7] +#define d(i) T[(3-(i))&7] +#define e(i) T[(4-(i))&7] +#define f(i) T[(5-(i))&7] +#define g(i) T[(6-(i))&7] +#define h(i) T[(7-(i))&7] + + +#ifdef _SHA256_UNROLL2 + +#define R(a,b,c,d,e,f,g,h, i) h += S1(e) + Ch(e,f,g) + K[i+j] + (j?blk2(i):blk0(i));\ + d += h; h += S0(a) + Maj(a, b, c) + +#define RX_8(i) \ + R(a,b,c,d,e,f,g,h, i); \ + R(h,a,b,c,d,e,f,g, i+1); \ + R(g,h,a,b,c,d,e,f, i+2); \ + R(f,g,h,a,b,c,d,e, i+3); \ + R(e,f,g,h,a,b,c,d, i+4); \ + R(d,e,f,g,h,a,b,c, i+5); \ + R(c,d,e,f,g,h,a,b, i+6); \ + R(b,c,d,e,f,g,h,a, i+7) + +#else + +#define R(i) h(i) += S1(e(i)) + Ch(e(i),f(i),g(i)) + K[i+j] + (j?blk2(i):blk0(i));\ + d(i) += h(i); h(i) += S0(a(i)) + Maj(a(i), b(i), c(i)) + +#ifdef _SHA256_UNROLL + +#define RX_8(i) R(i+0); R(i+1); R(i+2); R(i+3); R(i+4); R(i+5); R(i+6); R(i+7); + +#endif + +#endif + +static const UInt32 K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void Sha256_Transform(UInt32 *state, const UInt32 *data) +{ + UInt32 W[16]; + unsigned j; + #ifdef _SHA256_UNROLL2 + UInt32 a,b,c,d,e,f,g,h; + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + f = state[5]; + g = state[6]; + h = state[7]; + #else + UInt32 T[8]; + for (j = 0; j < 8; j++) + T[j] = state[j]; + #endif + + for (j = 0; j < 64; j += 16) + { + #if defined(_SHA256_UNROLL) || defined(_SHA256_UNROLL2) + RX_8(0); RX_8(8); + #else + unsigned i; + for (i = 0; i < 16; i++) { R(i); } + #endif + } + + #ifdef _SHA256_UNROLL2 + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; + #else + for (j = 0; j < 8; j++) + state[j] += T[j]; + #endif + + /* Wipe variables */ + /* memset(W, 0, sizeof(W)); */ + /* memset(T, 0, sizeof(T)); */ +} + +#undef S0 +#undef S1 +#undef s0 +#undef s1 + +static void Sha256_WriteByteBlock(CSha256 *p) +{ + UInt32 data32[16]; + unsigned i; + for (i = 0; i < 16; i++) + data32[i] = + ((UInt32)(p->buffer[i * 4 ]) << 24) + + ((UInt32)(p->buffer[i * 4 + 1]) << 16) + + ((UInt32)(p->buffer[i * 4 + 2]) << 8) + + ((UInt32)(p->buffer[i * 4 + 3])); + Sha256_Transform(p->state, data32); +} + +void Sha256_Update(CSha256 *p, const Byte *data, size_t size) +{ + UInt32 curBufferPos = (UInt32)p->count & 0x3F; + while (size > 0) + { + p->buffer[curBufferPos++] = *data++; + p->count++; + size--; + if (curBufferPos == 64) + { + curBufferPos = 0; + Sha256_WriteByteBlock(p); + } + } +} + +void Sha256_Final(CSha256 *p, Byte *digest) +{ + UInt64 lenInBits = (p->count << 3); + UInt32 curBufferPos = (UInt32)p->count & 0x3F; + unsigned i; + p->buffer[curBufferPos++] = 0x80; + while (curBufferPos != (64 - 8)) + { + curBufferPos &= 0x3F; + if (curBufferPos == 0) + Sha256_WriteByteBlock(p); + p->buffer[curBufferPos++] = 0; + } + for (i = 0; i < 8; i++) + { + p->buffer[curBufferPos++] = (Byte)(lenInBits >> 56); + lenInBits <<= 8; + } + Sha256_WriteByteBlock(p); + + for (i = 0; i < 8; i++) + { + *digest++ = (Byte)(p->state[i] >> 24); + *digest++ = (Byte)(p->state[i] >> 16); + *digest++ = (Byte)(p->state[i] >> 8); + *digest++ = (Byte)(p->state[i]); + } + Sha256_Init(p); +} diff --git a/src/ZipLib/extlibs/lzma/unix/Sha256.h b/src/ZipLib/extlibs/lzma/unix/Sha256.h new file mode 100644 index 00000000..530f513e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Sha256.h @@ -0,0 +1,26 @@ +/* Sha256.h -- SHA-256 Hash +2010-06-11 : Igor Pavlov : Public domain */ + +#ifndef __CRYPTO_SHA256_H +#define __CRYPTO_SHA256_H + +#include "Types.h" + +EXTERN_C_BEGIN + +#define SHA256_DIGEST_SIZE 32 + +typedef struct +{ + UInt32 state[8]; + UInt64 count; + Byte buffer[64]; +} CSha256; + +void Sha256_Init(CSha256 *p); +void Sha256_Update(CSha256 *p, const Byte *data, size_t size); +void Sha256_Final(CSha256 *p, Byte *digest); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Sort.c b/src/ZipLib/extlibs/lzma/unix/Sort.c new file mode 100644 index 00000000..388d2289 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Sort.c @@ -0,0 +1,93 @@ +/* Sort.c -- Sort functions +2010-09-17 : Igor Pavlov : Public domain */ + +#include "Sort.h" + +#define HeapSortDown(p, k, size, temp) \ + { for (;;) { \ + UInt32 s = (k << 1); \ + if (s > size) break; \ + if (s < size && p[s + 1] > p[s]) s++; \ + if (temp >= p[s]) break; \ + p[k] = p[s]; k = s; \ + } p[k] = temp; } + +void HeapSort(UInt32 *p, UInt32 size) +{ + if (size <= 1) + return; + p--; + { + UInt32 i = size / 2; + do + { + UInt32 temp = p[i]; + UInt32 k = i; + HeapSortDown(p, k, size, temp) + } + while (--i != 0); + } + /* + do + { + UInt32 k = 1; + UInt32 temp = p[size]; + p[size--] = p[1]; + HeapSortDown(p, k, size, temp) + } + while (size > 1); + */ + while (size > 3) + { + UInt32 temp = p[size]; + UInt32 k = (p[3] > p[2]) ? 3 : 2; + p[size--] = p[1]; + p[1] = p[k]; + HeapSortDown(p, k, size, temp) + } + { + UInt32 temp = p[size]; + p[size] = p[1]; + if (size > 2 && p[2] < temp) + { + p[1] = p[2]; + p[2] = temp; + } + else + p[1] = temp; + } +} + +/* +#define HeapSortRefDown(p, vals, n, size, temp) \ + { UInt32 k = n; UInt32 val = vals[temp]; for (;;) { \ + UInt32 s = (k << 1); \ + if (s > size) break; \ + if (s < size && vals[p[s + 1]] > vals[p[s]]) s++; \ + if (val >= vals[p[s]]) break; \ + p[k] = p[s]; k = s; \ + } p[k] = temp; } + +void HeapSortRef(UInt32 *p, UInt32 *vals, UInt32 size) +{ + if (size <= 1) + return; + p--; + { + UInt32 i = size / 2; + do + { + UInt32 temp = p[i]; + HeapSortRefDown(p, vals, i, size, temp); + } + while (--i != 0); + } + do + { + UInt32 temp = p[size]; + p[size--] = p[1]; + HeapSortRefDown(p, vals, 1, size, temp); + } + while (size > 1); +} +*/ diff --git a/src/ZipLib/extlibs/lzma/unix/Sort.h b/src/ZipLib/extlibs/lzma/unix/Sort.h new file mode 100644 index 00000000..65dfc6f6 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Sort.h @@ -0,0 +1,20 @@ +/* Sort.h -- Sort functions +2009-02-07 : Igor Pavlov : Public domain */ + +#ifndef __7Z_SORT_H +#define __7Z_SORT_H + +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void HeapSort(UInt32 *p, UInt32 size); +/* void HeapSortRef(UInt32 *p, UInt32 *vals, UInt32 size); */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Threads.c b/src/ZipLib/extlibs/lzma/unix/Threads.c new file mode 100644 index 00000000..1b8203f6 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Threads.c @@ -0,0 +1,582 @@ +/* Threads.c */ + +#include "Threads.h" + +#ifdef ENV_BEOS +#include +#else +#include +#include +#endif + +#include + +#if defined(__linux__) +#define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP +#endif + +#ifdef ENV_BEOS + +/* TODO : optimize the code and verify the returned values */ + +WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter) +{ + thread->_tid = spawn_thread((int32 (*)(void *))startAddress, "CThread", B_LOW_PRIORITY, parameter); + if (thread->_tid >= B_OK) { + resume_thread(thread->_tid); + } else { + thread->_tid = B_BAD_THREAD_ID; + } + thread->_created = 1; + return 0; // SZ_OK; +} + +WRes Thread_Wait(CThread *thread) +{ + int ret; + + if (thread->_created == 0) + return EINVAL; + + if (thread->_tid >= B_OK) + { + status_t exit_value; + wait_for_thread(thread->_tid, &exit_value); + thread->_tid = B_BAD_THREAD_ID; + } else { + return EINVAL; + } + + thread->_created = 0; + + return 0; +} + +WRes Thread_Close(CThread *thread) +{ + if (!thread->_created) return SZ_OK; + + thread->_tid = B_BAD_THREAD_ID; + thread->_created = 0; + return SZ_OK; +} + + +WRes Event_Create(CEvent *p, BOOL manualReset, int initialSignaled) +{ + p->_index_waiting = 0; + p->_manual_reset = manualReset; + p->_state = (initialSignaled ? TRUE : FALSE); + p->_created = 1; + p->_sem = create_sem(1,"event"); + return 0; +} + +WRes Event_Set(CEvent *p) { + int index; + acquire_sem(p->_sem); + p->_state = TRUE; + for(index = 0 ; index < p->_index_waiting ; index++) + { + send_data(p->_waiting[index], '7zCN', NULL, 0); + } + p->_index_waiting = 0; + release_sem(p->_sem); + return 0; +} + +WRes Event_Reset(CEvent *p) { + acquire_sem(p->_sem); + p->_state = FALSE; + release_sem(p->_sem); + return 0; +} + +WRes Event_Wait(CEvent *p) { + acquire_sem(p->_sem); + while (p->_state == FALSE) + { + thread_id sender; + p->_waiting[p->_index_waiting++] = find_thread(NULL); + release_sem(p->_sem); + /* int msg = */ receive_data(&sender, NULL, 0); + acquire_sem(p->_sem); + } + if (p->_manual_reset == FALSE) + { + p->_state = FALSE; + } + release_sem(p->_sem); + return 0; +} + +WRes Event_Close(CEvent *p) { + if (p->_created) + { + p->_created = 0; + delete_sem(p->_sem); + } + return 0; +} + +WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount) +{ + p->_index_waiting = 0; + p->_count = initiallyCount; + p->_maxCount = maxCount; + p->_created = 1; + p->_sem = create_sem(1,"sem"); + return 0; +} + +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount) +{ + UInt32 newCount; + int index; + + if (releaseCount < 1) return EINVAL; + + acquire_sem(p->_sem); + newCount = p->_count + releaseCount; + if (newCount > p->_maxCount) + { + release_sem(p->_sem); + return EINVAL; + } + p->_count = newCount; + for(index = 0 ; index < p->_index_waiting ; index++) + { + send_data(p->_waiting[index], '7zCN', NULL, 0); + } + p->_index_waiting = 0; + release_sem(p->_sem); + return 0; +} + +WRes Semaphore_Wait(CSemaphore *p) { + acquire_sem(p->_sem); + while (p->_count < 1) + { + thread_id sender; + p->_waiting[p->_index_waiting++] = find_thread(NULL); + release_sem(p->_sem); + /* int msg = */ receive_data(&sender, NULL, 0); + acquire_sem(p->_sem); + } + p->_count--; + release_sem(p->_sem); + return 0; +} + +WRes Semaphore_Close(CSemaphore *p) { + if (p->_created) + { + p->_created = 0; + delete_sem(p->_sem); + } + return 0; +} + +WRes CriticalSection_Init(CCriticalSection * lpCriticalSection) +{ + lpCriticalSection->_sem = create_sem(1,"cc"); + return 0; +} + +#else /* !ENV_BEOS */ + +WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter) +{ + pthread_attr_t attr; + int ret; + + thread->_created = 0; + + ret = pthread_attr_init(&attr); + if (ret) return ret; + + ret = pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINABLE); + if (ret) return ret; + + ret = pthread_create(&thread->_tid, &attr, (void * (*)(void *))startAddress, parameter); + + /* ret2 = */ pthread_attr_destroy(&attr); + + if (ret) return ret; + + thread->_created = 1; + + return 0; // SZ_OK; +} + +WRes Thread_Wait(CThread *thread) +{ + void *thread_return; + int ret; + + if (thread->_created == 0) + return EINVAL; + + ret = pthread_join(thread->_tid,&thread_return); + thread->_created = 0; + + return ret; +} + +WRes Thread_Close(CThread *thread) +{ + if (!thread->_created) return SZ_OK; + + pthread_detach(thread->_tid); + thread->_tid = 0; + thread->_created = 0; + return SZ_OK; +} + +#ifdef DEBUG_SYNCHRO + +#include + +static void dump_error(int ligne,int ret,const char *text,void *param) +{ + printf("\n##T%d#ERROR2 (l=%d) %s : param=%p ret = %d (%s)##\n",(int)pthread_self(),ligne,text,param,ret,strerror(ret)); + // abort(); +} + +WRes Event_Create(CEvent *p, BOOL manualReset, int initialSignaled) +{ + int ret; + pthread_mutexattr_t mutexattr; + memset(&mutexattr,0,sizeof(mutexattr)); + ret = pthread_mutexattr_init(&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"Event_Create::pthread_mutexattr_init",&mutexattr); + ret = pthread_mutexattr_settype(&mutexattr,PTHREAD_MUTEX_ERRORCHECK); + if (ret != 0) dump_error(__LINE__,ret,"Event_Create::pthread_mutexattr_settype",&mutexattr); + ret = pthread_mutex_init(&p->_mutex,&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"Event_Create::pthread_mutexattr_init",&p->_mutex); + if (ret == 0) + { + ret = pthread_cond_init(&p->_cond,0); + if (ret != 0) dump_error(__LINE__,ret,"Event_Create::pthread_cond_init",&p->_cond); + p->_manual_reset = manualReset; + p->_state = (initialSignaled ? TRUE : FALSE); + p->_created = 1; + } + return ret; +} + +WRes Event_Set(CEvent *p) { + int ret = pthread_mutex_lock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"ES::pthread_mutex_lock",&p->_mutex); + if (ret == 0) + { + p->_state = TRUE; + ret = pthread_cond_broadcast(&p->_cond); + if (ret != 0) dump_error(__LINE__,ret,"ES::pthread_cond_broadcast",&p->_cond); + if (ret == 0) + { + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"ES::pthread_mutex_unlock",&p->_mutex); + } + } + return ret; +} + +WRes Event_Reset(CEvent *p) { + int ret = pthread_mutex_lock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"ER::pthread_mutex_lock",&p->_mutex); + if (ret == 0) + { + p->_state = FALSE; + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"ER::pthread_mutex_unlock",&p->_mutex); + } + return ret; +} + +WRes Event_Wait(CEvent *p) { + int ret = pthread_mutex_lock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"EW::pthread_mutex_lock",&p->_mutex); + if (ret == 0) + { + while ((p->_state == FALSE) && (ret == 0)) + { + ret = pthread_cond_wait(&p->_cond, &p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"EW::pthread_cond_wait",&p->_mutex); + } + if (ret == 0) + { + if (p->_manual_reset == FALSE) + { + p->_state = FALSE; + } + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"EW::pthread_mutex_unlock",&p->_mutex); + } + } + return ret; +} + +WRes Event_Close(CEvent *p) { + if (p->_created) + { + int ret; + p->_created = 0; + ret = pthread_mutex_destroy(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"EC::pthread_mutex_destroy",&p->_mutex); + ret = pthread_cond_destroy(&p->_cond); + if (ret != 0) dump_error(__LINE__,ret,"EC::pthread_cond_destroy",&p->_cond); + } + return 0; +} + +WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount) +{ + int ret; + pthread_mutexattr_t mutexattr; + memset(&mutexattr,0,sizeof(mutexattr)); + ret = pthread_mutexattr_init(&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"SemC::pthread_mutexattr_init",&mutexattr); + ret = pthread_mutexattr_settype(&mutexattr,PTHREAD_MUTEX_ERRORCHECK); + if (ret != 0) dump_error(__LINE__,ret,"SemC::pthread_mutexattr_settype",&mutexattr); + ret = pthread_mutex_init(&p->_mutex,&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"SemC::pthread_mutexattr_init",&p->_mutex); + if (ret == 0) + { + ret = pthread_cond_init(&p->_cond,0); + if (ret != 0) dump_error(__LINE__,ret,"SemC::pthread_cond_init",&p->_mutex); + p->_count = initiallyCount; + p->_maxCount = maxCount; + p->_created = 1; + } + return ret; +} + +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount) +{ + int ret; + if (releaseCount < 1) return EINVAL; + + ret = pthread_mutex_lock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemR::pthread_mutex_lock",&p->_mutex); + if (ret == 0) + { + UInt32 newCount = p->_count + releaseCount; + if (newCount > p->_maxCount) + { + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemR::pthread_mutex_unlock",&p->_mutex); + return EINVAL; + } + p->_count = newCount; + ret = pthread_cond_broadcast(&p->_cond); + if (ret != 0) dump_error(__LINE__,ret,"SemR::pthread_cond_broadcast",&p->_cond); + if (ret == 0) + { + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemR::pthread_mutex_unlock",&p->_mutex); + } + } + return ret; +} + +WRes Semaphore_Wait(CSemaphore *p) { + int ret = pthread_mutex_lock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemW::pthread_mutex_lock",&p->_mutex); + if (ret == 0) + { + while ((p->_count < 1) && (ret == 0)) + { + ret = pthread_cond_wait(&p->_cond, &p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemW::pthread_cond_wait",&p->_mutex); + } + if (ret == 0) + { + p->_count--; + ret = pthread_mutex_unlock(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"SemW::pthread_mutex_unlock",&p->_mutex); + } + } + return ret; +} + +WRes Semaphore_Close(CSemaphore *p) { + if (p->_created) + { + int ret; + p->_created = 0; + ret = pthread_mutex_destroy(&p->_mutex); + if (ret != 0) dump_error(__LINE__,ret,"Semc::pthread_mutex_destroy",&p->_mutex); + ret = pthread_cond_destroy(&p->_cond); + if (ret != 0) dump_error(__LINE__,ret,"Semc::pthread_cond_destroy",&p->_cond); + } + return 0; +} + +WRes CriticalSection_Init(CCriticalSection * lpCriticalSection) +{ + if (lpCriticalSection) + { + int ret; + pthread_mutexattr_t mutexattr; + memset(&mutexattr,0,sizeof(mutexattr)); + ret = pthread_mutexattr_init(&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"CS I::pthread_mutexattr_init",&mutexattr); + ret = pthread_mutexattr_settype(&mutexattr,PTHREAD_MUTEX_ERRORCHECK); + if (ret != 0) dump_error(__LINE__,ret,"CS I::pthread_mutexattr_settype",&mutexattr); + ret = pthread_mutex_init(&lpCriticalSection->_mutex,&mutexattr); + if (ret != 0) dump_error(__LINE__,ret,"CS I::pthread_mutexattr_init",&lpCriticalSection->_mutex); + return ret; + } + return EINTR; +} + +void CriticalSection_Enter(CCriticalSection * lpCriticalSection) +{ + if (lpCriticalSection) + { + int ret = pthread_mutex_lock(&(lpCriticalSection->_mutex)); + if (ret != 0) dump_error(__LINE__,ret,"CS::pthread_mutex_lock",&(lpCriticalSection->_mutex)); + } +} + +void CriticalSection_Leave(CCriticalSection * lpCriticalSection) +{ + if (lpCriticalSection) + { + int ret = pthread_mutex_unlock(&(lpCriticalSection->_mutex)); + if (ret != 0) dump_error(__LINE__,ret,"CS::pthread_mutex_unlock",&(lpCriticalSection->_mutex)); + } +} + +void CriticalSection_Delete(CCriticalSection * lpCriticalSection) +{ + if (lpCriticalSection) + { + int ret = pthread_mutex_destroy(&(lpCriticalSection->_mutex)); + if (ret != 0) dump_error(__LINE__,ret,"CS::pthread_mutex_destroy",&(lpCriticalSection->_mutex)); + } +} + +#else + +WRes Event_Create(CEvent *p, BOOL manualReset, int initialSignaled) +{ + pthread_mutex_init(&p->_mutex,0); + pthread_cond_init(&p->_cond,0); + p->_manual_reset = manualReset; + p->_state = (initialSignaled ? TRUE : FALSE); + p->_created = 1; + return 0; +} + +WRes Event_Set(CEvent *p) { + pthread_mutex_lock(&p->_mutex); + p->_state = TRUE; + pthread_cond_broadcast(&p->_cond); + pthread_mutex_unlock(&p->_mutex); + return 0; +} + +WRes Event_Reset(CEvent *p) { + pthread_mutex_lock(&p->_mutex); + p->_state = FALSE; + pthread_mutex_unlock(&p->_mutex); + return 0; +} + +WRes Event_Wait(CEvent *p) { + pthread_mutex_lock(&p->_mutex); + while (p->_state == FALSE) + { + pthread_cond_wait(&p->_cond, &p->_mutex); + } + if (p->_manual_reset == FALSE) + { + p->_state = FALSE; + } + pthread_mutex_unlock(&p->_mutex); + return 0; +} + +WRes Event_Close(CEvent *p) { + if (p->_created) + { + p->_created = 0; + pthread_mutex_destroy(&p->_mutex); + pthread_cond_destroy(&p->_cond); + } + return 0; +} + +WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount) +{ + pthread_mutex_init(&p->_mutex,0); + pthread_cond_init(&p->_cond,0); + p->_count = initiallyCount; + p->_maxCount = maxCount; + p->_created = 1; + return 0; +} + +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 releaseCount) +{ + UInt32 newCount; + + if (releaseCount < 1) return EINVAL; + + pthread_mutex_lock(&p->_mutex); + + newCount = p->_count + releaseCount; + if (newCount > p->_maxCount) + { + pthread_mutex_unlock(&p->_mutex); + return EINVAL; + } + p->_count = newCount; + pthread_cond_broadcast(&p->_cond); + pthread_mutex_unlock(&p->_mutex); + return 0; +} + +WRes Semaphore_Wait(CSemaphore *p) { + pthread_mutex_lock(&p->_mutex); + while (p->_count < 1) + { + pthread_cond_wait(&p->_cond, &p->_mutex); + } + p->_count--; + pthread_mutex_unlock(&p->_mutex); + return 0; +} + +WRes Semaphore_Close(CSemaphore *p) { + if (p->_created) + { + p->_created = 0; + pthread_mutex_destroy(&p->_mutex); + pthread_cond_destroy(&p->_cond); + } + return 0; +} + +WRes CriticalSection_Init(CCriticalSection * lpCriticalSection) +{ + return pthread_mutex_init(&(lpCriticalSection->_mutex),0); +} + +#endif /* DEBUG_SYNCHRO */ + +#endif /* ENV_BEOS */ + +WRes ManualResetEvent_Create(CManualResetEvent *p, int initialSignaled) + { return Event_Create(p, TRUE, initialSignaled); } + +WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p) + { return ManualResetEvent_Create(p, 0); } + +WRes AutoResetEvent_Create(CAutoResetEvent *p, int initialSignaled) + { return Event_Create(p, FALSE, initialSignaled); } +WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p) + { return AutoResetEvent_Create(p, 0); } + diff --git a/src/ZipLib/extlibs/lzma/unix/Threads.h b/src/ZipLib/extlibs/lzma/unix/Threads.h new file mode 100644 index 00000000..68fd9b0d --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Threads.h @@ -0,0 +1,127 @@ +/* Threads.h -- multithreading library +2008-11-22 : Igor Pavlov : Public domain */ + +#ifndef __7Z_THRESDS_H +#define __7Z_THRESDS_H + +#include "Types.h" + +#ifdef ENV_BEOS +#include +#define MAX_THREAD 256 +#else +#include +#endif + +/* #define DEBUG_SYNCHRO 1 */ + +typedef struct _CThread +{ +#ifdef ENV_BEOS + thread_id _tid; +#else + pthread_t _tid; +#endif + int _created; + +} CThread; + +#define Thread_Construct(thread) (thread)->_created = 0 +#define Thread_WasCreated(thread) ((thread)->_created != 0) + +typedef unsigned THREAD_FUNC_RET_TYPE; +#define THREAD_FUNC_CALL_TYPE MY_STD_CALL +#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE + +typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *); +typedef void* LPVOID; +typedef unsigned char BOOL; + +#define TRUE (1) +#define FALSE (0) + +WRes Thread_Create(CThread *thread, THREAD_FUNC_TYPE startAddress, LPVOID parameter); +WRes Thread_Wait(CThread *thread); +WRes Thread_Close(CThread *thread); + +typedef struct _CEvent +{ + int _created; + int _manual_reset; + int _state; +#ifdef ENV_BEOS + thread_id _waiting[MAX_THREAD]; + int _index_waiting; + sem_id _sem; +#else + pthread_mutex_t _mutex; + pthread_cond_t _cond; +#endif +} CEvent; + +typedef CEvent CAutoResetEvent; +typedef CEvent CManualResetEvent; + +#define Event_Construct(event) (event)->_created = 0 +#define Event_IsCreated(event) ((event)->_created) + +WRes ManualResetEvent_Create(CManualResetEvent *event, int initialSignaled); +WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *event); +WRes AutoResetEvent_Create(CAutoResetEvent *event, int initialSignaled); +WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *event); +WRes Event_Set(CEvent *event); +WRes Event_Reset(CEvent *event); +WRes Event_Wait(CEvent *event); +WRes Event_Close(CEvent *event); + + +typedef struct _CSemaphore +{ + int _created; + UInt32 _count; + UInt32 _maxCount; +#ifdef ENV_BEOS + thread_id _waiting[MAX_THREAD]; + int _index_waiting; + sem_id _sem; +#else + pthread_mutex_t _mutex; + pthread_cond_t _cond; +#endif +} CSemaphore; + +#define Semaphore_Construct(p) (p)->_created = 0 + +WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount); +WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num); +#define Semaphore_Release1(p) Semaphore_ReleaseN(p, 1) +WRes Semaphore_Wait(CSemaphore *p); +WRes Semaphore_Close(CSemaphore *p); + +typedef struct { +#ifdef ENV_BEOS + sem_id _sem; +#else + pthread_mutex_t _mutex; +#endif +} CCriticalSection; + +WRes CriticalSection_Init(CCriticalSection *p); +#ifdef ENV_BEOS +#define CriticalSection_Delete(p) delete_sem((p)->_sem) +#define CriticalSection_Enter(p) acquire_sem((p)->_sem) +#define CriticalSection_Leave(p) release_sem((p)->_sem) +#else +#ifdef DEBUG_SYNCHRO +void CriticalSection_Delete(CCriticalSection *); +void CriticalSection_Enter(CCriticalSection *); +void CriticalSection_Leave(CCriticalSection *); +#else +#define CriticalSection_Delete(p) pthread_mutex_destroy(&((p)->_mutex)) +#define CriticalSection_Enter(p) pthread_mutex_lock(&((p)->_mutex)) +#define CriticalSection_Leave(p) pthread_mutex_unlock(&((p)->_mutex)) +#endif +#endif + +#endif + diff --git a/src/ZipLib/extlibs/lzma/unix/Types.h b/src/ZipLib/extlibs/lzma/unix/Types.h new file mode 100644 index 00000000..7732c240 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Types.h @@ -0,0 +1,254 @@ +/* Types.h -- Basic types +2010-10-09 : Igor Pavlov : Public domain */ + +#ifndef __7Z_TYPES_H +#define __7Z_TYPES_H + +#include + +#ifdef _WIN32 +#include +#endif + +#ifndef EXTERN_C_BEGIN +#ifdef __cplusplus +#define EXTERN_C_BEGIN extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_BEGIN +#define EXTERN_C_END +#endif +#endif + +EXTERN_C_BEGIN + +#define SZ_OK 0 + +#define SZ_ERROR_DATA 1 +#define SZ_ERROR_MEM 2 +#define SZ_ERROR_CRC 3 +#define SZ_ERROR_UNSUPPORTED 4 +#define SZ_ERROR_PARAM 5 +#define SZ_ERROR_INPUT_EOF 6 +#define SZ_ERROR_OUTPUT_EOF 7 +#define SZ_ERROR_READ 8 +#define SZ_ERROR_WRITE 9 +#define SZ_ERROR_PROGRESS 10 +#define SZ_ERROR_FAIL 11 +#define SZ_ERROR_THREAD 12 + +#define SZ_ERROR_ARCHIVE 16 +#define SZ_ERROR_NO_ARCHIVE 17 + +typedef int SRes; + +#ifdef _WIN32 +typedef DWORD WRes; +#else +typedef int WRes; +#endif + +#ifndef RINOK +#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } +#endif + +typedef unsigned char Byte; +typedef short Int16; +typedef unsigned short UInt16; + +#ifdef _LZMA_UINT32_IS_ULONG +typedef long Int32; +typedef unsigned long UInt32; +#else +typedef int Int32; +typedef unsigned int UInt32; +#endif + +#ifdef _SZ_NO_INT_64 + +/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. + NOTES: Some code will work incorrectly in that case! */ + +typedef long Int64; +typedef unsigned long UInt64; + +#else + +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#define UINT64_CONST(n) n +#else +typedef long long int Int64; +typedef unsigned long long int UInt64; +#define UINT64_CONST(n) n ## ULL +#endif + +#endif + +#ifdef _LZMA_NO_SYSTEM_SIZE_T +typedef UInt32 SizeT; +#else +typedef size_t SizeT; +#endif + +typedef int Bool; +#define True 1 +#define False 0 + + +#ifdef _WIN32 +#define MY_STD_CALL __stdcall +#else +#define MY_STD_CALL +#endif + +#ifdef _MSC_VER + +#if _MSC_VER >= 1300 +#define MY_NO_INLINE __declspec(noinline) +#else +#define MY_NO_INLINE +#endif + +#define MY_CDECL __cdecl +#define MY_FAST_CALL __fastcall + +#else + +#define MY_CDECL +#define MY_FAST_CALL + +#endif + + +/* The following interfaces use first parameter as pointer to structure */ + +typedef struct +{ + Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ +} IByteIn; + +typedef struct +{ + void (*Write)(void *p, Byte b); +} IByteOut; + +typedef struct +{ + SRes (*Read)(void *p, void *buf, size_t *size); + /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. + (output(*size) < input(*size)) is allowed */ +} ISeqInStream; + +/* it can return SZ_ERROR_INPUT_EOF */ +SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); +SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); +SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); + +typedef struct +{ + size_t (*Write)(void *p, const void *buf, size_t size); + /* Returns: result - the number of actually written bytes. + (result < size) means error */ +} ISeqOutStream; + +typedef enum +{ + SZ_SEEK_SET = 0, + SZ_SEEK_CUR = 1, + SZ_SEEK_END = 2 +} ESzSeek; + +typedef struct +{ + SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ + SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); +} ISeekInStream; + +typedef struct +{ + SRes (*Look)(void *p, const void **buf, size_t *size); + /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. + (output(*size) > input(*size)) is not allowed + (output(*size) < input(*size)) is allowed */ + SRes (*Skip)(void *p, size_t offset); + /* offset must be <= output(*size) of Look */ + + SRes (*Read)(void *p, void *buf, size_t *size); + /* reads directly (without buffer). It's same as ISeqInStream::Read */ + SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); +} ILookInStream; + +SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); +SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); + +/* reads via ILookInStream::Read */ +SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); +SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); + +#define LookToRead_BUF_SIZE (1 << 14) + +typedef struct +{ + ILookInStream s; + ISeekInStream *realStream; + size_t pos; + size_t size; + Byte buf[LookToRead_BUF_SIZE]; +} CLookToRead; + +void LookToRead_CreateVTable(CLookToRead *p, int lookahead); +void LookToRead_Init(CLookToRead *p); + +typedef struct +{ + ISeqInStream s; + ILookInStream *realStream; +} CSecToLook; + +void SecToLook_CreateVTable(CSecToLook *p); + +typedef struct +{ + ISeqInStream s; + ILookInStream *realStream; +} CSecToRead; + +void SecToRead_CreateVTable(CSecToRead *p); + +typedef struct +{ + SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); + /* Returns: result. (result != SZ_OK) means break. + Value (UInt64)(Int64)-1 for size means unknown value. */ +} ICompressProgress; + +typedef struct +{ + void *(*Alloc)(void *p, size_t size); + void (*Free)(void *p, void *address); /* address can be 0 */ +} ISzAlloc; + +#define IAlloc_Alloc(p, size) (p)->Alloc((p), size) +#define IAlloc_Free(p, a) (p)->Free((p), a) + +#ifdef _WIN32 + +#define CHAR_PATH_SEPARATOR '\\' +#define WCHAR_PATH_SEPARATOR L'\\' +#define STRING_PATH_SEPARATOR "\\" +#define WSTRING_PATH_SEPARATOR L"\\" + +#else + +#define CHAR_PATH_SEPARATOR '/' +#define WCHAR_PATH_SEPARATOR L'/' +#define STRING_PATH_SEPARATOR "/" +#define WSTRING_PATH_SEPARATOR L"/" + +#endif + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/Xz.c b/src/ZipLib/extlibs/lzma/unix/Xz.c new file mode 100644 index 00000000..18caba2c --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Xz.c @@ -0,0 +1,88 @@ +/* Xz.c - Xz +2009-04-15 : Igor Pavlov : Public domain */ + +#include "7zCrc.h" +#include "CpuArch.h" +#include "Xz.h" +#include "XzCrc64.h" + +Byte XZ_SIG[XZ_SIG_SIZE] = { 0xFD, '7', 'z', 'X', 'Z', 0 }; +Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE] = { 'Y', 'Z' }; + +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v) +{ + unsigned i = 0; + do + { + buf[i++] = (Byte)((v & 0x7F) | 0x80); + v >>= 7; + } + while (v != 0); + buf[i - 1] &= 0x7F; + return i; +} + +void Xz_Construct(CXzStream *p) +{ + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; + p->flags = 0; +} + +void Xz_Free(CXzStream *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->blocks); + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; +} + +unsigned XzFlags_GetCheckSize(CXzStreamFlags f) +{ + int t = XzFlags_GetCheckType(f); + return (t == 0) ? 0 : (4 << ((t - 1) / 3)); +} + +void XzCheck_Init(CXzCheck *p, int mode) +{ + p->mode = mode; + switch (mode) + { + case XZ_CHECK_CRC32: p->crc = CRC_INIT_VAL; break; + case XZ_CHECK_CRC64: p->crc64 = CRC64_INIT_VAL; break; + case XZ_CHECK_SHA256: Sha256_Init(&p->sha); break; + } +} + +void XzCheck_Update(CXzCheck *p, const void *data, size_t size) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: p->crc = CrcUpdate(p->crc, data, size); break; + case XZ_CHECK_CRC64: p->crc64 = Crc64Update(p->crc64, data, size); break; + case XZ_CHECK_SHA256: Sha256_Update(&p->sha, (const Byte *)data, size); break; + } +} + +int XzCheck_Final(CXzCheck *p, Byte *digest) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: + SetUi32(digest, CRC_GET_DIGEST(p->crc)); + break; + case XZ_CHECK_CRC64: + { + int i; + UInt64 v = CRC64_GET_DIGEST(p->crc64); + for (i = 0; i < 8; i++, v >>= 8) + digest[i] = (Byte)(v & 0xFF); + break; + } + case XZ_CHECK_SHA256: + Sha256_Final(&p->sha, digest); + break; + default: + return 0; + } + return 1; +} diff --git a/src/ZipLib/extlibs/lzma/unix/Xz.h b/src/ZipLib/extlibs/lzma/unix/Xz.h new file mode 100644 index 00000000..2cfa1b78 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/Xz.h @@ -0,0 +1,252 @@ +/* Xz.h - Xz interface +2010-09-17 : Igor Pavlov : Public domain */ + +#ifndef __XZ_H +#define __XZ_H + +#include "Sha256.h" + +EXTERN_C_BEGIN + +#define XZ_ID_Subblock 1 +#define XZ_ID_Delta 3 +#define XZ_ID_X86 4 +#define XZ_ID_PPC 5 +#define XZ_ID_IA64 6 +#define XZ_ID_ARM 7 +#define XZ_ID_ARMT 8 +#define XZ_ID_SPARC 9 +#define XZ_ID_LZMA2 0x21 + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value); +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v); + +/* ---------- xz block ---------- */ + +#define XZ_BLOCK_HEADER_SIZE_MAX 1024 + +#define XZ_NUM_FILTERS_MAX 4 +#define XZ_BF_NUM_FILTERS_MASK 3 +#define XZ_BF_PACK_SIZE (1 << 6) +#define XZ_BF_UNPACK_SIZE (1 << 7) + +#define XZ_FILTER_PROPS_SIZE_MAX 20 + +typedef struct +{ + UInt64 id; + UInt32 propsSize; + Byte props[XZ_FILTER_PROPS_SIZE_MAX]; +} CXzFilter; + +typedef struct +{ + UInt64 packSize; + UInt64 unpackSize; + Byte flags; + CXzFilter filters[XZ_NUM_FILTERS_MAX]; +} CXzBlock; + +#define XzBlock_GetNumFilters(p) (((p)->flags & XZ_BF_NUM_FILTERS_MASK) + 1) +#define XzBlock_HasPackSize(p) (((p)->flags & XZ_BF_PACK_SIZE) != 0) +#define XzBlock_HasUnpackSize(p) (((p)->flags & XZ_BF_UNPACK_SIZE) != 0) + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header); +SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes); + +/* ---------- xz stream ---------- */ + +#define XZ_SIG_SIZE 6 +#define XZ_FOOTER_SIG_SIZE 2 + +extern Byte XZ_SIG[XZ_SIG_SIZE]; +extern Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE]; + +#define XZ_STREAM_FLAGS_SIZE 2 +#define XZ_STREAM_CRC_SIZE 4 + +#define XZ_STREAM_HEADER_SIZE (XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE) +#define XZ_STREAM_FOOTER_SIZE (XZ_FOOTER_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE + 4) + +#define XZ_CHECK_MASK 0xF +#define XZ_CHECK_NO 0 +#define XZ_CHECK_CRC32 1 +#define XZ_CHECK_CRC64 4 +#define XZ_CHECK_SHA256 10 + +typedef struct +{ + int mode; + UInt32 crc; + UInt64 crc64; + CSha256 sha; +} CXzCheck; + +void XzCheck_Init(CXzCheck *p, int mode); +void XzCheck_Update(CXzCheck *p, const void *data, size_t size); +int XzCheck_Final(CXzCheck *p, Byte *digest); + +typedef UInt16 CXzStreamFlags; + +#define XzFlags_IsSupported(f) ((f) <= XZ_CHECK_MASK) +#define XzFlags_GetCheckType(f) ((f) & XZ_CHECK_MASK) +#define XzFlags_HasDataCrc32(f) (Xz_GetCheckType(f) == XZ_CHECK_CRC32) +unsigned XzFlags_GetCheckSize(CXzStreamFlags f); + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf); +SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream); + +typedef struct +{ + UInt64 unpackSize; + UInt64 totalSize; +} CXzBlockSizes; + +typedef struct +{ + CXzStreamFlags flags; + size_t numBlocks; + size_t numBlocksAllocated; + CXzBlockSizes *blocks; + UInt64 startOffset; +} CXzStream; + +void Xz_Construct(CXzStream *p); +void Xz_Free(CXzStream *p, ISzAlloc *alloc); + +#define XZ_SIZE_OVERFLOW ((UInt64)(Int64)-1) + +UInt64 Xz_GetUnpackSize(const CXzStream *p); +UInt64 Xz_GetPackSize(const CXzStream *p); + +typedef struct +{ + size_t num; + size_t numAllocated; + CXzStream *streams; +} CXzs; + +void Xzs_Construct(CXzs *p); +void Xzs_Free(CXzs *p, ISzAlloc *alloc); +SRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc); + +UInt64 Xzs_GetNumBlocks(const CXzs *p); +UInt64 Xzs_GetUnpackSize(const CXzs *p); + +typedef enum +{ + CODER_STATUS_NOT_SPECIFIED, /* use main error code instead */ + CODER_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ + CODER_STATUS_NOT_FINISHED, /* stream was not finished */ + CODER_STATUS_NEEDS_MORE_INPUT /* you must provide more input bytes */ +} ECoderStatus; + +typedef enum +{ + CODER_FINISH_ANY, /* finish at any point */ + CODER_FINISH_END /* block must be finished at the end */ +} ECoderFinishMode; + +typedef struct _IStateCoder +{ + void *p; + void (*Free)(void *p, ISzAlloc *alloc); + SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAlloc *alloc); + void (*Init)(void *p); + SRes (*Code)(void *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished); +} IStateCoder; + +#define MIXCODER_NUM_FILTERS_MAX 4 + +typedef struct +{ + ISzAlloc *alloc; + Byte *buf; + int numCoders; + int finished[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t pos[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t size[MIXCODER_NUM_FILTERS_MAX - 1]; + UInt64 ids[MIXCODER_NUM_FILTERS_MAX]; + IStateCoder coders[MIXCODER_NUM_FILTERS_MAX]; +} CMixCoder; + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc); +void MixCoder_Free(CMixCoder *p); +void MixCoder_Init(CMixCoder *p); +SRes MixCoder_SetFromMethod(CMixCoder *p, int coderIndex, UInt64 methodId); +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status); + +typedef enum +{ + XZ_STATE_STREAM_HEADER, + XZ_STATE_STREAM_INDEX, + XZ_STATE_STREAM_INDEX_CRC, + XZ_STATE_STREAM_FOOTER, + XZ_STATE_STREAM_PADDING, + XZ_STATE_BLOCK_HEADER, + XZ_STATE_BLOCK, + XZ_STATE_BLOCK_FOOTER +} EXzState; + +typedef struct +{ + EXzState state; + UInt32 pos; + unsigned alignPos; + unsigned indexPreSize; + + CXzStreamFlags streamFlags; + + UInt32 blockHeaderSize; + UInt64 packSize; + UInt64 unpackSize; + + UInt64 numBlocks; + UInt64 indexSize; + UInt64 indexPos; + UInt64 padSize; + + UInt64 numStreams; + + UInt32 crc; + CMixCoder decoder; + CXzBlock block; + CXzCheck check; + CSha256 sha; + Byte shaDigest[SHA256_DIGEST_SIZE]; + Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; +} CXzUnpacker; + +SRes XzUnpacker_Create(CXzUnpacker *p, ISzAlloc *alloc); +void XzUnpacker_Free(CXzUnpacker *p); + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + LZMA_FINISH_ANY - use smallest number of input bytes + LZMA_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + LZMA_STATUS_FINISHED_WITH_MARK + LZMA_STATUS_NOT_FINISHED + SZ_ERROR_DATA - Data error + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_UNSUPPORTED - Unsupported properties + SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). +*/ + + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, /* int srcWasFinished, */ int finishMode, + ECoderStatus *status); + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/XzCrc64.c b/src/ZipLib/extlibs/lzma/unix/XzCrc64.c new file mode 100644 index 00000000..0369554b --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzCrc64.c @@ -0,0 +1,33 @@ +/* XzCrc64.c -- CRC64 calculation +2010-04-16 : Igor Pavlov : Public domain */ + +#include "XzCrc64.h" + +#define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42) +UInt64 g_Crc64Table[256]; + +void MY_FAST_CALL Crc64GenerateTable(void) +{ + UInt32 i; + for (i = 0; i < 256; i++) + { + UInt64 r = i; + int j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ ((UInt64)kCrc64Poly & ~((r & 1) - 1)); + g_Crc64Table[i] = r; + } +} + +UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 ; size--, p++) + v = CRC64_UPDATE_BYTE(v, *p); + return v; +} + +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size) +{ + return CRC64_GET_DIGEST(Crc64Update(CRC64_INIT_VAL, data, size)); +} diff --git a/src/ZipLib/extlibs/lzma/unix/XzCrc64.h b/src/ZipLib/extlibs/lzma/unix/XzCrc64.h new file mode 100644 index 00000000..0e8efd7e --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzCrc64.h @@ -0,0 +1,26 @@ +/* XzCrc64.h -- CRC64 calculation +2010-04-16 : Igor Pavlov : Public domain */ + +#ifndef __XZ_CRC64_H +#define __XZ_CRC64_H + +#include + +#include "Types.h" + +EXTERN_C_BEGIN + +extern UInt64 g_Crc64Table[]; + +void MY_FAST_CALL Crc64GenerateTable(void); + +#define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) +#define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) +#define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size); +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size); + +EXTERN_C_END + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/XzDec.c b/src/ZipLib/extlibs/lzma/unix/XzDec.c new file mode 100644 index 00000000..40f1a2a4 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzDec.c @@ -0,0 +1,875 @@ +/* XzDec.c -- Xz Decode +2010-04-16 : Igor Pavlov : Public domain */ + +/* #define XZ_DUMP */ + +#ifdef XZ_DUMP +#include +#endif + +#include +#include + +#include "7zCrc.h" +#include "Alloc.h" +#include "Bra.h" +#include "CpuArch.h" +#include "Delta.h" +#include "Lzma2Dec.h" + +#ifdef USE_SUBBLOCK +#include "SbDec.h" +#endif + +#include "Xz.h" + +#define XZ_CHECK_SIZE_MAX 64 + +#define CODER_BUF_SIZE (1 << 17) + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value) +{ + int i, limit; + *value = 0; + limit = (maxSize > 9) ? 9 : (int)maxSize; + + for (i = 0; i < limit;) + { + Byte b = p[i]; + *value |= (UInt64)(b & 0x7F) << (7 * i++); + if ((b & 0x80) == 0) + return (b == 0 && i != 1) ? 0 : i; + } + return 0; +} + +/* ---------- BraState ---------- */ + +#define BRA_BUF_SIZE (1 << 14) + +typedef struct +{ + size_t bufPos; + size_t bufConv; + size_t bufTotal; + + UInt32 methodId; + int encodeMode; + UInt32 delta; + UInt32 ip; + UInt32 x86State; + Byte deltaState[DELTA_STATE_SIZE]; + + Byte buf[BRA_BUF_SIZE]; +} CBraState; + +void BraState_Free(void *pp, ISzAlloc *alloc) +{ + alloc->Free(alloc, pp); +} + +SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + CBraState *p = ((CBraState *)pp); + alloc = alloc; + p->encodeMode = 0; + p->ip = 0; + if (p->methodId == XZ_ID_Delta) + { + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + p->delta = (unsigned)props[0] + 1; + } + else + { + if (propSize == 4) + { + UInt32 v = GetUi32(props); + switch(p->methodId) + { + case XZ_ID_PPC: + case XZ_ID_ARM: + case XZ_ID_SPARC: + if ((v & 3) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_ARMT: + if ((v & 1) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_IA64: + if ((v & 0xF) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + } + p->ip = v; + } + else if (propSize != 0) + return SZ_ERROR_UNSUPPORTED; + } + return SZ_OK; +} + +void BraState_Init(void *pp) +{ + CBraState *p = ((CBraState *)pp); + p->bufPos = p->bufConv = p->bufTotal = 0; + x86_Convert_Init(p->x86State); + if (p->methodId == XZ_ID_Delta) + Delta_Init(p->deltaState); +} + +#define CASE_BRA_CONV(isa) case XZ_ID_ ## isa: p->bufConv = isa ## _Convert(p->buf, p->bufTotal, p->ip, p->encodeMode); break; + +static SRes BraState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + CBraState *p = ((CBraState *)pp); + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + *destLen = 0; + *srcLen = 0; + finishMode = finishMode; + *wasFinished = 0; + while (destLenOrig > 0) + { + if (p->bufPos != p->bufConv) + { + size_t curSize = p->bufConv - p->bufPos; + if (curSize > destLenOrig) + curSize = destLenOrig; + memcpy(dest, p->buf + p->bufPos, curSize); + p->bufPos += curSize; + *destLen += curSize; + dest += curSize; + destLenOrig -= curSize; + continue; + } + p->bufTotal -= p->bufPos; + memmove(p->buf, p->buf + p->bufPos, p->bufTotal); + p->bufPos = 0; + p->bufConv = 0; + { + size_t curSize = BRA_BUF_SIZE - p->bufTotal; + if (curSize > srcLenOrig) + curSize = srcLenOrig; + memcpy(p->buf + p->bufTotal, src, curSize); + *srcLen += curSize; + src += curSize; + srcLenOrig -= curSize; + p->bufTotal += curSize; + } + if (p->bufTotal == 0) + break; + switch(p->methodId) + { + case XZ_ID_Delta: + if (p->encodeMode) + Delta_Encode(p->deltaState, p->delta, p->buf, p->bufTotal); + else + Delta_Decode(p->deltaState, p->delta, p->buf, p->bufTotal); + p->bufConv = p->bufTotal; + break; + case XZ_ID_X86: + p->bufConv = x86_Convert(p->buf, p->bufTotal, p->ip, &p->x86State, p->encodeMode); + break; + CASE_BRA_CONV(PPC) + CASE_BRA_CONV(IA64) + CASE_BRA_CONV(ARM) + CASE_BRA_CONV(ARMT) + CASE_BRA_CONV(SPARC) + default: + return SZ_ERROR_UNSUPPORTED; + } + p->ip += (UInt32)p->bufConv; + + if (p->bufConv == 0) + { + if (!srcWasFinished) + break; + p->bufConv = p->bufTotal; + } + } + if (p->bufTotal == p->bufPos && srcLenOrig == 0 && srcWasFinished) + *wasFinished = 1; + return SZ_OK; +} + +SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, ISzAlloc *alloc) +{ + CBraState *decoder; + if (id != XZ_ID_Delta && + id != XZ_ID_X86 && + id != XZ_ID_PPC && + id != XZ_ID_IA64 && + id != XZ_ID_ARM && + id != XZ_ID_ARMT && + id != XZ_ID_SPARC) + return SZ_ERROR_UNSUPPORTED; + p->p = 0; + decoder = alloc->Alloc(alloc, sizeof(CBraState)); + if (decoder == 0) + return SZ_ERROR_MEM; + decoder->methodId = (UInt32)id; + p->p = decoder; + p->Free = BraState_Free; + p->SetProps = BraState_SetProps; + p->Init = BraState_Init; + p->Code = BraState_Code; + return SZ_OK; +} + +/* ---------- SbState ---------- */ + +#ifdef USE_SUBBLOCK + +static void SbState_Free(void *pp, ISzAlloc *alloc) +{ + CSubblockDec *p = (CSubblockDec *)pp; + SubblockDec_Free(p, alloc); + alloc->Free(alloc, pp); +} + +static SRes SbState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + pp = pp; + props = props; + alloc = alloc; + return (propSize == 0) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static void SbState_Init(void *pp) +{ + SubblockDec_Init((CSubblockDec *)pp); +} + +static SRes SbState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + ECoderStatus status; + SRes res = SubblockDec_Decode((CSubblockDec *)pp, dest, destLen, src, srcLen, finishMode, &status); + srcWasFinished = srcWasFinished; + *wasFinished = (status == LZMA_STATUS_FINISHED_WITH_MARK); + return res; +} + +SRes SbState_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CSubblockDec *decoder; + p->p = 0; + decoder = alloc->Alloc(alloc, sizeof(CSubblockDec)); + if (decoder == 0) + return SZ_ERROR_MEM; + p->p = decoder; + p->Free = SbState_Free; + p->SetProps = SbState_SetProps; + p->Init = SbState_Init; + p->Code = SbState_Code; + SubblockDec_Construct(decoder); + return SZ_OK; +} +#endif + +/* ---------- Lzma2State ---------- */ + +static void Lzma2State_Free(void *pp, ISzAlloc *alloc) +{ + Lzma2Dec_Free((CLzma2Dec *)pp, alloc); + alloc->Free(alloc, pp); +} + +static SRes Lzma2State_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + return Lzma2Dec_Allocate((CLzma2Dec *)pp, props[0], alloc); +} + +static void Lzma2State_Init(void *pp) +{ + Lzma2Dec_Init((CLzma2Dec *)pp); +} + +static SRes Lzma2State_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + ELzmaStatus status; + /* ELzmaFinishMode fm = (finishMode == LZMA_FINISH_ANY) ? LZMA_FINISH_ANY : LZMA_FINISH_END; */ + SRes res = Lzma2Dec_DecodeToBuf((CLzma2Dec *)pp, dest, destLen, src, srcLen, finishMode, &status); + srcWasFinished = srcWasFinished; + *wasFinished = (status == LZMA_STATUS_FINISHED_WITH_MARK); + return res; +} + +static SRes Lzma2State_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CLzma2Dec *decoder = alloc->Alloc(alloc, sizeof(CLzma2Dec)); + p->p = decoder; + if (decoder == 0) + return SZ_ERROR_MEM; + p->Free = Lzma2State_Free; + p->SetProps = Lzma2State_SetProps; + p->Init = Lzma2State_Init; + p->Code = Lzma2State_Code; + Lzma2Dec_Construct(decoder); + return SZ_OK; +} + + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc) +{ + int i; + p->alloc = alloc; + p->buf = 0; + p->numCoders = 0; + for (i = 0; i < MIXCODER_NUM_FILTERS_MAX; i++) + p->coders[i].p = NULL; +} + +void MixCoder_Free(CMixCoder *p) +{ + int i; + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *sc = &p->coders[i]; + if (p->alloc && sc->p) + sc->Free(sc->p, p->alloc); + } + p->numCoders = 0; + if (p->buf) + p->alloc->Free(p->alloc, p->buf); +} + +void MixCoder_Init(CMixCoder *p) +{ + int i; + for (i = 0; i < p->numCoders - 1; i++) + { + p->size[i] = 0; + p->pos[i] = 0; + p->finished[i] = 0; + } + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *coder = &p->coders[i]; + coder->Init(coder->p); + } +} + +SRes MixCoder_SetFromMethod(CMixCoder *p, int coderIndex, UInt64 methodId) +{ + IStateCoder *sc = &p->coders[coderIndex]; + p->ids[coderIndex] = methodId; + switch(methodId) + { + case XZ_ID_LZMA2: return Lzma2State_SetFromMethod(sc, p->alloc); + #ifdef USE_SUBBLOCK + case XZ_ID_Subblock: return SbState_SetFromMethod(sc, p->alloc); + #endif + } + if (coderIndex == 0) + return SZ_ERROR_UNSUPPORTED; + return BraState_SetFromMethod(sc, methodId, p->alloc); +} + +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + Bool allFinished = True; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_FINISHED; + + if (p->buf == 0) + { + p->buf = p->alloc->Alloc(p->alloc, CODER_BUF_SIZE * (MIXCODER_NUM_FILTERS_MAX - 1)); + if (p->buf == 0) + return SZ_ERROR_MEM; + } + + if (p->numCoders != 1) + finishMode = CODER_FINISH_ANY; + + for (;;) + { + Bool processed = False; + int i; + /* + if (p->numCoders == 1 && *destLen == destLenOrig && finishMode == LZMA_FINISH_ANY) + break; + */ + + for (i = 0; i < p->numCoders; i++) + { + SRes res; + IStateCoder *coder = &p->coders[i]; + Byte *destCur; + SizeT destLenCur, srcLenCur; + const Byte *srcCur; + int srcFinishedCur; + int encodingWasFinished; + + if (i == 0) + { + srcCur = src; + srcLenCur = srcLenOrig - *srcLen; + srcFinishedCur = srcWasFinished; + } + else + { + srcCur = p->buf + (CODER_BUF_SIZE * (i - 1)) + p->pos[i - 1]; + srcLenCur = p->size[i - 1] - p->pos[i - 1]; + srcFinishedCur = p->finished[i - 1]; + } + + if (i == p->numCoders - 1) + { + destCur = dest; + destLenCur = destLenOrig - *destLen; + } + else + { + if (p->pos[i] != p->size[i]) + continue; + destCur = p->buf + (CODER_BUF_SIZE * i); + destLenCur = CODER_BUF_SIZE; + } + + res = coder->Code(coder->p, destCur, &destLenCur, srcCur, &srcLenCur, srcFinishedCur, finishMode, &encodingWasFinished); + + if (!encodingWasFinished) + allFinished = False; + + if (i == 0) + { + *srcLen += srcLenCur; + src += srcLenCur; + } + else + { + p->pos[i - 1] += srcLenCur; + } + + if (i == p->numCoders - 1) + { + *destLen += destLenCur; + dest += destLenCur; + } + else + { + p->size[i] = destLenCur; + p->pos[i] = 0; + p->finished[i] = encodingWasFinished; + } + + if (res != SZ_OK) + return res; + + if (destLenCur != 0 || srcLenCur != 0) + processed = True; + } + if (!processed) + break; + } + if (allFinished) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf) +{ + *p = (CXzStreamFlags)GetBe16(buf + XZ_SIG_SIZE); + if (CrcCalc(buf + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE) != + GetUi32(buf + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE)) + return SZ_ERROR_NO_ARCHIVE; + return XzFlags_IsSupported(*p) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static Bool Xz_CheckFooter(CXzStreamFlags flags, UInt64 indexSize, const Byte *buf) +{ + return + indexSize == (((UInt64)GetUi32(buf + 4) + 1) << 2) && + (GetUi32(buf) == CrcCalc(buf + 4, 6) && + flags == GetBe16(buf + 8) && + memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) == 0); +} + +#define READ_VARINT_AND_CHECK(buf, pos, size, res) \ + { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \ + if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; } + + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header) +{ + unsigned pos; + int numFilters, i; + UInt32 headerSize = (UInt32)header[0] << 2; + + if (CrcCalc(header, headerSize) != GetUi32(header + headerSize)) + return SZ_ERROR_ARCHIVE; + + pos = 1; + if (pos == headerSize) + return SZ_ERROR_ARCHIVE; + p->flags = header[pos++]; + + if (XzBlock_HasPackSize(p)) + { + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize); + if (p->packSize == 0 || p->packSize + headerSize >= (UInt64)1 << 63) + return SZ_ERROR_ARCHIVE; + } + + if (XzBlock_HasUnpackSize(p)) + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize); + + numFilters = XzBlock_GetNumFilters(p); + for (i = 0; i < numFilters; i++) + { + CXzFilter *filter = p->filters + i; + UInt64 size; + READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id); + READ_VARINT_AND_CHECK(header, pos, headerSize, &size); + if (size > headerSize - pos || size > XZ_FILTER_PROPS_SIZE_MAX) + return SZ_ERROR_ARCHIVE; + filter->propsSize = (UInt32)size; + memcpy(filter->props, header + pos, (size_t)size); + pos += (unsigned)size; + + #ifdef XZ_DUMP + printf("\nf[%d] = %2X: ", i, filter->id); + { + int i; + for (i = 0; i < size; i++) + printf(" %2X", filter->props[i]); + } + #endif + } + + while (pos < headerSize) + if (header[pos++] != 0) + return SZ_ERROR_ARCHIVE; + return SZ_OK; +} + +SRes XzDec_Init(CMixCoder *p, const CXzBlock *block) +{ + int i; + Bool needReInit = True; + int numFilters = XzBlock_GetNumFilters(block); + if (numFilters == p->numCoders) + { + for (i = 0; i < numFilters; i++) + if (p->ids[i] != block->filters[numFilters - 1 - i].id) + break; + needReInit = (i != numFilters); + } + if (needReInit) + { + MixCoder_Free(p); + p->numCoders = numFilters; + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + RINOK(MixCoder_SetFromMethod(p, i, f->id)); + } + } + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + IStateCoder *sc = &p->coders[i]; + RINOK(sc->SetProps(sc->p, f->props, f->propsSize, p->alloc)); + } + MixCoder_Init(p); + return SZ_OK; +} + +SRes XzUnpacker_Create(CXzUnpacker *p, ISzAlloc *alloc) +{ + MixCoder_Construct(&p->decoder, alloc); + p->state = XZ_STATE_STREAM_HEADER; + p->pos = 0; + p->numStreams = 0; + return SZ_OK; +} + +void XzUnpacker_Free(CXzUnpacker *p) +{ + MixCoder_Free(&p->decoder); +} + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_SPECIFIED; + for (;;) + { + SizeT srcRem = srcLenOrig - *srcLen; + + if (p->state == XZ_STATE_BLOCK) + { + SizeT destLen2 = destLenOrig - *destLen; + SizeT srcLen2 = srcLenOrig - *srcLen; + SRes res; + if (srcLen2 == 0 && destLen2 == 0) + { + *status = CODER_STATUS_NOT_FINISHED; + return SZ_OK; + } + + res = MixCoder_Code(&p->decoder, dest, &destLen2, src, &srcLen2, False, finishMode, status); + XzCheck_Update(&p->check, dest, destLen2); + + (*srcLen) += srcLen2; + src += srcLen2; + p->packSize += srcLen2; + + (*destLen) += destLen2; + dest += destLen2; + p->unpackSize += destLen2; + + RINOK(res); + + if (*status == CODER_STATUS_FINISHED_WITH_MARK) + { + Byte temp[32]; + unsigned num = Xz_WriteVarInt(temp, p->packSize + p->blockHeaderSize + XzFlags_GetCheckSize(p->streamFlags)); + num += Xz_WriteVarInt(temp + num, p->unpackSize); + Sha256_Update(&p->sha, temp, num); + p->indexSize += num; + p->numBlocks++; + + p->state = XZ_STATE_BLOCK_FOOTER; + p->pos = 0; + p->alignPos = 0; + } + else if (srcLen2 == 0 && destLen2 == 0) + return SZ_OK; + + continue; + } + + if (srcRem == 0) + { + *status = CODER_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + switch(p->state) + { + case XZ_STATE_STREAM_HEADER: + { + if (p->pos < XZ_STREAM_HEADER_SIZE) + { + if (p->pos < XZ_SIG_SIZE && *src != XZ_SIG[p->pos]) + return SZ_ERROR_NO_ARCHIVE; + p->buf[p->pos++] = *src++; + (*srcLen)++; + } + else + { + RINOK(Xz_ParseHeader(&p->streamFlags, p->buf)); + p->state = XZ_STATE_BLOCK_HEADER; + Sha256_Init(&p->sha); + p->indexSize = 0; + p->numBlocks = 0; + p->pos = 0; + } + break; + } + + case XZ_STATE_BLOCK_HEADER: + { + if (p->pos == 0) + { + p->buf[p->pos++] = *src++; + (*srcLen)++; + if (p->buf[0] == 0) + { + p->indexPreSize = 1 + Xz_WriteVarInt(p->buf + 1, p->numBlocks); + p->indexPos = p->indexPreSize; + p->indexSize += p->indexPreSize; + Sha256_Final(&p->sha, p->shaDigest); + Sha256_Init(&p->sha); + p->crc = CrcUpdate(CRC_INIT_VAL, p->buf, p->indexPreSize); + p->state = XZ_STATE_STREAM_INDEX; + } + p->blockHeaderSize = ((UInt32)p->buf[0] << 2) + 4; + } + else if (p->pos != p->blockHeaderSize) + { + UInt32 cur = p->blockHeaderSize - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + RINOK(XzBlock_Parse(&p->block, p->buf)); + p->state = XZ_STATE_BLOCK; + p->packSize = 0; + p->unpackSize = 0; + XzCheck_Init(&p->check, XzFlags_GetCheckType(p->streamFlags)); + RINOK(XzDec_Init(&p->decoder, &p->block)); + } + break; + } + + case XZ_STATE_BLOCK_FOOTER: + { + if (((p->packSize + p->alignPos) & 3) != 0) + { + (*srcLen)++; + p->alignPos++; + if (*src++ != 0) + return SZ_ERROR_CRC; + } + else + { + UInt32 checkSize = XzFlags_GetCheckSize(p->streamFlags); + UInt32 cur = checkSize - p->pos; + if (cur != 0) + { + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + Byte digest[XZ_CHECK_SIZE_MAX]; + p->state = XZ_STATE_BLOCK_HEADER; + p->pos = 0; + if (XzCheck_Final(&p->check, digest) && memcmp(digest, p->buf, checkSize) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX: + { + if (p->pos < p->indexPreSize) + { + (*srcLen)++; + if (*src++ != p->buf[p->pos++]) + return SZ_ERROR_CRC; + } + else + { + if (p->indexPos < p->indexSize) + { + UInt64 cur = p->indexSize - p->indexPos; + if (srcRem > cur) + srcRem = (SizeT)cur; + p->crc = CrcUpdate(p->crc, src, srcRem); + Sha256_Update(&p->sha, src, srcRem); + (*srcLen) += srcRem; + src += srcRem; + p->indexPos += srcRem; + } + else if ((p->indexPos & 3) != 0) + { + Byte b = *src++; + p->crc = CRC_UPDATE_BYTE(p->crc, b); + (*srcLen)++; + p->indexPos++; + p->indexSize++; + if (b != 0) + return SZ_ERROR_CRC; + } + else + { + Byte digest[SHA256_DIGEST_SIZE]; + p->state = XZ_STATE_STREAM_INDEX_CRC; + p->indexSize += 4; + p->pos = 0; + Sha256_Final(&p->sha, digest); + if (memcmp(digest, p->shaDigest, SHA256_DIGEST_SIZE) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX_CRC: + { + if (p->pos < 4) + { + (*srcLen)++; + p->buf[p->pos++] = *src++; + } + else + { + p->state = XZ_STATE_STREAM_FOOTER; + p->pos = 0; + if (CRC_GET_DIGEST(p->crc) != GetUi32(p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_FOOTER: + { + UInt32 cur = XZ_STREAM_FOOTER_SIZE - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + if (p->pos == XZ_STREAM_FOOTER_SIZE) + { + p->state = XZ_STATE_STREAM_PADDING; + p->numStreams++; + p->padSize = 0; + if (!Xz_CheckFooter(p->streamFlags, p->indexSize, p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_PADDING: + { + if (*src != 0) + { + if (((UInt32)p->padSize & 3) != 0) + return SZ_ERROR_NO_ARCHIVE; + p->pos = 0; + p->state = XZ_STATE_STREAM_HEADER; + } + else + { + (*srcLen)++; + src++; + p->padSize++; + } + break; + } + + case XZ_STATE_BLOCK: break; /* to disable GCC warning */ + } + } + /* + if (p->state == XZ_STATE_FINISHED) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; + */ +} + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p) +{ + return (p->state == XZ_STATE_STREAM_PADDING) && (((UInt32)p->padSize & 3) == 0); +} diff --git a/src/ZipLib/extlibs/lzma/unix/XzEnc.c b/src/ZipLib/extlibs/lzma/unix/XzEnc.c new file mode 100644 index 00000000..721b4e76 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzEnc.c @@ -0,0 +1,497 @@ +/* XzEnc.c -- Xz Encode +2009-06-04 : Igor Pavlov : Public domain */ + +#include +#include + +#include "7zCrc.h" +#include "Alloc.h" +#include "Bra.h" +#include "CpuArch.h" +#ifdef USE_SUBBLOCK +#include "SbEnc.h" +#endif + +#include "XzEnc.h" + +static void *SzBigAlloc(void *p, size_t size) { p = p; return BigAlloc(size); } +static void SzBigFree(void *p, void *address) { p = p; BigFree(address); } +static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree }; + +static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } +static void SzFree(void *p, void *address) { p = p; MyFree(address); } +static ISzAlloc g_Alloc = { SzAlloc, SzFree }; + +#define XzBlock_ClearFlags(p) (p)->flags = 0; +#define XzBlock_SetNumFilters(p, n) (p)->flags |= ((n) - 1); +#define XzBlock_SetHasPackSize(p) (p)->flags |= XZ_BF_PACK_SIZE; +#define XzBlock_SetHasUnpackSize(p) (p)->flags |= XZ_BF_UNPACK_SIZE; + +static SRes WriteBytes(ISeqOutStream *s, const void *buf, UInt32 size) +{ + return (s->Write(s, buf, size) == size) ? SZ_OK : SZ_ERROR_WRITE; +} + +static SRes WriteBytesAndCrc(ISeqOutStream *s, const void *buf, UInt32 size, UInt32 *crc) +{ + *crc = CrcUpdate(*crc, buf, size); + return WriteBytes(s, buf, size); +} + +SRes Xz_WriteHeader(CXzStreamFlags f, ISeqOutStream *s) +{ + UInt32 crc; + Byte header[XZ_STREAM_HEADER_SIZE]; + memcpy(header, XZ_SIG, XZ_SIG_SIZE); + header[XZ_SIG_SIZE] = (Byte)(f >> 8); + header[XZ_SIG_SIZE + 1] = (Byte)(f & 0xFF); + crc = CrcCalc(header + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE); + SetUi32(header + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE, crc); + return WriteBytes(s, header, XZ_STREAM_HEADER_SIZE); +} + +SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s) +{ + Byte header[XZ_BLOCK_HEADER_SIZE_MAX]; + + unsigned pos = 1; + int numFilters, i; + header[pos++] = p->flags; + + if (XzBlock_HasPackSize(p)) pos += Xz_WriteVarInt(header + pos, p->packSize); + if (XzBlock_HasUnpackSize(p)) pos += Xz_WriteVarInt(header + pos, p->unpackSize); + numFilters = XzBlock_GetNumFilters(p); + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &p->filters[i]; + pos += Xz_WriteVarInt(header + pos, f->id); + pos += Xz_WriteVarInt(header + pos, f->propsSize); + memcpy(header + pos, f->props, f->propsSize); + pos += f->propsSize; + } + while((pos & 3) != 0) + header[pos++] = 0; + header[0] = (Byte)(pos >> 2); + SetUi32(header + pos, CrcCalc(header, pos)); + return WriteBytes(s, header, pos + 4); +} + +SRes Xz_WriteFooter(CXzStream *p, ISeqOutStream *s) +{ + Byte buf[32]; + UInt64 globalPos; + { + UInt32 crc = CRC_INIT_VAL; + unsigned pos = 1 + Xz_WriteVarInt(buf + 1, p->numBlocks); + size_t i; + + globalPos = pos; + buf[0] = 0; + RINOK(WriteBytesAndCrc(s, buf, pos, &crc)); + for (i = 0; i < p->numBlocks; i++) + { + const CXzBlockSizes *block = &p->blocks[i]; + pos = Xz_WriteVarInt(buf, block->totalSize); + pos += Xz_WriteVarInt(buf + pos, block->unpackSize); + globalPos += pos; + RINOK(WriteBytesAndCrc(s, buf, pos, &crc)); + } + pos = ((unsigned)globalPos & 3); + if (pos != 0) + { + buf[0] = buf[1] = buf[2] = 0; + RINOK(WriteBytesAndCrc(s, buf, 4 - pos, &crc)); + globalPos += 4 - pos; + } + { + SetUi32(buf, CRC_GET_DIGEST(crc)); + RINOK(WriteBytes(s, buf, 4)); + globalPos += 4; + } + } + + { + UInt32 indexSize = (UInt32)((globalPos >> 2) - 1); + SetUi32(buf + 4, indexSize); + buf[8] = (Byte)(p->flags >> 8); + buf[9] = (Byte)(p->flags & 0xFF); + SetUi32(buf, CrcCalc(buf + 4, 6)); + memcpy(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE); + return WriteBytes(s, buf, 12); + } +} + +SRes Xz_AddIndexRecord(CXzStream *p, UInt64 unpackSize, UInt64 totalSize, ISzAlloc *alloc) +{ + if (p->blocks == 0 || p->numBlocksAllocated == p->numBlocks) + { + size_t num = (p->numBlocks + 1) * 2; + size_t newSize = sizeof(CXzBlockSizes) * num; + CXzBlockSizes *blocks; + if (newSize / sizeof(CXzBlockSizes) != num) + return SZ_ERROR_MEM; + blocks = alloc->Alloc(alloc, newSize); + if (blocks == 0) + return SZ_ERROR_MEM; + if (p->numBlocks != 0) + { + memcpy(blocks, p->blocks, p->numBlocks * sizeof(CXzBlockSizes)); + Xz_Free(p, alloc); + } + p->blocks = blocks; + p->numBlocksAllocated = num; + } + { + CXzBlockSizes *block = &p->blocks[p->numBlocks++]; + block->totalSize = totalSize; + block->unpackSize = unpackSize; + } + return SZ_OK; +} + +/* ---------- CSeqCheckInStream ---------- */ + +typedef struct +{ + ISeqInStream p; + ISeqInStream *realStream; + UInt64 processed; + CXzCheck check; +} CSeqCheckInStream; + +void SeqCheckInStream_Init(CSeqCheckInStream *p, int mode) +{ + p->processed = 0; + XzCheck_Init(&p->check, mode); +} + +void SeqCheckInStream_GetDigest(CSeqCheckInStream *p, Byte *digest) +{ + XzCheck_Final(&p->check, digest); +} + +static SRes SeqCheckInStream_Read(void *pp, void *data, size_t *size) +{ + CSeqCheckInStream *p = (CSeqCheckInStream *)pp; + SRes res = p->realStream->Read(p->realStream, data, size); + XzCheck_Update(&p->check, data, *size); + p->processed += *size; + return res; +} + +/* ---------- CSeqSizeOutStream ---------- */ + +typedef struct +{ + ISeqOutStream p; + ISeqOutStream *realStream; + UInt64 processed; +} CSeqSizeOutStream; + +static size_t MyWrite(void *pp, const void *data, size_t size) +{ + CSeqSizeOutStream *p = (CSeqSizeOutStream *)pp; + size = p->realStream->Write(p->realStream, data, size); + p->processed += size; + return size; +} + +/* ---------- CSeqInFilter ---------- */ + +/* +typedef struct _IFilter +{ + void *p; + void (*Free)(void *p, ISzAlloc *alloc); + SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAlloc *alloc); + void (*Init)(void *p); + size_t (*Filter)(void *p, Byte *data, SizeT destLen); +} IFilter; + +#define FILT_BUF_SIZE (1 << 19) + +typedef struct +{ + ISeqInStream p; + ISeqInStream *realStream; + UInt32 x86State; + UInt32 ip; + UInt64 processed; + CXzCheck check; + Byte buf[FILT_BUF_SIZE]; + UInt32 bufferPos; + UInt32 convertedPosBegin; + UInt32 convertedPosEnd; + IFilter *filter; +} CSeqInFilter; + +static SRes SeqInFilter_Read(void *pp, void *data, size_t *size) +{ + CSeqInFilter *p = (CSeqInFilter *)pp; + size_t remSize = *size; + *size = 0; + + while (remSize > 0) + { + int i; + if (p->convertedPosBegin != p->convertedPosEnd) + { + UInt32 sizeTemp = p->convertedPosEnd - p->convertedPosBegin; + if (remSize < sizeTemp) + sizeTemp = (UInt32)remSize; + memmove(data, p->buf + p->convertedPosBegin, sizeTemp); + p->convertedPosBegin += sizeTemp; + data = (void *)((Byte *)data + sizeTemp); + remSize -= sizeTemp; + *size += sizeTemp; + break; + } + for (i = 0; p->convertedPosEnd + i < p->bufferPos; i++) + p->buf[i] = p->buf[i + p->convertedPosEnd]; + p->bufferPos = i; + p->convertedPosBegin = p->convertedPosEnd = 0; + { + size_t processedSizeTemp = FILT_BUF_SIZE - p->bufferPos; + RINOK(p->realStream->Read(p->realStream, p->buf + p->bufferPos, &processedSizeTemp)); + p->bufferPos = p->bufferPos + (UInt32)processedSizeTemp; + } + p->convertedPosEnd = (UInt32)p->filter->Filter(p->filter->p, p->buf, p->bufferPos); + if (p->convertedPosEnd == 0) + { + if (p->bufferPos == 0) + break; + else + { + p->convertedPosEnd = p->bufferPos; + continue; + } + } + if (p->convertedPosEnd > p->bufferPos) + { + for (; p->bufferPos < p->convertedPosEnd; p->bufferPos++) + p->buf[p->bufferPos] = 0; + p->convertedPosEnd = (UInt32)p->filter->Filter(p->filter->p, p->buf, p->bufferPos); + } + } + return SZ_OK; +} +*/ + +/* +typedef struct +{ + ISeqInStream p; + ISeqInStream *realStream; + CMixCoder mixCoder; + Byte buf[FILT_BUF_SIZE]; + UInt32 bufPos; + UInt32 bufSize; +} CMixCoderSeqInStream; + +static SRes CMixCoderSeqInStream_Read(void *pp, void *data, size_t *size) +{ + CMixCoderSeqInStream *p = (CMixCoderSeqInStream *)pp; + SRes res = SZ_OK; + size_t remSize = *size; + *size = 0; + while (remSize > 0) + { + if (p->bufPos == p->bufSize) + { + size_t curSize; + p->bufPos = p->bufSize = 0; + if (*size != 0) + break; + curSize = FILT_BUF_SIZE; + RINOK(p->realStream->Read(p->realStream, p->buf, &curSize)); + p->bufSize = (UInt32)curSize; + } + { + SizeT destLen = remSize; + SizeT srcLen = p->bufSize - p->bufPos; + res = MixCoder_Code(&p->mixCoder, data, &destLen, p->buf + p->bufPos, &srcLen, 0); + data = (void *)((Byte *)data + destLen); + remSize -= destLen; + *size += destLen; + p->bufPos += srcLen; + } + } + return res; +} +*/ + +#ifdef USE_SUBBLOCK +typedef struct +{ + ISeqInStream p; + CSubblockEnc sb; + UInt64 processed; +} CSbEncInStream; + +void SbEncInStream_Init(CSbEncInStream *p) +{ + p->processed = 0; + SubblockEnc_Init(&p->sb); +} + +static SRes SbEncInStream_Read(void *pp, void *data, size_t *size) +{ + CSbEncInStream *p = (CSbEncInStream *)pp; + SRes res = SubblockEnc_Read(&p->sb, data, size); + p->processed += *size; + return res; +} +#endif + +typedef struct +{ + /* CMixCoderSeqInStream inStream; */ + CLzma2EncHandle lzma2; + #ifdef USE_SUBBLOCK + CSbEncInStream sb; + #endif + ISzAlloc *alloc; + ISzAlloc *bigAlloc; +} CLzma2WithFilters; + + +static void Lzma2WithFilters_Construct(CLzma2WithFilters *p, ISzAlloc *alloc, ISzAlloc *bigAlloc) +{ + p->alloc = alloc; + p->bigAlloc = bigAlloc; + p->lzma2 = NULL; + #ifdef USE_SUBBLOCK + p->sb.p.Read = SbEncInStream_Read; + SubblockEnc_Construct(&p->sb.sb, p->alloc); + #endif +} + +static SRes Lzma2WithFilters_Create(CLzma2WithFilters *p) +{ + p->lzma2 = Lzma2Enc_Create(p->alloc, p->bigAlloc); + if (p->lzma2 == 0) + return SZ_ERROR_MEM; + return SZ_OK; +} + +static void Lzma2WithFilters_Free(CLzma2WithFilters *p) +{ + #ifdef USE_SUBBLOCK + SubblockEnc_Free(&p->sb.sb); + #endif + if (p->lzma2) + { + Lzma2Enc_Destroy(p->lzma2); + p->lzma2 = NULL; + } +} + +static SRes Xz_Compress(CXzStream *xz, + CLzma2WithFilters *lzmaf, + ISeqOutStream *outStream, + ISeqInStream *inStream, + const CLzma2EncProps *lzma2Props, + Bool useSubblock, + ICompressProgress *progress) +{ + xz->flags = XZ_CHECK_CRC32; + + RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, lzma2Props)); + RINOK(Xz_WriteHeader(xz->flags, outStream)); + + { + CSeqCheckInStream checkInStream; + CSeqSizeOutStream seqSizeOutStream; + CXzBlock block; + int filterIndex = 0; + + XzBlock_ClearFlags(&block); + XzBlock_SetNumFilters(&block, 1 + (useSubblock ? 1 : 0)); + + if (useSubblock) + { + CXzFilter *f = &block.filters[filterIndex++]; + f->id = XZ_ID_Subblock; + f->propsSize = 0; + } + + { + CXzFilter *f = &block.filters[filterIndex++]; + f->id = XZ_ID_LZMA2; + f->propsSize = 1; + f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2); + } + + seqSizeOutStream.p.Write = MyWrite; + seqSizeOutStream.realStream = outStream; + seqSizeOutStream.processed = 0; + + RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p)); + + checkInStream.p.Read = SeqCheckInStream_Read; + checkInStream.realStream = inStream; + SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags)); + + #ifdef USE_SUBBLOCK + if (useSubblock) + { + lzmaf->sb.sb.inStream = &checkInStream.p; + SubblockEnc_Init(&lzmaf->sb.sb); + } + #endif + + { + UInt64 packPos = seqSizeOutStream.processed; + SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p, + #ifdef USE_SUBBLOCK + useSubblock ? &lzmaf->sb.p: + #endif + &checkInStream.p, + progress); + RINOK(res); + block.unpackSize = checkInStream.processed; + block.packSize = seqSizeOutStream.processed - packPos; + } + + { + unsigned padSize = 0; + Byte buf[128]; + while((((unsigned)block.packSize + padSize) & 3) != 0) + buf[padSize++] = 0; + SeqCheckInStream_GetDigest(&checkInStream, buf + padSize); + RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags))); + RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc)); + } + } + return Xz_WriteFooter(xz, outStream); +} + +SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, + const CLzma2EncProps *lzma2Props, Bool useSubblock, + ICompressProgress *progress) +{ + SRes res; + CXzStream xz; + CLzma2WithFilters lzmaf; + Xz_Construct(&xz); + Lzma2WithFilters_Construct(&lzmaf, &g_Alloc, &g_BigAlloc); + res = Lzma2WithFilters_Create(&lzmaf); + if (res == SZ_OK) + res = Xz_Compress(&xz, &lzmaf, outStream, inStream, + lzma2Props, useSubblock, progress); + Lzma2WithFilters_Free(&lzmaf); + Xz_Free(&xz, &g_Alloc); + return res; +} + +SRes Xz_EncodeEmpty(ISeqOutStream *outStream) +{ + SRes res; + CXzStream xz; + Xz_Construct(&xz); + res = Xz_WriteHeader(xz.flags, outStream); + if (res == SZ_OK) + res = Xz_WriteFooter(&xz, outStream); + Xz_Free(&xz, &g_Alloc); + return res; +} diff --git a/src/ZipLib/extlibs/lzma/unix/XzEnc.h b/src/ZipLib/extlibs/lzma/unix/XzEnc.h new file mode 100644 index 00000000..13390df8 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzEnc.h @@ -0,0 +1,25 @@ +/* XzEnc.h -- Xz Encode +2009-04-15 : Igor Pavlov : Public domain */ + +#ifndef __XZ_ENC_H +#define __XZ_ENC_H + +#include "Lzma2Enc.h" + +#include "Xz.h" + +#ifdef __cplusplus +extern "C" { +#endif + +SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, + const CLzma2EncProps *lzma2Props, Bool useSubblock, + ICompressProgress *progress); + +SRes Xz_EncodeEmpty(ISeqOutStream *outStream); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/ZipLib/extlibs/lzma/unix/XzIn.c b/src/ZipLib/extlibs/lzma/unix/XzIn.c new file mode 100644 index 00000000..f8ea8631 --- /dev/null +++ b/src/ZipLib/extlibs/lzma/unix/XzIn.c @@ -0,0 +1,306 @@ +/* XzIn.c - Xz input +2009-06-19 : Igor Pavlov : Public domain */ + +#include + +#include "7zCrc.h" +#include "CpuArch.h" +#include "Xz.h" + +SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream) +{ + Byte sig[XZ_STREAM_HEADER_SIZE]; + RINOK(SeqInStream_Read2(inStream, sig, XZ_STREAM_HEADER_SIZE, SZ_ERROR_NO_ARCHIVE)); + if (memcmp(sig, XZ_SIG, XZ_SIG_SIZE) != 0) + return SZ_ERROR_NO_ARCHIVE; + return Xz_ParseHeader(p, sig); +} + +#define READ_VARINT_AND_CHECK(buf, pos, size, res) \ + { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \ + if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; } + +SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes) +{ + Byte header[XZ_BLOCK_HEADER_SIZE_MAX]; + unsigned headerSize; + *headerSizeRes = 0; + RINOK(SeqInStream_ReadByte(inStream, &header[0])); + headerSize = ((unsigned)header[0] << 2) + 4; + if (headerSize == 0) + { + *headerSizeRes = 1; + *isIndex = True; + return SZ_OK; + } + + *isIndex = False; + *headerSizeRes = headerSize; + RINOK(SeqInStream_Read(inStream, header + 1, headerSize - 1)); + return XzBlock_Parse(p, header); +} + +#define ADD_SIZE_CHECH(size, val) \ + { UInt64 newSize = size + (val); if (newSize < size) return XZ_SIZE_OVERFLOW; size = newSize; } + +UInt64 Xz_GetUnpackSize(const CXzStream *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->numBlocks; i++) + ADD_SIZE_CHECH(size, p->blocks[i].unpackSize); + return size; +} + +UInt64 Xz_GetPackSize(const CXzStream *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->numBlocks; i++) + ADD_SIZE_CHECH(size, (p->blocks[i].totalSize + 3) & ~(UInt64)3); + return size; +} + +/* +SRes XzBlock_ReadFooter(CXzBlock *p, CXzStreamFlags f, ISeqInStream *inStream) +{ + return SeqInStream_Read(inStream, p->check, XzFlags_GetCheckSize(f)); +} +*/ + +static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *alloc) +{ + size_t i, numBlocks, crcStartPos, pos = 1; + UInt32 crc; + + if (size < 5 || buf[0] != 0) + return SZ_ERROR_ARCHIVE; + + size -= 4; + crc = CrcCalc(buf, size); + if (crc != GetUi32(buf + size)) + return SZ_ERROR_ARCHIVE; + + { + UInt64 numBlocks64; + READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64); + numBlocks = (size_t)numBlocks64; + if (numBlocks != numBlocks64 || numBlocks * 2 > size) + return SZ_ERROR_ARCHIVE; + } + + crcStartPos = pos; + Xz_Free(p, alloc); + if (numBlocks != 0) + { + p->numBlocks = numBlocks; + p->numBlocksAllocated = numBlocks; + p->blocks = alloc->Alloc(alloc, sizeof(CXzBlockSizes) * numBlocks); + if (p->blocks == 0) + return SZ_ERROR_MEM; + for (i = 0; i < numBlocks; i++) + { + CXzBlockSizes *block = &p->blocks[i]; + READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize); + READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize); + if (block->totalSize == 0) + return SZ_ERROR_ARCHIVE; + } + } + while ((pos & 3) != 0) + if (buf[pos++] != 0) + return SZ_ERROR_ARCHIVE; + return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE; +} + +static SRes Xz_ReadIndex(CXzStream *p, ILookInStream *stream, UInt64 indexSize, ISzAlloc *alloc) +{ + SRes res; + size_t size; + Byte *buf; + if (indexSize > ((UInt32)1 << 31)) + return SZ_ERROR_UNSUPPORTED; + size = (size_t)indexSize; + if (size != indexSize) + return SZ_ERROR_UNSUPPORTED; + buf = alloc->Alloc(alloc, size); + if (buf == 0) + return SZ_ERROR_MEM; + res = LookInStream_Read2(stream, buf, size, SZ_ERROR_UNSUPPORTED); + if (res == SZ_OK) + res = Xz_ReadIndex2(p, buf, size, alloc); + alloc->Free(alloc, buf); + return res; +} + +static SRes SeekFromCur(ILookInStream *inStream, Int64 *res) +{ + return inStream->Seek(inStream, res, SZ_SEEK_CUR); +} + +static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOffset, ISzAlloc *alloc) +{ + UInt64 indexSize; + Byte buf[XZ_STREAM_FOOTER_SIZE]; + + if ((*startOffset & 3) != 0 || *startOffset < XZ_STREAM_FOOTER_SIZE) + return SZ_ERROR_NO_ARCHIVE; + *startOffset = -XZ_STREAM_FOOTER_SIZE; + RINOK(SeekFromCur(stream, startOffset)); + + RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE)); + + if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0) + { + Int64 i = 0; + *startOffset += XZ_STREAM_FOOTER_SIZE; + for (;;) + { + int j; + size_t processedSize; + #define TEMP_BUF_SIZE (1 << 10) + Byte tempBuf[TEMP_BUF_SIZE]; + if (*startOffset < XZ_STREAM_FOOTER_SIZE || i > (1 << 16)) + return SZ_ERROR_NO_ARCHIVE; + processedSize = (*startOffset > TEMP_BUF_SIZE) ? TEMP_BUF_SIZE : (size_t)*startOffset; + i += processedSize; + *startOffset = -(Int64)processedSize; + RINOK(SeekFromCur(stream, startOffset)); + RINOK(LookInStream_Read2(stream, tempBuf, processedSize, SZ_ERROR_NO_ARCHIVE)); + for (j = (int)processedSize; j >= 1; j--) // FIXED j >= 0 => j >= 1 + if (tempBuf[j -1] != 0) + break; + if (j != 0) + { + if ((j & 3) != 0) + return SZ_ERROR_NO_ARCHIVE; + *startOffset += j; + if (*startOffset < XZ_STREAM_FOOTER_SIZE) + return SZ_ERROR_NO_ARCHIVE; + *startOffset -= XZ_STREAM_FOOTER_SIZE; + RINOK(stream->Seek(stream, startOffset, SZ_SEEK_SET)); + RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE)); + if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0) + return SZ_ERROR_NO_ARCHIVE; + break; + } + } + } + + p->flags = (CXzStreamFlags)GetBe16(buf + 8); + + if (!XzFlags_IsSupported(p->flags)) + return SZ_ERROR_UNSUPPORTED; + + if (GetUi32(buf) != CrcCalc(buf + 4, 6)) + return SZ_ERROR_ARCHIVE; + + indexSize = ((UInt64)GetUi32(buf + 4) + 1) << 2; + + *startOffset = -(Int64)(indexSize + XZ_STREAM_FOOTER_SIZE); + RINOK(SeekFromCur(stream, startOffset)); + + RINOK(Xz_ReadIndex(p, stream, indexSize, alloc)); + + { + UInt64 totalSize = Xz_GetPackSize(p); + UInt64 sum = XZ_STREAM_HEADER_SIZE + totalSize + indexSize; + if (totalSize == XZ_SIZE_OVERFLOW || + sum >= ((UInt64)1 << 63) || + totalSize >= ((UInt64)1 << 63)) + return SZ_ERROR_ARCHIVE; + *startOffset = -(Int64)sum; + RINOK(SeekFromCur(stream, startOffset)); + } + { + CXzStreamFlags headerFlags; + CSecToRead secToRead; + SecToRead_CreateVTable(&secToRead); + secToRead.realStream = stream; + + RINOK(Xz_ReadHeader(&headerFlags, &secToRead.s)); + return (p->flags == headerFlags) ? SZ_OK : SZ_ERROR_ARCHIVE; + } +} + + +/* ---------- Xz Streams ---------- */ + +void Xzs_Construct(CXzs *p) +{ + p->num = p->numAllocated = 0; + p->streams = 0; +} + +void Xzs_Free(CXzs *p, ISzAlloc *alloc) +{ + size_t i; + for (i = 0; i < p->num; i++) + Xz_Free(&p->streams[i], alloc); + alloc->Free(alloc, p->streams); + p->num = p->numAllocated = 0; + p->streams = 0; +} + +UInt64 Xzs_GetNumBlocks(const CXzs *p) +{ + UInt64 num = 0; + size_t i; + for (i = 0; i < p->num; i++) + num += p->streams[i].numBlocks; + return num; +} + +UInt64 Xzs_GetUnpackSize(const CXzs *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->num; i++) + ADD_SIZE_CHECH(size, Xz_GetUnpackSize(&p->streams[i])); + return size; +} + +/* +UInt64 Xzs_GetPackSize(const CXzs *p) +{ + UInt64 size = 0; + size_t i; + for (i = 0; i < p->num; i++) + ADD_SIZE_CHECH(size, Xz_GetTotalSize(&p->streams[i])); + return size; +} +*/ + +SRes Xzs_ReadBackward(CXzs *p, ILookInStream *stream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc) +{ + Int64 endOffset = 0; + RINOK(stream->Seek(stream, &endOffset, SZ_SEEK_END)); + *startOffset = endOffset; + for (;;) + { + CXzStream st; + SRes res; + Xz_Construct(&st); + res = Xz_ReadBackward(&st, stream, startOffset, alloc); + st.startOffset = *startOffset; + RINOK(res); + if (p->num == p->numAllocated) + { + size_t newNum = p->num + p->num / 4 + 1; + Byte *data = (Byte *)alloc->Alloc(alloc, newNum * sizeof(CXzStream)); + if (data == 0) + return SZ_ERROR_MEM; + p->numAllocated = newNum; + memcpy(data, p->streams, p->num * sizeof(CXzStream)); + alloc->Free(alloc, p->streams); + p->streams = (CXzStream *)data; + } + p->streams[p->num++] = st; + if (*startOffset == 0) + break; + RINOK(stream->Seek(stream, startOffset, SZ_SEEK_SET)); + if (progress && progress->Progress(progress, endOffset - *startOffset, (UInt64)(Int64)-1) != SZ_OK) + return SZ_ERROR_PROGRESS; + } + return SZ_OK; +} diff --git a/src/ZipLib/extlibs/zlib/adler32.c b/src/ZipLib/extlibs/zlib/adler32.c new file mode 100644 index 00000000..a868f073 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/adler32.c @@ -0,0 +1,179 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#define local static + +local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); + +#define BASE 65521 /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware -- + try it both ways to see which is faster */ +#ifdef NO_DIVIDE +/* note that this assumes BASE is 65521, where 65536 % 65521 == 15 + (thank you to John Reiser for pointing this out) */ +# define CHOP(a) \ + do { \ + unsigned long tmp = a >> 16; \ + a &= 0xffffUL; \ + a += (tmp << 4) - tmp; \ + } while (0) +# define MOD28(a) \ + do { \ + CHOP(a); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD(a) \ + do { \ + CHOP(a); \ + MOD28(a); \ + } while (0) +# define MOD63(a) \ + do { /* this assumes a is not negative */ \ + z_off64_t tmp = a >> 32; \ + a &= 0xffffffffL; \ + a += (tmp << 8) - (tmp << 5) + tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD28(a) a %= BASE +# define MOD63(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD28(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +local uLong adler32_combine_(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* for negative len, return invalid adler32 as a clue for debugging */ + if (len2 < 0) + return 0xffffffffUL; + + /* the derivation of this formula is left as an exercise for the reader */ + MOD63(len2); /* assumes len2 >= 0 */ + rem = (unsigned)len2; + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 >= BASE) sum1 -= BASE; + if (sum1 >= BASE) sum1 -= BASE; + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} + +uLong ZEXPORT adler32_combine64(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} diff --git a/src/ZipLib/extlibs/zlib/compress.c b/src/ZipLib/extlibs/zlib/compress.c new file mode 100644 index 00000000..ea4dfbe9 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/compress.c @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13; +} diff --git a/src/ZipLib/extlibs/zlib/crc32.c b/src/ZipLib/extlibs/zlib/crc32.c new file mode 100644 index 00000000..979a7190 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/crc32.c @@ -0,0 +1,425 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + + DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Definitions for doing the crc four data bytes at a time. */ +#if !defined(NOBYFOUR) && defined(Z_U4) +# define BYFOUR +#endif +#ifdef BYFOUR + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); +local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); + + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local z_crc_t FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const z_crc_t FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + z_crc_t c; + int n, k; + z_crc_t poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0; + for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) + poly |= (z_crc_t)1 << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (z_crc_t)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = ZSWAP32(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = ZSWAP32(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const z_crc_t FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const z_crc_t FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + (unsigned long)(table[n]), + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const z_crc_t FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const z_crc_t FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + z_crc_t endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register z_crc_t c; + register const z_crc_t FAR *buf4; + + c = (z_crc_t)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register z_crc_t c; + register const z_crc_t FAR *buf4; + + c = ZSWAP32((z_crc_t)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(ZSWAP32(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +local uLong crc32_combine_(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case (also disallow negative lengths) */ + if (len2 <= 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} + +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} diff --git a/src/ZipLib/extlibs/zlib/crc32.h b/src/ZipLib/extlibs/zlib/crc32.h new file mode 100644 index 00000000..9e0c7781 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const z_crc_t FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/src/ZipLib/extlibs/zlib/deflate.c b/src/ZipLib/extlibs/zlib/deflate.c new file mode 100644 index 00000000..9e4c2cbc --- /dev/null +++ b/src/ZipLib/extlibs/zlib/deflate.c @@ -0,0 +1,1965 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://tools.ietf.org/html/rfc1951 + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local block_state deflate_rle OF((deflate_state *s, int flush)); +local block_state deflate_huff OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ +#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; +#endif + } + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt str, n; + int wrap; + unsigned avail; + unsigned char *next; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) + return Z_STREAM_ERROR; + s = strm->state; + wrap = s->wrap; + if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) + return Z_STREAM_ERROR; + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap == 1) + strm->adler = adler32(strm->adler, dictionary, dictLength); + s->wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s->w_size) { + if (wrap == 0) { /* already empty otherwise */ + CLEAR_HASH(s); + s->strstart = 0; + s->block_start = 0L; + s->insert = 0; + } + dictionary += dictLength - s->w_size; /* use the tail */ + dictLength = s->w_size; + } + + /* insert dictionary into window and hash */ + avail = strm->avail_in; + next = strm->next_in; + strm->avail_in = dictLength; + strm->next_in = (Bytef *)dictionary; + fill_window(s); + while (s->lookahead >= MIN_MATCH) { + str = s->strstart; + n = s->lookahead - (MIN_MATCH-1); + do { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + } while (--n); + s->strstart = str; + s->lookahead = MIN_MATCH-1; + fill_window(s); + } + s->strstart += s->lookahead; + s->block_start = (long)s->strstart; + s->insert = s->lookahead; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + strm->next_in = next; + strm->avail_in = avail; + s->wrap = wrap; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateResetKeep (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + int ret; + + ret = deflateResetKeep(strm); + if (ret == Z_OK) + lm_init(strm->state); + return ret; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePending (strm, pending, bits) + unsigned *pending; + int *bits; + z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (pending != Z_NULL) + *pending = strm->state->pending; + if (bits != Z_NULL) + *bits = strm->state->bi_valid; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + deflate_state *s; + int put; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; + do { + put = Buf_size - s->bi_valid; + if (put > bits) + put = bits; + s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); + s->bi_valid += put; + _tr_flush_bits(s); + value >>= put; + bits -= put; + } while (bits); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if ((strategy != s->strategy || func != configuration_table[level].func) && + strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_BLOCK); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds for + * every combination of windowBits and memLevel. But even the conservative + * upper bound of about 14% expansion does not seem onerous for output buffer + * allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong complen, wraplen; + Bytef *str; + + /* conservative upper bound for compressed data */ + complen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + + /* if can't get parameters, return conservative bound plus zlib wrapper */ + if (strm == Z_NULL || strm->state == Z_NULL) + return complen + 6; + + /* compute wrapper length */ + s = strm->state; + switch (s->wrap) { + case 0: /* raw deflate */ + wraplen = 0; + break; + case 1: /* zlib wrapper */ + wraplen = 6 + (s->strstart ? 4 : 0); + break; + case 2: /* gzip wrapper */ + wraplen = 18; + if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + if (s->gzhead->extra != Z_NULL) + wraplen += 2 + s->gzhead->extra_len; + str = s->gzhead->name; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + str = s->gzhead->comment; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + if (s->gzhead->hcrc) + wraplen += 2; + } + break; + default: /* for compiler happiness */ + wraplen = 6; + } + + /* if not default parameters, return conservative bound */ + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return complen + wraplen; + + /* default settings: return tight bound for that case */ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13 - 6 + wraplen; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len; + deflate_state *s = strm->state; + + _tr_flush_bits(s); + len = s->pending; + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, s->pending_out, len); + strm->next_out += len; + s->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + s->pending -= len; + if (s->pending == 0) { + s->pending_out = s->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_BLOCK || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + (s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush)); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + if (s->lookahead == 0) { + s->strstart = 0; + s->block_start = 0L; + s->insert = 0; + } + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + zmemcpy(buf, strm->next_in, len); + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, buf, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, buf, len); + } +#endif + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->insert = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ + +#else /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for FASTEST only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#endif /* FASTEST */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) break; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead + s->insert >= MIN_MATCH) { + uInt str = s->strstart - s->insert; + s->ins_h = s->window[str]; + UPDATE_HASH(s, s->ins_h, s->window[str + 1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + while (s->insert) { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + s->insert--; + if (s->lookahead + s->insert < MIN_MATCH) + break; + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } + + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "not enough room for search"); +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, last) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (last)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, last) { \ + FLUSH_BLOCK_ONLY(s, last); \ + if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if ((long)s->strstart > s->block_start) + FLUSH_BLOCK(s, 0); + return block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; +} +#endif /* FASTEST */ + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt prev; /* byte at distance one to match */ + Bytef *scan, *strend; /* scan goes up to strend for length of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s->lookahead <= MAX_MATCH) { + fill_window(s); + if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s->match_length = 0; + if (s->lookahead >= MIN_MATCH && s->strstart > 0) { + scan = s->window + s->strstart - 1; + prev = *scan; + if (prev == *++scan && prev == *++scan && prev == *++scan) { + strend = s->window + s->strstart + MAX_MATCH; + do { + } while (prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + scan < strend); + s->match_length = MAX_MATCH - (int)(strend - scan); + if (s->match_length > s->lookahead) + s->match_length = s->lookahead; + } + Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, s->match_length); + + _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + s->strstart += s->match_length; + s->match_length = 0; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +local block_state deflate_huff(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s->lookahead == 0) { + fill_window(s); + if (s->lookahead == 0) { + if (flush == Z_NO_FLUSH) + return need_more; + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s->match_length = 0; + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + if (bflush) FLUSH_BLOCK(s, 0); + } + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; +} diff --git a/src/ZipLib/extlibs/zlib/deflate.h b/src/ZipLib/extlibs/zlib/deflate.h new file mode 100644 index 00000000..fbac44d9 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/deflate.h @@ -0,0 +1,346 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2012 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define Buf_size 16 +/* size of bit buffer in bi_buf */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to suppress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + uInt insert; /* bytes at end of window left to insert */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + ulg high_water; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + +#define WIN_INIT MAX_MATCH +/* Number of bytes after end of data in window to initialize in order to avoid + memory checker errors from longest match routines */ + + /* in trees.c */ +void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch ZLIB_INTERNAL _length_code[]; + extern uch ZLIB_INTERNAL _dist_code[]; +#else + extern const uch ZLIB_INTERNAL _length_code[]; + extern const uch ZLIB_INTERNAL _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/src/ZipLib/extlibs/zlib/gzguts.h b/src/ZipLib/extlibs/zlib/gzguts.h new file mode 100644 index 00000000..4f8dbdb8 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/gzguts.h @@ -0,0 +1,193 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#ifdef HAVE_HIDDEN +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +// #include +#include "zlib.h" +#ifdef STDC +# include +# include +# include +#endif +#include + +#ifdef _WIN32 +# include +#endif + +#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) +# include +#endif + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS +/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 +/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +# ifdef VMS +# define NO_vsnprintf +# endif +# ifdef __OS400__ +# define NO_vsnprintf +# endif +# ifdef __MVS__ +# define NO_vsnprintf +# endif +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifndef NO_STRERROR +# include +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default memLevel */ +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif + +/* default i/o buffer size -- double this for output when reading */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* exposed contents for gzgetc() macro */ + struct gzFile_s x; /* "x" for exposed */ + /* x.have: number of bytes available at x.next */ + /* x.next: next output data to deliver or write */ + /* x.pos: current position in uncompressed data */ + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer */ + unsigned char *out; /* output buffer (double-sized when reading) */ + int direct; /* 0 if processing gzip, 1 if transparent */ + /* just for reading */ + int how; /* 0: get header, 1: copy, 2: decompress */ + z_off64_t start; /* where the gzip data started, for rewinding */ + int eof; /* true if end of input file reached */ + int past; /* true if read requested past end */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif diff --git a/src/ZipLib/extlibs/zlib/infback.c b/src/ZipLib/extlibs/zlib/infback.c new file mode 100644 index 00000000..981aff17 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/infback.c @@ -0,0 +1,640 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2011 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; +#endif + } + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->wnext = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + state->length = (unsigned)here.val; + + /* process literal */ + if (here.op == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/src/ZipLib/extlibs/zlib/inffast.c b/src/ZipLib/extlibs/zlib/inffast.c new file mode 100644 index 00000000..2f1d60b4 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inffast.c @@ -0,0 +1,340 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2008, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code here; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + wnext = state->wnext; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op == 0) { /* literal */ + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state->sane) { + strm->msg = + (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + if (len <= op - whave) { + do { + PUP(out) = 0; + } while (--len); + continue; + } + len -= op - whave; + do { + PUP(out) = 0; + } while (--op > whave); + if (op == 0) { + from = out - dist; + do { + PUP(out) = PUP(from); + } while (--len); + continue; + } +#endif + } + from = window - OFF; + if (wnext == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + here = dcode[here.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + here = lcode[here.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and wnext == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/src/ZipLib/extlibs/zlib/inffast.h b/src/ZipLib/extlibs/zlib/inffast.h new file mode 100644 index 00000000..e5c1aa4c --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/src/ZipLib/extlibs/zlib/inffixed.h b/src/ZipLib/extlibs/zlib/inffixed.h new file mode 100644 index 00000000..d6283277 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. + It is part of the implementation of this library and is + subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/src/ZipLib/extlibs/zlib/inflate.c b/src/ZipLib/extlibs/zlib/inflate.c new file mode 100644 index 00000000..47418a1e --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inflate.c @@ -0,0 +1,1496 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2012 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common wnext == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateResetKeep(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + if (state->wrap) /* to support ill-conceived Java test suite */ + strm->adler = state->wrap & 1; + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + state->sane = 1; + state->back = -1; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + return inflateResetKeep(strm); +} + +int ZEXPORT inflateReset2(strm, windowBits) +z_streamp strm; +int windowBits; +{ + int wrap; + struct inflate_state FAR *state; + + /* get the state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) + windowBits &= 15; +#endif + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) + return Z_STREAM_ERROR; + if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { + ZFREE(strm, state->window); + state->window = Z_NULL; + } + + /* update state and reset the rest of it */ + state->wrap = wrap; + state->wbits = (unsigned)windowBits; + return inflateReset(strm); +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + int ret; + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; +#endif + } + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->window = Z_NULL; + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state); + strm->state = Z_NULL; + } + return ret; +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits < 0) { + state->hold = 0; + state->bits = 0; + return Z_OK; + } + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, + state.lencode[low].bits, state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->wnext = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->wnext = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->wnext; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->wnext = copy; + state->whave = state->wsize; + } + else { + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (state->wbits == 0) + state->wbits = len; + else if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = ZSWAP32(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN_; /* decode codes */ + if (flush == Z_TREES) { + DROPBITS(2); + goto inf_leave; + } + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; + case COPY_: + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; + case LEN_: + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; + break; + } + state->back = 0; + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + state->length = (unsigned)here.val; + if ((int)(here.op) == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + state->mode = LIT; + break; + } + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->back = -1; + state->mode = TYPE; + break; + } + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->whave) { + if (state->sane) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + Trace((stderr, "inflate.c too far\n")); + copy -= state->whave; + if (copy > state->length) copy = state->length; + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = 0; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; +#endif + } + if (copy > state->wnext) { + copy -= state->wnext; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->wnext - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + ZSWAP32(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (out != strm->avail_out && state->mode < BAD && + (state->mode < CHECK || flush != Z_FINISH))) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0) + + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long dictid; + unsigned char *next; + unsigned avail; + int ret; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary identifier */ + if (state->mode == DICT) { + dictid = adler32(0L, Z_NULL, 0); + dictid = adler32(dictid, dictionary, dictLength); + if (dictid != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + next = strm->next_out; + avail = strm->avail_out; + strm->next_out = (Bytef *)dictionary + dictLength; + strm->avail_out = 0; + ret = updatewindow(strm, dictLength); + strm->avail_out = avail; + strm->next_out = next; + if (ret) { + state->mode = MEM; + return Z_MEM_ERROR; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); + zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} + +int ZEXPORT inflateUndermine(strm, subvert) +z_streamp strm; +int subvert; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->sane = !subvert; +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + return Z_OK; +#else + state->sane = 1; + return Z_DATA_ERROR; +#endif +} + +long ZEXPORT inflateMark(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + state = (struct inflate_state FAR *)strm->state; + return ((long)(state->back) << 16) + + (state->mode == COPY ? state->length : + (state->mode == MATCH ? state->was - state->length : 0)); +} diff --git a/src/ZipLib/extlibs/zlib/inflate.h b/src/ZipLib/extlibs/zlib/inflate.h new file mode 100644 index 00000000..95f4986d --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inflate.h @@ -0,0 +1,122 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY_, /* i/o: same as COPY below, but only first time in */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN_, /* i: same as LEN below, but only first time in */ + LEN, /* i: waiting for length/lit/eob code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to BAD or MEM on error -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) or (raw) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> + HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + (raw) -> TYPEDO + Read deflate blocks: + TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK + STORED -> COPY_ -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN_ + LEN_ -> LEN + Read deflate codes in fixed or dynamic block: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 10K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ + int sane; /* if false, allow invalid distance too far */ + int back; /* bits back of last unprocessed length/lit */ + unsigned was; /* initial length of match */ +}; diff --git a/src/ZipLib/extlibs/zlib/inftrees.c b/src/ZipLib/extlibs/zlib/inftrees.c new file mode 100644 index 00000000..abcd7c45 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inftrees.c @@ -0,0 +1,306 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2012 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code here; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)1; + here.val = (unsigned short)0; + *(*table)++ = here; /* make a table to force an error */ + *(*table)++ = here; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + here.op = (unsigned char)0; + here.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + here.op = (unsigned char)(extra[work[sym]]); + here.val = base[work[sym]]; + } + else { + here.op = (unsigned char)(32 + 64); /* end of block */ + here.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = here; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff != 0) { + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + next[huff] = here; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/src/ZipLib/extlibs/zlib/inftrees.h b/src/ZipLib/extlibs/zlib/inftrees.h new file mode 100644 index 00000000..baa53a0b --- /dev/null +++ b/src/ZipLib/extlibs/zlib/inftrees.h @@ -0,0 +1,62 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of the dynamic table. The maximum number of code structures is + 1444, which is the sum of 852 for literal/length codes and 592 for distance + codes. These values were found by exhaustive searches using the program + examples/enough.c found in the zlib distribtution. The arguments to that + program are the number of symbols, the initial root table size, and the + maximum bit length of a code. "enough 286 9 15" for literal/length codes + returns returns 852, and "enough 30 6 15" for distance codes returns 592. + The initial root table size (9 or 6) is found in the fifth argument of the + inflate_table() calls in inflate.c and infback.c. If the root table size is + changed, then these maximum sizes would be need to be recalculated and + updated. */ +#define ENOUGH_LENS 852 +#define ENOUGH_DISTS 592 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) + +/* Type of code to build for inflate_table() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/src/ZipLib/extlibs/zlib/trees.c b/src/ZipLib/extlibs/zlib/trees.c new file mode 100644 index 00000000..8c32b214 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/trees.c @@ -0,0 +1,1224 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2012 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local int detect_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) + */ +void ZLIB_INTERNAL _tr_flush_bits(s) + deflate_state *s; +{ + bi_flush(s); +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +void ZLIB_INTERNAL _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+last, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+last, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(s) + deflate_state *s; +{ + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long black_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>= 1) + if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("white-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/src/ZipLib/extlibs/zlib/trees.h b/src/ZipLib/extlibs/zlib/trees.h new file mode 100644 index 00000000..d35639d8 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/src/ZipLib/extlibs/zlib/uncompr.c b/src/ZipLib/extlibs/zlib/uncompr.c new file mode 100644 index 00000000..ad98be3a --- /dev/null +++ b/src/ZipLib/extlibs/zlib/uncompr.c @@ -0,0 +1,59 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/src/ZipLib/extlibs/zlib/zconf.h b/src/ZipLib/extlibs/zlib/zconf.h new file mode 100644 index 00000000..8a46a58b --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zconf.h @@ -0,0 +1,506 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2012 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateResetKeep z_inflateResetKeep +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +/* ./configure may #define Z_U4 here */ + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# else +# if (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# else +# if (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +# endif +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#ifdef _WIN32 +# include /* for wchar_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/src/ZipLib/extlibs/zlib/zlib.h b/src/ZipLib/extlibs/zlib/zlib.h new file mode 100644 index 00000000..3edf3acd --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zlib.h @@ -0,0 +1,1744 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.7, May 2nd, 2012 + + Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.7" +#define ZLIB_VERNUM 0x1270 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 7 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). Then deflate is guaranteed to + return Z_STREAM_END. If not enough output space is provided, deflate will + not return Z_STREAM_END, and it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + producted so far. The CRC-32 is checked against the gzip trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/src/ZipLib/extlibs/zlib/zlib.vcxproj b/src/ZipLib/extlibs/zlib/zlib.vcxproj new file mode 100644 index 00000000..9da6b55a --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zlib.vcxproj @@ -0,0 +1,182 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D} + Win32Proj + zlib + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/zlib/zlib.vcxproj.filters b/src/ZipLib/extlibs/zlib/zlib.vcxproj.filters new file mode 100644 index 00000000..3d4e1021 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zlib.vcxproj.filters @@ -0,0 +1,87 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/ZipLib/extlibs/zlib/zutil.c b/src/ZipLib/extlibs/zlib/zutil.c new file mode 100644 index 00000000..65e0d3b7 --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zutil.c @@ -0,0 +1,324 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" +#ifndef Z_SOLO +# include "gzguts.h" +#endif + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + +#ifndef Z_SOLO + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ + +#endif /* !Z_SOLO */ diff --git a/src/ZipLib/extlibs/zlib/zutil.h b/src/ZipLib/extlibs/zlib/zutil.h new file mode 100644 index 00000000..4e3dcc6a --- /dev/null +++ b/src/ZipLib/extlibs/zlib/zutil.h @@ -0,0 +1,252 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2012 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#ifdef HAVE_HIDDEN +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#if defined(STDC) && !defined(Z_SOLO) +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifdef Z_SOLO + typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# ifndef Z_SOLO +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# if defined(M_I86) && !defined(Z_SOLO) +# include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# ifndef Z_SOLO +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(pyr) || defined(Z_SOLO) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +#ifndef Z_SOLO + voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); + void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); +#endif + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +/* Reverse the bytes in a 32-bit value */ +#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +#endif /* ZUTIL_H */ diff --git a/src/ZipLib/methods/Bzip2Method.h b/src/ZipLib/methods/Bzip2Method.h new file mode 100644 index 00000000..074c7ad9 --- /dev/null +++ b/src/ZipLib/methods/Bzip2Method.h @@ -0,0 +1,46 @@ +#pragma once +#include "ICompressionMethod.h" +#include "../compression/bzip2/bzip2_encoder.h" +#include "../compression/bzip2/bzip2_decoder.h" + +#include + +class Bzip2Method : + public ICompressionMethod +{ + public: + ZIP_METHOD_CLASS_PROLOGUE( + Bzip2Method, + bzip2_encoder, bzip2_decoder, + _encoderProps, _decoderProps, + /* CompressionMethod */ 12, + /* VersionNeededToExtract */ 46 + ); + + enum class BlockSize : int + { + B100 = 1, + B200 = 2, + B300 = 3, + B400 = 4, + B500 = 5, + B600 = 6, + B700 = 7, + B800 = 8, + B900 = 9, + + Fastest = B100, + Default = B600, + Best = B900 + }; + + size_t GetBufferCapacity() const { return _encoderProps.BufferCapacity; } + void SetBufferCapacity(size_t bufferCapacity) { _encoderProps.BufferCapacity = bufferCapacity; } + + BlockSize GetBlockSize() const { return static_cast(_encoderProps.BlockSize); } + void SetBlockSize(BlockSize compressionLevel) { _encoderProps.BlockSize = static_cast(compressionLevel); } + + private: + bzip2_encoder_properties _encoderProps; + bzip2_decoder_properties _decoderProps; +}; diff --git a/src/ZipLib/methods/DeflateMethod.h b/src/ZipLib/methods/DeflateMethod.h new file mode 100644 index 00000000..6072a3cf --- /dev/null +++ b/src/ZipLib/methods/DeflateMethod.h @@ -0,0 +1,46 @@ +#pragma once +#include "ICompressionMethod.h" +#include "../compression/deflate/deflate_encoder.h" +#include "../compression/deflate/deflate_decoder.h" + +#include + +class DeflateMethod : + public ICompressionMethod +{ + public: + ZIP_METHOD_CLASS_PROLOGUE( + DeflateMethod, + deflate_encoder, deflate_decoder, + _encoderProps, _decoderProps, + /* CompressionMethod */ 8, + /* VersionNeededToExtract */ 20 + ); + + enum class CompressionLevel : int + { + L1 = 1, + L2 = 2, + L3 = 3, + L4 = 4, + L5 = 5, + L6 = 6, + L7 = 7, + L8 = 8, + L9 = 9, + + Fastest = L1, + Default = L6, + Best = L9 + }; + + size_t GetBufferCapacity() const { return _encoderProps.BufferCapacity; } + void SetBufferCapacity(size_t bufferCapacity) { _encoderProps.BufferCapacity = bufferCapacity; } + + CompressionLevel GetCompressionLevel() const { return static_cast(_encoderProps.CompressionLevel); } + void SetCompressionLevel(CompressionLevel compressionLevel) { _encoderProps.CompressionLevel = static_cast(compressionLevel); } + + private: + deflate_encoder_properties _encoderProps; + deflate_decoder_properties _decoderProps; +}; diff --git a/src/ZipLib/methods/ICompressionMethod.h b/src/ZipLib/methods/ICompressionMethod.h new file mode 100644 index 00000000..37c45585 --- /dev/null +++ b/src/ZipLib/methods/ICompressionMethod.h @@ -0,0 +1,103 @@ +#pragma once +#include "../compression/compression_interface.h" + +#include "../compression/store/store_encoder.h" +#include "../compression/store/store_decoder.h" + +#include + +#define ZIP_METHOD_CLASS_PROLOGUE( \ + method_class, \ + encoder_class, decoder_class, \ + encoder_props_member, decoder_props_member, \ + compression_method, version_needed_to_extract) \ + \ + typedef std::shared_ptr Ptr; \ + \ + static const uint16_t CompressionMethod = compression_method; \ + static const uint16_t VersionNeededToExtract = version_needed_to_extract; \ + \ + method_class() \ + { \ + this->SetEncoder(std::make_shared()); \ + this->SetDecoder(std::make_shared()); \ + } \ + \ + static Ptr Create() \ + { \ + return std::make_shared(); \ + } \ + \ + compression_encoder_properties_interface& GetEncoderProperties() override \ + { \ + encoder_props_member.normalize(); \ + return encoder_props_member; \ + } \ + \ + compression_decoder_properties_interface& GetDecoderProperties() override \ + { \ + decoder_props_member.normalize(); \ + return decoder_props_member; \ + } \ + \ + const ZipMethodDescriptor& GetZipMethodDescriptor() const override \ + { \ + return GetZipMethodDescriptorStatic(); \ + } \ + \ + static const ZipMethodDescriptor& GetZipMethodDescriptorStatic() \ + { \ + static ZipMethodDescriptor zmd(CompressionMethod, VersionNeededToExtract); \ + return zmd; \ + } + +struct ZipMethodDescriptor +{ + ZipMethodDescriptor(uint16_t compressionMethod, uint16_t versionNeededToExtract) + : CompressionMethod(compressionMethod) + , VersionNeededToExtract(versionNeededToExtract) + { + + } + + uint16_t GetCompressionMethod() const { return CompressionMethod; } + uint16_t GetVersionNeededToExtract() const { return VersionNeededToExtract; } + + private: + const uint16_t CompressionMethod; + const uint16_t VersionNeededToExtract; +}; + +class ICompressionMethod +{ + public: + static const uint16_t StoredCompressionMethod = 0; + static const uint16_t StoredVersionNeededToExtract = 10; + + typedef std::shared_ptr Ptr; + + typedef std::shared_ptr encoder_t; + typedef std::shared_ptr decoder_t; + + encoder_t GetEncoder() const { return _encoder; } + decoder_t GetDecoder() const { return _decoder; } + + virtual compression_encoder_properties_interface& GetEncoderProperties() = 0; + virtual compression_decoder_properties_interface& GetDecoderProperties() = 0; + + virtual const ZipMethodDescriptor& GetZipMethodDescriptor() const = 0; + static const ZipMethodDescriptor& GetZipMethodDescriptorStatic() + { + // Default "Stored method" descriptor. + static ZipMethodDescriptor zmd(StoredCompressionMethod, StoredVersionNeededToExtract); + return zmd; + } + + protected: + void SetEncoder(encoder_t encoder) { _encoder = encoder; } + void SetDecoder(decoder_t decoder) { _decoder = decoder; } + + private: + encoder_t _encoder; + decoder_t _decoder; +}; diff --git a/src/ZipLib/methods/LzmaMethod.h b/src/ZipLib/methods/LzmaMethod.h new file mode 100644 index 00000000..d1d91da0 --- /dev/null +++ b/src/ZipLib/methods/LzmaMethod.h @@ -0,0 +1,46 @@ +#pragma once +#include "ICompressionMethod.h" +#include "../compression/lzma/lzma_encoder.h" +#include "../compression/lzma/lzma_decoder.h" + +#include + +class LzmaMethod : + public ICompressionMethod +{ + public: + ZIP_METHOD_CLASS_PROLOGUE( + LzmaMethod, + lzma_encoder, lzma_decoder, + _encoderProps, _decoderProps, + /* CompressionMethod */ 14, + /* VersionNeededToExtract */ 63 + ); + + enum class CompressionLevel : int + { + L1 = 1, + L2 = 2, + L3 = 3, + L4 = 4, + L5 = 5, + L6 = 6, + L7 = 7, + L8 = 8, + L9 = 9, + + Fastest = L1, + Default = L6, + Best = L9 + }; + + bool GetIsMultithreaded() const { return _encoderProps.IsMultithreaded; } + void SetIsMultithreaded(bool isMultithreaded) { _encoderProps.IsMultithreaded = isMultithreaded; } + + CompressionLevel GetCompressionLevel() const { return static_cast(_encoderProps.CompressionLevel); } + void SetCompressionLevel(CompressionLevel compressionLevel) { _encoderProps.CompressionLevel = static_cast(compressionLevel); } + + private: + lzma_encoder_properties _encoderProps; + lzma_decoder_properties _decoderProps; +}; diff --git a/src/ZipLib/methods/StoreMethod.h b/src/ZipLib/methods/StoreMethod.h new file mode 100644 index 00000000..fa944254 --- /dev/null +++ b/src/ZipLib/methods/StoreMethod.h @@ -0,0 +1,23 @@ +#pragma once +#include "ICompressionMethod.h" +#include "../compression/store/store_encoder.h" +#include "../compression/store/store_decoder.h" + +#include + +class StoreMethod : + public ICompressionMethod +{ + public: + ZIP_METHOD_CLASS_PROLOGUE( + StoreMethod, + store_encoder, store_decoder, + _encoderProps, _decoderProps, + /* CompressionMethod */ 0, + /* VersionNeededToExtract */ 10 + ); + + private: + store_encoder_properties _encoderProps; + store_decoder_properties _decoderProps; +}; diff --git a/src/ZipLib/methods/ZipMethodResolver.h b/src/ZipLib/methods/ZipMethodResolver.h new file mode 100644 index 00000000..0c549013 --- /dev/null +++ b/src/ZipLib/methods/ZipMethodResolver.h @@ -0,0 +1,30 @@ +#pragma once +#include +#include +#include "ICompressionMethod.h" + +#include "StoreMethod.h" +#include "DeflateMethod.h" +#include "Bzip2Method.h" +#include "LzmaMethod.h" + +#define ZIP_METHOD_TABLE \ + ZIP_METHOD_ADD(StoreMethod); \ + ZIP_METHOD_ADD(DeflateMethod); \ + ZIP_METHOD_ADD(Bzip2Method); \ + ZIP_METHOD_ADD(LzmaMethod); + +#define ZIP_METHOD_ADD(method_class) \ + if (compressionMethod == method_class::GetZipMethodDescriptorStatic().GetCompressionMethod()) \ + return method_class::Create() + +struct ZipMethodResolver +{ + static ICompressionMethod::Ptr GetZipMethodInstance(uint16_t compressionMethod) + { + ZIP_METHOD_TABLE; + return ICompressionMethod::Ptr(); + } +}; + +#undef ZIP_METHOD diff --git a/src/ZipLib/streams/compression_decoder_stream.h b/src/ZipLib/streams/compression_decoder_stream.h new file mode 100644 index 00000000..401b750e --- /dev/null +++ b/src/ZipLib/streams/compression_decoder_stream.h @@ -0,0 +1,72 @@ +#pragma once +#include +#include "streambuffs/compression_decoder_streambuf.h" + +/** + * \brief Basic generic compression decoder stream. + */ +template +class basic_compression_decoder_stream + : public std::basic_istream +{ + public: + typedef typename compression_decoder_streambuf::istream_type istream_type; + typedef typename compression_decoder_streambuf::ostream_type ostream_type; + + typedef typename compression_decoder_streambuf::icompression_decoder_type icompression_decoder_type; + typedef typename compression_decoder_streambuf::icompression_decoder_ptr_type icompression_decoder_ptr_type; + + basic_compression_decoder_stream() + : std::basic_istream(&_compressionDecoderStreambuf) + { + + } + + basic_compression_decoder_stream(icompression_decoder_ptr_type compressionDecoder, istream_type& stream) + : std::basic_istream(&_compressionDecoderStreambuf) + , _compressionDecoderStreambuf(compressionDecoder, stream) + { + + } + + basic_compression_decoder_stream(icompression_decoder_ptr_type compressionDecoder, compression_decoder_properties_interface& props, istream_type& stream) + : std::basic_istream(&_compressionDecoderStreambuf) + , _compressionDecoderStreambuf(compressionDecoder, props, stream) + { + + } + + bool init(icompression_decoder_ptr_type compressionDecoder, istream_type& stream) + { + return _compressionDecoderStreambuf.init(compressionDecoder, stream); + } + + bool init(icompression_decoder_ptr_type compressionDecoder, compression_decoder_properties_interface& props, istream_type& stream) + { + return _compressionDecoderStreambuf.init(compressionDecoder, props, stream); + } + + bool is_init() const + { + return _compressionDecoderStreambuf.is_init(); + } + + size_t get_bytes_read() const + { + return _compressionDecoderStreambuf.get_bytes_read(); + } + + size_t get_bytes_written() const + { + return _compressionDecoderStreambuf.get_bytes_written(); + } + + private: + compression_decoder_streambuf _compressionDecoderStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_compression_decoder_stream> byte_compression_decoder_stream; +typedef basic_compression_decoder_stream> compression_decoder_stream; +typedef basic_compression_decoder_stream> wcompression_decoder_stream; diff --git a/src/ZipLib/streams/compression_encoder_stream.h b/src/ZipLib/streams/compression_encoder_stream.h new file mode 100644 index 00000000..078a6b06 --- /dev/null +++ b/src/ZipLib/streams/compression_encoder_stream.h @@ -0,0 +1,72 @@ +#pragma once +#include +#include "streambuffs/compression_encoder_streambuf.h" + +/** + * \brief Basic generic compression encoder stream. + */ +template +class basic_compression_encoder_stream + : public std::basic_ostream +{ + public: + typedef typename compression_encoder_streambuf::istream_type istream_type; + typedef typename compression_encoder_streambuf::ostream_type ostream_type; + + typedef typename compression_encoder_streambuf::icompression_encoder_type icompression_encoder_type; + typedef typename compression_encoder_streambuf::icompression_encoder_ptr_type icompression_encoder_ptr_type; + + basic_compression_encoder_stream() + : std::basic_ostream(&_compressionEncoderStreambuf) + { + + } + + basic_compression_encoder_stream(icompression_encoder_ptr_type compressionEncoder, ostream_type& stream) + : std::basic_ostream(&_compressionEncoderStreambuf) + , _compressionEncoderStreambuf(compressionEncoder, stream) + { + + } + + basic_compression_encoder_stream(icompression_encoder_ptr_type compressionEncoder, compression_encoder_properties_interface& props, ostream_type& stream) + : std::basic_ostream(&_compressionEncoderStreambuf) + , _compressionEncoderStreambuf(compressionEncoder, props, stream) + { + + } + + void init(icompression_encoder_ptr_type compressionEncoder, ostream_type& stream) + { + _compressionEncoderStreambuf.init(compressionEncoder, stream); + } + + void init(icompression_encoder_ptr_type compressionEncoder, compression_encoder_properties_interface& props, ostream_type& stream) + { + _compressionEncoderStreambuf.init(compressionEncoder, props, stream); + } + + bool is_init() const + { + return _compressionEncoderStreambuf.is_init(); + } + + size_t get_bytes_read() const + { + return _compressionEncoderStreambuf.get_bytes_read(); + } + + size_t get_bytes_written() const + { + return _compressionEncoderStreambuf.get_bytes_written(); + } + + private: + compression_encoder_streambuf _compressionEncoderStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_compression_encoder_stream> byte_compression_encoder_stream; +typedef basic_compression_encoder_stream> compression_encoder_stream; +typedef basic_compression_encoder_stream> wcompression_encoder_stream; diff --git a/src/ZipLib/streams/crc32stream.h b/src/ZipLib/streams/crc32stream.h new file mode 100644 index 00000000..cffaa7c9 --- /dev/null +++ b/src/ZipLib/streams/crc32stream.h @@ -0,0 +1,49 @@ +#pragma once +#include +#include "streambuffs/crc32_streambuf.h" + +/** + * \brief Basic CRC32 output stream. Computes CRC32 of input data. + */ +template +class basic_crc32stream + : public std::basic_istream +{ + public: + basic_crc32stream() + : std::basic_istream(&_crc32Streambuf) + { + + } + + basic_crc32stream(std::basic_istream* stream) + : std::basic_istream(&_crc32Streambuf) + , _crc32Streambuf(stream) + { + + } + + void init(std::basic_istream& stream) + { + _crc32Streambuf.init(stream); + } + + size_t get_bytes_read() const + { + return _crc32Streambuf.get_bytes_read(); + } + + uint32_t get_crc32() const + { + return _crc32Streambuf.get_crc32(); + } + + private: + crc32_streambuf _crc32Streambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_crc32stream> byte_crc32stream; +typedef basic_crc32stream> crc32stream; +typedef basic_crc32stream> wcrc32stream; diff --git a/src/ZipLib/streams/memstream.h b/src/ZipLib/streams/memstream.h new file mode 100644 index 00000000..641291e5 --- /dev/null +++ b/src/ZipLib/streams/memstream.h @@ -0,0 +1,109 @@ +#pragma once +#include +#include +#include "streambuffs/mem_streambuf.h" + +/** + * \brief Basic input memory stream. + * Creates input stream around the memory buffer. + * Supports seeking. + * Returns EOF when stream seeks behind the size of buffer. + */ +template +class basic_imemstream + : public std::basic_istream +{ + public: + basic_imemstream(ELEM_TYPE* buffer, size_t length) + : std::basic_istream(&_memStreambuf) + , _memStreambuf(buffer, length) + { + + } + + template + basic_imemstream(ELEM_TYPE (&buffer)[N]) + : basic_imemstream(buffer, N) + { + + } + + private: + mem_streambuf _memStreambuf; +}; + +/** + * \brief Basic output memory stream. + * Creates output stream around the memory buffer. + * Supports seeking. + * Sets badbit if the stream wants to write behind the buffer size. + */ +template +class basic_omemstream + : public std::basic_ostream +{ + public: + basic_omemstream(ELEM_TYPE* buffer, size_t length) + : _memStreambuf(buffer, length) + , std::basic_ostream(&_memStreambuf) + { + + } + + template + basic_omemstream(ELEM_TYPE (&buffer)[N]) + : _memStreambuf(buffer, N) + , std::basic_ostream(&_memStreambuf) + { + + } + + private: + mem_streambuf _memStreambuf; +}; + +/** + * \brief Basic input/output memory stream. + * Combines imemstream & omemstream. + * Creates input/output stream around the memory buffer. + * Supports seeking. + * Returns EOF when stream seeks behind the size of buffer. + * Sets badbit if the stream wants to write behind the buffer size. + */ +template +class basic_iomemstream + : public std::basic_iostream +{ + public: + basic_iomemstream(ELEM_TYPE* buffer, size_t length) + : _memStreambuf(buffer, length) + , std::basic_iostream(&_memStreambuf) + { + + } + + template + basic_iomemstream(ELEM_TYPE (&buffer)[N]) + : _memStreambuf(buffer, N) + , std::basic_iostream(&_memStreambuf) + { + + } + + private: + mem_streambuf _memStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_imemstream> byte_imemstream; +typedef basic_imemstream> imemstream; +typedef basic_imemstream> wimemstream; + +typedef basic_omemstream> byte_omemstream; +typedef basic_omemstream> omemstream; +typedef basic_omemstream> womemstream; + +typedef basic_iomemstream> byte_iomemstream; +typedef basic_iomemstream> iomemstream; +typedef basic_iomemstream> wiomemstream; diff --git a/src/ZipLib/streams/nullstream.h b/src/ZipLib/streams/nullstream.h new file mode 100644 index 00000000..ad238cb1 --- /dev/null +++ b/src/ZipLib/streams/nullstream.h @@ -0,0 +1,28 @@ +#pragma once +#include +#include +#include "streambuffs/null_streambuf.h" + +/** + * \brief Basic null stream. + */ +template +class basic_nullstream + : public std::basic_iostream +{ + public: + basic_nullstream() + : std::basic_iostream(&_nullStreambuf) + { + + } + + private: + null_streambuf _nullStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_nullstream> byte_nullstream; +typedef basic_nullstream> nullstream; +typedef basic_nullstream> wnullstream; diff --git a/src/ZipLib/streams/serialization.h b/src/ZipLib/streams/serialization.h new file mode 100644 index 00000000..1d4a9951 --- /dev/null +++ b/src/ZipLib/streams/serialization.h @@ -0,0 +1,102 @@ +#pragma once +#include +#include +#include + +/** + * \brief Deserializes the basic input type. Deserializes floating number from its binary representation. + * + * \tparam RETURN_TYPE Type of the value to be deserialized. + * \param stream The stream to be deserialized from. + * \param [out] out The deserialized value. + * + * \return Count of read elements. + */ +template +std::ios::pos_type deserialize(std::basic_istream& stream, RETURN_TYPE& out) +{ + stream.read(reinterpret_cast(&out), sizeof(RETURN_TYPE)); + return stream.gcount(); +} + +/** + * \brief Deserializes the string from the stream. + * \param stream The stream to be deserialized from. + * \param [out] out The deserialized string. + * \param length The expected length of the string. The value represents the amount of ELEM_TYPE to be read. + * + * \return Count of read elements. + */ +template class STRING_TYPE> +std::ios::pos_type deserialize(std::basic_istream& stream, STRING_TYPE& out, size_t length) +{ + if (length > 0) + { + out.resize(length, ELEM_TYPE(0)); + stream.read(reinterpret_cast(&out[0]), length); + return stream.gcount(); + } + + return 0; +} + +/** + * \brief Deserializes the vector from the stream. + * \param stream The stream to be deserialized from. + * \param [out] out The deserialized string. + * \param length The expected amount of elements in the serialized vector. + * + * \return Count of read elements. + */ +template class VECTOR_TYPE> +std::ios::pos_type deserialize(std::basic_istream& stream, VECTOR_TYPE& out, size_t length) +{ + static_assert(sizeof(ELEM_TYPE) == sizeof(VECTOR_ELEM_TYPE), "sizes must match"); + + if (length > 0) + { + out.resize(length, VECTOR_ELEM_TYPE()); + stream.read(reinterpret_cast(&out[0]), length); + return stream.gcount(); + } + + return 0; +} + +/** + * \brief Serializes the basic input type. Serializes floating number into its binary representation. + * + * \tparam TYPE Type of the value to be serialized. + * \param stream The stream to be serialized into. + * \param value The value to be serialized. + */ +template +void serialize(std::basic_ostream& stream, const TYPE& value) +{ + stream.write(reinterpret_cast(&value), sizeof(TYPE) / sizeof(ELEM_TYPE)); +} + +/** + * \brief Serializes the string. + * \param stream The stream to be serialized into. + * \param value The string to be serialized. + */ +template class STRING_TYPE> +void serialize(std::basic_ostream& stream, const STRING_TYPE& value) +{ + stream.write(reinterpret_cast(&value[0]), value.length()); +} + +/** + * \brief Serializes the vector. + * + * \param stream The stream to be serialized into. + * \param value The vector to be serialized. + */ +template class VECTOR_TYPE> +void serialize(std::basic_ostream& stream, const VECTOR_TYPE& value) +{ + static_assert(sizeof(ELEM_TYPE) == sizeof(VECTOR_ELEM_TYPE), "sizes must match"); + + stream.write(reinterpret_cast(&value[0]), value.size()); +} diff --git a/src/ZipLib/streams/streambuffs/compression_decoder_streambuf.h b/src/ZipLib/streams/streambuffs/compression_decoder_streambuf.h new file mode 100644 index 00000000..e79ca2dc --- /dev/null +++ b/src/ZipLib/streams/streambuffs/compression_decoder_streambuf.h @@ -0,0 +1,105 @@ +#pragma once +#include +#include +#include +#include + +#include "../../compression/compression_interface.h" + +template +class compression_decoder_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + typedef std::basic_istream istream_type; + typedef std::basic_ostream ostream_type; + + typedef compression_decoder_interface_basic icompression_decoder_type; + typedef std::shared_ptr icompression_decoder_ptr_type; + + compression_decoder_streambuf() + { + + } + + compression_decoder_streambuf(icompression_decoder_ptr_type compressionDecoder, istream_type& stream) + { + init(compressionDecoder, stream); + } + + compression_decoder_streambuf(icompression_decoder_ptr_type compressionDecoder, compression_decoder_properties_interface& props, istream_type& stream) + { + init(compressionDecoder, stream); + } + + void init(icompression_decoder_ptr_type compressionDecoder, istream_type& stream) + { + _compressionDecoder = compressionDecoder; + + // compression decoder init + _compressionDecoder->init(stream); + + // set stream buffer + this->setg(_compressionDecoder->get_buffer_end(), _compressionDecoder->get_buffer_end(), _compressionDecoder->get_buffer_end()); + } + + void init(icompression_decoder_ptr_type compressionDecoder, compression_decoder_properties_interface& props, istream_type& stream) + { + _compressionDecoder = compressionDecoder; + + // compression decoder init + _compressionDecoder->init(stream, props); + + // set stream buffer + this->setg(_compressionDecoder->get_buffer_end(), _compressionDecoder->get_buffer_end(), _compressionDecoder->get_buffer_end()); + } + + bool is_init() const + { + return _compressionDecoder->is_init(); + } + + size_t get_bytes_read() const + { + return _compressionDecoder->get_bytes_read(); + } + + size_t get_bytes_written() const + { + return _compressionDecoder->get_bytes_written(); + } + + protected: + int_type underflow() override + { + // buffer exhausted + if (this->gptr() >= this->egptr()) + { + ELEM_TYPE* base = _compressionDecoder->get_buffer_begin(); + + // how many bytes has been read + size_t n = _compressionDecoder->decode_next(); + + if (n == 0) + { + return traits_type::eof(); + } + + // set buffer pointers + this->setg(base, base, base + n); + } + + return traits_type::to_int_type(*this->gptr()); + } + + private: + icompression_decoder_ptr_type _compressionDecoder; +}; diff --git a/src/ZipLib/streams/streambuffs/compression_encoder_streambuf.h b/src/ZipLib/streams/streambuffs/compression_encoder_streambuf.h new file mode 100644 index 00000000..722ba436 --- /dev/null +++ b/src/ZipLib/streams/streambuffs/compression_encoder_streambuf.h @@ -0,0 +1,130 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +#include "../../compression/compression_interface.h" + +template +class compression_encoder_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + typedef std::basic_istream istream_type; + typedef std::basic_ostream ostream_type; + + typedef compression_encoder_interface_basic icompression_encoder_type; + typedef std::shared_ptr icompression_encoder_ptr_type; + + compression_encoder_streambuf() + { + + } + + compression_encoder_streambuf(icompression_encoder_ptr_type compressionEncoder, ostream_type& stream) + { + init(compressionEncoder, stream); + } + + compression_encoder_streambuf(icompression_encoder_ptr_type compressionEncoder, compression_encoder_properties_interface& props, ostream_type& stream) + { + init(compressionEncoder, props, stream); + } + + virtual ~compression_encoder_streambuf() + { + sync(); + } + + void init(icompression_encoder_ptr_type compressionEncoder, ostream_type& stream) + { + _compressionEncoder = compressionEncoder; + + // compression encoder init + _compressionEncoder->init(stream); + + // set stream buffer + this->setp(_compressionEncoder->get_buffer_begin(), _compressionEncoder->get_buffer_end() - 1); + } + + void init(icompression_encoder_ptr_type compressionEncoder, compression_encoder_properties_interface& props, ostream_type& stream) + { + _compressionEncoder = compressionEncoder; + + // compression encoder init + _compressionEncoder->init(stream, props); + + // set stream buffer + this->setp(_compressionEncoder->get_buffer_begin(), _compressionEncoder->get_buffer_end() - 1); + } + + bool is_init() const + { + return _compressionEncoder->is_init(); + } + + size_t get_bytes_read() const + { + return _compressionEncoder->get_bytes_read(); + } + + size_t get_bytes_written() const + { + return _compressionEncoder->get_bytes_written(); + } + + protected: + int_type overflow(int_type c = traits_type::eof()) override + { + bool is_eof = traits_type::eq_int_type(c, traits_type::eof()); + + // if the input is not EOF, just put it into the buffer + // and increment current pointer + if (!is_eof) + { + *this->pptr() = c; + this->pbump(1); + } + + // if input buffer is full or input is EOF, + // compress the buffer + if (this->pptr() >= this->epptr() || is_eof) + { + process(); + } + + // not eof + return ~traits_type::eof(); + } + + int sync() override + { + process(); + _compressionEncoder->sync(); + + return 0; + } + + private: + void process() + { + std::ptrdiff_t inputLength = this->pptr() - this->pbase(); + _compressionEncoder->encode_next(inputLength); + + // set pointers for new buffer + this->setp(_compressionEncoder->get_buffer_begin(), _compressionEncoder->get_buffer_end() - 1); + } + + icompression_encoder_ptr_type _compressionEncoder; +}; diff --git a/src/ZipLib/streams/streambuffs/crc32_streambuf.h b/src/ZipLib/streams/streambuffs/crc32_streambuf.h new file mode 100644 index 00000000..74939173 --- /dev/null +++ b/src/ZipLib/streams/streambuffs/crc32_streambuf.h @@ -0,0 +1,105 @@ +#pragma once +#include +#include + +#include "../substream.h" +#include "../../extlibs/zlib/zlib.h" + +template +class crc32_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + crc32_streambuf() + : _inputStream(nullptr) + , _internalBufferPosition(_internalBuffer + INTERNAL_BUFFER_SIZE) + , _internalBufferEnd(_internalBuffer + INTERNAL_BUFFER_SIZE) + , _bytesRead(0) + , _crc32(0) + { + + } + + crc32_streambuf(std::basic_istream& input) + : crc32_streambuf() + { + init(input); + } + + void init(std::basic_istream& input) + { + _inputStream = &input; + + ELEM_TYPE* endOfBuffer = _internalBuffer + INTERNAL_BUFFER_SIZE; + this->setg(endOfBuffer, endOfBuffer, endOfBuffer); + } + + bool is_init() const + { + return (_inputStream != nullptr); + } + + size_t get_bytes_read() const + { + return _bytesRead; + } + + uint32_t get_crc32() const + { + return _crc32; + } + + protected: + int_type underflow() override + { + // buffer exhausted + if (this->gptr() >= _internalBufferEnd) + { + _inputStream->read(_internalBuffer, static_cast(INTERNAL_BUFFER_SIZE)); + size_t n = static_cast(_inputStream->gcount()); + + _bytesRead += n; + + _internalBufferPosition = _internalBuffer; + _internalBufferEnd = _internalBuffer + n; + + if (n == 0) + { + return traits_type::eof(); + } + } + + // set buffer pointers, increment current position + ELEM_TYPE* base = _internalBufferPosition++; + + // setting all pointers to the same position forces calling of this method each time, + // so crc32 really represents the checksum of what really has been read + this->setg(base, base, base + 1); + + _crc32 = crc32(_crc32, reinterpret_cast(this->gptr()), static_cast(sizeof(ELEM_TYPE))); + + return traits_type::to_int_type(*this->gptr()); + } + + private: + enum : size_t + { + INTERNAL_BUFFER_SIZE = 1 << 15 + }; + + ELEM_TYPE _internalBuffer[INTERNAL_BUFFER_SIZE]; + ELEM_TYPE* _internalBufferPosition; + ELEM_TYPE* _internalBufferEnd; + + std::basic_istream* _inputStream; + size_t _bytesRead; + uint32_t _crc32; +}; diff --git a/src/ZipLib/streams/streambuffs/mem_streambuf.h b/src/ZipLib/streams/streambuffs/mem_streambuf.h new file mode 100644 index 00000000..3a14b6d0 --- /dev/null +++ b/src/ZipLib/streams/streambuffs/mem_streambuf.h @@ -0,0 +1,201 @@ +#pragma once +#include +#include +#include + +template +class mem_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + mem_streambuf(ELEM_TYPE* buffer, size_t length) + { + // set stream buffer + ELEM_TYPE* endOfBuffer = buffer + length; + this->setg(buffer, buffer, endOfBuffer); + this->setp(buffer, buffer, endOfBuffer); + } + + protected: + int_type underflow() override + { + // buffer not exhausted + if (this->gptr() < this->egptr()) + { + return traits_type::to_int_type(*this->gptr()); + } + + return traits_type::eof(); + } + + int_type overflow(int_type c = traits_type::eof()) override + { + assert(this->pptr() != nullptr); + + // check if incoming character is not EOF + // also, we might not overflow the buffer + if (!traits_type::eq_int_type(c, traits_type::eof()) && + this->pptr() < this->epptr()) + { + *this->pptr() = c; + this->pbump(1); // shift pptr() by 1 + return c; // return value must not be EOF + } + + return traits_type::eof(); + } + + pos_type seekpos(pos_type pos, std::ios::openmode which = std::ios::in | std::ios::out) override + { + static const off_type BAD_OFFSET(-1); + + // depending on which pointer we move, it must be set + assert(which & std::ios::in ? this->gptr() != nullptr : true); + assert(which & std::ios::out ? this->pptr() != nullptr : true); + + // do not seek over the length of buffer + if (pos <= pos_type(this->egptr() - this->eback())) + { + // position of read buffer + if (which & std::ios::in) + { + // move gptr to the right position + this->gbump(static_cast(this->eback() - this->gptr() + pos)); + + if (which & std::ios::out) + { + // change write position to match + this->setp(this->pbase(), this->gptr(), this->epptr()); + } + } + + // position of write buffer + else if (which & std::ios::out) + { + // move pptr to the right position + this->pbump(static_cast(this->eback() - this->pptr() + pos)); + } + + return pos; + } + + // something went wrong + return pos_type(BAD_OFFSET); + } + + pos_type seekoff(off_type off, std::ios::seekdir dir, std::ios::openmode which = std::ios::in | std::ios::out) override + { + static const off_type BAD_OFFSET(-1); + + // depending on which pointer we move, it must be set + assert(which & std::ios::in ? this->gptr() != nullptr : true); + assert(which & std::ios::out ? this->pptr() != nullptr : true); + + if (which & std::ios::in) + { + // position within read buffer + if (dir == std::ios::end) + { + off += off_type(this->egptr() - this->eback()); + } + else if (dir == std::ios::cur && (which & std::ios::out) == 0) + { + off += off_type(this->gptr() - this->eback()); + } + else if (dir != std::ios::beg) + { + off = BAD_OFFSET; + } + + if (off >= 0 && off <= off_type(this->egptr() - this->eback())) + { + // move gptr to the right position + this->gbump(static_cast(this->eback() - this->gptr() + off)); + if (which & std::ios::out) + { + // change write position to match + this->setp(this->pbase(), this->gptr(), this->epptr()); + } + } + else + { + off = BAD_OFFSET; + } + } + else if (which & std::ios::out) + { + // position within write buffer + if (dir == std::ios::end) + { + off += off_type(this->egptr() - this->eback()); + } + else if (dir == std::ios::cur) + { + off += off_type(this->pptr() - this->eback()); + } + else if (dir != std::ios::beg) + { + // if dir is ios::beg, just leave the offset set as is + // if dir is not neither of the valid directions, set bad offset + off = BAD_OFFSET; + } + + if (off >= 0 && off <= off_type(this->egptr() - this->eback())) + { + // change write position + this->pbump(static_cast(this->eback() - this->pptr() + off)); + } + else + { + off = BAD_OFFSET; + } + } + else + { + // neither read nor write buffer selected, fail + off = BAD_OFFSET; + } + return (pos_type(off)); + } + + int_type pbackfail(int_type c = traits_type::eof()) override + { + assert(this->gptr() != nullptr); + + // put an element back to stream + if (this->gptr() <= this->eback() || // do not underflow + (!traits_type::eq_int_type(traits_type::eof(), c) && + !traits_type::eq(traits_type::to_char_type(c), this->gptr()[-1]))) + { + // can't put back, fail + return (traits_type::eof()); + } + else + { + // back up one position and store put-back character + this->gbump(-1); + + if (!traits_type::eq_int_type(traits_type::eof(), c)) + { + *this->gptr() = traits_type::to_char_type(c); + } + + return (traits_type::not_eof(c)); + } + } + + private: + void setp(ELEM_TYPE* first, ELEM_TYPE* next, ELEM_TYPE* last) + { + this->std::basic_streambuf::setp(first, last); + this->pbump(static_cast(next - first)); + } +}; diff --git a/src/ZipLib/streams/streambuffs/null_streambuf.h b/src/ZipLib/streams/streambuffs/null_streambuf.h new file mode 100644 index 00000000..df9ccee2 --- /dev/null +++ b/src/ZipLib/streams/streambuffs/null_streambuf.h @@ -0,0 +1,32 @@ +#pragma once +#include + +template +class null_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + null_streambuf() + { + + } + + protected: + std::streamsize xsgetn(char_type* s, std::streamsize count) override + { + return 0; + } + + std::streamsize xsputn(const ELEM_TYPE* ptr, std::streamsize count) override + { + return count; + } +}; diff --git a/src/ZipLib/streams/streambuffs/sub_streambuf.h b/src/ZipLib/streams/streambuffs/sub_streambuf.h new file mode 100644 index 00000000..4ec48450 --- /dev/null +++ b/src/ZipLib/streams/streambuffs/sub_streambuf.h @@ -0,0 +1,98 @@ +#pragma once +#include +#include +#include + +template +class sub_streambuf : + public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + sub_streambuf() + : _inputStream(nullptr) + , _startPosition(0) + , _currentPosition(0) + , _endPosition(0) + { + + } + + sub_streambuf(std::basic_istream& input, pos_type startOffset, size_t length) + : sub_streambuf() + { + init(input, startOffset, length); + } + + void init(std::basic_istream& input, pos_type startOffset, size_t length) + { + _inputStream = &input; + _startPosition = startOffset; + _currentPosition = startOffset; + _endPosition = startOffset + static_cast(length); + _internalBuffer = new ELEM_TYPE[INTERNAL_BUFFER_SIZE]; + + // set stream buffer + ELEM_TYPE* endOfOutputBuffer = _internalBuffer + INTERNAL_BUFFER_SIZE; + this->setg(endOfOutputBuffer, endOfOutputBuffer, endOfOutputBuffer); + } + + bool is_init() const + { + return (_inputStream != nullptr && _internalBuffer != nullptr); + } + + virtual ~sub_streambuf() + { + if (_internalBuffer != nullptr) + { + delete[] _internalBuffer; + } + } + + protected: + int_type underflow() override + { + // buffer exhausted + if (this->gptr() >= this->egptr()) + { + ELEM_TYPE* base = _internalBuffer; + + _inputStream->seekg(_currentPosition, std::ios::beg); + _inputStream->read(_internalBuffer, std::min(static_cast(INTERNAL_BUFFER_SIZE), static_cast(_endPosition - _currentPosition))); + size_t n = static_cast(_inputStream->gcount()); + + _currentPosition += n; + + if (n == 0) + { + return traits_type::eof(); + } + + // set buffer pointers + this->setg(base, base, base + n); + } + + return traits_type::to_int_type(*this->gptr()); + } + + private: + enum : size_t + { + INTERNAL_BUFFER_SIZE = 1 << 15 + }; + + ELEM_TYPE* _internalBuffer; + + std::basic_istream* _inputStream; + pos_type _startPosition; + pos_type _currentPosition; + pos_type _endPosition; +}; diff --git a/src/ZipLib/streams/streambuffs/tee_streambuff.h b/src/ZipLib/streams/streambuffs/tee_streambuff.h new file mode 100644 index 00000000..a8cc9c7f --- /dev/null +++ b/src/ZipLib/streams/streambuffs/tee_streambuff.h @@ -0,0 +1,63 @@ +#pragma once +#include +#include + +template +class tee_streambuf: + public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + tee_streambuf& bind(base_type* sb) + { + _sbCollection.push_back(sb); + return *this; + } + + tee_streambuf& bind(std::basic_ostream& stream) + { + _sbCollection.push_back(stream.rdbuf()); + return *this; + } + + protected: + int_type overflow(int_type c = traits_type::eof()) override + { + bool failed = false; + + for (auto* sb : _sbCollection) + { + if (sb->sputc(c) == traits_type::eof()) + { + failed = true; + } + } + + return failed ? traits_type::eof() : c; + } + + int sync() override + { + bool failed = false; + + for (auto* sb : _sbCollection) + { + if (sb->pubsync() == -1) + { + failed = true; + } + } + + return failed ? -1 : 0; + } + + private: + std::vector _sbCollection; +}; diff --git a/src/ZipLib/streams/streambuffs/zip_crypto_streambuf.h b/src/ZipLib/streams/streambuffs/zip_crypto_streambuf.h new file mode 100644 index 00000000..f387bfcb --- /dev/null +++ b/src/ZipLib/streams/streambuffs/zip_crypto_streambuf.h @@ -0,0 +1,285 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +#include "../../extlibs/zlib/zlib.h" + +template +class zip_crypto_streambuf + : public std::basic_streambuf +{ + public: + typedef std::basic_streambuf base_type; + typedef typename std::basic_streambuf::traits_type traits_type; + + typedef typename base_type::char_type char_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + zip_crypto_streambuf() + : _internalBuffer(nullptr) + , _inputStream(nullptr) + , _outputStream(nullptr) + , _finalByte(-1) + , _encryptionHeaderRead(false) + , _encryptionHeaderWritten(false) + { + static_assert(sizeof(ELEM_TYPE) == 1, "size of ELEM_TYPE must be 1"); + } + + zip_crypto_streambuf(std::basic_ostream& stream, const ELEM_TYPE* password) + : zip_crypto_streambuf() + { + static_assert(sizeof(ELEM_TYPE) == 1, "size of ELEM_TYPE must be 1"); + init(stream, password); + } + + zip_crypto_streambuf(std::basic_istream& stream, const ELEM_TYPE* password) + : zip_crypto_streambuf() + { + static_assert(sizeof(ELEM_TYPE) == 1, "size of ELEM_TYPE must be 1"); + init(stream, password); + } + + ~zip_crypto_streambuf() + { + if (_internalBuffer != nullptr) + { + delete[] _internalBuffer; + } + } + + void init(std::basic_ostream& stream, const ELEM_TYPE* password) + { + _inputStream = nullptr; + _outputStream = &stream; + _finalByte = -1; + _encryptionHeaderRead = false; + _encryptionHeaderWritten = false; + + init_internal(password); + } + + void init(std::basic_istream& stream, const ELEM_TYPE* password) + { + _inputStream = &stream; + _outputStream = nullptr; + _finalByte = -1; + _encryptionHeaderRead = false; + _encryptionHeaderWritten = false; + + init_internal(password); + } + + bool is_init() const + { + return (_inputStream != nullptr || _outputStream != nullptr); + } + + void set_final_byte(uint8_t c) + { + _finalByte = int(c); + } + + bool has_correct_password() const + { + return (uint8_t(_finalByte) == _encryptionHeader.u8[11]); + } + + bool prepare_for_decryption() + { + if (_inputStream == nullptr) + { + return false; + } + + _inputStream->read(reinterpret_cast(&_encryptionHeader), sizeof(_encryptionHeader)); + finish_decryption_header(); + _encryptionHeaderRead = true; + + return has_correct_password(); + } + + protected: + int_type overflow(int_type c = traits_type::eof()) override + { + bool is_eof = traits_type::eq_int_type(c, traits_type::eof()); + + // buffering would be great, maybe? + if (!is_eof) + { + if (!_encryptionHeaderWritten) + { + finish_encryption_header(); + _outputStream->write(reinterpret_cast(&_encryptionHeader), sizeof(_encryptionHeader)); + _encryptionHeaderWritten = true; + } + + uint8_t encryptedByte = encrypt_byte(uint8_t(c)); + _outputStream->write(reinterpret_cast(&encryptedByte), sizeof(encryptedByte)); + + return encryptedByte; + } + + return traits_type::eof(); + } + + int_type underflow() override + { + // if we're going to decrypt, + // the call to prepare_for_decryption() is needed + if (!_encryptionHeaderRead) + { + return traits_type::eof(); + } + + // buffer exhausted + if (this->gptr() >= this->egptr()) + { + ELEM_TYPE* base = _internalBuffer; + _inputStream->read(_internalBuffer, INTERNAL_BUFFER_SIZE); + + size_t n = static_cast(_inputStream->gcount()); + + if (n == 0) + { + return traits_type::eof(); + } + + decrypt_internal_buffer(n); + + // set buffer pointers + this->setg(base, base, base + n); + } + + return traits_type::to_int_type(*this->gptr()); + } + + int sync() override + { + return _outputStream->rdbuf()->pubsync(); + } + + private: + static uint32_t crc32_byte(uint32_t prevCrc32, uint8_t c) + { + return uint32_t(get_crc_table()[(prevCrc32 ^ c) & 0xff] ^ (prevCrc32 >> 8)); + } + + bool init_internal(const ELEM_TYPE* password) + { + assert(password != nullptr); + + _keys.u32[0] = 0x12345678; + _keys.u32[1] = 0x23456789; + _keys.u32[2] = 0x34567890; + + do + { + update_keys(uint8_t(*password++)); + } while (*password != '\0'); + + // make encryption header + auto seed = std::chrono::system_clock::now().time_since_epoch().count(); + std::mt19937 generator(static_cast(seed)); + + _encryptionHeader.u32[0] = generator(); + _encryptionHeader.u32[1] = generator(); + _encryptionHeader.u32[2] = generator(); + + // set stream buffer + _internalBuffer = new ELEM_TYPE[INTERNAL_BUFFER_SIZE]; + ELEM_TYPE* endOfInternalBuffer = _internalBuffer + INTERNAL_BUFFER_SIZE; + this->setg(endOfInternalBuffer, endOfInternalBuffer, endOfInternalBuffer); + + return true; + } + + void finish_encryption_header() + { + assert(_finalByte != -1); + + _encryptionHeader.u8[11] = uint8_t(_finalByte); + + for (uint8_t& c : _encryptionHeader.u8) + { + c = encrypt_byte(c); + } + } + + void finish_decryption_header() + { + for (uint8_t& c : _encryptionHeader.u8) + { + c = decrypt_byte(c); + } + } + + uint8_t encrypt_byte(uint8_t c) + { + uint8_t result = uint8_t(c ^ get_magic_byte()); + + update_keys(c); + + return result; + } + + uint8_t decrypt_byte(uint8_t c) + { + uint8_t result = uint8_t(c ^ get_magic_byte()); + + update_keys(result); + + return result; + } + + void decrypt_internal_buffer(size_t length) + { + for (size_t i = 0; i < length; ++i) + { + _internalBuffer[i] = decrypt_byte(_internalBuffer[i]); + } + } + + void update_keys(uint8_t c) + { + _keys.u32[0] = crc32_byte(_keys.u32[0], c); + _keys.u32[1] = _keys.u32[1] + uint8_t(_keys.u32[0] & 0x000000ff); + _keys.u32[1] = _keys.u32[1] * 0x08088405 + 1; + _keys.u32[2] = crc32_byte(_keys.u32[2], _keys.u32[1] >> 24); + } + + uint8_t get_magic_byte() const + { + uint16_t t = uint16_t(uint16_t(_keys.u32[2] & 0xFFFF) | 2); + return uint8_t((t * (t ^ 1)) >> 8); + } + + union encryption_header + { + uint8_t u8[12]; + uint32_t u32[3]; + }; + + ////////////////////////////////////////////////////////////////////////// + + enum : size_t + { + INTERNAL_BUFFER_SIZE = 1 << 15 + }; + + ELEM_TYPE* _internalBuffer; + + std::basic_istream* _inputStream; + std::basic_ostream* _outputStream; + encryption_header _keys; + encryption_header _encryptionHeader; + int _finalByte; + bool _encryptionHeaderRead; + bool _encryptionHeaderWritten; +}; diff --git a/src/ZipLib/streams/substream.h b/src/ZipLib/streams/substream.h new file mode 100644 index 00000000..c1fe45e3 --- /dev/null +++ b/src/ZipLib/streams/substream.h @@ -0,0 +1,59 @@ +#pragma once +#include +#include "streambuffs/sub_streambuf.h" + +/** + * \brief Basic input substream. Creates a virtual stream over an existing input stream. + * The substream starts at the position 0 and continues until EOF or the specified length. + */ +template +class basic_isubstream + : public std::basic_istream +{ + public: + typedef typename std::basic_istream::pos_type pos_type; + + basic_isubstream() + : std::basic_istream(&_subStreambuf) + { + + } + + basic_isubstream(std::basic_istream& input, pos_type startOffset = 0) + : std::basic_istream(&_subStreambuf) + , _subStreambuf(input, startOffset, static_cast(-1)) + { + + } + + basic_isubstream(std::basic_istream& input, pos_type startOffset, size_t length) + : std::basic_istream(&_subStreambuf) + , _subStreambuf(input, startOffset, length) + { + + } + + void init(std::basic_istream& input, pos_type startOffset = 0) + { + _subStreambuf.init(input, startOffset, static_cast(-1)); + } + + void init(std::basic_istream& input, pos_type startOffset, size_t length) + { + _subStreambuf.init(input, startOffset, length); + } + + bool is_init() const + { + return _subStreambuf.is_init(); + } + + private: + sub_streambuf _subStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_isubstream> byte_isubstream; +typedef basic_isubstream> isubstream; +typedef basic_isubstream> wisubstream; diff --git a/src/ZipLib/streams/teestream.h b/src/ZipLib/streams/teestream.h new file mode 100644 index 00000000..c70b9b21 --- /dev/null +++ b/src/ZipLib/streams/teestream.h @@ -0,0 +1,55 @@ +#pragma once +#include +#include +#include "streambuffs/tee_streambuff.h" + +/** + * \brief Basic teestream. Distributes the input data into every bound output stream. + */ +template +class basic_teestream + : public std::basic_ostream +{ + public: + basic_teestream() + : std::basic_ostream(&_teeStreambuf) + { + + } + + basic_teestream(basic_teestream&& other) + : basic_teestream() + { + _teeStreambuf = std::move(other._teeStreambuf); + this->swap(other); + } + + basic_teestream& bind(std::basic_streambuf* sb) + { + _teeStreambuf.bind(sb); + return *this; + } + + basic_teestream& bind(std::basic_ostream& stream) + { + _teeStreambuf.bind(stream); + return *this; + } + + basic_teestream move() + { + return std::move(*this); + } + + private: + basic_teestream(const basic_teestream&); + basic_teestream& operator = (const basic_teestream&); + + tee_streambuf _teeStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_teestream> byte_teestream; +typedef basic_teestream> teestream; +typedef basic_teestream> wteestream; diff --git a/src/ZipLib/streams/zip_cryptostream.h b/src/ZipLib/streams/zip_cryptostream.h new file mode 100644 index 00000000..c50396c6 --- /dev/null +++ b/src/ZipLib/streams/zip_cryptostream.h @@ -0,0 +1,67 @@ +#pragma once +#include +#include "streambuffs/zip_crypto_streambuf.h" + +template +class basic_zip_cryptostream + : public std::basic_iostream +{ + public: + basic_zip_cryptostream() + : std::basic_iostream(&_zipCryptoStreambuf) + { + + } + + basic_zip_cryptostream(std::basic_ostream& stream, const ELEM_TYPE* password) + : std::basic_iostream(&_zipCryptoStreambuf) + , _zipCryptoStreambuf(stream, password) + { + + } + + basic_zip_cryptostream(std::basic_istream& stream, const ELEM_TYPE* password) + : std::basic_iostream(&_zipCryptoStreambuf) + , _zipCryptoStreambuf(stream, password) + { + + } + + void init(std::basic_ostream& stream, const ELEM_TYPE* password) + { + _zipCryptoStreambuf.init(stream, password); + } + + void init(std::basic_istream& stream, const ELEM_TYPE* password) + { + _zipCryptoStreambuf.init(stream, password); + } + + bool is_init() const + { + return _zipCryptoStreambuf.is_init(); + } + + void set_final_byte(uint8_t c) + { + _zipCryptoStreambuf.set_final_byte(c); + } + + bool has_correct_password() const + { + return _zipCryptoStreambuf.has_correct_password(); + } + + bool prepare_for_decryption() + { + return _zipCryptoStreambuf.prepare_for_decryption(); + } + + private: + zip_crypto_streambuf _zipCryptoStreambuf; +}; + +////////////////////////////////////////////////////////////////////////// + +typedef basic_zip_cryptostream> byte_zip_cryptostream; +typedef basic_zip_cryptostream> zip_cryptostream; diff --git a/src/ZipLib/utils/enum_utils.h b/src/ZipLib/utils/enum_utils.h new file mode 100644 index 00000000..ab94358f --- /dev/null +++ b/src/ZipLib/utils/enum_utils.h @@ -0,0 +1,15 @@ +#pragma once +#include + +#define MARK_AS_TYPED_ENUMFLAGS_BASE(EnumType, type, friend) \ + inline friend bool operator ! (EnumType lhs) { return bool( ! type (lhs) ); } \ + inline friend EnumType operator ~ (EnumType lhs) { return EnumType( ~ type (lhs) ); } \ + inline friend EnumType operator | (EnumType lhs, EnumType rhs) { return EnumType( type (lhs) | type (rhs) ); } \ + inline friend EnumType operator & (EnumType lhs, EnumType rhs) { return EnumType( type (lhs) & type (rhs) ); } \ + inline friend EnumType operator ^ (EnumType lhs, EnumType rhs) { return EnumType( type (lhs) ^ type (rhs) ); } \ + inline friend EnumType operator |= (EnumType& lhs, EnumType rhs) { return lhs = lhs | rhs; } \ + inline friend EnumType operator &= (EnumType& lhs, EnumType rhs) { return lhs = lhs & rhs; } \ + inline friend EnumType operator ^= (EnumType& lhs, EnumType rhs) { return lhs = lhs ^ rhs; } + +#define MARK_AS_TYPED_ENUMFLAGS(EnumType) MARK_AS_TYPED_ENUMFLAGS_BASE(EnumType, uint32_t, ) +#define MARK_AS_TYPED_ENUMFLAGS_FRIEND(EnumType) MARK_AS_TYPED_ENUMFLAGS_BASE(EnumType, uint32_t, friend) diff --git a/src/ZipLib/utils/stream_utils.h b/src/ZipLib/utils/stream_utils.h new file mode 100644 index 00000000..e06715fd --- /dev/null +++ b/src/ZipLib/utils/stream_utils.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include + +namespace utils { namespace stream { + +static void copy(std::istream& from, std::ostream& to, size_t bufferSize = 1024 * 1024) +{ + std::vector buff(bufferSize); + + do + { + from.read(buff.data(), buff.size()); + to.write(buff.data(), from.gcount()); + } while (static_cast(from.gcount()) == buff.size()); +} + +} } diff --git a/src/ZipLib/utils/time_utils.h b/src/ZipLib/utils/time_utils.h new file mode 100644 index 00000000..6cb73e59 --- /dev/null +++ b/src/ZipLib/utils/time_utils.h @@ -0,0 +1,42 @@ +#pragma once +#include +#include + +#if defined(_MSC_VER) +# define _utils_stream_localtime(dt, ts) do { localtime_s((ts), (dt)); } while (0) +#elif defined(__GNUC__) || defined(__GNUG__) +# define _utils_stream_localtime(dt, ts) do { localtime_r((dt), (ts)); } while (0) +#else +# define _utils_stream_localtime(dt, ts) do { tm* _tmp = localtime(dt); memcpy((ts), _tmp, sizeof(tm)); } while (0) +#endif + +namespace utils { namespace time { + +void timestamp_to_datetime(time_t dateTime, uint16_t& date, uint16_t& time) +{ + tm timeStruct; + + _utils_stream_localtime(&dateTime, &timeStruct); + + date = ((timeStruct.tm_year - 80) << 9) + ((timeStruct.tm_mon + 1) << 5) + timeStruct.tm_mday; + time = (timeStruct.tm_hour << 11) + (timeStruct.tm_min << 5) + (timeStruct.tm_sec >> 1); +} + +time_t datetime_to_timestamp(uint16_t date, uint16_t time) +{ + tm timeStruct; + + timeStruct.tm_year = ((date >> 9) & 0x7f) + 80; + timeStruct.tm_mon = ((date >> 5) & 0x0f) - 1; + timeStruct.tm_mday = ((date) & 0x1f); + + timeStruct.tm_hour = ((time >> 11) & 0x1f); + timeStruct.tm_min = ((time >> 5) & 0x3f); + timeStruct.tm_sec = ((time << 1) & 0x3f); + + return mktime(&timeStruct); +} + +} } + +#undef _utils_stream_localtime diff --git a/src/winmain.cpp b/src/winmain.cpp index 7a4025a0..6cb2afbd 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -17,18 +17,25 @@ along with GUP. If not, see . */ +#include "../ZipLib/ZipFile.h" +#include "../ZipLib/utils/stream_utils.h" + #include #include +#include #include #include #include "resource.h" #include #include "xmlTools.h" + #define CURL_STATICLIB #include "../curl/include/curl/curl.h" using namespace std; +typedef vector ParamVector; + HINSTANCE hInst; static HWND hProgressDlg; static HWND hProgressBar; @@ -42,9 +49,10 @@ static string winGupUserAgent = "WinGup/"; static string dlFileName = ""; const char FLAG_OPTIONS[] = "-options"; -//const char FLAG_VERSION[] = "-v"; const char FLAG_VERBOSE[] = "-verbose"; const char FLAG_HELP[] = "--help"; +const char FLAG_UUZIP[] = "-unzipTo"; +const char FLAG_CLEANUP[] = "-clean"; const char MSGID_NOUPDATE[] = "No update is available."; const char MSGID_UPDATEAVAILABLE[] = "An update package is available, do you want to download it?"; @@ -56,6 +64,8 @@ const char MSGID_HELP[] = "Usage :\r\ gup --help\r\ gup -options\r\ gup [-verbose] [-vVERSION_VALUE] [-pCUSTOM_PARAM]\r\ +gup -clean FOLDER_TO_ACTION\r\ +gup -unzipTo [-clean] FOLDER_TO_ACTION ZIP_URL\r\ \r\ --help : Show this help message (and quit program).\r\ -options : Show the proxy configuration dialog (and quit program).\r\ @@ -66,108 +76,242 @@ gup [-verbose] [-vVERSION_VALUE] [-pCUSTOM_PARAM]\r\ -p : Launch GUP with CUSTOM_PARAM.\r\ CUSTOM_PARAM will pass to destination by using GET method\r\ with argument name \"param\"\r\ - -verbose : Show error/warning message if any."; - + -verbose : Show error/warning message if any.\r\ + -clean: Delete all files in FOLDER_TO_ACTION.\r\ + -unzipTo: Download zip file from ZIP_URL then unzip it into FOLDER_TO_ACTION.\r\ + ZIP_URL: The URL to download zip file.\r\ + FOLDER_TO_ACTION: The folder where we clean or/and unzip to.\r\ + "; std::string thirdDoUpdateDlgButtonLabel; -static bool isInList(const char *token2Find, char *list2Clean) { - char word[1024]; - bool isFileNamePart = false; - for (int i = 0, j = 0 ; i <= int(strlen(list2Clean)) ; i++) +//commandLine should contain path to n++ executable running +void parseCommandLine(const char* commandLine, ParamVector& paramVector) +{ + if (!commandLine) + return; + + char* cmdLine = new char[lstrlenA(commandLine) + 1]; + lstrcpyA(cmdLine, commandLine); + + char* cmdLinePtr = cmdLine; + + bool isInFile = false; + bool isInWhiteSpace = true; + size_t commandLength = lstrlenA(cmdLinePtr); + std::vector args; + for (size_t i = 0; i < commandLength; ++i) { - if ((list2Clean[i] == ' ') || (list2Clean[i] == '\0')) + switch (cmdLinePtr[i]) { - if ((j) && (!isFileNamePart)) + case '\"': //quoted filename, ignore any following whitespace { - word[j] = '\0'; - j = 0; - bool bingo = !strcmp(token2Find, word); - - if (bingo) + if (!isInFile) //" will always be treated as start or end of param, in case the user forgot to add an space { - int wordLen = int(strlen(word)); - int prevPos = i - wordLen; + args.push_back(cmdLinePtr + i + 1); //add next param(since zero terminated original, no overflow of +1) + } + isInFile = !isInFile; + isInWhiteSpace = false; + //because we dont want to leave in any quotes in the filename, remove them now (with zero terminator) + cmdLinePtr[i] = 0; + } + break; - for (i = i + 1 ; i <= int(strlen(list2Clean)) ; i++, prevPos++) - list2Clean[prevPos] = list2Clean[i]; + case '\t': //also treat tab as whitespace + case ' ': + { + isInWhiteSpace = true; + if (!isInFile) + cmdLinePtr[i] = 0; //zap spaces into zero terminators, unless its part of a filename + } + break; - list2Clean[prevPos] = '\0'; - - return true; + default: //default char, if beginning of word, add it + { + if (!isInFile && isInWhiteSpace) + { + args.push_back(cmdLinePtr + i); //add next param + isInWhiteSpace = false; } } } - else if (list2Clean[i] == '"') + } + paramVector.assign(args.begin(), args.end()); + delete[] cmdLine; +}; + +bool isInList(const char* token2Find, ParamVector & params) +{ + size_t nbItems = params.size(); + + for (size_t i = 0; i < nbItems; ++i) + { + if (!strcmp(token2Find, params.at(i).c_str())) { - isFileNamePart = !isFileNamePart; + params.erase(params.begin() + i); + return true; } - else - { - word[j++] = list2Clean[i]; + } + return false; +}; + +bool getParamVal(char c, ParamVector & params, string & value) +{ + value = ""; + size_t nbItems = params.size(); + + for (size_t i = 0; i < nbItems; ++i) + { + const char* token = params.at(i).c_str(); + if (token[0] == '-' && strlen(token) >= 2 && token[1] == c) { //dash, and enough chars + value = (token + 2); + params.erase(params.begin() + i); + return true; } } return false; +} + +class ZipOperation +{ +public: + void setUnzipOp(bool isUnzip) { + if (isUnzip) _op |= unzipOp; + else _op ^= unzipOp; + }; + + void setCleanupOp(bool isClean) { + if (isClean) _op |= cleanOp; + else _op ^= cleanOp; + }; + + void setDestFolder(const string& destFolder) { + _destFolder = destFolder; + } + string getDestFolder() const { return _destFolder; } + + void setDownloadZipUrl(const string& downloadZipUrl) { + _downloadZipUrl = downloadZipUrl; + } + string getDownloadZipUrl() const { return _downloadZipUrl; } + + bool isUnzipReady() const { + return (_op & unzipOp) && !_downloadZipUrl.empty() && !_destFolder.empty(); + }; + + bool isCleanupReady() const { + return (_op & cleanOp) && !_destFolder.empty(); + }; + + bool isReady2Go() const { + return isUnzipReady() || isCleanupReady(); + } + +private: + const unsigned char unzipOp = 1; + const unsigned char cleanOp = 2; + unsigned char _op = 0; + + string _destFolder; + string _downloadZipUrl; }; -static string getParamVal(char c, char *list2Clean) { - char word[1024]; - bool checkDash = true; - bool checkCh = false; - bool action = false; - bool isFileNamePart = false; - int pos2Erase = 0; - for (int i = 0, j = 0 ; i <= int(strlen(list2Clean)) ; i++) +string PathAppend(string& strDest, const string& str2append) +{ + if (strDest.empty() && str2append.empty()) // "" + "" { - if ((list2Clean[i] == ' ') || (list2Clean[i] == '\0')) - { - if (action) - { - word[j] = '\0'; - j = 0; - action = false; + strDest = "\\"; + return strDest; + } - for (i = i + 1 ; i <= int(strlen(list2Clean)) ; i++, pos2Erase++) - list2Clean[pos2Erase] = list2Clean[i]; - - list2Clean[pos2Erase] = '\0'; + if (strDest.empty() && !str2append.empty()) // "" + titi + { + strDest = str2append; + return strDest; + } - return word; - } - checkDash = true; - } - else if (list2Clean[i] == '"') - { - isFileNamePart = !isFileNamePart; - } + if (strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] == '\\')) // toto\ + \titi + { + strDest.erase(strDest.length() - 1, 1); + strDest += str2append; + return strDest; + } - if (!isFileNamePart) - { - if (action) - { - word[j++] = list2Clean[i]; - } - else if (checkDash) - { - if (list2Clean[i] == '-') - checkCh = true; - - if (list2Clean[i] != ' ') - checkDash = false; - } - else if (checkCh) + if ((strDest[strDest.length() - 1] == '\\' && (!str2append.empty() && str2append[0] != '\\')) // toto\ + titi + || (strDest[strDest.length() - 1] != '\\' && (!str2append.empty() && str2append[0] == '\\'))) // toto + \titi + { + strDest += str2append; + return strDest; + } + + // toto + titi + strDest += "\\"; + strDest += str2append; + + return strDest; +}; + +bool decompress(const string& zipFullFilePath, const string& unzipDestTo) +{ + // if destination folder doesn't exist, create it. + if (!::PathFileExistsA(unzipDestTo.c_str())) + { + if (!::CreateDirectoryA(unzipDestTo.c_str(), NULL)) + return false; + } + + ZipArchive::Ptr archive = ZipFile::Open(zipFullFilePath.c_str()); + + std::istream* decompressStream = nullptr; + auto count = archive->GetEntriesCount(); + + if (!count) // wrong archive format + return false; + + for (size_t i = 0; i < count; ++i) + { + ZipArchiveEntry::Ptr entry = archive->GetEntry(static_cast(i)); + assert(entry != nullptr); + + //("[+] Trying no pass...\n"); + decompressStream = entry->GetDecompressionStream(); + assert(decompressStream != nullptr); + + string file2extrait = entry->GetFullName(); + printf("[+] Extracting file '%s'\n", file2extrait.c_str()); + + string extraitFullFilePath = unzipDestTo; + PathAppend(extraitFullFilePath, file2extrait); + + auto pos = extraitFullFilePath.find_last_of('/'); + if (pos == extraitFullFilePath.length() - 1) // it's a folder to created + { + // if folder doesn't exist, create it. + if (!::PathFileExistsA(extraitFullFilePath.c_str())) { - if (list2Clean[i] == c) - { - action = true; - pos2Erase = i-1; - } - checkCh = false; - } - } + if (!::CreateDirectoryA(extraitFullFilePath.c_str(), NULL)) + return false; + } + } + else + { + std::ofstream destFile; + destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + + if (!destFile.is_open()) + { + throw std::runtime_error("cannot create destination file"); + } + + utils::stream::copy(*decompressStream, destFile); + + destFile.flush(); + destFile.close(); + } } - return ""; + + return true; }; static void goToScreenCenter(HWND hwnd) @@ -214,20 +358,20 @@ static size_t getDownloadData(unsigned char *data, size_t size, size_t nmemb, FI return len; }; -static size_t ratio = 0; +static size_t downloadRatio = 0; static size_t setProgress(HWND, double t, double d, double, double) { while (stopDL) ::Sleep(1000); - size_t step = size_t(d * 100.0 / t - ratio); - ratio = size_t(d * 100.0 / t); + size_t step = size_t(d * 100.0 / t - downloadRatio); + downloadRatio = size_t(d * 100.0 / t); SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0); SendMessage(hProgressBar, PBM_STEPIT, 0, 0); char percentage[128]; - sprintf(percentage, "Downloading %s: %Iu %%", dlFileName.c_str(), ratio); + sprintf(percentage, "Downloading %s: %Iu %%", dlFileName.c_str(), downloadRatio); ::SetWindowTextA(hProgressDlg, percentage); return 0; }; @@ -353,7 +497,7 @@ static DWORD WINAPI launchProgressBar(void *) return 0; } -bool downloadBinary(string urlFrom, string destTo, pair proxyServerInfo, bool isSilentMode, pair stoppedMessage) +bool downloadBinary(const string& urlFrom, const string& destTo, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) { FILE* pFile = fopen(destTo.c_str(), "wb"); @@ -406,7 +550,7 @@ bool downloadBinary(string urlFrom, string destTo, pair proxyServer return true; } -bool getUpdateInfo(string &info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const string& customParam, const string& version) +bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const string& customParam, const string& version) { char errorBuffer[CURL_ERROR_SIZE] = { 0 }; @@ -525,19 +669,58 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool isSilentMode = false; FILE *pFile = NULL; - bool launchSettingsDlg = false; - bool isVerbose = false; - bool isHelp = false; - string version = ""; - string customParam = ""; + string version; + string customParam; + ZipOperation zipOp; + + ParamVector params; + parseCommandLine(lpszCmdLine, params); + + bool launchSettingsDlg = isInList(FLAG_OPTIONS, params); + bool isVerbose = isInList(FLAG_VERBOSE, params); + bool isHelp = isInList(FLAG_HELP, params); + bool isCleanUp = isInList(FLAG_CLEANUP, params); + bool isUnzip = isInList(FLAG_UUZIP, params); + + getParamVal('v', params, version); + getParamVal('p', params, customParam); - if (lpszCmdLine && lpszCmdLine[0]) + if (isCleanUp || isUnzip) { - launchSettingsDlg = isInList(FLAG_OPTIONS, lpszCmdLine); - isVerbose = isInList(FLAG_VERBOSE, lpszCmdLine); - isHelp = isInList(FLAG_HELP, lpszCmdLine); - version = getParamVal('v', lpszCmdLine); - customParam = getParamVal('p', lpszCmdLine); + // retrieve the dir to clean up and url to download + + /* + for (auto& i : params) + { + MessageBoxA(NULL, i.c_str(), "", MB_OK); + } + */ + + size_t nbParam = params.size(); + + if (nbParam == 1) // only clean + { + if (isUnzip) + return -1; + + zipOp.setDestFolder(params[0]); + } + else if (nbParam == 2) // must be unzipTo + { + if (!isUnzip) + return -1; + + zipOp.setDestFolder(params[0]); + zipOp.setDownloadZipUrl(params[1]); + } + else + { + return -1; + } + zipOp.setCleanupOp(isCleanUp); + zipOp.setUnzipOp(isUnzip); + + //decompress(params[0], params[1]); } if (isHelp) @@ -549,7 +732,70 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) GupExtraOptions extraOptions("gupOptions.xml"); GupNativeLang nativeLang("nativeLang.xml"); GupParameters gupParams("gup.xml"); - + + if (zipOp.isReady2Go()) + { + // Clean up firstly + if (zipOp.isCleanupReady()) + { + //::DeleteFile(fileNamePath); + + auto len = zipOp.getDestFolder().length(); + LPSTR actionFolder = new char[len + 2]; + strcpy(actionFolder, zipOp.getDestFolder().c_str()); + actionFolder[len] = 0; + actionFolder[len+1] = 0; + + SHFILEOPSTRUCTA fileOpStruct = { 0 }; + fileOpStruct.hwnd = NULL; + fileOpStruct.pFrom = actionFolder; + fileOpStruct.pTo = NULL; + fileOpStruct.wFunc = FO_DELETE; + fileOpStruct.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; + fileOpStruct.fAnyOperationsAborted = false; + fileOpStruct.hNameMappings = NULL; + fileOpStruct.lpszProgressTitle = NULL; + + int res = SHFileOperationA(&fileOpStruct); + if (res != 0) + { + // problem + } + } + + if (zipOp.isUnzipReady()) + { + std::string dlDest = std::getenv("TEMP"); + dlDest += "\\"; + dlDest += ::PathFindFileNameA(zipOp.getDownloadZipUrl().c_str()); + + char *ext = ::PathFindExtensionA(zipOp.getDownloadZipUrl().c_str()); + if (strcmp(ext, ".zip") != 0) + dlDest += ".zip"; + + dlFileName = ::PathFindFileNameA(zipOp.getDownloadZipUrl().c_str()); + + + string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == "") + dlStopped = MSGID_DOWNLOADSTOPPED; + + bool isSuccessful = downloadBinary(zipOp.getDownloadZipUrl(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + if (!isSuccessful) + { + return -1; + } + + isSuccessful = decompress(dlDest, zipOp.getDestFolder()); + if (!isSuccessful) + { + return -1; + } + } + + return 0; + } + hInst = hInstance; try { if (launchSettingsDlg) @@ -576,8 +822,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Get your software's current version. // If you pass the version number as the argument // then the version set in the gup.xml will be overrided - if (lpszCmdLine && lpszCmdLine[0]) - gupParams.setCurrentVersion(lpszCmdLine); + if (!version.empty()) + gupParams.setCurrentVersion(version.c_str()); // override silent mode if "-isVerbose" is passed as argument if (isVerbose) diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 3bdb224a..3ee06e0f 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -98,8 +98,8 @@ NoExtensions - libcurl_debug.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x86-debug-dll-ipv6-sspi-winssl\lib;%(AdditionalLibraryDirectories) + libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc14-x86-debug-dll-ipv6-sspi-winssl\lib;Bin\x86\Debug;%(AdditionalLibraryDirectories) true Windows MachineX86 @@ -123,8 +123,8 @@ true - libcurl_debug.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x64-debug-dll-ipv6-sspi-winssl\lib;%(AdditionalLibraryDirectories) + libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc14-x64-debug-dll-ipv6-sspi-winssl\lib;Bin\x64\Debug;%(AdditionalLibraryDirectories) true Windows @@ -149,8 +149,8 @@ NoExtensions - libcurl.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x86-release-dll-ipv6-sspi-winssl\lib;%(AdditionalLibraryDirectories) + libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc14-x86-release-dll-ipv6-sspi-winssl\lib;Bin\x86\Release;%(AdditionalLibraryDirectories) false Windows true @@ -189,8 +189,8 @@ del ..\bin\GUP.ipdb true - libcurl.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\lib;%(AdditionalLibraryDirectories) + libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\lib;Bin\x64\Release;%(AdditionalLibraryDirectories) false Windows true From 8634ebf2152ad9ee945bad48f51e04d91960c6b1 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 1 Apr 2018 17:55:51 +0200 Subject: [PATCH 004/110] Add VS solution --- .gitignore | 1 - src/winmain.cpp | 33 +++++++++++------------ vcproj/GUP.sln | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 vcproj/GUP.sln diff --git a/.gitignore b/.gitignore index b26c59b7..bd514d9f 100644 --- a/.gitignore +++ b/.gitignore @@ -89,7 +89,6 @@ $RECYCLE.BIN/ *.d *.o -vcproj/GUP.sln curl/winbuild/CURL_OBJS.inc curl/winbuild/LIBCURL_OBJS.inc curl/winbuild/vc120.idb diff --git a/src/winmain.cpp b/src/winmain.cpp index 6cb2afbd..9a65789f 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -685,17 +685,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) getParamVal('v', params, version); getParamVal('p', params, customParam); + if (isHelp) + { + ::MessageBoxA(NULL, MSGID_HELP, "GUP Command Argument Help", MB_OK); + return 0; + } + if (isCleanUp || isUnzip) { // retrieve the dir to clean up and url to download - - /* - for (auto& i : params) - { - MessageBoxA(NULL, i.c_str(), "", MB_OK); - } - */ - size_t nbParam = params.size(); if (nbParam == 1) // only clean @@ -723,12 +721,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) //decompress(params[0], params[1]); } - if (isHelp) - { - ::MessageBoxA(NULL, MSGID_HELP, "GUP Command Argument Help", MB_OK); - return 0; - } - GupExtraOptions extraOptions("gupOptions.xml"); GupNativeLang nativeLang("nativeLang.xml"); GupParameters gupParams("gup.xml"); @@ -738,8 +730,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Clean up firstly if (zipOp.isCleanupReady()) { - //::DeleteFile(fileNamePath); - + // else delete directly auto len = zipOp.getDestFolder().length(); LPSTR actionFolder = new char[len + 2]; strcpy(actionFolder, zipOp.getDestFolder().c_str()); @@ -751,7 +742,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) fileOpStruct.pFrom = actionFolder; fileOpStruct.pTo = NULL; fileOpStruct.wFunc = FO_DELETE; - fileOpStruct.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; + fileOpStruct.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_ALLOWUNDO; fileOpStruct.fAnyOperationsAborted = false; fileOpStruct.hNameMappings = NULL; fileOpStruct.lpszProgressTitle = NULL; @@ -783,12 +774,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool isSuccessful = downloadBinary(zipOp.getDownloadZipUrl(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!isSuccessful) { + if (zipOp.isCleanupReady()) + { + //TODO move back the folder from temp + } return -1; } isSuccessful = decompress(dlDest, zipOp.getDestFolder()); if (!isSuccessful) { + if (zipOp.isCleanupReady()) + { + //TODO move back the folder from temp + } return -1; } } diff --git a/vcproj/GUP.sln b/vcproj/GUP.sln new file mode 100644 index 00000000..f2304e63 --- /dev/null +++ b/vcproj/GUP.sln @@ -0,0 +1,71 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUP", "GUP.vcxproj", "{B97C3450-77CA-4009-A5C7-00953E64B07A}" + ProjectSection(ProjectDependencies) = postProject + {5C9FD859-DDF9-4510-8397-B329B0AE8C48} = {5C9FD859-DDF9-4510-8397-B329B0AE8C48} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\src\ZipLib\extlibs\bzip2\bzip2.vcxproj", "{DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzma", "..\src\ZipLib\extlibs\lzma\lzma.vcxproj", "{7EAD1358-3E72-4FB6-A212-25D462B5C1E9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\src\ZipLib\extlibs\zlib\zlib.vcxproj", "{BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipLib", "..\src\ZipLib\ZipLib.vcxproj", "{5C9FD859-DDF9-4510-8397-B329B0AE8C48}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x64.ActiveCfg = Debug|x64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x64.Build.0 = Debug|x64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x86.ActiveCfg = Debug|Win32 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x86.Build.0 = Debug|Win32 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x64.ActiveCfg = Release|x64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x64.Build.0 = Release|x64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x86.ActiveCfg = Release|Win32 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x86.Build.0 = Release|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.ActiveCfg = Debug|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.Build.0 = Debug|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.ActiveCfg = Debug|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.Build.0 = Debug|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.ActiveCfg = Release|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.Build.0 = Release|x64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.ActiveCfg = Release|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.Build.0 = Release|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.ActiveCfg = Debug|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.Build.0 = Debug|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.ActiveCfg = Debug|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.Build.0 = Debug|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.ActiveCfg = Release|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.Build.0 = Release|x64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.ActiveCfg = Release|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.Build.0 = Release|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.ActiveCfg = Debug|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.Build.0 = Debug|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.ActiveCfg = Debug|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.Build.0 = Debug|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.ActiveCfg = Release|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.Build.0 = Release|x64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.ActiveCfg = Release|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.Build.0 = Release|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.ActiveCfg = Debug|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.Build.0 = Debug|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.ActiveCfg = Debug|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.Build.0 = Debug|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.ActiveCfg = Release|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.Build.0 = Release|x64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x86.ActiveCfg = Release|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From a7619fb07353c7288f9fd572014d392477cb3592 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 11 May 2018 02:39:51 +0200 Subject: [PATCH 005/110] WinGup (for Notepad++) 5.0 release --- README.md | 2 +- src/gup.rc | 6 +++--- src/resource.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f074fb5f..616eca28 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ How to build it? x86 release: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static MACHINE=x86 x86 debug: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static DEBUG=yes MACHINE=x86 ``` - 1. Open [`vcproj\GUP.vcxproj`](https://github.com/gup4win/wingup/blob/master/vcproj/GUP.vcxproj) + 1. Open [`vcproj\GUP.sln`](https://github.com/gup4win/wingup/blob/master/vcproj/GUP.sln) 2. Build WinGup [like a normal Visual Studio project](https://msdn.microsoft.com/en-us/library/7s88b19e.aspx) with VS2015 diff --git a/src/gup.rc b/src/gup.rc index 7c93564e..c338cf46 100644 --- a/src/gup.rc +++ b/src/gup.rc @@ -38,12 +38,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Don HO don.h@free.fr\0" - VALUE "FileDescription", "GUP : a free (LGPL) Generic Updater\0" + VALUE "FileDescription", "WinGup for Notepad++\0" VALUE "FileVersion", VERSION_VALUE VALUE "InternalName", "gup.exe\0" - VALUE "LegalCopyright", "Copyright 2007 by Don HO\0" + VALUE "LegalCopyright", "Copyright 2018 by Don HO\0" VALUE "OriginalFilename", "gup.exe\0" - VALUE "ProductName", "GUP\0" + VALUE "ProductName", "WinGup for Notepad++\0" VALUE "ProductVersion", VERSION_VALUE END END diff --git a/src/resource.h b/src/resource.h index 2aa9d457..a1a39b6a 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "4.2\0" -#define VERSION_DIGITALVALUE 4, 2, 0, 0 +#define VERSION_VALUE "5.0\0" +#define VERSION_DIGITALVALUE 5, 0, 0, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 3e49cf231eb5d3b528ce000d634817170b6fb9e5 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 11 May 2018 03:05:22 +0200 Subject: [PATCH 006/110] WinGup (for Notepad++) 5.0 release Update change log --- src/change.log | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/change.log b/src/change.log index 618240d8..0bb0d8d7 100644 --- a/src/change.log +++ b/src/change.log @@ -1,7 +1,3 @@ -GUP v4.2 bug-fix & new enhancement: +WinGup (for Notepad++) v5 new enhancement: -1. Update cURL from 7.42.1 to 7.56.1 -2. Enable CURLSSLOPT_NO_REVOKE option in cURL to fix the problem that updating requires certificate support: - https://github.com/notepad-plus-plus/notepad-plus-plus/issues/1237 -3. Fixed unwanted message displaying issue. -4. Add more tanslations. +1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean) \ No newline at end of file From a28ba5ca26d96b7f8a282b0ed9cee25db19950bb Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 17 May 2018 09:30:16 +0200 Subject: [PATCH 007/110] Fix unzip bug & enhance error management in case of probllem of unzip --- src/winmain.cpp | 187 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 146 insertions(+), 41 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 9a65789f..2c32d850 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -21,6 +21,7 @@ #include "../ZipLib/utils/stream_utils.h" #include +#include #include #include #include @@ -59,6 +60,7 @@ const char MSGID_UPDATEAVAILABLE[] = "An update package is available, do you wan const char MSGID_DOWNLOADSTOPPED[] = "Download is stopped by user. Update is aborted."; const char MSGID_CLOSEAPP[] = " is opened.\rUpdater will close it in order to process the installation.\rContinue?"; const char MSGID_ABORTORNOT[] = "Do you want to abort update download?"; +const char MSGID_UNZIPFAILED[] = "Unzip operation failed. It could be zip file is invalid.\nOld files are about to be restored."; const char MSGID_HELP[] = "Usage :\r\ \r\ gup --help\r\ @@ -252,6 +254,52 @@ string PathAppend(string& strDest, const string& str2append) return strDest; }; +vector tokenizeString(const string & tokenString, const char delim) +{ + //Vector is created on stack and copied on return + std::vector tokens; + + // Skip delimiters at beginning. + string::size_type lastPos = tokenString.find_first_not_of(delim, 0); + // Find first "non-delimiter". + string::size_type pos = tokenString.find_first_of(delim, lastPos); + + while (pos != std::string::npos || lastPos != std::string::npos) + { + // Found a token, add it to the vector. + tokens.push_back(tokenString.substr(lastPos, pos - lastPos)); + // Skip delimiters. Note the "not_of" + lastPos = tokenString.find_first_not_of(delim, pos); + // Find next "non-delimiter" + pos = tokenString.find_first_of(delim, lastPos); + } + return tokens; +}; + +bool deleteFileOrFolder(const string& f2delete) +{ + auto len = f2delete.length(); + LPSTR actionFolder = new char[len + 2]; + strcpy(actionFolder, f2delete.c_str()); + actionFolder[len] = 0; + actionFolder[len + 1] = 0; + + SHFILEOPSTRUCTA fileOpStruct = { 0 }; + fileOpStruct.hwnd = NULL; + fileOpStruct.pFrom = actionFolder; + fileOpStruct.pTo = NULL; + fileOpStruct.wFunc = FO_DELETE; + fileOpStruct.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_ALLOWUNDO; + fileOpStruct.fAnyOperationsAborted = false; + fileOpStruct.hNameMappings = NULL; + fileOpStruct.lpszProgressTitle = NULL; + + int res = SHFileOperationA(&fileOpStruct); + + delete[] actionFolder; + return (res == 0); +}; + bool decompress(const string& zipFullFilePath, const string& unzipDestTo) { // if destination folder doesn't exist, create it. @@ -279,29 +327,91 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) assert(decompressStream != nullptr); string file2extrait = entry->GetFullName(); - printf("[+] Extracting file '%s'\n", file2extrait.c_str()); - string extraitFullFilePath = unzipDestTo; PathAppend(extraitFullFilePath, file2extrait); - auto pos = extraitFullFilePath.find_last_of('/'); - if (pos == extraitFullFilePath.length() - 1) // it's a folder to created + ZipArchiveEntry::Attributes attr = entry->GetAttributes(); + + //auto pos = extraitFullFilePath.find_last_of('/'); + //if (pos == extraitFullFilePath.length() - 1) // it's a folder to created + if (attr == ZipArchiveEntry::Attributes::Directory) { // if folder doesn't exist, create it. if (!::PathFileExistsA(extraitFullFilePath.c_str())) { + char msg[1024]; + sprintf(msg, "[+] Create folder '%s'\n", file2extrait.c_str()); + OutputDebugStringA(msg); + if (!::CreateDirectoryA(extraitFullFilePath.c_str(), NULL)) return false; } } else { + char msg[1024]; + sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); + OutputDebugStringA(msg); + std::ofstream destFile; destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + // + // We try to catch the wrong detection of folder entry from ZipLib here + // if (!destFile.is_open()) { - throw std::runtime_error("cannot create destination file"); + // file2extrait be separated into an array + vector strArray = tokenizeString(file2extrait, '/'); + + // loop unzipDestTo + file2extraitVector[i] to create directory (by checking existing file length is 0, and removing existing file) + if (strArray.size() > 1) + { + for (size_t j = 0; j < strArray.size() - 1; ++j) + { + string folderFullFilePath = unzipDestTo; + PathAppend(folderFullFilePath, strArray[j]); + + BOOL isCreateFolderOK = FALSE; + if (::PathFileExistsA(folderFullFilePath.c_str())) + { + // check if it is 0 length + struct _stat64 buf; + _stat64(folderFullFilePath.c_str(), &buf); + + if (buf.st_size == 0) + { + // if 0 length remove it + deleteFileOrFolder(folderFullFilePath); + } + else + { + return false; + } + + // create it + isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); + } + else + { + // create it + isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); + } + + // check if directory creation failed + if (!isCreateFolderOK) + return false; + + } + // copy again + std::ofstream destFile2; + destFile2.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + + if (!destFile2.is_open()) + { + return false; + } + } } utils::stream::copy(*decompressStream, destFile); @@ -664,6 +774,7 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, return true; } + int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { bool isSilentMode = false; @@ -717,8 +828,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) } zipOp.setCleanupOp(isCleanUp); zipOp.setUnzipOp(isUnzip); - - //decompress(params[0], params[1]); } GupExtraOptions extraOptions("gupOptions.xml"); @@ -727,40 +836,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (zipOp.isReady2Go()) { - // Clean up firstly - if (zipOp.isCleanupReady()) + // if -unzip is present, -clean will be ignored + if (!zipOp.isUnzipReady() && zipOp.isCleanupReady()) { - // else delete directly - auto len = zipOp.getDestFolder().length(); - LPSTR actionFolder = new char[len + 2]; - strcpy(actionFolder, zipOp.getDestFolder().c_str()); - actionFolder[len] = 0; - actionFolder[len+1] = 0; - - SHFILEOPSTRUCTA fileOpStruct = { 0 }; - fileOpStruct.hwnd = NULL; - fileOpStruct.pFrom = actionFolder; - fileOpStruct.pTo = NULL; - fileOpStruct.wFunc = FO_DELETE; - fileOpStruct.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_ALLOWUNDO; - fileOpStruct.fAnyOperationsAborted = false; - fileOpStruct.hNameMappings = NULL; - fileOpStruct.lpszProgressTitle = NULL; - - int res = SHFileOperationA(&fileOpStruct); - if (res != 0) - { - // problem - } + deleteFileOrFolder(zipOp.getDestFolder()); } - + if (zipOp.isUnzipReady()) { std::string dlDest = std::getenv("TEMP"); dlDest += "\\"; dlDest += ::PathFindFileNameA(zipOp.getDownloadZipUrl().c_str()); - char *ext = ::PathFindExtensionA(zipOp.getDownloadZipUrl().c_str()); + char *ext = ::PathFindExtensionA(dlDest.c_str()); if (strcmp(ext, ".zip") != 0) dlDest += ".zip"; @@ -771,25 +859,42 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (dlStopped == "") dlStopped = MSGID_DOWNLOADSTOPPED; + bool isSuccessful = downloadBinary(zipOp.getDownloadZipUrl(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!isSuccessful) { - if (zipOp.isCleanupReady()) - { - //TODO move back the folder from temp - } return -1; } + // check if renamed folder exist, if it does, delete it + string backup4RestoreInCaseOfFailedPath = zipOp.getDestFolder() + ".backup4RestoreInCaseOfFailed"; + if (::PathFileExistsA(backup4RestoreInCaseOfFailedPath.c_str())) + deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + + // rename the folder with suffix ".backup4RestoreInCaseOfFailed" + ::MoveFileA(zipOp.getDestFolder().c_str(), backup4RestoreInCaseOfFailedPath.c_str()); + isSuccessful = decompress(dlDest, zipOp.getDestFolder()); if (!isSuccessful) { - if (zipOp.isCleanupReady()) - { - //TODO move back the folder from temp - } + string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); + if (unzipFailed == "") + unzipFailed = MSGID_UNZIPFAILED; + + ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + + // Delete incomplete unzipped folder + deleteFileOrFolder(zipOp.getDestFolder()); + + // rename back the folder + ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), zipOp.getDestFolder().c_str()); + return -1; } + + // delete the folder with suffix ".backup4RestoreInCaseOfFailed" + deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + } return 0; From 90cebf2c18549104b294421f5f75fcffb5ad1160 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 19 May 2018 17:34:35 +0200 Subject: [PATCH 008/110] Add 1 translatable entry --- src/ConfigFiles/nativeLang.xml | 1 + src/translations/catalan.xml | 2 +- src/translations/french.xml | 3 ++- src/translations/german.xml | 2 +- src/translations/italian.xml | 2 +- src/translations/portuguese.xml | 2 +- src/translations/russian.xml | 2 +- src/translations/spanish.xml | 2 +- src/winmain.cpp | 2 +- 9 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ConfigFiles/nativeLang.xml b/src/ConfigFiles/nativeLang.xml index 98c66916..3b1a5e3c 100644 --- a/src/ConfigFiles/nativeLang.xml +++ b/src/ConfigFiles/nativeLang.xml @@ -27,5 +27,6 @@ Download is stopped by user. Update is aborted. is opened.\rUpdater will close it in order to process the installation.\rContinue? Do you want to abort update download? + "Can't unzip: Operation not permitted or decompression failed" diff --git a/src/translations/catalan.xml b/src/translations/catalan.xml index 8e2aee79..cabdad7b 100644 --- a/src/translations/catalan.xml +++ b/src/translations/catalan.xml @@ -1,3 +1,4 @@ + - No hi ha cap actualitzaci disponible. diff --git a/src/translations/french.xml b/src/translations/french.xml index 51a14915..1b536ace 100644 --- a/src/translations/french.xml +++ b/src/translations/french.xml @@ -1,3 +1,4 @@ + - La mise jour n'est pas disponible. @@ -27,5 +27,6 @@ Use this file to set your proxy settings if need. Le tlchargement est interrompu. La mise jour ne sera pas poursuivie. est ouvert. Il sera ferm afin de pouvoir poursuivre l'installation. Continue? Etes-vous sr d'interrompre le tlchargement? + "Impossible de dzipper: l'opration n'est pas permise ou la dcompression a chou." diff --git a/src/translations/german.xml b/src/translations/german.xml index b1987f18..2e6f2f63 100644 --- a/src/translations/german.xml +++ b/src/translations/german.xml @@ -1,3 +1,4 @@ + - diff --git a/src/translations/italian.xml b/src/translations/italian.xml index 1ea06f93..c24aca07 100644 --- a/src/translations/italian.xml +++ b/src/translations/italian.xml @@ -1,3 +1,4 @@ + - Nessun aggiornamento disponibile. diff --git a/src/translations/portuguese.xml b/src/translations/portuguese.xml index da102e0b..513f3f19 100644 --- a/src/translations/portuguese.xml +++ b/src/translations/portuguese.xml @@ -1,3 +1,4 @@ + - Nenhuma atualização disponível. diff --git a/src/translations/russian.xml b/src/translations/russian.xml index c279799a..d03701d2 100644 --- a/src/translations/russian.xml +++ b/src/translations/russian.xml @@ -1,3 +1,4 @@ + - diff --git a/src/translations/spanish.xml b/src/translations/spanish.xml index de430fb7..e32921e5 100644 --- a/src/translations/spanish.xml +++ b/src/translations/spanish.xml @@ -1,3 +1,4 @@ + - No hay ninguna actualizacin disponible. diff --git a/src/winmain.cpp b/src/winmain.cpp index 2c32d850..c502fc18 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -60,7 +60,7 @@ const char MSGID_UPDATEAVAILABLE[] = "An update package is available, do you wan const char MSGID_DOWNLOADSTOPPED[] = "Download is stopped by user. Update is aborted."; const char MSGID_CLOSEAPP[] = " is opened.\rUpdater will close it in order to process the installation.\rContinue?"; const char MSGID_ABORTORNOT[] = "Do you want to abort update download?"; -const char MSGID_UNZIPFAILED[] = "Unzip operation failed. It could be zip file is invalid.\nOld files are about to be restored."; +const char MSGID_UNZIPFAILED[] = "Can't unzip:\nOperation not permitted or decompression failed"; const char MSGID_HELP[] = "Usage :\r\ \r\ gup --help\r\ From 1a7c1a1d6b338dddc40d0dc638146f711b07adc7 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 20 May 2018 00:38:24 +0200 Subject: [PATCH 009/110] WinGup (for Notepad++) 5.0.1 release --- src/change.log | 8 +++++++- src/resource.h | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/change.log b/src/change.log index 0bb0d8d7..dfa0c06b 100644 --- a/src/change.log +++ b/src/change.log @@ -1,3 +1,9 @@ +WinGup (for Notepad++) v5.0.1 bug-fix: + +1. Fix unzip bug. +2. Enhance error management in case of problem of unzip. + + WinGup (for Notepad++) v5 new enhancement: -1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean) \ No newline at end of file +1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean). \ No newline at end of file diff --git a/src/resource.h b/src/resource.h index a1a39b6a..f4d22c36 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.0\0" -#define VERSION_DIGITALVALUE 5, 0, 0, 0 +#define VERSION_VALUE "5.01\0" +#define VERSION_DIGITALVALUE 5, 0, 1, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 6f7d457f23819367a51620cce92a4959bb58ad6a Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 17 Jul 2018 16:13:53 +0200 Subject: [PATCH 010/110] Turn on silent mode as default --- src/ConfigFiles/gup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ConfigFiles/gup.xml b/src/ConfigFiles/gup.xml index 7ffabb95..de5d4fd9 100644 --- a/src/ConfigFiles/gup.xml +++ b/src/ConfigFiles/gup.xml @@ -75,6 +75,6 @@ This parameter can hide all the network error message. If "SilentMode" is set as "yes", then users won't be warned when there's no connection of internet or the url is not available. --> - no + yes From 1fca6ce68dbf67f95d78fb31c5cf2d6e9b544c20 Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 17 Jul 2018 16:55:32 +0200 Subject: [PATCH 011/110] WinGup (for Notepad++) 5.0.2 release --- src/change.log | 7 ++++++- src/resource.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/change.log b/src/change.log index dfa0c06b..968942f3 100644 --- a/src/change.log +++ b/src/change.log @@ -1,3 +1,8 @@ +WinGup (for Notepad++) v5.0.2 change: + +1. Turn on the silent mode as default (no binary change, only on gup.xml). + + WinGup (for Notepad++) v5.0.1 bug-fix: 1. Fix unzip bug. @@ -6,4 +11,4 @@ WinGup (for Notepad++) v5.0.1 bug-fix: WinGup (for Notepad++) v5 new enhancement: -1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean). \ No newline at end of file +1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean). diff --git a/src/resource.h b/src/resource.h index f4d22c36..dc4ad224 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.01\0" -#define VERSION_DIGITALVALUE 5, 0, 1, 0 +#define VERSION_VALUE "5.02\0" +#define VERSION_DIGITALVALUE 5, 0, 2, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From b6441879a73bb57d7be4e5bc4cb48eec6aefb775 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 12 Sep 2018 03:28:33 +0200 Subject: [PATCH 012/110] Change logic of plugins removal/update/installation uninstall: tell user to restart Notepad++ - Gup.exe remove all - clean in batch - relaunch Notepad++ gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" update: tell user to restart Notepad++ - Gup.exe download - remove all in directory - unzip/clean in batch - relaunch Notepad++ gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto" "titi http://titi" "tata http://tata" gup.exe -unzip -clean "c:\npp\notepad++.exe" c:\temp\ "toto http://toto" "ti et ti http://titi" "tata http://tata" Install: GUp.exe download - create directory - unzip: one by one, no relaunch gup.exe -unzipTo c:\donho\notepad++\plugins "https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip" --- src/winmain.cpp | 442 +++++++++++++++++++++++++----------------------- 1 file changed, 227 insertions(+), 215 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index c502fc18..4a4eeb7a 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -174,51 +174,6 @@ bool getParamVal(char c, ParamVector & params, string & value) return false; } -class ZipOperation -{ -public: - void setUnzipOp(bool isUnzip) { - if (isUnzip) _op |= unzipOp; - else _op ^= unzipOp; - }; - - void setCleanupOp(bool isClean) { - if (isClean) _op |= cleanOp; - else _op ^= cleanOp; - }; - - void setDestFolder(const string& destFolder) { - _destFolder = destFolder; - } - string getDestFolder() const { return _destFolder; } - - void setDownloadZipUrl(const string& downloadZipUrl) { - _downloadZipUrl = downloadZipUrl; - } - string getDownloadZipUrl() const { return _downloadZipUrl; } - - bool isUnzipReady() const { - return (_op & unzipOp) && !_downloadZipUrl.empty() && !_destFolder.empty(); - }; - - bool isCleanupReady() const { - return (_op & cleanOp) && !_destFolder.empty(); - }; - - bool isReady2Go() const { - return isUnzipReady() || isCleanupReady(); - } - -private: - const unsigned char unzipOp = 1; - const unsigned char cleanOp = 2; - unsigned char _op = 0; - - string _destFolder; - string _downloadZipUrl; -}; - - string PathAppend(string& strDest, const string& str2append) { if (strDest.empty() && str2append.empty()) // "" + "" @@ -309,116 +264,116 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) return false; } - ZipArchive::Ptr archive = ZipFile::Open(zipFullFilePath.c_str()); - - std::istream* decompressStream = nullptr; - auto count = archive->GetEntriesCount(); - - if (!count) // wrong archive format - return false; - - for (size_t i = 0; i < count; ++i) - { - ZipArchiveEntry::Ptr entry = archive->GetEntry(static_cast(i)); - assert(entry != nullptr); - - //("[+] Trying no pass...\n"); - decompressStream = entry->GetDecompressionStream(); - assert(decompressStream != nullptr); - - string file2extrait = entry->GetFullName(); - string extraitFullFilePath = unzipDestTo; - PathAppend(extraitFullFilePath, file2extrait); - - ZipArchiveEntry::Attributes attr = entry->GetAttributes(); - - //auto pos = extraitFullFilePath.find_last_of('/'); - //if (pos == extraitFullFilePath.length() - 1) // it's a folder to created - if (attr == ZipArchiveEntry::Attributes::Directory) - { + ZipArchive::Ptr archive = ZipFile::Open(zipFullFilePath.c_str()); + + std::istream* decompressStream = nullptr; + auto count = archive->GetEntriesCount(); + + if (!count) // wrong archive format + return false; + + for (size_t i = 0; i < count; ++i) + { + ZipArchiveEntry::Ptr entry = archive->GetEntry(static_cast(i)); + assert(entry != nullptr); + + //("[+] Trying no pass...\n"); + decompressStream = entry->GetDecompressionStream(); + assert(decompressStream != nullptr); + + string file2extrait = entry->GetFullName(); + string extraitFullFilePath = unzipDestTo; + PathAppend(extraitFullFilePath, file2extrait); + + ZipArchiveEntry::Attributes attr = entry->GetAttributes(); + + //auto pos = extraitFullFilePath.find_last_of('/'); + //if (pos == extraitFullFilePath.length() - 1) // it's a folder to created + if (attr == ZipArchiveEntry::Attributes::Directory) + { // if folder doesn't exist, create it. if (!::PathFileExistsA(extraitFullFilePath.c_str())) { - char msg[1024]; - sprintf(msg, "[+] Create folder '%s'\n", file2extrait.c_str()); + char msg[1024]; + sprintf(msg, "[+] Create folder '%s'\n", file2extrait.c_str()); OutputDebugStringA(msg); if (!::CreateDirectoryA(extraitFullFilePath.c_str(), NULL)) return false; - } - } - else - { - char msg[1024]; - sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); - OutputDebugStringA(msg); - - std::ofstream destFile; - destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); - - // - // We try to catch the wrong detection of folder entry from ZipLib here - // - if (!destFile.is_open()) - { - // file2extrait be separated into an array - vector strArray = tokenizeString(file2extrait, '/'); - - // loop unzipDestTo + file2extraitVector[i] to create directory (by checking existing file length is 0, and removing existing file) - if (strArray.size() > 1) - { - for (size_t j = 0; j < strArray.size() - 1; ++j) - { - string folderFullFilePath = unzipDestTo; - PathAppend(folderFullFilePath, strArray[j]); - - BOOL isCreateFolderOK = FALSE; - if (::PathFileExistsA(folderFullFilePath.c_str())) - { - // check if it is 0 length + } + } + else + { + char msg[1024]; + sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); + OutputDebugStringA(msg); + + std::ofstream destFile; + destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + + // + // We try to catch the wrong detection of folder entry from ZipLib here + // + if (!destFile.is_open()) + { + // file2extrait be separated into an array + vector strArray = tokenizeString(file2extrait, '/'); + + // loop unzipDestTo + file2extraitVector[i] to create directory (by checking existing file length is 0, and removing existing file) + if (strArray.size() > 1) + { + for (size_t j = 0; j < strArray.size() - 1; ++j) + { + string folderFullFilePath = unzipDestTo; + PathAppend(folderFullFilePath, strArray[j]); + + BOOL isCreateFolderOK = FALSE; + if (::PathFileExistsA(folderFullFilePath.c_str())) + { + // check if it is 0 length struct _stat64 buf; _stat64(folderFullFilePath.c_str(), &buf); - if (buf.st_size == 0) - { - // if 0 length remove it - deleteFileOrFolder(folderFullFilePath); - } - else - { - return false; - } - - // create it - isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); - } - else - { - // create it - isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); - } - - // check if directory creation failed - if (!isCreateFolderOK) - return false; - - } - // copy again - std::ofstream destFile2; - destFile2.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); - - if (!destFile2.is_open()) - { - return false; - } - } - } - - utils::stream::copy(*decompressStream, destFile); - - destFile.flush(); - destFile.close(); - } + if (buf.st_size == 0) + { + // if 0 length remove it + deleteFileOrFolder(folderFullFilePath); + } + else + { + return false; + } + + // create it + isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); + } + else + { + // create it + isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); + } + + // check if directory creation failed + if (!isCreateFolderOK) + return false; + + } + // copy again + std::ofstream destFile2; + destFile2.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + + if (!destFile2.is_open()) + { + return false; + } + } + } + + utils::stream::copy(*decompressStream, destFile); + + destFile.flush(); + destFile.close(); + } } return true; @@ -774,7 +729,18 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, return true; } +/* +uninstall: tell user to restart Notepad++ - Gup.exe remove all - clean in batch - relaunch Notepad++ +gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" +gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" + +update: tell user to restart Notepad++ - Gup.exe download - remove all in directory - unzip/clean in batch - relaunch Notepad++ +gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto" "titi http://titi" "tata http://tata" +gup.exe -unzip -clean "c:\npp\notepad++.exe" c:\temp\ "toto http://toto" "ti et ti http://titi" "tata http://tata" +Install: GUp.exe download - create directory - unzip: one by one, no relaunch +gup.exe -unzipTo c:\donho\notepad++\plugins "https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip" +*/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { bool isSilentMode = false; @@ -782,7 +748,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) string version; string customParam; - ZipOperation zipOp; ParamVector params; parseCommandLine(lpszCmdLine, params); @@ -802,104 +767,151 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } - if (isCleanUp || isUnzip) - { - // retrieve the dir to clean up and url to download - size_t nbParam = params.size(); + GupExtraOptions extraOptions("gupOptions.xml"); + GupNativeLang nativeLang("nativeLang.xml"); + GupParameters gupParams("gup.xml"); - if (nbParam == 1) // only clean - { - if (isUnzip) - return -1; + // + // Plugins Updater + // + size_t nbParam = params.size(); + if (isCleanUp && !isUnzip) // remove only + { + if (nbParam < 3) + return -1; - zipOp.setDestFolder(params[0]); - } - else if (nbParam == 2) // must be unzipTo - { - if (!isUnzip) - return -1; + string prog2Launch = params[0]; + char prog2LaunchDir[MAX_PATH]; + strcpy(prog2LaunchDir, prog2Launch.c_str()); + ::PathRemoveFileSpecA(prog2LaunchDir); + string destPathRoot = params[1]; - zipOp.setDestFolder(params[0]); - zipOp.setDownloadZipUrl(params[1]); - } - else + // clean + for (size_t i = 2; i < nbParam; ++i) { - return -1; + string destPath = destPathRoot; + ::PathAppend(destPath, params[i]); + deleteFileOrFolder(destPath); } - zipOp.setCleanupOp(isCleanUp); - zipOp.setUnzipOp(isUnzip); + + ::ShellExecuteA(NULL, "open", prog2Launch.c_str(), "", prog2LaunchDir, SW_SHOWNORMAL); + return 0; } + + + if (isCleanUp && isUnzip) // update + { + if (nbParam < 3) + return -1; - GupExtraOptions extraOptions("gupOptions.xml"); - GupNativeLang nativeLang("nativeLang.xml"); - GupParameters gupParams("gup.xml"); + string prog2Launch = params[0]; + char prog2LaunchDir[MAX_PATH]; + strcpy(prog2LaunchDir, prog2Launch.c_str()); + ::PathRemoveFileSpecA(prog2LaunchDir); + string destPathRoot = params[1]; - if (zipOp.isReady2Go()) - { - // if -unzip is present, -clean will be ignored - if (!zipOp.isUnzipReady() && zipOp.isCleanupReady()) - { - deleteFileOrFolder(zipOp.getDestFolder()); - } - - if (zipOp.isUnzipReady()) + for (size_t i = 2; i < nbParam; ++i) { - std::string dlDest = std::getenv("TEMP"); - dlDest += "\\"; - dlDest += ::PathFindFileNameA(zipOp.getDownloadZipUrl().c_str()); + string destPath = destPathRoot; - char *ext = ::PathFindExtensionA(dlDest.c_str()); - if (strcmp(ext, ".zip") != 0) - dlDest += ".zip"; + // break down param in dest folder name and download url + auto pos = params[i].find_last_of(" "); + if (pos != string::npos && pos > 0) + { + string folder = params[i].substr(0, pos - 1); + string dlUrl = params[i].substr(pos, params[i].length() - 1); + ::PathAppend(destPath, folder); - dlFileName = ::PathFindFileNameA(zipOp.getDownloadZipUrl().c_str()); + // clean + deleteFileOrFolder(destPath); + // install + std::string dlDest = std::getenv("TEMP"); + dlDest += "\\"; + dlDest += ::PathFindFileNameA(dlUrl.c_str()); - string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); - if (dlStopped == "") - dlStopped = MSGID_DOWNLOADSTOPPED; + char *ext = ::PathFindExtensionA(dlDest.c_str()); + if (strcmp(ext, ".zip") != 0) + dlDest += ".zip"; + dlFileName = ::PathFindFileNameA(dlUrl.c_str()); - bool isSuccessful = downloadBinary(zipOp.getDownloadZipUrl(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); - if (!isSuccessful) - { - return -1; - } + string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == "") + dlStopped = MSGID_DOWNLOADSTOPPED; - // check if renamed folder exist, if it does, delete it - string backup4RestoreInCaseOfFailedPath = zipOp.getDestFolder() + ".backup4RestoreInCaseOfFailed"; - if (::PathFileExistsA(backup4RestoreInCaseOfFailedPath.c_str())) - deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + bool isSuccessful = downloadBinary(dlUrl, dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + if (isSuccessful) + { + isSuccessful = decompress(dlDest, destPathRoot); + if (!isSuccessful) + { + string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); + if (unzipFailed == "") + unzipFailed = MSGID_UNZIPFAILED; + + ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + + // Delete incomplete unzipped folder + deleteFileOrFolder(destPathRoot); + } + } + } + } - // rename the folder with suffix ".backup4RestoreInCaseOfFailed" - ::MoveFileA(zipOp.getDestFolder().c_str(), backup4RestoreInCaseOfFailedPath.c_str()); + ::ShellExecuteA(NULL, "open", prog2Launch.c_str(), "", prog2LaunchDir, SW_SHOWNORMAL); + return 0; + } - isSuccessful = decompress(dlDest, zipOp.getDestFolder()); - if (!isSuccessful) - { - string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); - if (unzipFailed == "") - unzipFailed = MSGID_UNZIPFAILED; + if (!isCleanUp && isUnzip) // install + { + if (nbParam != 2) + return -1; - ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + string downloadZipUrl = params[1]; + string destRoot = params[0]; - // Delete incomplete unzipped folder - deleteFileOrFolder(zipOp.getDestFolder()); + std::string dlDest = std::getenv("TEMP"); + dlDest += "\\"; + dlDest += ::PathFindFileNameA(downloadZipUrl.c_str()); - // rename back the folder - ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), zipOp.getDestFolder().c_str()); + char *ext = ::PathFindExtensionA(dlDest.c_str()); + if (strcmp(ext, ".zip") != 0) + dlDest += ".zip"; - return -1; - } + dlFileName = ::PathFindFileNameA(downloadZipUrl.c_str()); - // delete the folder with suffix ".backup4RestoreInCaseOfFailed" - deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == "") + dlStopped = MSGID_DOWNLOADSTOPPED; + bool isSuccessful = downloadBinary(downloadZipUrl, dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + if (!isSuccessful) + { + return -1; } + isSuccessful = decompress(dlDest, destRoot); + if (!isSuccessful) + { + string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); + if (unzipFailed == "") + unzipFailed = MSGID_UNZIPFAILED; + + ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + + // Delete incomplete unzipped folder + deleteFileOrFolder(destRoot); + + return -1; + } return 0; } + + // + // Notepad++ Updater + // hInst = hInstance; try { if (launchSettingsDlg) From 291b9da93ff8f677290a593d35e951e9fd7611ca Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 18 Sep 2018 20:15:25 +0200 Subject: [PATCH 013/110] Fix a parser argument bug. --- src/winmain.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 4a4eeb7a..91c9c287 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -795,6 +795,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) } ::ShellExecuteA(NULL, "open", prog2Launch.c_str(), "", prog2LaunchDir, SW_SHOWNORMAL); + return 0; } @@ -818,8 +819,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) auto pos = params[i].find_last_of(" "); if (pos != string::npos && pos > 0) { - string folder = params[i].substr(0, pos - 1); - string dlUrl = params[i].substr(pos, params[i].length() - 1); + string folder = params[i].substr(0, pos); + string dlUrl = params[i].substr(pos + 1, params[i].length() - 1); ::PathAppend(destPath, folder); // clean From bbf95833f2d56ff3bf7e1921357d2349a0185bf0 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 24 Sep 2018 02:30:51 +0200 Subject: [PATCH 014/110] Fix an unzip bug. --- src/winmain.cpp | 69 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 91c9c287..1a31d5d2 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -302,7 +302,7 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) return false; } } - else + else // it's a file { char msg[1024]; sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); @@ -322,30 +322,26 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) // loop unzipDestTo + file2extraitVector[i] to create directory (by checking existing file length is 0, and removing existing file) if (strArray.size() > 1) { - for (size_t j = 0; j < strArray.size() - 1; ++j) + string folderFullFilePath = unzipDestTo; + for (int j = 0; j < int(strArray.size()) - 1; ++j) // loop on only directory, not on file (which is the last element) { - string folderFullFilePath = unzipDestTo; PathAppend(folderFullFilePath, strArray[j]); BOOL isCreateFolderOK = FALSE; if (::PathFileExistsA(folderFullFilePath.c_str())) { - // check if it is 0 length - struct _stat64 buf; - _stat64(folderFullFilePath.c_str(), &buf); - - if (buf.st_size == 0) + if (!::PathIsDirectoryA(folderFullFilePath.c_str())) { - // if 0 length remove it + // if it's a file, remove it deleteFileOrFolder(folderFullFilePath); + + // create it + isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); } - else + else //perfect { - return false; + isCreateFolderOK = TRUE; } - - // create it - isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); } else { @@ -356,8 +352,8 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) // check if directory creation failed if (!isCreateFolderOK) return false; - } + // copy again std::ofstream destFile2; destFile2.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); @@ -729,6 +725,24 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, return true; } +void writeLog(const char *logFileName, const char *logSuffix, const char *log2write) +{ + FILE *f = fopen(logFileName, "a+"); + string log = logSuffix; + log += log2write; + fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); + fputc('\n', f); + fflush(f); + fclose(f); +}; + +#ifdef _DEBUG +#define WRITE_LOG(fn, suffix, log) writeLog(fn, suffix, log); +#else +#define WRITE_LOG(fn, suffix, log) +#endif + + /* uninstall: tell user to restart Notepad++ - Gup.exe remove all - clean in batch - relaunch Notepad++ gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" @@ -767,6 +781,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } + WRITE_LOG("c:\\tmp\\winup.log", "lpszCmdLine: ", lpszCmdLine); + GupExtraOptions extraOptions("gupOptions.xml"); GupNativeLang nativeLang("nativeLang.xml"); GupParameters gupParams("gup.xml"); @@ -778,8 +794,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (isCleanUp && !isUnzip) // remove only { if (nbParam < 3) + { + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (isCleanUp && !isUnzip) // remove only: ", "nbParam < 3"); return -1; - + } string prog2Launch = params[0]; char prog2LaunchDir[MAX_PATH]; strcpy(prog2LaunchDir, prog2Launch.c_str()); @@ -803,8 +821,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (isCleanUp && isUnzip) // update { if (nbParam < 3) + { + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (isCleanUp && isUnzip) // update: ", "nbParam < 3"); return -1; - + } string prog2Launch = params[0]; char prog2LaunchDir[MAX_PATH]; strcpy(prog2LaunchDir, prog2Launch.c_str()); @@ -867,7 +887,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (!isCleanUp && isUnzip) // install { if (nbParam != 2) + { + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "nbParam != 2"); return -1; + } string downloadZipUrl = params[1]; string destRoot = params[0]; @@ -889,6 +912,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool isSuccessful = downloadBinary(downloadZipUrl, dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!isSuccessful) { + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "downloadBinary func failed."); return -1; } @@ -904,6 +928,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Delete incomplete unzipped folder deleteFileOrFolder(destRoot); + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "decompress func failed."); return -1; } return 0; @@ -951,8 +976,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool getUpdateInfoSuccessful = getUpdateInfo(updateInfo, gupParams, extraOptions, customParam, version); if (!getUpdateInfoSuccessful) + { + WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part: ", "getUpdateInfo func failed."); return -1; - + } GupDownloadInfo gupDlInfo(updateInfo.c_str()); @@ -1030,8 +1057,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!dlSuccessful) + { + WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part: ", "downloadBinary func failed."); return -1; - + } // // Run executable bin @@ -1053,6 +1082,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (pFile != NULL) fclose(pFile); + WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part, exception: ", ex.what()); return -1; } catch (...) @@ -1063,6 +1093,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (pFile != NULL) fclose(pFile); + WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part, exception: ", "Unknown Exception"); return -1; } } From bd8ccc6bf279422b5b98659315805f1de72c8645 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 10 Oct 2018 10:24:31 +0200 Subject: [PATCH 015/110] WinGup (for Notepad++) 5.0.3 release --- src/change.log | 17 ++++------------- src/resource.h | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/change.log b/src/change.log index 968942f3..827fafc0 100644 --- a/src/change.log +++ b/src/change.log @@ -1,14 +1,5 @@ -WinGup (for Notepad++) v5.0.2 change: +WinGup (for Notepad++) v5.0.3 change: -1. Turn on the silent mode as default (no binary change, only on gup.xml). - - -WinGup (for Notepad++) v5.0.1 bug-fix: - -1. Fix unzip bug. -2. Enhance error management in case of problem of unzip. - - -WinGup (for Notepad++) v5 new enhancement: - -1. Add decompression and deleting capacity (2 new flags: -unzipTo -clean). +1. Fix an unzip bug. +2. Fix a parser argument bug. +3. Change logic of plugins removal/update/installation. diff --git a/src/resource.h b/src/resource.h index dc4ad224..20675e5c 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.02\0" -#define VERSION_DIGITALVALUE 5, 0, 2, 0 +#define VERSION_VALUE "5.03\0" +#define VERSION_DIGITALVALUE 5, 0, 3, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 6d792ed46ff3aa8951f423b1f9f0d40be8c5943b Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 27 Oct 2018 14:19:24 +0200 Subject: [PATCH 016/110] Add sha-256 implementation for checking plugin zip package's sha-256 hash while installation and update. --- src/sha2/sha-256.cpp | 210 +++++++++++++++++++++++++++++++++++++ src/sha2/sha-256.h | 3 + src/winmain.cpp | 111 +++++++++++++++++--- vcproj/GUP.vcxproj | 10 +- vcproj/GUP.vcxproj.filters | 2 + 5 files changed, 319 insertions(+), 17 deletions(-) create mode 100644 src/sha2/sha-256.cpp create mode 100644 src/sha2/sha-256.h diff --git a/src/sha2/sha-256.cpp b/src/sha2/sha-256.cpp new file mode 100644 index 00000000..a97cff25 --- /dev/null +++ b/src/sha2/sha-256.cpp @@ -0,0 +1,210 @@ +#include +#include + +#include "sha-256.h" + +#define CHUNK_SIZE 64 +#define TOTAL_LEN_LEN 8 + +/* + * ABOUT bool: this file does not use bool in order to be as pre-C99 compatible as possible. + */ + +/* + * Comments from pseudo-code at https://en.wikipedia.org/wiki/SHA-2 are reproduced here. + * When useful for clarification, portions of the pseudo-code are reproduced here too. + */ + +/* + * Initialize array of round constants: + * (first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311): + */ +static const uint32_t k[] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +struct buffer_state { + const uint8_t * p; + size_t len; + size_t total_len; + int single_one_delivered; /* bool */ + int total_len_delivered; /* bool */ +}; + +static inline uint32_t right_rot(uint32_t value, unsigned int count) +{ + /* + * Defined behaviour in standard C for all count where 0 < count < 32, + * which is what we need here. + */ + return value >> count | value << (32 - count); +} + +static void init_buf_state(struct buffer_state * state, const void * input, size_t len) +{ + state->p = static_cast(input); + state->len = len; + state->total_len = len; + state->single_one_delivered = 0; + state->total_len_delivered = 0; +} + +/* Return value: bool */ +static int calc_chunk(uint8_t chunk[CHUNK_SIZE], struct buffer_state * state) +{ + size_t space_in_chunk; + + if (state->total_len_delivered) { + return 0; + } + + if (state->len >= CHUNK_SIZE) { + memcpy(chunk, state->p, CHUNK_SIZE); + state->p += CHUNK_SIZE; + state->len -= CHUNK_SIZE; + return 1; + } + + memcpy(chunk, state->p, state->len); + chunk += state->len; + space_in_chunk = CHUNK_SIZE - state->len; + state->p += state->len; + state->len = 0; + + /* If we are here, space_in_chunk is one at minimum. */ + if (!state->single_one_delivered) { + *chunk++ = 0x80; + space_in_chunk -= 1; + state->single_one_delivered = 1; + } + + /* + * Now: + * - either there is enough space left for the total length, and we can conclude, + * - or there is too little space left, and we have to pad the rest of this chunk with zeroes. + * In the latter case, we will conclude at the next invokation of this function. + */ + if (space_in_chunk >= TOTAL_LEN_LEN) { + const size_t left = space_in_chunk - TOTAL_LEN_LEN; + size_t len = state->total_len; + int i; + memset(chunk, 0x00, left); + chunk += left; + + /* Storing of len * 8 as a big endian 64-bit without overflow. */ + chunk[7] = (uint8_t) (len << 3); + len >>= 5; + for (i = 6; i >= 0; i--) { + chunk[i] = (uint8_t) len; + len >>= 8; + } + state->total_len_delivered = 1; + } else { + memset(chunk, 0x00, space_in_chunk); + } + + return 1; +} + +/* + * Limitations: + * - Since input is a pointer in RAM, the data to hash should be in RAM, which could be a problem + * for large data sizes. + * - SHA algorithms theoretically operate on bit strings. However, this implementation has no support + * for bit string lengths that are not multiples of eight, and it really operates on arrays of bytes. + * In particular, the len parameter is a number of bytes. + */ +void calc_sha_256(uint8_t hash[32], const void * input, size_t len) +{ + /* + * Note 1: All integers (expect indexes) are 32-bit unsigned integers and addition is calculated modulo 2^32. + * Note 2: For each round, there is one round constant k[i] and one entry in the message schedule array w[i], 0 = i = 63 + * Note 3: The compression function uses 8 working variables, a through h + * Note 4: Big-endian convention is used when expressing the constants in this pseudocode, + * and when parsing message block data from bytes to words, for example, + * the first word of the input message "abc" after padding is 0x61626380 + */ + + /* + * Initialize hash values: + * (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19): + */ + uint32_t h[] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + int i, j; + + /* 512-bit chunks is what we will operate on. */ + uint8_t chunk[64]; + + struct buffer_state state; + + init_buf_state(&state, input, len); + + while (calc_chunk(chunk, &state)) { + uint32_t ah[8]; + + /* + * create a 64-entry message schedule array w[0..63] of 32-bit words + * (The initial values in w[0..63] don't matter, so many implementations zero them here) + * copy chunk into first 16 words w[0..15] of the message schedule array + */ + uint32_t w[64]; + const uint8_t *p = chunk; + + memset(w, 0x00, sizeof w); + for (i = 0; i < 16; i++) { + w[i] = (uint32_t) p[0] << 24 | (uint32_t) p[1] << 16 | + (uint32_t) p[2] << 8 | (uint32_t) p[3]; + p += 4; + } + + /* Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: */ + for (i = 16; i < 64; i++) { + const uint32_t s0 = right_rot(w[i - 15], 7) ^ right_rot(w[i - 15], 18) ^ (w[i - 15] >> 3); + const uint32_t s1 = right_rot(w[i - 2], 17) ^ right_rot(w[i - 2], 19) ^ (w[i - 2] >> 10); + w[i] = w[i - 16] + s0 + w[i - 7] + s1; + } + + /* Initialize working variables to current hash value: */ + for (i = 0; i < 8; i++) + ah[i] = h[i]; + + /* Compression function main loop: */ + for (i = 0; i < 64; i++) { + const uint32_t s1 = right_rot(ah[4], 6) ^ right_rot(ah[4], 11) ^ right_rot(ah[4], 25); + const uint32_t ch = (ah[4] & ah[5]) ^ (~ah[4] & ah[6]); + const uint32_t temp1 = ah[7] + s1 + ch + k[i] + w[i]; + const uint32_t s0 = right_rot(ah[0], 2) ^ right_rot(ah[0], 13) ^ right_rot(ah[0], 22); + const uint32_t maj = (ah[0] & ah[1]) ^ (ah[0] & ah[2]) ^ (ah[1] & ah[2]); + const uint32_t temp2 = s0 + maj; + + ah[7] = ah[6]; + ah[6] = ah[5]; + ah[5] = ah[4]; + ah[4] = ah[3] + temp1; + ah[3] = ah[2]; + ah[2] = ah[1]; + ah[1] = ah[0]; + ah[0] = temp1 + temp2; + } + + /* Add the compressed chunk to the current hash value: */ + for (i = 0; i < 8; i++) + h[i] += ah[i]; + } + + /* Produce the final hash value (big-endian): */ + for (i = 0, j = 0; i < 8; i++) + { + hash[j++] = (uint8_t) (h[i] >> 24); + hash[j++] = (uint8_t) (h[i] >> 16); + hash[j++] = (uint8_t) (h[i] >> 8); + hash[j++] = (uint8_t) h[i]; + } +} diff --git a/src/sha2/sha-256.h b/src/sha2/sha-256.h new file mode 100644 index 00000000..eaca0558 --- /dev/null +++ b/src/sha2/sha-256.h @@ -0,0 +1,3 @@ +#pragma once + +void calc_sha_256(uint8_t hash[32], const void *input, size_t len); diff --git a/src/winmain.cpp b/src/winmain.cpp index 1a31d5d2..07d2a00f 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -29,6 +29,7 @@ #include "resource.h" #include #include "xmlTools.h" +#include "sha-256.h" #define CURL_STATICLIB #include "../curl/include/curl/curl.h" @@ -255,6 +256,28 @@ bool deleteFileOrFolder(const string& f2delete) return (res == 0); }; +std::string getFileContent(const char *file2read) +{ + if (!::PathFileExistsA(file2read)) + return ""; + + const size_t blockSize = 1024; + char data[blockSize]; + std::string wholeFileContent = ""; + FILE *fp = fopen(file2read, "rb"); + + size_t lenFile = 0; + do + { + lenFile = fread(data, 1, blockSize, fp); + if (lenFile <= 0) break; + wholeFileContent.append(data, lenFile); + } while (lenFile > 0); + + fclose(fp); + return wholeFileContent; +}; + bool decompress(const string& zipFullFilePath, const string& unzipDestTo) { // if destination folder doesn't exist, create it. @@ -558,7 +581,7 @@ static DWORD WINAPI launchProgressBar(void *) return 0; } -bool downloadBinary(const string& urlFrom, const string& destTo, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) +bool downloadBinary(const string& urlFrom, const string& destTo, const string& sha2HashToCheck, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) { FILE* pFile = fopen(destTo.c_str(), "wb"); @@ -604,10 +627,52 @@ bool downloadBinary(const string& urlFrom, const string& destTo, pair(content.c_str()), content.length()); + + for (size_t i = 0; i < 32; i++) + { + sprintf(sha2hashStr + i * 2, "%02x", sha2hash[i]); + } + + if (sha2HashToCheck != sha2hashStr) + { + string pluginPakageName = ::PathFindFileNameA(destTo.c_str()); + string msg = "The hash of plugin package \""; + msg += pluginPakageName; + msg += "\" is not correct. This plugin won't be installed."; + MessageBoxA(NULL, msg.c_str(), "Plugin package hash mismatched", MB_OK | MB_APPLMODAL); + ok = false; + } + } + } + + if (!ok) + { + // Remove downloaded plugin package + deleteFileOrFolder(destTo); + return false; + } + return true; } @@ -749,11 +814,11 @@ gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" update: tell user to restart Notepad++ - Gup.exe download - remove all in directory - unzip/clean in batch - relaunch Notepad++ -gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto" "titi http://titi" "tata http://tata" -gup.exe -unzip -clean "c:\npp\notepad++.exe" c:\temp\ "toto http://toto" "ti et ti http://titi" "tata http://tata" +gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto 7c31a97b..." "titi http://titi 087a0591..." "tata http://tata 2e9766c..." +gup.exe -unzip -clean "c:\npp\notepad++.exe" c:\temp\ "toto http://toto 7c31a97b..." "ti et ti http://titi 087a0591..." "tata http://tata 2e9766c..." Install: GUp.exe download - create directory - unzip: one by one, no relaunch -gup.exe -unzipTo c:\donho\notepad++\plugins "https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip" +gup.exe -unzipTo "c:\donho\notepad++\plugins" https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip 7c31a97ba2c5973a3087a05918a8acbf1e57a82d6d2e9766cb32611a1cbb8515 */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { @@ -839,8 +904,27 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) auto pos = params[i].find_last_of(" "); if (pos != string::npos && pos > 0) { - string folder = params[i].substr(0, pos); - string dlUrl = params[i].substr(pos + 1, params[i].length() - 1); + string folder; + string dlUrl; + + string tempStr = params[i].substr(0, pos); + string sha256ToCheck = params[i].substr(pos + 1, params[i].length() - 1); + if (sha256ToCheck.length() != 64) + continue; + + auto pos2 = tempStr.find_last_of(" "); + if (pos2 != string::npos && pos2 > 0) + { + // 3 parts - OK + dlUrl = tempStr.substr(pos2 + 1, tempStr.length() - 1); + folder = tempStr.substr(0, pos2); + } + else + { + // 2 parts - error. Just pass to the next + continue; + } + ::PathAppend(destPath, folder); // clean @@ -861,7 +945,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (dlStopped == "") dlStopped = MSGID_DOWNLOADSTOPPED; - bool isSuccessful = downloadBinary(dlUrl, dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + bool isSuccessful = downloadBinary(dlUrl, dlDest, sha256ToCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (isSuccessful) { isSuccessful = decompress(dlDest, destPathRoot); @@ -886,14 +970,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (!isCleanUp && isUnzip) // install { - if (nbParam != 2) + if (nbParam != 3) { - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "nbParam != 2"); + WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "nbParam != 3"); return -1; } - string downloadZipUrl = params[1]; string destRoot = params[0]; + string downloadZipUrl = params[1]; + string sha256_toCheck = params[2]; std::string dlDest = std::getenv("TEMP"); dlDest += "\\"; @@ -909,7 +994,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (dlStopped == "") dlStopped = MSGID_DOWNLOADSTOPPED; - bool isSuccessful = downloadBinary(downloadZipUrl, dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + bool isSuccessful = downloadBinary(downloadZipUrl, dlDest, sha256_toCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!isSuccessful) { WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "downloadBinary func failed."); @@ -1054,7 +1139,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (dlStopped == "") dlStopped = MSGID_DOWNLOADSTOPPED; - bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); + bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, "", pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!dlSuccessful) { diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 3ee06e0f..50e4556d 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\src\libcurl\include;..\src\TinyXml;%(AdditionalIncludeDirectories) + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks @@ -112,7 +112,7 @@ Disabled - ..\src\libcurl\include;..\src\TinyXml;%(AdditionalIncludeDirectories) + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -139,7 +139,7 @@ - ..\src\libcurl\include;..\src\TinyXml;%(AdditionalIncludeDirectories) + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreaded @@ -179,7 +179,7 @@ del ..\bin\GUP.ipdb - ..\src\libcurl\include;..\src\TinyXml;%(AdditionalIncludeDirectories) + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreaded @@ -213,6 +213,7 @@ del ..\bin64\GUP.ipdb + @@ -222,6 +223,7 @@ del ..\bin64\GUP.ipdb + diff --git a/vcproj/GUP.vcxproj.filters b/vcproj/GUP.vcxproj.filters index 16bbd786..c0c265b3 100644 --- a/vcproj/GUP.vcxproj.filters +++ b/vcproj/GUP.vcxproj.filters @@ -18,6 +18,7 @@ tinyxml + @@ -28,6 +29,7 @@ tinyxml + From ee17cc0668af0b4a95ede22ecde95b0711ebb34f Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 30 Oct 2018 00:11:39 +0100 Subject: [PATCH 017/110] Shift the post installation (checking if the plugin is deployed correctely) responsability from Notepad++ to WinGup For the sake of retro-compatibility, change the way of plugin packaging: 1. The plugin DLL file should be placed at the root level of the ZIP file. 2. The root level of the ZIP file can also contain additional files (DLL files or data files needed by the plugin) and folders which will be copied to the users harddisk as well. 3. Everything what gets copied from the ZIP file will be stored under \plugins\. --- src/winmain.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 07d2a00f..54d5e08b 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -278,6 +278,8 @@ std::string getFileContent(const char *file2read) return wholeFileContent; }; +// unzipDestTo should be plugin home root + plugin folder name +// ex: %APPDATA%\..\local\Notepad++\plugins\myAwesomePlugin bool decompress(const string& zipFullFilePath, const string& unzipDestTo) { // if destination folder doesn't exist, create it. @@ -395,6 +397,24 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) } } + // check installed dll + string pluginFolder = PathFindFileNameA(unzipDestTo.c_str()); + string installedPluginPath = unzipDestTo + "\\" + pluginFolder + ".dll"; + + if (::PathFileExistsA(installedPluginPath.c_str())) + { + // DLL is deployed correctly. + // OK and nothing to do. + } + else + { + // Remove installed plugin + MessageBox(NULL, TEXT("The plugin package is built wrongly. This plugin will be uninstalled."), TEXT("GUP"), MB_OK | MB_APPLMODAL); + + deleteFileOrFolder(unzipDestTo); + return FALSE; + } + return true; }; @@ -815,16 +835,16 @@ gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" update: tell user to restart Notepad++ - Gup.exe download - remove all in directory - unzip/clean in batch - relaunch Notepad++ gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto 7c31a97b..." "titi http://titi 087a0591..." "tata http://tata 2e9766c..." -gup.exe -unzip -clean "c:\npp\notepad++.exe" c:\temp\ "toto http://toto 7c31a97b..." "ti et ti http://titi 087a0591..." "tata http://tata 2e9766c..." +gup.exe -unzip -clean "c:\npp\notepad++.exe" "c:\donho\notepad++\plugins" "toto http://toto 7c31a97b..." "ti et ti http://titi 087a0591..." "tata http://tata 2e9766c..." Install: GUp.exe download - create directory - unzip: one by one, no relaunch -gup.exe -unzipTo "c:\donho\notepad++\plugins" https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip 7c31a97ba2c5973a3087a05918a8acbf1e57a82d6d2e9766cb32611a1cbb8515 +gup.exe -unzipTo "c:\donho\notepad++\plugins\mimetools" https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip 7c31a97ba2c5973a3087a05918a8acbf1e57a82d6d2e9766cb32611a1cbb8515 */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { bool isSilentMode = false; FILE *pFile = NULL; - + string version; string customParam; From 27c5babb4b0ae50806f0266c5dfdae99e91f66ff Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 1 Nov 2018 17:40:05 +0100 Subject: [PATCH 018/110] Fix Updating plugin not working bug, and change plugin installation implementation. Make plugin installation way as updating one: same arguments and same implementation. --- src/winmain.cpp | 92 +++++++++++-------------------------------------- 1 file changed, 21 insertions(+), 71 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 54d5e08b..b84d5c7c 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -827,21 +827,11 @@ void writeLog(const char *logFileName, const char *logSuffix, const char *log2wr #define WRITE_LOG(fn, suffix, log) #endif - -/* -uninstall: tell user to restart Notepad++ - Gup.exe remove all - clean in batch - relaunch Notepad++ -gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" -gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" - -update: tell user to restart Notepad++ - Gup.exe download - remove all in directory - unzip/clean in batch - relaunch Notepad++ -gup.exe -unzip -clean "appPath2Launch" "dest_folder" "toto http://toto 7c31a97b..." "titi http://titi 087a0591..." "tata http://tata 2e9766c..." -gup.exe -unzip -clean "c:\npp\notepad++.exe" "c:\donho\notepad++\plugins" "toto http://toto 7c31a97b..." "ti et ti http://titi 087a0591..." "tata http://tata 2e9766c..." - -Install: GUp.exe download - create directory - unzip: one by one, no relaunch -gup.exe -unzipTo "c:\donho\notepad++\plugins\mimetools" https://github.com/npp-plugins/mimetools/releases/download/v2.1/mimetools.v2.1.zip 7c31a97ba2c5973a3087a05918a8acbf1e57a82d6d2e9766cb32611a1cbb8515 -*/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { + // Debug use - stop here so we can attach this process for debugging + // ::MessageBoxA(NULL, "And do something dirty to me ;)", "Attach me!", MB_OK); + bool isSilentMode = false; FILE *pFile = NULL; @@ -876,6 +866,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Plugins Updater // size_t nbParam = params.size(); + + // uninstall plugin: + // gup.exe -clean "appPath2Launch" "dest_folder" "fold1" "a fold2" "fold3" + // gup.exe -clean "c:\npp\notepad++.exe" "c:\temp\" "toto" "ti ti" "tata" if (isCleanUp && !isUnzip) // remove only { if (nbParam < 3) @@ -902,8 +896,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } - - if (isCleanUp && isUnzip) // update + // update: + // gup.exe -unzip -clean "appPath2Launch" "dest_folder" "pluginFolderName1 http://pluginFolderName1/pluginFolderName1.zip sha256Hash1" "pluginFolderName2 http://pluginFolderName2/pluginFolderName2.zip sha256Hash2" "plugin Folder Name3 http://plugin_Folder_Name3/plugin_Folder_Name3.zip sha256Hash3" + // gup.exe -unzip -clean "c:\npp\notepad++.exe" "c:\donho\notepad++\plugins" "toto http://toto/toto.zip 7c31a97b..." "ti et ti http://ti_ti/ti_ti.zip 087a0591..." "tata http://tata/tata.zip 2e9766c..." + + // Install: + // gup.exe -unzip "appPath2Launch" "dest_folder" "pluginFolderName1 http://pluginFolderName1/pluginFolderName1.zip sha256Hash1" "pluginFolderName2 http://pluginFolderName2/pluginFolderName2.zip sha256Hash2" "plugin Folder Name3 http://plugin_Folder_Name3/plugin_Folder_Name3.zip sha256Hash3" + // gup.exe -unzip "c:\npp\notepad++.exe" "c:\donho\notepad++\plugins" "toto http://toto/toto.zip 7c31a97b..." "ti et ti http://ti_ti/ti_ti.zip 087a0591..." "tata http://tata/tata.zip 2e9766c..." + if (isUnzip) // update or install { if (nbParam < 3) { @@ -947,8 +947,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) ::PathAppend(destPath, folder); - // clean - deleteFileOrFolder(destPath); + if (isCleanUp) // Update + { + deleteFileOrFolder(destPath); + } // install std::string dlDest = std::getenv("TEMP"); @@ -968,7 +970,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) bool isSuccessful = downloadBinary(dlUrl, dlDest, sha256ToCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (isSuccessful) { - isSuccessful = decompress(dlDest, destPathRoot); + isSuccessful = decompress(dlDest, destPath); if (!isSuccessful) { string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); @@ -978,7 +980,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); // Delete incomplete unzipped folder - deleteFileOrFolder(destPathRoot); + deleteFileOrFolder(destPath); } } } @@ -988,58 +990,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return 0; } - if (!isCleanUp && isUnzip) // install - { - if (nbParam != 3) - { - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "nbParam != 3"); - return -1; - } - - string destRoot = params[0]; - string downloadZipUrl = params[1]; - string sha256_toCheck = params[2]; - - std::string dlDest = std::getenv("TEMP"); - dlDest += "\\"; - dlDest += ::PathFindFileNameA(downloadZipUrl.c_str()); - - char *ext = ::PathFindExtensionA(dlDest.c_str()); - if (strcmp(ext, ".zip") != 0) - dlDest += ".zip"; - - dlFileName = ::PathFindFileNameA(downloadZipUrl.c_str()); - - string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); - if (dlStopped == "") - dlStopped = MSGID_DOWNLOADSTOPPED; - - bool isSuccessful = downloadBinary(downloadZipUrl, dlDest, sha256_toCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); - if (!isSuccessful) - { - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "downloadBinary func failed."); - return -1; - } - - isSuccessful = decompress(dlDest, destRoot); - if (!isSuccessful) - { - string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); - if (unzipFailed == "") - unzipFailed = MSGID_UNZIPFAILED; - - ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); - - // Delete incomplete unzipped folder - deleteFileOrFolder(destRoot); - - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (!isCleanUp && isUnzip) // install: ", "decompress func failed."); - return -1; - } - return 0; - } - - // // Notepad++ Updater // From add05d584bc1ecd9f7d2ff45f597055b5be1c42c Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 2 Nov 2018 15:46:06 +0100 Subject: [PATCH 019/110] Make comparing hash string insensitive case. --- src/winmain.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index b84d5c7c..1dea8d00 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -673,8 +673,9 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s { sprintf(sha2hashStr + i * 2, "%02x", sha2hash[i]); } - - if (sha2HashToCheck != sha2hashStr) + string sha2HashToCheckLowerCase = sha2HashToCheck; + std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), ::tolower); + if (sha2HashToCheckLowerCase != sha2hashStr) { string pluginPakageName = ::PathFindFileNameA(destTo.c_str()); string msg = "The hash of plugin package \""; @@ -830,7 +831,7 @@ void writeLog(const char *logFileName, const char *logSuffix, const char *log2wr int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { // Debug use - stop here so we can attach this process for debugging - // ::MessageBoxA(NULL, "And do something dirty to me ;)", "Attach me!", MB_OK); + //::MessageBoxA(NULL, "And do something dirty to me ;)", "Attach me!", MB_OK); bool isSilentMode = false; FILE *pFile = NULL; From 694d8412bf6d03995530298c26eee97c4951dfad Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 11 Nov 2018 02:40:59 +0100 Subject: [PATCH 020/110] WinGup 5.0.4 release --- src/change.log | 10 ++++++---- src/resource.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/change.log b/src/change.log index 827fafc0..f34abf6d 100644 --- a/src/change.log +++ b/src/change.log @@ -1,5 +1,7 @@ -WinGup (for Notepad++) v5.0.3 change: +WinGup (for Notepad++) v5.0.4 bug-fix & enhancements: + +1. Fix updating plugin not working bug. +2. Change plugin installation behaviour - same with plugin update now. +3. Add SHA-256 hash implementation for checking plugin zip package's SHA-256 hash while installation and update. + -1. Fix an unzip bug. -2. Fix a parser argument bug. -3. Change logic of plugins removal/update/installation. diff --git a/src/resource.h b/src/resource.h index 20675e5c..bcb4c74d 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.03\0" -#define VERSION_DIGITALVALUE 5, 0, 3, 0 +#define VERSION_VALUE "5.04\0" +#define VERSION_DIGITALVALUE 5, 0, 4, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 8959c0c802a46cf68eacc9d4474763b4a699e3c5 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 14 Nov 2018 09:36:16 +0100 Subject: [PATCH 021/110] Remove downloaded zip file after installation or update. --- src/winmain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/winmain.cpp b/src/winmain.cpp index 1dea8d00..0b728a9a 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -983,6 +983,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Delete incomplete unzipped folder deleteFileOrFolder(destPath); } + + // Remove downloaded zip from TEMP folder + ::DeleteFile(dlDest.c_str()); } } } From a01667ba7b73c1a2a7404029d1abc37c0897aa79 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 18 Nov 2018 02:08:53 +0100 Subject: [PATCH 022/110] Enhancement: if plugins update fails, restore the original installed plugins. --- src/winmain.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 0b728a9a..4329d3e6 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -948,9 +948,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) ::PathAppend(destPath, folder); + // Make a backup path + string backup4RestoreInCaseOfFailedPath; if (isCleanUp) // Update { - deleteFileOrFolder(destPath); + //deleteFileOrFolder(destPath); + + // check if renamed folder exist, if it does, delete it + backup4RestoreInCaseOfFailedPath = destPath + ".backup4RestoreInCaseOfFailed"; + if (::PathFileExistsA(backup4RestoreInCaseOfFailedPath.c_str())) + deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + + // rename the folder with suffix ".backup4RestoreInCaseOfFailed" + ::MoveFileA(destPath.c_str(), backup4RestoreInCaseOfFailedPath.c_str()); } // install @@ -982,10 +992,32 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Delete incomplete unzipped folder deleteFileOrFolder(destPath); + + if (!backup4RestoreInCaseOfFailedPath.empty()) + { + // rename back the folder + ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); + } + } + else + { + if (!backup4RestoreInCaseOfFailedPath.empty()) + { + // delete the folder with suffix ".backup4RestoreInCaseOfFailed" + deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); + } } // Remove downloaded zip from TEMP folder - ::DeleteFile(dlDest.c_str()); + ::DeleteFileA(dlDest.c_str()); + } + else + { + if (!backup4RestoreInCaseOfFailedPath.empty()) + { + // delete the folder with suffix ".backup4RestoreInCaseOfFailed" + ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); + } } } } From af34920693261307d34bb530622e6d70cbe875d2 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 1 Dec 2018 17:03:05 +0100 Subject: [PATCH 023/110] Force WinGup relaunch application with no relevation If WinGup is launched with privilege rights (UAC), the application it launches will have the same right. This PR makes explorer, which always has user's restriction, launch the application to get rid of the relevation. --- src/winmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 4329d3e6..8bea20c5 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -1022,7 +1022,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) } } - ::ShellExecuteA(NULL, "open", prog2Launch.c_str(), "", prog2LaunchDir, SW_SHOWNORMAL); + ::ShellExecuteA(NULL, "open", "explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); return 0; } From 6415820cf573bcc6e3461b07d04d5ccc4bf87789 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 5 Dec 2018 00:57:34 +0100 Subject: [PATCH 024/110] Launch Notepad++.exe without privilege rights after removing plugins --- src/winmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 8bea20c5..5b856506 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -892,7 +892,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) deleteFileOrFolder(destPath); } - ::ShellExecuteA(NULL, "open", prog2Launch.c_str(), "", prog2LaunchDir, SW_SHOWNORMAL); + ::ShellExecuteA(NULL, "open", "explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); return 0; } From 1d5cc12da7480c997e2b16642ffd593ba38b8dcc Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 9 Dec 2018 17:48:31 +0100 Subject: [PATCH 025/110] WinGup (for Notepad++) 5.0.5 release --- src/change.log | 10 ++++------ src/resource.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/change.log b/src/change.log index f34abf6d..d8dfe5a6 100644 --- a/src/change.log +++ b/src/change.log @@ -1,7 +1,5 @@ -WinGup (for Notepad++) v5.0.4 bug-fix & enhancements: - -1. Fix updating plugin not working bug. -2. Change plugin installation behaviour - same with plugin update now. -3. Add SHA-256 hash implementation for checking plugin zip package's SHA-256 hash while installation and update. - +WinGup (for Notepad++) v5.0.5 bug-fix & enhancements: +1. Restore the original installed plugins if plugins update fails. +2. Remove downloaded zip file after installation or update. +3. Relaunch Notepad++.exe without privilege rights after installing/updating/removing plugins. diff --git a/src/resource.h b/src/resource.h index bcb4c74d..53323fc0 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.04\0" -#define VERSION_DIGITALVALUE 5, 0, 4, 0 +#define VERSION_VALUE "5.05\0" +#define VERSION_DIGITALVALUE 5, 0, 5, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 86501c2de70008a3dd6d6f27b876cacd60fd47d1 Mon Sep 17 00:00:00 2001 From: Christian Grasser Date: Mon, 5 Nov 2018 22:12:07 +0100 Subject: [PATCH 026/110] Enhance checking download plugin package hash error message. - added missing nullpointer checks - extended error message on hash mismatch with the expected and found hashes Close #5 --- src/winmain.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 5b856506..3a1a4fd2 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -265,6 +265,8 @@ std::string getFileContent(const char *file2read) char data[blockSize]; std::string wholeFileContent = ""; FILE *fp = fopen(file2read, "rb"); + if(!fp) + return ""; size_t lenFile = 0; do @@ -604,6 +606,8 @@ static DWORD WINAPI launchProgressBar(void *) bool downloadBinary(const string& urlFrom, const string& destTo, const string& sha2HashToCheck, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) { FILE* pFile = fopen(destTo.c_str(), "wb"); + if (!pFile) + return false; // Download the install package from indicated location char errorBuffer[CURL_ERROR_SIZE] = { 0 }; @@ -677,10 +681,14 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), ::tolower); if (sha2HashToCheckLowerCase != sha2hashStr) { - string pluginPakageName = ::PathFindFileNameA(destTo.c_str()); + string pluginPackageName = ::PathFindFileNameA(destTo.c_str()); string msg = "The hash of plugin package \""; - msg += pluginPakageName; - msg += "\" is not correct. This plugin won't be installed."; + msg += pluginPackageName; + msg += "\" is not correct. Expected:\r"; + msg += sha2HashToCheckLowerCase; + msg += "\r<> Found:\r"; + msg += sha2hashStr; + msg += "\rThis plugin won't be installed."; MessageBoxA(NULL, msg.c_str(), "Plugin package hash mismatched", MB_OK | MB_APPLMODAL); ok = false; } @@ -814,12 +822,15 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, void writeLog(const char *logFileName, const char *logSuffix, const char *log2write) { FILE *f = fopen(logFileName, "a+"); - string log = logSuffix; - log += log2write; - fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); - fputc('\n', f); - fflush(f); - fclose(f); + if (f) + { + string log = logSuffix; + log += log2write; + log += '\n'; + fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); + fflush(f); + fclose(f); + } }; #ifdef _DEBUG From eda04532d135dc3b1f1c777170f83f57068562f7 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 19 Dec 2018 09:58:44 +0100 Subject: [PATCH 027/110] Fix unzipped bug (0 length issue) for plugin operations' part --- src/winmain.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 3a1a4fd2..22916dcb 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -312,11 +312,7 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) string extraitFullFilePath = unzipDestTo; PathAppend(extraitFullFilePath, file2extrait); - ZipArchiveEntry::Attributes attr = entry->GetAttributes(); - - //auto pos = extraitFullFilePath.find_last_of('/'); - //if (pos == extraitFullFilePath.length() - 1) // it's a folder to created - if (attr == ZipArchiveEntry::Attributes::Directory) + if (entry->IsDirectory()) { // if folder doesn't exist, create it. if (!::PathFileExistsA(extraitFullFilePath.c_str())) @@ -339,7 +335,7 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); // - // We try to catch the wrong detection of folder entry from ZipLib here + // We try to catch the missing folder entry case // if (!destFile.is_open()) { @@ -389,6 +385,9 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) { return false; } + utils::stream::copy(*decompressStream, destFile2); + destFile2.flush(); + destFile2.close(); } } From a4f12fd8cd0ca6eb6e44594b08ef6c9e2665a72e Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 20 Dec 2018 00:21:28 +0100 Subject: [PATCH 028/110] Fix unzip 0 length bug (for real) --- src/winmain.cpp | 80 ++++++++++++++----------------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 22916dcb..2cfa78ad 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -312,6 +312,11 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) string extraitFullFilePath = unzipDestTo; PathAppend(extraitFullFilePath, file2extrait); + + // file2extrait be separated into an array + vector strArray = tokenizeString(file2extrait, '/'); + string folderPath = unzipDestTo; + if (entry->IsDirectory()) { // if folder doesn't exist, create it. @@ -319,10 +324,18 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) { char msg[1024]; sprintf(msg, "[+] Create folder '%s'\n", file2extrait.c_str()); - OutputDebugStringA(msg); + OutputDebugStringA(msg); - if (!::CreateDirectoryA(extraitFullFilePath.c_str(), NULL)) - return false; + for (size_t k = 0; k < strArray.size(); ++k) + { + PathAppend(folderPath, strArray[k]); + if (!::PathFileExistsA(folderPath.c_str())) + { + if (!::CreateDirectoryA(folderPath.c_str(), NULL)) + return false; + } + } + } } else // it's a file @@ -331,66 +344,19 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); OutputDebugStringA(msg); - std::ofstream destFile; - destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); - - // - // We try to catch the missing folder entry case - // - if (!destFile.is_open()) + for (size_t k = 0; k < strArray.size() - 1; ++k) // loop on only directory, not on file (which is the last element) { - // file2extrait be separated into an array - vector strArray = tokenizeString(file2extrait, '/'); - - // loop unzipDestTo + file2extraitVector[i] to create directory (by checking existing file length is 0, and removing existing file) - if (strArray.size() > 1) + PathAppend(folderPath, strArray[k]); + if (!::PathFileExistsA(folderPath.c_str())) { - string folderFullFilePath = unzipDestTo; - for (int j = 0; j < int(strArray.size()) - 1; ++j) // loop on only directory, not on file (which is the last element) - { - PathAppend(folderFullFilePath, strArray[j]); - - BOOL isCreateFolderOK = FALSE; - if (::PathFileExistsA(folderFullFilePath.c_str())) - { - if (!::PathIsDirectoryA(folderFullFilePath.c_str())) - { - // if it's a file, remove it - deleteFileOrFolder(folderFullFilePath); - - // create it - isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); - } - else //perfect - { - isCreateFolderOK = TRUE; - } - } - else - { - // create it - isCreateFolderOK = ::CreateDirectoryA(folderFullFilePath.c_str(), NULL); - } - - // check if directory creation failed - if (!isCreateFolderOK) - return false; - } - - // copy again - std::ofstream destFile2; - destFile2.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); - - if (!destFile2.is_open()) - { + if (!::CreateDirectoryA(folderPath.c_str(), NULL)) return false; - } - utils::stream::copy(*decompressStream, destFile2); - destFile2.flush(); - destFile2.close(); } } + std::ofstream destFile; + destFile.open(extraitFullFilePath, std::ios::binary | std::ios::trunc); + utils::stream::copy(*decompressStream, destFile); destFile.flush(); From dfbc2ad37abe67e0db6844e54d56bf0e423b1f26 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 21 Dec 2018 02:18:56 +0100 Subject: [PATCH 029/110] Fix/hack error directory/file detection while unzip It should be fixed once for all logically (except the leaf directory could still be treated as file). However, the logic doesn't exist in a nightmare, which is based on an unreliable unzip component. --- src/winmain.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 2cfa78ad..d93c5be2 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -329,13 +329,20 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) for (size_t k = 0; k < strArray.size(); ++k) { PathAppend(folderPath, strArray[k]); + if (!::PathFileExistsA(folderPath.c_str())) { - if (!::CreateDirectoryA(folderPath.c_str(), NULL)) - return false; + ::CreateDirectoryA(folderPath.c_str(), NULL); + } + else if (!::PathIsDirectoryA(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection + { // Hence such hack to make the result is as correct as possible + // if it's a file, remove it + deleteFileOrFolder(folderPath); + + // create it + ::CreateDirectoryA(folderPath.c_str(), NULL); } } - } } else // it's a file @@ -349,8 +356,15 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) PathAppend(folderPath, strArray[k]); if (!::PathFileExistsA(folderPath.c_str())) { - if (!::CreateDirectoryA(folderPath.c_str(), NULL)) - return false; + ::CreateDirectoryA(folderPath.c_str(), NULL); + } + else if (!::PathIsDirectoryA(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection + { // Hence such hack to make the result is as correct as possible + // if it's a file, remove it + deleteFileOrFolder(folderPath); + + // create it + ::CreateDirectoryA(folderPath.c_str(), NULL); } } @@ -806,6 +820,17 @@ void writeLog(const char *logFileName, const char *logSuffix, const char *log2wr int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { + /* + { + string destPath = "C:\\tmp\\res\\TagsView"; + string dlDest = "C:\\tmp\\pb\\TagsView_Npp_03beta.zip"; + bool isSuccessful = decompress(dlDest, destPath); + if (isSuccessful) + { + return 0; + } + } + */ // Debug use - stop here so we can attach this process for debugging //::MessageBoxA(NULL, "And do something dirty to me ;)", "Attach me!", MB_OK); From 8fbc659340443ee391fade8760c94e08509541a3 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 21 Dec 2018 10:05:16 +0100 Subject: [PATCH 030/110] WinGup (for Notepad++) 5.1 release --- src/change.log | 8 ++++---- src/resource.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/change.log b/src/change.log index d8dfe5a6..97695581 100644 --- a/src/change.log +++ b/src/change.log @@ -1,5 +1,5 @@ -WinGup (for Notepad++) v5.0.5 bug-fix & enhancements: +WinGup (for Notepad++) v5.1 bug-fix & enhancements: -1. Restore the original installed plugins if plugins update fails. -2. Remove downloaded zip file after installation or update. -3. Relaunch Notepad++.exe without privilege rights after installing/updating/removing plugins. +1. Fix directory/file detection bug while unzip. +2. Fix 0 length unzipped issue for plugin operations. +3. Enhance checking download plugin package hash error message. \ No newline at end of file diff --git a/src/resource.h b/src/resource.h index 53323fc0..fb28f9e9 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.05\0" -#define VERSION_DIGITALVALUE 5, 0, 5, 0 +#define VERSION_VALUE "5.1\0" +#define VERSION_DIGITALVALUE 5, 1, 0, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 10d34c109a19bcaeb7d9e824f6ad76ea16857834 Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 6 Aug 2019 13:26:43 +0200 Subject: [PATCH 031/110] UI improvement: Plugins downloading with the progress bar --- src/winmain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index d93c5be2..358a6eb2 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -592,6 +592,9 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s char errorBuffer[CURL_ERROR_SIZE] = { 0 }; CURLcode res = CURLE_FAILED_INIT; CURL* curl = curl_easy_init(); + + ::CreateThread(NULL, 0, launchProgressBar, NULL, 0, NULL); + if (curl) { curl_easy_setopt(curl, CURLOPT_URL, urlFrom.c_str()); @@ -1129,8 +1132,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // // Download executable bin // - ::CreateThread(NULL, 0, launchProgressBar, NULL, 0, NULL); - + std::string dlDest = std::getenv("TEMP"); dlDest += "\\"; dlDest += ::PathFindFileNameA(gupDlInfo.getDownloadLocation().c_str()); From 38ba1c83b8e9838449e93d0a0142a15cd1a39282 Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 6 Aug 2019 18:31:50 +0200 Subject: [PATCH 032/110] Update README.md Close #4 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 616eca28..1e344171 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +What is WinGup for Notepad++? +-------------------------- + +This project is the fork of [WinGUp](https://github.com/gup4win/wingup). +WinGUp has been built for Notepad++'s need, but keep its functionality generic for being able to be used on any Windows application. With new built-in Plugins Admin in Notepad++, a more specific updater for Notepad++ is necessary. Hence this fork from the original WinGUp. + + What is WinGup? --------------- From ab60990dee79acf1fabfa2d302a8322463e1cdf2 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 9 Aug 2019 09:47:23 +0200 Subject: [PATCH 033/110] Fix the wrong progress bar info issue When there are several downloads simultaneously, the percentage shows completely wrong. --- src/winmain.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 358a6eb2..bdc69f37 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -88,6 +88,20 @@ gup -unzipTo [-clean] FOLDER_TO_ACTION ZIP_URL\r\ std::string thirdDoUpdateDlgButtonLabel; +void writeLog(const char *logFileName, const char *logSuffix, const char *log2write) +{ + FILE *f = fopen(logFileName, "a+"); + if (f) + { + string log = logSuffix; + log += log2write; + log += '\n'; + fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); + fflush(f); + fclose(f); + } +}; + //commandLine should contain path to n++ executable running void parseCommandLine(const char* commandLine, ParamVector& paramVector) { @@ -443,20 +457,20 @@ static size_t getDownloadData(unsigned char *data, size_t size, size_t nmemb, FI return len; }; -static size_t downloadRatio = 0; - -static size_t setProgress(HWND, double t, double d, double, double) +static size_t setProgress(HWND, double dlTotal, double dlSoFar, double, double) { while (stopDL) ::Sleep(1000); - size_t step = size_t(d * 100.0 / t - downloadRatio); - downloadRatio = size_t(d * 100.0 / t); + + size_t downloadedRatio = SendMessage(hProgressBar, PBM_DELTAPOS, 0, 0); + + size_t step = size_t(dlSoFar * 100.0 / dlTotal - downloadedRatio); SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0); SendMessage(hProgressBar, PBM_STEPIT, 0, 0); char percentage[128]; - sprintf(percentage, "Downloading %s: %Iu %%", dlFileName.c_str(), downloadRatio); + sprintf(percentage, "Downloading %s: %Iu %%", dlFileName.c_str(), downloadedRatio); ::SetWindowTextA(hProgressDlg, percentage); return 0; }; @@ -594,7 +608,6 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s CURL* curl = curl_easy_init(); ::CreateThread(NULL, 0, launchProgressBar, NULL, 0, NULL); - if (curl) { curl_easy_setopt(curl, CURLOPT_URL, urlFrom.c_str()); @@ -801,19 +814,6 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, return true; } -void writeLog(const char *logFileName, const char *logSuffix, const char *log2write) -{ - FILE *f = fopen(logFileName, "a+"); - if (f) - { - string log = logSuffix; - log += log2write; - log += '\n'; - fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); - fflush(f); - fclose(f); - } -}; #ifdef _DEBUG #define WRITE_LOG(fn, suffix, log) writeLog(fn, suffix, log); From c0139f293aa2e4ecf1be6acfd3195da92b704046 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 16 Oct 2019 01:18:39 +0200 Subject: [PATCH 034/110] WinGUp (for Notepad++) v5.1.1 release --- src/change.log | 6 ++---- src/resource.h | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/change.log b/src/change.log index 97695581..cd68cf52 100644 --- a/src/change.log +++ b/src/change.log @@ -1,5 +1,3 @@ -WinGup (for Notepad++) v5.1 bug-fix & enhancements: +WinGup (for Notepad++) v5.1.1 enhancements: -1. Fix directory/file detection bug while unzip. -2. Fix 0 length unzipped issue for plugin operations. -3. Enhance checking download plugin package hash error message. \ No newline at end of file +1. UI improvement: Plugins downloading with the progress bar \ No newline at end of file diff --git a/src/resource.h b/src/resource.h index fb28f9e9..b564422c 100644 --- a/src/resource.h +++ b/src/resource.h @@ -1,5 +1,5 @@ /* - Copyright 2007 Don HO + Copyright 2019 Don HO This file is part of GUP. @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.1\0" -#define VERSION_DIGITALVALUE 5, 1, 0, 0 +#define VERSION_VALUE "5.11\0" +#define VERSION_DIGITALVALUE 5, 1, 1, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From d1a980f47de0ebfbe36e98b8ecf4a9d737acb60d Mon Sep 17 00:00:00 2001 From: mere-human <9664141+mere-human@users.noreply.github.com> Date: Mon, 18 Jan 2021 21:44:54 +0200 Subject: [PATCH 035/110] Improve info while no update available Also, allow user to go to the website and check for update manually. Fix #13, close #15 --- src/ConfigFiles/nativeLang.xml | 5 ++- src/gup.rc | 13 ++++++ src/resource.h | 4 ++ src/winmain.cpp | 79 ++++++++++++++++++++++++++++++---- 4 files changed, 91 insertions(+), 10 deletions(-) diff --git a/src/ConfigFiles/nativeLang.xml b/src/ConfigFiles/nativeLang.xml index 3b1a5e3c..8ceb9533 100644 --- a/src/ConfigFiles/nativeLang.xml +++ b/src/ConfigFiles/nativeLang.xml @@ -22,10 +22,11 @@ - No update is available. + No update is available. The auto-update may not have been activated yet. An update package is available, do you want to download it? + <a id="id_download">Go to the download page</a> Download is stopped by user. Update is aborted. - is opened.\rUpdater will close it in order to process the installation.\rContinue? + is opened. Updater will close it in order to process the installation. Continue? Do you want to abort update download? "Can't unzip: Operation not permitted or decompression failed" diff --git a/src/gup.rc b/src/gup.rc index c338cf46..f8095d13 100644 --- a/src/gup.rc +++ b/src/gup.rc @@ -82,3 +82,16 @@ BEGIN PUSHBUTTON "No",IDNO,110,60,50,14 PUSHBUTTON "Never",IDCANCEL,170,60,50,14 END + +IDD_UPDATE_DLG DIALOGEX 0, 0, 187, 94 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE +CAPTION "No update" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL "No update is available.\r\rThe auto-update may not have been activated yet.",IDC_UPDATE_STATIC1,"Static",WS_GROUP|SS_CENTER,10,12,167,30 + CONTROL "Go to the download page",IDC_DOWNLOAD_LINK, + "SysLink",WS_TABSTOP,51,48,84,12 + DEFPUSHBUTTON "OK",IDOK,68,72,50,14 +END + diff --git a/src/resource.h b/src/resource.h index b564422c..279961a3 100644 --- a/src/resource.h +++ b/src/resource.h @@ -31,4 +31,8 @@ #define IDC_PORT_STATIC 1006 #define IDD_YESNONEVERDLG 1007 #define IDC_YESNONEVERMSG 1008 +#define IDD_UPDATE_DLG 1009 +#define IDC_UPDATE_STATIC1 1010 +#define IDC_DOWNLOAD_LINK 1011 + #endif // RESOURCE_H diff --git a/src/winmain.cpp b/src/winmain.cpp index bdc69f37..c8372753 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -56,7 +56,6 @@ const char FLAG_HELP[] = "--help"; const char FLAG_UUZIP[] = "-unzipTo"; const char FLAG_CLEANUP[] = "-clean"; -const char MSGID_NOUPDATE[] = "No update is available."; const char MSGID_UPDATEAVAILABLE[] = "An update package is available, do you want to download it?"; const char MSGID_DOWNLOADSTOPPED[] = "Download is stopped by user. Update is aborted."; const char MSGID_CLOSEAPP[] = " is opened.\rUpdater will close it in order to process the installation.\rContinue?"; @@ -590,6 +589,70 @@ LRESULT CALLBACK proxyDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM) return FALSE; } +struct UpdateCheckParams +{ + GupNativeLang& _nativeLang; + GupParameters& _gupParams; +}; + +LRESULT CALLBACK updateCheckDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + { + auto* params = reinterpret_cast(lParam); + if (params) + { + const string& title = params->_gupParams.getMessageBoxTitle(); + if (!title.empty()) + ::SetWindowTextA(hWndDlg, title.c_str()); + string textMsg = params->_nativeLang.getMessageString("MSGID_NOUPDATE"); + if (!textMsg.empty()) + ::SetDlgItemTextA(hWndDlg, IDC_UPDATE_STATIC1, textMsg.c_str()); + string textLink = params->_nativeLang.getMessageString("MSGID_DOWNLOADTEXT"); + if (!textLink.empty()) + ::SetDlgItemTextA(hWndDlg, IDC_DOWNLOAD_LINK, textLink.c_str()); + } + goToScreenCenter(hWndDlg); + return TRUE; + } + + case WM_COMMAND: + { + switch LOWORD((wParam)) + { + case IDOK: + case IDYES: + case IDNO: + case IDCANCEL: + EndDialog(hWndDlg, wParam); + return TRUE; + default: + break; + } + } + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) + { + case NM_CLICK: + case NM_RETURN: + { + PNMLINK pNMLink = (PNMLINK)lParam; + LITEM item = pNMLink->item; + if (lstrcmpW(item.szID, L"id_download") == 0) + { + ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/downloads/"), NULL, NULL, SW_SHOWNORMAL); + } + break; + } + } + break; + } + return FALSE; +} + static DWORD WINAPI launchProgressBar(void *) { ::DialogBox(hInst, MAKEINTRESOURCE(IDD_PROGRESS_DLG), NULL, reinterpret_cast(progressBarDlgProc)); @@ -673,7 +736,8 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s sprintf(sha2hashStr + i * 2, "%02x", sha2hash[i]); } string sha2HashToCheckLowerCase = sha2HashToCheck; - std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), ::tolower); + std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), + [](char c) { return static_cast(::tolower(c)); }); if (sha2HashToCheckLowerCase != sha2hashStr) { string pluginPackageName = ::PathFindFileNameA(destTo.c_str()); @@ -1076,16 +1140,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) return -1; } + HWND hApp = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); + bool isModal = gupParams.isMessageBoxModal(); GupDownloadInfo gupDlInfo(updateInfo.c_str()); if (!gupDlInfo.doesNeed2BeUpdated()) { if (!isSilentMode) { - string noUpdate = nativeLang.getMessageString("MSGID_NOUPDATE"); - if (noUpdate == "") - noUpdate = MSGID_NOUPDATE; - ::MessageBoxA(NULL, noUpdate.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + UpdateCheckParams localParams{ nativeLang, gupParams }; + ::DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE_DLG), isModal ? hApp : NULL, + reinterpret_cast(updateCheckDlgProc), reinterpret_cast(&localParams)); } return 0; } @@ -1104,8 +1169,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) thirdDoUpdateDlgButtonLabel = gupParams.get3rdButtonLabel(); int dlAnswer = 0; - HWND hApp = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); - bool isModal = gupParams.isMessageBoxModal(); if (!thirdButtonCmd) dlAnswer = ::MessageBoxA(isModal ? hApp : NULL, updateAvailable.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_YESNO); From be7d2e940f3078e96d2aa97908cf8915368284c5 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 1 Feb 2021 20:38:08 +0100 Subject: [PATCH 036/110] Remove the unecessary format from the translation So the error of translated text won't mess the feature of download page link. Enhance the commit: https://github.com/notepad-plus-plus/wingup/commit/d1a980f47de0ebfbe36e98b8ecf4a9d737acb60d --- src/ConfigFiles/nativeLang.xml | 4 ++-- src/winmain.cpp | 9 +++++++-- vcproj/GUP.vcxproj | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ConfigFiles/nativeLang.xml b/src/ConfigFiles/nativeLang.xml index 8ceb9533..8a2a7793 100644 --- a/src/ConfigFiles/nativeLang.xml +++ b/src/ConfigFiles/nativeLang.xml @@ -1,4 +1,4 @@ - + - - - - - - No update is available. The auto-update may not have been activated yet. - An update package is available, do you want to download it? - Go to the download page - Download is stopped by user. Update is aborted. - is opened. Updater will close it in order to process the installation. Continue? - Do you want to abort update download? - "Can't unzip: Operation not permitted or decompression failed" - - diff --git a/src/TinyXml/tinyxmlparser.cpp b/src/TinyXml/tinyxmlparser.cpp index 98f898e3..edff9e2f 100644 --- a/src/TinyXml/tinyxmlparser.cpp +++ b/src/TinyXml/tinyxmlparser.cpp @@ -22,6 +22,8 @@ must not be misrepresented as being the original software. distribution. */ +#pragma warning(disable : 4244) + #include "tinyxml.h" #include diff --git a/src/gup.rc b/src/gup.rc index f8095d13..54a52685 100644 --- a/src/gup.rc +++ b/src/gup.rc @@ -90,8 +90,7 @@ CAPTION "No update" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "No update is available.\r\rThe auto-update may not have been activated yet.",IDC_UPDATE_STATIC1,"Static",WS_GROUP|SS_CENTER,10,12,167,30 - CONTROL "Go to the download page",IDC_DOWNLOAD_LINK, - "SysLink",WS_TABSTOP,51,48,84,12 + CONTROL "Go to the download page",IDC_DOWNLOAD_LINK,"SysLink",WS_TABSTOP,51,48,110,12 DEFPUSHBUTTON "OK",IDOK,68,72,50,14 END diff --git a/src/resource.h b/src/resource.h index 279961a3..16dbe0b4 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,7 +20,7 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE "5.11\0" +#define VERSION_VALUE L"5.11\0" #define VERSION_DIGITALVALUE 5, 1, 1, 0 #define IDD_PROGRESS_DLG 1001 diff --git a/src/translations/catalan.xml b/src/translations/catalan.xml index cabdad7b..29836b9f 100644 --- a/src/translations/catalan.xml +++ b/src/translations/catalan.xml @@ -17,15 +17,15 @@ You should have received a copy of the GNU Lesser General Public License along with GUP. If not, see . --> - - + + + + - No hi ha cap actualitzaci disponible. - Hi ha una actualitzaci disponible. Voleu baixar-la? - S'ha interromput la baixada. No es podr fer l'actualitzaci. - s obert.\rEl programa es tancar per fer la instalaci.\rVoleu continuar? - Segur que voleu interrompre la baixada de l'actualitzaci? + + + + + diff --git a/src/translations/english.xml b/src/translations/english.xml new file mode 100644 index 00000000..b5c8ab7a --- /dev/null +++ b/src/translations/english.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/src/translations/french.xml b/src/translations/french.xml index 1b536ace..9f478b98 100644 --- a/src/translations/french.xml +++ b/src/translations/french.xml @@ -1,15 +1,15 @@ - + - - + + + + - La mise jour n'est pas disponible. - Une mise jour est disponible, voulez-vous le tlcharger? - Le tlchargement est interrompu. La mise jour ne sera pas poursuivie. - est ouvert. Il sera ferm afin de pouvoir poursuivre l'installation. Continue? - Etes-vous sr d'interrompre le tlchargement? - "Impossible de dzipper: l'opration n'est pas permise ou la dcompression a chou." + + + + + + + diff --git a/src/translations/german.xml b/src/translations/german.xml index 2e6f2f63..c078afde 100644 --- a/src/translations/german.xml +++ b/src/translations/german.xml @@ -1,15 +1,15 @@ - + - + + + - - Es sind keine neuen Updates verfgbar. + + - - Ein Update ist verfgbar. Mchten Sie es herunterladen? + + - - Das Herunterladen wurde durch den Benutzer gestoppt. Das Update wurde abgebrochen. + + - - wird ausgefhrt.\rDer Updater wird die Anwendung beenden um die Installation vorzunehmen.\rFortfahren? + + - - Mchten Sie das Herunterladen des Updates wirklich abbrechen? + + diff --git a/src/translations/italian.xml b/src/translations/italian.xml deleted file mode 100644 index c24aca07..00000000 --- a/src/translations/italian.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Nessun aggiornamento disponibile. - E' disponibile un aggiornamento, si desidera scaricarlo? - Download arrestato dall'utente. Aggiornamento annullato. - è aperto.\rL'aggiornamento lo chiuderà Per proseguire l'installazione.\rContinuare? - Si vuole annullare il download dell'aggiornamento? - - diff --git a/src/translations/portuguese.xml b/src/translations/portuguese.xml deleted file mode 100644 index 513f3f19..00000000 --- a/src/translations/portuguese.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Nenhuma atualização disponível. - Há uma atualização disponível, você quer baixá-la? - Download interrompido pelo usuário. Atualização cancelada. - está aberto.\rA atualização irá fechá-lo para continuar a instalação.\rContinuar? - Você deseja cancelar o download da atualização? - - \ No newline at end of file diff --git a/src/translations/russian.xml b/src/translations/russian.xml index d03701d2..e13788d7 100644 --- a/src/translations/russian.xml +++ b/src/translations/russian.xml @@ -1,15 +1,15 @@ - + - - + + + + - - . - - . ? - - . . - - .\r , .\r ? - - ? + + + + + + + + + + diff --git a/src/translations/spanish.xml b/src/translations/spanish.xml index e32921e5..0700820c 100644 --- a/src/translations/spanish.xml +++ b/src/translations/spanish.xml @@ -1,4 +1,4 @@ - + - + - No hay ninguna actualizacin disponible. - Hay una actualizacin disponible. Quiere descargarla? - Se interrumpi la descarga. No se podr realizar la actualizacin. - est abierto.\rSe cerrar el programa para realizar la instalacin.\rQuiere continuar? - Confirma que quiere interrumpir la descarga de la actualizacin? + + + + + diff --git a/src/translations/taiwaneseMandarin.xml b/src/translations/taiwaneseMandarin.xml new file mode 100644 index 00000000..ee6c0431 --- /dev/null +++ b/src/translations/taiwaneseMandarin.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/src/translations/turkish.xml b/src/translations/turkish.xml deleted file mode 100644 index f44de5b9..00000000 --- a/src/translations/turkish.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - Hiçbir güncelleme mevcut değildir. - Bir güncelleme mevcuttur, onu indirmek ister misiniz? - İndirme kullanıcı tarafından durduruldu. Güncelleme iptal edildi. - açılmıştır.\rGüncelleyici kurma işlemi kapanacaktır.\rDevam? - Güncellemeyi durdurmak istiyor musunuz? - - diff --git a/src/translations/vietnamese.xml b/src/translations/vietnamese.xml index 910ad205..58d3d128 100644 --- a/src/translations/vietnamese.xml +++ b/src/translations/vietnamese.xml @@ -1,4 +1,4 @@ - + - + Hiện tại không có bản cập nhật nào. Một gói cập nhật hiện sẵn có, bạn có muốn tải về không? diff --git a/src/winmain.cpp b/src/winmain.cpp index c5d6c8aa..523459ca 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -36,32 +36,32 @@ using namespace std; -typedef vector ParamVector; +typedef vector ParamVector; HINSTANCE hInst; static HWND hProgressDlg; static HWND hProgressBar; static bool doAbort = false; static bool stopDL = false; -static string msgBoxTitle = ""; -static string abortOrNot = ""; -static string proxySrv = "0.0.0.0"; +static wstring msgBoxTitle = L""; +static wstring abortOrNot = L""; +static wstring proxySrv = L"0.0.0.0"; static long proxyPort = 0; -static string winGupUserAgent = "WinGup/"; -static string dlFileName = ""; - -const char FLAG_OPTIONS[] = "-options"; -const char FLAG_VERBOSE[] = "-verbose"; -const char FLAG_HELP[] = "--help"; -const char FLAG_UUZIP[] = "-unzipTo"; -const char FLAG_CLEANUP[] = "-clean"; - -const char MSGID_UPDATEAVAILABLE[] = "An update package is available, do you want to download it?"; -const char MSGID_DOWNLOADSTOPPED[] = "Download is stopped by user. Update is aborted."; -const char MSGID_CLOSEAPP[] = " is opened.\rUpdater will close it in order to process the installation.\rContinue?"; -const char MSGID_ABORTORNOT[] = "Do you want to abort update download?"; -const char MSGID_UNZIPFAILED[] = "Can't unzip:\nOperation not permitted or decompression failed"; -const char MSGID_HELP[] = "Usage :\r\ +static wstring winGupUserAgent = L"WinGup/"; +static wstring dlFileName = L""; + +const wchar_t FLAG_OPTIONS[] = L"-options"; +const wchar_t FLAG_VERBOSE[] = L"-verbose"; +const wchar_t FLAG_HELP[] = L"--help"; +const wchar_t FLAG_UUZIP[] = L"-unzipTo"; +const wchar_t FLAG_CLEANUP[] = L"-clean"; + +const wchar_t MSGID_UPDATEAVAILABLE[] = L"An update package is available, do you want to download it?"; +const wchar_t MSGID_DOWNLOADSTOPPED[] = L"Download is stopped by user. Update is aborted."; +const wchar_t MSGID_CLOSEAPP[] = L" is opened.\rUpdater will close it in order to process the installation.\rContinue?"; +const wchar_t MSGID_ABORTORNOT[] = L"Do you want to abort update download?"; +const wchar_t MSGID_UNZIPFAILED[] = L"Can't unzip:\nOperation not permitted or decompression failed"; +const wchar_t MSGID_HELP[] = L"Usage :\r\ \r\ gup --help\r\ gup -options\r\ @@ -84,15 +84,14 @@ gup -unzipTo [-clean] FOLDER_TO_ACTION ZIP_URL\r\ ZIP_URL: The URL to download zip file.\r\ FOLDER_TO_ACTION: The folder where we clean or/and unzip to.\r\ "; -std::string thirdDoUpdateDlgButtonLabel; +std::wstring thirdDoUpdateDlgButtonLabel; - -void writeLog(const char *logFileName, const char *logSuffix, const char *log2write) +void writeLog(const wchar_t *logFileName, const wchar_t *logSuffix, const wchar_t *log2write) { - FILE *f = fopen(logFileName, "a+"); + FILE *f = _wfopen(logFileName, L"a+"); if (f) { - string log = logSuffix; + wstring log = logSuffix; log += log2write; log += '\n'; fwrite(log.c_str(), sizeof(log.c_str()[0]), log.length(), f); @@ -102,20 +101,20 @@ void writeLog(const char *logFileName, const char *logSuffix, const char *log2wr }; //commandLine should contain path to n++ executable running -void parseCommandLine(const char* commandLine, ParamVector& paramVector) +void parseCommandLine(const wchar_t* commandLine, ParamVector& paramVector) { if (!commandLine) return; - char* cmdLine = new char[lstrlenA(commandLine) + 1]; - lstrcpyA(cmdLine, commandLine); + wchar_t* cmdLine = new wchar_t[lstrlen(commandLine) + 1]; + lstrcpy(cmdLine, commandLine); - char* cmdLinePtr = cmdLine; + wchar_t* cmdLinePtr = cmdLine; bool isInFile = false; bool isInWhiteSpace = true; - size_t commandLength = lstrlenA(cmdLinePtr); - std::vector args; + size_t commandLength = lstrlen(cmdLinePtr); + std::vector args; for (size_t i = 0; i < commandLength; ++i) { switch (cmdLinePtr[i]) @@ -156,13 +155,13 @@ void parseCommandLine(const char* commandLine, ParamVector& paramVector) delete[] cmdLine; }; -bool isInList(const char* token2Find, ParamVector & params) +bool isInList(const wchar_t* token2Find, ParamVector & params) { size_t nbItems = params.size(); for (size_t i = 0; i < nbItems; ++i) { - if (!strcmp(token2Find, params.at(i).c_str())) + if (!lstrcmp(token2Find, params.at(i).c_str())) { params.erase(params.begin() + i); return true; @@ -171,15 +170,16 @@ bool isInList(const char* token2Find, ParamVector & params) return false; }; -bool getParamVal(char c, ParamVector & params, string & value) +bool getParamVal(wchar_t c, ParamVector & params, wstring & value) { - value = ""; + value = L""; size_t nbItems = params.size(); for (size_t i = 0; i < nbItems; ++i) { - const char* token = params.at(i).c_str(); - if (token[0] == '-' && strlen(token) >= 2 && token[1] == c) { //dash, and enough chars + const wchar_t* token = params.at(i).c_str(); + if (token[0] == '-' && lstrlen(token) >= 2 && token[1] == c) //dash, and enough chars + { value = (token + 2); params.erase(params.begin() + i); return true; @@ -188,11 +188,11 @@ bool getParamVal(char c, ParamVector & params, string & value) return false; } -string PathAppend(string& strDest, const string& str2append) +wstring PathAppend(wstring& strDest, const wstring& str2append) { if (strDest.empty() && str2append.empty()) // "" + "" { - strDest = "\\"; + strDest = L"\\"; return strDest; } @@ -217,16 +217,16 @@ string PathAppend(string& strDest, const string& str2append) } // toto + titi - strDest += "\\"; + strDest += L"\\"; strDest += str2append; return strDest; }; -vector tokenizeString(const string & tokenString, const char delim) +vector tokenizeString(const wstring & tokenString, const char delim) { //Vector is created on stack and copied on return - std::vector tokens; + std::vector tokens; // Skip delimiters at beginning. string::size_type lastPos = tokenString.find_first_not_of(delim, 0); @@ -245,15 +245,15 @@ vector tokenizeString(const string & tokenString, const char delim) return tokens; }; -bool deleteFileOrFolder(const string& f2delete) +bool deleteFileOrFolder(const wstring& f2delete) { auto len = f2delete.length(); - LPSTR actionFolder = new char[len + 2]; - strcpy(actionFolder, f2delete.c_str()); + wchar_t* actionFolder = new wchar_t[len + 2]; + lstrcpy(actionFolder, f2delete.c_str()); actionFolder[len] = 0; actionFolder[len + 1] = 0; - SHFILEOPSTRUCTA fileOpStruct = { 0 }; + SHFILEOPSTRUCT fileOpStruct = { 0 }; fileOpStruct.hwnd = NULL; fileOpStruct.pFrom = actionFolder; fileOpStruct.pTo = NULL; @@ -263,13 +263,13 @@ bool deleteFileOrFolder(const string& f2delete) fileOpStruct.hNameMappings = NULL; fileOpStruct.lpszProgressTitle = NULL; - int res = SHFileOperationA(&fileOpStruct); + int res = SHFileOperation(&fileOpStruct); delete[] actionFolder; return (res == 0); }; -std::string getFileContent(const char *file2read) +std::string getFileContentA(const char* file2read) { if (!::PathFileExistsA(file2read)) return ""; @@ -295,16 +295,17 @@ std::string getFileContent(const char *file2read) // unzipDestTo should be plugin home root + plugin folder name // ex: %APPDATA%\..\local\Notepad++\plugins\myAwesomePlugin -bool decompress(const string& zipFullFilePath, const string& unzipDestTo) +bool decompress(const wstring& zipFullFilePath, const wstring& unzipDestTo) { // if destination folder doesn't exist, create it. - if (!::PathFileExistsA(unzipDestTo.c_str())) + if (!::PathFileExists(unzipDestTo.c_str())) { - if (!::CreateDirectoryA(unzipDestTo.c_str(), NULL)) + if (!::CreateDirectory(unzipDestTo.c_str(), NULL)) return false; } - ZipArchive::Ptr archive = ZipFile::Open(zipFullFilePath.c_str()); + string zipFullFilePathA = ws2s(zipFullFilePath); + ZipArchive::Ptr archive = ZipFile::Open(zipFullFilePathA.c_str()); std::istream* decompressStream = nullptr; auto count = archive->GetEntriesCount(); @@ -321,63 +322,65 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) decompressStream = entry->GetDecompressionStream(); assert(decompressStream != nullptr); - string file2extrait = entry->GetFullName(); - string extraitFullFilePath = unzipDestTo; + wstring file2extrait = s2ws(entry->GetFullName()); + wstring extraitFullFilePath = unzipDestTo; PathAppend(extraitFullFilePath, file2extrait); // file2extrait be separated into an array - vector strArray = tokenizeString(file2extrait, '/'); - string folderPath = unzipDestTo; + vector strArray = tokenizeString(file2extrait, '/'); + wstring folderPath = unzipDestTo; if (entry->IsDirectory()) { // if folder doesn't exist, create it. - if (!::PathFileExistsA(extraitFullFilePath.c_str())) + if (!::PathFileExists(extraitFullFilePath.c_str())) { - char msg[1024]; - sprintf(msg, "[+] Create folder '%s'\n", file2extrait.c_str()); - OutputDebugStringA(msg); + const size_t msgLen = 1024; + wchar_t msg[msgLen]; + swprintf(msg, msgLen, L"[+] Create folder '%s'\n", file2extrait.c_str()); + OutputDebugString(msg); for (size_t k = 0; k < strArray.size(); ++k) { PathAppend(folderPath, strArray[k]); - if (!::PathFileExistsA(folderPath.c_str())) + if (!::PathFileExists(folderPath.c_str())) { - ::CreateDirectoryA(folderPath.c_str(), NULL); + ::CreateDirectory(folderPath.c_str(), NULL); } - else if (!::PathIsDirectoryA(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection + else if (!::PathIsDirectory(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection { // Hence such hack to make the result is as correct as possible // if it's a file, remove it deleteFileOrFolder(folderPath); // create it - ::CreateDirectoryA(folderPath.c_str(), NULL); + ::CreateDirectory(folderPath.c_str(), NULL); } } } } else // it's a file { - char msg[1024]; - sprintf(msg, "[+] Extracting file '%s'\n", file2extrait.c_str()); - OutputDebugStringA(msg); + const size_t msgLen = 1024; + wchar_t msg[msgLen]; + swprintf(msg, msgLen, L"[+] Extracting file '%s'\n", file2extrait.c_str()); + OutputDebugString(msg); for (size_t k = 0; k < strArray.size() - 1; ++k) // loop on only directory, not on file (which is the last element) { PathAppend(folderPath, strArray[k]); - if (!::PathFileExistsA(folderPath.c_str())) + if (!::PathFileExists(folderPath.c_str())) { - ::CreateDirectoryA(folderPath.c_str(), NULL); + ::CreateDirectory(folderPath.c_str(), NULL); } - else if (!::PathIsDirectoryA(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection + else if (!::PathIsDirectory(folderPath.c_str())) // The unzip core component is not reliable for the file/directory detection { // Hence such hack to make the result is as correct as possible // if it's a file, remove it deleteFileOrFolder(folderPath); // create it - ::CreateDirectoryA(folderPath.c_str(), NULL); + ::CreateDirectory(folderPath.c_str(), NULL); } } @@ -392,10 +395,10 @@ bool decompress(const string& zipFullFilePath, const string& unzipDestTo) } // check installed dll - string pluginFolder = PathFindFileNameA(unzipDestTo.c_str()); - string installedPluginPath = unzipDestTo + "\\" + pluginFolder + ".dll"; + wstring pluginFolder = PathFindFileName(unzipDestTo.c_str()); + wstring installedPluginPath = unzipDestTo + L"\\" + pluginFolder + L".dll"; - if (::PathFileExistsA(installedPluginPath.c_str())) + if (::PathFileExists(installedPluginPath.c_str())) { // DLL is deployed correctly. // OK and nothing to do. @@ -468,9 +471,10 @@ static size_t setProgress(HWND, double dlTotal, double dlSoFar, double, double) SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0); SendMessage(hProgressBar, PBM_STEPIT, 0, 0); - char percentage[128]; - sprintf(percentage, "Downloading %s: %Iu %%", dlFileName.c_str(), downloadedRatio); - ::SetWindowTextA(hProgressDlg, percentage); + const size_t percentageLen = 1024; + wchar_t percentage[percentageLen]; + swprintf(percentage, percentageLen, L"Downloading %s: %Iu %%", dlFileName.c_str(), downloadedRatio); + ::SetWindowText(hProgressDlg, percentage); return 0; }; @@ -502,9 +506,9 @@ LRESULT CALLBACK progressBarDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARA return TRUE; case IDCANCEL: stopDL = true; - if (abortOrNot == "") + if (abortOrNot == L"") abortOrNot = MSGID_ABORTORNOT; - int abortAnswer = ::MessageBoxA(hWndDlg, abortOrNot.c_str(), msgBoxTitle.c_str(), MB_YESNO); + int abortAnswer = ::MessageBox(hWndDlg, abortOrNot.c_str(), msgBoxTitle.c_str(), MB_YESNO); if (abortAnswer == IDYES) { doAbort = true; @@ -526,8 +530,8 @@ LRESULT CALLBACK yesNoNeverDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP { case WM_INITDIALOG: { - if (thirdDoUpdateDlgButtonLabel != "") - ::SetDlgItemTextA(hWndDlg, IDCANCEL, thirdDoUpdateDlgButtonLabel.c_str()); + if (thirdDoUpdateDlgButtonLabel != L"") + ::SetDlgItemText(hWndDlg, IDCANCEL, thirdDoUpdateDlgButtonLabel.c_str()); goToScreenCenter(hWndDlg); return TRUE; @@ -562,7 +566,7 @@ LRESULT CALLBACK proxyDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM) switch(Msg) { case WM_INITDIALOG: - ::SetDlgItemTextA(hWndDlg, IDC_PROXYSERVER_EDIT, proxySrv.c_str()); + ::SetDlgItemText(hWndDlg, IDC_PROXYSERVER_EDIT, proxySrv.c_str()); ::SetDlgItemInt(hWndDlg, IDC_PORT_EDIT, proxyPort, FALSE); goToScreenCenter(hWndDlg); return TRUE; @@ -572,8 +576,8 @@ LRESULT CALLBACK proxyDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM) { case IDOK: { - char proxyServer[MAX_PATH]; - ::GetDlgItemTextA(hWndDlg, IDC_PROXYSERVER_EDIT, proxyServer, MAX_PATH); + wchar_t proxyServer[MAX_PATH]; + ::GetDlgItemText(hWndDlg, IDC_PROXYSERVER_EDIT, proxyServer, MAX_PATH); proxySrv = proxyServer; proxyPort = ::GetDlgItemInt(hWndDlg, IDC_PORT_EDIT, NULL, FALSE); EndDialog(hWndDlg, 1); @@ -599,61 +603,63 @@ LRESULT CALLBACK updateCheckDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, L { switch (message) { - case WM_INITDIALOG: - { - auto* params = reinterpret_cast(lParam); - if (params) + case WM_INITDIALOG: { - const string& title = params->_gupParams.getMessageBoxTitle(); - if (!title.empty()) - ::SetWindowTextA(hWndDlg, title.c_str()); - string textMsg = params->_nativeLang.getMessageString("MSGID_NOUPDATE"); - if (!textMsg.empty()) - ::SetDlgItemTextA(hWndDlg, IDC_UPDATE_STATIC1, textMsg.c_str()); - string goToDlStr = params->_nativeLang.getMessageString("MSGID_DOWNLOADTEXT"); - if (!goToDlStr.empty()) + auto* params = reinterpret_cast(lParam); + if (params) { - string textLink = ""; - textLink += goToDlStr; - textLink += ""; - ::SetDlgItemTextA(hWndDlg, IDC_DOWNLOAD_LINK, textLink.c_str()); + const wstring& title = params->_gupParams.getMessageBoxTitle(); + if (!title.empty()) + ::SetWindowText(hWndDlg, title.c_str()); + + wstring textMsg = params->_nativeLang.getMessageString("MSGID_NOUPDATE"); + if (!textMsg.empty()) + ::SetDlgItemText(hWndDlg, IDC_UPDATE_STATIC1, textMsg.c_str()); + + wstring goToDlStr = params->_nativeLang.getMessageString("MSGID_DOWNLOADTEXT"); + if (!goToDlStr.empty()) + { + wstring textLink = L""; + textLink += goToDlStr; + textLink += L""; + ::SetDlgItemText(hWndDlg, IDC_DOWNLOAD_LINK, textLink.c_str()); + } } + goToScreenCenter(hWndDlg); + return TRUE; } - goToScreenCenter(hWndDlg); - return TRUE; - } - case WM_COMMAND: - { - switch LOWORD((wParam)) + case WM_COMMAND: { - case IDOK: - case IDYES: - case IDNO: - case IDCANCEL: - EndDialog(hWndDlg, wParam); - return TRUE; - default: - break; + switch LOWORD((wParam)) + { + case IDOK: + case IDYES: + case IDNO: + case IDCANCEL: + EndDialog(hWndDlg, wParam); + return TRUE; + default: + break; + } } - } - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) - { - case NM_CLICK: - case NM_RETURN: - { - PNMLINK pNMLink = (PNMLINK)lParam; - LITEM item = pNMLink->item; - if (lstrcmpW(item.szID, L"id_download") == 0) + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { - ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/downloads/"), NULL, NULL, SW_SHOWNORMAL); + case NM_CLICK: + case NM_RETURN: + { + PNMLINK pNMLink = (PNMLINK)lParam; + LITEM item = pNMLink->item; + if (lstrcmpW(item.szID, L"id_download") == 0) + { + ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/downloads/"), NULL, NULL, SW_SHOWNORMAL); + } + break; + } } break; - } - } - break; } return FALSE; } @@ -664,9 +670,9 @@ static DWORD WINAPI launchProgressBar(void *) return 0; } -bool downloadBinary(const string& urlFrom, const string& destTo, const string& sha2HashToCheck, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) +bool downloadBinary(const wstring& urlFrom, const wstring& destTo, const wstring& sha2HashToCheck, pair proxyServerInfo, bool isSilentMode, const pair& stoppedMessage) { - FILE* pFile = fopen(destTo.c_str(), "wb"); + FILE* pFile = _wfopen(destTo.c_str(), L"wb"); if (!pFile) return false; @@ -678,7 +684,7 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s ::CreateThread(NULL, 0, launchProgressBar, NULL, 0, NULL); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, urlFrom.c_str()); + curl_easy_setopt(curl, CURLOPT_URL, ws2s(urlFrom).c_str()); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getDownloadData); @@ -688,12 +694,12 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, setProgress); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, hProgressBar); - curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_USERAGENT, ws2s(winGupUserAgent).c_str()); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); if (!proxyServerInfo.first.empty() && proxyServerInfo.second != -1) { - curl_easy_setopt(curl, CURLOPT_PROXY, proxyServerInfo.first.c_str()); + curl_easy_setopt(curl, CURLOPT_PROXY, ws2s(proxyServerInfo.first).c_str()); curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyServerInfo.second); } curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST | CURLSSLOPT_NO_REVOKE); @@ -707,9 +713,10 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s { if (!isSilentMode && doAbort == false) ::MessageBoxA(NULL, errorBuffer, "curl error", MB_OK); + if (doAbort) { - ::MessageBoxA(NULL, stoppedMessage.first.c_str(), stoppedMessage.second.c_str(), MB_OK); + ::MessageBox(NULL, stoppedMessage.first.c_str(), stoppedMessage.second.c_str(), MB_OK); } doAbort = false; return false; @@ -724,11 +731,11 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s if (!sha2HashToCheck.empty()) { char sha2hashStr[65] = { '\0' }; - std::string content = getFileContent(destTo.c_str()); + std::string content = getFileContentA(ws2s(destTo).c_str()); if (content.empty()) { // Remove installed plugin - MessageBoxA(NULL, "The plugin package is not found.", "Plugin cannot be found", MB_OK | MB_APPLMODAL); + MessageBox(NULL, L"The plugin package is not found.", L"Plugin cannot be found", MB_OK | MB_APPLMODAL); ok = false; } else @@ -740,20 +747,22 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s { sprintf(sha2hashStr + i * 2, "%02x", sha2hash[i]); } - string sha2HashToCheckLowerCase = sha2HashToCheck; + wstring sha2HashToCheckLowerCase = sha2HashToCheck; std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), [](char c) { return static_cast(::tolower(c)); }); - if (sha2HashToCheckLowerCase != sha2hashStr) + + wstring sha2hashStrW = s2ws(sha2hashStr); + if (sha2HashToCheckLowerCase != sha2hashStrW) { - string pluginPackageName = ::PathFindFileNameA(destTo.c_str()); - string msg = "The hash of plugin package \""; + wstring pluginPackageName = ::PathFindFileName(destTo.c_str()); + wstring msg = L"The hash of plugin package \""; msg += pluginPackageName; - msg += "\" is not correct. Expected:\r"; + msg += L"\" is not correct. Expected:\r"; msg += sha2HashToCheckLowerCase; - msg += "\r<> Found:\r"; - msg += sha2hashStr; - msg += "\rThis plugin won't be installed."; - MessageBoxA(NULL, msg.c_str(), "Plugin package hash mismatched", MB_OK | MB_APPLMODAL); + msg += L"\r<> Found:\r"; + msg += sha2hashStrW; + msg += L"\rThis plugin won't be installed."; + MessageBox(NULL, msg.c_str(), L"Plugin package hash mismatched", MB_OK | MB_APPLMODAL); ok = false; } } @@ -769,7 +778,7 @@ bool downloadBinary(const string& urlFrom, const string& destTo, const string& s return true; } -bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const string& customParam, const string& version) +bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const GupExtraOptions& proxyServer, const wstring& customParam, const wstring& version) { char errorBuffer[CURL_ERROR_SIZE] = { 0 }; @@ -781,7 +790,7 @@ bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const curl = curl_easy_init(); if (curl) { - std::string urlComplete = gupParams.getInfoLocation() + "?version="; + std::wstring urlComplete = gupParams.getInfoLocation() + L"?version="; if (!version.empty()) urlComplete += version; else @@ -789,18 +798,18 @@ bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const if (!customParam.empty()) { - string customParamPost = "¶m="; + wstring customParamPost = L"¶m="; customParamPost += customParam; urlComplete += customParamPost; } else if (!gupParams.getParam().empty()) { - string customParamPost = "¶m="; + wstring customParamPost = L"¶m="; customParamPost += gupParams.getParam(); urlComplete += customParamPost; } - curl_easy_setopt(curl, CURLOPT_URL, urlComplete.c_str()); + curl_easy_setopt(curl, CURLOPT_URL, ws2s(urlComplete).c_str()); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, TRUE); @@ -808,26 +817,26 @@ bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, getUpdateInfoCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &info2get); - string ua = gupParams.getSoftwareName(); + wstring ua = gupParams.getSoftwareName(); winGupUserAgent += VERSION_VALUE; - if (ua != "") + if (ua != L"") { - ua += "/"; + ua += L"/"; ua += version; - ua += " ("; + ua += L" ("; ua += winGupUserAgent; - ua += ")"; + ua += L")"; winGupUserAgent = ua; } - curl_easy_setopt(curl, CURLOPT_USERAGENT, winGupUserAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_USERAGENT, ws2s(winGupUserAgent).c_str()); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer); if (proxyServer.hasProxySettings()) { - curl_easy_setopt(curl, CURLOPT_PROXY, proxyServer.getProxyServer().c_str()); + curl_easy_setopt(curl, CURLOPT_PROXY, ws2s(proxyServer.getProxyServer()).c_str()); curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxyServer.getPort()); } @@ -847,16 +856,16 @@ bool getUpdateInfo(const string& info2get, const GupParameters& gupParams, const return true; } -bool runInstaller(const string& app2runPath, const string& binWindowsClassName, const string& closeMsg, const string& closeMsgTitle) +bool runInstaller(const wstring& app2runPath, const wstring& binWindowsClassName, const wstring& closeMsg, const wstring& closeMsgTitle) { if (!binWindowsClassName.empty()) { - HWND h = ::FindWindowExA(NULL, NULL, binWindowsClassName.c_str(), NULL); + HWND h = ::FindWindowEx(NULL, NULL, binWindowsClassName.c_str(), NULL); if (h) { - int installAnswer = ::MessageBoxA(NULL, closeMsg.c_str(), closeMsgTitle.c_str(), MB_YESNO); + int installAnswer = ::MessageBox(NULL, closeMsg.c_str(), closeMsgTitle.c_str(), MB_YESNO); if (installAnswer == IDNO) { @@ -868,12 +877,12 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, while (h) { ::SendMessage(h, WM_CLOSE, 0, 0); - h = ::FindWindowExA(NULL, NULL, binWindowsClassName.c_str(), NULL); + h = ::FindWindowEx(NULL, NULL, binWindowsClassName.c_str(), NULL); } } // execute the installer - HINSTANCE result = ::ShellExecuteA(NULL, "open", app2runPath.c_str(), "", ".", SW_SHOW); + HINSTANCE result = ::ShellExecute(NULL, L"open", app2runPath.c_str(), L"", L".", SW_SHOW); if (result <= (HINSTANCE)32) // There's a problem (Don't ask me why, ask Microsoft) { @@ -890,12 +899,12 @@ bool runInstaller(const string& app2runPath, const string& binWindowsClassName, #define WRITE_LOG(fn, suffix, log) #endif -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int) { /* { - string destPath = "C:\\tmp\\res\\TagsView"; - string dlDest = "C:\\tmp\\pb\\TagsView_Npp_03beta.zip"; + wstring destPath = L"C:\\tmp\\res\\TagsView"; + wstring dlDest = L"C:\\tmp\\pb\\TagsView_Npp_03beta.zip"; bool isSuccessful = decompress(dlDest, destPath); if (isSuccessful) { @@ -904,13 +913,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) } */ // Debug use - stop here so we can attach this process for debugging - //::MessageBoxA(NULL, "And do something dirty to me ;)", "Attach me!", MB_OK); + //::MessageBox(NULL, L"And do something dirty to me ;)", L"Attach me!", MB_OK); bool isSilentMode = false; FILE *pFile = NULL; - string version; - string customParam; + wstring version; + wstring customParam; ParamVector params; parseCommandLine(lpszCmdLine, params); @@ -926,15 +935,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (isHelp) { - ::MessageBoxA(NULL, MSGID_HELP, "GUP Command Argument Help", MB_OK); + ::MessageBox(NULL, MSGID_HELP, L"GUP Command Argument Help", MB_OK); return 0; } - WRITE_LOG("c:\\tmp\\winup.log", "lpszCmdLine: ", lpszCmdLine); + WRITE_LOG(L"c:\\tmp\\winup.log", L"lpszCmdLine: ", lpszCmdLine); - GupExtraOptions extraOptions("gupOptions.xml"); + GupExtraOptions extraOptions(L"gupOptions.xml"); GupNativeLang nativeLang("nativeLang.xml"); - GupParameters gupParams("gup.xml"); + GupParameters gupParams(L"gup.xml"); // // Plugins Updater @@ -948,24 +957,24 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { if (nbParam < 3) { - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (isCleanUp && !isUnzip) // remove only: ", "nbParam < 3"); + WRITE_LOG(L"c:\\tmp\\winup.log", L"-1 in plugin updater's part - if (isCleanUp && !isUnzip) // remove only: ", L"nbParam < 3"); return -1; } - string prog2Launch = params[0]; - char prog2LaunchDir[MAX_PATH]; - strcpy(prog2LaunchDir, prog2Launch.c_str()); - ::PathRemoveFileSpecA(prog2LaunchDir); - string destPathRoot = params[1]; + wstring prog2Launch = params[0]; + wchar_t prog2LaunchDir[MAX_PATH]; + lstrcpy(prog2LaunchDir, prog2Launch.c_str()); + ::PathRemoveFileSpec(prog2LaunchDir); + wstring destPathRoot = params[1]; // clean for (size_t i = 2; i < nbParam; ++i) { - string destPath = destPathRoot; + wstring destPath = destPathRoot; ::PathAppend(destPath, params[i]); deleteFileOrFolder(destPath); } - ::ShellExecuteA(NULL, "open", "explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); + ::ShellExecute(NULL, L"open", L"explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); return 0; } @@ -981,32 +990,32 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) { if (nbParam < 3) { - WRITE_LOG("c:\\tmp\\winup.log", "-1 in plugin updater's part - if (isCleanUp && isUnzip) // update: ", "nbParam < 3"); + WRITE_LOG(L"c:\\tmp\\winup.log", L"-1 in plugin updater's part - if (isCleanUp && isUnzip) // update: ", L"nbParam < 3"); return -1; } - string prog2Launch = params[0]; - char prog2LaunchDir[MAX_PATH]; - strcpy(prog2LaunchDir, prog2Launch.c_str()); - ::PathRemoveFileSpecA(prog2LaunchDir); - string destPathRoot = params[1]; + wstring prog2Launch = params[0]; + wchar_t prog2LaunchDir[MAX_PATH]; + lstrcpy(prog2LaunchDir, prog2Launch.c_str()); + ::PathRemoveFileSpec(prog2LaunchDir); + wstring destPathRoot = params[1]; for (size_t i = 2; i < nbParam; ++i) { - string destPath = destPathRoot; + wstring destPath = destPathRoot; // break down param in dest folder name and download url - auto pos = params[i].find_last_of(" "); - if (pos != string::npos && pos > 0) + auto pos = params[i].find_last_of(L" "); + if (pos != wstring::npos && pos > 0) { - string folder; - string dlUrl; + wstring folder; + wstring dlUrl; - string tempStr = params[i].substr(0, pos); - string sha256ToCheck = params[i].substr(pos + 1, params[i].length() - 1); + wstring tempStr = params[i].substr(0, pos); + wstring sha256ToCheck = params[i].substr(pos + 1, params[i].length() - 1); if (sha256ToCheck.length() != 64) continue; - auto pos2 = tempStr.find_last_of(" "); + auto pos2 = tempStr.find_last_of(L" "); if (pos2 != string::npos && pos2 > 0) { // 3 parts - OK @@ -1022,46 +1031,46 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) ::PathAppend(destPath, folder); // Make a backup path - string backup4RestoreInCaseOfFailedPath; + wstring backup4RestoreInCaseOfFailedPath; if (isCleanUp) // Update { //deleteFileOrFolder(destPath); // check if renamed folder exist, if it does, delete it - backup4RestoreInCaseOfFailedPath = destPath + ".backup4RestoreInCaseOfFailed"; - if (::PathFileExistsA(backup4RestoreInCaseOfFailedPath.c_str())) + backup4RestoreInCaseOfFailedPath = destPath + L".backup4RestoreInCaseOfFailed"; + if (::PathFileExists(backup4RestoreInCaseOfFailedPath.c_str())) deleteFileOrFolder(backup4RestoreInCaseOfFailedPath); // rename the folder with suffix ".backup4RestoreInCaseOfFailed" - ::MoveFileA(destPath.c_str(), backup4RestoreInCaseOfFailedPath.c_str()); + ::MoveFile(destPath.c_str(), backup4RestoreInCaseOfFailedPath.c_str()); } // install - std::string dlDest = std::getenv("TEMP"); - dlDest += "\\"; - dlDest += ::PathFindFileNameA(dlUrl.c_str()); + std::wstring dlDest = _wgetenv(L"TEMP"); + dlDest += L"\\"; + dlDest += ::PathFindFileName(dlUrl.c_str()); - char *ext = ::PathFindExtensionA(dlDest.c_str()); - if (strcmp(ext, ".zip") != 0) - dlDest += ".zip"; + wchar_t *ext = ::PathFindExtension(dlDest.c_str()); + if (lstrcmp(ext, L".zip") != 0) + dlDest += L".zip"; - dlFileName = ::PathFindFileNameA(dlUrl.c_str()); + dlFileName = ::PathFindFileName(dlUrl.c_str()); - string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); - if (dlStopped == "") + wstring dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == L"") dlStopped = MSGID_DOWNLOADSTOPPED; - bool isSuccessful = downloadBinary(dlUrl, dlDest, sha256ToCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); + bool isSuccessful = downloadBinary(dlUrl, dlDest, sha256ToCheck, pair(extraOptions.getProxyServer(), extraOptions.getPort()), true, pair(dlStopped, gupParams.getMessageBoxTitle())); if (isSuccessful) { isSuccessful = decompress(dlDest, destPath); if (!isSuccessful) { - string unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); - if (unzipFailed == "") + wstring unzipFailed = nativeLang.getMessageString("MSGID_UNZIPFAILED"); + if (unzipFailed == L"") unzipFailed = MSGID_UNZIPFAILED; - ::MessageBoxA(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); + ::MessageBox(NULL, unzipFailed.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_OK); // Delete incomplete unzipped folder deleteFileOrFolder(destPath); @@ -1069,7 +1078,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (!backup4RestoreInCaseOfFailedPath.empty()) { // rename back the folder - ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); + ::MoveFile(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); } } else @@ -1082,20 +1091,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) } // Remove downloaded zip from TEMP folder - ::DeleteFileA(dlDest.c_str()); + ::DeleteFile(dlDest.c_str()); } else { if (!backup4RestoreInCaseOfFailedPath.empty()) { // delete the folder with suffix ".backup4RestoreInCaseOfFailed" - ::MoveFileA(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); + ::MoveFile(backup4RestoreInCaseOfFailedPath.c_str(), destPath.c_str()); } } } } - ::ShellExecuteA(NULL, "open", "explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); + ::ShellExecute(NULL, L"open", L"explorer.exe", prog2Launch.c_str(), prog2LaunchDir, SW_SHOWNORMAL); return 0; } @@ -1112,7 +1121,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) proxyPort = extraOptions.getPort(); } if (::DialogBox(hInst, MAKEINTRESOURCE(IDD_PROXY_DLG), NULL, reinterpret_cast(proxyDlgProc))) - extraOptions.writeProxyInfo("gupOptions.xml", proxySrv.c_str(), proxyPort); + extraOptions.writeProxyInfo(L"gupOptions.xml", proxySrv.c_str(), proxyPort); return 0; } @@ -1141,11 +1150,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (!getUpdateInfoSuccessful) { - WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part: ", "getUpdateInfo func failed."); + WRITE_LOG(L"c:\\tmp\\winup.log", L"return -1 in Npp Updater part: ", L"getUpdateInfo func failed."); return -1; } - HWND hApp = ::FindWindowExA(NULL, NULL, gupParams.getClassName().c_str(), NULL); + HWND hApp = ::FindWindowEx(NULL, NULL, gupParams.getClassName().c_str(), NULL); bool isModal = gupParams.isMessageBoxModal(); GupDownloadInfo gupDlInfo(updateInfo.c_str()); @@ -1166,8 +1175,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // // Ask user if he/she want to do update - string updateAvailable = nativeLang.getMessageString("MSGID_UPDATEAVAILABLE"); - if (updateAvailable == "") + wstring updateAvailable = nativeLang.getMessageString("MSGID_UPDATEAVAILABLE"); + if (updateAvailable == L"") updateAvailable = MSGID_UPDATEAVAILABLE; int thirdButtonCmd = gupParams.get3rdButtonCmd(); @@ -1176,7 +1185,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) int dlAnswer = 0; if (!thirdButtonCmd) - dlAnswer = ::MessageBoxA(isModal ? hApp : NULL, updateAvailable.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_YESNO); + dlAnswer = ::MessageBox(isModal ? hApp : NULL, updateAvailable.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_YESNO); else dlAnswer = static_cast(::DialogBox(hInst, MAKEINTRESOURCE(IDD_YESNONEVERDLG), isModal ? hApp : NULL, reinterpret_cast(yesNoNeverDlgProc))); @@ -1187,7 +1196,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (dlAnswer == IDCANCEL) { - if (gupParams.getClassName() != "") + if (gupParams.getClassName() != L"") { if (hApp) { @@ -1201,35 +1210,35 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) // Download executable bin // - std::string dlDest = std::getenv("TEMP"); - dlDest += "\\"; - dlDest += ::PathFindFileNameA(gupDlInfo.getDownloadLocation().c_str()); + std::wstring dlDest = _wgetenv(L"TEMP"); + dlDest += L"\\"; + dlDest += ::PathFindFileName(gupDlInfo.getDownloadLocation().c_str()); - char *ext = ::PathFindExtensionA(gupDlInfo.getDownloadLocation().c_str()); - if (strcmp(ext, ".exe") != 0) - dlDest += ".exe"; + wchar_t *ext = ::PathFindExtension(gupDlInfo.getDownloadLocation().c_str()); + if (lstrcmpW(ext, L".exe") != 0) + dlDest += L".exe"; - dlFileName = ::PathFindFileNameA(gupDlInfo.getDownloadLocation().c_str()); + dlFileName = ::PathFindFileName(gupDlInfo.getDownloadLocation().c_str()); - string dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); - if (dlStopped == "") + wstring dlStopped = nativeLang.getMessageString("MSGID_DOWNLOADSTOPPED"); + if (dlStopped == L"") dlStopped = MSGID_DOWNLOADSTOPPED; - bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, "", pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); + bool dlSuccessful = downloadBinary(gupDlInfo.getDownloadLocation(), dlDest, L"", pair(extraOptions.getProxyServer(), extraOptions.getPort()), isSilentMode, pair(dlStopped, gupParams.getMessageBoxTitle())); if (!dlSuccessful) { - WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part: ", "downloadBinary func failed."); + WRITE_LOG(L"c:\\tmp\\winup.log", L"return -1 in Npp Updater part: ", L"downloadBinary func failed."); return -1; } // // Run executable bin // - string msg = gupParams.getClassName(); - string closeApp = nativeLang.getMessageString("MSGID_CLOSEAPP"); - if (closeApp == "") + wstring msg = gupParams.getClassName(); + wstring closeApp = nativeLang.getMessageString("MSGID_CLOSEAPP"); + if (closeApp == L"") closeApp = MSGID_CLOSEAPP; msg += closeApp; @@ -1244,7 +1253,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (pFile != NULL) fclose(pFile); - WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part, exception: ", ex.what()); + WRITE_LOG(L"c:\\tmp\\winup.log", L"return -1 in Npp Updater part, exception: ", s2ws(ex.what()).c_str()); return -1; } catch (...) @@ -1255,7 +1264,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int) if (pFile != NULL) fclose(pFile); - WRITE_LOG("c:\\tmp\\winup.log", "return -1 in Npp Updater part, exception: ", "Unknown Exception"); + WRITE_LOG(L"c:\\tmp\\winup.log", L"return -1 in Npp Updater part, exception: ", L"Unknown Exception"); return -1; } } diff --git a/src/xmlTools.cpp b/src/xmlTools.cpp index 16a2331f..0e1d7eca 100644 --- a/src/xmlTools.cpp +++ b/src/xmlTools.cpp @@ -18,12 +18,31 @@ */ #include "xmlTools.h" +#include +#include using namespace std; -GupParameters::GupParameters(const char * xmlFileName) + +wstring s2ws(const string& str) { - _xmlDoc.LoadFile(xmlFileName); + using convert_typeX = codecvt_utf8; + wstring_convert converterX; + + return converterX.from_bytes(str); +} + +string ws2s(const wstring& wstr) +{ + using convert_typeX = codecvt_utf8; + wstring_convert converterX; + + return converterX.to_bytes(wstr); +} + +GupParameters::GupParameters(const wchar_t * xmlFileName) +{ + _xmlDoc.LoadFile(ws2s(xmlFileName).c_str()); TiXmlNode *root = _xmlDoc.FirstChild("GUPInput"); if (!root) @@ -38,7 +57,7 @@ GupParameters::GupParameters(const char * xmlFileName) const char *val = n->Value(); if (val) { - _currentVersion = val; + _currentVersion = s2ws(val); } } } @@ -52,7 +71,7 @@ GupParameters::GupParameters(const char * xmlFileName) const char *val = n->Value(); if (val) { - _param = val; + _param = s2ws(val); } } } @@ -69,7 +88,7 @@ GupParameters::GupParameters(const char * xmlFileName) if (!iuVal || !(*iuVal)) throw exception("InfoUrl is missed."); - _infoUrl = iuVal; + _infoUrl = s2ws(iuVal); TiXmlNode *classeNameNode = root->FirstChildElement("ClassName2Close"); if (classeNameNode) @@ -80,7 +99,7 @@ GupParameters::GupParameters(const char * xmlFileName) const char *val = n->Value(); if (val) { - _className2Close = val; + _className2Close = s2ws(val); } } } @@ -96,7 +115,7 @@ GupParameters::GupParameters(const char * xmlFileName) valStr = n->Value(); if (valStr) { - _messageBoxTitle = valStr; + _messageBoxTitle = s2ws(valStr); } } @@ -133,7 +152,7 @@ GupParameters::GupParameters(const char * xmlFileName) const char * extraCmdLabel = (progNameNode->ToElement())->Attribute("extraCmdButtonLabel"); if (extraCmdLabel != NULL) { - _3rdButton_label = extraCmdLabel; + _3rdButton_label = s2ws(extraCmdLabel); } } @@ -168,12 +187,12 @@ GupParameters::GupParameters(const char * xmlFileName) { const char *uaVal = un->Value(); if (uaVal) - _softwareName = uaVal; + _softwareName = s2ws(uaVal); } } } -GupDownloadInfo::GupDownloadInfo(const char * xmlString) : _updateVersion(""), _updateLocation("") +GupDownloadInfo::GupDownloadInfo(const char* xmlString) { _xmlDoc.Parse(xmlString); @@ -214,7 +233,7 @@ GupDownloadInfo::GupDownloadInfo(const char * xmlString) : _updateVersion(""), _ const char *val = n->Value(); if (val) { - _updateVersion = val; + _updateVersion = s2ws(val); } } } @@ -231,13 +250,13 @@ GupDownloadInfo::GupDownloadInfo(const char * xmlString) : _updateVersion(""), _ if (!locVal || !(*locVal)) throw exception("Location is missed."); - _updateLocation = locVal; + _updateLocation = s2ws(locVal); } } -GupExtraOptions::GupExtraOptions(const char * xmlFileName) : _proxyServer(""), _port(-1)//, _hasProxySettings(false) +GupExtraOptions::GupExtraOptions(const wchar_t * xmlFileName) { - _xmlDoc.LoadFile(xmlFileName); + _xmlDoc.LoadFile(ws2s(xmlFileName).c_str()); TiXmlNode *root = _xmlDoc.FirstChild("GUPOptions"); if (!root) @@ -254,7 +273,7 @@ GupExtraOptions::GupExtraOptions(const char * xmlFileName) : _proxyServer(""), _ { const char *val = server->Value(); if (val) - _proxyServer = val; + _proxyServer = s2ws(val); } } @@ -272,13 +291,13 @@ GupExtraOptions::GupExtraOptions(const char * xmlFileName) : _proxyServer(""), _ } } -void GupExtraOptions::writeProxyInfo(const char *fn, const char *proxySrv, long port) +void GupExtraOptions::writeProxyInfo(const wchar_t* fn, const wchar_t* proxySrv, long port) { - TiXmlDocument newProxySettings(fn); + TiXmlDocument newProxySettings(ws2s(fn).c_str()); TiXmlNode *root = newProxySettings.InsertEndChild(TiXmlElement("GUPOptions")); TiXmlNode *proxy = root->InsertEndChild(TiXmlElement("Proxy")); TiXmlNode *server = proxy->InsertEndChild(TiXmlElement("server")); - server->InsertEndChild(TiXmlText(proxySrv)); + server->InsertEndChild(TiXmlText(ws2s(proxySrv).c_str())); TiXmlNode *portNode = proxy->InsertEndChild(TiXmlElement("port")); char portStr[10]; sprintf(portStr, "%d", port); @@ -287,26 +306,24 @@ void GupExtraOptions::writeProxyInfo(const char *fn, const char *proxySrv, long newProxySettings.SaveFile(); } -std::string GupNativeLang::getMessageString(std::string msgID) +std::wstring GupNativeLang::getMessageString(std::string msgID) { if (!_nativeLangRoot) - return ""; + return L""; TiXmlNode *popupMessagesNode = _nativeLangRoot->FirstChildElement("PopupMessages"); if (!popupMessagesNode) - return ""; + return L""; TiXmlNode *node = popupMessagesNode->FirstChildElement(msgID.c_str()); if (!node) - return ""; + return L""; - TiXmlNode *sn = node->FirstChild(); - if (!sn) - return ""; - - const char *val = sn->Value(); - if (!val || !(*val)) - return ""; - - return val; + TiXmlElement* element = node->ToElement(); + + const char *content = element->Attribute("content"); + if (content) + return s2ws(content); + + return L""; } diff --git a/src/xmlTools.h b/src/xmlTools.h index dbbc2c61..da3427bc 100644 --- a/src/xmlTools.h +++ b/src/xmlTools.h @@ -20,6 +20,8 @@ #include "tinyxml.h" #include +std::wstring s2ws(const std::string& str); +std::string ws2s(const std::wstring& wstr); class XMLTool { @@ -30,20 +32,20 @@ class XMLTool { class GupParameters : public XMLTool { public: GupParameters() {}; - GupParameters(const char * xmlFileName); + GupParameters(const wchar_t * xmlFileName); - const std::string & getCurrentVersion() const { return _currentVersion;}; - const std::string & getParam() const { return _param; }; - const std::string & getInfoLocation() const {return _infoUrl;}; - const std::string & getClassName() const {return _className2Close;}; - const std::string & getMessageBoxTitle() const {return _messageBoxTitle;}; - const std::string & getSoftwareName() const {return _softwareName;}; + const std::wstring & getCurrentVersion() const { return _currentVersion;}; + const std::wstring & getParam() const { return _param; }; + const std::wstring & getInfoLocation() const {return _infoUrl;}; + const std::wstring & getClassName() const {return _className2Close;}; + const std::wstring & getMessageBoxTitle() const {return _messageBoxTitle;}; + const std::wstring & getSoftwareName() const {return _softwareName;}; int get3rdButtonCmd() const {return _3rdButton_wm_cmd;}; int get3rdButtonWparam() const {return _3rdButton_wParam;}; int get3rdButtonLparam() const {return _3rdButton_lParam;}; - const std::string & get3rdButtonLabel() const { return _3rdButton_label; }; + const std::wstring & get3rdButtonLabel() const { return _3rdButton_label; }; - void setCurrentVersion(const char *currentVersion) {_currentVersion = currentVersion;}; + void setCurrentVersion(const wchar_t *currentVersion) {_currentVersion = currentVersion;}; bool setSilentMode(bool mode) { bool oldMode = _isSilentMode; _isSilentMode = mode; @@ -53,47 +55,46 @@ class GupParameters : public XMLTool { bool isMessageBoxModal() const { return _isMessageBoxModal; }; private: - std::string _currentVersion; - std::string _param; - std::string _infoUrl; - std::string _className2Close; - std::string _messageBoxTitle; - std::string _softwareName; + std::wstring _currentVersion; + std::wstring _param; + std::wstring _infoUrl; + std::wstring _className2Close; + std::wstring _messageBoxTitle; + std::wstring _softwareName; bool _isMessageBoxModal = false; int _3rdButton_wm_cmd = 0; int _3rdButton_wParam = 0; int _3rdButton_lParam = 0; - std::string _3rdButton_label; + std::wstring _3rdButton_label; bool _isSilentMode = true; }; class GupExtraOptions : public XMLTool { public: - GupExtraOptions(const char * xmlFileName); - const std::string & getProxyServer() const { return _proxyServer;}; + GupExtraOptions(const wchar_t * xmlFileName); + const std::wstring & getProxyServer() const { return _proxyServer;}; long getPort() const { return _port;}; bool hasProxySettings() const {return ((!_proxyServer.empty()) && (_port != -1));}; - void writeProxyInfo(const char *fn, const char *proxySrv, long port); + void writeProxyInfo(const wchar_t *fn, const wchar_t *proxySrv, long port); private: - std::string _proxyServer; - long _port; - //bool _hasProxySettings; + std::wstring _proxyServer; + long _port = -1; }; class GupDownloadInfo : public XMLTool { public: - GupDownloadInfo() : _updateVersion(""), _updateLocation("") {}; - GupDownloadInfo(const char * xmlString); + GupDownloadInfo() {}; + GupDownloadInfo(const char* xmlString); - const std::string & getVersion() const { return _updateVersion;}; - const std::string & getDownloadLocation() const {return _updateLocation;}; + const std::wstring & getVersion() const { return _updateVersion;}; + const std::wstring & getDownloadLocation() const {return _updateLocation;}; bool doesNeed2BeUpdated() const {return _need2BeUpdated;}; private: bool _need2BeUpdated; - std::string _updateVersion; - std::string _updateLocation; + std::wstring _updateVersion; + std::wstring _updateLocation; }; class GupNativeLang : public XMLTool { @@ -102,7 +103,7 @@ class GupNativeLang : public XMLTool { _xmlDoc.LoadFile(xmlFileName); _nativeLangRoot = _xmlDoc.FirstChild("GUP_NativeLangue"); }; - std::string getMessageString(std::string msgID); + std::wstring getMessageString(std::string msgID); protected: TiXmlNode *_nativeLangRoot; diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 87a940c0..2025b123 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -87,7 +87,7 @@ Disabled ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;TIXML_USE_STL;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -113,7 +113,7 @@ Disabled ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;TIXML_USE_STL;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -140,7 +140,7 @@ ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;TIXML_USE_STL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreaded Level4 @@ -180,7 +180,7 @@ del ..\bin\GUP.ipdb ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + WIN32;TIXML_USE_STL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreaded From 9b193fa212b6c6fe058e9739a845aa9f1905f11f Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 5 Feb 2021 03:17:35 +0100 Subject: [PATCH 038/110] Make all localization XML files in Unicode --- src/translations/catalan.xml | 14 +++++++------- src/translations/french.xml | 2 +- src/translations/german.xml | 4 ++-- src/translations/russian.xml | 4 ++-- src/translations/spanish.xml | 10 +++++----- src/translations/vietnamese.xml | 10 +++++----- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/translations/catalan.xml b/src/translations/catalan.xml index 29836b9f..2369134d 100644 --- a/src/translations/catalan.xml +++ b/src/translations/catalan.xml @@ -1,4 +1,4 @@ - + - + - - - - - + + + + + diff --git a/src/translations/french.xml b/src/translations/french.xml index 9f478b98..afb0a429 100644 --- a/src/translations/french.xml +++ b/src/translations/french.xml @@ -26,7 +26,7 @@ - + diff --git a/src/translations/german.xml b/src/translations/german.xml index c078afde..bfd13a21 100644 --- a/src/translations/german.xml +++ b/src/translations/german.xml @@ -31,8 +31,8 @@ - - + + diff --git a/src/translations/russian.xml b/src/translations/russian.xml index e13788d7..086ad7fc 100644 --- a/src/translations/russian.xml +++ b/src/translations/russian.xml @@ -28,8 +28,8 @@ - - + + diff --git a/src/translations/spanish.xml b/src/translations/spanish.xml index 0700820c..b9c6903b 100644 --- a/src/translations/spanish.xml +++ b/src/translations/spanish.xml @@ -22,10 +22,10 @@ Use this file to set your proxy settings if need. --> - - - - - + + + + + diff --git a/src/translations/vietnamese.xml b/src/translations/vietnamese.xml index 58d3d128..ac903ee8 100644 --- a/src/translations/vietnamese.xml +++ b/src/translations/vietnamese.xml @@ -19,10 +19,10 @@ - Hiện tại không có bản cập nhật nào. - Một gói cập nhật hiện sẵn có, bạn có muốn tải về không? - Quá trình tải đã dừng lại bởi người dùng. Cập nhật bị hủy bỏ. - đã được mở.\rTrình cập nhật sẽ đóng nó để xử lý việc cài đặt.\rTiếp tục? - Bạn có muốn hủy bỏ việc tải về cập nhật? + + + + + From cfa5bfbb08c343d8baada179f6f8c334f30f13b1 Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 5 Feb 2021 03:54:10 +0100 Subject: [PATCH 039/110] Clicking link on "No Update" dialog closes the dialog For unknown reason, after clicking "Go to download page" link, the dialog sinks on the bottom of Z-buffer of all application - user has to minimize or close all other programs (with GUI) to get back this dialog. This commit provides the (workaround) solution to close the dialog after clicking the link. --- src/winmain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/winmain.cpp b/src/winmain.cpp index 523459ca..12d4315e 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -655,6 +655,7 @@ LRESULT CALLBACK updateCheckDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, L if (lstrcmpW(item.szID, L"id_download") == 0) { ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/downloads/"), NULL, NULL, SW_SHOWNORMAL); + EndDialog(hWndDlg, wParam); } break; } From 984ac2049ae6ba4c650653e449543d956c28968d Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 5 Feb 2021 23:37:27 +0100 Subject: [PATCH 040/110] Fix x64 build error --- src/TinyXml/tinyxmlparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TinyXml/tinyxmlparser.cpp b/src/TinyXml/tinyxmlparser.cpp index edff9e2f..f0f613e3 100644 --- a/src/TinyXml/tinyxmlparser.cpp +++ b/src/TinyXml/tinyxmlparser.cpp @@ -396,7 +396,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag ) while ( in->good() ) { - int tagIndex = tag->length(); + size_t tagIndex = tag->length(); while ( in->good() && in->peek() != '>' ) { int c = in->get(); @@ -637,7 +637,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag) // We should be at a "<", regardless. if ( !in->good() ) return; assert( in->peek() == '<' ); - int tagIndex = tag->length(); + size_t tagIndex = tag->length(); bool closingTag = false; bool firstCharFound = false; From 4351dab93cdf0dc0083c84537ded19ce10f3d46a Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 5 Feb 2021 23:40:34 +0100 Subject: [PATCH 041/110] WinGUp (for Notepad++) v5.1.2 release --- src/change.log | 5 +++-- src/resource.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/change.log b/src/change.log index cd68cf52..81072ef1 100644 --- a/src/change.log +++ b/src/change.log @@ -1,3 +1,4 @@ -WinGup (for Notepad++) v5.1.1 enhancements: +WinGup (for Notepad++) v5.1.2 enhancements: -1. UI improvement: Plugins downloading with the progress bar \ No newline at end of file +1. Improve info while no update available and provide download page link on the dialog. +2. Change from non-Unicode application to Unicode application. diff --git a/src/resource.h b/src/resource.h index 16dbe0b4..33880e00 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE L"5.11\0" -#define VERSION_DIGITALVALUE 5, 1, 1, 0 +#define VERSION_VALUE L"5.12\0" +#define VERSION_DIGITALVALUE 5, 1, 2, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 8016e45eb48aabe03127fde56ecb1d440ac9e3be Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 27 Feb 2021 02:56:57 +0100 Subject: [PATCH 042/110] Improve "No Notepad++ update" dialog message https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9573 --- src/gup.rc | 9 +++--- src/resource.h | 1 - src/translations/english.xml | 10 ++++-- src/translations/french.xml | 10 ++++-- src/translations/taiwaneseMandarin.xml | 10 ++++-- src/winmain.cpp | 44 ++++++++++++++++++++------ 6 files changed, 59 insertions(+), 25 deletions(-) diff --git a/src/gup.rc b/src/gup.rc index 54a52685..dbe03b6a 100644 --- a/src/gup.rc +++ b/src/gup.rc @@ -83,14 +83,13 @@ BEGIN PUSHBUTTON "Never",IDCANCEL,170,60,50,14 END -IDD_UPDATE_DLG DIALOGEX 0, 0, 187, 94 +IDD_UPDATE_DLG DIALOGEX 0, 0, 200, 110 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE CAPTION "No update" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - CONTROL "No update is available.\r\rThe auto-update may not have been activated yet.",IDC_UPDATE_STATIC1,"Static",WS_GROUP|SS_CENTER,10,12,167,30 - CONTROL "Go to the download page",IDC_DOWNLOAD_LINK,"SysLink",WS_TABSTOP,51,48,110,12 - DEFPUSHBUTTON "OK",IDOK,68,72,50,14 + CONTROL "No update is available\ror the newest version is not triggered yet for updating (more info).\r\rGo to the download page to update Notepad++ manually.",IDC_DOWNLOAD_LINK,"SysLink",WS_TABSTOP,10,10,150,70 + DEFPUSHBUTTON "Close",IDOK,68,90,50,14 END diff --git a/src/resource.h b/src/resource.h index 33880e00..b9f13d68 100644 --- a/src/resource.h +++ b/src/resource.h @@ -32,7 +32,6 @@ #define IDD_YESNONEVERDLG 1007 #define IDC_YESNONEVERMSG 1008 #define IDD_UPDATE_DLG 1009 -#define IDC_UPDATE_STATIC1 1010 #define IDC_DOWNLOAD_LINK 1011 #endif // RESOURCE_H diff --git a/src/translations/english.xml b/src/translations/english.xml index b5c8ab7a..9c15fa4e 100644 --- a/src/translations/english.xml +++ b/src/translations/english.xml @@ -20,11 +20,15 @@ - + - - + + + + + + diff --git a/src/translations/french.xml b/src/translations/french.xml index afb0a429..2a728797 100644 --- a/src/translations/french.xml +++ b/src/translations/french.xml @@ -20,11 +20,15 @@ - + - - + + + + + + diff --git a/src/translations/taiwaneseMandarin.xml b/src/translations/taiwaneseMandarin.xml index ee6c0431..46bff7a4 100644 --- a/src/translations/taiwaneseMandarin.xml +++ b/src/translations/taiwaneseMandarin.xml @@ -20,11 +20,15 @@ - + - - + + + + + + diff --git a/src/winmain.cpp b/src/winmain.cpp index 12d4315e..bf119580 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -293,6 +293,17 @@ std::string getFileContentA(const char* file2read) return wholeFileContent; }; +wstring stringReplace(wstring subject, const wstring& search, const wstring& replace) +{ + size_t pos = 0; + while ((pos = subject.find(search, pos)) != std::string::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } + return subject; +} + // unzipDestTo should be plugin home root + plugin folder name // ex: %APPDATA%\..\local\Notepad++\plugins\myAwesomePlugin bool decompress(const wstring& zipFullFilePath, const wstring& unzipDestTo) @@ -612,17 +623,25 @@ LRESULT CALLBACK updateCheckDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, L if (!title.empty()) ::SetWindowText(hWndDlg, title.c_str()); - wstring textMsg = params->_nativeLang.getMessageString("MSGID_NOUPDATE"); - if (!textMsg.empty()) - ::SetDlgItemText(hWndDlg, IDC_UPDATE_STATIC1, textMsg.c_str()); - - wstring goToDlStr = params->_nativeLang.getMessageString("MSGID_DOWNLOADTEXT"); - if (!goToDlStr.empty()) + wstring dlStr = params->_nativeLang.getMessageString("MSGID_DOWNLOADPAGE"); + wstring moreInfoStr = params->_nativeLang.getMessageString("MSGID_MOREINFO"); + if (!dlStr.empty() && !moreInfoStr.empty()) { - wstring textLink = L""; - textLink += goToDlStr; - textLink += L""; - ::SetDlgItemText(hWndDlg, IDC_DOWNLOAD_LINK, textLink.c_str()); + wstring goToDlStr = params->_nativeLang.getMessageString("MSGID_GOTODOWNLOADPAGETEXT"); + if (!goToDlStr.empty()) + { + wstring moreInfoLink = L""; + moreInfoLink += moreInfoStr; + moreInfoLink += L""; + wstring textWithLink = stringReplace(goToDlStr, L"$MSGID_MOREINFO$", moreInfoLink); + + wstring dlLink = L""; + dlLink += dlStr; + dlLink += L""; + textWithLink = stringReplace(textWithLink, L"$MSGID_DOWNLOADPAGE$", dlLink); + + ::SetDlgItemText(hWndDlg, IDC_DOWNLOAD_LINK, textWithLink.c_str()); + } } } goToScreenCenter(hWndDlg); @@ -657,6 +676,11 @@ LRESULT CALLBACK updateCheckDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, L ::ShellExecute(NULL, TEXT("open"), TEXT("https://notepad-plus-plus.org/downloads/"), NULL, NULL, SW_SHOWNORMAL); EndDialog(hWndDlg, wParam); } + else if (lstrcmpW(item.szID, L"id_moreinfo") == 0) + { + ::ShellExecute(NULL, TEXT("open"), TEXT("https://npp-user-manual.org/docs/upgrading/#new-version-available-but-auto-updater-find-nothing"), NULL, NULL, SW_SHOWNORMAL); + EndDialog(hWndDlg, wParam); + } break; } } From 1e10716d0269f0ccfdf09425b51b02e6adcd7a31 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 8 Mar 2021 21:07:08 +0100 Subject: [PATCH 043/110] WinGUp (for Notepad++) v5.1.3 release --- src/change.log | 5 ++--- src/resource.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/change.log b/src/change.log index 81072ef1..97f3a1ea 100644 --- a/src/change.log +++ b/src/change.log @@ -1,4 +1,3 @@ -WinGup (for Notepad++) v5.1.2 enhancements: +WinGup (for Notepad++) v5.1.3 enhancements: -1. Improve info while no update available and provide download page link on the dialog. -2. Change from non-Unicode application to Unicode application. +1. Improve "No Notepad++ update" dialog message. diff --git a/src/resource.h b/src/resource.h index b9f13d68..900a48b5 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE L"5.12\0" -#define VERSION_DIGITALVALUE 5, 1, 2, 0 +#define VERSION_VALUE L"5.13\0" +#define VERSION_DIGITALVALUE 5, 1, 3, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From e367d874966d064f03e176b23968b10e80bf241b Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 20 Apr 2021 01:44:14 +0200 Subject: [PATCH 044/110] Fix an incompatible cast error --- src/winmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index bf119580..e62a2131 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -774,7 +774,7 @@ bool downloadBinary(const wstring& urlFrom, const wstring& destTo, const wstring } wstring sha2HashToCheckLowerCase = sha2HashToCheck; std::transform(sha2HashToCheckLowerCase.begin(), sha2HashToCheckLowerCase.end(), sha2HashToCheckLowerCase.begin(), - [](char c) { return static_cast(::tolower(c)); }); + [](wchar_t c) { return static_cast(::tolower(c)); }); wstring sha2hashStrW = s2ws(sha2hashStr); if (sha2HashToCheckLowerCase != sha2hashStrW) From dc176c567fa9ca004827efb4197c45ab2989a3b0 Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 20 Apr 2021 20:20:10 +0200 Subject: [PATCH 045/110] Add ARM64 build --- .gitignore | 1 + README.md | 29 ++-- src/ZipLib/ZipLib.vcxproj | 81 +++++++++- src/ZipLib/extlibs/bzip2/bzip2.vcxproj | 78 ++++++++- src/ZipLib/extlibs/lzma/lzma.vcxproj | 81 +++++++++- src/ZipLib/extlibs/zlib/zlib.vcxproj | 81 +++++++++- vcproj/GUP.sln | 29 +++- vcproj/GUP.vcxproj | 209 ++++++++++++++++++++++++- 8 files changed, 550 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index bd514d9f..d301ccac 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ UpgradeLog*.htm *.bak bin/ bin64/ +binarm64/ curl/build curl/builds diff --git a/README.md b/README.md index 1e344171..e566de56 100644 --- a/README.md +++ b/README.md @@ -62,21 +62,22 @@ to make sure it responds to your WinGup with the correct xml data. How to build it? ---------------- - 0. You have to build cURL before building WinGup: - ``` - a. Open VS2015 Native Tool Command for 32/64 bits - b. go to curl winbuild directory: - cd \curl\winbuild - c. compile cURL by using one of the following commands, according the mode and archetecture of wingup you want to build. - x64 release: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static MACHINE=x64 - x64 debug: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static DEBUG=yes MACHINE=x64 - x86 release: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static MACHINE=x86 - x86 debug: nmake /f Makefile.vc mode=dll vc=14 RTLIBCFG=static DEBUG=yes MACHINE=x86 -``` - 1. Open [`vcproj\GUP.sln`](https://github.com/gup4win/wingup/blob/master/vcproj/GUP.sln) + * Step 1: You have to build cURL before building WinGup: + + 1. Open VS2017 Native Tool Command for 32/64 bits. If you want to build for ARM, oprn a cmd, and run the following command:
+ `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat` + 2. go to curl winbuild directory:
+ `cd \curl\winbuild` + 3. compile cURL by using one of the following commands, according the mode and archetecture of wingup you want to build. + - x64 release: `nmake /f Makefile.vc mode=dll vc=15 RTLIBCFG=static MACHINE=x64` + - x64 debug: `nmake /f Makefile.vc mode=dll vc=15 RTLIBCFG=static DEBUG=yes MACHINE=x64` + - x86 release: `nmake /f Makefile.vc mode=dll vc=15 RTLIBCFG=static MACHINE=x86` + - x86 debug: `nmake /f Makefile.vc mode=dll vc=15 RTLIBCFG=static DEBUG=yes MACHINE=x86` + - ARM64 release: `nmake /f Makefile.vc mode=dll vc=15 RTLIBCFG=static MACHINE=ARM64` + + * Step 2: Open [`vcproj\GUP.sln`](https://github.com/gup4win/wingup/blob/master/vcproj/GUP.sln) with VS2017. - 2. Build WinGup [like a normal Visual Studio project](https://msdn.microsoft.com/en-us/library/7s88b19e.aspx) with VS2015 - + * Step 3: Build WinGup like a normal Visual Studio project. To whom should you say "thank you"? diff --git a/src/ZipLib/ZipLib.vcxproj b/src/ZipLib/ZipLib.vcxproj index 0a67b26b..3405077e 100644 --- a/src/ZipLib/ZipLib.vcxproj +++ b/src/ZipLib/ZipLib.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -99,31 +107,45 @@ {5C9FD859-DDF9-4510-8397-B329B0AE8C48} Win32Proj ZipLib + 10.0.17763.0 StaticLibrary true - v140 + v141 Unicode StaticLibrary true - v140 + v141 + Unicode + + + StaticLibrary + true + v141 Unicode StaticLibrary false - v140 + v141 true Unicode StaticLibrary false - v140 + v141 + true + Unicode + + + StaticLibrary + false + v141 true Unicode @@ -136,12 +158,18 @@ + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ @@ -151,6 +179,7 @@ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ @@ -159,6 +188,10 @@ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + @@ -189,6 +222,21 @@ true + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + Level3 @@ -200,6 +248,8 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + false + true Windows @@ -219,6 +269,29 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + true + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + true + true Windows diff --git a/src/ZipLib/extlibs/bzip2/bzip2.vcxproj b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj index ef45a432..619b7a1c 100644 --- a/src/ZipLib/extlibs/bzip2/bzip2.vcxproj +++ b/src/ZipLib/extlibs/bzip2/bzip2.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -36,31 +44,45 @@ {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71} Win32Proj bzip2 + 10.0.17763.0 StaticLibrary true - v140 + v141 Unicode StaticLibrary true - v140 + v141 + Unicode + + + StaticLibrary + true + v141 Unicode StaticLibrary false - v140 + v141 true Unicode StaticLibrary false - v140 + v141 + true + Unicode + + + StaticLibrary + false + v141 true Unicode @@ -73,12 +95,18 @@ + + + + + + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ @@ -92,10 +120,15 @@ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + @@ -126,6 +159,21 @@ true + + + + + Level3 + Disabled + WIN32;BZ_NO_STDIO;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreadedDebug + + + Windows + true + + Level3 @@ -137,6 +185,7 @@ WIN32;BZ_NO_STDIO;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996; 4244 MultiThreaded + true Windows @@ -156,6 +205,27 @@ WIN32;BZ_NO_STDIO;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996; 4244 MultiThreaded + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;BZ_NO_STDIO;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996; 4244 + MultiThreaded + true Windows diff --git a/src/ZipLib/extlibs/lzma/lzma.vcxproj b/src/ZipLib/extlibs/lzma/lzma.vcxproj index ec9caa4a..8b2cd40a 100644 --- a/src/ZipLib/extlibs/lzma/lzma.vcxproj +++ b/src/ZipLib/extlibs/lzma/lzma.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -92,31 +100,45 @@ {7EAD1358-3E72-4FB6-A212-25D462B5C1E9} Win32Proj lzma + 10.0.17763.0 StaticLibrary true - v140 + v141 Unicode StaticLibrary true - v140 + v141 + Unicode + + + StaticLibrary + true + v141 Unicode StaticLibrary false - v140 + v141 true Unicode StaticLibrary false - v140 + v141 + true + Unicode + + + StaticLibrary + false + v141 true Unicode @@ -129,12 +151,18 @@ + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ @@ -148,10 +176,15 @@ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + @@ -182,6 +215,21 @@ true + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + Level3 @@ -193,6 +241,8 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + false + true Windows @@ -212,6 +262,29 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + true + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + true + true Windows diff --git a/src/ZipLib/extlibs/zlib/zlib.vcxproj b/src/ZipLib/extlibs/zlib/zlib.vcxproj index 9da6b55a..2f74d0af 100644 --- a/src/ZipLib/extlibs/zlib/zlib.vcxproj +++ b/src/ZipLib/extlibs/zlib/zlib.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -48,31 +56,45 @@ {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D} Win32Proj zlib + 10.0.17763.0 StaticLibrary true - v140 + v141 Unicode StaticLibrary true - v140 + v141 + Unicode + + + StaticLibrary + true + v141 Unicode StaticLibrary false - v140 + v141 true Unicode StaticLibrary false - v140 + v141 + true + Unicode + + + StaticLibrary + false + v141 true Unicode @@ -85,12 +107,18 @@ + + + + + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ @@ -104,10 +132,15 @@ $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + + $(SolutionDir)Bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + @@ -138,6 +171,21 @@ true + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreadedDebug + + + Windows + true + + Level3 @@ -149,6 +197,8 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + false + true Windows @@ -168,6 +218,29 @@ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 4996 MultiThreaded + true + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + 4996 + MultiThreaded + true + true Windows diff --git a/vcproj/GUP.sln b/vcproj/GUP.sln index f2304e63..4255ab8a 100644 --- a/vcproj/GUP.sln +++ b/vcproj/GUP.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.779 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUP", "GUP.vcxproj", "{B97C3450-77CA-4009-A5C7-00953E64B07A}" ProjectSection(ProjectDependencies) = postProject @@ -18,48 +18,70 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipLib", "..\src\ZipLib\Zip EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|ARM64.Build.0 = Debug|ARM64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x64.ActiveCfg = Debug|x64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x64.Build.0 = Debug|x64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x86.ActiveCfg = Debug|Win32 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Debug|x86.Build.0 = Debug|Win32 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|ARM64.ActiveCfg = Release|ARM64 + {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|ARM64.Build.0 = Release|ARM64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x64.ActiveCfg = Release|x64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x64.Build.0 = Release|x64 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x86.ActiveCfg = Release|Win32 {B97C3450-77CA-4009-A5C7-00953E64B07A}.Release|x86.Build.0 = Release|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|ARM64.Build.0 = Debug|ARM64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.ActiveCfg = Debug|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x64.Build.0 = Debug|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.ActiveCfg = Debug|Win32 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Debug|x86.Build.0 = Debug|Win32 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|ARM64.ActiveCfg = Release|ARM64 + {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|ARM64.Build.0 = Release|ARM64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.ActiveCfg = Release|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x64.Build.0 = Release|x64 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.ActiveCfg = Release|Win32 {DBBF348D-C221-4F2E-8A0D-24EFA0D98E71}.Release|x86.Build.0 = Release|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|ARM64.Build.0 = Debug|ARM64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.ActiveCfg = Debug|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x64.Build.0 = Debug|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.ActiveCfg = Debug|Win32 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Debug|x86.Build.0 = Debug|Win32 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|ARM64.ActiveCfg = Release|ARM64 + {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|ARM64.Build.0 = Release|ARM64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.ActiveCfg = Release|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x64.Build.0 = Release|x64 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.ActiveCfg = Release|Win32 {7EAD1358-3E72-4FB6-A212-25D462B5C1E9}.Release|x86.Build.0 = Release|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|ARM64.Build.0 = Debug|ARM64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.ActiveCfg = Debug|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x64.Build.0 = Debug|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.ActiveCfg = Debug|Win32 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Debug|x86.Build.0 = Debug|Win32 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|ARM64.ActiveCfg = Release|ARM64 + {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|ARM64.Build.0 = Release|ARM64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.ActiveCfg = Release|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x64.Build.0 = Release|x64 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.ActiveCfg = Release|Win32 {BAEB16B3-DB4C-432F-9E6A-2ACADEA0691D}.Release|x86.Build.0 = Release|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|ARM64.Build.0 = Debug|ARM64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.ActiveCfg = Debug|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x64.Build.0 = Debug|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.ActiveCfg = Debug|Win32 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Debug|x86.Build.0 = Debug|Win32 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|ARM64.ActiveCfg = Release|ARM64 + {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|ARM64.Build.0 = Release|ARM64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.ActiveCfg = Release|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x64.Build.0 = Release|x64 {5C9FD859-DDF9-4510-8397-B329B0AE8C48}.Release|x86.ActiveCfg = Release|Win32 @@ -68,4 +90,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FB08992D-8D3E-495B-9A2B-BACD9E876453} + EndGlobalSection EndGlobal diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 2025b123..b552578d 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -1,6 +1,14 @@  + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release + ARM + + + Release + ARM64 + Release Win32 @@ -22,29 +38,52 @@ {B97C3450-77CA-4009-A5C7-00953E64B07A} GUP Win32Proj - 8.1 + 10.0.17763.0 + true Application - v140_xp + v141 Unicode true Application - v140_xp + v141 + Unicode + true + + + Application + v141 + Unicode + true + + + Application + v141 Unicode true Application - v140_xp + v141 Unicode Application - v140_xp + v141 + Unicode + + + Application + v141 + Unicode + + + Application + v141 Unicode @@ -56,12 +95,24 @@ + + + + + + + + + + + + <_ProjectFileVersion>12.0.30501.0 @@ -74,6 +125,12 @@ true + + true + + + true + ..\bin\ $(Configuration)\ @@ -83,6 +140,14 @@ false ..\bin64\ + + false + + + false + ..\binarm64\ + $(SolutionDir)Obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ + Disabled @@ -99,7 +164,7 @@ libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x86-debug-dll-ipv6-sspi-winssl\lib;Bin\x86\Debug;%(AdditionalLibraryDirectories) + ..\curl\builds\libcurl-vc15-x86-debug-dll-ipv6-sspi-winssl\lib;Bin\x86\Debug;%(AdditionalLibraryDirectories) true Windows MachineX86 @@ -110,6 +175,54 @@ + + Disabled + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) + WIN32;TIXML_USE_STL;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level4 + ProgramDatabase + true + + + libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc15-x64-debug-dll-ipv6-sspi-winssl\lib;Bin\x64\Debug;%(AdditionalLibraryDirectories) + true + Windows + + + + + + + + + Disabled + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) + WIN32;TIXML_USE_STL;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level4 + ProgramDatabase + true + + + libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc14-x64-debug-dll-ipv6-sspi-winssl\lib;Bin\x64\Debug;%(AdditionalLibraryDirectories) + true + Windows + + + + + + + Disabled ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) @@ -147,10 +260,11 @@ None true NoExtensions + false libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x86-release-dll-ipv6-sspi-winssl\lib;Bin\x86\Release;%(AdditionalLibraryDirectories) + ..\curl\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl\lib;Bin\x86\Release;%(AdditionalLibraryDirectories) false Windows true @@ -187,6 +301,47 @@ del ..\bin\GUP.ipdb Level4 None true + true + + + libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-winssl\lib;Bin\x64\Release;%(AdditionalLibraryDirectories) + false + Windows + true + true + + + copy ..\src\change.log ..\bin64\change.log +copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml +copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php +copy ..\LICENSE ..\bin64\LICENSE +copy ..\README.md ..\bin64\README.md +copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll +xcopy ..\src\translations ..\bin64\translations\ /S /Y /E +del ..\bin64\GUP.iobj +del ..\bin64\GUP.ipdb + + + + + + + + + + + + + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) + WIN32;TIXML_USE_STL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreaded + + + Level4 + None + true + false libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) @@ -205,6 +360,46 @@ copy ..\README.md ..\bin64\README.md copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll xcopy ..\src\translations ..\bin64\translations\ /S /Y /E del ..\bin64\GUP.iobj +del ..\bin64\GUP.ipdb + + + + + + + + + + + + + ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) + WIN32;TIXML_USE_STL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreaded + + + Level4 + None + true + true + + + libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;Shell32.lib;%(AdditionalDependencies) + ..\curl\builds\libcurl-vc15-ARM64-release-dll-ipv6-sspi-winssl\lib;Bin\arm64\Release;%(AdditionalLibraryDirectories) + false + Windows + true + true + + + copy ..\src\change.log ..\bin64\change.log +copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml +copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php +copy ..\LICENSE ..\bin64\LICENSE +copy ..\README.md ..\bin64\README.md +copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll +xcopy ..\src\translations ..\bin64\translations\ /S /Y /E +del ..\bin64\GUP.iobj del ..\bin64\GUP.ipdb From d143f8c1937be3dae7cb3110d22fd4b4b15ae30f Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 20 Apr 2021 23:12:56 +0200 Subject: [PATCH 046/110] Fix build post-events for 3 archetectures --- vcproj/GUP.vcxproj | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index b552578d..7c4619e8 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -277,7 +277,7 @@ copy ..\src\ConfigFiles\gup.xml ..\bin\gup.xml copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin\getDownLoadUrl.php copy ..\LICENSE ..\bin\LICENSE copy ..\README.md ..\bin\README.md -copy ..\curl\builds\libcurl-vc14-x86-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin\libcurl.dll +copy ..\curl\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin\libcurl.dll xcopy ..\src\translations ..\bin\translations\ /S /Y /E del ..\bin\GUP.iobj del ..\bin\GUP.ipdb @@ -317,7 +317,7 @@ copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php copy ..\LICENSE ..\bin64\LICENSE copy ..\README.md ..\bin64\README.md -copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll +copy ..\curl\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll xcopy ..\src\translations ..\bin64\translations\ /S /Y /E del ..\bin64\GUP.iobj del ..\bin64\GUP.ipdb @@ -392,15 +392,13 @@ del ..\bin64\GUP.ipdb true - copy ..\src\change.log ..\bin64\change.log -copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml -copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php -copy ..\LICENSE ..\bin64\LICENSE -copy ..\README.md ..\bin64\README.md -copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll -xcopy ..\src\translations ..\bin64\translations\ /S /Y /E -del ..\bin64\GUP.iobj -del ..\bin64\GUP.ipdb + copy ..\src\change.log ..\binarm64\change.log +copy ..\src\ConfigFiles\gup.xml ..\binarm64\gup.xml +copy ..\src\ConfigFiles\getDownLoadUrl.php ..\binarm64\getDownLoadUrl.php +copy ..\LICENSE ..\binarm64\LICENSE +copy ..\README.md ..\binarm64\README.md +copy ..\curl\builds\libcurl-vc15-ARM64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\binarm64\libcurl.dll +xcopy ..\src\translations ..\binarm64\translations\ /S /Y /E From fe6e7fe365def23675af6569543f1ff85cf42c39 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 17 May 2021 18:51:53 +0200 Subject: [PATCH 047/110] WinGUp (for Notepad++) v5.2 release --- src/change.log | 4 ++-- src/resource.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/change.log b/src/change.log index 97f3a1ea..d8f18f2b 100644 --- a/src/change.log +++ b/src/change.log @@ -1,3 +1,3 @@ -WinGup (for Notepad++) v5.1.3 enhancements: +WinGup (for Notepad++) v5.2 new feature: -1. Improve "No Notepad++ update" dialog message. +1. Add ARM64 build. diff --git a/src/resource.h b/src/resource.h index 900a48b5..1db95061 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE L"5.13\0" -#define VERSION_DIGITALVALUE 5, 1, 3, 0 +#define VERSION_VALUE L"5.2\0" +#define VERSION_DIGITALVALUE 5, 2, 0, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 3d5cb3f8d6eb908cce25217b7630e99d0219e063 Mon Sep 17 00:00:00 2001 From: mere-human <9664141+mere-human@users.noreply.github.com> Date: Sat, 28 Aug 2021 12:23:30 +0300 Subject: [PATCH 048/110] Fix GUP crashes when %TEMP% is not set Use a fallback TMP, TEMP or use the other directory. Fix #16, close #18 --- src/winmain.cpp | 37 +++++++++++++++++++++++++++++++++++-- src/xmlTools.cpp | 2 +- src/xmlTools.h | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index e62a2131..29911f7f 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -61,6 +61,7 @@ const wchar_t MSGID_DOWNLOADSTOPPED[] = L"Download is stopped by user. Update is const wchar_t MSGID_CLOSEAPP[] = L" is opened.\rUpdater will close it in order to process the installation.\rContinue?"; const wchar_t MSGID_ABORTORNOT[] = L"Do you want to abort update download?"; const wchar_t MSGID_UNZIPFAILED[] = L"Can't unzip:\nOperation not permitted or decompression failed"; +const wchar_t MSGID_NODOWNLOADFOLDER[] = L"Can't find a download folder"; const wchar_t MSGID_HELP[] = L"Usage :\r\ \r\ gup --help\r\ @@ -917,6 +918,34 @@ bool runInstaller(const wstring& app2runPath, const wstring& binWindowsClassName return true; } +// Returns a folder suitable for exe installer download destination. +// In case of error, shows a message box and returns an empty string. +std::wstring getDestDir(const GupNativeLang& nativeLang, const GupParameters& gupParams) +{ + // Note: Other fallback directories may be Downloads, %UserProfile%, etc. + const wchar_t* envVar = _wgetenv(L"TEMP"); + if (envVar) + return envVar; + envVar = _wgetenv(L"TMP"); + if (envVar) + return envVar; + + envVar = _wgetenv(L"AppData"); + if (envVar) + { + std::wstring result = envVar; + result += L"\\Notepad++"; + if (::PathFileExists(result.c_str())) + return result; + } + + std::wstring message = nativeLang.getMessageString("MSGID_NODOWNLOADFOLDER"); + if (message.empty()) + message = MSGID_NODOWNLOADFOLDER; + ::MessageBox(NULL, message.c_str(), gupParams.getMessageBoxTitle().c_str(), MB_ICONERROR | MB_OK); + return {}; +} + #ifdef _DEBUG #define WRITE_LOG(fn, suffix, log) writeLog(fn, suffix, log); @@ -1071,7 +1100,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int) } // install - std::wstring dlDest = _wgetenv(L"TEMP"); + std::wstring dlDest = getDestDir(nativeLang, gupParams); + if (dlDest.empty()) + return -1; dlDest += L"\\"; dlDest += ::PathFindFileName(dlUrl.c_str()); @@ -1235,7 +1266,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR lpszCmdLine, int) // Download executable bin // - std::wstring dlDest = _wgetenv(L"TEMP"); + std::wstring dlDest = getDestDir(nativeLang, gupParams); + if (dlDest.empty()) + return -1; dlDest += L"\\"; dlDest += ::PathFindFileName(gupDlInfo.getDownloadLocation().c_str()); diff --git a/src/xmlTools.cpp b/src/xmlTools.cpp index 0e1d7eca..f439b49d 100644 --- a/src/xmlTools.cpp +++ b/src/xmlTools.cpp @@ -306,7 +306,7 @@ void GupExtraOptions::writeProxyInfo(const wchar_t* fn, const wchar_t* proxySrv, newProxySettings.SaveFile(); } -std::wstring GupNativeLang::getMessageString(std::string msgID) +std::wstring GupNativeLang::getMessageString(const std::string& msgID) const { if (!_nativeLangRoot) return L""; diff --git a/src/xmlTools.h b/src/xmlTools.h index da3427bc..493d2c54 100644 --- a/src/xmlTools.h +++ b/src/xmlTools.h @@ -103,7 +103,7 @@ class GupNativeLang : public XMLTool { _xmlDoc.LoadFile(xmlFileName); _nativeLangRoot = _xmlDoc.FirstChild("GUP_NativeLangue"); }; - std::wstring getMessageString(std::string msgID); + std::wstring getMessageString(const std::string& msgID) const; protected: TiXmlNode *_nativeLangRoot; From 6e0da5be746d7993468a00c041d913943be05dec Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 7 Oct 2021 16:26:09 +0200 Subject: [PATCH 049/110] Enhancement for getting download folder path --- src/winmain.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index 29911f7f..c3c52c51 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "resource.h" #include #include "xmlTools.h" @@ -61,7 +62,7 @@ const wchar_t MSGID_DOWNLOADSTOPPED[] = L"Download is stopped by user. Update is const wchar_t MSGID_CLOSEAPP[] = L" is opened.\rUpdater will close it in order to process the installation.\rContinue?"; const wchar_t MSGID_ABORTORNOT[] = L"Do you want to abort update download?"; const wchar_t MSGID_UNZIPFAILED[] = L"Can't unzip:\nOperation not permitted or decompression failed"; -const wchar_t MSGID_NODOWNLOADFOLDER[] = L"Can't find a download folder"; +const wchar_t MSGID_NODOWNLOADFOLDER[] = L"Can't find any folder for downloading.\rPlease check your environment variables\"%TMP%\", \"%TEMP%\" and \"%APPDATA%\""; const wchar_t MSGID_HELP[] = L"Usage :\r\ \r\ gup --help\r\ @@ -918,6 +919,20 @@ bool runInstaller(const wstring& app2runPath, const wstring& binWindowsClassName return true; } + +std::wstring getSpecialFolderLocation(int folderKind) +{ + TCHAR path[MAX_PATH]; + const HRESULT specialLocationResult = SHGetFolderPath(nullptr, folderKind, nullptr, SHGFP_TYPE_CURRENT, path); + + wstring result; + if (SUCCEEDED(specialLocationResult)) + { + result = path; + } + return result; +} + // Returns a folder suitable for exe installer download destination. // In case of error, shows a message box and returns an empty string. std::wstring getDestDir(const GupNativeLang& nativeLang, const GupParameters& gupParams) @@ -931,13 +946,22 @@ std::wstring getDestDir(const GupNativeLang& nativeLang, const GupParameters& gu return envVar; envVar = _wgetenv(L"AppData"); + std::wstring downloadFolder; if (envVar) { - std::wstring result = envVar; - result += L"\\Notepad++"; - if (::PathFileExists(result.c_str())) - return result; + downloadFolder = envVar; } + else + { + downloadFolder = getSpecialFolderLocation(CSIDL_APPDATA); + } + downloadFolder += L"\\Notepad++"; + if (::PathFileExists(downloadFolder.c_str())) + return downloadFolder; + + downloadFolder = getSpecialFolderLocation(CSIDL_INTERNET_CACHE); + if (!downloadFolder.empty()) + return downloadFolder; std::wstring message = nativeLang.getMessageString("MSGID_NODOWNLOADFOLDER"); if (message.empty()) From cab5b5c6c8201dedaf3d1eb0c84861d025e84fff Mon Sep 17 00:00:00 2001 From: Don HO Date: Thu, 7 Oct 2021 16:28:02 +0200 Subject: [PATCH 050/110] WinGUp (for Notepad++) v5.2.1 release --- src/change.log | 4 ++-- src/resource.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/change.log b/src/change.log index d8f18f2b..a8eba913 100644 --- a/src/change.log +++ b/src/change.log @@ -1,3 +1,3 @@ -WinGup (for Notepad++) v5.2 new feature: +WinGup (for Notepad++) v5.2.1 bug-fix: -1. Add ARM64 build. +1. Fix GUP crashes when %TEMP% is not set. diff --git a/src/resource.h b/src/resource.h index 1db95061..f95ef0a4 100644 --- a/src/resource.h +++ b/src/resource.h @@ -20,8 +20,8 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define VERSION_VALUE L"5.2\0" -#define VERSION_DIGITALVALUE 5, 2, 0, 0 +#define VERSION_VALUE L"5.21\0" +#define VERSION_DIGITALVALUE 5, 2, 1, 0 #define IDD_PROGRESS_DLG 1001 #define IDD_PROXY_DLG 1002 From 2993a68ff08d00c530add866ca5884e886f3a369 Mon Sep 17 00:00:00 2001 From: Rajendra Singh Date: Sat, 6 Nov 2021 21:56:59 +0530 Subject: [PATCH 051/110] Avoid Divide by Zero condition Close #21 --- src/winmain.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/winmain.cpp b/src/winmain.cpp index c3c52c51..5cfaf3c4 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -479,10 +479,13 @@ static size_t setProgress(HWND, double dlTotal, double dlSoFar, double, double) size_t downloadedRatio = SendMessage(hProgressBar, PBM_DELTAPOS, 0, 0); - size_t step = size_t(dlSoFar * 100.0 / dlTotal - downloadedRatio); + if (dlTotal != 0) + { + size_t step = size_t(dlSoFar * 100.0 / dlTotal - downloadedRatio); - SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0); - SendMessage(hProgressBar, PBM_STEPIT, 0, 0); + SendMessage(hProgressBar, PBM_SETSTEP, (WPARAM)step, 0); + SendMessage(hProgressBar, PBM_STEPIT, 0, 0); + } const size_t percentageLen = 1024; wchar_t percentage[percentageLen]; From 728ac51975c3580e62bc75badd98eae4ee1dfb88 Mon Sep 17 00:00:00 2001 From: Rajendra Singh Date: Sat, 6 Nov 2021 21:22:03 +0530 Subject: [PATCH 052/110] Add custom icon on dialog & taskbar Close #20 --- src/ConfigFiles/gup.xml | 7 ++++++ src/gup.rc | 7 ++---- src/winmain.cpp | 54 ++++++++++++++++++++++++++++++++++++++++- src/xmlTools.cpp | 12 +++++++++ src/xmlTools.h | 2 ++ 5 files changed, 76 insertions(+), 6 deletions(-) diff --git a/src/ConfigFiles/gup.xml b/src/ConfigFiles/gup.xml index de5d4fd9..ecc0c773 100644 --- a/src/ConfigFiles/gup.xml +++ b/src/ConfigFiles/gup.xml @@ -47,6 +47,13 @@ --> Notepad++ + + updater.ico + updater.ico diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 7c4619e8..2c9e0fd1 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -277,6 +277,7 @@ copy ..\src\ConfigFiles\gup.xml ..\bin\gup.xml copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin\getDownLoadUrl.php copy ..\LICENSE ..\bin\LICENSE copy ..\README.md ..\bin\README.md +copy ..\resources\updater.ico ..\bin\updater.ico copy ..\curl\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin\libcurl.dll xcopy ..\src\translations ..\bin\translations\ /S /Y /E del ..\bin\GUP.iobj @@ -313,6 +314,7 @@ del ..\bin\GUP.ipdb copy ..\src\change.log ..\bin64\change.log +copy ..\resources\updater.ico ..\bin64\updater.ico copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php copy ..\LICENSE ..\bin64\LICENSE @@ -393,6 +395,7 @@ del ..\bin64\GUP.ipdb copy ..\src\change.log ..\binarm64\change.log +copy ..\resources\updater.ico ..\binarm64\updater.ico copy ..\src\ConfigFiles\gup.xml ..\binarm64\gup.xml copy ..\src\ConfigFiles\getDownLoadUrl.php ..\binarm64\getDownLoadUrl.php copy ..\LICENSE ..\binarm64\LICENSE From 5e88e8ee1e738c837c047aec216289dd9ae52ae6 Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 7 Nov 2021 03:02:34 +0100 Subject: [PATCH 054/110] Remove unused build configuration --- vcproj/GUP.vcxproj | 95 ---------------------------------------------- 1 file changed, 95 deletions(-) diff --git a/vcproj/GUP.vcxproj b/vcproj/GUP.vcxproj index 2c9e0fd1..671046f3 100644 --- a/vcproj/GUP.vcxproj +++ b/vcproj/GUP.vcxproj @@ -1,10 +1,6 @@  - - Debug - ARM - Debug ARM64 @@ -17,10 +13,6 @@ Debug x64 - - Release - ARM - Release ARM64 @@ -54,12 +46,6 @@ Unicode true - - Application - v141 - Unicode - true - Application v141 @@ -76,11 +62,6 @@ v141 Unicode - - Application - v141 - Unicode - Application v141 @@ -95,9 +76,6 @@ - - - @@ -107,9 +85,6 @@ - - - @@ -125,9 +100,6 @@ true - - true - true @@ -140,9 +112,6 @@ false ..\bin64\ - - false - false ..\binarm64\ @@ -198,30 +167,6 @@ - - - Disabled - ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;TIXML_USE_STL;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level4 - ProgramDatabase - true - - - libcurl_debug.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x64-debug-dll-ipv6-sspi-winssl\lib;Bin\x64\Debug;%(AdditionalLibraryDirectories) - true - Windows - - - - - - Disabled @@ -322,46 +267,6 @@ copy ..\README.md ..\bin64\README.md copy ..\curl\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll xcopy ..\src\translations ..\bin64\translations\ /S /Y /E del ..\bin64\GUP.iobj -del ..\bin64\GUP.ipdb - - - - - - - - - - - - - ..\src\libcurl\include;..\src\TinyXml;..\src\sha2;%(AdditionalIncludeDirectories) - WIN32;TIXML_USE_STL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreaded - - - Level4 - None - true - false - - - libcurl.lib;ZipLib.lib;zlib.lib;lzma.lib;bzip2.lib;comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\lib;Bin\x64\Release;%(AdditionalLibraryDirectories) - false - Windows - true - true - - - copy ..\src\change.log ..\bin64\change.log -copy ..\src\ConfigFiles\gup.xml ..\bin64\gup.xml -copy ..\src\ConfigFiles\getDownLoadUrl.php ..\bin64\getDownLoadUrl.php -copy ..\LICENSE ..\bin64\LICENSE -copy ..\README.md ..\bin64\README.md -copy ..\curl\builds\libcurl-vc14-x64-release-dll-ipv6-sspi-winssl\bin\libcurl.dll ..\bin64\libcurl.dll -xcopy ..\src\translations ..\bin64\translations\ /S /Y /E -del ..\bin64\GUP.iobj del ..\bin64\GUP.ipdb From 1eb2628d11d68ea0e1dc3540007c15744f00669b Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 7 Nov 2021 19:06:00 +0100 Subject: [PATCH 055/110] Update cURL from v7.56.1 to v7.79.1 --- README.md | 2 +- curl/.azure-pipelines.yml | 206 + curl/.circleci/config.yml | 73 + curl/.cirrus.yml | 132 + curl/.dcignore | 3 + curl/.dir-locals.el | 31 + curl/.gitattributes | 14 + curl/.github/CONTRIBUTING.md | 23 + curl/.github/FUNDING.yml | 2 + curl/.github/ISSUE_TEMPLATE/bug_report.md | 28 + curl/.github/ISSUE_TEMPLATE/config.yml | 11 + curl/.github/lock.yml | 8 + curl/.github/stale.yml | 17 + curl/.github/workflows/codeql-analysis.yml | 50 + curl/.github/workflows/fuzz.yml | 36 + curl/.github/workflows/linux-hyper.yml | 48 + curl/.github/workflows/macos.yml | 129 + curl/.gitignore | 60 + curl/.lgtm.yml | 31 + curl/.mailmap | 80 + curl/.muse/config.toml | 3 + curl/.muse/setup.sh | 4 + curl/CHANGES | 6809 +-- curl/CMake/CMakeConfigurableFile.in | 22 +- curl/CMake/CurlSymbolHiding.cmake | 107 +- curl/CMake/CurlTests.c | 185 +- curl/CMake/FindBearSSL.cmake | 30 + curl/CMake/FindBrotli.cmake | 41 + curl/CMake/FindCARES.cmake | 53 +- curl/CMake/FindGSS.cmake | 435 +- curl/CMake/FindLibSSH2.cmake | 52 +- curl/CMake/FindMbedTLS.cmake | 21 + curl/CMake/FindNGHTTP2.cmake | 27 +- curl/CMake/FindNGHTTP3.cmake | 76 + curl/CMake/FindNGTCP2.cmake | 113 + curl/CMake/FindNSS.cmake | 38 + curl/CMake/FindQUICHE.cmake | 68 + curl/CMake/FindWolfSSL.cmake | 34 + curl/CMake/FindZstd.cmake | 69 + curl/CMake/Macros.cmake | 94 +- curl/CMake/OtherTests.cmake | 301 +- curl/CMake/Platforms/WindowsCache.cmake | 46 +- curl/CMake/Utilities.cmake | 61 +- curl/CMake/cmake_uninstall.cmake.in | 39 +- curl/CMake/curl-config.cmake.in | 33 + curl/CMakeLists.txt | 1006 +- curl/COPYING | 2 +- curl/GIT-INFO | 44 + curl/MacOSX-Framework | 27 +- curl/Makefile | 44 +- curl/Makefile.am | 222 +- curl/Makefile.dist | 115 + curl/Makefile.in | 1780 - curl/README | 20 +- curl/README.md | 88 + curl/RELEASE-NOTES | 131 +- curl/SECURITY.md | 10 + curl/acinclude.m4 | 711 +- curl/aclocal.m4 | 1209 - curl/appveyor.yml | 318 + curl/buildconf | 448 +- curl/buildconf.bat | 10 +- curl/compile | 347 - curl/config.guess | 1462 - curl/config.sub | 1825 - curl/configure | 43759 ---------------- curl/configure.ac | 3232 +- curl/curl-config.in | 40 +- curl/depcomp | 791 - curl/docs/.gitignore | 4 + curl/docs/ALTSVC.md | 41 + curl/docs/BINDINGS.md | 49 +- curl/docs/BUFREF.md | 81 + curl/docs/BUG-BOUNTY.md | 83 + curl/docs/BUGS | 297 - curl/docs/BUGS.md | 266 + curl/docs/CHECKSRC.md | 71 +- curl/docs/CIPHERS.md | 102 +- curl/docs/CMakeLists.txt | 21 + curl/docs/CODE_REVIEW.md | 168 + curl/docs/CODE_STYLE.md | 293 +- curl/docs/CONTRIBUTE.md | 73 +- curl/docs/CURL-DISABLE.md | 136 + curl/docs/DEPRECATE.md | 13 + curl/docs/DYNBUF.md | 108 + curl/docs/ECH.md | 135 + curl/docs/EXPERIMENTAL.md | 23 + curl/docs/FAQ | 414 +- curl/docs/{FEATURES => FEATURES.md} | 178 +- curl/docs/GOVERNANCE.md | 182 + curl/docs/HELP-US.md | 29 +- curl/docs/HISTORY.md | 165 +- curl/docs/HSTS.md | 44 + curl/docs/HTTP-COOKIES.md | 36 +- curl/docs/HTTP2.md | 31 +- curl/docs/HTTP3.md | 142 + curl/docs/HYPER.md | 69 + curl/docs/INSTALL.cmake | 8 +- curl/docs/INSTALL.md | 454 +- curl/docs/INTERNALS.md | 550 +- curl/docs/KNOWN_BUGS | 889 +- curl/docs/LICENSE-MIXING.md | 127 - curl/docs/MAIL-ETIQUETTE | 8 +- curl/docs/MANUAL | 1059 - curl/docs/MANUAL.md | 990 + curl/docs/MQTT.md | 27 + curl/docs/Makefile.am | 66 +- curl/docs/Makefile.in | 871 - curl/docs/NEW-PROTOCOL.md | 110 + curl/docs/PARALLEL-TRANSFERS.md | 58 + curl/docs/README.cmake | 16 - curl/docs/README.md | 6 +- curl/docs/README.netware | 26 - curl/docs/README.win32 | 25 - ...RELEASE-PROCEDURE => RELEASE-PROCEDURE.md} | 53 +- curl/docs/RESOURCES | 83 - curl/docs/ROADMAP.md | 124 +- curl/docs/RUSTLS.md | 26 + .../docs/{SECURITY.md => SECURITY-PROCESS.md} | 113 +- curl/docs/SSL-PROBLEMS.md | 29 +- curl/docs/SSLCERTS.md | 16 +- curl/docs/THANKS | 985 +- curl/docs/THANKS-filter | 129 + curl/docs/TODO | 948 +- curl/docs/TheArtOfHttpScripting | 758 - curl/docs/TheArtOfHttpScripting.md | 700 + curl/docs/URL-SYNTAX.md | 366 + curl/docs/{VERSIONS => VERSIONS.md} | 17 +- curl/docs/cmdline-opts/CMakeLists.txt | 23 +- curl/docs/cmdline-opts/MANPAGE.md | 17 +- curl/docs/cmdline-opts/Makefile.am | 7 +- curl/docs/cmdline-opts/Makefile.in | 616 - curl/docs/cmdline-opts/Makefile.inc | 309 +- curl/docs/cmdline-opts/gen.pl | 211 +- curl/docs/cmdline-opts/page-footer | 81 +- curl/docs/cmdline-opts/page-header | 120 +- curl/docs/curl-config.1 | 15 +- curl/docs/curl.1 | 2862 - curl/docs/examples/.checksrc | 3 + curl/docs/examples/.gitignore | 95 + curl/docs/examples/10-at-a-time.c | 196 +- curl/docs/examples/Makefile.am | 18 +- curl/docs/examples/Makefile.example | 4 +- curl/docs/examples/Makefile.in | 1778 - curl/docs/examples/Makefile.inc | 141 +- curl/docs/examples/Makefile.m32 | 205 +- curl/docs/examples/Makefile.netware | 254 +- curl/docs/examples/{README => README.md} | 24 +- curl/docs/examples/adddocsref.pl | 56 + .../lib501.c => docs/examples/altsvc.c} | 56 +- curl/docs/examples/anyauthput.c | 23 +- curl/docs/examples/asiohiper.cpp | 486 - curl/docs/examples/cacertinmem.c | 194 +- curl/docs/examples/certinfo.c | 4 +- curl/docs/examples/chkspeed.c | 30 +- curl/docs/examples/cookie_interface.c | 12 +- curl/docs/examples/crawler.c | 217 + curl/docs/examples/curlgtk.c | 28 +- curl/docs/examples/curlx.c | 45 +- curl/docs/examples/debug.c | 12 +- curl/docs/examples/ephiperfifo.c | 545 + curl/docs/examples/evhiperfifo.c | 20 +- curl/docs/examples/externalsocket.c | 16 +- curl/docs/examples/fileupload.c | 16 +- curl/docs/examples/fopen.c | 10 +- curl/docs/examples/ftp-wildcard.c | 8 +- curl/docs/examples/ftpget.c | 6 +- curl/docs/examples/ftpgetinfo.c | 7 +- curl/docs/examples/ftpgetresp.c | 4 +- curl/docs/examples/ftpsget.c | 6 +- curl/docs/examples/ftpupload.c | 8 +- curl/docs/examples/ftpuploadfrommem.c | 6 +- curl/docs/examples/ftpuploadresume.c | 6 +- curl/docs/examples/getinfo.c | 6 +- curl/docs/examples/getinmemory.c | 13 +- curl/docs/examples/getredirect.c | 6 +- .../lib511.c => docs/examples/getreferrer.c} | 63 +- curl/docs/examples/ghiper.c | 28 +- curl/docs/examples/hiperfifo.c | 140 +- curl/docs/examples/href_extractor.c | 6 +- curl/docs/examples/htmltidy.c | 23 +- curl/docs/examples/htmltitle.cpp | 18 +- curl/docs/examples/http-post.c | 4 +- curl/docs/examples/http2-download.c | 167 +- curl/docs/examples/http2-pushinmemory.c | 188 + curl/docs/examples/http2-serverpush.c | 110 +- curl/docs/examples/http2-upload.c | 191 +- .../examples/http3-present.c} | 42 +- .../lib1551.c => docs/examples/http3.c} | 41 +- curl/docs/examples/httpcustomheader.c | 6 +- curl/docs/examples/httpput-postfields.c | 101 + curl/docs/examples/httpput.c | 11 +- curl/docs/examples/https.c | 4 +- curl/docs/examples/imap-append.c | 54 +- curl/docs/examples/imap-authzid.c | 71 + curl/docs/examples/imap-copy.c | 4 +- curl/docs/examples/imap-create.c | 4 +- curl/docs/examples/imap-delete.c | 4 +- curl/docs/examples/imap-examine.c | 4 +- curl/docs/examples/imap-fetch.c | 4 +- curl/docs/examples/imap-list.c | 4 +- curl/docs/examples/imap-lsub.c | 4 +- curl/docs/examples/imap-multi.c | 110 +- curl/docs/examples/imap-noop.c | 4 +- curl/docs/examples/imap-search.c | 4 +- curl/docs/examples/imap-ssl.c | 4 +- curl/docs/examples/imap-store.c | 4 +- curl/docs/examples/imap-tls.c | 4 +- curl/docs/examples/makefile.dj | 5 +- curl/docs/examples/multi-app.c | 89 +- curl/docs/examples/multi-debugcallback.c | 88 +- curl/docs/examples/multi-double.c | 100 +- curl/docs/examples/multi-event.c | 240 + curl/docs/examples/multi-formadd.c | 87 +- .../examples/multi-legacy.c} | 98 +- curl/docs/examples/multi-post.c | 86 +- curl/docs/examples/multi-single.c | 42 +- curl/docs/examples/multi-uv.c | 10 +- curl/docs/examples/multithread.c | 27 +- curl/docs/examples/opensslthreadlock.c | 4 +- curl/docs/examples/parseurl.c | 78 + .../examples/{persistant.c => persistent.c} | 8 +- curl/docs/examples/pop3-authzid.c | 70 + curl/docs/examples/pop3-dele.c | 4 +- curl/docs/examples/pop3-list.c | 4 +- curl/docs/examples/pop3-multi.c | 113 +- curl/docs/examples/pop3-noop.c | 4 +- curl/docs/examples/pop3-retr.c | 4 +- curl/docs/examples/pop3-ssl.c | 4 +- curl/docs/examples/pop3-stat.c | 4 +- curl/docs/examples/pop3-tls.c | 4 +- curl/docs/examples/pop3-top.c | 4 +- curl/docs/examples/pop3-uidl.c | 4 +- curl/docs/examples/post-callback.c | 6 +- curl/docs/examples/postinmemory.c | 20 +- curl/docs/examples/postit2-formadd.c | 7 +- curl/docs/examples/postit2.c | 7 +- curl/docs/examples/progressfunc.c | 44 +- curl/docs/examples/resolve.c | 10 +- curl/docs/examples/rtsp.c | 41 +- curl/docs/examples/sampleconv.c | 9 +- curl/docs/examples/sendrecv.c | 13 +- curl/docs/examples/sepheaders.c | 6 +- curl/docs/examples/sessioninfo.c | 7 +- curl/docs/examples/sftpget.c | 6 +- curl/docs/examples/sftpuploadresume.c | 135 + curl/docs/examples/shared-connection-cache.c | 85 + curl/docs/examples/simple.c | 6 +- curl/docs/examples/simplepost.c | 6 +- curl/docs/examples/simplessl.c | 4 +- curl/docs/examples/smooth-gtk-thread.c | 29 +- curl/docs/examples/smtp-authzid.c | 160 + curl/docs/examples/smtp-expn.c | 4 +- curl/docs/examples/smtp-mail.c | 75 +- curl/docs/examples/smtp-mime.c | 21 +- curl/docs/examples/smtp-multi.c | 166 +- curl/docs/examples/smtp-ssl.c | 57 +- curl/docs/examples/smtp-tls.c | 57 +- curl/docs/examples/smtp-vrfy.c | 4 +- curl/docs/examples/sslbackend.c | 14 +- curl/docs/examples/synctime.c | 57 +- curl/docs/examples/threaded-ssl.c | 17 +- curl/docs/examples/url2file.c | 8 +- .../lib542.c => docs/examples/urlapi.c} | 73 +- curl/docs/examples/usercertinmem.c | 42 +- curl/docs/examples/version-check.pl | 6 +- curl/docs/examples/xmlstream.c | 15 +- curl/docs/libcurl/.gitignore | 4 + curl/docs/libcurl/{ABI => ABI.md} | 44 +- curl/docs/libcurl/CMakeLists.txt | 21 + curl/docs/libcurl/Makefile.am | 6 +- curl/docs/libcurl/Makefile.in | 1266 - curl/docs/libcurl/Makefile.inc | 130 +- curl/docs/libcurl/curl_easy_cleanup.3 | 12 +- curl/docs/libcurl/curl_easy_duphandle.3 | 16 +- curl/docs/libcurl/curl_easy_escape.3 | 12 +- curl/docs/libcurl/curl_easy_getinfo.3 | 72 +- curl/docs/libcurl/curl_easy_init.3 | 11 +- curl/docs/libcurl/curl_easy_option_by_id.3 | 46 + curl/docs/libcurl/curl_easy_option_by_name.3 | 44 + curl/docs/libcurl/curl_easy_option_next.3 | 74 + curl/docs/libcurl/curl_easy_pause.3 | 57 +- curl/docs/libcurl/curl_easy_perform.3 | 10 +- curl/docs/libcurl/curl_easy_recv.3 | 7 +- curl/docs/libcurl/curl_easy_reset.3 | 11 +- curl/docs/libcurl/curl_easy_send.3 | 7 +- curl/docs/libcurl/curl_easy_setopt.3 | 125 +- curl/docs/libcurl/curl_easy_strerror.3 | 9 +- curl/docs/libcurl/curl_easy_unescape.3 | 9 +- curl/docs/libcurl/curl_easy_upkeep.3 | 77 + curl/docs/libcurl/curl_escape.3 | 11 +- curl/docs/libcurl/curl_formadd.3 | 10 +- curl/docs/libcurl/curl_formfree.3 | 10 +- curl/docs/libcurl/curl_formget.3 | 7 +- curl/docs/libcurl/curl_free.3 | 10 +- curl/docs/libcurl/curl_getdate.3 | 21 +- curl/docs/libcurl/curl_getenv.3 | 17 +- curl/docs/libcurl/curl_global_cleanup.3 | 7 +- curl/docs/libcurl/curl_global_init.3 | 20 +- curl/docs/libcurl/curl_global_init_mem.3 | 10 +- curl/docs/libcurl/curl_global_sslset.3 | 22 +- curl/docs/libcurl/curl_mime_addpart.3 | 7 +- curl/docs/libcurl/curl_mime_data.3 | 9 +- curl/docs/libcurl/curl_mime_data_cb.3 | 20 +- curl/docs/libcurl/curl_mime_encoder.3 | 9 +- curl/docs/libcurl/curl_mime_filedata.3 | 24 +- curl/docs/libcurl/curl_mime_filename.3 | 11 +- curl/docs/libcurl/curl_mime_free.3 | 9 +- curl/docs/libcurl/curl_mime_headers.3 | 9 +- curl/docs/libcurl/curl_mime_init.3 | 9 +- curl/docs/libcurl/curl_mime_name.3 | 9 +- curl/docs/libcurl/curl_mime_subparts.3 | 7 +- curl/docs/libcurl/curl_mime_type.3 | 11 +- curl/docs/libcurl/curl_mprintf.3 | 227 +- curl/docs/libcurl/curl_multi_add_handle.3 | 17 +- curl/docs/libcurl/curl_multi_assign.3 | 7 +- curl/docs/libcurl/curl_multi_cleanup.3 | 10 +- curl/docs/libcurl/curl_multi_fdset.3 | 14 +- curl/docs/libcurl/curl_multi_info_read.3 | 7 +- curl/docs/libcurl/curl_multi_init.3 | 8 +- curl/docs/libcurl/curl_multi_perform.3 | 11 +- curl/docs/libcurl/curl_multi_poll.3 | 117 + curl/docs/libcurl/curl_multi_remove_handle.3 | 10 +- curl/docs/libcurl/curl_multi_setopt.3 | 11 +- curl/docs/libcurl/curl_multi_socket.3 | 26 +- curl/docs/libcurl/curl_multi_socket_action.3 | 87 +- curl/docs/libcurl/curl_multi_strerror.3 | 9 +- curl/docs/libcurl/curl_multi_timeout.3 | 8 +- curl/docs/libcurl/curl_multi_wait.3 | 14 +- curl/docs/libcurl/curl_multi_wakeup.3 | 86 + curl/docs/libcurl/curl_share_cleanup.3 | 9 +- curl/docs/libcurl/curl_share_init.3 | 8 +- curl/docs/libcurl/curl_share_setopt.3 | 43 +- curl/docs/libcurl/curl_share_strerror.3 | 9 +- curl/docs/libcurl/curl_slist_append.3 | 21 +- curl/docs/libcurl/curl_slist_free_all.3 | 11 +- curl/docs/libcurl/curl_strequal.3 | 7 +- curl/docs/libcurl/curl_unescape.3 | 9 +- curl/docs/libcurl/curl_url.3 | 53 + curl/docs/libcurl/curl_url_cleanup.3 | 44 + curl/docs/libcurl/curl_url_dup.3 | 52 + curl/docs/libcurl/curl_url_get.3 | 124 + curl/docs/libcurl/curl_url_set.3 | 162 + curl/docs/libcurl/curl_version.3 | 9 +- curl/docs/libcurl/curl_version_info.3 | 166 +- curl/docs/libcurl/index.html | 71 - curl/docs/libcurl/libcurl-easy.3 | 7 +- curl/docs/libcurl/libcurl-env.3 | 92 + curl/docs/libcurl/libcurl-errors.3 | 90 +- curl/docs/libcurl/libcurl-multi.3 | 32 +- curl/docs/libcurl/libcurl-security.3 | 394 + curl/docs/libcurl/libcurl-share.3 | 14 +- curl/docs/libcurl/libcurl-symbols.3 | 1816 - curl/docs/libcurl/libcurl-thread.3 | 36 +- curl/docs/libcurl/libcurl-tutorial.3 | 266 +- curl/docs/libcurl/libcurl-url.3 | 138 + curl/docs/libcurl/libcurl.3 | 17 +- curl/docs/libcurl/libcurl.m4 | 4 +- curl/docs/libcurl/mksymbolsmanpage.pl | 12 +- curl/docs/libcurl/opts/CMakeLists.txt | 21 + .../docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 | 27 +- .../libcurl/opts/CURLINFO_APPCONNECT_TIME.3 | 11 +- .../libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 | 66 + curl/docs/libcurl/opts/CURLINFO_CERTINFO.3 | 16 +- .../libcurl/opts/CURLINFO_CONDITION_UNMET.3 | 17 +- .../docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 | 11 +- .../libcurl/opts/CURLINFO_CONNECT_TIME_T.3 | 62 + .../opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 | 7 +- .../opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.3 | 11 +- .../opts/CURLINFO_CONTENT_LENGTH_UPLOAD.3 | 7 +- .../opts/CURLINFO_CONTENT_LENGTH_UPLOAD_T.3 | 11 +- .../docs/libcurl/opts/CURLINFO_CONTENT_TYPE.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_COOKIELIST.3 | 20 +- .../libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 | 68 + .../libcurl/opts/CURLINFO_EFFECTIVE_URL.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_FILETIME.3 | 16 +- curl/docs/libcurl/opts/CURLINFO_FILETIME_T.3 | 71 + .../libcurl/opts/CURLINFO_FTP_ENTRY_PATH.3 | 5 +- curl/docs/libcurl/opts/CURLINFO_HEADER_SIZE.3 | 7 +- .../libcurl/opts/CURLINFO_HTTPAUTH_AVAIL.3 | 10 +- .../libcurl/opts/CURLINFO_HTTP_CONNECTCODE.3 | 5 +- .../docs/libcurl/opts/CURLINFO_HTTP_VERSION.3 | 16 +- curl/docs/libcurl/opts/CURLINFO_LASTSOCKET.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_LOCAL_IP.3 | 9 +- curl/docs/libcurl/opts/CURLINFO_LOCAL_PORT.3 | 7 +- .../libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 | 11 +- .../libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 | 62 + .../docs/libcurl/opts/CURLINFO_NUM_CONNECTS.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_OS_ERRNO.3 | 11 +- .../libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 | 20 +- .../opts/CURLINFO_PRETRANSFER_TIME_T.3 | 66 + curl/docs/libcurl/opts/CURLINFO_PRIMARY_IP.3 | 9 +- .../docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_PRIVATE.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_PROTOCOL.3 | 22 +- .../libcurl/opts/CURLINFO_PROXYAUTH_AVAIL.3 | 10 +- curl/docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 | 104 + .../opts/CURLINFO_PROXY_SSL_VERIFYRESULT.3 | 5 +- .../libcurl/opts/CURLINFO_REDIRECT_COUNT.3 | 7 +- .../libcurl/opts/CURLINFO_REDIRECT_TIME.3 | 9 +- .../libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 | 63 + .../docs/libcurl/opts/CURLINFO_REDIRECT_URL.3 | 7 +- curl/docs/libcurl/opts/CURLINFO_REFERER.3 | 61 + .../docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3 | 7 +- .../libcurl/opts/CURLINFO_RESPONSE_CODE.3 | 9 +- curl/docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 | 63 + .../libcurl/opts/CURLINFO_RTSP_CLIENT_CSEQ.3 | 5 +- .../libcurl/opts/CURLINFO_RTSP_CSEQ_RECV.3 | 5 +- .../libcurl/opts/CURLINFO_RTSP_SERVER_CSEQ.3 | 5 +- .../libcurl/opts/CURLINFO_RTSP_SESSION_ID.3 | 5 +- curl/docs/libcurl/opts/CURLINFO_SCHEME.3 | 11 +- .../libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 | 7 +- .../libcurl/opts/CURLINFO_SIZE_DOWNLOAD_T.3 | 11 +- curl/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 | 7 +- .../libcurl/opts/CURLINFO_SIZE_UPLOAD_T.3 | 11 +- .../libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 | 7 +- .../libcurl/opts/CURLINFO_SPEED_DOWNLOAD_T.3 | 11 +- .../docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 | 7 +- .../libcurl/opts/CURLINFO_SPEED_UPLOAD_T.3 | 11 +- curl/docs/libcurl/opts/CURLINFO_SSL_ENGINES.3 | 5 +- .../libcurl/opts/CURLINFO_SSL_VERIFYRESULT.3 | 15 +- .../opts/CURLINFO_STARTTRANSFER_TIME.3 | 11 +- .../opts/CURLINFO_STARTTRANSFER_TIME_T.3 | 65 + curl/docs/libcurl/opts/CURLINFO_TLS_SESSION.3 | 5 +- curl/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 | 80 +- curl/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 | 11 +- .../docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 | 63 + .../opts/CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 | 9 +- .../CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 | 9 +- curl/docs/libcurl/opts/CURLMOPT_MAXCONNECTS.3 | 10 +- .../opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 | 56 + .../opts/CURLMOPT_MAX_HOST_CONNECTIONS.3 | 18 +- .../opts/CURLMOPT_MAX_PIPELINE_LENGTH.3 | 9 +- .../opts/CURLMOPT_MAX_TOTAL_CONNECTIONS.3 | 18 +- curl/docs/libcurl/opts/CURLMOPT_PIPELINING.3 | 21 +- .../opts/CURLMOPT_PIPELINING_SERVER_BL.3 | 27 +- .../opts/CURLMOPT_PIPELINING_SITE_BL.3 | 21 +- curl/docs/libcurl/opts/CURLMOPT_PUSHDATA.3 | 5 +- .../docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 | 10 +- curl/docs/libcurl/opts/CURLMOPT_SOCKETDATA.3 | 5 +- .../libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 | 32 +- curl/docs/libcurl/opts/CURLMOPT_TIMERDATA.3 | 5 +- .../libcurl/opts/CURLMOPT_TIMERFUNCTION.3 | 28 +- .../opts/CURLOPT_ABSTRACT_UNIX_SOCKET.3 | 38 +- .../libcurl/opts/CURLOPT_ACCEPTTIMEOUT_MS.3 | 5 +- .../libcurl/opts/CURLOPT_ACCEPT_ENCODING.3 | 45 +- .../docs/libcurl/opts/CURLOPT_ADDRESS_SCOPE.3 | 21 +- curl/docs/libcurl/opts/CURLOPT_ALTSVC.3 | 58 + curl/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 | 82 + curl/docs/libcurl/opts/CURLOPT_APPEND.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_AUTOREFERER.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 | 97 + curl/docs/libcurl/opts/CURLOPT_BUFFERSIZE.3 | 12 +- curl/docs/libcurl/opts/CURLOPT_CAINFO.3 | 31 +- curl/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 | 68 + curl/docs/libcurl/opts/CURLOPT_CAPATH.3 | 18 +- curl/docs/libcurl/opts/CURLOPT_CERTINFO.3 | 11 +- .../libcurl/opts/CURLOPT_CHUNK_BGN_FUNCTION.3 | 40 +- curl/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 | 13 +- .../libcurl/opts/CURLOPT_CHUNK_END_FUNCTION.3 | 5 +- .../libcurl/opts/CURLOPT_CLOSESOCKETDATA.3 | 9 +- .../opts/CURLOPT_CLOSESOCKETFUNCTION.3 | 11 +- .../libcurl/opts/CURLOPT_CONNECTTIMEOUT.3 | 7 +- .../libcurl/opts/CURLOPT_CONNECTTIMEOUT_MS.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_CONNECT_ONLY.3 | 10 +- curl/docs/libcurl/opts/CURLOPT_CONNECT_TO.3 | 13 +- .../opts/CURLOPT_CONV_FROM_NETWORK_FUNCTION.3 | 5 +- .../opts/CURLOPT_CONV_FROM_UTF8_FUNCTION.3 | 5 +- .../opts/CURLOPT_CONV_TO_NETWORK_FUNCTION.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_COOKIE.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_COOKIEFILE.3 | 32 +- curl/docs/libcurl/opts/CURLOPT_COOKIEJAR.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_COOKIELIST.3 | 11 +- .../docs/libcurl/opts/CURLOPT_COOKIESESSION.3 | 7 +- .../libcurl/opts/CURLOPT_COPYPOSTFIELDS.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_CRLF.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_CRLFILE.3 | 22 +- curl/docs/libcurl/opts/CURLOPT_CURLU.3 | 70 + .../docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 | 33 +- .../docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.3 | 11 +- .../libcurl/opts/CURLOPT_DEFAULT_PROTOCOL.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_DIRLISTONLY.3 | 7 +- .../opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 | 56 + .../libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3 | 12 +- .../docs/libcurl/opts/CURLOPT_DNS_INTERFACE.3 | 11 +- .../docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP4.3 | 9 +- .../docs/libcurl/opts/CURLOPT_DNS_LOCAL_IP6.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_DNS_SERVERS.3 | 13 +- .../opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 | 69 + .../opts/CURLOPT_DNS_USE_GLOBAL_CACHE.3 | 13 +- .../libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 | 85 + .../libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 | 96 + .../opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 | 69 + curl/docs/libcurl/opts/CURLOPT_DOH_URL.3 | 80 + curl/docs/libcurl/opts/CURLOPT_EGDSOCKET.3 | 15 +- curl/docs/libcurl/opts/CURLOPT_ERRORBUFFER.3 | 23 +- .../opts/CURLOPT_EXPECT_100_TIMEOUT_MS.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_FAILONERROR.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_FILETIME.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_FNMATCH_DATA.3 | 5 +- .../libcurl/opts/CURLOPT_FNMATCH_FUNCTION.3 | 9 +- .../libcurl/opts/CURLOPT_FOLLOWLOCATION.3 | 18 +- curl/docs/libcurl/opts/CURLOPT_FORBID_REUSE.3 | 5 +- .../docs/libcurl/opts/CURLOPT_FRESH_CONNECT.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_FTPPORT.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_FTPSSLAUTH.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 | 11 +- .../opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 | 5 +- .../opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 | 5 +- .../libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 | 5 +- .../opts/CURLOPT_FTP_RESPONSE_TIMEOUT.3 | 5 +- .../libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_FTP_USE_EPRT.3 | 25 +- curl/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 | 9 +- .../libcurl/opts/CURLOPT_GSSAPI_DELEGATION.3 | 9 +- .../opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 | 64 + .../libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 | 59 + curl/docs/libcurl/opts/CURLOPT_HEADER.3 | 27 +- curl/docs/libcurl/opts/CURLOPT_HEADERDATA.3 | 7 +- .../libcurl/opts/CURLOPT_HEADERFUNCTION.3 | 40 +- curl/docs/libcurl/opts/CURLOPT_HEADEROPT.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_HSTS.3 | 76 + curl/docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 | 61 + .../libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 | 78 + .../docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 | 61 + .../libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 | 74 + curl/docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 | 68 + .../libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 | 58 + .../libcurl/opts/CURLOPT_HTTP200ALIASES.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_HTTPAUTH.3 | 22 +- curl/docs/libcurl/opts/CURLOPT_HTTPGET.3 | 22 +- curl/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 | 25 +- curl/docs/libcurl/opts/CURLOPT_HTTPPOST.3 | 9 +- .../libcurl/opts/CURLOPT_HTTPPROXYTUNNEL.3 | 11 +- .../opts/CURLOPT_HTTP_CONTENT_DECODING.3 | 9 +- .../opts/CURLOPT_HTTP_TRANSFER_DECODING.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_HTTP_VERSION.3 | 28 +- .../opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 | 12 +- curl/docs/libcurl/opts/CURLOPT_INFILESIZE.3 | 9 +- .../libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_INTERFACE.3 | 12 +- .../libcurl/opts/CURLOPT_INTERLEAVEDATA.3 | 5 +- .../libcurl/opts/CURLOPT_INTERLEAVEFUNCTION.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_IOCTLDATA.3 | 5 +- .../docs/libcurl/opts/CURLOPT_IOCTLFUNCTION.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_IPRESOLVE.3 | 24 +- curl/docs/libcurl/opts/CURLOPT_ISSUERCERT.3 | 7 +- .../libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 | 79 + .../opts/CURLOPT_KEEP_SENDING_ON_ERROR.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_KEYPASSWD.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_KRBLEVEL.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_LOCALPORT.3 | 13 +- .../libcurl/opts/CURLOPT_LOCALPORTRANGE.3 | 11 +- .../docs/libcurl/opts/CURLOPT_LOGIN_OPTIONS.3 | 11 +- .../libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 | 9 +- .../libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_MAIL_AUTH.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_MAIL_FROM.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_MAIL_RCPT.3 | 14 +- .../opts/CURLOPT_MAIL_RCPT_ALLLOWFAILS.3 | 72 + curl/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 | 65 + curl/docs/libcurl/opts/CURLOPT_MAXCONNECTS.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_MAXFILESIZE.3 | 9 +- .../libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 | 9 +- .../opts/CURLOPT_MAX_RECV_SPEED_LARGE.3 | 17 +- .../opts/CURLOPT_MAX_SEND_SPEED_LARGE.3 | 14 +- curl/docs/libcurl/opts/CURLOPT_MIMEPOST.3 | 17 +- curl/docs/libcurl/opts/CURLOPT_NETRC.3 | 26 +- curl/docs/libcurl/opts/CURLOPT_NETRC_FILE.3 | 7 +- .../opts/CURLOPT_NEW_DIRECTORY_PERMS.3 | 5 +- .../libcurl/opts/CURLOPT_NEW_FILE_PERMS.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_NOBODY.3 | 27 +- curl/docs/libcurl/opts/CURLOPT_NOPROGRESS.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_NOPROXY.3 | 22 +- curl/docs/libcurl/opts/CURLOPT_NOSIGNAL.3 | 24 +- .../libcurl/opts/CURLOPT_OPENSOCKETDATA.3 | 5 +- .../libcurl/opts/CURLOPT_OPENSOCKETFUNCTION.3 | 20 +- curl/docs/libcurl/opts/CURLOPT_PASSWORD.3 | 12 +- curl/docs/libcurl/opts/CURLOPT_PATH_AS_IS.3 | 12 +- .../libcurl/opts/CURLOPT_PINNEDPUBLICKEY.3 | 27 +- curl/docs/libcurl/opts/CURLOPT_PIPEWAIT.3 | 16 +- curl/docs/libcurl/opts/CURLOPT_PORT.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_POST.3 | 20 +- curl/docs/libcurl/opts/CURLOPT_POSTFIELDS.3 | 26 +- .../docs/libcurl/opts/CURLOPT_POSTFIELDSIZE.3 | 9 +- .../opts/CURLOPT_POSTFIELDSIZE_LARGE.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_POSTQUOTE.3 | 15 +- curl/docs/libcurl/opts/CURLOPT_POSTREDIR.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_PREQUOTE.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_PRE_PROXY.3 | 14 +- curl/docs/libcurl/opts/CURLOPT_PRIVATE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 | 34 +- .../libcurl/opts/CURLOPT_PROGRESSFUNCTION.3 | 43 +- curl/docs/libcurl/opts/CURLOPT_PROTOCOLS.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_PROXY.3 | 21 +- curl/docs/libcurl/opts/CURLOPT_PROXYAUTH.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_PROXYHEADER.3 | 5 +- .../docs/libcurl/opts/CURLOPT_PROXYPASSWORD.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_PROXYPORT.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_PROXYTYPE.3 | 5 +- .../docs/libcurl/opts/CURLOPT_PROXYUSERNAME.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_PROXYUSERPWD.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_PROXY_CAINFO.3 | 18 +- .../libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 | 75 + curl/docs/libcurl/opts/CURLOPT_PROXY_CAPATH.3 | 20 +- .../docs/libcurl/opts/CURLOPT_PROXY_CRLFILE.3 | 13 +- .../libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 | 73 + .../opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 | 85 + .../libcurl/opts/CURLOPT_PROXY_KEYPASSWD.3 | 15 +- .../opts/CURLOPT_PROXY_PINNEDPUBLICKEY.3 | 15 +- .../libcurl/opts/CURLOPT_PROXY_SERVICE_NAME.3 | 5 +- .../docs/libcurl/opts/CURLOPT_PROXY_SSLCERT.3 | 13 +- .../libcurl/opts/CURLOPT_PROXY_SSLCERTTYPE.3 | 13 +- .../libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 | 72 + curl/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY.3 | 11 +- .../libcurl/opts/CURLOPT_PROXY_SSLKEYTYPE.3 | 13 +- .../libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 | 73 + .../libcurl/opts/CURLOPT_PROXY_SSLVERSION.3 | 27 +- .../opts/CURLOPT_PROXY_SSL_CIPHER_LIST.3 | 14 +- .../libcurl/opts/CURLOPT_PROXY_SSL_OPTIONS.3 | 68 +- .../opts/CURLOPT_PROXY_SSL_VERIFYHOST.3 | 24 +- .../opts/CURLOPT_PROXY_SSL_VERIFYPEER.3 | 5 +- .../opts/CURLOPT_PROXY_TLS13_CIPHERS.3 | 69 + .../opts/CURLOPT_PROXY_TLSAUTH_PASSWORD.3 | 7 +- .../libcurl/opts/CURLOPT_PROXY_TLSAUTH_TYPE.3 | 11 +- .../opts/CURLOPT_PROXY_TLSAUTH_USERNAME.3 | 7 +- .../opts/CURLOPT_PROXY_TRANSFER_MODE.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_PUT.3 | 32 +- curl/docs/libcurl/opts/CURLOPT_QUOTE.3 | 38 +- curl/docs/libcurl/opts/CURLOPT_RANDOM_FILE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_RANGE.3 | 19 +- curl/docs/libcurl/opts/CURLOPT_READDATA.3 | 14 +- curl/docs/libcurl/opts/CURLOPT_READFUNCTION.3 | 58 +- .../libcurl/opts/CURLOPT_REDIR_PROTOCOLS.3 | 23 +- curl/docs/libcurl/opts/CURLOPT_REFERER.3 | 16 +- .../libcurl/opts/CURLOPT_REQUEST_TARGET.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_RESOLVE.3 | 43 +- .../opts/CURLOPT_RESOLVER_START_DATA.3 | 63 + .../opts/CURLOPT_RESOLVER_START_FUNCTION.3 | 83 + curl/docs/libcurl/opts/CURLOPT_RESUME_FROM.3 | 9 +- .../libcurl/opts/CURLOPT_RESUME_FROM_LARGE.3 | 9 +- .../libcurl/opts/CURLOPT_RTSP_CLIENT_CSEQ.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_RTSP_REQUEST.3 | 33 +- .../libcurl/opts/CURLOPT_RTSP_SERVER_CSEQ.3 | 9 +- .../libcurl/opts/CURLOPT_RTSP_SESSION_ID.3 | 9 +- .../libcurl/opts/CURLOPT_RTSP_STREAM_URI.3 | 11 +- .../libcurl/opts/CURLOPT_RTSP_TRANSPORT.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 | 64 + curl/docs/libcurl/opts/CURLOPT_SASL_IR.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SEEKDATA.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SERVICE_NAME.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_SHARE.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SOCKOPTDATA.3 | 7 +- .../libcurl/opts/CURLOPT_SOCKOPTFUNCTION.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SOCKS5_AUTH.3 | 9 +- .../libcurl/opts/CURLOPT_SOCKS5_GSSAPI_NEC.3 | 9 +- .../opts/CURLOPT_SOCKS5_GSSAPI_SERVICE.3 | 5 +- .../libcurl/opts/CURLOPT_SSH_AUTH_TYPES.3 | 9 +- .../libcurl/opts/CURLOPT_SSH_COMPRESSION.3 | 9 +- .../opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_SSH_KEYDATA.3 | 5 +- .../libcurl/opts/CURLOPT_SSH_KEYFUNCTION.3 | 18 +- .../libcurl/opts/CURLOPT_SSH_KNOWNHOSTS.3 | 7 +- .../opts/CURLOPT_SSH_PRIVATE_KEYFILE.3 | 9 +- .../libcurl/opts/CURLOPT_SSH_PUBLIC_KEYFILE.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_SSLCERT.3 | 23 +- curl/docs/libcurl/opts/CURLOPT_SSLCERTTYPE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 | 69 + curl/docs/libcurl/opts/CURLOPT_SSLENGINE.3 | 11 +- .../libcurl/opts/CURLOPT_SSLENGINE_DEFAULT.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_SSLKEY.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_SSLKEYTYPE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 | 75 + curl/docs/libcurl/opts/CURLOPT_SSLVERSION.3 | 70 +- .../libcurl/opts/CURLOPT_SSL_CIPHER_LIST.3 | 17 +- curl/docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.3 | 40 +- .../libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.3 | 93 +- .../docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 | 54 + .../libcurl/opts/CURLOPT_SSL_ENABLE_ALPN.3 | 9 +- .../libcurl/opts/CURLOPT_SSL_ENABLE_NPN.3 | 9 +- .../libcurl/opts/CURLOPT_SSL_FALSESTART.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_SSL_OPTIONS.3 | 68 +- .../opts/CURLOPT_SSL_SESSIONID_CACHE.3 | 9 +- .../libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 | 25 +- .../libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 | 17 +- .../libcurl/opts/CURLOPT_SSL_VERIFYSTATUS.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_STDERR.3 | 9 +- .../libcurl/opts/CURLOPT_STREAM_DEPENDS.3 | 9 +- .../libcurl/opts/CURLOPT_STREAM_DEPENDS_E.3 | 9 +- .../docs/libcurl/opts/CURLOPT_STREAM_WEIGHT.3 | 11 +- .../opts/CURLOPT_SUPPRESS_CONNECT_HEADERS.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_TCP_FASTOPEN.3 | 13 +- .../docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 | 11 +- .../docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_TCP_NODELAY.3 | 15 +- .../docs/libcurl/opts/CURLOPT_TELNETOPTIONS.3 | 5 +- curl/docs/libcurl/opts/CURLOPT_TFTP_BLKSIZE.3 | 5 +- .../libcurl/opts/CURLOPT_TFTP_NO_OPTIONS.3 | 11 +- .../docs/libcurl/opts/CURLOPT_TIMECONDITION.3 | 7 +- curl/docs/libcurl/opts/CURLOPT_TIMEOUT.3 | 28 +- curl/docs/libcurl/opts/CURLOPT_TIMEOUT_MS.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_TIMEVALUE.3 | 14 +- .../libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 | 64 + .../docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 | 68 + .../libcurl/opts/CURLOPT_TLSAUTH_PASSWORD.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_TLSAUTH_TYPE.3 | 15 +- .../libcurl/opts/CURLOPT_TLSAUTH_USERNAME.3 | 11 +- curl/docs/libcurl/opts/CURLOPT_TRAILERDATA.3 | 51 + .../libcurl/opts/CURLOPT_TRAILERFUNCTION.3 | 103 + curl/docs/libcurl/opts/CURLOPT_TRANSFERTEXT.3 | 5 +- .../libcurl/opts/CURLOPT_TRANSFER_ENCODING.3 | 7 +- .../libcurl/opts/CURLOPT_UNIX_SOCKET_PATH.3 | 44 +- .../libcurl/opts/CURLOPT_UNRESTRICTED_AUTH.3 | 7 +- .../libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 | 78 + curl/docs/libcurl/opts/CURLOPT_UPLOAD.3 | 11 +- .../libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 | 72 + curl/docs/libcurl/opts/CURLOPT_URL.3 | 251 +- curl/docs/libcurl/opts/CURLOPT_USERAGENT.3 | 13 +- curl/docs/libcurl/opts/CURLOPT_USERNAME.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_USERPWD.3 | 9 +- curl/docs/libcurl/opts/CURLOPT_USE_SSL.3 | 10 +- curl/docs/libcurl/opts/CURLOPT_VERBOSE.3 | 12 +- .../docs/libcurl/opts/CURLOPT_WILDCARDMATCH.3 | 27 +- curl/docs/libcurl/opts/CURLOPT_WRITEDATA.3 | 11 +- .../docs/libcurl/opts/CURLOPT_WRITEFUNCTION.3 | 57 +- curl/docs/libcurl/opts/CURLOPT_XFERINFODATA.3 | 34 +- .../libcurl/opts/CURLOPT_XFERINFOFUNCTION.3 | 43 +- .../libcurl/opts/CURLOPT_XOAUTH2_BEARER.3 | 19 +- curl/docs/libcurl/opts/Makefile.am | 4 +- curl/docs/libcurl/opts/Makefile.in | 991 - curl/docs/libcurl/opts/Makefile.inc | 77 +- curl/docs/libcurl/opts/template.3 | 38 + curl/docs/libcurl/symbols-in-versions | 224 +- curl/docs/libcurl/symbols.pl | 6 +- curl/docs/mk-ca-bundle.1 | 6 +- curl/docs/options-in-versions | 254 + curl/include/Makefile.am | 23 +- curl/include/Makefile.in | 719 - curl/include/README | 33 - curl/include/README.md | 14 + curl/include/curl/.gitignore | 3 + curl/include/curl/Makefile.am | 15 +- curl/include/curl/Makefile.in | 688 - curl/include/curl/curl.h | 1101 +- curl/include/curl/curlver.h | 24 +- curl/include/curl/easy.h | 29 +- curl/include/curl/mprintf.h | 10 +- curl/include/curl/multi.h | 103 +- curl/include/curl/options.h | 68 + curl/include/curl/stdcheaders.h | 10 +- curl/include/curl/system.h | 91 +- curl/include/curl/typecheck-gcc.h | 594 +- curl/include/curl/urlapi.h | 126 + curl/install-sh | 508 - curl/lib/.checksrc | 1 + curl/lib/.gitattributes | 1 + curl/lib/.gitignore | 12 + curl/lib/CMakeLists.txt | 106 +- curl/lib/Makefile.Watcom | 275 - curl/lib/Makefile.am | 51 +- curl/lib/Makefile.b32 | 185 - curl/lib/Makefile.in | 3229 -- curl/lib/Makefile.inc | 367 +- curl/lib/Makefile.m32 | 150 +- curl/lib/Makefile.netware | 280 +- curl/lib/Makefile.vxworks | 21 + curl/lib/altsvc.c | 647 + curl/lib/altsvc.h | 79 + curl/lib/amigaos.c | 61 +- curl/lib/amigaos.h | 11 +- curl/lib/arpa_telnet.h | 8 +- curl/lib/asyn-ares.c | 612 +- curl/lib/asyn-thread.c | 406 +- curl/lib/asyn.h | 56 +- curl/lib/base64.c | 41 +- curl/lib/bufref.c | 127 + curl/{tests/unit/unit1601.c => lib/bufref.h} | 52 +- curl/lib/c-hyper.c | 1094 + curl/lib/c-hyper.h | 57 + curl/lib/checksrc.pl | 364 +- curl/lib/config-amigaos.h | 20 +- curl/lib/config-dos.h | 19 +- curl/lib/config-mac.h | 14 +- curl/lib/config-os400.h | 89 +- curl/lib/config-plan9.h | 198 + curl/lib/config-riscos.h | 79 +- curl/lib/config-symbian.h | 811 - curl/lib/config-tpf.h | 98 +- curl/lib/config-vxworks.h | 118 +- curl/lib/config-win32.h | 95 +- curl/lib/config-win32ce.h | 57 +- curl/lib/conncache.c | 456 +- curl/lib/conncache.h | 83 +- curl/lib/connect.c | 1011 +- curl/lib/connect.h | 41 +- curl/lib/content_encoding.c | 960 +- curl/lib/content_encoding.h | 47 +- curl/lib/cookie.c | 1027 +- curl/lib/cookie.h | 41 +- curl/lib/curl_addrinfo.c | 143 +- curl/lib/curl_addrinfo.h | 32 +- curl/lib/curl_base64.h | 4 +- curl/lib/curl_config.h.cmake | 337 +- curl/lib/curl_config.h.in | 1027 - curl/lib/curl_ctype.c | 133 + curl/lib/curl_ctype.h | 81 + curl/lib/curl_des.c | 4 +- curl/lib/curl_des.h | 4 +- curl/lib/curl_endian.c | 46 +- curl/lib/curl_endian.h | 9 +- curl/lib/curl_fnmatch.c | 375 +- curl/lib/curl_fnmatch.h | 4 +- curl/lib/curl_get_line.c | 60 + curl/lib/curl_get_line.h | 29 + curl/lib/curl_gethostname.c | 6 +- curl/lib/curl_gethostname.h | 6 +- curl/lib/curl_gssapi.c | 25 +- curl/lib/curl_gssapi.h | 18 +- curl/lib/curl_hmac.h | 37 +- curl/lib/{curl_sec.h => curl_krb5.h} | 21 +- curl/lib/curl_ldap.h | 5 +- curl/lib/curl_md4.h | 15 +- curl/lib/curl_md5.h | 32 +- curl/lib/curl_memory.h | 6 +- curl/lib/curl_memrchr.c | 21 +- curl/lib/curl_memrchr.h | 4 +- curl/lib/curl_multibyte.c | 137 +- curl/lib/curl_multibyte.h | 65 +- curl/lib/curl_ntlm_core.c | 322 +- curl/lib/curl_ntlm_core.h | 36 +- curl/lib/curl_ntlm_wb.c | 249 +- curl/lib/curl_ntlm_wb.h | 17 +- curl/lib/curl_path.c | 198 + curl/lib/curl_path.h | 47 + curl/lib/curl_printf.h | 18 +- curl/lib/curl_range.c | 94 + .../server_setup.h => lib/curl_range.h} | 16 +- curl/lib/curl_rtmp.c | 85 +- curl/lib/curl_rtmp.h | 4 +- curl/lib/curl_sasl.c | 383 +- curl/lib/curl_sasl.h | 33 +- curl/lib/curl_setup.h | 373 +- curl/lib/curl_setup_once.h | 91 +- .../server_sockaddr.h => lib/curl_sha256.h} | 33 +- curl/lib/curl_sspi.c | 28 +- curl/lib/curl_sspi.h | 4 +- curl/lib/curl_threads.c | 23 +- curl/lib/curl_threads.h | 7 +- curl/lib/curlx.h | 37 +- curl/lib/dict.c | 143 +- curl/lib/dict.h | 4 +- curl/lib/doh.c | 1014 + curl/lib/doh.h | 109 + curl/lib/dotdot.c | 12 +- curl/lib/dotdot.h | 6 +- curl/lib/dynbuf.c | 255 + curl/lib/dynbuf.h | 88 + curl/lib/easy.c | 622 +- curl/lib/easygetopt.c | 96 + curl/lib/easyif.h | 5 +- curl/lib/easyoptions.c | 359 + curl/lib/{vtls/axtls.h => easyoptions.h} | 23 +- curl/lib/escape.c | 104 +- curl/lib/escape.h | 15 +- curl/lib/file.c | 265 +- curl/lib/file.h | 5 +- curl/lib/fileinfo.c | 12 +- curl/lib/fileinfo.h | 9 +- curl/lib/firefox-db2pem.sh | 5 +- curl/lib/formdata.c | 140 +- curl/lib/formdata.h | 25 +- curl/lib/ftp.c | 2332 +- curl/lib/ftp.h | 29 +- curl/lib/ftplistparser.c | 244 +- curl/lib/ftplistparser.h | 4 +- curl/lib/getenv.c | 49 +- curl/lib/getinfo.c | 175 +- curl/lib/getinfo.h | 4 +- curl/lib/gopher.c | 136 +- curl/lib/gopher.h | 7 +- curl/lib/hash.c | 99 +- curl/lib/hash.h | 52 +- curl/lib/hmac.c | 56 +- curl/lib/hostasyn.c | 70 +- curl/lib/hostcheck.c | 36 +- curl/lib/hostcheck.h | 5 +- curl/lib/hostip.c | 823 +- curl/lib/hostip.h | 108 +- curl/lib/hostip4.c | 319 +- curl/lib/hostip6.c | 126 +- curl/lib/hostsyn.c | 15 +- curl/lib/hsts.c | 544 + curl/lib/hsts.h | 65 + curl/lib/http.c | 3990 +- curl/lib/http.h | 199 +- curl/lib/http2.c | 1430 +- curl/lib/http2.h | 44 +- curl/lib/http_aws_sigv4.c | 394 + curl/lib/{vtls/cyassl.h => http_aws_sigv4.h} | 14 +- curl/lib/http_chunks.c | 154 +- curl/lib/http_chunks.h | 31 +- curl/lib/http_digest.c | 35 +- curl/lib/http_digest.h | 18 +- curl/lib/http_negotiate.c | 146 +- curl/lib/http_negotiate.h | 19 +- curl/lib/http_ntlm.c | 189 +- curl/lib/http_ntlm.h | 20 +- curl/lib/http_proxy.c | 751 +- curl/lib/http_proxy.h | 34 +- curl/lib/idn_win32.c | 12 +- curl/lib/if2ip.c | 82 +- curl/lib/if2ip.h | 8 +- curl/lib/imap.c | 722 +- curl/lib/imap.h | 8 +- curl/lib/inet_ntop.c | 20 +- curl/lib/inet_ntop.h | 5 +- curl/lib/inet_pton.c | 7 +- curl/lib/inet_pton.h | 5 +- curl/lib/krb5.c | 647 +- curl/lib/ldap.c | 280 +- curl/lib/libcurl.plist | 8 +- curl/lib/libcurl.rc | 18 +- curl/lib/llist.c | 77 +- curl/lib/llist.h | 36 +- curl/lib/makefile.amiga | 29 +- curl/lib/makefile.dj | 9 +- curl/lib/md4.c | 341 +- curl/lib/md5.c | 306 +- curl/lib/memdebug.c | 239 +- curl/lib/memdebug.h | 132 +- curl/lib/mime.c | 506 +- curl/lib/mime.h | 85 +- curl/lib/mk-ca-bundle.pl | 83 +- curl/lib/mk-ca-bundle.vbs | 6 +- curl/lib/mprintf.c | 158 +- curl/lib/mqtt.c | 794 + curl/lib/mqtt.h | 59 + curl/lib/multi.c | 2610 +- curl/lib/multihandle.h | 128 +- curl/lib/multiif.h | 41 +- curl/lib/netrc.c | 240 +- curl/lib/netrc.h | 13 +- curl/lib/non-ascii.c | 46 +- curl/lib/non-ascii.h | 4 +- curl/lib/nonblock.c | 11 +- curl/lib/nonblock.h | 5 +- curl/lib/nwlib.c | 48 +- curl/lib/nwos.c | 4 +- curl/lib/objnames-test08.sh | 217 - curl/lib/objnames-test10.sh | 217 - curl/lib/objnames.inc | 107 - curl/lib/openldap.c | 322 +- curl/lib/optiontable.pl | 118 + curl/lib/parsedate.c | 204 +- curl/lib/parsedate.h | 11 +- curl/lib/pingpong.c | 170 +- curl/lib/pingpong.h | 64 +- curl/lib/pipeline.c | 403 - curl/lib/pipeline.h | 56 - curl/lib/pop3.c | 515 +- curl/lib/pop3.h | 8 +- curl/lib/progress.c | 568 +- curl/lib/progress.h | 35 +- curl/lib/psl.c | 111 + curl/{tests/libtest/testtrace.h => lib/psl.h} | 34 +- curl/lib/quic.h | 62 + curl/lib/rand.c | 19 +- curl/lib/rand.h | 14 +- curl/lib/rename.c | 71 + curl/lib/rename.h | 27 + curl/lib/rtsp.c | 339 +- curl/lib/rtsp.h | 11 +- curl/lib/security.c | 588 - curl/lib/select.c | 517 +- curl/lib/select.h | 50 +- curl/lib/sendf.c | 488 +- curl/lib/sendf.h | 28 +- curl/lib/setopt.c | 3039 ++ curl/lib/setopt.h | 30 + curl/lib/setup-os400.h | 14 +- curl/lib/setup-vms.h | 16 +- curl/lib/setup-win32.h | 122 + curl/lib/sha256.c | 488 + curl/lib/share.c | 36 +- curl/lib/share.h | 19 +- curl/lib/sigpipe.h | 7 +- curl/lib/slist.c | 5 +- curl/lib/slist.h | 5 +- curl/lib/smb.c | 409 +- curl/lib/smb.h | 46 +- curl/lib/smtp.c | 818 +- curl/lib/smtp.h | 13 +- curl/lib/sockaddr.h | 5 +- curl/lib/socketpair.c | 137 + curl/lib/socketpair.h | 33 + curl/lib/socks.c | 1313 +- curl/lib/socks.h | 40 +- curl/lib/socks_gssapi.c | 53 +- curl/lib/socks_sspi.c | 68 +- curl/lib/speedcheck.c | 10 +- curl/lib/speedcheck.h | 4 +- curl/lib/splay.c | 32 +- curl/lib/splay.h | 22 +- curl/lib/strcase.c | 90 +- curl/lib/strcase.h | 6 +- curl/lib/strdup.c | 41 +- curl/lib/strdup.h | 7 +- curl/lib/strerror.c | 650 +- curl/lib/strerror.h | 14 +- curl/lib/strtok.c | 6 +- curl/lib/strtok.h | 4 +- curl/lib/strtoofft.c | 6 +- curl/lib/strtoofft.h | 12 +- curl/lib/system_win32.c | 316 +- curl/lib/system_win32.h | 41 +- curl/lib/telnet.c | 469 +- curl/lib/telnet.h | 5 +- curl/lib/tftp.c | 478 +- curl/lib/tftp.h | 5 +- curl/lib/timeval.c | 156 +- curl/lib/timeval.h | 33 +- curl/lib/transfer.c | 1366 +- curl/lib/transfer.h | 48 +- curl/lib/url.c | 6296 +-- curl/lib/url.h | 64 +- .../server/getpart.h => lib/urlapi-int.h} | 24 +- curl/lib/urlapi.c | 1575 + curl/lib/urldata.h | 1383 +- curl/lib/vauth/cleartext.c | 115 +- curl/lib/vauth/cram.c | 71 +- curl/lib/vauth/digest.c | 312 +- curl/lib/vauth/digest.h | 10 +- curl/lib/vauth/digest_sspi.c | 115 +- curl/lib/vauth/gsasl.c | 124 + curl/lib/vauth/krb5_gssapi.c | 198 +- curl/lib/vauth/krb5_sspi.c | 212 +- curl/lib/vauth/ntlm.c | 411 +- curl/lib/vauth/ntlm.h | 10 +- curl/lib/vauth/ntlm_sspi.c | 160 +- curl/lib/vauth/oauth2.c | 69 +- curl/lib/vauth/spnego_gssapi.c | 25 +- curl/lib/vauth/spnego_sspi.c | 104 +- curl/lib/vauth/vauth.c | 71 +- curl/lib/vauth/vauth.h | 106 +- curl/lib/version.c | 415 +- curl/lib/version_win32.c | 226 + curl/lib/version_win32.h | 53 + curl/lib/vquic/ngtcp2.c | 1888 + curl/lib/vquic/ngtcp2.h | 66 + curl/lib/vquic/quiche.c | 884 + .../chkhostname.c => lib/vquic/quiche.h} | 47 +- curl/lib/vquic/vquic.c | 85 + curl/lib/vquic/vquic.h | 34 + curl/lib/vssh/libssh.c | 2947 ++ curl/lib/{ssh.c => vssh/libssh2.c} | 2014 +- curl/lib/{ => vssh}/ssh.h | 114 +- curl/lib/vssh/wolfssh.c | 1169 + curl/lib/vssh/wolfssh.h | 27 + curl/lib/vtls/axtls.c | 742 - curl/lib/vtls/bearssl.c | 921 + curl/lib/vtls/bearssl.h | 32 + curl/lib/vtls/darwinssl.c | 3020 -- curl/lib/vtls/gskit.c | 361 +- curl/lib/vtls/gskit.h | 4 +- curl/lib/vtls/gtls.c | 1034 +- curl/lib/vtls/gtls.h | 4 +- curl/lib/vtls/keylog.c | 156 + curl/lib/vtls/keylog.h | 56 + curl/lib/vtls/mbedtls.c | 586 +- curl/lib/vtls/mbedtls.h | 4 +- curl/lib/vtls/mbedtls_threadlock.c | 133 + ...rssl_threadlock.h => mbedtls_threadlock.h} | 39 +- curl/lib/vtls/mesalink.c | 674 + curl/lib/vtls/mesalink.h | 32 + curl/lib/vtls/nss.c | 723 +- curl/lib/vtls/nssg.h | 4 +- curl/lib/vtls/openssl.c | 2699 +- curl/lib/vtls/openssl.h | 4 +- curl/lib/vtls/polarssl.c | 937 - curl/lib/vtls/polarssl_threadlock.c | 153 - curl/lib/vtls/rustls.c | 575 + curl/lib/vtls/rustls.h | 33 + curl/lib/vtls/schannel.c | 1774 +- curl/lib/vtls/schannel.h | 82 +- curl/lib/vtls/schannel_verify.c | 744 + curl/lib/vtls/sectransp.c | 3510 ++ curl/lib/vtls/{darwinssl.h => sectransp.h} | 16 +- curl/lib/vtls/vtls.c | 559 +- curl/lib/vtls/vtls.h | 181 +- curl/lib/vtls/{cyassl.c => wolfssl.c} | 771 +- curl/lib/vtls/{polarssl.h => wolfssl.h} | 17 +- curl/lib/warnless.c | 167 +- curl/lib/warnless.h | 26 +- curl/lib/wildcard.c | 26 +- curl/lib/wildcard.h | 24 +- curl/lib/x509asn1.c | 636 +- curl/lib/x509asn1.h | 82 +- curl/libcurl.pc.in | 8 +- curl/ltmain.sh | 11156 ---- curl/m4/.gitignore | 6 + curl/m4/ax_code_coverage.m4 | 264 - curl/m4/ax_compile_check_sizeof.m4 | 115 + curl/m4/curl-amissl.m4 | 47 + curl/m4/curl-bearssl.m4 | 108 + curl/m4/curl-compilers.m4 | 271 +- curl/m4/curl-confopts.m4 | 132 +- curl/m4/curl-functions.m4 | 1462 +- curl/m4/curl-gnutls.m4 | 165 + curl/m4/curl-mbedtls.m4 | 109 + curl/m4/curl-mesalink.m4 | 107 + curl/m4/curl-nss.m4 | 142 + curl/m4/curl-openssl.m4 | 435 +- curl/m4/curl-override.m4 | 22 +- curl/m4/curl-reentrant.m4 | 117 +- curl/m4/curl-rustls.m4 | 106 + curl/m4/curl-schannel.m4 | 46 + curl/m4/curl-sectransp.m4 | 43 + curl/m4/curl-sysconfig.m4 | 52 + curl/m4/curl-wolfssl.m4 | 175 + curl/m4/libtool.m4 | 8387 --- curl/m4/ltoptions.m4 | 437 - curl/m4/ltsugar.m4 | 124 - curl/m4/ltversion.m4 | 23 - curl/m4/lt~obsolete.m4 | 99 - curl/m4/xc-am-iface.m4 | 3 +- curl/m4/xc-cc-check.m4 | 3 +- curl/m4/xc-lt-iface.m4 | 3 +- curl/m4/xc-translit.m4 | 3 +- curl/m4/xc-val-flgs.m4 | 3 +- curl/m4/zz40-xc-ovr.m4 | 13 +- curl/m4/zz50-xc-ovr.m4 | 3 +- curl/m4/zz60-xc-ovr.m4 | 3 +- curl/maketgz | 58 +- curl/missing | 215 - curl/packages/AIX/Makefile.am | 3 - curl/packages/AIX/Makefile.in | 716 - curl/packages/AIX/RPM/Makefile.am | 2 - curl/packages/AIX/RPM/Makefile.in | 537 - curl/packages/AIX/RPM/README | 33 - curl/packages/AIX/RPM/curl.spec.in | 134 - curl/packages/Android/Android.mk | 38 +- curl/packages/DOS/README | 10 +- curl/packages/DOS/common.dj | 135 +- curl/packages/EPM/Makefile.am | 3 - curl/packages/EPM/Makefile.in | 538 - curl/packages/EPM/README | 12 - curl/packages/EPM/curl.list.in | 60 - curl/packages/Linux/Makefile.am | 1 - curl/packages/Linux/Makefile.in | 715 - curl/packages/Linux/RPM/Makefile.am | 2 - curl/packages/Linux/RPM/Makefile.in | 540 - curl/packages/Linux/RPM/README | 5 - curl/packages/Linux/RPM/curl-ssl.spec.in | 85 - curl/packages/Linux/RPM/curl.spec.in | 84 - curl/packages/Linux/RPM/make_curl_rpm | 62 - curl/packages/Makefile.am | 82 +- curl/packages/Makefile.in | 747 - curl/packages/NetWare/get_exp.awk | 72 - curl/packages/NetWare/get_ver.awk | 44 - curl/packages/OS400/README.OS400 | 39 +- curl/packages/OS400/ccsidcurl.c | 491 +- curl/packages/OS400/ccsidcurl.h | 91 +- curl/packages/OS400/chkstrings.c | 62 + curl/packages/OS400/curl.inc.in | 698 +- curl/packages/OS400/initscript.sh | 21 + curl/packages/OS400/make-include.sh | 21 + curl/packages/OS400/make-lib.sh | 41 + curl/packages/OS400/make-src.sh | 21 + curl/packages/OS400/make-tests.sh | 21 + curl/packages/OS400/makefile.sh | 23 +- curl/packages/OS400/os400sys.c | 716 +- curl/packages/OS400/os400sys.h | 4 +- curl/packages/Solaris/Makefile.am | 38 - curl/packages/Solaris/Makefile.in | 568 - curl/packages/Symbian/bwins/libcurlu.def | 61 - curl/packages/Symbian/eabi/libcurlu.def | 61 - curl/packages/Symbian/group/bld.inf | 10 - curl/packages/Symbian/group/curl.iby | 15 - curl/packages/Symbian/group/curl.mmp | 64 - curl/packages/Symbian/group/curl.pkg | 26 - curl/packages/Symbian/group/libcurl.iby | 14 - curl/packages/Symbian/group/libcurl.mmp | 67 - curl/packages/Symbian/group/libcurl.pkg | 22 - curl/packages/Symbian/readme.txt | 93 - curl/packages/TPF/curl.mak | 22 +- curl/packages/TPF/maketpf.env_curl | 22 +- curl/packages/TPF/maketpf.env_curllib | 22 +- curl/packages/Win32/Makefile.am | 3 - curl/packages/Win32/Makefile.in | 716 - curl/packages/Win32/README | 53 - curl/packages/Win32/cygwin/Makefile.am | 62 - curl/packages/Win32/cygwin/Makefile.in | 596 - curl/packages/Win32/cygwin/README | 114 - curl/packages/vms/Makefile.am | 21 + curl/packages/vms/Makefile.in | 571 - curl/packages/vms/backup_gnv_curl_src.com | 2 +- curl/packages/vms/build_gnv_curl.com | 2 +- .../packages/vms/build_gnv_curl_pcsi_desc.com | 4 +- .../packages/vms/build_gnv_curl_pcsi_text.com | 2 +- .../vms/build_gnv_curl_release_notes.com | 2 +- curl/packages/vms/build_libcurl_pc.com | 2 +- curl/packages/vms/build_vms.com | 2 +- curl/packages/vms/clean_gnv_curl.com | 5 +- curl/packages/vms/compare_curl_source.com | 4 +- curl/packages/vms/config_h.com | 51 +- curl/packages/vms/curl_crtl_init.c | 24 +- curl/packages/vms/curl_gnv_build_steps.txt | 8 +- curl/packages/vms/curl_startup.com | 2 +- curl/packages/vms/curlmsg.h | 4 +- curl/packages/vms/curlmsg.msg | 21 + curl/packages/vms/curlmsg_vms.h | 4 +- .../vms/generate_config_vms_h_curl.com | 31 +- curl/packages/vms/generate_vax_transfer.com | 2 +- curl/packages/vms/gnv_conftest.c_first | 3 +- curl/packages/vms/gnv_curl_configure.sh | 2 +- curl/packages/vms/gnv_libcurl_symbols.opt | 2 +- curl/packages/vms/gnv_link_curl.com | 6 +- curl/packages/vms/make_gnv_curl_install.sh | 2 +- curl/packages/vms/make_pcsi_curl_kit_name.com | 2 +- curl/packages/vms/pcsi_gnv_curl_file_list.txt | 2 +- curl/packages/vms/pcsi_product_gnv_curl.com | 2 +- curl/packages/vms/readme | 8 +- curl/packages/vms/setup_gnv_curl_build.com | 6 +- curl/packages/vms/stage_curl_install.com | 2 +- curl/packages/vms/vms_eco_level.h | 2 +- curl/plan9/README | 55 + curl/plan9/include/mkfile | 34 + curl/plan9/lib/mkfile | 39 + .../Makefile.am => plan9/lib/mkfile.inc} | 14 +- curl/{tests/valgrind.pm => plan9/mkfile} | 26 +- curl/plan9/mkfile.proto | 30 + .../extern-scan.pl => plan9/src/mkfile} | 67 +- curl/plan9/src/mkfile.inc | 25 + curl/projects/README | 27 +- curl/projects/Windows/.gitattributes | 1 + curl/projects/Windows/.gitignore | 6 + curl/projects/Windows/VC10/.gitignore | 4 + curl/projects/Windows/VC10/lib/.gitignore | 6 + .../lib/{libcurl.vcxproj => libcurl.tmpl} | 544 +- curl/projects/Windows/VC10/src/.gitignore | 6 + .../VC10/src/{curl.vcxproj => curl.tmpl} | 239 +- curl/projects/Windows/VC11/.gitignore | 4 + curl/projects/Windows/VC11/lib/.gitignore | 6 + .../lib/{libcurl.vcxproj => libcurl.tmpl} | 544 +- curl/projects/Windows/VC11/src/.gitignore | 6 + .../VC11/src/{curl.vcxproj => curl.tmpl} | 239 +- curl/projects/Windows/VC12/.gitignore | 4 + curl/projects/Windows/VC12/lib/.gitignore | 6 + .../lib/{libcurl.vcxproj => libcurl.tmpl} | 544 +- curl/projects/Windows/VC12/src/.gitignore | 6 + .../VC12/src/{curl.vcxproj => curl.tmpl} | 239 +- curl/projects/Windows/VC14/.gitignore | 5 + curl/projects/Windows/VC14/lib/.gitignore | 6 + .../lib/{libcurl.vcxproj => libcurl.tmpl} | 544 +- curl/projects/Windows/VC14/src/.gitignore | 6 + .../VC14/src/{curl.vcxproj => curl.tmpl} | 239 +- curl/projects/Windows/VC15/.gitignore | 5 + curl/projects/Windows/VC15/curl-all.sln | 298 + curl/projects/Windows/VC15/lib/.gitignore | 6 + curl/projects/Windows/VC15/lib/libcurl.sln | 181 + curl/projects/Windows/VC15/lib/libcurl.tmpl | 2373 + .../Windows/VC15/lib/libcurl.vcxproj.filters | 17 + curl/projects/Windows/VC15/src/.gitignore | 6 + curl/projects/Windows/VC15/src/curl.sln | 181 + curl/projects/Windows/VC15/src/curl.tmpl | 2671 + .../Windows/VC15/src/curl.vcxproj.filters | 17 + curl/projects/Windows/VC6/.gitignore | 2 + curl/projects/Windows/VC6/curl-all.dsw | 88 +- curl/projects/Windows/VC6/lib/.gitignore | 5 + curl/projects/Windows/VC6/lib/libcurl.dsw | 58 +- .../VC6/lib/{libcurl.dsp => libcurl.tmpl} | 1047 +- curl/projects/Windows/VC6/src/.gitignore | 5 + curl/projects/Windows/VC6/src/curl.dsw | 58 +- .../Windows/VC6/src/{curl.dsp => curl.tmpl} | 389 +- curl/projects/Windows/VC7.1/.gitignore | 2 + curl/projects/Windows/VC7.1/lib/.gitignore | 3 + .../lib/{libcurl.vcproj => libcurl.tmpl} | 796 +- curl/projects/Windows/VC7.1/src/.gitignore | 3 + .../VC7.1/src/{curl.vcproj => curl.tmpl} | 285 +- curl/projects/Windows/VC7/.gitignore | 1 + curl/projects/Windows/VC7/lib/.gitignore | 2 + .../VC7/lib/{libcurl.vcproj => libcurl.tmpl} | 796 +- curl/projects/Windows/VC7/src/.gitignore | 2 + .../VC7/src/{curl.vcproj => curl.tmpl} | 285 +- curl/projects/Windows/VC8/.gitignore | 2 + curl/projects/Windows/VC8/lib/.gitignore | 4 + .../VC8/lib/{libcurl.vcproj => libcurl.tmpl} | 1063 +- curl/projects/Windows/VC8/src/.gitignore | 4 + .../VC8/src/{curl.vcproj => curl.tmpl} | 389 +- curl/projects/Windows/VC9/.gitignore | 2 + curl/projects/Windows/VC9/lib/.gitignore | 4 + .../VC9/lib/{libcurl.vcproj => libcurl.tmpl} | 1159 +- curl/projects/Windows/VC9/src/.gitignore | 4 + .../VC9/src/{curl.vcproj => curl.tmpl} | 389 +- curl/projects/build-openssl.bat | 761 +- curl/projects/build-wolfssl.bat | 77 +- curl/projects/checksrc.bat | 40 +- curl/projects/generate.bat | 55 +- curl/projects/wolfssl_options.h | 24 +- curl/projects/wolfssl_override.props | 2 +- curl/scripts/Makefile.am | 26 +- curl/scripts/Makefile.in | 570 - curl/scripts/completion.pl | 155 + curl/scripts/contributors.sh | 98 + curl/scripts/contrithanks.sh | 76 + curl/scripts/copyright.pl | 186 + curl/scripts/coverage.sh | 21 + curl/scripts/delta | 142 + curl/scripts/installcheck.sh | 48 + curl/scripts/log2changes.pl | 102 + curl/scripts/release-notes.pl | 214 + curl/scripts/singleuse.pl | 218 + curl/scripts/updatemanpages.pl | 6 +- curl/scripts/zsh.pl | 89 - curl/scripts/zuul/before_script.sh | 188 + curl/scripts/zuul/iconv-env.sh | 22 + curl/scripts/zuul/script.sh | 182 + curl/src/.gitignore | 10 + curl/src/CMakeLists.txt | 59 +- curl/src/Makefile.Watcom | 234 - curl/src/Makefile.am | 74 +- curl/src/Makefile.b32 | 154 - curl/src/Makefile.in | 2137 - curl/src/Makefile.inc | 205 +- curl/src/Makefile.m32 | 163 +- curl/src/Makefile.netware | 290 +- curl/src/curl.rc | 66 +- curl/src/macos/src/macos_main.cpp | 2 +- curl/src/makefile.amiga | 40 +- curl/src/makefile.dj | 29 +- curl/src/mkhelp.pl | 27 +- curl/src/slist_wc.c | 4 +- curl/src/slist_wc.h | 5 +- curl/src/tool_binmode.c | 5 +- curl/src/tool_binmode.h | 5 +- curl/src/tool_bname.c | 5 +- curl/src/tool_bname.h | 5 +- curl/src/tool_cb_dbg.c | 26 +- curl/src/tool_cb_dbg.h | 5 +- curl/src/tool_cb_hdr.c | 113 +- curl/src/tool_cb_hdr.h | 8 +- curl/src/tool_cb_prg.c | 235 +- curl/src/tool_cb_prg.h | 8 +- curl/src/tool_cb_rea.c | 30 +- curl/src/tool_cb_rea.h | 15 +- curl/src/tool_cb_see.c | 16 +- curl/src/tool_cb_see.h | 14 +- curl/src/tool_cb_wrt.c | 112 +- curl/src/tool_cb_wrt.h | 8 +- curl/src/tool_cfgable.c | 38 +- curl/src/tool_cfgable.h | 87 +- curl/src/tool_convert.c | 19 +- curl/src/tool_convert.h | 5 +- curl/src/tool_dirhie.c | 42 +- curl/src/tool_dirhie.h | 5 +- curl/src/tool_doswin.c | 194 +- curl/src/tool_doswin.h | 10 +- curl/src/tool_easysrc.c | 10 +- curl/src/tool_easysrc.h | 4 +- curl/src/tool_filetime.c | 158 + .../sethostname.h => src/tool_filetime.h} | 34 +- curl/src/tool_formparse.c | 822 +- curl/src/tool_formparse.h | 48 +- curl/src/tool_getparam.c | 664 +- curl/src/tool_getparam.h | 8 +- curl/src/tool_getpass.c | 22 +- curl/src/tool_getpass.h | 4 +- curl/src/tool_help.c | 947 +- curl/src/tool_help.h | 9 +- curl/src/tool_helpers.c | 10 +- curl/src/tool_helpers.h | 5 +- curl/src/tool_homedir.c | 105 +- curl/src/tool_homedir.h | 6 +- curl/src/tool_hugehelp.c | 10083 +--- .../unit1330.c => src/tool_hugehelp.c.cvs} | 24 +- curl/src/tool_hugehelp.h | 4 +- curl/src/tool_libinfo.c | 10 +- curl/src/tool_libinfo.h | 5 +- curl/src/tool_main.c | 80 +- curl/src/tool_main.h | 8 +- curl/src/tool_metalink.c | 981 - curl/src/tool_metalink.h | 167 - curl/src/tool_msgs.c | 34 +- curl/src/tool_msgs.h | 7 +- curl/src/tool_operate.c | 2557 +- curl/src/tool_operate.h | 58 +- curl/src/tool_operhlp.c | 50 +- curl/src/tool_operhlp.h | 7 +- curl/src/tool_panykey.c | 13 +- curl/src/tool_panykey.h | 11 +- curl/src/tool_paramhlp.c | 168 +- curl/src/tool_paramhlp.h | 8 +- curl/src/tool_parsecfg.c | 225 +- curl/src/tool_parsecfg.h | 5 +- curl/src/tool_progress.c | 332 + .../sethostname.c => src/tool_progress.h} | 34 +- curl/src/tool_sdecls.h | 16 +- curl/src/tool_setopt.c | 565 +- curl/src/tool_setopt.h | 97 +- curl/src/tool_setup.h | 5 +- curl/src/tool_sleep.c | 7 +- curl/src/tool_sleep.h | 5 +- curl/src/tool_strdup.c | 15 +- curl/src/tool_strdup.h | 4 +- curl/src/tool_urlglob.c | 182 +- curl/src/tool_urlglob.h | 23 +- curl/src/tool_util.c | 51 +- curl/src/tool_util.h | 5 +- curl/src/tool_version.h | 6 +- curl/src/tool_vms.c | 15 +- curl/src/tool_vms.h | 5 +- curl/src/tool_writeout.c | 563 +- curl/src/tool_writeout.h | 63 +- curl/src/tool_writeout_json.c | 91 + curl/src/tool_writeout_json.h | 32 + curl/src/tool_xattr.c | 74 +- curl/src/tool_xattr.h | 4 +- curl/test-driver | 148 - curl/tests/CMakeLists.txt | 4 - curl/tests/FILEFORMAT | 454 - curl/tests/Makefile.am | 124 - curl/tests/Makefile.in | 828 - curl/tests/README | 289 - curl/tests/certs/EdelCurlRoot-ca.cacert | 84 - curl/tests/certs/EdelCurlRoot-ca.cnf | 11 - curl/tests/certs/EdelCurlRoot-ca.crt | 84 - curl/tests/certs/EdelCurlRoot-ca.csr | 17 - curl/tests/certs/EdelCurlRoot-ca.der | Bin 918 -> 0 bytes curl/tests/certs/EdelCurlRoot-ca.key | 27 - curl/tests/certs/EdelCurlRoot-ca.prm | 18 - curl/tests/certs/Makefile.am | 91 - curl/tests/certs/Makefile.in | 804 - curl/tests/certs/Server-localhost-sv.crl | 21 - curl/tests/certs/Server-localhost-sv.crt | 80 - curl/tests/certs/Server-localhost-sv.csr | 11 - curl/tests/certs/Server-localhost-sv.der | Bin 835 -> 0 bytes curl/tests/certs/Server-localhost-sv.dhp | 0 curl/tests/certs/Server-localhost-sv.key | 15 - curl/tests/certs/Server-localhost-sv.pem | 120 - curl/tests/certs/Server-localhost-sv.prm | 25 - curl/tests/certs/Server-localhost-sv.pub.der | Bin 162 -> 0 bytes curl/tests/certs/Server-localhost-sv.pub.pem | 6 - curl/tests/certs/Server-localhost.nn-sv.crl | 21 - curl/tests/certs/Server-localhost.nn-sv.crt | 80 - curl/tests/certs/Server-localhost.nn-sv.csr | 11 - curl/tests/certs/Server-localhost.nn-sv.der | Bin 841 -> 0 bytes curl/tests/certs/Server-localhost.nn-sv.dhp | 0 curl/tests/certs/Server-localhost.nn-sv.key | 15 - curl/tests/certs/Server-localhost.nn-sv.pem | 120 - curl/tests/certs/Server-localhost.nn-sv.prm | 25 - .../certs/Server-localhost.nn-sv.pub.der | Bin 162 -> 0 bytes .../certs/Server-localhost.nn-sv.pub.pem | 6 - curl/tests/certs/Server-localhost0h-sv.crl | 22 - curl/tests/certs/Server-localhost0h-sv.crt | 80 - curl/tests/certs/Server-localhost0h-sv.csr | 11 - curl/tests/certs/Server-localhost0h-sv.der | Bin 837 -> 0 bytes curl/tests/certs/Server-localhost0h-sv.dhp | 0 curl/tests/certs/Server-localhost0h-sv.key | 15 - curl/tests/certs/Server-localhost0h-sv.pem | 121 - curl/tests/certs/Server-localhost0h-sv.prm | 26 - .../tests/certs/Server-localhost0h-sv.pub.der | Bin 162 -> 0 bytes .../tests/certs/Server-localhost0h-sv.pub.pem | 6 - curl/tests/certs/scripts/Makefile.in | 562 - curl/tests/certs/scripts/genroot.sh | 66 - curl/tests/certs/scripts/genserv.sh | 118 - curl/tests/certs/srp-verifier-conf | 3 - curl/tests/certs/srp-verifier-db | 2 - curl/tests/curl_test_data.py | 61 - curl/tests/data/CMakeLists.txt | 7 - curl/tests/data/DISABLED | 22 - curl/tests/data/Makefile.am | 29 - curl/tests/data/Makefile.in | 752 - curl/tests/data/Makefile.inc | 189 - curl/tests/data/test1 | 55 - curl/tests/data/test10 | 67 - curl/tests/data/test100 | 57 - curl/tests/data/test1000 | 42 - curl/tests/data/test1001 | 107 - curl/tests/data/test1002 | 117 - curl/tests/data/test1003 | 48 - curl/tests/data/test1004 | 59 - curl/tests/data/test1005 | 48 - curl/tests/data/test1006 | 49 - curl/tests/data/test1007 | 42 - curl/tests/data/test1008 | 133 - curl/tests/data/test1009 | 47 - curl/tests/data/test101 | 58 - curl/tests/data/test1010 | 58 - curl/tests/data/test1011 | 76 - curl/tests/data/test1012 | 79 - curl/tests/data/test1013 | 37 - curl/tests/data/test1014 | 37 - curl/tests/data/test1015 | 55 - curl/tests/data/test1016 | 39 - curl/tests/data/test1017 | 40 - curl/tests/data/test1018 | 39 - curl/tests/data/test1019 | 42 - curl/tests/data/test102 | 52 - curl/tests/data/test1020 | 42 - curl/tests/data/test1021 | 141 - curl/tests/data/test1022 | 37 - curl/tests/data/test1023 | 37 - curl/tests/data/test1024 | 103 - curl/tests/data/test1025 | 105 - curl/tests/data/test1026 | 39 - curl/tests/data/test1027 | 39 - curl/tests/data/test1028 | 94 - curl/tests/data/test1029 | 58 - curl/tests/data/test103 | 54 - curl/tests/data/test1030 | 110 - curl/tests/data/test1031 | 76 - curl/tests/data/test1032 | 56 - curl/tests/data/test1033 | 60 - curl/tests/data/test1034 | 70 - curl/tests/data/test1035 | 63 - curl/tests/data/test1036 | 61 - curl/tests/data/test1037 | 54 - curl/tests/data/test1038 | 53 - curl/tests/data/test1039 | 53 - curl/tests/data/test104 | 43 - curl/tests/data/test1040 | 79 - curl/tests/data/test1041 | 78 - curl/tests/data/test1042 | 94 - curl/tests/data/test1043 | 84 - curl/tests/data/test1044 | 58 - curl/tests/data/test1045 | 52 - curl/tests/data/test1046 | 60 - curl/tests/data/test1047 | 58 - curl/tests/data/test1048 | 68 - curl/tests/data/test1049 | 47 - curl/tests/data/test105 | 53 - curl/tests/data/test1050 | 66 - curl/tests/data/test1051 | 118 - curl/tests/data/test1052 | 111 - curl/tests/data/test1053 | 127 - curl/tests/data/test1054 | 80 - curl/tests/data/test1055 | 100 - curl/tests/data/test1056 | 81 - curl/tests/data/test1057 | 52 - curl/tests/data/test1058 | 53 - curl/tests/data/test1059 | 58 - curl/tests/data/test106 | 52 - curl/tests/data/test1060 | 902 - curl/tests/data/test1061 | 907 - curl/tests/data/test1062 | 49 - curl/tests/data/test1063 | 45 - curl/tests/data/test1064 | 79 - curl/tests/data/test1065 | 78 - curl/tests/data/test1066 | 82 - curl/tests/data/test1067 | 78 - curl/tests/data/test1068 | 58 - curl/tests/data/test1069 | 36 - curl/tests/data/test107 | 51 - curl/tests/data/test1070 | 65 - curl/tests/data/test1071 | 114 - curl/tests/data/test1072 | 78 - curl/tests/data/test1073 | 72 - curl/tests/data/test1074 | 76 - curl/tests/data/test1075 | 94 - curl/tests/data/test1076 | 79 - curl/tests/data/test1077 | 75 - curl/tests/data/test1078 | 96 - curl/tests/data/test1079 | 76 - curl/tests/data/test108 | 56 - curl/tests/data/test1080 | 69 - curl/tests/data/test1081 | 77 - curl/tests/data/test1082 | 55 - curl/tests/data/test1083 | 59 - curl/tests/data/test1084 | 41 - curl/tests/data/test1085 | 48 - curl/tests/data/test1086 | 110 - curl/tests/data/test1087 | 110 - curl/tests/data/test1088 | 112 - curl/tests/data/test1089 | 91 - curl/tests/data/test109 | 48 - curl/tests/data/test1090 | 98 - curl/tests/data/test1091 | 46 - curl/tests/data/test1092 | 56 - curl/tests/data/test1093 | 47 - curl/tests/data/test1094 | 53 - curl/tests/data/test1095 | 84 - curl/tests/data/test1096 | 50 - curl/tests/data/test1097 | 80 - curl/tests/data/test1098 | 73 - curl/tests/data/test1099 | 51 - curl/tests/data/test11 | 76 - curl/tests/data/test110 | 52 - curl/tests/data/test1100 | 118 - curl/tests/data/test1101 | 54 - curl/tests/data/test1102 | 51 - curl/tests/data/test1103 | 48 - curl/tests/data/test1104 | 85 - curl/tests/data/test1105 | 65 - curl/tests/data/test1106 | 57 - curl/tests/data/test1107 | 53 - curl/tests/data/test1108 | 45 - curl/tests/data/test1109 | 46 - curl/tests/data/test111 | 45 - curl/tests/data/test1110 | 47 - curl/tests/data/test1111 | 47 - curl/tests/data/test1112 | 114 - curl/tests/data/test1113 | 99 - curl/tests/data/test1114 | 136 - curl/tests/data/test1115 | 52 - curl/tests/data/test1116 | 77 - curl/tests/data/test1117 | 87 - curl/tests/data/test1118 | 55 - curl/tests/data/test1119 | 25 - curl/tests/data/test112 | 49 - curl/tests/data/test1120 | 44 - curl/tests/data/test1121 | 47 - curl/tests/data/test1122 | 70 - curl/tests/data/test1123 | 201 - curl/tests/data/test1124 | 69 - curl/tests/data/test1125 | 70 - curl/tests/data/test1126 | 52 - curl/tests/data/test1127 | 61 - curl/tests/data/test1128 | 85 - curl/tests/data/test1129 | 97 - curl/tests/data/test113 | 37 - curl/tests/data/test1130 | 97 - curl/tests/data/test1131 | 95 - curl/tests/data/test1132 | 25 - curl/tests/data/test1133 | 95 - curl/tests/data/test1134 | 65 - curl/tests/data/test1135 | 108 - curl/tests/data/test1136 | 64 - curl/tests/data/test1137 | 52 - curl/tests/data/test1138 | 74 - curl/tests/data/test1139 | 27 - curl/tests/data/test114 | 38 - curl/tests/data/test1140 | 26 - curl/tests/data/test1141 | 70 - curl/tests/data/test1142 | 64 - curl/tests/data/test1143 | 45 - curl/tests/data/test1144 | 69 - curl/tests/data/test1145 | 40 - curl/tests/data/test1146 | 45 - curl/tests/data/test1147 | 64 - curl/tests/data/test1148 | 57 - curl/tests/data/test1149 | 64 - curl/tests/data/test115 | 44 - curl/tests/data/test1150 | 55 - curl/tests/data/test1151 | 66 - curl/tests/data/test1152 | 61 - curl/tests/data/test1153 | 61 - curl/tests/data/test116 | 55 - curl/tests/data/test1160 | 49 - curl/tests/data/test1161 | 54 - curl/tests/data/test117 | 44 - curl/tests/data/test118 | 48 - curl/tests/data/test119 | 50 - curl/tests/data/test12 | 56 - curl/tests/data/test120 | 53 - curl/tests/data/test1200 | 39 - curl/tests/data/test1201 | 39 - curl/tests/data/test1202 | 40 - curl/tests/data/test1203 | 43 - curl/tests/data/test1204 | 79 - curl/tests/data/test1205 | 50 - curl/tests/data/test1206 | 53 - curl/tests/data/test1207 | 53 - curl/tests/data/test1208 | 57 - curl/tests/data/test1209 | 58 - curl/tests/data/test121 | 51 - curl/tests/data/test1210 | 63 - curl/tests/data/test1211 | 53 - curl/tests/data/test1212 | 51 - curl/tests/data/test1213 | 53 - curl/tests/data/test1214 | 53 - curl/tests/data/test1215 | 106 - curl/tests/data/test1216 | 63 - curl/tests/data/test1217 | 57 - curl/tests/data/test1218 | 61 - curl/tests/data/test1219 | 49 - curl/tests/data/test122 | 45 - curl/tests/data/test1220 | 37 - curl/tests/data/test1221 | 53 - curl/tests/data/test1222 | 53 - curl/tests/data/test1223 | 60 - curl/tests/data/test1224 | 49 - curl/tests/data/test1225 | 57 - curl/tests/data/test1226 | 49 - curl/tests/data/test1227 | 48 - curl/tests/data/test1228 | 55 - curl/tests/data/test1229 | 83 - curl/tests/data/test123 | 40 - curl/tests/data/test1230 | 78 - curl/tests/data/test1231 | 61 - curl/tests/data/test1232 | 65 - curl/tests/data/test1233 | 46 - curl/tests/data/test1234 | 33 - curl/tests/data/test1235 | 95 - curl/tests/data/test1236 | 33 - curl/tests/data/test1237 | 47 - curl/tests/data/test1238 | 52 - curl/tests/data/test1239 | 68 - curl/tests/data/test124 | 47 - curl/tests/data/test1240 | 48 - curl/tests/data/test1241 | 64 - curl/tests/data/test1242 | 43 - curl/tests/data/test1243 | 44 - curl/tests/data/test1244 | 61 - curl/tests/data/test1245 | 63 - curl/tests/data/test1246 | 64 - curl/tests/data/test1247 | 38 - curl/tests/data/test1248 | 49 - curl/tests/data/test1249 | 52 - curl/tests/data/test125 | 41 - curl/tests/data/test1250 | 53 - curl/tests/data/test1251 | 54 - curl/tests/data/test1252 | 52 - curl/tests/data/test1253 | 53 - curl/tests/data/test1254 | 53 - curl/tests/data/test1255 | 53 - curl/tests/data/test1256 | 54 - curl/tests/data/test1257 | 54 - curl/tests/data/test1258 | 54 - curl/tests/data/test1259 | 47 - curl/tests/data/test126 | 48 - curl/tests/data/test1260 | 36 - curl/tests/data/test1261 | 61 - curl/tests/data/test1262 | 40 - curl/tests/data/test127 | 46 - curl/tests/data/test128 | 57 - curl/tests/data/test1280 | 58 - curl/tests/data/test1281 | 38 - curl/tests/data/test1282 | 45 - curl/tests/data/test1283 | 57 - curl/tests/data/test1284 | 89 - curl/tests/data/test1285 | 97 - curl/tests/data/test1286 | 110 - curl/tests/data/test1287 | 91 - curl/tests/data/test1288 | 96 - curl/tests/data/test1289 | 35 - curl/tests/data/test129 | 52 - curl/tests/data/test1298 | 56 - curl/tests/data/test1299 | 55 - curl/tests/data/test13 | 44 - curl/tests/data/test130 | 64 - curl/tests/data/test1300 | 26 - curl/tests/data/test1301 | 26 - curl/tests/data/test1302 | 26 - curl/tests/data/test1303 | 26 - curl/tests/data/test1304 | 30 - curl/tests/data/test1305 | 30 - curl/tests/data/test1306 | 30 - curl/tests/data/test1307 | 27 - curl/tests/data/test1308 | 31 - curl/tests/data/test1309 | 1568 - curl/tests/data/test131 | 63 - curl/tests/data/test1310 | 125 - curl/tests/data/test1311 | 64 - curl/tests/data/test1312 | 64 - curl/tests/data/test1313 | 64 - curl/tests/data/test1314 | 79 - curl/tests/data/test1315 | 83 - curl/tests/data/test1316 | 81 - curl/tests/data/test1317 | 56 - curl/tests/data/test1318 | 60 - curl/tests/data/test1319 | 86 - curl/tests/data/test132 | 62 - curl/tests/data/test1320 | 73 - curl/tests/data/test1321 | 82 - curl/tests/data/test1322 | 57 - curl/tests/data/test1323 | 32 - curl/tests/data/test1325 | 80 - curl/tests/data/test1326 | 48 - curl/tests/data/test1327 | 47 - curl/tests/data/test1328 | 71 - curl/tests/data/test1329 | 30 - curl/tests/data/test133 | 62 - curl/tests/data/test1330 | 51 - curl/tests/data/test1331 | 89 - curl/tests/data/test1332 | 80 - curl/tests/data/test1333 | 55 - curl/tests/data/test1334 | 76 - curl/tests/data/test1335 | 73 - curl/tests/data/test1336 | 81 - curl/tests/data/test1337 | 78 - curl/tests/data/test1338 | 77 - curl/tests/data/test1339 | 74 - curl/tests/data/test134 | 62 - curl/tests/data/test1340 | 80 - curl/tests/data/test1341 | 77 - curl/tests/data/test1342 | 83 - curl/tests/data/test1343 | 80 - curl/tests/data/test1344 | 89 - curl/tests/data/test1345 | 86 - curl/tests/data/test1346 | 73 - curl/tests/data/test1347 | 78 - curl/tests/data/test1348 | 61 - curl/tests/data/test1349 | 83 - curl/tests/data/test135 | 54 - curl/tests/data/test1350 | 80 - curl/tests/data/test1351 | 84 - curl/tests/data/test1352 | 81 - curl/tests/data/test1353 | 83 - curl/tests/data/test1354 | 78 - curl/tests/data/test1355 | 61 - curl/tests/data/test1356 | 79 - curl/tests/data/test1357 | 99 - curl/tests/data/test1358 | 96 - curl/tests/data/test1359 | 100 - curl/tests/data/test136 | 42 - curl/tests/data/test1360 | 97 - curl/tests/data/test1361 | 99 - curl/tests/data/test1362 | 96 - curl/tests/data/test1363 | 79 - curl/tests/data/test1364 | 71 - curl/tests/data/test1365 | 68 - curl/tests/data/test1366 | 73 - curl/tests/data/test1367 | 70 - curl/tests/data/test1368 | 72 - curl/tests/data/test1369 | 69 - curl/tests/data/test137 | 47 - curl/tests/data/test1370 | 74 - curl/tests/data/test1371 | 71 - curl/tests/data/test1372 | 78 - curl/tests/data/test1373 | 75 - curl/tests/data/test1374 | 81 - curl/tests/data/test1375 | 78 - curl/tests/data/test1376 | 68 - curl/tests/data/test1377 | 70 - curl/tests/data/test1378 | 56 - curl/tests/data/test1379 | 76 - curl/tests/data/test138 | 49 - curl/tests/data/test1380 | 73 - curl/tests/data/test1381 | 77 - curl/tests/data/test1382 | 74 - curl/tests/data/test1383 | 76 - curl/tests/data/test1384 | 73 - curl/tests/data/test1385 | 56 - curl/tests/data/test1386 | 71 - curl/tests/data/test1387 | 91 - curl/tests/data/test1388 | 88 - curl/tests/data/test1389 | 92 - curl/tests/data/test139 | 47 - curl/tests/data/test1390 | 89 - curl/tests/data/test1391 | 91 - curl/tests/data/test1392 | 88 - curl/tests/data/test1393 | 71 - curl/tests/data/test1394 | 30 - curl/tests/data/test1395 | 26 - curl/tests/data/test1396 | 27 - curl/tests/data/test1397 | 27 - curl/tests/data/test1398 | 26 - curl/tests/data/test1399 | 26 - curl/tests/data/test14 | 44 - curl/tests/data/test140 | 42 - curl/tests/data/test1400 | 109 - curl/tests/data/test1401 | 130 - curl/tests/data/test1402 | 116 - curl/tests/data/test1403 | 111 - curl/tests/data/test1404 | 186 - curl/tests/data/test1405 | 142 - curl/tests/data/test1406 | 128 - curl/tests/data/test1407 | 106 - curl/tests/data/test1408 | 74 - curl/tests/data/test1409 | 31 - curl/tests/data/test141 | 52 - curl/tests/data/test1410 | 31 - curl/tests/data/test1411 | 60 - curl/tests/data/test1412 | 118 - curl/tests/data/test1413 | 73 - curl/tests/data/test1414 | 57 - curl/tests/data/test1415 | 75 - curl/tests/data/test1416 | 63 - curl/tests/data/test1417 | 78 - curl/tests/data/test1418 | 108 - curl/tests/data/test1419 | 69 - curl/tests/data/test142 | 190 - curl/tests/data/test1420 | 111 - curl/tests/data/test1421 | 72 - curl/tests/data/test1422 | 63 - curl/tests/data/test1423 | 57 - curl/tests/data/test1424 | 76 - curl/tests/data/test1425 | Bin 1726 -> 0 bytes curl/tests/data/test1426 | Bin 1663 -> 0 bytes curl/tests/data/test1427 | 29 - curl/tests/data/test1428 | 81 - curl/tests/data/test1429 | 69 - curl/tests/data/test143 | 44 - curl/tests/data/test1430 | 53 - curl/tests/data/test1431 | 53 - curl/tests/data/test1432 | 54 - curl/tests/data/test1433 | 57 - curl/tests/data/test1434 | 90 - curl/tests/data/test1435 | 46 - curl/tests/data/test1436 | 85 - curl/tests/data/test1437 | 84 - curl/tests/data/test1438 | 58 - curl/tests/data/test1439 | 58 - curl/tests/data/test144 | 49 - curl/tests/data/test1440 | 35 - curl/tests/data/test1441 | 35 - curl/tests/data/test1442 | 35 - curl/tests/data/test1443 | 68 - curl/tests/data/test1444 | 52 - curl/tests/data/test1445 | 35 - curl/tests/data/test1446 | 42 - curl/tests/data/test1447 | 38 - curl/tests/data/test1448 | 92 - curl/tests/data/test1449 | 38 - curl/tests/data/test145 | 51 - curl/tests/data/test1450 | 34 - curl/tests/data/test1451 | 36 - curl/tests/data/test1452 | 41 - curl/tests/data/test1453 | 38 - curl/tests/data/test146 | 55 - curl/tests/data/test147 | 55 - curl/tests/data/test148 | 49 - curl/tests/data/test149 | 53 - curl/tests/data/test15 | 57 - curl/tests/data/test150 | 103 - curl/tests/data/test1500 | 44 - curl/tests/data/test1501 | 53 - curl/tests/data/test1502 | 58 - curl/tests/data/test1503 | 58 - curl/tests/data/test1504 | 58 - curl/tests/data/test1505 | 58 - curl/tests/data/test1506 | 96 - curl/tests/data/test1507 | 51 - curl/tests/data/test1508 | 31 - curl/tests/data/test1509 | 88 - curl/tests/data/test151 | 48 - curl/tests/data/test1510 | 96 - curl/tests/data/test1511 | 70 - curl/tests/data/test1512 | 80 - curl/tests/data/test1513 | 49 - curl/tests/data/test1514 | 48 - curl/tests/data/test1515 | 62 - curl/tests/data/test1516 | 58 - curl/tests/data/test1517 | 69 - curl/tests/data/test152 | 52 - curl/tests/data/test1520 | 63 - curl/tests/data/test1521 | 30 - curl/tests/data/test1525 | 74 - curl/tests/data/test1526 | 76 - curl/tests/data/test1527 | 76 - curl/tests/data/test1528 | 60 - curl/tests/data/test1529 | 43 - curl/tests/data/test153 | 134 - curl/tests/data/test1530 | 30 - curl/tests/data/test1531 | Bin 552 -> 0 bytes curl/tests/data/test1532 | 49 - curl/tests/data/test1533 | 74 - curl/tests/data/test1534 | 50 - curl/tests/data/test1535 | 50 - curl/tests/data/test1536 | 50 - curl/tests/data/test1537 | 45 - curl/tests/data/test1538 | 149 - curl/tests/data/test154 | 109 - curl/tests/data/test1540 | 64 - curl/tests/data/test155 | 140 - curl/tests/data/test1550 | 29 - curl/tests/data/test1551 | 72 - curl/tests/data/test1552 | 52 - curl/tests/data/test1553 | 52 - curl/tests/data/test156 | 60 - curl/tests/data/test157 | 47 - curl/tests/data/test158 | 56 - curl/tests/data/test159 | 83 - curl/tests/data/test16 | 52 - curl/tests/data/test160 | 73 - curl/tests/data/test1600 | 27 - curl/tests/data/test1601 | 26 - curl/tests/data/test1602 | 26 - curl/tests/data/test1603 | 26 - curl/tests/data/test1604 | 25 - curl/tests/data/test1605 | 25 - curl/tests/data/test1606 | 26 - curl/tests/data/test161 | 51 - curl/tests/data/test162 | 61 - curl/tests/data/test163 | 79 - curl/tests/data/test164 | 68 - curl/tests/data/test165 | 67 - curl/tests/data/test166 | 60 - curl/tests/data/test167 | 80 - curl/tests/data/test168 | 100 - curl/tests/data/test169 | 129 - curl/tests/data/test17 | 54 - curl/tests/data/test170 | 52 - curl/tests/data/test1700 | 101 - curl/tests/data/test1701 | 83 - curl/tests/data/test1702 | 78 - curl/tests/data/test171 | 58 - curl/tests/data/test172 | 56 - curl/tests/data/test173 | 79 - curl/tests/data/test174 | 52 - curl/tests/data/test175 | 86 - curl/tests/data/test176 | 88 - curl/tests/data/test177 | 54 - curl/tests/data/test178 | 50 - curl/tests/data/test179 | 57 - curl/tests/data/test18 | 91 - curl/tests/data/test180 | 67 - curl/tests/data/test1800 | 55 - curl/tests/data/test1801 | 69 - curl/tests/data/test181 | 68 - curl/tests/data/test182 | 43 - curl/tests/data/test183 | 56 - curl/tests/data/test184 | 75 - curl/tests/data/test185 | 75 - curl/tests/data/test186 | 62 - curl/tests/data/test187 | 77 - curl/tests/data/test188 | 78 - curl/tests/data/test189 | 76 - curl/tests/data/test19 | 37 - curl/tests/data/test190 | 44 - curl/tests/data/test1900 | 61 - curl/tests/data/test1901 | 63 - curl/tests/data/test1902 | 62 - curl/tests/data/test1903 | 62 - curl/tests/data/test1904 | 79 - curl/tests/data/test191 | 41 - curl/tests/data/test192 | 59 - curl/tests/data/test193 | 82 - curl/tests/data/test194 | 73 - curl/tests/data/test195 | 38 - curl/tests/data/test196 | 41 - curl/tests/data/test197 | 75 - curl/tests/data/test198 | 70 - curl/tests/data/test199 | 59 - curl/tests/data/test2 | 53 - curl/tests/data/test20 | 38 - curl/tests/data/test200 | 41 - curl/tests/data/test2000 | 73 - curl/tests/data/test2001 | 109 - curl/tests/data/test2002 | 128 - curl/tests/data/test2003 | 168 - curl/tests/data/test2004 | 78 - curl/tests/data/test2005 | 93 - curl/tests/data/test2006 | 112 - curl/tests/data/test2007 | 113 - curl/tests/data/test2008 | 105 - curl/tests/data/test2009 | 106 - curl/tests/data/test201 | 34 - curl/tests/data/test2010 | 105 - curl/tests/data/test2011 | 93 - curl/tests/data/test2012 | 92 - curl/tests/data/test2013 | 78 - curl/tests/data/test2014 | 78 - curl/tests/data/test2015 | 78 - curl/tests/data/test2016 | 78 - curl/tests/data/test2017 | 78 - curl/tests/data/test2018 | 78 - curl/tests/data/test2019 | 78 - curl/tests/data/test202 | 37 - curl/tests/data/test2020 | 78 - curl/tests/data/test2021 | 78 - curl/tests/data/test2022 | 78 - curl/tests/data/test2023 | 162 - curl/tests/data/test2024 | 176 - curl/tests/data/test2025 | 272 - curl/tests/data/test2026 | 220 - curl/tests/data/test2027 | 248 - curl/tests/data/test2028 | 316 - curl/tests/data/test2029 | 240 - curl/tests/data/test203 | 42 - curl/tests/data/test2030 | 297 - curl/tests/data/test2031 | 321 - curl/tests/data/test2032 | 123 - curl/tests/data/test2033 | 124 - curl/tests/data/test2034 | 58 - curl/tests/data/test2035 | 44 - curl/tests/data/test2036 | 39 - curl/tests/data/test2037 | 58 - curl/tests/data/test2038 | 44 - curl/tests/data/test2039 | 63 - curl/tests/data/test204 | 40 - curl/tests/data/test2040 | 69 - curl/tests/data/test2041 | 58 - curl/tests/data/test2042 | 44 - curl/tests/data/test2043 | 33 - curl/tests/data/test2044 | 33 - curl/tests/data/test2045 | 54 - curl/tests/data/test2046 | 98 - curl/tests/data/test2047 | 101 - curl/tests/data/test2048 | 40 - curl/tests/data/test2049 | 64 - curl/tests/data/test205 | 38 - curl/tests/data/test2050 | 78 - curl/tests/data/test2051 | 74 - curl/tests/data/test2052 | 68 - curl/tests/data/test2053 | 56 - curl/tests/data/test2054 | 64 - curl/tests/data/test2055 | 80 - curl/tests/data/test2056 | 87 - curl/tests/data/test2057 | 108 - curl/tests/data/test206 | 108 - curl/tests/data/test207 | 67 - curl/tests/data/test208 | 75 - curl/tests/data/test209 | 123 - curl/tests/data/test21 | 33 - curl/tests/data/test210 | 52 - curl/tests/data/test211 | 54 - curl/tests/data/test212 | 64 - curl/tests/data/test213 | 126 - curl/tests/data/test214 | 50 - curl/tests/data/test215 | 58 - curl/tests/data/test216 | 45 - curl/tests/data/test217 | 60 - curl/tests/data/test218 | 59 - curl/tests/data/test219 | 37 - curl/tests/data/test22 | 46 - curl/tests/data/test220 | 68 - curl/tests/data/test221 | 71 - curl/tests/data/test222 | 199 - curl/tests/data/test223 | 92 - curl/tests/data/test224 | 104 - curl/tests/data/test225 | 28 - curl/tests/data/test226 | 29 - curl/tests/data/test227 | 57 - curl/tests/data/test228 | 52 - curl/tests/data/test229 | 41 - curl/tests/data/test23 | 33 - curl/tests/data/test231 | 38 - curl/tests/data/test233 | 94 - curl/tests/data/test234 | 97 - curl/tests/data/test235 | 48 - curl/tests/data/test236 | 52 - curl/tests/data/test237 | 44 - curl/tests/data/test238 | 42 - curl/tests/data/test239 | 102 - curl/tests/data/test24 | 50 - curl/tests/data/test240 | 58 - curl/tests/data/test241 | 56 - curl/tests/data/test242 | 54 - curl/tests/data/test243 | 131 - curl/tests/data/test244 | 54 - curl/tests/data/test245 | 88 - curl/tests/data/test246 | 98 - curl/tests/data/test247 | 47 - curl/tests/data/test248 | 56 - curl/tests/data/test249 | 53 - curl/tests/data/test25 | 116 - curl/tests/data/test250 | 58 - curl/tests/data/test251 | 60 - curl/tests/data/test252 | 60 - curl/tests/data/test253 | 63 - curl/tests/data/test254 | 61 - curl/tests/data/test255 | 64 - curl/tests/data/test256 | 64 - curl/tests/data/test257 | 112 - curl/tests/data/test258 | 135 - curl/tests/data/test259 | 133 - curl/tests/data/test26 | 45 - curl/tests/data/test260 | 55 - curl/tests/data/test261 | 48 - curl/tests/data/test262 | Bin 1137 -> 0 bytes curl/tests/data/test263 | 54 - curl/tests/data/test264 | 49 - curl/tests/data/test265 | 127 - curl/tests/data/test266 | 78 - curl/tests/data/test267 | 111 - curl/tests/data/test268 | 57 - curl/tests/data/test269 | 53 - curl/tests/data/test27 | 56 - curl/tests/data/test270 | 50 - curl/tests/data/test271 | 46 - curl/tests/data/test272 | 40 - curl/tests/data/test273 | 84 - curl/tests/data/test274 | 52 - curl/tests/data/test275 | 88 - curl/tests/data/test276 | 76 - curl/tests/data/test277 | 58 - curl/tests/data/test278 | 49 - curl/tests/data/test279 | 50 - curl/tests/data/test28 | 75 - curl/tests/data/test280 | 63 - curl/tests/data/test281 | 65 - curl/tests/data/test282 | 45 - curl/tests/data/test283 | 39 - curl/tests/data/test284 | 70 - curl/tests/data/test285 | 47 - curl/tests/data/test286 | 95 - curl/tests/data/test287 | 53 - curl/tests/data/test288 | 48 - curl/tests/data/test289 | 30 - curl/tests/data/test29 | 52 - curl/tests/data/test290 | 43 - curl/tests/data/test291 | 47 - curl/tests/data/test292 | 56 - curl/tests/data/test293 | 60 - curl/tests/data/test294 | 64 - curl/tests/data/test295 | 45 - curl/tests/data/test296 | 48 - curl/tests/data/test297 | 46 - curl/tests/data/test298 | 45 - curl/tests/data/test299 | 53 - curl/tests/data/test3 | 60 - curl/tests/data/test30 | 43 - curl/tests/data/test300 | 52 - curl/tests/data/test301 | 57 - curl/tests/data/test302 | 51 - curl/tests/data/test303 | 55 - curl/tests/data/test304 | 72 - curl/tests/data/test305 | 35 - curl/tests/data/test306 | 65 - curl/tests/data/test307 | 56 - curl/tests/data/test308 | 35 - curl/tests/data/test309 | 86 - curl/tests/data/test31 | 137 - curl/tests/data/test310 | 57 - curl/tests/data/test311 | 43 - curl/tests/data/test312 | 43 - curl/tests/data/test313 | 39 - curl/tests/data/test32 | 56 - curl/tests/data/test320 | 96 - curl/tests/data/test321 | 33 - curl/tests/data/test322 | 33 - curl/tests/data/test323 | 33 - curl/tests/data/test324 | 33 - curl/tests/data/test325 | 66 - curl/tests/data/test33 | 64 - curl/tests/data/test34 | 66 - curl/tests/data/test35 | Bin 810 -> 0 bytes curl/tests/data/test350 | 57 - curl/tests/data/test351 | 56 - curl/tests/data/test352 | 57 - curl/tests/data/test353 | 56 - curl/tests/data/test354 | 50 - curl/tests/data/test36 | 66 - curl/tests/data/test37 | 47 - curl/tests/data/test38 | 61 - curl/tests/data/test39 | 109 - curl/tests/data/test4 | 62 - curl/tests/data/test40 | 74 - curl/tests/data/test400 | 62 - curl/tests/data/test401 | 57 - curl/tests/data/test402 | 36 - curl/tests/data/test403 | 65 - curl/tests/data/test404 | 32 - curl/tests/data/test405 | 35 - curl/tests/data/test406 | 67 - curl/tests/data/test407 | 60 - curl/tests/data/test408 | 62 - curl/tests/data/test409 | 57 - curl/tests/data/test41 | 32 - curl/tests/data/test42 | 74 - curl/tests/data/test43 | 79 - curl/tests/data/test44 | 72 - curl/tests/data/test45 | 76 - curl/tests/data/test46 | 89 - curl/tests/data/test47 | 49 - curl/tests/data/test48 | 54 - curl/tests/data/test49 | 74 - curl/tests/data/test5 | 50 - curl/tests/data/test50 | 74 - curl/tests/data/test500 | 58 - curl/tests/data/test501 | 40 - curl/tests/data/test502 | 47 - curl/tests/data/test503 | 87 - curl/tests/data/test504 | 44 - curl/tests/data/test505 | 66 - curl/tests/data/test506 | 243 - curl/tests/data/test507 | 37 - curl/tests/data/test508 | 58 - curl/tests/data/test509 | 44 - curl/tests/data/test51 | 74 - curl/tests/data/test510 | 65 - curl/tests/data/test511 | 50 - curl/tests/data/test512 | 53 - curl/tests/data/test513 | 49 - curl/tests/data/test514 | 57 - curl/tests/data/test515 | 54 - curl/tests/data/test516 | 54 - curl/tests/data/test517 | 135 - curl/tests/data/test518 | 67 - curl/tests/data/test519 | 78 - curl/tests/data/test52 | 74 - curl/tests/data/test520 | 53 - curl/tests/data/test521 | 60 - curl/tests/data/test522 | 60 - curl/tests/data/test523 | 64 - curl/tests/data/test524 | 46 - curl/tests/data/test525 | 59 - curl/tests/data/test526 | 63 - curl/tests/data/test527 | 63 - curl/tests/data/test528 | 65 - curl/tests/data/test529 | 59 - curl/tests/data/test53 | 54 - curl/tests/data/test530 | 83 - curl/tests/data/test531 | 59 - curl/tests/data/test532 | 63 - curl/tests/data/test533 | 55 - curl/tests/data/test534 | 53 - curl/tests/data/test535 | 69 - curl/tests/data/test536 | 74 - curl/tests/data/test537 | 64 - curl/tests/data/test538 | 45 - curl/tests/data/test539 | 71 - curl/tests/data/test54 | 45 - curl/tests/data/test540 | 110 - curl/tests/data/test541 | 57 - curl/tests/data/test542 | 57 - curl/tests/data/test543 | 35 - curl/tests/data/test544 | 56 - curl/tests/data/test545 | Bin 798 -> 0 bytes curl/tests/data/test546 | 70 - curl/tests/data/test547 | 135 - curl/tests/data/test548 | 135 - curl/tests/data/test549 | 65 - curl/tests/data/test55 | 66 - curl/tests/data/test550 | 65 - curl/tests/data/test551 | 100 - curl/tests/data/test552 | Bin 142985 -> 0 bytes curl/tests/data/test553 | 65 - curl/tests/data/test554 | 132 - curl/tests/data/test555 | 144 - curl/tests/data/test556 | 50 - curl/tests/data/test557 | 47 - curl/tests/data/test558 | 56 - curl/tests/data/test559 | 50 - curl/tests/data/test56 | 61 - curl/tests/data/test560 | 56 - curl/tests/data/test561 | 66 - curl/tests/data/test562 | 53 - curl/tests/data/test563 | 57 - curl/tests/data/test564 | 65 - curl/tests/data/test565 | 109 - curl/tests/data/test566 | 57 - curl/tests/data/test567 | 50 - curl/tests/data/test568 | 117 - curl/tests/data/test569 | 111 - curl/tests/data/test57 | 48 - curl/tests/data/test570 | 77 - curl/tests/data/test571 | 108 - curl/tests/data/test572 | 122 - curl/tests/data/test573 | 58 - curl/tests/data/test574 | 98 - curl/tests/data/test575 | 121 - curl/tests/data/test576 | 192 - curl/tests/data/test577 | 55 - curl/tests/data/test578 | 52 - curl/tests/data/test579 | 87 - curl/tests/data/test58 | 51 - curl/tests/data/test580 | 58 - curl/tests/data/test581 | 58 - curl/tests/data/test582 | 49 - curl/tests/data/test583 | 45 - curl/tests/data/test584 | 102 - curl/tests/data/test585 | 69 - curl/tests/data/test586 | 59 - curl/tests/data/test587 | 58 - curl/tests/data/test588 | 69 - curl/tests/data/test589 | 55 - curl/tests/data/test59 | 47 - curl/tests/data/test590 | 125 - curl/tests/data/test591 | 73 - curl/tests/data/test592 | 74 - curl/tests/data/test593 | 72 - curl/tests/data/test594 | 72 - curl/tests/data/test595 | 57 - curl/tests/data/test596 | 60 - curl/tests/data/test597 | 37 - curl/tests/data/test598 | 80 - curl/tests/data/test599 | 86 - curl/tests/data/test6 | 49 - curl/tests/data/test60 | 58 - curl/tests/data/test600 | 42 - curl/tests/data/test601 | 42 - curl/tests/data/test602 | 43 - curl/tests/data/test603 | 43 - curl/tests/data/test604 | 33 - curl/tests/data/test605 | 33 - curl/tests/data/test606 | 33 - curl/tests/data/test607 | 33 - curl/tests/data/test608 | 49 - curl/tests/data/test609 | 45 - curl/tests/data/test61 | 73 - curl/tests/data/test610 | 47 - curl/tests/data/test611 | 47 - curl/tests/data/test612 | 47 - curl/tests/data/test613 | 48 - curl/tests/data/test614 | 49 - curl/tests/data/test615 | 44 - curl/tests/data/test616 | 39 - curl/tests/data/test617 | 39 - curl/tests/data/test618 | 39 - curl/tests/data/test619 | 39 - curl/tests/data/test62 | 65 - curl/tests/data/test620 | 38 - curl/tests/data/test621 | 38 - curl/tests/data/test622 | 43 - curl/tests/data/test623 | 44 - curl/tests/data/test624 | 47 - curl/tests/data/test625 | 47 - curl/tests/data/test626 | 42 - curl/tests/data/test627 | 46 - curl/tests/data/test628 | 33 - curl/tests/data/test629 | 33 - curl/tests/data/test63 | 52 - curl/tests/data/test630 | 34 - curl/tests/data/test631 | 34 - curl/tests/data/test632 | 34 - curl/tests/data/test633 | 42 - curl/tests/data/test634 | 43 - curl/tests/data/test635 | 42 - curl/tests/data/test636 | 43 - curl/tests/data/test637 | 44 - curl/tests/data/test638 | 49 - curl/tests/data/test639 | 49 - curl/tests/data/test64 | 84 - curl/tests/data/test640 | 41 - curl/tests/data/test641 | 41 - curl/tests/data/test642 | 42 - curl/tests/data/test643 | 131 - curl/tests/data/test644 | 59 - curl/tests/data/test645 | 141 - curl/tests/data/test646 | 98 - curl/tests/data/test647 | 79 - curl/tests/data/test648 | 75 - curl/tests/data/test649 | 72 - curl/tests/data/test65 | 84 - curl/tests/data/test650 | 123 - curl/tests/data/test651 | 73 - curl/tests/data/test652 | 358 - curl/tests/data/test653 | 93 - curl/tests/data/test66 | 41 - curl/tests/data/test67 | 102 - curl/tests/data/test68 | 101 - curl/tests/data/test69 | 123 - curl/tests/data/test7 | 62 - curl/tests/data/test70 | 88 - curl/tests/data/test700 | 57 - curl/tests/data/test701 | 57 - curl/tests/data/test702 | 39 - curl/tests/data/test703 | 39 - curl/tests/data/test704 | 36 - curl/tests/data/test705 | 36 - curl/tests/data/test706 | 59 - curl/tests/data/test707 | 59 - curl/tests/data/test708 | 60 - curl/tests/data/test709 | 60 - curl/tests/data/test71 | 78 - curl/tests/data/test710 | 57 - curl/tests/data/test711 | 52 - curl/tests/data/test712 | 48 - curl/tests/data/test713 | 49 - curl/tests/data/test714 | 67 - curl/tests/data/test715 | 69 - curl/tests/data/test72 | 87 - curl/tests/data/test73 | 55 - curl/tests/data/test74 | 75 - curl/tests/data/test75 | 50 - curl/tests/data/test76 | 39 - curl/tests/data/test77 | 56 - curl/tests/data/test78 | 68 - curl/tests/data/test79 | 55 - curl/tests/data/test8 | 69 - curl/tests/data/test80 | 83 - curl/tests/data/test800 | 49 - curl/tests/data/test801 | 46 - curl/tests/data/test802 | 47 - curl/tests/data/test803 | 45 - curl/tests/data/test804 | 47 - curl/tests/data/test805 | 62 - curl/tests/data/test806 | 44 - curl/tests/data/test807 | 45 - curl/tests/data/test808 | 49 - curl/tests/data/test809 | 43 - curl/tests/data/test81 | 103 - curl/tests/data/test810 | 43 - curl/tests/data/test811 | 40 - curl/tests/data/test812 | 40 - curl/tests/data/test813 | 40 - curl/tests/data/test814 | 41 - curl/tests/data/test815 | 46 - curl/tests/data/test816 | 49 - curl/tests/data/test817 | 40 - curl/tests/data/test818 | 46 - curl/tests/data/test819 | 56 - curl/tests/data/test82 | 56 - curl/tests/data/test820 | 57 - curl/tests/data/test821 | 59 - curl/tests/data/test822 | 71 - curl/tests/data/test823 | 63 - curl/tests/data/test824 | 56 - curl/tests/data/test825 | 56 - curl/tests/data/test826 | 57 - curl/tests/data/test827 | 71 - curl/tests/data/test828 | 56 - curl/tests/data/test829 | 29 - curl/tests/data/test83 | 79 - curl/tests/data/test830 | 56 - curl/tests/data/test831 | 67 - curl/tests/data/test832 | 58 - curl/tests/data/test833 | 65 - curl/tests/data/test834 | 76 - curl/tests/data/test835 | 67 - curl/tests/data/test836 | 59 - curl/tests/data/test837 | 56 - curl/tests/data/test838 | 56 - curl/tests/data/test839 | 56 - curl/tests/data/test84 | 54 - curl/tests/data/test840 | 56 - curl/tests/data/test841 | 51 - curl/tests/data/test842 | 62 - curl/tests/data/test843 | 62 - curl/tests/data/test844 | 59 - curl/tests/data/test845 | 59 - curl/tests/data/test846 | 50 - curl/tests/data/test85 | 58 - curl/tests/data/test850 | 49 - curl/tests/data/test851 | 44 - curl/tests/data/test852 | 47 - curl/tests/data/test853 | 52 - curl/tests/data/test854 | 45 - curl/tests/data/test855 | 47 - curl/tests/data/test856 | 48 - curl/tests/data/test857 | 60 - curl/tests/data/test858 | 41 - curl/tests/data/test859 | 41 - curl/tests/data/test86 | 97 - curl/tests/data/test860 | 41 - curl/tests/data/test861 | 52 - curl/tests/data/test862 | 50 - curl/tests/data/test863 | 41 - curl/tests/data/test864 | 54 - curl/tests/data/test865 | 57 - curl/tests/data/test866 | 58 - curl/tests/data/test867 | 60 - curl/tests/data/test868 | 72 - curl/tests/data/test869 | 64 - curl/tests/data/test87 | 61 - curl/tests/data/test870 | 57 - curl/tests/data/test871 | 56 - curl/tests/data/test872 | 57 - curl/tests/data/test873 | 71 - curl/tests/data/test874 | 56 - curl/tests/data/test875 | 29 - curl/tests/data/test876 | 57 - curl/tests/data/test877 | 68 - curl/tests/data/test878 | 59 - curl/tests/data/test879 | 66 - curl/tests/data/test88 | 101 - curl/tests/data/test880 | 77 - curl/tests/data/test881 | 68 - curl/tests/data/test882 | 58 - curl/tests/data/test883 | 57 - curl/tests/data/test884 | 57 - curl/tests/data/test885 | 56 - curl/tests/data/test886 | 56 - curl/tests/data/test887 | 63 - curl/tests/data/test888 | 62 - curl/tests/data/test889 | 61 - curl/tests/data/test89 | 147 - curl/tests/data/test890 | 60 - curl/tests/data/test9 | 72 - curl/tests/data/test90 | 193 - curl/tests/data/test900 | 51 - curl/tests/data/test901 | 63 - curl/tests/data/test902 | 57 - curl/tests/data/test903 | 56 - curl/tests/data/test904 | 57 - curl/tests/data/test905 | 59 - curl/tests/data/test906 | 71 - curl/tests/data/test907 | 63 - curl/tests/data/test908 | 56 - curl/tests/data/test909 | 51 - curl/tests/data/test91 | 124 - curl/tests/data/test910 | 51 - curl/tests/data/test911 | 47 - curl/tests/data/test912 | 55 - curl/tests/data/test913 | 50 - curl/tests/data/test914 | 46 - curl/tests/data/test915 | 51 - curl/tests/data/test916 | 47 - curl/tests/data/test917 | 55 - curl/tests/data/test918 | 48 - curl/tests/data/test919 | 55 - curl/tests/data/test92 | 55 - curl/tests/data/test920 | 56 - curl/tests/data/test921 | 70 - curl/tests/data/test922 | 55 - curl/tests/data/test923 | 40 - curl/tests/data/test924 | 43 - curl/tests/data/test925 | 40 - curl/tests/data/test926 | 44 - curl/tests/data/test927 | 43 - curl/tests/data/test928 | 41 - curl/tests/data/test929 | 38 - curl/tests/data/test93 | 50 - curl/tests/data/test930 | 38 - curl/tests/data/test931 | 29 - curl/tests/data/test932 | 56 - curl/tests/data/test933 | 67 - curl/tests/data/test934 | 58 - curl/tests/data/test935 | 65 - curl/tests/data/test936 | 76 - curl/tests/data/test937 | 67 - curl/tests/data/test938 | 65 - curl/tests/data/test939 | 50 - curl/tests/data/test94 | 58 - curl/tests/data/test940 | 45 - curl/tests/data/test941 | 66 - curl/tests/data/test942 | 56 - curl/tests/data/test943 | 56 - curl/tests/data/test944 | 55 - curl/tests/data/test945 | 55 - curl/tests/data/test946 | 62 - curl/tests/data/test947 | 61 - curl/tests/data/test948 | 63 - curl/tests/data/test949 | 62 - curl/tests/data/test95 | 81 - curl/tests/data/test950 | 43 - curl/tests/data/test96 | 46 - curl/tests/data/test97 | 52 - curl/tests/data/test98 | 55 - curl/tests/data/test99 | 69 - curl/tests/dictserver.py | 159 - curl/tests/directories.pm | 287 - curl/tests/ftp.pm | 326 - curl/tests/ftpserver.pl | 3233 -- curl/tests/getpart.pm | 294 - curl/tests/http2-server.pl | 83 - curl/tests/http_pipe.py | 441 - curl/tests/httpserver.pl | 139 - curl/tests/libtest/CMakeLists.txt | 135 - curl/tests/libtest/Makefile.am | 134 - curl/tests/libtest/Makefile.in | 8394 --- curl/tests/libtest/Makefile.inc | 478 - curl/tests/libtest/first.c | 183 - curl/tests/libtest/lib1500.c | 90 - curl/tests/libtest/lib1501.c | 111 - curl/tests/libtest/lib1502.c | 146 - curl/tests/libtest/lib1506.c | 137 - curl/tests/libtest/lib1507.c | 151 - curl/tests/libtest/lib1509.c | 97 - curl/tests/libtest/lib1510.c | 99 - curl/tests/libtest/lib1511.c | 75 - curl/tests/libtest/lib1512.c | 91 - curl/tests/libtest/lib1513.c | 74 - curl/tests/libtest/lib1514.c | 80 - curl/tests/libtest/lib1515.c | 154 - curl/tests/libtest/lib1517.c | 116 - curl/tests/libtest/lib1520.c | 115 - curl/tests/libtest/lib1521.c | 2533 - curl/tests/libtest/lib1525.c | 98 - curl/tests/libtest/lib1526.c | 104 - curl/tests/libtest/lib1527.c | 100 - curl/tests/libtest/lib1528.c | 73 - curl/tests/libtest/lib1529.c | 60 - curl/tests/libtest/lib1530.c | 68 - curl/tests/libtest/lib1532.c | 80 - curl/tests/libtest/lib1533.c | 200 - curl/tests/libtest/lib1534.c | 129 - curl/tests/libtest/lib1535.c | 128 - curl/tests/libtest/lib1536.c | 129 - curl/tests/libtest/lib1537.c | 94 - curl/tests/libtest/lib1538.c | 52 - curl/tests/libtest/lib1540.c | 121 - curl/tests/libtest/lib1550.c | 46 - curl/tests/libtest/lib1552.c | 93 - curl/tests/libtest/lib1553.c | 109 - curl/tests/libtest/lib1900.c | 248 - curl/tests/libtest/lib500.c | 143 - curl/tests/libtest/lib502.c | 92 - curl/tests/libtest/lib503.c | 102 - curl/tests/libtest/lib504.c | 114 - curl/tests/libtest/lib505.c | 150 - curl/tests/libtest/lib506.c | 380 - curl/tests/libtest/lib507.c | 100 - curl/tests/libtest/lib508.c | 108 - curl/tests/libtest/lib509.c | 147 - curl/tests/libtest/lib510.c | 135 - curl/tests/libtest/lib512.c | 77 - curl/tests/libtest/lib513.c | 83 - curl/tests/libtest/lib514.c | 79 - curl/tests/libtest/lib515.c | 60 - curl/tests/libtest/lib516.c | 59 - curl/tests/libtest/lib517.c | 139 - curl/tests/libtest/lib518.c | 523 - curl/tests/libtest/lib519.c | 63 - curl/tests/libtest/lib520.c | 55 - curl/tests/libtest/lib521.c | 57 - curl/tests/libtest/lib523.c | 58 - curl/tests/libtest/lib524.c | 56 - curl/tests/libtest/lib525.c | 162 - curl/tests/libtest/lib526.c | 184 - curl/tests/libtest/lib530.c | 122 - curl/tests/libtest/lib533.c | 112 - curl/tests/libtest/lib536.c | 142 - curl/tests/libtest/lib537.c | 525 - curl/tests/libtest/lib539.c | 91 - curl/tests/libtest/lib540.c | 248 - curl/tests/libtest/lib541.c | 115 - curl/tests/libtest/lib543.c | 62 - curl/tests/libtest/lib544.c | 92 - curl/tests/libtest/lib547.c | 131 - curl/tests/libtest/lib549.c | 66 - curl/tests/libtest/lib552.c | 224 - curl/tests/libtest/lib553.c | 115 - curl/tests/libtest/lib554.c | 225 - curl/tests/libtest/lib555.c | 160 - curl/tests/libtest/lib556.c | 109 - curl/tests/libtest/lib557.c | 1700 - curl/tests/libtest/lib558.c | 53 - curl/tests/libtest/lib559.c | 56 - curl/tests/libtest/lib560.c | 113 - curl/tests/libtest/lib562.c | 74 - curl/tests/libtest/lib564.c | 93 - curl/tests/libtest/lib566.c | 68 - curl/tests/libtest/lib567.c | 70 - curl/tests/libtest/lib568.c | 178 - curl/tests/libtest/lib569.c | 128 - curl/tests/libtest/lib570.c | 116 - curl/tests/libtest/lib571.c | 215 - curl/tests/libtest/lib572.c | 184 - curl/tests/libtest/lib573.c | 114 - curl/tests/libtest/lib574.c | 71 - curl/tests/libtest/lib575.c | 114 - curl/tests/libtest/lib576.c | 125 - curl/tests/libtest/lib578.c | 105 - curl/tests/libtest/lib579.c | 162 - curl/tests/libtest/lib582.c | 356 - curl/tests/libtest/lib583.c | 84 - curl/tests/libtest/lib586.c | 247 - curl/tests/libtest/lib589.c | 59 - curl/tests/libtest/lib590.c | 72 - curl/tests/libtest/lib591.c | 147 - curl/tests/libtest/lib597.c | 148 - curl/tests/libtest/lib598.c | 73 - curl/tests/libtest/lib599.c | 97 - curl/tests/libtest/lib643.c | 297 - curl/tests/libtest/lib650.c | 190 - curl/tests/libtest/lib651.c | 94 - curl/tests/libtest/lib652.c | 128 - curl/tests/libtest/lib653.c | 63 - curl/tests/libtest/libauthretry.c | 148 - curl/tests/libtest/libntlmconnect.c | 231 - curl/tests/libtest/mk-lib1521.pl | 309 - curl/tests/libtest/notexists.pl | 15 - curl/tests/libtest/stub_gssapi.c | 397 - curl/tests/libtest/stub_gssapi.h | 183 - curl/tests/libtest/test.h | 434 - curl/tests/libtest/test1013.pl | 51 - curl/tests/libtest/test1022.pl | 54 - curl/tests/libtest/test307.pl | 19 - curl/tests/libtest/test610.pl | 33 - curl/tests/libtest/test613.pl | 109 - curl/tests/libtest/test75.pl | 13 - curl/tests/libtest/testtrace.c | 145 - curl/tests/libtest/testutil.c | 130 - curl/tests/libtest/testutil.h | 45 - curl/tests/manpage-scan.pl | 289 - curl/tests/mem-include-scan.pl | 96 - curl/tests/memanalyze.pl | 425 - curl/tests/negtelnetserver.py | 349 - curl/tests/nroff-scan.pl | 104 - curl/tests/pathhelp.pm | 761 - .../python_dependencies/impacket/__init__.py | 25 - .../tests/python_dependencies/impacket/nmb.py | 980 - .../python_dependencies/impacket/nt_errors.py | 3586 -- .../python_dependencies/impacket/ntlm.py | 971 - .../tests/python_dependencies/impacket/smb.py | 4099 -- .../python_dependencies/impacket/smb3.py | 1629 - .../impacket/smb3structs.py | 1363 - .../python_dependencies/impacket/smbserver.py | 4168 -- .../python_dependencies/impacket/spnego.py | 372 - .../python_dependencies/impacket/structure.py | 743 - .../python_dependencies/impacket/uuid.py | 68 - .../python_dependencies/impacket/version.py | 12 - curl/tests/rtspserver.pl | 109 - curl/tests/runtests.1 | 118 - curl/tests/runtests.pl | 5871 --- curl/tests/secureserver.pl | 356 - curl/tests/server/CMakeLists.txt | 66 - curl/tests/server/Makefile.am | 65 - curl/tests/server/Makefile.in | 2127 - curl/tests/server/Makefile.inc | 70 - curl/tests/server/base64.pl | 9 - curl/tests/server/fake_ntlm.c | 285 - curl/tests/server/getpart.c | 482 - curl/tests/server/resolve.c | 156 - curl/tests/server/rtspd.c | 1485 - curl/tests/server/sockfilt.c | 1571 - curl/tests/server/sws.c | 2414 - curl/tests/server/testpart.c | 50 - curl/tests/server/tftp.h | 61 - curl/tests/server/tftpd.c | 1434 - curl/tests/server/util.c | 399 - curl/tests/server/util.h | 68 - curl/tests/serverhelp.pm | 247 - curl/tests/smbserver.py | 377 - curl/tests/sshhelp.pm | 454 - curl/tests/sshserver.pl | 1080 - curl/tests/stunnel.pem | 143 - curl/tests/symbol-scan.pl | 176 - curl/tests/testcurl.1 | 125 - curl/tests/testcurl.pl | 814 - curl/tests/tftpserver.pl | 110 - curl/tests/unit/CMakeLists.txt | 54 - curl/tests/unit/Makefile.am | 72 - curl/tests/unit/Makefile.in | 1844 - curl/tests/unit/Makefile.inc | 87 - curl/tests/unit/README | 70 - curl/tests/unit/curlcheck.h | 102 - curl/tests/unit/unit1300.c | 270 - curl/tests/unit/unit1301.c | 54 - curl/tests/unit/unit1302.c | 165 - curl/tests/unit/unit1303.c | 149 - curl/tests/unit/unit1304.c | 189 - curl/tests/unit/unit1305.c | 139 - curl/tests/unit/unit1307.c | 234 - curl/tests/unit/unit1308.c | 95 - curl/tests/unit/unit1309.c | 145 - curl/tests/unit/unit1323.c | 66 - curl/tests/unit/unit1394.c | 126 - curl/tests/unit/unit1395.c | 94 - curl/tests/unit/unit1396.c | 115 - curl/tests/unit/unit1397.c | 79 - curl/tests/unit/unit1398.c | 91 - curl/tests/unit/unit1399.c | 117 - curl/tests/unit/unit1600.c | 71 - curl/tests/unit/unit1602.c | 78 - curl/tests/unit/unit1603.c | 150 - curl/tests/unit/unit1604.c | 353 - curl/tests/unit/unit1605.c | 55 - curl/tests/unit/unit1606.c | 89 - curl/tests/valgrind.supp | 110 - curl/winbuild/.gitignore | 2 + curl/winbuild/BUILD.WINDOWS.txt | 107 - curl/winbuild/Makefile.vc | 97 +- curl/winbuild/MakefileBuild.vc | 299 +- curl/winbuild/README.md | 133 + curl/winbuild/gen_resp_file.bat | 36 +- curl/winbuild/makedebug.cmd | 34 + vcproj/GUP.vcxproj | 30 +- 2837 files changed, 111087 insertions(+), 346228 deletions(-) create mode 100644 curl/.azure-pipelines.yml create mode 100644 curl/.circleci/config.yml create mode 100644 curl/.cirrus.yml create mode 100644 curl/.dcignore create mode 100644 curl/.dir-locals.el create mode 100644 curl/.gitattributes create mode 100644 curl/.github/CONTRIBUTING.md create mode 100644 curl/.github/FUNDING.yml create mode 100644 curl/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 curl/.github/ISSUE_TEMPLATE/config.yml create mode 100644 curl/.github/lock.yml create mode 100644 curl/.github/stale.yml create mode 100644 curl/.github/workflows/codeql-analysis.yml create mode 100644 curl/.github/workflows/fuzz.yml create mode 100644 curl/.github/workflows/linux-hyper.yml create mode 100644 curl/.github/workflows/macos.yml create mode 100644 curl/.gitignore create mode 100644 curl/.lgtm.yml create mode 100644 curl/.mailmap create mode 100644 curl/.muse/config.toml create mode 100644 curl/.muse/setup.sh create mode 100644 curl/CMake/FindBearSSL.cmake create mode 100644 curl/CMake/FindBrotli.cmake create mode 100644 curl/CMake/FindNGHTTP3.cmake create mode 100644 curl/CMake/FindNGTCP2.cmake create mode 100644 curl/CMake/FindNSS.cmake create mode 100644 curl/CMake/FindQUICHE.cmake create mode 100644 curl/CMake/FindWolfSSL.cmake create mode 100644 curl/CMake/FindZstd.cmake create mode 100644 curl/CMake/curl-config.cmake.in create mode 100644 curl/GIT-INFO create mode 100644 curl/Makefile.dist delete mode 100644 curl/Makefile.in create mode 100644 curl/README.md create mode 100644 curl/SECURITY.md delete mode 100644 curl/aclocal.m4 create mode 100644 curl/appveyor.yml delete mode 100644 curl/compile delete mode 100644 curl/config.guess delete mode 100644 curl/config.sub delete mode 100644 curl/configure delete mode 100644 curl/depcomp create mode 100644 curl/docs/.gitignore create mode 100644 curl/docs/ALTSVC.md create mode 100644 curl/docs/BUFREF.md create mode 100644 curl/docs/BUG-BOUNTY.md delete mode 100644 curl/docs/BUGS create mode 100644 curl/docs/BUGS.md create mode 100644 curl/docs/CODE_REVIEW.md create mode 100644 curl/docs/CURL-DISABLE.md create mode 100644 curl/docs/DEPRECATE.md create mode 100644 curl/docs/DYNBUF.md create mode 100644 curl/docs/ECH.md create mode 100644 curl/docs/EXPERIMENTAL.md rename curl/docs/{FEATURES => FEATURES.md} (53%) create mode 100644 curl/docs/GOVERNANCE.md create mode 100644 curl/docs/HSTS.md create mode 100644 curl/docs/HTTP3.md create mode 100644 curl/docs/HYPER.md delete mode 100644 curl/docs/LICENSE-MIXING.md delete mode 100644 curl/docs/MANUAL create mode 100644 curl/docs/MANUAL.md create mode 100644 curl/docs/MQTT.md delete mode 100644 curl/docs/Makefile.in create mode 100644 curl/docs/NEW-PROTOCOL.md create mode 100644 curl/docs/PARALLEL-TRANSFERS.md delete mode 100644 curl/docs/README.cmake delete mode 100644 curl/docs/README.netware delete mode 100644 curl/docs/README.win32 rename curl/docs/{RELEASE-PROCEDURE => RELEASE-PROCEDURE.md} (65%) delete mode 100644 curl/docs/RESOURCES create mode 100644 curl/docs/RUSTLS.md rename curl/docs/{SECURITY.md => SECURITY-PROCESS.md} (51%) create mode 100644 curl/docs/THANKS-filter delete mode 100644 curl/docs/TheArtOfHttpScripting create mode 100644 curl/docs/TheArtOfHttpScripting.md create mode 100644 curl/docs/URL-SYNTAX.md rename curl/docs/{VERSIONS => VERSIONS.md} (80%) delete mode 100644 curl/docs/cmdline-opts/Makefile.in delete mode 100644 curl/docs/curl.1 create mode 100644 curl/docs/examples/.checksrc create mode 100644 curl/docs/examples/.gitignore delete mode 100644 curl/docs/examples/Makefile.in rename curl/docs/examples/{README => README.md} (54%) create mode 100644 curl/docs/examples/adddocsref.pl rename curl/{tests/libtest/lib501.c => docs/examples/altsvc.c} (51%) delete mode 100644 curl/docs/examples/asiohiper.cpp create mode 100644 curl/docs/examples/crawler.c create mode 100644 curl/docs/examples/ephiperfifo.c rename curl/{tests/libtest/lib511.c => docs/examples/getreferrer.c} (51%) create mode 100644 curl/docs/examples/http2-pushinmemory.c rename curl/{tests/libtest/lib1508.c => docs/examples/http3-present.c} (58%) rename curl/{tests/libtest/lib1551.c => docs/examples/http3.c} (55%) create mode 100644 curl/docs/examples/httpput-postfields.c create mode 100644 curl/docs/examples/imap-authzid.c create mode 100644 curl/docs/examples/multi-event.c rename curl/{tests/libtest/lib1531.c => docs/examples/multi-legacy.c} (64%) create mode 100644 curl/docs/examples/parseurl.c rename curl/docs/examples/{persistant.c => persistent.c} (88%) create mode 100644 curl/docs/examples/pop3-authzid.c create mode 100644 curl/docs/examples/sftpuploadresume.c create mode 100644 curl/docs/examples/shared-connection-cache.c create mode 100644 curl/docs/examples/smtp-authzid.c rename curl/{tests/libtest/lib542.c => docs/examples/urlapi.c} (50%) create mode 100644 curl/docs/libcurl/.gitignore rename curl/docs/libcurl/{ABI => ABI.md} (65%) delete mode 100644 curl/docs/libcurl/Makefile.in create mode 100644 curl/docs/libcurl/curl_easy_option_by_id.3 create mode 100644 curl/docs/libcurl/curl_easy_option_by_name.3 create mode 100644 curl/docs/libcurl/curl_easy_option_next.3 create mode 100644 curl/docs/libcurl/curl_easy_upkeep.3 create mode 100644 curl/docs/libcurl/curl_multi_poll.3 create mode 100644 curl/docs/libcurl/curl_multi_wakeup.3 create mode 100644 curl/docs/libcurl/curl_url.3 create mode 100644 curl/docs/libcurl/curl_url_cleanup.3 create mode 100644 curl/docs/libcurl/curl_url_dup.3 create mode 100644 curl/docs/libcurl/curl_url_get.3 create mode 100644 curl/docs/libcurl/curl_url_set.3 delete mode 100644 curl/docs/libcurl/index.html create mode 100644 curl/docs/libcurl/libcurl-env.3 create mode 100644 curl/docs/libcurl/libcurl-security.3 delete mode 100644 curl/docs/libcurl/libcurl-symbols.3 create mode 100644 curl/docs/libcurl/libcurl-url.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_CONNECT_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_EFFECTIVE_METHOD.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_FILETIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_PROXY_ERROR.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_REDIRECT_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_REFERER.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_RETRY_AFTER.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLINFO_TOTAL_TIME_T.3 create mode 100644 curl/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_ALTSVC.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_ALTSVC_CTRL.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_AWS_SIGV4.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_CAINFO_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_CURLU.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DISALLOW_USERNAME_IN_URL.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DNS_SHUFFLE_ADDRESSES.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYHOST.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYPEER.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DOH_SSL_VERIFYSTATUS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_DOH_URL.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HAPROXYPROTOCOL.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTSREADDATA.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTSREADFUNCTION.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTSWRITEDATA.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTSWRITEFUNCTION.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HSTS_CTRL.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_HTTP09_ALLOWED.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_ISSUERCERT_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_MAIL_RCPT_ALLLOWFAILS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_MAXAGE_CONN.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_CAINFO_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_ISSUERCERT_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_SSLCERT_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_SSLKEY_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_PROXY_TLS13_CIPHERS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_SASL_AUTHZID.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_SSLCERT_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_SSLKEY_BLOB.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_SSL_EC_CURVES.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_TLS13_CIPHERS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_TRAILERDATA.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_TRAILERFUNCTION.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_UPKEEP_INTERVAL_MS.3 create mode 100644 curl/docs/libcurl/opts/CURLOPT_UPLOAD_BUFFERSIZE.3 delete mode 100644 curl/docs/libcurl/opts/Makefile.in create mode 100644 curl/docs/libcurl/opts/template.3 create mode 100644 curl/docs/options-in-versions delete mode 100644 curl/include/Makefile.in delete mode 100644 curl/include/README create mode 100644 curl/include/README.md create mode 100644 curl/include/curl/.gitignore delete mode 100644 curl/include/curl/Makefile.in create mode 100644 curl/include/curl/options.h create mode 100644 curl/include/curl/urlapi.h delete mode 100644 curl/install-sh create mode 100644 curl/lib/.checksrc create mode 100644 curl/lib/.gitattributes create mode 100644 curl/lib/.gitignore delete mode 100644 curl/lib/Makefile.Watcom delete mode 100644 curl/lib/Makefile.b32 delete mode 100644 curl/lib/Makefile.in create mode 100644 curl/lib/altsvc.c create mode 100644 curl/lib/altsvc.h create mode 100644 curl/lib/bufref.c rename curl/{tests/unit/unit1601.c => lib/bufref.h} (50%) create mode 100644 curl/lib/c-hyper.c create mode 100644 curl/lib/c-hyper.h create mode 100644 curl/lib/config-plan9.h delete mode 100644 curl/lib/config-symbian.h delete mode 100644 curl/lib/curl_config.h.in create mode 100644 curl/lib/curl_ctype.c create mode 100644 curl/lib/curl_ctype.h create mode 100644 curl/lib/curl_get_line.c create mode 100644 curl/lib/curl_get_line.h rename curl/lib/{curl_sec.h => curl_krb5.h} (75%) create mode 100644 curl/lib/curl_path.c create mode 100644 curl/lib/curl_path.h create mode 100644 curl/lib/curl_range.c rename curl/{tests/server/server_setup.h => lib/curl_range.h} (72%) rename curl/{tests/server/server_sockaddr.h => lib/curl_sha256.h} (62%) create mode 100644 curl/lib/doh.c create mode 100644 curl/lib/doh.h create mode 100644 curl/lib/dynbuf.c create mode 100644 curl/lib/dynbuf.h create mode 100644 curl/lib/easygetopt.c create mode 100644 curl/lib/easyoptions.c rename curl/lib/{vtls/axtls.h => easyoptions.h} (68%) create mode 100644 curl/lib/hsts.c create mode 100644 curl/lib/hsts.h create mode 100644 curl/lib/http_aws_sigv4.c rename curl/lib/{vtls/cyassl.h => http_aws_sigv4.h} (76%) create mode 100644 curl/lib/mqtt.c create mode 100644 curl/lib/mqtt.h delete mode 100644 curl/lib/objnames-test08.sh delete mode 100644 curl/lib/objnames-test10.sh delete mode 100644 curl/lib/objnames.inc create mode 100644 curl/lib/optiontable.pl delete mode 100644 curl/lib/pipeline.c delete mode 100644 curl/lib/pipeline.h create mode 100644 curl/lib/psl.c rename curl/{tests/libtest/testtrace.h => lib/psl.h} (54%) create mode 100644 curl/lib/quic.h create mode 100644 curl/lib/rename.c create mode 100644 curl/lib/rename.h delete mode 100644 curl/lib/security.c create mode 100644 curl/lib/setopt.c create mode 100644 curl/lib/setopt.h create mode 100644 curl/lib/setup-win32.h create mode 100644 curl/lib/sha256.c create mode 100644 curl/lib/socketpair.c create mode 100644 curl/lib/socketpair.h rename curl/{tests/server/getpart.h => lib/urlapi-int.h} (63%) create mode 100644 curl/lib/urlapi.c create mode 100644 curl/lib/vauth/gsasl.c create mode 100644 curl/lib/version_win32.c create mode 100644 curl/lib/version_win32.h create mode 100644 curl/lib/vquic/ngtcp2.c create mode 100644 curl/lib/vquic/ngtcp2.h create mode 100644 curl/lib/vquic/quiche.c rename curl/{tests/libtest/chkhostname.c => lib/vquic/quiche.h} (56%) create mode 100644 curl/lib/vquic/vquic.c create mode 100644 curl/lib/vquic/vquic.h create mode 100644 curl/lib/vssh/libssh.c rename curl/lib/{ssh.c => vssh/libssh2.c} (61%) rename curl/lib/{ => vssh}/ssh.h (75%) create mode 100644 curl/lib/vssh/wolfssh.c create mode 100644 curl/lib/vssh/wolfssh.h delete mode 100644 curl/lib/vtls/axtls.c create mode 100644 curl/lib/vtls/bearssl.c create mode 100644 curl/lib/vtls/bearssl.h delete mode 100644 curl/lib/vtls/darwinssl.c create mode 100644 curl/lib/vtls/keylog.c create mode 100644 curl/lib/vtls/keylog.h create mode 100644 curl/lib/vtls/mbedtls_threadlock.c rename curl/lib/vtls/{polarssl_threadlock.h => mbedtls_threadlock.h} (51%) create mode 100644 curl/lib/vtls/mesalink.c create mode 100644 curl/lib/vtls/mesalink.h delete mode 100644 curl/lib/vtls/polarssl.c delete mode 100644 curl/lib/vtls/polarssl_threadlock.c create mode 100644 curl/lib/vtls/rustls.c create mode 100644 curl/lib/vtls/rustls.h create mode 100644 curl/lib/vtls/schannel_verify.c create mode 100644 curl/lib/vtls/sectransp.c rename curl/lib/vtls/{darwinssl.h => sectransp.h} (75%) rename curl/lib/vtls/{cyassl.c => wolfssl.c} (50%) rename curl/lib/vtls/{polarssl.h => wolfssl.h} (70%) delete mode 100644 curl/ltmain.sh create mode 100644 curl/m4/.gitignore delete mode 100644 curl/m4/ax_code_coverage.m4 create mode 100644 curl/m4/ax_compile_check_sizeof.m4 create mode 100644 curl/m4/curl-amissl.m4 create mode 100644 curl/m4/curl-bearssl.m4 create mode 100644 curl/m4/curl-gnutls.m4 create mode 100644 curl/m4/curl-mbedtls.m4 create mode 100644 curl/m4/curl-mesalink.m4 create mode 100644 curl/m4/curl-nss.m4 create mode 100644 curl/m4/curl-rustls.m4 create mode 100644 curl/m4/curl-schannel.m4 create mode 100644 curl/m4/curl-sectransp.m4 create mode 100644 curl/m4/curl-sysconfig.m4 create mode 100644 curl/m4/curl-wolfssl.m4 delete mode 100644 curl/m4/libtool.m4 delete mode 100644 curl/m4/ltoptions.m4 delete mode 100644 curl/m4/ltsugar.m4 delete mode 100644 curl/m4/ltversion.m4 delete mode 100644 curl/m4/lt~obsolete.m4 delete mode 100644 curl/missing delete mode 100644 curl/packages/AIX/Makefile.am delete mode 100644 curl/packages/AIX/Makefile.in delete mode 100644 curl/packages/AIX/RPM/Makefile.am delete mode 100644 curl/packages/AIX/RPM/Makefile.in delete mode 100644 curl/packages/AIX/RPM/README delete mode 100644 curl/packages/AIX/RPM/curl.spec.in delete mode 100644 curl/packages/EPM/Makefile.am delete mode 100644 curl/packages/EPM/Makefile.in delete mode 100644 curl/packages/EPM/README delete mode 100644 curl/packages/EPM/curl.list.in delete mode 100644 curl/packages/Linux/Makefile.am delete mode 100644 curl/packages/Linux/Makefile.in delete mode 100644 curl/packages/Linux/RPM/Makefile.am delete mode 100644 curl/packages/Linux/RPM/Makefile.in delete mode 100644 curl/packages/Linux/RPM/README delete mode 100644 curl/packages/Linux/RPM/curl-ssl.spec.in delete mode 100644 curl/packages/Linux/RPM/curl.spec.in delete mode 100644 curl/packages/Linux/RPM/make_curl_rpm delete mode 100644 curl/packages/Makefile.in delete mode 100644 curl/packages/NetWare/get_exp.awk delete mode 100644 curl/packages/NetWare/get_ver.awk create mode 100644 curl/packages/OS400/chkstrings.c delete mode 100644 curl/packages/Solaris/Makefile.am delete mode 100644 curl/packages/Solaris/Makefile.in delete mode 100644 curl/packages/Symbian/bwins/libcurlu.def delete mode 100644 curl/packages/Symbian/eabi/libcurlu.def delete mode 100644 curl/packages/Symbian/group/bld.inf delete mode 100644 curl/packages/Symbian/group/curl.iby delete mode 100644 curl/packages/Symbian/group/curl.mmp delete mode 100644 curl/packages/Symbian/group/curl.pkg delete mode 100644 curl/packages/Symbian/group/libcurl.iby delete mode 100644 curl/packages/Symbian/group/libcurl.mmp delete mode 100644 curl/packages/Symbian/group/libcurl.pkg delete mode 100644 curl/packages/Symbian/readme.txt delete mode 100644 curl/packages/Win32/Makefile.am delete mode 100644 curl/packages/Win32/Makefile.in delete mode 100644 curl/packages/Win32/README delete mode 100644 curl/packages/Win32/cygwin/Makefile.am delete mode 100644 curl/packages/Win32/cygwin/Makefile.in delete mode 100644 curl/packages/Win32/cygwin/README delete mode 100644 curl/packages/vms/Makefile.in create mode 100644 curl/plan9/README create mode 100644 curl/plan9/include/mkfile create mode 100644 curl/plan9/lib/mkfile rename curl/{tests/certs/scripts/Makefile.am => plan9/lib/mkfile.inc} (79%) rename curl/{tests/valgrind.pm => plan9/mkfile} (75%) create mode 100644 curl/plan9/mkfile.proto rename curl/{tests/extern-scan.pl => plan9/src/mkfile} (53%) create mode 100644 curl/plan9/src/mkfile.inc create mode 100644 curl/projects/Windows/.gitattributes create mode 100644 curl/projects/Windows/.gitignore create mode 100644 curl/projects/Windows/VC10/.gitignore create mode 100644 curl/projects/Windows/VC10/lib/.gitignore rename curl/projects/Windows/VC10/lib/{libcurl.vcxproj => libcurl.tmpl} (84%) create mode 100644 curl/projects/Windows/VC10/src/.gitignore rename curl/projects/Windows/VC10/src/{curl.vcxproj => curl.tmpl} (94%) create mode 100644 curl/projects/Windows/VC11/.gitignore create mode 100644 curl/projects/Windows/VC11/lib/.gitignore rename curl/projects/Windows/VC11/lib/{libcurl.vcxproj => libcurl.tmpl} (84%) create mode 100644 curl/projects/Windows/VC11/src/.gitignore rename curl/projects/Windows/VC11/src/{curl.vcxproj => curl.tmpl} (94%) create mode 100644 curl/projects/Windows/VC12/.gitignore create mode 100644 curl/projects/Windows/VC12/lib/.gitignore rename curl/projects/Windows/VC12/lib/{libcurl.vcxproj => libcurl.tmpl} (84%) create mode 100644 curl/projects/Windows/VC12/src/.gitignore rename curl/projects/Windows/VC12/src/{curl.vcxproj => curl.tmpl} (94%) create mode 100644 curl/projects/Windows/VC14/.gitignore create mode 100644 curl/projects/Windows/VC14/lib/.gitignore rename curl/projects/Windows/VC14/lib/{libcurl.vcxproj => libcurl.tmpl} (84%) create mode 100644 curl/projects/Windows/VC14/src/.gitignore rename curl/projects/Windows/VC14/src/{curl.vcxproj => curl.tmpl} (94%) create mode 100644 curl/projects/Windows/VC15/.gitignore create mode 100644 curl/projects/Windows/VC15/curl-all.sln create mode 100644 curl/projects/Windows/VC15/lib/.gitignore create mode 100644 curl/projects/Windows/VC15/lib/libcurl.sln create mode 100644 curl/projects/Windows/VC15/lib/libcurl.tmpl create mode 100644 curl/projects/Windows/VC15/lib/libcurl.vcxproj.filters create mode 100644 curl/projects/Windows/VC15/src/.gitignore create mode 100644 curl/projects/Windows/VC15/src/curl.sln create mode 100644 curl/projects/Windows/VC15/src/curl.tmpl create mode 100644 curl/projects/Windows/VC15/src/curl.vcxproj.filters create mode 100644 curl/projects/Windows/VC6/.gitignore create mode 100644 curl/projects/Windows/VC6/lib/.gitignore rename curl/projects/Windows/VC6/lib/{libcurl.dsp => libcurl.tmpl} (60%) create mode 100644 curl/projects/Windows/VC6/src/.gitignore rename curl/projects/Windows/VC6/src/{curl.dsp => curl.tmpl} (77%) create mode 100644 curl/projects/Windows/VC7.1/.gitignore create mode 100644 curl/projects/Windows/VC7.1/lib/.gitignore rename curl/projects/Windows/VC7.1/lib/{libcurl.vcproj => libcurl.tmpl} (69%) create mode 100644 curl/projects/Windows/VC7.1/src/.gitignore rename curl/projects/Windows/VC7.1/src/{curl.vcproj => curl.tmpl} (86%) create mode 100644 curl/projects/Windows/VC7/.gitignore create mode 100644 curl/projects/Windows/VC7/lib/.gitignore rename curl/projects/Windows/VC7/lib/{libcurl.vcproj => libcurl.tmpl} (67%) create mode 100644 curl/projects/Windows/VC7/src/.gitignore rename curl/projects/Windows/VC7/src/{curl.vcproj => curl.tmpl} (85%) create mode 100644 curl/projects/Windows/VC8/.gitignore create mode 100644 curl/projects/Windows/VC8/lib/.gitignore rename curl/projects/Windows/VC8/lib/{libcurl.vcproj => libcurl.tmpl} (80%) create mode 100644 curl/projects/Windows/VC8/src/.gitignore rename curl/projects/Windows/VC8/src/{curl.vcproj => curl.tmpl} (92%) create mode 100644 curl/projects/Windows/VC9/.gitignore create mode 100644 curl/projects/Windows/VC9/lib/.gitignore rename curl/projects/Windows/VC9/lib/{libcurl.vcproj => libcurl.tmpl} (78%) create mode 100644 curl/projects/Windows/VC9/src/.gitignore rename curl/projects/Windows/VC9/src/{curl.vcproj => curl.tmpl} (92%) delete mode 100644 curl/scripts/Makefile.in create mode 100644 curl/scripts/completion.pl create mode 100644 curl/scripts/contributors.sh create mode 100644 curl/scripts/contrithanks.sh create mode 100644 curl/scripts/copyright.pl create mode 100644 curl/scripts/delta create mode 100644 curl/scripts/installcheck.sh create mode 100644 curl/scripts/log2changes.pl create mode 100644 curl/scripts/release-notes.pl create mode 100644 curl/scripts/singleuse.pl delete mode 100644 curl/scripts/zsh.pl create mode 100644 curl/scripts/zuul/before_script.sh create mode 100644 curl/scripts/zuul/iconv-env.sh create mode 100644 curl/scripts/zuul/script.sh create mode 100644 curl/src/.gitignore delete mode 100644 curl/src/Makefile.Watcom delete mode 100644 curl/src/Makefile.b32 delete mode 100644 curl/src/Makefile.in create mode 100644 curl/src/tool_filetime.c rename curl/{tests/libtest/sethostname.h => src/tool_filetime.h} (55%) rename curl/{tests/unit/unit1330.c => src/tool_hugehelp.c.cvs} (72%) delete mode 100644 curl/src/tool_metalink.c delete mode 100644 curl/src/tool_metalink.h create mode 100644 curl/src/tool_progress.c rename curl/{tests/libtest/sethostname.c => src/tool_progress.h} (57%) create mode 100644 curl/src/tool_writeout_json.c create mode 100644 curl/src/tool_writeout_json.h delete mode 100644 curl/test-driver delete mode 100644 curl/tests/CMakeLists.txt delete mode 100644 curl/tests/FILEFORMAT delete mode 100644 curl/tests/Makefile.am delete mode 100644 curl/tests/Makefile.in delete mode 100644 curl/tests/README delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.cacert delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.cnf delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.crt delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.csr delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.der delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.key delete mode 100644 curl/tests/certs/EdelCurlRoot-ca.prm delete mode 100644 curl/tests/certs/Makefile.am delete mode 100644 curl/tests/certs/Makefile.in delete mode 100644 curl/tests/certs/Server-localhost-sv.crl delete mode 100644 curl/tests/certs/Server-localhost-sv.crt delete mode 100644 curl/tests/certs/Server-localhost-sv.csr delete mode 100644 curl/tests/certs/Server-localhost-sv.der delete mode 100644 curl/tests/certs/Server-localhost-sv.dhp delete mode 100644 curl/tests/certs/Server-localhost-sv.key delete mode 100644 curl/tests/certs/Server-localhost-sv.pem delete mode 100644 curl/tests/certs/Server-localhost-sv.prm delete mode 100644 curl/tests/certs/Server-localhost-sv.pub.der delete mode 100644 curl/tests/certs/Server-localhost-sv.pub.pem delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.crl delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.crt delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.csr delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.der delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.dhp delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.key delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.pem delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.prm delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.pub.der delete mode 100644 curl/tests/certs/Server-localhost.nn-sv.pub.pem delete mode 100644 curl/tests/certs/Server-localhost0h-sv.crl delete mode 100644 curl/tests/certs/Server-localhost0h-sv.crt delete mode 100644 curl/tests/certs/Server-localhost0h-sv.csr delete mode 100644 curl/tests/certs/Server-localhost0h-sv.der delete mode 100644 curl/tests/certs/Server-localhost0h-sv.dhp delete mode 100644 curl/tests/certs/Server-localhost0h-sv.key delete mode 100644 curl/tests/certs/Server-localhost0h-sv.pem delete mode 100644 curl/tests/certs/Server-localhost0h-sv.prm delete mode 100644 curl/tests/certs/Server-localhost0h-sv.pub.der delete mode 100644 curl/tests/certs/Server-localhost0h-sv.pub.pem delete mode 100644 curl/tests/certs/scripts/Makefile.in delete mode 100644 curl/tests/certs/scripts/genroot.sh delete mode 100644 curl/tests/certs/scripts/genserv.sh delete mode 100644 curl/tests/certs/srp-verifier-conf delete mode 100644 curl/tests/certs/srp-verifier-db delete mode 100644 curl/tests/curl_test_data.py delete mode 100644 curl/tests/data/CMakeLists.txt delete mode 100644 curl/tests/data/DISABLED delete mode 100644 curl/tests/data/Makefile.am delete mode 100644 curl/tests/data/Makefile.in delete mode 100644 curl/tests/data/Makefile.inc delete mode 100644 curl/tests/data/test1 delete mode 100644 curl/tests/data/test10 delete mode 100644 curl/tests/data/test100 delete mode 100644 curl/tests/data/test1000 delete mode 100644 curl/tests/data/test1001 delete mode 100644 curl/tests/data/test1002 delete mode 100644 curl/tests/data/test1003 delete mode 100644 curl/tests/data/test1004 delete mode 100644 curl/tests/data/test1005 delete mode 100644 curl/tests/data/test1006 delete mode 100644 curl/tests/data/test1007 delete mode 100644 curl/tests/data/test1008 delete mode 100644 curl/tests/data/test1009 delete mode 100644 curl/tests/data/test101 delete mode 100644 curl/tests/data/test1010 delete mode 100644 curl/tests/data/test1011 delete mode 100644 curl/tests/data/test1012 delete mode 100644 curl/tests/data/test1013 delete mode 100644 curl/tests/data/test1014 delete mode 100644 curl/tests/data/test1015 delete mode 100644 curl/tests/data/test1016 delete mode 100644 curl/tests/data/test1017 delete mode 100644 curl/tests/data/test1018 delete mode 100644 curl/tests/data/test1019 delete mode 100644 curl/tests/data/test102 delete mode 100644 curl/tests/data/test1020 delete mode 100644 curl/tests/data/test1021 delete mode 100644 curl/tests/data/test1022 delete mode 100644 curl/tests/data/test1023 delete mode 100644 curl/tests/data/test1024 delete mode 100644 curl/tests/data/test1025 delete mode 100644 curl/tests/data/test1026 delete mode 100644 curl/tests/data/test1027 delete mode 100644 curl/tests/data/test1028 delete mode 100644 curl/tests/data/test1029 delete mode 100644 curl/tests/data/test103 delete mode 100644 curl/tests/data/test1030 delete mode 100644 curl/tests/data/test1031 delete mode 100644 curl/tests/data/test1032 delete mode 100644 curl/tests/data/test1033 delete mode 100644 curl/tests/data/test1034 delete mode 100644 curl/tests/data/test1035 delete mode 100644 curl/tests/data/test1036 delete mode 100644 curl/tests/data/test1037 delete mode 100644 curl/tests/data/test1038 delete mode 100644 curl/tests/data/test1039 delete mode 100644 curl/tests/data/test104 delete mode 100644 curl/tests/data/test1040 delete mode 100644 curl/tests/data/test1041 delete mode 100644 curl/tests/data/test1042 delete mode 100644 curl/tests/data/test1043 delete mode 100644 curl/tests/data/test1044 delete mode 100644 curl/tests/data/test1045 delete mode 100644 curl/tests/data/test1046 delete mode 100644 curl/tests/data/test1047 delete mode 100644 curl/tests/data/test1048 delete mode 100644 curl/tests/data/test1049 delete mode 100644 curl/tests/data/test105 delete mode 100644 curl/tests/data/test1050 delete mode 100644 curl/tests/data/test1051 delete mode 100644 curl/tests/data/test1052 delete mode 100644 curl/tests/data/test1053 delete mode 100644 curl/tests/data/test1054 delete mode 100644 curl/tests/data/test1055 delete mode 100644 curl/tests/data/test1056 delete mode 100644 curl/tests/data/test1057 delete mode 100644 curl/tests/data/test1058 delete mode 100644 curl/tests/data/test1059 delete mode 100644 curl/tests/data/test106 delete mode 100644 curl/tests/data/test1060 delete mode 100644 curl/tests/data/test1061 delete mode 100644 curl/tests/data/test1062 delete mode 100644 curl/tests/data/test1063 delete mode 100644 curl/tests/data/test1064 delete mode 100644 curl/tests/data/test1065 delete mode 100644 curl/tests/data/test1066 delete mode 100644 curl/tests/data/test1067 delete mode 100644 curl/tests/data/test1068 delete mode 100644 curl/tests/data/test1069 delete mode 100644 curl/tests/data/test107 delete mode 100644 curl/tests/data/test1070 delete mode 100644 curl/tests/data/test1071 delete mode 100644 curl/tests/data/test1072 delete mode 100644 curl/tests/data/test1073 delete mode 100644 curl/tests/data/test1074 delete mode 100644 curl/tests/data/test1075 delete mode 100644 curl/tests/data/test1076 delete mode 100644 curl/tests/data/test1077 delete mode 100644 curl/tests/data/test1078 delete mode 100644 curl/tests/data/test1079 delete mode 100644 curl/tests/data/test108 delete mode 100644 curl/tests/data/test1080 delete mode 100644 curl/tests/data/test1081 delete mode 100644 curl/tests/data/test1082 delete mode 100644 curl/tests/data/test1083 delete mode 100644 curl/tests/data/test1084 delete mode 100644 curl/tests/data/test1085 delete mode 100644 curl/tests/data/test1086 delete mode 100644 curl/tests/data/test1087 delete mode 100644 curl/tests/data/test1088 delete mode 100644 curl/tests/data/test1089 delete mode 100644 curl/tests/data/test109 delete mode 100644 curl/tests/data/test1090 delete mode 100644 curl/tests/data/test1091 delete mode 100644 curl/tests/data/test1092 delete mode 100644 curl/tests/data/test1093 delete mode 100644 curl/tests/data/test1094 delete mode 100644 curl/tests/data/test1095 delete mode 100644 curl/tests/data/test1096 delete mode 100644 curl/tests/data/test1097 delete mode 100644 curl/tests/data/test1098 delete mode 100644 curl/tests/data/test1099 delete mode 100644 curl/tests/data/test11 delete mode 100644 curl/tests/data/test110 delete mode 100644 curl/tests/data/test1100 delete mode 100644 curl/tests/data/test1101 delete mode 100644 curl/tests/data/test1102 delete mode 100644 curl/tests/data/test1103 delete mode 100644 curl/tests/data/test1104 delete mode 100644 curl/tests/data/test1105 delete mode 100644 curl/tests/data/test1106 delete mode 100644 curl/tests/data/test1107 delete mode 100644 curl/tests/data/test1108 delete mode 100644 curl/tests/data/test1109 delete mode 100644 curl/tests/data/test111 delete mode 100644 curl/tests/data/test1110 delete mode 100644 curl/tests/data/test1111 delete mode 100644 curl/tests/data/test1112 delete mode 100644 curl/tests/data/test1113 delete mode 100644 curl/tests/data/test1114 delete mode 100644 curl/tests/data/test1115 delete mode 100644 curl/tests/data/test1116 delete mode 100644 curl/tests/data/test1117 delete mode 100644 curl/tests/data/test1118 delete mode 100644 curl/tests/data/test1119 delete mode 100644 curl/tests/data/test112 delete mode 100644 curl/tests/data/test1120 delete mode 100644 curl/tests/data/test1121 delete mode 100644 curl/tests/data/test1122 delete mode 100644 curl/tests/data/test1123 delete mode 100644 curl/tests/data/test1124 delete mode 100644 curl/tests/data/test1125 delete mode 100644 curl/tests/data/test1126 delete mode 100644 curl/tests/data/test1127 delete mode 100644 curl/tests/data/test1128 delete mode 100644 curl/tests/data/test1129 delete mode 100644 curl/tests/data/test113 delete mode 100644 curl/tests/data/test1130 delete mode 100644 curl/tests/data/test1131 delete mode 100644 curl/tests/data/test1132 delete mode 100644 curl/tests/data/test1133 delete mode 100644 curl/tests/data/test1134 delete mode 100644 curl/tests/data/test1135 delete mode 100644 curl/tests/data/test1136 delete mode 100644 curl/tests/data/test1137 delete mode 100644 curl/tests/data/test1138 delete mode 100644 curl/tests/data/test1139 delete mode 100644 curl/tests/data/test114 delete mode 100644 curl/tests/data/test1140 delete mode 100644 curl/tests/data/test1141 delete mode 100644 curl/tests/data/test1142 delete mode 100644 curl/tests/data/test1143 delete mode 100644 curl/tests/data/test1144 delete mode 100644 curl/tests/data/test1145 delete mode 100644 curl/tests/data/test1146 delete mode 100644 curl/tests/data/test1147 delete mode 100644 curl/tests/data/test1148 delete mode 100644 curl/tests/data/test1149 delete mode 100644 curl/tests/data/test115 delete mode 100644 curl/tests/data/test1150 delete mode 100644 curl/tests/data/test1151 delete mode 100644 curl/tests/data/test1152 delete mode 100644 curl/tests/data/test1153 delete mode 100644 curl/tests/data/test116 delete mode 100644 curl/tests/data/test1160 delete mode 100644 curl/tests/data/test1161 delete mode 100644 curl/tests/data/test117 delete mode 100644 curl/tests/data/test118 delete mode 100644 curl/tests/data/test119 delete mode 100644 curl/tests/data/test12 delete mode 100644 curl/tests/data/test120 delete mode 100644 curl/tests/data/test1200 delete mode 100644 curl/tests/data/test1201 delete mode 100644 curl/tests/data/test1202 delete mode 100644 curl/tests/data/test1203 delete mode 100644 curl/tests/data/test1204 delete mode 100644 curl/tests/data/test1205 delete mode 100644 curl/tests/data/test1206 delete mode 100644 curl/tests/data/test1207 delete mode 100644 curl/tests/data/test1208 delete mode 100644 curl/tests/data/test1209 delete mode 100644 curl/tests/data/test121 delete mode 100644 curl/tests/data/test1210 delete mode 100644 curl/tests/data/test1211 delete mode 100644 curl/tests/data/test1212 delete mode 100644 curl/tests/data/test1213 delete mode 100644 curl/tests/data/test1214 delete mode 100644 curl/tests/data/test1215 delete mode 100644 curl/tests/data/test1216 delete mode 100644 curl/tests/data/test1217 delete mode 100644 curl/tests/data/test1218 delete mode 100644 curl/tests/data/test1219 delete mode 100644 curl/tests/data/test122 delete mode 100644 curl/tests/data/test1220 delete mode 100644 curl/tests/data/test1221 delete mode 100644 curl/tests/data/test1222 delete mode 100644 curl/tests/data/test1223 delete mode 100644 curl/tests/data/test1224 delete mode 100644 curl/tests/data/test1225 delete mode 100644 curl/tests/data/test1226 delete mode 100644 curl/tests/data/test1227 delete mode 100644 curl/tests/data/test1228 delete mode 100644 curl/tests/data/test1229 delete mode 100644 curl/tests/data/test123 delete mode 100644 curl/tests/data/test1230 delete mode 100644 curl/tests/data/test1231 delete mode 100644 curl/tests/data/test1232 delete mode 100644 curl/tests/data/test1233 delete mode 100644 curl/tests/data/test1234 delete mode 100644 curl/tests/data/test1235 delete mode 100644 curl/tests/data/test1236 delete mode 100644 curl/tests/data/test1237 delete mode 100644 curl/tests/data/test1238 delete mode 100644 curl/tests/data/test1239 delete mode 100644 curl/tests/data/test124 delete mode 100644 curl/tests/data/test1240 delete mode 100644 curl/tests/data/test1241 delete mode 100644 curl/tests/data/test1242 delete mode 100644 curl/tests/data/test1243 delete mode 100644 curl/tests/data/test1244 delete mode 100644 curl/tests/data/test1245 delete mode 100644 curl/tests/data/test1246 delete mode 100644 curl/tests/data/test1247 delete mode 100644 curl/tests/data/test1248 delete mode 100644 curl/tests/data/test1249 delete mode 100644 curl/tests/data/test125 delete mode 100644 curl/tests/data/test1250 delete mode 100644 curl/tests/data/test1251 delete mode 100644 curl/tests/data/test1252 delete mode 100644 curl/tests/data/test1253 delete mode 100644 curl/tests/data/test1254 delete mode 100644 curl/tests/data/test1255 delete mode 100644 curl/tests/data/test1256 delete mode 100644 curl/tests/data/test1257 delete mode 100644 curl/tests/data/test1258 delete mode 100644 curl/tests/data/test1259 delete mode 100644 curl/tests/data/test126 delete mode 100644 curl/tests/data/test1260 delete mode 100644 curl/tests/data/test1261 delete mode 100644 curl/tests/data/test1262 delete mode 100644 curl/tests/data/test127 delete mode 100644 curl/tests/data/test128 delete mode 100644 curl/tests/data/test1280 delete mode 100644 curl/tests/data/test1281 delete mode 100644 curl/tests/data/test1282 delete mode 100644 curl/tests/data/test1283 delete mode 100644 curl/tests/data/test1284 delete mode 100644 curl/tests/data/test1285 delete mode 100644 curl/tests/data/test1286 delete mode 100644 curl/tests/data/test1287 delete mode 100644 curl/tests/data/test1288 delete mode 100644 curl/tests/data/test1289 delete mode 100644 curl/tests/data/test129 delete mode 100644 curl/tests/data/test1298 delete mode 100644 curl/tests/data/test1299 delete mode 100644 curl/tests/data/test13 delete mode 100644 curl/tests/data/test130 delete mode 100644 curl/tests/data/test1300 delete mode 100644 curl/tests/data/test1301 delete mode 100644 curl/tests/data/test1302 delete mode 100644 curl/tests/data/test1303 delete mode 100644 curl/tests/data/test1304 delete mode 100644 curl/tests/data/test1305 delete mode 100644 curl/tests/data/test1306 delete mode 100644 curl/tests/data/test1307 delete mode 100644 curl/tests/data/test1308 delete mode 100644 curl/tests/data/test1309 delete mode 100644 curl/tests/data/test131 delete mode 100644 curl/tests/data/test1310 delete mode 100644 curl/tests/data/test1311 delete mode 100644 curl/tests/data/test1312 delete mode 100644 curl/tests/data/test1313 delete mode 100644 curl/tests/data/test1314 delete mode 100644 curl/tests/data/test1315 delete mode 100644 curl/tests/data/test1316 delete mode 100644 curl/tests/data/test1317 delete mode 100644 curl/tests/data/test1318 delete mode 100644 curl/tests/data/test1319 delete mode 100644 curl/tests/data/test132 delete mode 100644 curl/tests/data/test1320 delete mode 100644 curl/tests/data/test1321 delete mode 100644 curl/tests/data/test1322 delete mode 100644 curl/tests/data/test1323 delete mode 100644 curl/tests/data/test1325 delete mode 100644 curl/tests/data/test1326 delete mode 100644 curl/tests/data/test1327 delete mode 100644 curl/tests/data/test1328 delete mode 100644 curl/tests/data/test1329 delete mode 100644 curl/tests/data/test133 delete mode 100644 curl/tests/data/test1330 delete mode 100644 curl/tests/data/test1331 delete mode 100644 curl/tests/data/test1332 delete mode 100644 curl/tests/data/test1333 delete mode 100644 curl/tests/data/test1334 delete mode 100644 curl/tests/data/test1335 delete mode 100644 curl/tests/data/test1336 delete mode 100644 curl/tests/data/test1337 delete mode 100644 curl/tests/data/test1338 delete mode 100644 curl/tests/data/test1339 delete mode 100644 curl/tests/data/test134 delete mode 100644 curl/tests/data/test1340 delete mode 100644 curl/tests/data/test1341 delete mode 100644 curl/tests/data/test1342 delete mode 100644 curl/tests/data/test1343 delete mode 100644 curl/tests/data/test1344 delete mode 100644 curl/tests/data/test1345 delete mode 100644 curl/tests/data/test1346 delete mode 100644 curl/tests/data/test1347 delete mode 100644 curl/tests/data/test1348 delete mode 100644 curl/tests/data/test1349 delete mode 100644 curl/tests/data/test135 delete mode 100644 curl/tests/data/test1350 delete mode 100644 curl/tests/data/test1351 delete mode 100644 curl/tests/data/test1352 delete mode 100644 curl/tests/data/test1353 delete mode 100644 curl/tests/data/test1354 delete mode 100644 curl/tests/data/test1355 delete mode 100644 curl/tests/data/test1356 delete mode 100644 curl/tests/data/test1357 delete mode 100644 curl/tests/data/test1358 delete mode 100644 curl/tests/data/test1359 delete mode 100644 curl/tests/data/test136 delete mode 100644 curl/tests/data/test1360 delete mode 100644 curl/tests/data/test1361 delete mode 100644 curl/tests/data/test1362 delete mode 100644 curl/tests/data/test1363 delete mode 100644 curl/tests/data/test1364 delete mode 100644 curl/tests/data/test1365 delete mode 100644 curl/tests/data/test1366 delete mode 100644 curl/tests/data/test1367 delete mode 100644 curl/tests/data/test1368 delete mode 100644 curl/tests/data/test1369 delete mode 100644 curl/tests/data/test137 delete mode 100644 curl/tests/data/test1370 delete mode 100644 curl/tests/data/test1371 delete mode 100644 curl/tests/data/test1372 delete mode 100644 curl/tests/data/test1373 delete mode 100644 curl/tests/data/test1374 delete mode 100644 curl/tests/data/test1375 delete mode 100644 curl/tests/data/test1376 delete mode 100644 curl/tests/data/test1377 delete mode 100644 curl/tests/data/test1378 delete mode 100644 curl/tests/data/test1379 delete mode 100644 curl/tests/data/test138 delete mode 100644 curl/tests/data/test1380 delete mode 100644 curl/tests/data/test1381 delete mode 100644 curl/tests/data/test1382 delete mode 100644 curl/tests/data/test1383 delete mode 100644 curl/tests/data/test1384 delete mode 100644 curl/tests/data/test1385 delete mode 100644 curl/tests/data/test1386 delete mode 100644 curl/tests/data/test1387 delete mode 100644 curl/tests/data/test1388 delete mode 100644 curl/tests/data/test1389 delete mode 100644 curl/tests/data/test139 delete mode 100644 curl/tests/data/test1390 delete mode 100644 curl/tests/data/test1391 delete mode 100644 curl/tests/data/test1392 delete mode 100644 curl/tests/data/test1393 delete mode 100644 curl/tests/data/test1394 delete mode 100644 curl/tests/data/test1395 delete mode 100644 curl/tests/data/test1396 delete mode 100644 curl/tests/data/test1397 delete mode 100644 curl/tests/data/test1398 delete mode 100644 curl/tests/data/test1399 delete mode 100644 curl/tests/data/test14 delete mode 100644 curl/tests/data/test140 delete mode 100644 curl/tests/data/test1400 delete mode 100644 curl/tests/data/test1401 delete mode 100644 curl/tests/data/test1402 delete mode 100644 curl/tests/data/test1403 delete mode 100644 curl/tests/data/test1404 delete mode 100644 curl/tests/data/test1405 delete mode 100644 curl/tests/data/test1406 delete mode 100644 curl/tests/data/test1407 delete mode 100644 curl/tests/data/test1408 delete mode 100644 curl/tests/data/test1409 delete mode 100644 curl/tests/data/test141 delete mode 100644 curl/tests/data/test1410 delete mode 100644 curl/tests/data/test1411 delete mode 100644 curl/tests/data/test1412 delete mode 100644 curl/tests/data/test1413 delete mode 100644 curl/tests/data/test1414 delete mode 100644 curl/tests/data/test1415 delete mode 100644 curl/tests/data/test1416 delete mode 100644 curl/tests/data/test1417 delete mode 100644 curl/tests/data/test1418 delete mode 100644 curl/tests/data/test1419 delete mode 100644 curl/tests/data/test142 delete mode 100644 curl/tests/data/test1420 delete mode 100644 curl/tests/data/test1421 delete mode 100644 curl/tests/data/test1422 delete mode 100644 curl/tests/data/test1423 delete mode 100644 curl/tests/data/test1424 delete mode 100644 curl/tests/data/test1425 delete mode 100644 curl/tests/data/test1426 delete mode 100644 curl/tests/data/test1427 delete mode 100644 curl/tests/data/test1428 delete mode 100644 curl/tests/data/test1429 delete mode 100644 curl/tests/data/test143 delete mode 100644 curl/tests/data/test1430 delete mode 100644 curl/tests/data/test1431 delete mode 100644 curl/tests/data/test1432 delete mode 100644 curl/tests/data/test1433 delete mode 100644 curl/tests/data/test1434 delete mode 100644 curl/tests/data/test1435 delete mode 100644 curl/tests/data/test1436 delete mode 100644 curl/tests/data/test1437 delete mode 100644 curl/tests/data/test1438 delete mode 100644 curl/tests/data/test1439 delete mode 100644 curl/tests/data/test144 delete mode 100644 curl/tests/data/test1440 delete mode 100644 curl/tests/data/test1441 delete mode 100644 curl/tests/data/test1442 delete mode 100644 curl/tests/data/test1443 delete mode 100644 curl/tests/data/test1444 delete mode 100644 curl/tests/data/test1445 delete mode 100644 curl/tests/data/test1446 delete mode 100644 curl/tests/data/test1447 delete mode 100644 curl/tests/data/test1448 delete mode 100644 curl/tests/data/test1449 delete mode 100644 curl/tests/data/test145 delete mode 100644 curl/tests/data/test1450 delete mode 100644 curl/tests/data/test1451 delete mode 100644 curl/tests/data/test1452 delete mode 100644 curl/tests/data/test1453 delete mode 100644 curl/tests/data/test146 delete mode 100644 curl/tests/data/test147 delete mode 100644 curl/tests/data/test148 delete mode 100644 curl/tests/data/test149 delete mode 100644 curl/tests/data/test15 delete mode 100644 curl/tests/data/test150 delete mode 100644 curl/tests/data/test1500 delete mode 100644 curl/tests/data/test1501 delete mode 100644 curl/tests/data/test1502 delete mode 100644 curl/tests/data/test1503 delete mode 100644 curl/tests/data/test1504 delete mode 100644 curl/tests/data/test1505 delete mode 100644 curl/tests/data/test1506 delete mode 100644 curl/tests/data/test1507 delete mode 100644 curl/tests/data/test1508 delete mode 100644 curl/tests/data/test1509 delete mode 100644 curl/tests/data/test151 delete mode 100644 curl/tests/data/test1510 delete mode 100644 curl/tests/data/test1511 delete mode 100644 curl/tests/data/test1512 delete mode 100644 curl/tests/data/test1513 delete mode 100644 curl/tests/data/test1514 delete mode 100644 curl/tests/data/test1515 delete mode 100644 curl/tests/data/test1516 delete mode 100644 curl/tests/data/test1517 delete mode 100644 curl/tests/data/test152 delete mode 100644 curl/tests/data/test1520 delete mode 100644 curl/tests/data/test1521 delete mode 100644 curl/tests/data/test1525 delete mode 100644 curl/tests/data/test1526 delete mode 100644 curl/tests/data/test1527 delete mode 100644 curl/tests/data/test1528 delete mode 100644 curl/tests/data/test1529 delete mode 100644 curl/tests/data/test153 delete mode 100644 curl/tests/data/test1530 delete mode 100644 curl/tests/data/test1531 delete mode 100644 curl/tests/data/test1532 delete mode 100644 curl/tests/data/test1533 delete mode 100644 curl/tests/data/test1534 delete mode 100644 curl/tests/data/test1535 delete mode 100644 curl/tests/data/test1536 delete mode 100644 curl/tests/data/test1537 delete mode 100644 curl/tests/data/test1538 delete mode 100644 curl/tests/data/test154 delete mode 100644 curl/tests/data/test1540 delete mode 100644 curl/tests/data/test155 delete mode 100644 curl/tests/data/test1550 delete mode 100644 curl/tests/data/test1551 delete mode 100644 curl/tests/data/test1552 delete mode 100644 curl/tests/data/test1553 delete mode 100644 curl/tests/data/test156 delete mode 100644 curl/tests/data/test157 delete mode 100644 curl/tests/data/test158 delete mode 100644 curl/tests/data/test159 delete mode 100644 curl/tests/data/test16 delete mode 100644 curl/tests/data/test160 delete mode 100644 curl/tests/data/test1600 delete mode 100644 curl/tests/data/test1601 delete mode 100644 curl/tests/data/test1602 delete mode 100644 curl/tests/data/test1603 delete mode 100644 curl/tests/data/test1604 delete mode 100644 curl/tests/data/test1605 delete mode 100644 curl/tests/data/test1606 delete mode 100644 curl/tests/data/test161 delete mode 100644 curl/tests/data/test162 delete mode 100644 curl/tests/data/test163 delete mode 100644 curl/tests/data/test164 delete mode 100644 curl/tests/data/test165 delete mode 100644 curl/tests/data/test166 delete mode 100644 curl/tests/data/test167 delete mode 100644 curl/tests/data/test168 delete mode 100644 curl/tests/data/test169 delete mode 100644 curl/tests/data/test17 delete mode 100644 curl/tests/data/test170 delete mode 100644 curl/tests/data/test1700 delete mode 100644 curl/tests/data/test1701 delete mode 100644 curl/tests/data/test1702 delete mode 100644 curl/tests/data/test171 delete mode 100644 curl/tests/data/test172 delete mode 100644 curl/tests/data/test173 delete mode 100644 curl/tests/data/test174 delete mode 100644 curl/tests/data/test175 delete mode 100644 curl/tests/data/test176 delete mode 100644 curl/tests/data/test177 delete mode 100644 curl/tests/data/test178 delete mode 100644 curl/tests/data/test179 delete mode 100644 curl/tests/data/test18 delete mode 100644 curl/tests/data/test180 delete mode 100644 curl/tests/data/test1800 delete mode 100644 curl/tests/data/test1801 delete mode 100644 curl/tests/data/test181 delete mode 100644 curl/tests/data/test182 delete mode 100644 curl/tests/data/test183 delete mode 100644 curl/tests/data/test184 delete mode 100644 curl/tests/data/test185 delete mode 100644 curl/tests/data/test186 delete mode 100644 curl/tests/data/test187 delete mode 100644 curl/tests/data/test188 delete mode 100644 curl/tests/data/test189 delete mode 100644 curl/tests/data/test19 delete mode 100644 curl/tests/data/test190 delete mode 100644 curl/tests/data/test1900 delete mode 100644 curl/tests/data/test1901 delete mode 100644 curl/tests/data/test1902 delete mode 100644 curl/tests/data/test1903 delete mode 100644 curl/tests/data/test1904 delete mode 100644 curl/tests/data/test191 delete mode 100644 curl/tests/data/test192 delete mode 100644 curl/tests/data/test193 delete mode 100644 curl/tests/data/test194 delete mode 100644 curl/tests/data/test195 delete mode 100644 curl/tests/data/test196 delete mode 100644 curl/tests/data/test197 delete mode 100644 curl/tests/data/test198 delete mode 100644 curl/tests/data/test199 delete mode 100644 curl/tests/data/test2 delete mode 100644 curl/tests/data/test20 delete mode 100644 curl/tests/data/test200 delete mode 100644 curl/tests/data/test2000 delete mode 100644 curl/tests/data/test2001 delete mode 100644 curl/tests/data/test2002 delete mode 100644 curl/tests/data/test2003 delete mode 100644 curl/tests/data/test2004 delete mode 100644 curl/tests/data/test2005 delete mode 100644 curl/tests/data/test2006 delete mode 100644 curl/tests/data/test2007 delete mode 100644 curl/tests/data/test2008 delete mode 100644 curl/tests/data/test2009 delete mode 100644 curl/tests/data/test201 delete mode 100644 curl/tests/data/test2010 delete mode 100644 curl/tests/data/test2011 delete mode 100644 curl/tests/data/test2012 delete mode 100644 curl/tests/data/test2013 delete mode 100644 curl/tests/data/test2014 delete mode 100644 curl/tests/data/test2015 delete mode 100644 curl/tests/data/test2016 delete mode 100644 curl/tests/data/test2017 delete mode 100644 curl/tests/data/test2018 delete mode 100644 curl/tests/data/test2019 delete mode 100644 curl/tests/data/test202 delete mode 100644 curl/tests/data/test2020 delete mode 100644 curl/tests/data/test2021 delete mode 100644 curl/tests/data/test2022 delete mode 100644 curl/tests/data/test2023 delete mode 100644 curl/tests/data/test2024 delete mode 100644 curl/tests/data/test2025 delete mode 100644 curl/tests/data/test2026 delete mode 100644 curl/tests/data/test2027 delete mode 100644 curl/tests/data/test2028 delete mode 100644 curl/tests/data/test2029 delete mode 100644 curl/tests/data/test203 delete mode 100644 curl/tests/data/test2030 delete mode 100644 curl/tests/data/test2031 delete mode 100644 curl/tests/data/test2032 delete mode 100644 curl/tests/data/test2033 delete mode 100644 curl/tests/data/test2034 delete mode 100644 curl/tests/data/test2035 delete mode 100644 curl/tests/data/test2036 delete mode 100644 curl/tests/data/test2037 delete mode 100644 curl/tests/data/test2038 delete mode 100644 curl/tests/data/test2039 delete mode 100644 curl/tests/data/test204 delete mode 100644 curl/tests/data/test2040 delete mode 100644 curl/tests/data/test2041 delete mode 100644 curl/tests/data/test2042 delete mode 100644 curl/tests/data/test2043 delete mode 100644 curl/tests/data/test2044 delete mode 100644 curl/tests/data/test2045 delete mode 100644 curl/tests/data/test2046 delete mode 100644 curl/tests/data/test2047 delete mode 100644 curl/tests/data/test2048 delete mode 100644 curl/tests/data/test2049 delete mode 100644 curl/tests/data/test205 delete mode 100644 curl/tests/data/test2050 delete mode 100644 curl/tests/data/test2051 delete mode 100644 curl/tests/data/test2052 delete mode 100644 curl/tests/data/test2053 delete mode 100644 curl/tests/data/test2054 delete mode 100644 curl/tests/data/test2055 delete mode 100644 curl/tests/data/test2056 delete mode 100644 curl/tests/data/test2057 delete mode 100644 curl/tests/data/test206 delete mode 100644 curl/tests/data/test207 delete mode 100644 curl/tests/data/test208 delete mode 100644 curl/tests/data/test209 delete mode 100644 curl/tests/data/test21 delete mode 100644 curl/tests/data/test210 delete mode 100644 curl/tests/data/test211 delete mode 100644 curl/tests/data/test212 delete mode 100644 curl/tests/data/test213 delete mode 100644 curl/tests/data/test214 delete mode 100644 curl/tests/data/test215 delete mode 100644 curl/tests/data/test216 delete mode 100644 curl/tests/data/test217 delete mode 100644 curl/tests/data/test218 delete mode 100644 curl/tests/data/test219 delete mode 100644 curl/tests/data/test22 delete mode 100644 curl/tests/data/test220 delete mode 100644 curl/tests/data/test221 delete mode 100644 curl/tests/data/test222 delete mode 100644 curl/tests/data/test223 delete mode 100644 curl/tests/data/test224 delete mode 100644 curl/tests/data/test225 delete mode 100644 curl/tests/data/test226 delete mode 100644 curl/tests/data/test227 delete mode 100644 curl/tests/data/test228 delete mode 100644 curl/tests/data/test229 delete mode 100644 curl/tests/data/test23 delete mode 100644 curl/tests/data/test231 delete mode 100644 curl/tests/data/test233 delete mode 100644 curl/tests/data/test234 delete mode 100644 curl/tests/data/test235 delete mode 100644 curl/tests/data/test236 delete mode 100644 curl/tests/data/test237 delete mode 100644 curl/tests/data/test238 delete mode 100644 curl/tests/data/test239 delete mode 100644 curl/tests/data/test24 delete mode 100644 curl/tests/data/test240 delete mode 100644 curl/tests/data/test241 delete mode 100644 curl/tests/data/test242 delete mode 100644 curl/tests/data/test243 delete mode 100644 curl/tests/data/test244 delete mode 100644 curl/tests/data/test245 delete mode 100644 curl/tests/data/test246 delete mode 100644 curl/tests/data/test247 delete mode 100644 curl/tests/data/test248 delete mode 100644 curl/tests/data/test249 delete mode 100644 curl/tests/data/test25 delete mode 100644 curl/tests/data/test250 delete mode 100644 curl/tests/data/test251 delete mode 100644 curl/tests/data/test252 delete mode 100644 curl/tests/data/test253 delete mode 100644 curl/tests/data/test254 delete mode 100644 curl/tests/data/test255 delete mode 100644 curl/tests/data/test256 delete mode 100644 curl/tests/data/test257 delete mode 100644 curl/tests/data/test258 delete mode 100644 curl/tests/data/test259 delete mode 100644 curl/tests/data/test26 delete mode 100644 curl/tests/data/test260 delete mode 100644 curl/tests/data/test261 delete mode 100644 curl/tests/data/test262 delete mode 100644 curl/tests/data/test263 delete mode 100644 curl/tests/data/test264 delete mode 100644 curl/tests/data/test265 delete mode 100644 curl/tests/data/test266 delete mode 100644 curl/tests/data/test267 delete mode 100644 curl/tests/data/test268 delete mode 100644 curl/tests/data/test269 delete mode 100644 curl/tests/data/test27 delete mode 100644 curl/tests/data/test270 delete mode 100644 curl/tests/data/test271 delete mode 100644 curl/tests/data/test272 delete mode 100644 curl/tests/data/test273 delete mode 100644 curl/tests/data/test274 delete mode 100644 curl/tests/data/test275 delete mode 100644 curl/tests/data/test276 delete mode 100644 curl/tests/data/test277 delete mode 100644 curl/tests/data/test278 delete mode 100644 curl/tests/data/test279 delete mode 100644 curl/tests/data/test28 delete mode 100644 curl/tests/data/test280 delete mode 100644 curl/tests/data/test281 delete mode 100644 curl/tests/data/test282 delete mode 100644 curl/tests/data/test283 delete mode 100644 curl/tests/data/test284 delete mode 100644 curl/tests/data/test285 delete mode 100644 curl/tests/data/test286 delete mode 100644 curl/tests/data/test287 delete mode 100644 curl/tests/data/test288 delete mode 100644 curl/tests/data/test289 delete mode 100644 curl/tests/data/test29 delete mode 100644 curl/tests/data/test290 delete mode 100644 curl/tests/data/test291 delete mode 100644 curl/tests/data/test292 delete mode 100644 curl/tests/data/test293 delete mode 100644 curl/tests/data/test294 delete mode 100644 curl/tests/data/test295 delete mode 100644 curl/tests/data/test296 delete mode 100644 curl/tests/data/test297 delete mode 100644 curl/tests/data/test298 delete mode 100644 curl/tests/data/test299 delete mode 100644 curl/tests/data/test3 delete mode 100644 curl/tests/data/test30 delete mode 100644 curl/tests/data/test300 delete mode 100644 curl/tests/data/test301 delete mode 100644 curl/tests/data/test302 delete mode 100644 curl/tests/data/test303 delete mode 100644 curl/tests/data/test304 delete mode 100644 curl/tests/data/test305 delete mode 100644 curl/tests/data/test306 delete mode 100644 curl/tests/data/test307 delete mode 100644 curl/tests/data/test308 delete mode 100644 curl/tests/data/test309 delete mode 100644 curl/tests/data/test31 delete mode 100644 curl/tests/data/test310 delete mode 100644 curl/tests/data/test311 delete mode 100644 curl/tests/data/test312 delete mode 100644 curl/tests/data/test313 delete mode 100644 curl/tests/data/test32 delete mode 100644 curl/tests/data/test320 delete mode 100644 curl/tests/data/test321 delete mode 100644 curl/tests/data/test322 delete mode 100644 curl/tests/data/test323 delete mode 100644 curl/tests/data/test324 delete mode 100644 curl/tests/data/test325 delete mode 100644 curl/tests/data/test33 delete mode 100644 curl/tests/data/test34 delete mode 100644 curl/tests/data/test35 delete mode 100644 curl/tests/data/test350 delete mode 100644 curl/tests/data/test351 delete mode 100644 curl/tests/data/test352 delete mode 100644 curl/tests/data/test353 delete mode 100644 curl/tests/data/test354 delete mode 100644 curl/tests/data/test36 delete mode 100644 curl/tests/data/test37 delete mode 100644 curl/tests/data/test38 delete mode 100644 curl/tests/data/test39 delete mode 100644 curl/tests/data/test4 delete mode 100644 curl/tests/data/test40 delete mode 100644 curl/tests/data/test400 delete mode 100644 curl/tests/data/test401 delete mode 100644 curl/tests/data/test402 delete mode 100644 curl/tests/data/test403 delete mode 100644 curl/tests/data/test404 delete mode 100644 curl/tests/data/test405 delete mode 100644 curl/tests/data/test406 delete mode 100644 curl/tests/data/test407 delete mode 100644 curl/tests/data/test408 delete mode 100644 curl/tests/data/test409 delete mode 100644 curl/tests/data/test41 delete mode 100644 curl/tests/data/test42 delete mode 100644 curl/tests/data/test43 delete mode 100644 curl/tests/data/test44 delete mode 100644 curl/tests/data/test45 delete mode 100644 curl/tests/data/test46 delete mode 100644 curl/tests/data/test47 delete mode 100644 curl/tests/data/test48 delete mode 100644 curl/tests/data/test49 delete mode 100644 curl/tests/data/test5 delete mode 100644 curl/tests/data/test50 delete mode 100644 curl/tests/data/test500 delete mode 100644 curl/tests/data/test501 delete mode 100644 curl/tests/data/test502 delete mode 100644 curl/tests/data/test503 delete mode 100644 curl/tests/data/test504 delete mode 100644 curl/tests/data/test505 delete mode 100644 curl/tests/data/test506 delete mode 100644 curl/tests/data/test507 delete mode 100644 curl/tests/data/test508 delete mode 100644 curl/tests/data/test509 delete mode 100644 curl/tests/data/test51 delete mode 100644 curl/tests/data/test510 delete mode 100644 curl/tests/data/test511 delete mode 100644 curl/tests/data/test512 delete mode 100644 curl/tests/data/test513 delete mode 100644 curl/tests/data/test514 delete mode 100644 curl/tests/data/test515 delete mode 100644 curl/tests/data/test516 delete mode 100644 curl/tests/data/test517 delete mode 100644 curl/tests/data/test518 delete mode 100644 curl/tests/data/test519 delete mode 100644 curl/tests/data/test52 delete mode 100644 curl/tests/data/test520 delete mode 100644 curl/tests/data/test521 delete mode 100644 curl/tests/data/test522 delete mode 100644 curl/tests/data/test523 delete mode 100644 curl/tests/data/test524 delete mode 100644 curl/tests/data/test525 delete mode 100644 curl/tests/data/test526 delete mode 100644 curl/tests/data/test527 delete mode 100644 curl/tests/data/test528 delete mode 100644 curl/tests/data/test529 delete mode 100644 curl/tests/data/test53 delete mode 100644 curl/tests/data/test530 delete mode 100644 curl/tests/data/test531 delete mode 100644 curl/tests/data/test532 delete mode 100644 curl/tests/data/test533 delete mode 100644 curl/tests/data/test534 delete mode 100644 curl/tests/data/test535 delete mode 100644 curl/tests/data/test536 delete mode 100644 curl/tests/data/test537 delete mode 100644 curl/tests/data/test538 delete mode 100644 curl/tests/data/test539 delete mode 100644 curl/tests/data/test54 delete mode 100644 curl/tests/data/test540 delete mode 100644 curl/tests/data/test541 delete mode 100644 curl/tests/data/test542 delete mode 100644 curl/tests/data/test543 delete mode 100644 curl/tests/data/test544 delete mode 100644 curl/tests/data/test545 delete mode 100644 curl/tests/data/test546 delete mode 100644 curl/tests/data/test547 delete mode 100644 curl/tests/data/test548 delete mode 100644 curl/tests/data/test549 delete mode 100644 curl/tests/data/test55 delete mode 100644 curl/tests/data/test550 delete mode 100644 curl/tests/data/test551 delete mode 100644 curl/tests/data/test552 delete mode 100644 curl/tests/data/test553 delete mode 100644 curl/tests/data/test554 delete mode 100644 curl/tests/data/test555 delete mode 100644 curl/tests/data/test556 delete mode 100644 curl/tests/data/test557 delete mode 100644 curl/tests/data/test558 delete mode 100644 curl/tests/data/test559 delete mode 100644 curl/tests/data/test56 delete mode 100644 curl/tests/data/test560 delete mode 100644 curl/tests/data/test561 delete mode 100644 curl/tests/data/test562 delete mode 100644 curl/tests/data/test563 delete mode 100644 curl/tests/data/test564 delete mode 100644 curl/tests/data/test565 delete mode 100644 curl/tests/data/test566 delete mode 100644 curl/tests/data/test567 delete mode 100644 curl/tests/data/test568 delete mode 100644 curl/tests/data/test569 delete mode 100644 curl/tests/data/test57 delete mode 100644 curl/tests/data/test570 delete mode 100644 curl/tests/data/test571 delete mode 100644 curl/tests/data/test572 delete mode 100644 curl/tests/data/test573 delete mode 100644 curl/tests/data/test574 delete mode 100644 curl/tests/data/test575 delete mode 100644 curl/tests/data/test576 delete mode 100644 curl/tests/data/test577 delete mode 100644 curl/tests/data/test578 delete mode 100644 curl/tests/data/test579 delete mode 100644 curl/tests/data/test58 delete mode 100644 curl/tests/data/test580 delete mode 100644 curl/tests/data/test581 delete mode 100644 curl/tests/data/test582 delete mode 100644 curl/tests/data/test583 delete mode 100644 curl/tests/data/test584 delete mode 100644 curl/tests/data/test585 delete mode 100644 curl/tests/data/test586 delete mode 100644 curl/tests/data/test587 delete mode 100644 curl/tests/data/test588 delete mode 100644 curl/tests/data/test589 delete mode 100644 curl/tests/data/test59 delete mode 100644 curl/tests/data/test590 delete mode 100644 curl/tests/data/test591 delete mode 100644 curl/tests/data/test592 delete mode 100644 curl/tests/data/test593 delete mode 100644 curl/tests/data/test594 delete mode 100644 curl/tests/data/test595 delete mode 100644 curl/tests/data/test596 delete mode 100644 curl/tests/data/test597 delete mode 100644 curl/tests/data/test598 delete mode 100644 curl/tests/data/test599 delete mode 100644 curl/tests/data/test6 delete mode 100644 curl/tests/data/test60 delete mode 100644 curl/tests/data/test600 delete mode 100644 curl/tests/data/test601 delete mode 100644 curl/tests/data/test602 delete mode 100644 curl/tests/data/test603 delete mode 100644 curl/tests/data/test604 delete mode 100644 curl/tests/data/test605 delete mode 100644 curl/tests/data/test606 delete mode 100644 curl/tests/data/test607 delete mode 100644 curl/tests/data/test608 delete mode 100644 curl/tests/data/test609 delete mode 100644 curl/tests/data/test61 delete mode 100644 curl/tests/data/test610 delete mode 100644 curl/tests/data/test611 delete mode 100644 curl/tests/data/test612 delete mode 100644 curl/tests/data/test613 delete mode 100644 curl/tests/data/test614 delete mode 100644 curl/tests/data/test615 delete mode 100644 curl/tests/data/test616 delete mode 100644 curl/tests/data/test617 delete mode 100644 curl/tests/data/test618 delete mode 100644 curl/tests/data/test619 delete mode 100644 curl/tests/data/test62 delete mode 100644 curl/tests/data/test620 delete mode 100644 curl/tests/data/test621 delete mode 100644 curl/tests/data/test622 delete mode 100644 curl/tests/data/test623 delete mode 100644 curl/tests/data/test624 delete mode 100644 curl/tests/data/test625 delete mode 100644 curl/tests/data/test626 delete mode 100644 curl/tests/data/test627 delete mode 100644 curl/tests/data/test628 delete mode 100644 curl/tests/data/test629 delete mode 100644 curl/tests/data/test63 delete mode 100644 curl/tests/data/test630 delete mode 100644 curl/tests/data/test631 delete mode 100644 curl/tests/data/test632 delete mode 100644 curl/tests/data/test633 delete mode 100644 curl/tests/data/test634 delete mode 100644 curl/tests/data/test635 delete mode 100644 curl/tests/data/test636 delete mode 100644 curl/tests/data/test637 delete mode 100644 curl/tests/data/test638 delete mode 100644 curl/tests/data/test639 delete mode 100644 curl/tests/data/test64 delete mode 100644 curl/tests/data/test640 delete mode 100644 curl/tests/data/test641 delete mode 100644 curl/tests/data/test642 delete mode 100644 curl/tests/data/test643 delete mode 100644 curl/tests/data/test644 delete mode 100644 curl/tests/data/test645 delete mode 100644 curl/tests/data/test646 delete mode 100644 curl/tests/data/test647 delete mode 100644 curl/tests/data/test648 delete mode 100644 curl/tests/data/test649 delete mode 100644 curl/tests/data/test65 delete mode 100644 curl/tests/data/test650 delete mode 100644 curl/tests/data/test651 delete mode 100644 curl/tests/data/test652 delete mode 100644 curl/tests/data/test653 delete mode 100644 curl/tests/data/test66 delete mode 100644 curl/tests/data/test67 delete mode 100644 curl/tests/data/test68 delete mode 100644 curl/tests/data/test69 delete mode 100644 curl/tests/data/test7 delete mode 100644 curl/tests/data/test70 delete mode 100644 curl/tests/data/test700 delete mode 100644 curl/tests/data/test701 delete mode 100644 curl/tests/data/test702 delete mode 100644 curl/tests/data/test703 delete mode 100644 curl/tests/data/test704 delete mode 100644 curl/tests/data/test705 delete mode 100644 curl/tests/data/test706 delete mode 100644 curl/tests/data/test707 delete mode 100644 curl/tests/data/test708 delete mode 100644 curl/tests/data/test709 delete mode 100644 curl/tests/data/test71 delete mode 100644 curl/tests/data/test710 delete mode 100644 curl/tests/data/test711 delete mode 100644 curl/tests/data/test712 delete mode 100644 curl/tests/data/test713 delete mode 100644 curl/tests/data/test714 delete mode 100644 curl/tests/data/test715 delete mode 100644 curl/tests/data/test72 delete mode 100644 curl/tests/data/test73 delete mode 100644 curl/tests/data/test74 delete mode 100644 curl/tests/data/test75 delete mode 100644 curl/tests/data/test76 delete mode 100644 curl/tests/data/test77 delete mode 100644 curl/tests/data/test78 delete mode 100644 curl/tests/data/test79 delete mode 100644 curl/tests/data/test8 delete mode 100644 curl/tests/data/test80 delete mode 100644 curl/tests/data/test800 delete mode 100644 curl/tests/data/test801 delete mode 100644 curl/tests/data/test802 delete mode 100644 curl/tests/data/test803 delete mode 100644 curl/tests/data/test804 delete mode 100644 curl/tests/data/test805 delete mode 100644 curl/tests/data/test806 delete mode 100644 curl/tests/data/test807 delete mode 100644 curl/tests/data/test808 delete mode 100644 curl/tests/data/test809 delete mode 100644 curl/tests/data/test81 delete mode 100644 curl/tests/data/test810 delete mode 100644 curl/tests/data/test811 delete mode 100644 curl/tests/data/test812 delete mode 100644 curl/tests/data/test813 delete mode 100644 curl/tests/data/test814 delete mode 100644 curl/tests/data/test815 delete mode 100644 curl/tests/data/test816 delete mode 100644 curl/tests/data/test817 delete mode 100644 curl/tests/data/test818 delete mode 100644 curl/tests/data/test819 delete mode 100644 curl/tests/data/test82 delete mode 100644 curl/tests/data/test820 delete mode 100644 curl/tests/data/test821 delete mode 100644 curl/tests/data/test822 delete mode 100644 curl/tests/data/test823 delete mode 100644 curl/tests/data/test824 delete mode 100644 curl/tests/data/test825 delete mode 100644 curl/tests/data/test826 delete mode 100644 curl/tests/data/test827 delete mode 100644 curl/tests/data/test828 delete mode 100644 curl/tests/data/test829 delete mode 100644 curl/tests/data/test83 delete mode 100644 curl/tests/data/test830 delete mode 100644 curl/tests/data/test831 delete mode 100644 curl/tests/data/test832 delete mode 100644 curl/tests/data/test833 delete mode 100644 curl/tests/data/test834 delete mode 100644 curl/tests/data/test835 delete mode 100644 curl/tests/data/test836 delete mode 100644 curl/tests/data/test837 delete mode 100644 curl/tests/data/test838 delete mode 100644 curl/tests/data/test839 delete mode 100644 curl/tests/data/test84 delete mode 100644 curl/tests/data/test840 delete mode 100644 curl/tests/data/test841 delete mode 100644 curl/tests/data/test842 delete mode 100644 curl/tests/data/test843 delete mode 100644 curl/tests/data/test844 delete mode 100644 curl/tests/data/test845 delete mode 100644 curl/tests/data/test846 delete mode 100644 curl/tests/data/test85 delete mode 100644 curl/tests/data/test850 delete mode 100644 curl/tests/data/test851 delete mode 100644 curl/tests/data/test852 delete mode 100644 curl/tests/data/test853 delete mode 100644 curl/tests/data/test854 delete mode 100644 curl/tests/data/test855 delete mode 100644 curl/tests/data/test856 delete mode 100644 curl/tests/data/test857 delete mode 100644 curl/tests/data/test858 delete mode 100644 curl/tests/data/test859 delete mode 100644 curl/tests/data/test86 delete mode 100644 curl/tests/data/test860 delete mode 100644 curl/tests/data/test861 delete mode 100644 curl/tests/data/test862 delete mode 100644 curl/tests/data/test863 delete mode 100644 curl/tests/data/test864 delete mode 100644 curl/tests/data/test865 delete mode 100644 curl/tests/data/test866 delete mode 100644 curl/tests/data/test867 delete mode 100644 curl/tests/data/test868 delete mode 100644 curl/tests/data/test869 delete mode 100644 curl/tests/data/test87 delete mode 100644 curl/tests/data/test870 delete mode 100644 curl/tests/data/test871 delete mode 100644 curl/tests/data/test872 delete mode 100644 curl/tests/data/test873 delete mode 100644 curl/tests/data/test874 delete mode 100644 curl/tests/data/test875 delete mode 100644 curl/tests/data/test876 delete mode 100644 curl/tests/data/test877 delete mode 100644 curl/tests/data/test878 delete mode 100644 curl/tests/data/test879 delete mode 100644 curl/tests/data/test88 delete mode 100644 curl/tests/data/test880 delete mode 100644 curl/tests/data/test881 delete mode 100644 curl/tests/data/test882 delete mode 100644 curl/tests/data/test883 delete mode 100644 curl/tests/data/test884 delete mode 100644 curl/tests/data/test885 delete mode 100644 curl/tests/data/test886 delete mode 100644 curl/tests/data/test887 delete mode 100644 curl/tests/data/test888 delete mode 100644 curl/tests/data/test889 delete mode 100644 curl/tests/data/test89 delete mode 100644 curl/tests/data/test890 delete mode 100644 curl/tests/data/test9 delete mode 100644 curl/tests/data/test90 delete mode 100644 curl/tests/data/test900 delete mode 100644 curl/tests/data/test901 delete mode 100644 curl/tests/data/test902 delete mode 100644 curl/tests/data/test903 delete mode 100644 curl/tests/data/test904 delete mode 100644 curl/tests/data/test905 delete mode 100644 curl/tests/data/test906 delete mode 100644 curl/tests/data/test907 delete mode 100644 curl/tests/data/test908 delete mode 100644 curl/tests/data/test909 delete mode 100644 curl/tests/data/test91 delete mode 100644 curl/tests/data/test910 delete mode 100644 curl/tests/data/test911 delete mode 100644 curl/tests/data/test912 delete mode 100644 curl/tests/data/test913 delete mode 100644 curl/tests/data/test914 delete mode 100644 curl/tests/data/test915 delete mode 100644 curl/tests/data/test916 delete mode 100644 curl/tests/data/test917 delete mode 100644 curl/tests/data/test918 delete mode 100644 curl/tests/data/test919 delete mode 100644 curl/tests/data/test92 delete mode 100644 curl/tests/data/test920 delete mode 100644 curl/tests/data/test921 delete mode 100644 curl/tests/data/test922 delete mode 100644 curl/tests/data/test923 delete mode 100644 curl/tests/data/test924 delete mode 100644 curl/tests/data/test925 delete mode 100644 curl/tests/data/test926 delete mode 100644 curl/tests/data/test927 delete mode 100644 curl/tests/data/test928 delete mode 100644 curl/tests/data/test929 delete mode 100644 curl/tests/data/test93 delete mode 100644 curl/tests/data/test930 delete mode 100644 curl/tests/data/test931 delete mode 100644 curl/tests/data/test932 delete mode 100644 curl/tests/data/test933 delete mode 100644 curl/tests/data/test934 delete mode 100644 curl/tests/data/test935 delete mode 100644 curl/tests/data/test936 delete mode 100644 curl/tests/data/test937 delete mode 100644 curl/tests/data/test938 delete mode 100644 curl/tests/data/test939 delete mode 100644 curl/tests/data/test94 delete mode 100644 curl/tests/data/test940 delete mode 100644 curl/tests/data/test941 delete mode 100644 curl/tests/data/test942 delete mode 100644 curl/tests/data/test943 delete mode 100644 curl/tests/data/test944 delete mode 100644 curl/tests/data/test945 delete mode 100644 curl/tests/data/test946 delete mode 100644 curl/tests/data/test947 delete mode 100644 curl/tests/data/test948 delete mode 100644 curl/tests/data/test949 delete mode 100644 curl/tests/data/test95 delete mode 100644 curl/tests/data/test950 delete mode 100644 curl/tests/data/test96 delete mode 100644 curl/tests/data/test97 delete mode 100644 curl/tests/data/test98 delete mode 100644 curl/tests/data/test99 delete mode 100644 curl/tests/dictserver.py delete mode 100644 curl/tests/directories.pm delete mode 100644 curl/tests/ftp.pm delete mode 100644 curl/tests/ftpserver.pl delete mode 100644 curl/tests/getpart.pm delete mode 100644 curl/tests/http2-server.pl delete mode 100644 curl/tests/http_pipe.py delete mode 100644 curl/tests/httpserver.pl delete mode 100644 curl/tests/libtest/CMakeLists.txt delete mode 100644 curl/tests/libtest/Makefile.am delete mode 100644 curl/tests/libtest/Makefile.in delete mode 100644 curl/tests/libtest/Makefile.inc delete mode 100644 curl/tests/libtest/first.c delete mode 100644 curl/tests/libtest/lib1500.c delete mode 100644 curl/tests/libtest/lib1501.c delete mode 100644 curl/tests/libtest/lib1502.c delete mode 100644 curl/tests/libtest/lib1506.c delete mode 100644 curl/tests/libtest/lib1507.c delete mode 100644 curl/tests/libtest/lib1509.c delete mode 100644 curl/tests/libtest/lib1510.c delete mode 100644 curl/tests/libtest/lib1511.c delete mode 100644 curl/tests/libtest/lib1512.c delete mode 100644 curl/tests/libtest/lib1513.c delete mode 100644 curl/tests/libtest/lib1514.c delete mode 100644 curl/tests/libtest/lib1515.c delete mode 100644 curl/tests/libtest/lib1517.c delete mode 100644 curl/tests/libtest/lib1520.c delete mode 100644 curl/tests/libtest/lib1521.c delete mode 100644 curl/tests/libtest/lib1525.c delete mode 100644 curl/tests/libtest/lib1526.c delete mode 100644 curl/tests/libtest/lib1527.c delete mode 100644 curl/tests/libtest/lib1528.c delete mode 100644 curl/tests/libtest/lib1529.c delete mode 100644 curl/tests/libtest/lib1530.c delete mode 100644 curl/tests/libtest/lib1532.c delete mode 100644 curl/tests/libtest/lib1533.c delete mode 100644 curl/tests/libtest/lib1534.c delete mode 100644 curl/tests/libtest/lib1535.c delete mode 100644 curl/tests/libtest/lib1536.c delete mode 100644 curl/tests/libtest/lib1537.c delete mode 100644 curl/tests/libtest/lib1538.c delete mode 100644 curl/tests/libtest/lib1540.c delete mode 100644 curl/tests/libtest/lib1550.c delete mode 100644 curl/tests/libtest/lib1552.c delete mode 100644 curl/tests/libtest/lib1553.c delete mode 100644 curl/tests/libtest/lib1900.c delete mode 100644 curl/tests/libtest/lib500.c delete mode 100644 curl/tests/libtest/lib502.c delete mode 100644 curl/tests/libtest/lib503.c delete mode 100644 curl/tests/libtest/lib504.c delete mode 100644 curl/tests/libtest/lib505.c delete mode 100644 curl/tests/libtest/lib506.c delete mode 100644 curl/tests/libtest/lib507.c delete mode 100644 curl/tests/libtest/lib508.c delete mode 100644 curl/tests/libtest/lib509.c delete mode 100644 curl/tests/libtest/lib510.c delete mode 100644 curl/tests/libtest/lib512.c delete mode 100644 curl/tests/libtest/lib513.c delete mode 100644 curl/tests/libtest/lib514.c delete mode 100644 curl/tests/libtest/lib515.c delete mode 100644 curl/tests/libtest/lib516.c delete mode 100644 curl/tests/libtest/lib517.c delete mode 100644 curl/tests/libtest/lib518.c delete mode 100644 curl/tests/libtest/lib519.c delete mode 100644 curl/tests/libtest/lib520.c delete mode 100644 curl/tests/libtest/lib521.c delete mode 100644 curl/tests/libtest/lib523.c delete mode 100644 curl/tests/libtest/lib524.c delete mode 100644 curl/tests/libtest/lib525.c delete mode 100644 curl/tests/libtest/lib526.c delete mode 100644 curl/tests/libtest/lib530.c delete mode 100644 curl/tests/libtest/lib533.c delete mode 100644 curl/tests/libtest/lib536.c delete mode 100644 curl/tests/libtest/lib537.c delete mode 100644 curl/tests/libtest/lib539.c delete mode 100644 curl/tests/libtest/lib540.c delete mode 100644 curl/tests/libtest/lib541.c delete mode 100644 curl/tests/libtest/lib543.c delete mode 100644 curl/tests/libtest/lib544.c delete mode 100644 curl/tests/libtest/lib547.c delete mode 100644 curl/tests/libtest/lib549.c delete mode 100644 curl/tests/libtest/lib552.c delete mode 100644 curl/tests/libtest/lib553.c delete mode 100644 curl/tests/libtest/lib554.c delete mode 100644 curl/tests/libtest/lib555.c delete mode 100644 curl/tests/libtest/lib556.c delete mode 100644 curl/tests/libtest/lib557.c delete mode 100644 curl/tests/libtest/lib558.c delete mode 100644 curl/tests/libtest/lib559.c delete mode 100644 curl/tests/libtest/lib560.c delete mode 100644 curl/tests/libtest/lib562.c delete mode 100644 curl/tests/libtest/lib564.c delete mode 100644 curl/tests/libtest/lib566.c delete mode 100644 curl/tests/libtest/lib567.c delete mode 100644 curl/tests/libtest/lib568.c delete mode 100644 curl/tests/libtest/lib569.c delete mode 100644 curl/tests/libtest/lib570.c delete mode 100644 curl/tests/libtest/lib571.c delete mode 100644 curl/tests/libtest/lib572.c delete mode 100644 curl/tests/libtest/lib573.c delete mode 100644 curl/tests/libtest/lib574.c delete mode 100644 curl/tests/libtest/lib575.c delete mode 100644 curl/tests/libtest/lib576.c delete mode 100644 curl/tests/libtest/lib578.c delete mode 100644 curl/tests/libtest/lib579.c delete mode 100644 curl/tests/libtest/lib582.c delete mode 100644 curl/tests/libtest/lib583.c delete mode 100644 curl/tests/libtest/lib586.c delete mode 100644 curl/tests/libtest/lib589.c delete mode 100644 curl/tests/libtest/lib590.c delete mode 100644 curl/tests/libtest/lib591.c delete mode 100644 curl/tests/libtest/lib597.c delete mode 100644 curl/tests/libtest/lib598.c delete mode 100644 curl/tests/libtest/lib599.c delete mode 100644 curl/tests/libtest/lib643.c delete mode 100644 curl/tests/libtest/lib650.c delete mode 100644 curl/tests/libtest/lib651.c delete mode 100644 curl/tests/libtest/lib652.c delete mode 100644 curl/tests/libtest/lib653.c delete mode 100644 curl/tests/libtest/libauthretry.c delete mode 100644 curl/tests/libtest/libntlmconnect.c delete mode 100644 curl/tests/libtest/mk-lib1521.pl delete mode 100644 curl/tests/libtest/notexists.pl delete mode 100644 curl/tests/libtest/stub_gssapi.c delete mode 100644 curl/tests/libtest/stub_gssapi.h delete mode 100644 curl/tests/libtest/test.h delete mode 100644 curl/tests/libtest/test1013.pl delete mode 100644 curl/tests/libtest/test1022.pl delete mode 100644 curl/tests/libtest/test307.pl delete mode 100644 curl/tests/libtest/test610.pl delete mode 100644 curl/tests/libtest/test613.pl delete mode 100644 curl/tests/libtest/test75.pl delete mode 100644 curl/tests/libtest/testtrace.c delete mode 100644 curl/tests/libtest/testutil.c delete mode 100644 curl/tests/libtest/testutil.h delete mode 100644 curl/tests/manpage-scan.pl delete mode 100644 curl/tests/mem-include-scan.pl delete mode 100644 curl/tests/memanalyze.pl delete mode 100644 curl/tests/negtelnetserver.py delete mode 100644 curl/tests/nroff-scan.pl delete mode 100644 curl/tests/pathhelp.pm delete mode 100644 curl/tests/python_dependencies/impacket/__init__.py delete mode 100644 curl/tests/python_dependencies/impacket/nmb.py delete mode 100644 curl/tests/python_dependencies/impacket/nt_errors.py delete mode 100644 curl/tests/python_dependencies/impacket/ntlm.py delete mode 100644 curl/tests/python_dependencies/impacket/smb.py delete mode 100644 curl/tests/python_dependencies/impacket/smb3.py delete mode 100644 curl/tests/python_dependencies/impacket/smb3structs.py delete mode 100644 curl/tests/python_dependencies/impacket/smbserver.py delete mode 100644 curl/tests/python_dependencies/impacket/spnego.py delete mode 100644 curl/tests/python_dependencies/impacket/structure.py delete mode 100644 curl/tests/python_dependencies/impacket/uuid.py delete mode 100644 curl/tests/python_dependencies/impacket/version.py delete mode 100644 curl/tests/rtspserver.pl delete mode 100644 curl/tests/runtests.1 delete mode 100644 curl/tests/runtests.pl delete mode 100644 curl/tests/secureserver.pl delete mode 100644 curl/tests/server/CMakeLists.txt delete mode 100644 curl/tests/server/Makefile.am delete mode 100644 curl/tests/server/Makefile.in delete mode 100644 curl/tests/server/Makefile.inc delete mode 100644 curl/tests/server/base64.pl delete mode 100644 curl/tests/server/fake_ntlm.c delete mode 100644 curl/tests/server/getpart.c delete mode 100644 curl/tests/server/resolve.c delete mode 100644 curl/tests/server/rtspd.c delete mode 100644 curl/tests/server/sockfilt.c delete mode 100644 curl/tests/server/sws.c delete mode 100644 curl/tests/server/testpart.c delete mode 100644 curl/tests/server/tftp.h delete mode 100644 curl/tests/server/tftpd.c delete mode 100644 curl/tests/server/util.c delete mode 100644 curl/tests/server/util.h delete mode 100644 curl/tests/serverhelp.pm delete mode 100644 curl/tests/smbserver.py delete mode 100644 curl/tests/sshhelp.pm delete mode 100644 curl/tests/sshserver.pl delete mode 100644 curl/tests/stunnel.pem delete mode 100644 curl/tests/symbol-scan.pl delete mode 100644 curl/tests/testcurl.1 delete mode 100644 curl/tests/testcurl.pl delete mode 100644 curl/tests/tftpserver.pl delete mode 100644 curl/tests/unit/CMakeLists.txt delete mode 100644 curl/tests/unit/Makefile.am delete mode 100644 curl/tests/unit/Makefile.in delete mode 100644 curl/tests/unit/Makefile.inc delete mode 100644 curl/tests/unit/README delete mode 100644 curl/tests/unit/curlcheck.h delete mode 100644 curl/tests/unit/unit1300.c delete mode 100644 curl/tests/unit/unit1301.c delete mode 100644 curl/tests/unit/unit1302.c delete mode 100644 curl/tests/unit/unit1303.c delete mode 100644 curl/tests/unit/unit1304.c delete mode 100644 curl/tests/unit/unit1305.c delete mode 100644 curl/tests/unit/unit1307.c delete mode 100644 curl/tests/unit/unit1308.c delete mode 100644 curl/tests/unit/unit1309.c delete mode 100644 curl/tests/unit/unit1323.c delete mode 100644 curl/tests/unit/unit1394.c delete mode 100644 curl/tests/unit/unit1395.c delete mode 100644 curl/tests/unit/unit1396.c delete mode 100644 curl/tests/unit/unit1397.c delete mode 100644 curl/tests/unit/unit1398.c delete mode 100644 curl/tests/unit/unit1399.c delete mode 100644 curl/tests/unit/unit1600.c delete mode 100644 curl/tests/unit/unit1602.c delete mode 100644 curl/tests/unit/unit1603.c delete mode 100644 curl/tests/unit/unit1604.c delete mode 100644 curl/tests/unit/unit1605.c delete mode 100644 curl/tests/unit/unit1606.c delete mode 100644 curl/tests/valgrind.supp create mode 100644 curl/winbuild/.gitignore delete mode 100644 curl/winbuild/BUILD.WINDOWS.txt create mode 100644 curl/winbuild/README.md create mode 100644 curl/winbuild/makedebug.cmd diff --git a/README.md b/README.md index e566de56..cdd9574d 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ How to build it? * Step 1: You have to build cURL before building WinGup: - 1. Open VS2017 Native Tool Command for 32/64 bits. If you want to build for ARM, oprn a cmd, and run the following command:
+ 1. Open VS2017 Native Tool Command for 32/64 bits. If you want to build for ARM, open a cmd, and run the following command:
`C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat` 2. go to curl winbuild directory:
`cd \curl\winbuild` diff --git a/curl/.azure-pipelines.yml b/curl/.azure-pipelines.yml new file mode 100644 index 00000000..63970558 --- /dev/null +++ b/curl/.azure-pipelines.yml @@ -0,0 +1,206 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: + branches: + include: + - 'master' + - '*/ci' + +pr: + branches: + include: + - 'master' + +stages: + +########################################## +### Linux jobs first +########################################## + +- stage: linux + dependsOn: [] + jobs: + - job: ubuntu + # define defaults to make sure variables are always expanded/replaced + variables: + install: '' + configure: '' + tests: '!433' + timeoutInMinutes: 60 + pool: + vmImage: 'ubuntu-latest' + strategy: + matrix: + default: + name: default + install: jsonlint + configure: --enable-debug --with-openssl + disable_ipv6: + name: w/o IPv6 + configure: --disable-ipv6 --with-openssl + disable_http_smtp_imap: + name: w/o HTTP/SMTP/IMAP + configure: --disable-http --disable-smtp --disable-imap --without-openssl + disable_thredres: + name: sync resolver + configure: --disable-threaded-resolver --with-openssl + https_only: + name: HTTPS only + configure: --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp --disable-smb --disable-smtp --disable-telnet --disable-tftp --with-openssl + torture: + name: torture + install: libnghttp2-dev + configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl + tests: -n -t --shallow=40 !FTP + steps: + - script: sudo apt-get update && sudo apt-get install -y stunnel4 python3-impacket libzstd-dev libbrotli-dev $(install) + displayName: 'apt install' + + - script: ./buildconf && ./configure --enable-warnings --enable-werror $(configure) + displayName: 'configure $(name)' + + - script: make V=1 && cd tests && make V=1 + displayName: 'compile' + env: + MAKEFLAGS: "-j 2" + + - script: make test-nonflaky + displayName: 'test' + env: + AZURE_ACCESS_TOKEN: "$(System.AccessToken)" + TFLAGS: "-r $(tests)" + +########################################## +### Windows jobs below +########################################## + +- stage: windows + dependsOn: [] + variables: + agent.preferPowerShellOnContainers: true + jobs: + - job: windows + # define defaults to make sure variables are always expanded/replaced + variables: + container_img: '' + container_cmd: '' + configure: '' + tests: '' + timeoutInMinutes: 120 + pool: + vmImage: 'windows-2019' + strategy: + matrix: + msys2_mingw32_debug_openssl: + name: 32-bit OpenSSL/libssh2 + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2 + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --with-libssh2 --with-openssl + tests: ~571 ~612 ~1056 ~1299 !SCP + msys2_mingw64_debug_openssl: + name: 64-bit OpenSSL/libssh2 + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2 + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --with-libssh2 --with-openssl + tests: ~571 ~612 ~1056 ~1299 !SCP + msys1_mingw_debug: + name: 32-bit (legacy) + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=i686-pc-mingw32 --build=i686-pc-mingw32 --prefix=/mingw --enable-debug --without-ssl + tests: ~203 ~1056 ~1143 + msys1_mingw32_debug: + name: 32-bit w/o zlib + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw32:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --without-zlib --without-ssl + tests: ~203 ~1056 ~1143 ~1299 + msys1_mingw64_debug: + name: 64-bit w/o zlib + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw64:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --without-zlib --without-ssl + tests: ~203 ~1056 ~1143 ~1299 + msys2_mingw32_debug_schannel: + name: 32-bit Schannel/SSPI/WinIDN/libssh2 + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2 + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + msys2_mingw64_debug_schannel: + name: 64-bit Schannel/SSPI/WinIDN/libssh2 + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2 + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + msys1_mingw_debug_schannel: + name: 32-bit Schannel/SSPI/WinIDN (legacy) + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=i686-pc-mingw32 --build=i686-pc-mingw32 --prefix=/mingw --enable-debug --enable-sspi --with-schannel --with-winidn + tests: ~203 ~305 ~310 ~311 ~312 ~313 ~404 ~1056 ~1143 ~2034 ~2035 ~2037 ~2038 ~2041 ~2042 ~2048 ~3000 ~3001 + msys1_mingw32_debug_schannel: + name: 32-bit Schannel/SSPI/WinIDN w/o zlib + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw32:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --without-zlib + tests: ~203 ~310 ~1056 ~1143 ~1299 ~2034 ~2037 ~2041 ~3000 ~3001 + msys1_mingw64_debug_schannel: + name: 64-bit Schannel/SSPI/WinIDN w/o zlib + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys1-mingw64:ltsc2019 + container_cmd: C:\MinGW\msys\1.0\bin\sh + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --without-zlib + tests: ~203 ~310 ~1056 ~1143 ~1299 ~2034 ~2037 ~2041 ~3000 ~3001 + container: + image: $(container_img) + env: + MSYS2_PATH_TYPE: inherit + steps: + - script: $(container_cmd) -l -c "cd $(echo '%cd%') && $(prepare)" + displayName: 'prepare' + condition: variables.prepare + + - script: $(container_cmd) -l -c "cd $(echo '%cd%') && ./buildconf && ./configure $(configure)" + displayName: 'configure $(name)' + + - script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 && cd tests && make V=1" + displayName: 'compile' + env: + MAKEFLAGS: "-j 2" + + - script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 install && PATH=/usr/bin:/bin find . -type f -path '*/.libs/*.exe' -print -execdir mv -t .. {} \;" + displayName: 'install' + + - script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 test-nonflaky" + displayName: 'test' + env: + AZURE_ACCESS_TOKEN: "$(System.AccessToken)" + TFLAGS: "-u -vc /usr/bin/curl.exe -r -rm $(tests)" diff --git a/curl/.circleci/config.yml b/curl/.circleci/config.yml new file mode 100644 index 00000000..67372b65 --- /dev/null +++ b/curl/.circleci/config.yml @@ -0,0 +1,73 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 + +commands: + configure: + steps: + - run: + command: | + ./buildconf + ./configure --enable-warnings --enable-werror --with-openssl + + build: + steps: + - run: make + + test: + steps: + - run: make test-nonflaky + +executors: + ubuntu: + machine: + image: ubuntu-2004:202010-01 + +jobs: + basic: + executor: ubuntu + steps: + - checkout + - configure + - build + - test + + arm: + machine: + image: ubuntu-2004:202101-01 + resource_class: arm.medium + steps: + - checkout + - configure + - build + - test + +workflows: + x86-openssl: + jobs: + - basic + + arm-openssl: + jobs: + - arm diff --git a/curl/.cirrus.yml b/curl/.cirrus.yml new file mode 100644 index 00000000..1246c2ed --- /dev/null +++ b/curl/.cirrus.yml @@ -0,0 +1,132 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# Cirrus CI configuration +# https://cirrus-ci.com/github/curl/curl + +freebsd_task: + name: FreeBSD + + matrix: + - name: FreeBSD 13.0 + freebsd_instance: + image_family: freebsd-13-0 + - name: FreeBSD 12.2 + freebsd_instance: + image_family: freebsd-12-2 + - name: FreeBSD 11.4 + freebsd_instance: + image_family: freebsd-11-4 + + env: + CIRRUS_CLONE_DEPTH: 10 + CRYPTOGRAPHY_DONT_BUILD_RUST: 1 + MAKE_FLAGS: -j 2 + + pkginstall_script: + - pkg update -f + - pkg install -y autoconf automake libtool pkgconf brotli openldap-client heimdal libpsl libssh2 openssh-portable libidn2 librtmp libnghttp2 nghttp2 stunnel + - pkg delete -y curl + - easy_install "cryptography<3.2" + - easy_install "pyOpenSSL<20.0" + - easy_install "impacket" + configure_script: + - ./buildconf + # Building with the address sanitizer is causing unexplainable test issues due to timeouts + #- case `uname -r` in + # 12.2*) + # export CC=clang; + # export CFLAGS="-fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g"; + # export CXXFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g"; + # export LDFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer" ;; + # esac + - ./configure --prefix="${HOME}"/install --enable-debug --with-openssl --with-libssh2 --with-brotli --with-gssapi --with-libidn2 --enable-manual --enable-ldap --enable-ldaps --with-librtmp --with-libpsl --with-nghttp2 || { tail -300 config.log; false; } + compile_script: + - make V=1 && cd tests && make V=1 + test_script: + # blackhole? + - sysctl net.inet.tcp.blackhole + # make sure we don't run blackhole != 0 + - sudo sysctl net.inet.tcp.blackhole=0 + # Some tests won't run if run as root so run them as another user. + # Make directories world writable so the test step can write wherever it needs. + - find . -type d -exec chmod 777 {} \; + # The OpenSSH server instance for the testsuite cannot be started on FreeBSD, + # therefore the SFTP and SCP tests are disabled right away from the beginning. + - sudo -u nobody make V=1 TFLAGS="-n -a -p -u !flaky !SFTP !SCP" test-nonflaky + install_script: + - make V=1 install + +windows_task: + name: Windows + timeout_in: 90m + windows_container: + image: ${container_img} + + matrix: + - name: Windows 32-bit shared/release Schannel/SSPI/WinIDN/libssh2 + env: + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2 + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + - name: Windows 32-bit static/release Schannel/SSPI/WinIDN/libssh2 + env: + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2 + configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 --disable-shared --enable-static + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + curl_LDFLAGS: -all-static + PKG_CONFIG: pkg-config --static + - name: Windows 64-bit shared/release Schannel/SSPI/WinIDN/libssh2 + env: + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2 + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + - name: Windows 64-bit static/release Schannel/SSPI/WinIDN/libssh2 + env: + container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019 + container_cmd: C:\msys64\usr\bin\sh + prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2 + configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 --disable-shared --enable-static + tests: ~165 ~310 ~571 ~612 ~1056 ~1299 ~1448 ~2034 ~2037 ~2041 ~2046 ~2047 ~3000 ~3001 !SCP + curl_LDFLAGS: -all-static + PKG_CONFIG: pkg-config --static + + env: + CIRRUS_CLONE_DEPTH: 10 + MSYS2_PATH_TYPE: inherit + MAKEFLAGS: -j 2 + + prepare_script: | + %container_cmd% -l -c "cd $(echo '%cd%') && %prepare%" + configure_script: | + %container_cmd% -l -c "cd $(echo '%cd%') && ./buildconf && ./configure %configure%" + compile_script: | + %container_cmd% -l -c "cd $(echo '%cd%') && make V=1 && cd tests && make V=1" + install_script: | + %container_cmd% -l -c "cd $(echo '%cd%') && make V=1 install && PATH=/usr/bin:/bin find . -type f -path '*/.libs/*.exe' -print -execdir mv -t .. {} \;" + test_script: | + %container_cmd% -l -c "cd $(echo '%cd%') && make V=1 TFLAGS='-u -r -rm %tests%' test-nonflaky" diff --git a/curl/.dcignore b/curl/.dcignore new file mode 100644 index 00000000..73b1e716 --- /dev/null +++ b/curl/.dcignore @@ -0,0 +1,3 @@ +tests/** +docs/** +docs/examples/** diff --git a/curl/.dir-locals.el b/curl/.dir-locals.el new file mode 100644 index 00000000..06dc613f --- /dev/null +++ b/curl/.dir-locals.el @@ -0,0 +1,31 @@ +;;;*************************************************************************** +;;; _ _ ____ _ +;;; Project ___| | | | _ \| | +;;; / __| | | | |_) | | +;;; | (__| |_| | _ <| |___ +;;; \___|\___/|_| \_\_____| +;;; +;;; Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +;;; +;;; This software is licensed as described in the file COPYING, which +;;; you should have received as part of this distribution. The terms +;;; are also available at https://curl.se/docs/copyright.html. +;;; +;;; You may opt to use, copy, modify, merge, publish, distribute and/or sell +;;; copies of the Software, and permit persons to whom the Software is +;;; furnished to do so, under the terms of the COPYING file. +;;; +;;; This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +;;; KIND, either express or implied. +;;; +;;;*************************************************************************** +;;; Directory Local Variables +;;; See Info node `(emacs) Directory Variables' for more information. + +((nil . ((indent-tabs-mode . nil) + (show-trailing-whitespace . t))) + (c-mode . ((c-basic-offset . 2) + )) + (c++-mode . ((c-basic-offset . 2) + )) + ) diff --git a/curl/.gitattributes b/curl/.gitattributes new file mode 100644 index 00000000..691da622 --- /dev/null +++ b/curl/.gitattributes @@ -0,0 +1,14 @@ +*.dsw -crlf +buildconf eol=lf +configure.ac eol=lf +*.m4 eol=lf +*.in eol=lf +*.am eol=lf +*.sh eol=lf +*.[ch] whitespace=tab-in-indent + +# Batch files (bat,btm,cmd) must be run with CRLF line endings. +# Refer to https://github.com/curl/curl/pull/6442 +*.bat text eol=crlf +*.btm text eol=crlf +*.cmd text eol=crlf diff --git a/curl/.github/CONTRIBUTING.md b/curl/.github/CONTRIBUTING.md new file mode 100644 index 00000000..48c2ba0a --- /dev/null +++ b/curl/.github/CONTRIBUTING.md @@ -0,0 +1,23 @@ +How to contribute to curl +========================= + +Join the community +------------------ + + 1. Click 'watch' on the GitHub repo + + 2. Subscribe to the suitable [mailing lists](https://curl.se/mail/) + +Read [CONTRIBUTE](../docs/CONTRIBUTE.md) +--------------------------------------- + +Send your suggestions using one of these methods: +------------------------------------------------- + + 1. in a mail to the mailing list + + 2. as a [pull request](https://github.com/curl/curl/pulls) + + 3. as an [issue](https://github.com/curl/curl/issues) + +/ The curl team! diff --git a/curl/.github/FUNDING.yml b/curl/.github/FUNDING.yml new file mode 100644 index 00000000..cbcc2747 --- /dev/null +++ b/curl/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: curl +open_collective: curl diff --git a/curl/.github/ISSUE_TEMPLATE/bug_report.md b/curl/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..2c1baec8 --- /dev/null +++ b/curl/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + + +### I did this + +### I expected the following + +### curl/libcurl version + +[curl -V output] + +### operating system + + diff --git a/curl/.github/ISSUE_TEMPLATE/config.yml b/curl/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..b16554c6 --- /dev/null +++ b/curl/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Feature request + url: https://curl.se/mail/ + about: To propose new features or enhancements, please bring that discussion to a suitable curl mailing list. + - name: Question + url: https://curl.se/mail/ + about: Questions should go to the mailing list + - name: Commercial support + url: https://curl.se/support.html + about: Several companies are offering paid support for curl/libcurl diff --git a/curl/.github/lock.yml b/curl/.github/lock.yml new file mode 100644 index 00000000..66e79128 --- /dev/null +++ b/curl/.github/lock.yml @@ -0,0 +1,8 @@ +# Configuration for lock-threads - https://github.com/dessant/lock-threads + +# Number of days of inactivity before a closed issue or pull request is locked +daysUntilLock: 90 +# Comment to post before locking. Set to `false` to disable +lockComment: false +# Limit to only `issues` or `pulls` +# only: issues diff --git a/curl/.github/stale.yml b/curl/.github/stale.yml new file mode 100644 index 00000000..9bcd4eb1 --- /dev/null +++ b/curl/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/curl/.github/workflows/codeql-analysis.yml b/curl/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..5f8b86f2 --- /dev/null +++ b/curl/.github/workflows/codeql-analysis.yml @@ -0,0 +1,50 @@ +name: codeql + +on: + # Trigger the workflow on push or pull requests, but only for the + # master branch + push: + branches: + - master + - '*/ci' + pull_request: + branches: + - master + schedule: + - cron: '0 0 * * 4' + +permissions: + security-events: write + +jobs: + codeql: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: cpp + queries: security-extended + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/curl/.github/workflows/fuzz.yml b/curl/.github/workflows/fuzz.yml new file mode 100644 index 00000000..fe5dd075 --- /dev/null +++ b/curl/.github/workflows/fuzz.yml @@ -0,0 +1,36 @@ +name: Fuzzer + +on: + # Trigger the workflow on push or pull requests, but only for the + # master branch + push: + branches: + - master + - '*/ci' + pull_request: + branches: + - master + +jobs: + fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'curl' + dry-run: false + + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'curl' + fuzz-seconds: 2400 + dry-run: false + + - name: Upload Crash + uses: actions/upload-artifact@v1 + if: failure() + with: + name: artifacts + path: ./out/artifacts diff --git a/curl/.github/workflows/linux-hyper.yml b/curl/.github/workflows/linux-hyper.yml new file mode 100644 index 00000000..cfff476e --- /dev/null +++ b/curl/.github/workflows/linux-hyper.yml @@ -0,0 +1,48 @@ +name: Linux + +on: + # Trigger the workflow on push or pull requests, but only for the + # master branch + push: + branches: + - master + - '*/ci' + pull_request: + branches: + - master + +jobs: + autotools: + name: ${{ matrix.build.name }} + runs-on: 'ubuntu-latest' + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + build: + - name: hyper + install: + configure: --with-openssl --with-hyper=$HOME/hyper + + steps: + - run: sudo apt-get install libtool autoconf automake pkg-config + name: install prereqs + + - run: (cd $HOME; + git clone --depth=1 https://github.com/hyperium/hyper.git; + curl https://sh.rustup.rs -sSf | sh -s -- -y; + source $HOME/.cargo/env; + cd $HOME/hyper; + RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi) + name: 'install hyper' + + - uses: actions/checkout@v2 + + - run: ./buildconf && LDFLAGS="-Wl,-rpath,$HOME/hyper/target/debug" ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }} && make + name: 'configure and build' + + - run: make test-nonflaky + name: 'test' + env: + LD_LIBRARY_PATH: $HOME/hyper/target/debug:/usr/local/lib + TFLAGS: "${{ matrix.build.tflags }}" diff --git a/curl/.github/workflows/macos.yml b/curl/.github/workflows/macos.yml new file mode 100644 index 00000000..af80da62 --- /dev/null +++ b/curl/.github/workflows/macos.yml @@ -0,0 +1,129 @@ +name: macOS + +on: + # Trigger the workflow on push or pull requests, but only for the + # master branch + push: + branches: + - master + - '*/ci' + pull_request: + branches: + - master + +jobs: + autotools: + name: ${{ matrix.build.name }} + runs-on: 'macos-latest' + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + build: + - name: normal + install: nghttp2 + configure: --without-ssl + macosx-version-min: 10.9 + - name: debug + install: nghttp2 + configure: --enable-debug --without-ssl + macosx-version-min: 10.9 + - name: libssh2 + install: nghttp2 libssh2 + configure: --enable-debug --with-libssh2 --without-ssl + macosx-version-min: 10.9 + - name: c-ares + install: nghttp2 + configure: --enable-debug --enable-ares --without-ssl + macosx-version-min: 10.9 + - name: HTTP only + install: nghttp2 + configure: --enable-debug --enable-maintainer-mode --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets --disable-shared --without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2 --without-nghttp2 --without-ntlm-auth --without-ssl --without-zlib + macosx-version-min: 10.15 + - name: SecureTransport http2 + install: nghttp2 + configure: --enable-debug --with-secure-transport + macosx-version-min: 10.8 + - name: OpenSSL http2 + install: nghttp2 openssl + configure: --enable-debug --with-openssl=/usr/local/opt/openssl + macosx-version-min: 10.9 + - name: LibreSSL http2 + install: nghttp2 libressl + configure: --enable-debug --with-openssl=/usr/local/opt/libressl + macosx-version-min: 10.9 + - name: torture + install: nghttp2 openssl + configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=/usr/local/opt/openssl + tflags: -n -t --shallow=25 !FTP + macosx-version-min: 10.9 + - name: torture-ftp + install: nghttp2 openssl + configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=/usr/local/opt/openssl + tflags: -n -t --shallow=20 FTP + macosx-version-min: 10.9 + - name: macOS 10.15 + install: nghttp2 libssh2 openssl + configure: --enable-debug --disable-ldap --with-openssl=/usr/local/opt/openssl + macosx-version-min: 10.15 + steps: + - run: echo libtool autoconf automake pkg-config ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile + name: 'brew bundle' + + - run: brew update && brew bundle install --no-lock --file /tmp/Brewfile + name: 'brew install' + + - uses: actions/checkout@v2 + + - run: ./buildconf && ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }} + name: 'configure' + env: + # -Wvla is caused by brotli + CFLAGS: "-Wno-vla -mmacosx-version-min=${{ matrix.build.macosx-version-min }}" + + - run: make + name: 'make' + + - run: make test-nonflaky + name: 'test' + env: + TFLAGS: "${{ matrix.build.tflags }} ~1452" + + cmake: + name: cmake ${{ matrix.compiler.CC }} ${{ matrix.build.name }} + runs-on: 'macos-latest' + env: ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + compiler: + - CC: clang + CXX: clang++ + CFLAGS: "-mmacosx-version-min=10.15 -Wno-deprecated-declarations" + - CC: gcc-9 + CXX: g++-9 + CFLAGS: "-mmacosx-version-min=10.15 -Wno-error=undef -Wno-error=conversion" + build: + - name: OpenSSL + install: nghttp2 openssl + generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON + - name: LibreSSL + install: nghttp2 libressl + generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/libressl -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON + - name: libssh2 + install: nghttp2 openssl libssh2 + generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_USE_LIBSSH2=ON + steps: + - run: echo libtool autoconf automake pkg-config ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile + name: 'brew bundle' + + - run: brew update && brew bundle install --no-lock --file /tmp/Brewfile + name: 'brew install' + + - uses: actions/checkout@v2 + + - run: cmake -H. -Bbuild -DCURL_WERROR=ON -DPICKY_COMPILER=ON ${{ matrix.build.generate }} + name: 'cmake generate' + + - run: cmake --build build + name: 'cmake build' diff --git a/curl/.gitignore b/curl/.gitignore new file mode 100644 index 00000000..e3574714 --- /dev/null +++ b/curl/.gitignore @@ -0,0 +1,60 @@ +*.asc +*.dll +*.exe +*.exp +*.la +*.lib +*.lo +*.o +*.obj +*.pdb +*.pyc +*~ +.*.sw? +.cproject +.deps +.dirstamp +.libs +.project +.settings +/.vs +/build/ +/builds/ +/stats/ +__pycache__ +CHANGES.dist +Debug +INSTALL +Makefile +Makefile.in +Release +TAGS +aclocal.m4 +aclocal.m4.bak +autom4te.cache +compile +config.cache +config.guess +config.log +config.status +config.sub +configure +curl-*.tar.bz2 +curl-*.tar.gz +curl-*.tar.xz +curl-*.zip +curl-config +depcomp +install-sh +libcurl.pc +libtool +ltmain.sh +missing +mkinstalldirs +tags +test-driver +scripts/_curl +scripts/curl.fish +curl_fuzzer +curl_fuzzer_seed_corpus.zip +libstandaloneengine.a diff --git a/curl/.lgtm.yml b/curl/.lgtm.yml new file mode 100644 index 00000000..932e9c0b --- /dev/null +++ b/curl/.lgtm.yml @@ -0,0 +1,31 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +extraction: + cpp: + prepare: + packages: # to avoid confusion with libopenafs-dev which also provides a des.h + - libssl-dev + after_prepare: # make sure lgtm.com doesn't use CMake (which generates and runs tests) + - rm -f CMakeLists.txt + - ./buildconf + configure: # enable as many optional features as possible + command: ./configure --enable-ares --with-libssh2 --with-gssapi --with-librtmp --with-openssl diff --git a/curl/.mailmap b/curl/.mailmap new file mode 100644 index 00000000..f9cdeb47 --- /dev/null +++ b/curl/.mailmap @@ -0,0 +1,80 @@ +Guenter Knauf +Gisle Vanem +Gisle Vanem +Alessandro Ghedini +Alessandro Ghedini +Björn Stenberg +Björn Stenberg +Viktor Szakats +Viktor Szakats +Daniel Gustafsson +Daniel Gustafsson +Linus Nielsen +Yamada Yasuharu +Ulion +Tim Rühsen +Steve Holme +Claes Jakobsson +Sergei Nikulov +Patrick Monnerat +Patrick Monnerat +Patrick Monnerat +Patrick Monnerat +Nick Zitzmann +Peter Wu +David Woodhouse +Marcel Raad +Marcel Raad +Marcel Raad +Anthony Bryan +Travis Burtrum +Dmitry Kostjuchenko +Richard Alcock +Richard Alcock +Jan Ehrhardt +Florin Petriuc +Pavel Pavlov +Jason Juang +Carlo Teubner +Joel Depooter +Sebastian Mundry +Rainer Canavan +Dan Fandrich +Henrik S. Gaßmann +Jiří Malák +Nick Zitzmann +Kees Dekker +Max Savenkov +Daniel Jelinski <30433125+djelinski@users.noreply.github.com> +Amit Katyal +Giorgos Oikonomou +Evgeny Grin +Peter Pih +Anton Malov +Marquis de Muesli +Kyohei Kadota +Lucas Pardue +Massimiliano Fantuzzi +Niall O'Reilly +Mohammad Hasbini +Andrew Ishchuk +Nicolas Guillier <59726521+nicoguillier@users.noreply.github.com> +Julian Z +Jessa Chandler +Gökhan Şengün +Svyatoslav Mishyn +Douglas Steinwand +James Fuller +Don J Olmstead +Nicolas Sterchele +Sergey Raevskiy +SecuritySense on github +Mipsters on github +Pavel Novikov +apique13 on github +Daniel Hwang +Jon Rumsey +Tobias Nyholm +Timur Artikov +Michał Antoniak <47522782+MAntoniak@users.noreply.github.com> +Gleb Ivanovsky diff --git a/curl/.muse/config.toml b/curl/.muse/config.toml new file mode 100644 index 00000000..4e5b5cc6 --- /dev/null +++ b/curl/.muse/config.toml @@ -0,0 +1,3 @@ +ignore = [ "DEAD_STORE" ] +build = "make" +setup = ".muse/setup.sh" diff --git a/curl/.muse/setup.sh b/curl/.muse/setup.sh new file mode 100644 index 00000000..55872d59 --- /dev/null +++ b/curl/.muse/setup.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +./buildconf +./configure +echo "Ran the setup script for muse including autoconf and executing ./configure" diff --git a/curl/CHANGES b/curl/CHANGES index 5043a1f5..3e2cd994 100644 --- a/curl/CHANGES +++ b/curl/CHANGES @@ -1,6806 +1,7 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| +See https://curl.se/changes.html for the edited and human readable online +version of what has changed over the years in different curl releases. - Changelog +Generate a CHANGES file like the one present in every release like this: -Version 7.56.1 (23 Oct 2017) - -Daniel Stenberg (23 Oct 2017) -- RELEASE-NOTES: 7.56.1 - -- THANKS: update at 7.56.1 release time - -- [Jon DeVree brought this change] - - mk-ca-bundle: Remove URL for aurora - - Aurora is no longer used by Mozilla - https://hacks.mozilla.org/2017/04/simplifying-firefox-release-channels/ - -- [Jon DeVree brought this change] - - mk-ca-bundle: Fix URL for NSS - - The 'tip' is the most recent branch committed to, this should be - 'default' like the URLs for the browser are. - - Closes #1998 - -- imap: if a FETCH response has no size, don't call write callback - - CVE-2017-1000257 - - Reported-by: Brian Carpenter and 0xd34db347 - Also detected by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3586 - -- ftp: reject illegal IP/port in PASV 227 response - - ... by using range checks. Among other things, this avoids an undefined - behavior for a left shift that could happen on negative or very large - values. - - Closes #1997 - - Detected by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3694 - -Patrick Monnerat (20 Oct 2017) -- test653: check reuse of easy handle after mime data change - - See issue #1999 - -- mime: do not reuse previously computed multipart size - - The contents might have changed: size must be recomputed. - - Reported-by: moteus on github - Fixes #1999 - -- test308: disable if MultiSSL feature enabled - - Even if OpenSSL is enabled, it might not be the default backend when - multi-ssl is enabled, causing the test to fail. - -- runtests: support MultiSSL client feature - -- vtls: change struct Curl_ssl `close' field name to `close_one'. - - On OS/400, `close' is an ASCII system macro that corrupts the code if - not used in a context not targetting the close() system API. - -- os400: add missing symbols in config file. - - Also adjust makefile to renamed files and warn about installation dirs mix-up. - -- test652: curl_mime_data + base64 encoder with large contents - -- mime: limit bas64-encoded lines length to 76 characters - -Daniel Stenberg (16 Oct 2017) -- RELEASE-NOTES: synced with f121575c0 - -- setopt: range check most long options - - ... filter early instead of risking "funny values" having to be dealt - with elsewhere. - -- setopt: avoid integer overflows when setting millsecond values - - ... that are multiplied by 1000 when stored. - - For 32 bit long systems, the max value accepted (2147483 seconds) is > - 596 hours which is unlikely to ever be set by a legitimate application - - and previously it didn't work either, it just caused undefined behavior. - - Also updated the man pages for these timeout options to mention the - return code. - - Closes #1938 - -Viktor Szakats (15 Oct 2017) -- makefile.m32: allow to override gcc, ar and ranlib - - Allow to ovverride certain build tools, making it possible to - use LLVM/Clang to build curl. The default behavior is unchanged. - To build with clang (as offered by MSYS2), these settings can - be used: - - CURL_CC=clang - CURL_AR=llvm-ar - CURL_RANLIB=llvm-ranlib - - Closes https://github.com/curl/curl/pull/1993 - -- ldap: silence clang warning - - Use memset() to initialize a structure to avoid LLVM/Clang warning: - ldap.c:193:39: warning: missing field 'UserLength' initializer [-Wmissing-field-initializers] - - Closes https://github.com/curl/curl/pull/1992 - -Daniel Stenberg (14 Oct 2017) -- runtests: use valgrind for torture as well - - NOTE: it makes them terribly slow. I recommend only using valgrind for - specific torture tests or using lots of patience. - -- memdebug: trace send, recv and socket - - ... to allow them to be included in torture tests too. - - closes #1980 - -- configure: remove the C++ compiler check - - ... we used it only for the fuzzer, which we now have in a separate git - repo. - - Closes #1990 - -Patrick Monnerat (13 Oct 2017) -- mime: do not call failf() if easy handle is NULL. - -Daniel Stenberg (13 Oct 2017) -- test651: curl_formadd with huge COPYCONTENTS - -- mime: fix the content reader to handle >16K data properly - - Reported-by: Jeroen Ooms - Closes #1988 - -Patrick Monnerat (12 Oct 2017) -- mime: keep "text/plain" content type if user-specified. - - Include test cases in 554, 587, 650. - - Fixes https://github.com/curl/curl/issues/1986 - -- cli tool: use file2memory() to buffer stdin in -F option. - - Closes PR https://github.com/curl/curl/pull/1985 - -- cli tool: reimplement stdin buffering in -F option. - - If stdin is not a regular file, its content is memory-buffered to enable - a possible data "rewind". - In all cases, stdin data size is determined before real use to avoid - having an unknown part's size. - - --libcurl generated code is left as an unbuffered stdin fread/fseek callback - part with unknown data size. - - Buffering is not supported in deprecated curl_formadd() API. - -Daniel Stenberg (12 Oct 2017) -- winbuild/BUILD.WINDOWS.txt: mention WITH_NGHTTP2 - -- HELP-US: the label "PR-welcome" is now renamed to "help wanted" - - following the new github "standard" - -- RELEASE-NOTES: synced with 5505df7d2 - -Jay Satiro (11 Oct 2017) -- [Artak Galoyan brought this change] - - url: Update current connection SSL verify params in setopt - - Now VERIFYHOST, VERIFYPEER and VERIFYSTATUS options change during active - connection updates the current connection's (i.e.'connectdata' - structure) appropriate ssl_config (and ssl_proxy_config) structures - variables, making these options effective for ongoing connection. - - This functionality was available before and was broken by the - following change: - "proxy: Support HTTPS proxy and SOCKS+HTTP(s)" - CommitId: cb4e2be7c6d42ca0780f8e0a747cecf9ba45f151. - - Bug: https://github.com/curl/curl/issues/1941 - - Closes https://github.com/curl/curl/pull/1951 - -Daniel Stenberg (11 Oct 2017) -- [David Benjamin brought this change] - - openssl: don't use old BORINGSSL_YYYYMM macros - - Those were temporary things we'd add and remove for our own convenience - long ago. The last few stayed around for too long as an oversight but - have since been removed. These days we have a running - BORINGSSL_API_VERSION counter which is bumped when we find it - convenient, but 2015-11-19 was quite some time ago, so just check - OPENSSL_IS_BORINGSSL. - - Closes #1979 - -- test950; verify SMTP with custom request - -- ftpserver: support case insensitive commands - -- smtp_done: free data before returning (on send failure) - - ... as otherwise it could leak that memory. - - Detected by OSS-fuzz: - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3600 - - Assisted-by: Max Dymond - Closes #1977 - -- FTP: URL decode path for dir listing in nocwd mode - - Reported-by: Zenju on github - - Test 244 added to verify - Fixes #1974 - Closes #1976 - -- test298: verify --ftp-method nowcwd with URL encoded path - - Ref: #1974 - -- CURLOPT_XFERINFODATA.3: fix duplicate see also - -- CURLOPT_NOPROGRESS.3: also refer to xferinfofunction - -- FAQ: s/CURLOPT_PROGRESSFUNCTION/CURLOPT_XFERINFOFUNCTION - -- openssl: enable PKCS12 support for !BoringSSL - - Enable PKCS12 for all non-boringssl builds without relying on configure - or cmake checks. - - Bug: https://curl.haxx.se/mail/lib-2017-10/0007.html - Reported-by: Christian Schmitz - Closes #1948 - -- [Kristiyan Tsaklev brought this change] - - curl: don't pass semicolons when parsing Content-Disposition - - Test 1422 updated to verify. - - Closes #1964 - -Patrick Monnerat (9 Oct 2017) -- mime: properly unbind mime structure in curl_mime_free(). - - This allows freeing a mime structure bound to the easy handle before - curl_easy_cleanup(). - - Fixes #1970. - -Daniel Stenberg (9 Oct 2017) -- RTSP: avoid integer overflow on funny RTSP response - - ... like a very large non-existing RTSP version number. - - Added test 577 to verify. - - Detected by OSS-fuzz. - Closes #1969 - -Patrick Monnerat (8 Oct 2017) -- ftpserver: properly reset $ftptargetdir. - -- test643: verify curl_mime_subparts() rejects cyclic additions. - -- mime: refuse to add subparts to one of their own descendants. - - Reported-by: Alexey Melnichuk - Fixes #1962 - -- mime: avoid resetting a part's encoder when part's contents change. - -- mime: improve unbinding top multipart from easy handle. - - Also avoid dangling pointers in referencing parts. - -Daniel Stenberg (8 Oct 2017) -- RELEASE-NOTES: synced with a4c1c75da30af1 - -- curlver.h: next expected release is 7.57.0 - -Patrick Monnerat (8 Oct 2017) -- mime: be tolerant about setting twice the same header list in a part. - -- docs: clarify form/mime usage of non-regular data files. - -Daniel Stenberg (8 Oct 2017) -- Revert "multi_done: wait for name resolve to finish if still ongoing" - - This reverts commit f3e03f6c0ac52a1bf396e03f7d7e9b5b3b7165fe. - - Caused memory leaks in the fuzzer, needs to be done differently. - - Disable test 1553 for now too, as it causes memory leaks without this - commit! - -- remove_handle: call multi_done() first, then clear dns cache pointer - - Closes #1960 - -- multi_done: wait for name resolve to finish if still ongoing - - ... as we must clean up memory. - -- pingpong: return error when trying to send without connection - - When imap_done() got called before a connection is setup, it would try - to "finish up" and dereffed a NULL pointer. - - Test case 1553 managed to reproduce. I had to actually use a host name - to try to resolve to slow it down, as using the normal local server IP - will make libcurl get a connection in the first curl_multi_perform() - loop and then the bug doesn't trigger. - - Fixes #1953 - Assisted-by: Max Dymond - -Dan Fandrich (6 Oct 2017) -- tests: added flaky keyword to tests 587 and 644 - - These are around 5% flaky in my Linux x86 autobuilds. - -Marcel Raad (6 Oct 2017) -- vtls: fix warnings with --disable-crypto-auth - - When CURL_DISABLE_CRYPTO_AUTH is defined, Curl_none_md5sum's parameters - are not used. - -Daniel Stenberg (6 Oct 2017) -- multi_cleanup: call DONE on handles that never got that - - ... fixes a memory leak with at least IMAP when remove_handle is never - called and the transfer is abruptly just abandoned early. - - Test 1552 added to verify - - Detected by OSS-fuzz - Assisted-by: Max Dymond - Closes #1954 - -- [Benbuck Nason brought this change] - - strtoofft: Remove extraneous null check - - Fixes #1950: curlx_strtoofft() doesn't fully protect against null 'str' - argument. - - Closes #1952 - -- openssl: fix build without HAVE_OPAQUE_EVP_PKEY - - Reported-by: Javier Sixto - Fixes #1955 - Closes #1956 - -Viktor Szakats (6 Oct 2017) -- lib/config-win32.h: let SMB/SMBS be enabled with OpenSSL/NSS - - The source code is now prepared to handle the case when both - Win32 Crypto and OpenSSL/NSS crypto backends are enabled - at the same time, making it now possible to enable `USE_WIN32_CRYPTO` - whenever the targeted Windows version supports it. Since this - matches the minimum Windows version supported by curl - (Windows 2000), enable it unconditionally for the Win32 platform. - - This in turn enables SMB (and SMBS) protocol support whenever - Win32 Crypto is available, regardless of what other crypto backends - are enabled. - - Ref: https://github.com/curl/curl/pull/1840#issuecomment-325682052 - - Closes https://github.com/curl/curl/pull/1943 - -Daniel Stenberg (5 Oct 2017) -- build: fix --disable-crypto-auth - - Reported-by: Wyatt O'Day - Fixes #1945 - Closes #1947 - -Jay Satiro (5 Oct 2017) -- [Nick Zitzmann brought this change] - - darwinssl: add support for TLSv1.3 - - Closes https://github.com/curl/curl/pull/1794 - -Daniel Stenberg (4 Oct 2017) -- [Felix Kaiser brought this change] - - docs: fix typo in curl_mime_data_cb man page - - Closes #1946 - -Viktor Szakats (4 Oct 2017) -- lib/Makefile.m32: allow customizing dll suffixes - - - New `CURL_DLL_SUFFIX` envvar will add a suffix to the generated - libcurl dll name. Useful to add `-x64` to 64-bit builds so that - it can live in the same directory as the 32-bit one. By default - this is empty. - - - New `CURL_DLL_A_SUFFIX` envvar to customize the suffix of the - generated import library (implib) for libcurl .dll. It defaults - to `dll`, and it's useful to modify that to `.dll` to have the - standard naming scheme for mingw-built .dlls, i.e. `libcurl.dll.a`. - - Closes https://github.com/curl/curl/pull/1942 - -Daniel Stenberg (4 Oct 2017) -- [Max Dymond brought this change] - - fuzzer: move to using external curl-fuzzer - - Use the external curl-fuzzer repository for fuzzing. - - Closes #1923 - -- failf: skip the sprintf() if there are no consumers - - Closes #1936 - -- ftp: UBsan fixup 'pointer index expression overflowed' - - Closes #1939 - -- RELEASE-PROCEDURE: update the release schedule - -Version 7.56.0 (4 Oct 2017) - -Daniel Stenberg (4 Oct 2017) -- RELEASE-NOTES: curl 7.56.0 - -- THANKS: added new 7.56.0 contributors - -Jay Satiro (4 Oct 2017) -- build-openssl.bat: Warn OpenSSL 1.1.0 not yet supported - - Ref: https://github.com/curl/curl/issues/1002 - -Michael Kaufmann (3 Oct 2017) -- idn: fix source code comment - -- vtls: compare and clone ssl configs properly - - Compare these settings in Curl_ssl_config_matches(): - - verifystatus (CURLOPT_SSL_VERIFYSTATUS) - - random_file (CURLOPT_RANDOM_FILE) - - egdsocket (CURLOPT_EGDSOCKET) - - Also copy the setting "verifystatus" in Curl_clone_primary_ssl_config(), - and copy the setting "sessionid" unconditionally. - - This means that reusing connections that are secured with a client - certificate is now possible, and the statement "TLS session resumption - is disabled when a client certificate is used" in the old advisory at - https://curl.haxx.se/docs/adv_20170419.html is obsolete. - - Reviewed-by: Daniel Stenberg - - Closes #1917 - -- proxy: read the "no_proxy" variable only if necessary - - Reviewed-by: Daniel Stenberg - - Closes #1919 - -Patrick Monnerat (3 Oct 2017) -- libcurl-tutorial: add casts in example to avoid compilation warnings. - -Daniel Stenberg (3 Oct 2017) -- examples: bring back curl_formadd-using examples - - ... now with a -formadd suffix. While the new mime API is introduced in - 7.56.0 we must acknowledge that lots of users can't upgrade their curl - versions immediately. - -- test1153: verify quoted double-qoutes in PWD response - -- FTP: zero terminate the entry path even on bad input - - ... a single double quote could leave the entry path buffer without a zero - terminating byte. CVE-2017-1000254 - - Test 1152 added to verify. - - Reported-by: Max Dymond - Bug: https://curl.haxx.se/docs/adv_20171004.html - -Jay Satiro (2 Oct 2017) -- [Sergei Nikulov brought this change] - - cmake: disable tests and man generation if perl/nroff not found - - Fixes https://github.com/curl/curl/issues/1500 - Reported-by: Jay Satiro - - Fixes https://github.com/curl/curl/pull/1662 - Assisted-by: Tom Seddon - Assisted-by: dpull@users.noreply.github.com - Assisted-by: elelel@users.noreply.github.com - - Closes https://github.com/curl/curl/pull/1924 - -Patrick Monnerat (2 Oct 2017) -- libcurl-tutorial: fix two typos. - -- TODO: remove deprecated form API items. - -- libcurl-tutorial: describe MIME API and deprecate form API. - - Include a guide to form/mime API conversion. - -Daniel Stenberg (30 Sep 2017) -- cookie: fix memory leak if path was set twice in header - - ... this will let the second occurance override the first. - - Added test 1161 to verify. - - Reported-by: Max Dymond - Fixes #1932 - Closes #1933 - -Dan Fandrich (30 Sep 2017) -- test650: Use variable replacement to set the host address and port - - Otherwise, the test fails when the -b test option is used to set a - different test port range. - -- Set and use more necessary options when some protocols are disabled - - When curl and libcurl are built with some protocols disabled, they stop - setting and receiving some options that don't make sense with those - protocols. In particular, when HTTP is disabled many options aren't set - that are used only by HTTP. However, some options that appear to be - HTTP-only are actually used by other protocols as well (some despite - having HTTP in the name) and should be set, but weren't. This change now - causes some of these options to be set and used for more (or for all) - protocols. In particular, this fixes tests 646 through 649 in an - HTTP-disabled build, which use the MIME API in the mail protocols. - -Daniel Stenberg (29 Sep 2017) -- test1160: verifies cookie leak for large cookies - - The fix done in 20ea22ff735 - -- cookie: fix memory leak on oversized rejection - - Regression brought by 2bc230de63b - - Detected by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3513 - Assisted-by: Max Dymond - - Closes #1930 - -- [Anders Bakken brought this change] - - connect: fix race condition with happy eyeballs timeout - - The timer should be started after conn->connecttime is set. Otherwise - the timer could expire without this condition being true: - - /* should we try another protocol family? */ - if(i == 0 && conn->tempaddr[1] == NULL && - curlx_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) { - - Ref: #1928 - -Michael Kaufmann (28 Sep 2017) -- docs: link CURLOPT_CONNECTTIMEOUT and CURLOPT_CONNECTTIMEOUT_MS - - Closes #1922 - -- docs: clarify the use of environment variables for proxy - - Closes #1921 - -- http: add custom empty headers to repeated requests - - Closes #1920 - -- reuse_conn: don't copy flags that are known to be equal - - A connection can only be reused if the flags "conn_to_host" and - "conn_to_port" match. Therefore it is not necessary to copy these flags - in reuse_conn(). - - Closes #1918 - -Daniel Stenberg (27 Sep 2017) -- curl.h: include on cygwin too - - When building with -std=c++14 on cygwin, this header won't be - automatically included as it otherwise is. - - The include decision should ideally be reversed and be - avoided where that header file doesn't exist. - - Reported-by: Ian Fette - Fixes #1925 - -- RELEASE-NOTES: synced with d8ab5dc50 - -Michael Kaufmann (24 Sep 2017) -- tests: adjust .gitignore for new tests - -Jay Satiro (23 Sep 2017) -- ntlm: move NTLM_NEEDS_NSS_INIT define into core NTLM header - - .. and include the core NTLM header in all NTLM-related source files. - - Follow up to 6f86022. Since then http_ntlm checks NTLM_NEEDS_NSS_INIT - but did not include vtls.h where it was defined. - - Closes https://github.com/curl/curl/pull/1911 - -Daniel Stenberg (23 Sep 2017) -- file_range: avoid integer overflow when figuring out byte range - - When trying to bump the value with one and the value is already at max, - it causes an integer overflow. - - Closes #1908 - Detected by oss-fuzz: - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3465 - - Assisted-by: Max Dymond - -Michael Kaufmann (23 Sep 2017) -- tests: fix a compiler warning in test 643 - -Jay Satiro (23 Sep 2017) -- symbols-in-versions: fix CURLSSLSET_NO_BACKENDS entry - - - Use spaces instead of tabs as the delimiter. - - Follow up to 7c52b12 which added the entry. The entry had used tabs but - the symbol-scan parser doesn't recognize tabs and would fail the symbol. - -Viktor Szakats (22 Sep 2017) -- metalink: fix NSS issue in MultiSSL builds - - In MultiSSL mode (i.e. when more than one SSL backend is compiled - in), we cannot use the compile time flag `USE_NSS` as indicator that - the NSS backend is in use. As far as Metalink is concerned, the SSL - backend is only used for MD5, SHA-1 and SHA-256 calculations, - therefore one of the available SSL backends is selected at compile - time, in a strict order of preference. - - Let's introduce a new `HAVE_NSS_CONTEXT` constant that can be used - to determine whether the SSL backend used for Metalink is the NSS - backend, and use that to guard the code that wants to de-initialize - the NSS-specific data structure. - - Ref: https://github.com/curl/curl/pull/1848 - -- ntlm: use strict order for SSL backend #if branches - - With the recently introduced MultiSSL support multiple SSL backends - can be compiled into cURL That means that now the order of the SSL - - One option would be to use the same SSL backend as was configured - via `curl_global_sslset()`, however, NTLMv2 support would appear - to be available only with some SSL backends. For example, when - eb88d778e (ntlm: Use Windows Crypt API, 2014-12-02) introduced - support for NTLMv1 using Windows' Crypt API, it specifically did - *not* introduce NTLMv2 support using Crypt API at the same time. - - So let's select one specific SSL backend for NTLM support when - compiled with multiple SSL backends, using a priority order such - that we support NTLMv2 even if only one compiled-in SSL backend can - be used for that. - - Ref: https://github.com/curl/curl/pull/1848 - -Daniel Stenberg (22 Sep 2017) -- symbols-in-versions: add CURLSSLSET_NO_BACKENDS - - ...fixup from b8e0fe19ec - -- imap: quote atoms properly when escaping characters - - Updates test 800 to verify - - Fixes #1902 - Closes #1903 - -- tests: make the imap server not verify user+password - - ... as the test cases themselves do that and it makes it easier to add - crazy test cases. - - Test 800 updated to use user name + password that need quoting. - - Test 856 updated to trigger an auth fail differently. - - Ref: #1902 - -- vtls: provide curl_global_sslset() even in non-SSL builds - - ... it just returns error: - - Bug: https://github.com/curl/curl/commit/1328f69d53f2f2e937696ea954c480412b018451#commitcomment-24470367 - Reported-by: Marcel Raad - - Closes #1906 - -Patrick Monnerat (22 Sep 2017) -- form/mime: field names are not allowed to contain zero-valued bytes. - - Also suppress length argument of curl_mime_name() (names are always - zero-terminated). - -Daniel Stenberg (21 Sep 2017) -- [Dirk Feytons brought this change] - - openssl: only verify RSA private key if supported - - In some cases the RSA key does not support verifying it because it's - located on a smart card, an engine wants to hide it, ... - Check the flags on the key before trying to verify it. - OpenSSL does the same thing internally; see ssl/ssl_rsa.c - - Closes #1904 - -Marcel Raad (21 Sep 2017) -- examples/post-callback: use long for CURLOPT_POSTFIELDSIZE - - Otherwise, typecheck-gcc.h warns on MinGW-w64. - -Patrick Monnerat (20 Sep 2017) -- mime: rephrase the multipart output state machine (#1898) ... - - ... in hope coverity will like it much. - -- mime: fix an explicit null dereference (#1899) - -Daniel Stenberg (20 Sep 2017) -- curl: check fseek() return code and bail on error - - Detected by coverity. CID 1418137. - -- smtp: fix memory leak in OOM - - Regression since ce0881edee - - Coverity CID 1418139 and CID 1418136 found it, but it was also seen in - torture testing. - -- RELEASE-NOTES: synced with 5fe85587c - -- [Pavel P brought this change] - - cookies: use lock when using CURLINFO_COOKIELIST - - Closes #1896 - -- [Max Dymond brought this change] - - ossfuzz: changes before merging the generated corpora - - Before merging in the oss-fuzz corpora from Google, there are some changes - to the fuzzer. - - Add a read corpus script, to display corpus files nicely. - - Change the behaviour of the fuzzer so that TLV parse failures all now - go down the same execution paths, which should reduce the size of the - corpora. - - Make unknown TLVs a failure to parse, which should decrease the size - of the corpora as well. - - Closes #1881 - -- mime:escape_string minor clarification change - - ... as it also removes a warning with old gcc versions. - - Bug: https://curl.haxx.se/mail/lib-2017-09/0049.html - Reported-by: Ben Greear - -- [Max Dymond brought this change] - - ossfuzz: don't write out to stdout - - Don't make the fuzzer write out to stdout - instead write some of the - contents to a memory block so we exercise the data output code but - quietly. - - Closes #1885 - -- cookies: reject oversized cookies - - ... instead of truncating them. - - There's no fixed limit for acceptable cookie names in RFC 6265, but the - entire cookie is said to be less than 4096 bytes (section 6.1). This is - also what browsers seem to implement. - - We now allow max 5000 bytes cookie header. Max 4095 bytes length per - cookie name and value. Name + value together may not exceed 4096 bytes. - - Added test 1151 to verify - - Bug: https://curl.haxx.se/mail/lib-2017-09/0062.html - Reported-by: Kevin Smith - - Closes #1894 - -- travis: on mac, don't install openssl or libidn - - - openssl is already installed and causes warnings when trying to - install again - - - libidn isn't used these days, and homebrew doesn't seem to have a - libidn2 package to replace with easily - - Closes #1895 - -- curl: make str2udouble not return values on error - - ... previously it would store a return value even when it returned - error, which could make the value get used anyway! - - Reported-by: Brian Carpenter - Closes #1893 - -Jay Satiro (18 Sep 2017) -- socks: fix incorrect port number in SOCKS4 error message - - Prior to this change it appears the SOCKS5 port parsing was erroneously - used for the SOCKS4 error message, and as a result an incorrect port - would be shown in the error message. - - Bug: https://github.com/curl/curl/issues/1892 - Reported-by: Jackarain@users.noreply.github.com - -- [Marc Aldorasi brought this change] - - schannel: Support partial send for when data is too large - - Schannel can only encrypt a certain amount of data at once. Instead of - failing when too much data is to be sent at once, send as much data as - we can and let the caller send the remaining data by calling send again. - - Bug: https://curl.haxx.se/mail/lib-2014-07/0033.html - - Closes https://github.com/curl/curl/pull/1890 - -- [David Benjamin brought this change] - - openssl: add missing includes - - lib/vtls/openssl.c uses OpenSSL APIs from BUF_MEM and BIO APIs. Include - their headers directly rather than relying on other OpenSSL headers - including things. - - Closes https://github.com/curl/curl/pull/1891 - -Daniel Stenberg (15 Sep 2017) -- conversions: fix several compiler warnings - -- server/getpart: provide dummy function to build conversion enabled - -- non-ascii: use iconv() with 'char **' argument - - Bug: https://curl.haxx.se/mail/lib-2017-09/0031.html - -- escape.c: error: pointer targets differ in signedness - -- docs: clarify the CURLOPT_INTERLEAVE* options behavior - -- [Max Dymond brought this change] - - rtsp: Segfault in rtsp.c when using WRITEDATA - - If the INTERLEAVEFUNCTION is defined, then use that plus the - INTERLEAVEDATA information when writing RTP. Otherwise, use - WRITEFUNCTION and WRITEDATA. - - Fixes #1880 - Closes #1884 - -Marcel Raad (15 Sep 2017) -- [Isaac Boukris brought this change] - - tests: enable gssapi in travis-ci linux build - - Closes https://github.com/curl/curl/pull/1687 - -- [Isaac Boukris brought this change] - - tests: add initial gssapi test using stub implementation - - The stub implementation is pre-loaded using LD_PRELOAD - and emulates common gssapi uses (only builds if curl is - initially built with gssapi support). - - The initial tests are currently disabled for debug builds - as LD_PRELOAD is not used then. - - Ref: https://github.com/curl/curl/pull/1687 - -Daniel Stenberg (15 Sep 2017) -- test1150: verify same host fetch using different ports over proxy - - Closes #1889 - -- URL: on connection re-use, still pick the new remote port - - ... as when a proxy connection is being re-used, it can still get a - different remote port. - - Fixes #1887 - Reported-by: Oli Kingshott - -- RELEASE-NOTES: synced with 87501e57f - -- code style: remove wrong uses of multiple spaces - - Closes #1878 - -- checksrc: detect and warn for multiple spaces - -- code style: use space after semicolon - -- checksrc: verify space after semicolons - -- code style: use spaces around pluses - -- checksrc: detect and warn for lack of spaces next to plus signs - -- code style: use spaces around equals signs - -- checksrc: verify spaces around equals signs - - ... as the code style mandates. - -- Curl_checkheaders: make it available for IMAP and SMTP too - - ... not only HTTP uses this now. - - Closes #1875 - -- travis: add build without HTTP/SMTP/IMAP - -Jay Satiro (10 Sep 2017) -- mbedtls: enable CA path processing - - CA path processing was implemented when mbedtls.c was added to libcurl - in fe7590f, but it was never enabled. - - Bug: https://github.com/curl/curl/issues/1877 - Reported-by: SBKarr@users.noreply.github.com - -Daniel Stenberg (8 Sep 2017) -- rtsp: do not call fwrite() with NULL pointer FILE * - - If the default write callback is used and no destination has been set, a - NULL pointer would be passed to fwrite()'s 4th argument. - - OSS-fuzz bug https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3327 - (not publicly open yet) - - Detected by OSS-fuzz - Closes #1874 - -- configure: use -Wno-varargs on clang 3.9[.X] debug builds - - ... to avoid a clang bug - -- [Max Dymond brought this change] - - ossfuzz: add some more handled CURL options - - Add support for HEADER, COOKIE, RANGE, CUSTOMREQUEST, MAIL_RECIPIENT, - MAIL_FROM and uploading data. - -- configure: check for C++ compiler after C, to make it non-fatal - - The tests for object file/executable file extensions are presumably only - done for the first of these macros in the configure file. - - Bug: https://github.com/curl/curl/pull/1851#issuecomment-327597515 - Reported-by: Marcel Raad - Closes #1873 - -Patrick Monnerat (7 Sep 2017) -- form API: add new test 650. - - Now that the form API is deprecated and not used anymore in curl tool, - a lot of its features left untested. Test 650 attempts to check all these - features not tested elsewhere. - -Jay Satiro (7 Sep 2017) -- configure: fix curl_off_t check's include order - - - Prepend srcdir include path instead of append. - - Prior to this change it was possible that during the check for the size - of curl_off_t the include path of a user's already installed curl could - come before the include path of the to-be-built curl, resulting in the - system.h of the former being incorrectly included for that check. - - Closes https://github.com/curl/curl/pull/1870 - -Daniel Stenberg (7 Sep 2017) -- [Jakub Zakrzewski brought this change] - - KNOWN_BUGS: Remove CMake symbol hiding issue - - It has already been fixed in 6140dfc - -- http-proxy: when not doing CONNECT, that phase is done immediately - - `conn->connect_state` is NULL when doing a regular non-CONNECT request - over the proxy and should therefor be considered complete at once. - - Fixes #1853 - Closes #1862 - Reported-by: Lawrence Wagerfield - -- [Johannes Schindelin brought this change] - - OpenSSL: fix yet another mistake while encapsulating SSL backend data - - Another mistake in my manual fixups of the largely mechanical - search-and-replace ("connssl->" -> "BACKEND->"), just like the previous - commit concerning HTTPS proxies (and hence not caught during my - earlier testing). - - Fixes #1855 - Closes #1871 - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - OpenSSL: fix erroneous SSL backend encapsulation - - In d65e6cc4f (vtls: prepare the SSL backends for encapsulated private - data, 2017-06-21), this developer prepared for a separation of the - private data of the SSL backends from the general connection data. - - This conversion was partially automated (search-and-replace) and - partially manual (e.g. proxy_ssl's backend data). - - Sadly, there was a crucial error in the manual part, where the wrong - handle was used: rather than connecting ssl[sockindex]' BIO to the - proxy_ssl[sockindex]', we reconnected proxy_ssl[sockindex]. The reason - was an incorrect location to paste "BACKEND->"... d'oh. - - Reported by Jay Satiro in https://github.com/curl/curl/issues/1855. - - Signed-off-by: Johannes Schindelin - -- [Jay Satiro brought this change] - - vtls: fix memory corruption - - Ever since 70f1db321 (vtls: encapsulate SSL backend-specific data, - 2017-07-28), the code handling HTTPS proxies was broken because the - pointer to the SSL backend data was not swapped between - conn->ssl[sockindex] and conn->proxy_ssl[sockindex] as intended, but - instead set to NULL (causing segmentation faults). - - [jes: provided the commit message, tested and verified the patch] - - Signed-off-by: Johannes Schindelin - -- vtls: switch to CURL_SHA256_DIGEST_LENGTH define - - ... instead of the prefix-less version since WolfSSL 3.12 now uses an - enum with that name that causes build failures for us. - - Fixes #1865 - Closes #1867 - Reported-by: Gisle Vanem - -- travis: add c-ares enabled builds linux + osx - - Closes #1868 - -- HISTORY: added some recent items - -Jay Satiro (6 Sep 2017) -- SSL: fix unused parameter warnings - -Patrick Monnerat (6 Sep 2017) -- mime: drop internal FILE * support. - - - The part kind MIMEKIND_FILE and associated code are suppressed. - - Seek data origin offset not used anymore: suppressed. - - MIMEKIND_NAMEDFILE renamed MIMEKIND_FILE; associated fields/functions - renamed accordingly. - - Curl_getformdata() processes stdin via a callback. - -Daniel Stenberg (6 Sep 2017) -- configure: remove --enable-soname-bump and SONAME_BUMP - - Back in 2008, (and commit 3f3d6ebe665f3) we changed the logic in how we - determine the native type for `curl_off_t`. To really make sure we - didn't break ABI without bumping SONAME, we introduced logic that - attempted to detect that it would use a different size and thus not be - compatible. We also provided a manual switch that allowed users to tell - configure to bump SONAME by force. - - Today, we know of no one who ever got a SONAME bump auto-detected and we - don't know of anyone who's using the manual bump feature. The auto- - detection is also no longer working since we introduced defining - curl_off_t in system.h (7.55.0). - - Finally, this bumping logic is not present in the cmake build. - - Closes #1861 - -Jay Satiro (6 Sep 2017) -- [Gisle Vanem brought this change] - - vtls: select ssl backend case-insensitive (follow-up) - - - Do a case-insensitive comparison of CURL_SSL_BACKEND env as well. - - - Change Curl_strcasecompare calls to strcasecompare - (maps to the former but shorter). - - Follow-up to c290b8f. - - Bug: https://github.com/curl/curl/commit/c290b8f#commitcomment-24094313 - - Co-authored-by: Jay Satiro - -- openssl: Integrate Peter Wu's SSLKEYLOGFILE implementation - - This is an adaptation of 2 of Peter Wu's SSLKEYLOGFILE implementations. - - The first one, written for old OpenSSL versions: - https://git.lekensteyn.nl/peter/wireshark-notes/tree/src/sslkeylog.c - - The second one, written for BoringSSL and new OpenSSL versions: - https://github.com/curl/curl/pull/1346 - - Note the first one is GPL licensed but the author gave permission to - waive that license for libcurl. - - As of right now this feature is disabled by default, and does not have - a configure option to enable it. To enable this feature define - ENABLE_SSLKEYLOGFILE when building libcurl and set environment - variable SSLKEYLOGFILE to a pathname that will receive the keys. - - And in Wireshark change your preferences to point to that key file: - Edit > Preferences > Protocols > SSL > Master-Secret - - Co-authored-by: Peter Wu - - Ref: https://github.com/curl/curl/pull/1030 - Ref: https://github.com/curl/curl/pull/1346 - - Closes https://github.com/curl/curl/pull/1866 - -Patrick Monnerat (5 Sep 2017) -- mime: fix a trivial warning. - -- mime: replace 'struct Curl_mimepart' by 'curl_mimepart' in encoder code. - - mime_state is now a typedef. - -- mime: implement encoders. - - curl_mime_encoder() is operational and documented. - curl tool -F option is extended with ";encoder=". - curl tool --libcurl option generates calls to curl_mime_encoder(). - New encoder tests 648 & 649. - Test 1404 extended with an encoder specification. - -- runtests.pl: support attribute "nonewline" in part verify/upload. - -- [Daniel Stenberg brought this change] - - fixup data/test1135 - -- [Daniel Stenberg brought this change] - - mime: unified to use the typedef'd mime structs everywhere - - ... and slightly edited to follow our code style better. - -- [Daniel Stenberg brought this change] - - curl.h: use lower case curl_mime* as for all public symbols - -- [Daniel Stenberg brought this change] - - docs/curl_mime_*.3: use correct variable types in examples - -Kamil Dudka (5 Sep 2017) -- openssl: use OpenSSL's default ciphers by default - - Up2date versions of OpenSSL maintain the default reasonably secure - without breaking compatibility, so it is better not to override the - default by curl. Suggested at https://bugzilla.redhat.com/1483972 - - Closes #1846 - -Viktor Szakats (5 Sep 2017) -- examples/mime: minor example code fixes - -Daniel Stenberg (5 Sep 2017) -- docs/curl_mime_*.3: added examples - -- configure: add MultiSSL to FEATURES when enabled - - ...for curl-config and its corresponding test 1014 - -- http-proxy: treat all 2xx as CONNECT success - - Added test 1904 to verify. - - Reported-by: Lawrence Wagerfield - Fixes #1859 - Closes #1860 - -- MAIL-ETIQUETTE: added "1.9 Your emails are public" - -- curl.h: fix "unused checksrc ignore", remove dangling reference - - ... to a README file that doesn't exist anymore - -Viktor Szakats (4 Sep 2017) -- docs: Update to secure URL versions - -- mime: use CURL_ZERO_TERMINATED in examples - - and some minor whitespace fixes - -Daniel Stenberg (4 Sep 2017) -- schannel: return CURLE_SSL_CACERT on failed verification - - ... not *CACERT_BADFILE as it isn't really because of a bad file. - - Bug: https://curl.haxx.se/mail/lib-2017-09/0002.html - Closes #1858 - -- test1135: fixed after bd8070085f9 - -- examples/post-callback: stop returning one byte at a time - - ... since people copy and paste code from this example and thus they get - an inefficient POST operation without a good reason and sometimes - without understanding why. - - Instead this now returns as much data as possible. - -- RELEASE-NOTES: fixed the function counter script - -- curl.h: make the curl_strequal() protos use the same style - - ... as the other functions. Makes it easier to machine-parse! - -- docs: curl_mime_*.3 man page formatting edits - -- RELEASE-NOTES: synced with 1ab9e9b50 - -Patrick Monnerat (4 Sep 2017) -- lib: bump version info (soname). Adapt and reenable test 1135. - -Daniel Stenberg (3 Sep 2017) -- headers: move the global_sslset() proto from multi.h to curl.h - - As it was added to multi.h simply to not break test 1135, which now has - been disabled due to the mime API addition anyway and su we can now move - the sslset stuff to where the other curl_global_* prototypes are. - -Patrick Monnerat (3 Sep 2017) -- mime: fix signed/unsigned conversions. - - Use and generate CURL_ZERO_TERMINATED in curl tool and tests. - -Jay Satiro (3 Sep 2017) -- tool_formparse: fix some trivial warnings - -Patrick Monnerat (3 Sep 2017) -- mime: use size_t instead of ssize_t in public API interface. - - To support telling a string is nul-terminated, symbol CURL_ZERO_TERMINATED - has been introduced. - - Documentation updated accordingly. - - symbols in versions updated. Added form API symbols deprecation info. - -- mime: remove support "-" stdin pseudo-file name in curl_mime_filedata(). - - This feature is badly supported in Windows: as a replacement, a caller has - to use curl_mime_data_cb() with fread, fseek and possibly fclose - callbacks to process opened files. - - The cli tool and documentation are updated accordingly. - - The feature is however kept internally for form API compatibility, with - the known caveats it always had. - - As a side effect, stdin size is not determined by the cli tool even if - possible and this results in a chunked transfer encoding. Test 173 is - updated accordingly. - -- mime: fix some implicit curl_off_t --> size_t conversion warnings. - -- mime: tests and examples. - - Additional mime-specific tests. - Existing tests updated to reflect small differences (Expect: 100-continue, - data size change due to empty lines, etc). - Option -F headers= keyword added to tests. - test1135 disabled until the entry point order change is resolved. - New example smtp-mime. - Examples postit2 and multi-post converted from form API to mime API. - -- mime: use in curl cli tool instead of form API. - - Extended -F option syntax to support multipart mail messages. - -F keyword headers= added to include custom headers in parts. - Documentation upgraded. - -- mime: new MIME API. - - Available in HTTP, SMTP and IMAP. - Deprecates the FORM API. - See CURLOPT_MIMEPOST. - Lib code and associated documentation. - -- test564: Add a warning comment about shell profile output. - - Shell profile output makes the SSH server failing and this problem reason - is not easy to find when no hint is given. - -- checksrc: disable SPACEBEFOREPAREN for case statement. - - The case keyword may be followed by a constant expression and thus should - allow it to start with an open parenthesis. - -- runtests.pl: allow tags in client section. - - This enables tests to create more than one file on the client side. - -- runtests.pl: Apply strippart to upload too. - - This will allow substitution of boundaries in mail messages. - -- Curl_base64_encode: always call with a real data handle. - - Some calls in different modules were setting the data handle to NULL, causing - segmentation faults when using builds that enable character code conversions. - -- non-ascii: allow conversion functions to be called with a NULL data handle. - -- http: fix a memory leakage in checkrtspprefix(). - -Daniel Stenberg (2 Sep 2017) -- [Max Dymond brought this change] - - ossfuzz: Move to C++ for curl_fuzzer. - - Automake gets confused if you want to use C++ static libraries with C - code - basically we need to involve the clang++ linker. The easiest way - of achieving this is to rename the C code as C++ code. This gets us a - bit further along the path and ought to be compatible with Google's - version of clang. - -- curl_global_sslset: select backend by name case insensitively - - Closes #1849 - -- [Max Dymond brought this change] - - ossfuzz: additional seed corpora - - Create simple seed corpora for: - - FTP - - telnet - - dict - - tftp - - imap - - pop3 - - based off the tests of the same number. - - Closes #1842 - -- [Max Dymond brought this change] - - ossfuzz: moving towards the ideal integration - - - Start with the basic code from the ossfuzz project. - - Rewrite fuzz corpora to be binary files full of Type-Length-Value - data, and write a glue layer in the fuzzing function to convert - corpora into CURL options. - - Have supporting functions to generate corpora from existing tests - - Integrate with Makefile.am - -- strcase: corrected comment header for Curl_strcasecompare() - -- unit1301: fix error message on first test - -- curl_global_sslset.3: show the struct and enum too - - ... so that users can actually write code based on the man page alone, - not having to read the header file. - -Jay Satiro (31 Aug 2017) -- darwinssl: handle long strings in TLS certs (follow-up) - - - Fix handling certificate subjects that are already UTF-8 encoded. - - Follow-up to b3b75d1 from two days ago. Since then a copy would be - skipped if the subject was already UTF-8, possibly resulting in a NULL - deref later on. - - Ref: https://github.com/curl/curl/issues/1823 - Ref: https://github.com/curl/curl/pull/1831 - - Closes https://github.com/curl/curl/pull/1836 - -Daniel Stenberg (31 Aug 2017) -- cyassl: call it the "WolfSSL" backend - - ... instead of cyassl, as this is the current name for it. - - Closes #1844 - -- polarssl: fix multissl breakage - - Reported-by: Dan Fandrich - Bug: https://curl.haxx.se/mail/lib-2017-08/0121.html - Closes #1843 - -- configure: remove the leading comma from the backends list - - ... when darwinssl is used. - - Reported-by: Viktor Szakats - Bug: https://github.com/curl/curl/commit/b0989cd3abaff4f9a0717b4875022fa79e33b481#commitcomment-23943493 - - Closes #1845 - -Kamil Dudka (30 Aug 2017) -- examples/sslbackend.c: fix failure of 'make checksrc' - - ./sslbackend.c:58:3: warning: else after closing brace on same line (BRACEELSE) - } else if(isdigit(*name)) { - ^ - ./sslbackend.c:62:3: warning: else after closing brace on same line (BRACEELSE) - } else - ^ - -Viktor Szakats (30 Aug 2017) -- makefile.m32: add multissl support - - Closes https://github.com/curl/curl/pull/1840 - -Daniel Stenberg (30 Aug 2017) -- curl.h: CURLSSLBACKEND_WOLFSSL used wrong value - - The CURLSSLBACKEND_WOLFSSL is supposed to be an alias for - CURLSSLBACKEND_CYASSL, but used an erronous value. To reduce the risk - for a similar mistake, define the backend aliases to use the enum values - instead. - - Reported-by: Gisle Vanem - Bug: https://curl.haxx.se/mail/lib-2017-08/0120.html - -- curl_global_sslset.3: clarify - - it is a one time *set*, not necessarily a one time use... it can be - called again if the first call failed or just listed the alternatives. - - clarify that the available backends are the ones this build supports - - plus add some formatting - - Reported-by: Rich Gray - Bug: https://curl.haxx.se/mail/lib-2017-08/0119.html - -- curl/multi.h: remove duplicated closing c++ brace - - Regression since 1328f69d53f2f2e93 - - Fixes #1841 - Reported-by: Andrei Karas - -- RELEASE-NOTES: synced with 8c33c963a - -- HELP-US.md: spelling - -- HELP-US.md: "How to get started helping out in the curl project" - - Closes #1837 - -Dan Fandrich (29 Aug 2017) -- asyn-thread: Fixed cleanup after OOM - - destroy_async_data() assumes that if the flag "done" is not set yet, the - thread itself will clean up once the request is complete. But if an - error (generally OOM) occurs before the thread even has a chance to - start, it will never get a chance to clean up and memory will be leaked. - By clearing "done" only just before starting the thread, the correct - cleanup sequence will happen in all cases. - -Daniel Stenberg (28 Aug 2017) -- curl_global_init.3: mention curl_global_sslset(3) - -Dan Fandrich (28 Aug 2017) -- unit1606: Fixed shadowed variable warning - -- asyn-thread: Improved cleanup after OOM situations - -- asyn-thread: Set errno to the proper value ENOMEM in OOM situation - - This used to be set in some configurations to EAI_MEMORY which is not a - valid value for errno and caused Curl_strerror to fail an assertion. - -Daniel Stenberg (28 Aug 2017) -- [Johannes Schindelin brought this change] - - configure: Handle "MultiSSL" specially When versioning symbols - - There is a mode in which libcurl is compiled with versioned symbols, - depending on the active SSL backend. - - When multiple SSL backends are active, it does not make sense to favor - one over the others, so let's not: introduce a new prefix for the case - where multiple SSL backends are compiled into cURL. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - configure: allow setting the default SSL backend - - Previously, we used as default SSL backend whatever was first in the - `available_backends` array. - - However, some users may want to override that default without patching - the source code. - - Now they can: with the --with-default-ssl-backend= option of - the ./configure script. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: use Curl_ssl_multi pseudo backend only when needed - - When only one SSL backend is configured, it is totally unnecessary to - let multissl_init() configure the backend at runtime, we can select the - correct backend at build time already. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - version: if built with more than one SSL backend, report all of them - - To discern the active one from the inactive ones, put the latter into - parentheses. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - version: add the CURL_VERSION_MULTI_SSL feature flag - - This new feature flag reports When cURL was built with multiple SSL - backends. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - metalink: allow compiling with multiple SSL backends - - Previously, the code assumed that at most one of the SSL backends would - be compiled in, emulating OpenSSL's functions if the configured backend - was not OpenSSL itself. - - However, now we allow building with multiple SSL backends and choosing - one at runtime. Therefore, metalink needs to be adjusted to handle this - scenario, too. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - docs/examples: demonstrate how to select SSL backends - - The newly-introduced curl_global_sslset() function deserves to be - show-cased. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - Add a man page for curl_global_sslset() - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: introduce curl_global_sslset() - - Let's add a compile time safe API to select an SSL backend. This - function needs to be called *before* curl_global_init(), and can be - called only once. - - Side note: we do not explicitly test that it is called before - curl_global_init(), but we do verify that it is not called multiple times - (even implicitly). - - If SSL is used before the function was called, it will use whatever the - CURL_SSL_BACKEND environment variable says (or default to the first - available SSL backend), and if a subsequent call to - curl_global_sslset() disagrees with the previous choice, it will fail - with CURLSSLSET_TOO_LATE. - - The function also accepts an "avail" parameter to point to a (read-only) - NULL-terminated list of available backends. This comes in real handy if - an application wants to let the user choose between whatever SSL backends - the currently available libcurl has to offer: simply call - - curl_global_sslset(-1, NULL, &avail); - - which will return CURLSSLSET_UNKNOWN_BACKEND and populate the avail - variable to point to the relevant information to present to the user. - - Just like with the HTTP/2 push functions, we have to add the function - declaration of curl_global_sslset() function to the header file - *multi.h* because VMS and OS/400 require a stable order of functions - declared in include/curl/*.h (where the header files are sorted - alphabetically). This looks a bit funny, but it cannot be helped. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: refactor out essential information about the SSL backends - - There is information about the compiled-in SSL backends that is really - no concern of any code other than the SSL backend itself, such as which - function (if any) implements SHA-256 summing. - - And there is information that is really interesting to the user, such as - the name, or the curl_sslbackend value. - - Let's factor out the latter into a publicly visible struct. This - information will be used in the upcoming API to set the SSL backend - globally. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: allow selecting which SSL backend to use at runtime - - When building software for the masses, it is sometimes not possible to - decide for all users which SSL backend is appropriate. - - Git for Windows, for example, uses cURL to perform clones, fetches and - pushes via HTTPS, and some users strongly prefer OpenSSL, while other - users really need to use Secure Channel because it offers - enterprise-ready tools to manage credentials via Windows' Credential - Store. - - The current Git for Windows versions use the ugly work-around of - building libcurl once with OpenSSL support and once with Secure Channel - support, and switching out the binaries in the installer depending on - the user's choice. - - Needless to say, this is a super ugly workaround that actually only - works in some cases: Git for Windows also comes in a portable form, and - in a form intended for third-party applications requiring Git - functionality, in which cases this "swap out libcurl-4.dll" simply is - not an option. - - Therefore, the Git for Windows project has a vested interest in teaching - cURL to make the SSL backend a *runtime* option. - - This patch makes that possible. - - By running ./configure with multiple --with- options, cURL will - be built with multiple backends. - - For the moment, the backend can be configured using the environment - variable CURL_SSL_BACKEND (valid values are e.g. "openssl" and - "schannel"). - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: fold the backend ID into the Curl_ssl structure - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - curl_ntlm_core: don't complain but #include OpenSSL header if needed - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: encapsulate SSL backend-specific data - - So far, all of the SSL backends' private data has been declared as - part of the ssl_connect_data struct, in one big #if .. #elif .. #endif - block. - - This can only work as long as the SSL backend is a compile-time option, - something we want to change in the next commits. - - Therefore, let's encapsulate the exact data needed by each SSL backend - into a private struct, and let's avoid bleeding any SSL backend-specific - information into urldata.h. This is also necessary to allow multiple SSL - backends to be compiled in at the same time, as e.g. OpenSSL's and - CyaSSL's headers cannot be included in the same .c file. - - To avoid too many malloc() calls, we simply append the private structs - to the connectdata struct in allocate_conn(). - - This requires us to take extra care of alignment issues: struct fields - often need to be aligned on certain boundaries e.g. 32-bit values need to - be stored at addresses that divide evenly by 4 (= 32 bit / 8 - bit-per-byte). - - We do that by assuming that no SSL backend's private data contains any - fields that need to be aligned on boundaries larger than `long long` - (typically 64-bit) would need. Under this assumption, we simply add a - dummy field of type `long long` to the `struct connectdata` struct. This - field will never be accessed but acts as a placeholder for the four - instances of ssl_backend_data instead. the size of each ssl_backend_data - struct is stored in the SSL backend-specific metadata, to allow - allocate_conn() to know how much extra space to allocate, and how to - initialize the ssl[sockindex]->backend and proxy_ssl[sockindex]->backend - pointers. - - This would appear to be a little complicated at first, but is really - necessary to encapsulate the private data of each SSL backend correctly. - And we need to encapsulate thusly if we ever want to allow selecting - CyaSSL and OpenSSL at runtime, as their headers cannot be included within - the same .c file (there are just too many conflicting definitions and - declarations for that). - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: prepare the SSL backends for encapsulated private data - - At the moment, cURL's SSL backend needs to be configured at build time. - As such, it is totally okay for them to hard-code their backend-specific - data in the ssl_connect_data struct. - - In preparation for making the SSL backend a runtime option, let's make - the access of said private data a bit more abstract so that it can be - adjusted later in an easy manner. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - urldata.h: move SSPI-specific #include to correct location - - In 86b889485 (sasl_gssapi: Added GSS-API based Kerberos V5 variables, - 2014-12-03), an SSPI-specific field was added to the kerberos5data - struct without moving the #include "curl_sspi.h" later in the same file. - - This broke the build when SSPI was enabled, unless Secure Channel was - used as SSL backend, because it just so happens that Secure Channel also - requires "curl_sspi.h" to be #included. - - In f4739f639 (urldata: include curl_sspi.h when Windows SSPI is enabled, - 2017-02-21), this bug was fixed incorrectly: Instead of moving the - appropriate conditional #include, the Secure Channel-conditional part - was now also SSPI-conditional. - - Fix this problem by moving the correct #include instead. - - This is also required for an upcoming patch that moves all the Secure - Channel-specific stuff out of urldata.h and encapsulates it properly in - vtls/schannel.c instead. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - urldata.h: remove support for obsolete PolarSSL version - - Since 5017d5ada (polarssl: now require 1.3.0+, 2014-03-17), we require - a newer PolarSSL version. No need to keep code trying to support any - older version. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - getinfo: access SSL internals via Curl_ssl - - In the ongoing endeavor to abstract out all SSL backend-specific - functionality, this is the next step: Instead of hard-coding how the - different SSL backends access their internal data in getinfo.c, let's - implement backend-specific functions to do that task. - - This will also allow for switching SSL backends as a runtime option. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: move SSL backends' private constants out of their header files - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - axtls: use Curl_none_* versions of init() and cleanup() - - There are convenient no-op versions of the init/cleanup functions now, - no need to define private ones for axTLS. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: remove obsolete declarations of SSL backend functionality - - These functions are all available via the Curl_ssl struct now, no need - to declare them separately anymore. - - As the global declarations are removed, the corresponding function - definitions are marked as file-local. The only two exceptions here are - Curl_mbedtls_shutdown() and Curl_polarssl_shutdown(): only the - declarations were removed, there are no function definitions to mark - file-local. - - Please note that Curl_nss_force_init() is *still* declared globally, as - the only SSL backend-specific function, because it was introduced - specifically for the use case where cURL was compiled with - `--without-ssl --with-nss`. For details, see f3b77e561 (http_ntlm: add - support for NSS, 2010-06-27). - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - schannel: reorder functions topologically - - The _shutdown() function calls the _session_free() function; While this - is not a problem now (because schannel.h declares both functions), a - patch looming in the immediate future with make all of these functions - file-local. - - So let's just move the _session_free() function's definition before it - is called. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - axtls: reorder functions topologically - - The connect_finish() function (like many other functions after it) calls - the Curl_axtls_close() function; While this is not a problem now - (because axtls.h declares the latter function), a patch looming in the - immediate future with make all of these functions file-local. - - So let's just move the Curl_axtls_close() function's definition before - it is called. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: move the SUPPORT_HTTPS_PROXY flag into the Curl_ssl struct - - That will allow us to choose the SSL backend at runtime. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: convert the have_curlssl_* constants to runtime flags - - The entire idea of introducing the Curl_ssl struct to describe SSL - backends is to prepare for choosing the SSL backend at runtime. - - To that end, convert all the #ifdef have_curlssl_* style conditionals - to use bit flags instead. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: move sha256sum into the Curl_ssl struct - - The SHA-256 checksumming is also an SSL backend-specific function. - Let's include it in the struct declaring the functionality of SSL - backends. - - In contrast to MD5, there is no fall-back code. To indicate this, the - respective entries are NULL for those backends that offer no support for - SHA-256 checksumming. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: move md5sum into the Curl_ssl struct - - The MD5 summing is also an SSL backend-specific function. So let's - include it, offering the previous fall-back code as a separate function - now: Curl_none_md5sum(). To allow for that, the signature had to be - changed so that an error could be returned from the implementation - (Curl_none_md5sum() can run out of memory). - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: use the Curl_ssl struct to access all SSL backends' functionality - - This is the first step to unify the SSL backend handling. Now all the - SSL backend-specific functionality is accessed via a global instance of - the Curl_ssl struct. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: declare Curl_ssl structs for every SSL backend - - The idea of introducing the Curl_ssl struct was to unify how the SSL - backends are declared and called. To this end, we now provide an - instance of the Curl_ssl struct for each and every SSL backend. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: introduce a new struct for SSL backends - - This new struct is similar in nature to Curl_handler: it will define the - functions and capabilities of all the SSL backends (where Curl_handler - defines the functions and capabilities of protocol handlers). - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: make sure every _sha256sum()'s first arg is const - - This patch makes the signature of the _sha256sum() functions consistent - among the SSL backends, in preparation for unifying the way all SSL - backends are accessed. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: make sure all _data_pending() functions return bool - - This patch makes the signature of the _data_pending() functions - consistent among the SSL backends, in preparation for unifying the way - all SSL backends are accessed. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: make sure all _cleanup() functions return void - - This patch makes the signature of the _cleanup() functions consistent - among the SSL backends, in preparation for unifying the way all SSL - backends are accessed. - - Signed-off-by: Johannes Schindelin - -- [Johannes Schindelin brought this change] - - vtls: use consistent signature for _random() implementations - - This will make the upcoming multissl backend much easier to implement. - - Signed-off-by: Johannes Schindelin - -- strtooff: fix build for systems with long long but no strtoll option - - Closes #1829 - - Reported-by: Dan Fandrich - Bug: https://github.com/curl/curl/pull/1758#issuecomment-324861615 - -- darwinssl: handle long strings in TLS certs - - ... as the previous fixed length 128 bytes buffer was sometimes too - small. - - Fixes #1823 - Closes #1831 - - Reported-by: Benjamin Sergeant - Assisted-by: Bill Pyne, Ray Satiro, Nick Zitzmann - -- system.h: include sys/poll.h for AIX - - ... to get the event/revent defines that might be used for the poll - struct. - - Reported-by: Michael Smith - Fixes #1828 - Closes #1833 - -Dan Fandrich (26 Aug 2017) -- tests: Make sure libtests & unittests call curl_global_cleanup() - - These were missed in commit c468c27b. - -Jay Satiro (26 Aug 2017) -- [theantigod brought this change] - - winbuild: fix embedded manifest option - - Embedded manifest option didn't work due to incorrect path. - - Fixes https://github.com/curl/curl/issues/1832 - -Daniel Stenberg (25 Aug 2017) -- fuzz/Makefile.am: remove curlbuild.h leftovers - -- examples/threaded-ssl: mention that this is for openssl before 1.1 - -- imap: use defined names for response codes - - When working on this code I found the previous setup a bit weird while - using proper defines increases readability. - - Closes #1824 - -- CURLOPT_USERPWD.3: see also CURLOPT_PROXYUSERPWD - -- imap: support PREAUTH - - It is a defined possible greeting at server startup that means the - connection is already authenticated. See - https://tools.ietf.org/html/rfc3501#section-7.1.4 - - Test 846 added to verify. - - Fixes #1818 - Closes #1820 - -Jay Satiro (23 Aug 2017) -- config-tpf: define SIZEOF_LONG - - Recent changes that replaced CURL_SIZEOF_LONG in the source with - SIZEOF_LONG broke builds that use the premade configuration files and - don't have SIZEOF_LONG defined. - - Bug: https://github.com/curl/curl/issues/1816 - -Dan Fandrich (23 Aug 2017) -- test1453: Fixed - -Daniel Stenberg (22 Aug 2017) -- [Gisle Vanem brought this change] - - config-dos: add missing defines, SIZEOF_* and two others - - Bug: #1816 - -- curl: shorten and clean up CA cert verification error message - - The previous message was just too long for ordinary people and it was - encouraging users to use `--insecure` a little too easy. - - Based-on-work-by: Frank Denis - - Closes #1810 - Closes #1817 - -- request-target.d: mention added in 7.55.0 - -Marcel Raad (22 Aug 2017) -- tool_main: turn off MinGW CRT's globbing - - By default, the MinGW CRT globs command-line arguments. This prevents - getting a single asterisk into an argument as test 1299 does. Turn off - globbing by setting the global variable _CRT_glob to 0 for MinGW. - - Fixes https://github.com/curl/curl/issues/1751 - Closes https://github.com/curl/curl/pull/1813 - -Viktor Szakats (22 Aug 2017) -- makefile.m32: add support for libidn2 - - libidn was replaced with libidn2 last year in configure. - Caveat: libidn2 may depend on a list of further libs. - These can be manually specified via CURL_LDFLAG_EXTRAS. - - Closes https://github.com/curl/curl/pull/1815 - -Jay Satiro (22 Aug 2017) -- [Viktor Szakats brought this change] - - config-win32: define SIZEOF_LONG - - Recent changes that replaced CURL_SIZEOF_LONG in the source with - SIZEOF_LONG broke builds that use the premade configuration files and - don't have SIZEOF_LONG defined. - - Closes https://github.com/curl/curl/pull/1814 - -Daniel Stenberg (20 Aug 2017) -- cmake: enable picky compiler options with clang and gcc - - closes #1799 - -- curl/system.h: fix build for hppa - - Reported-by: John David Anglin - Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872502#10 - -- [Even Rouault brought this change] - - tftp: fix memory leak on too long filename - - Fixes - - $ valgrind --leak-check=full ~/install-curl-git/bin/curl tftp://localhost/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz - - ==9752== Memcheck, a memory error detector - ==9752== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. - ==9752== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info - ==9752== Command: /home/even/install-curl-git/bin/curl tftp://localhost/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz - ==9752== - curl: (71) TFTP file name too long - - ==9752== - ==9752== HEAP SUMMARY: - ==9752== 505 bytes in 1 blocks are definitely lost in loss record 11 of 11 - ==9752== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) - ==9752== by 0x4E61CED: Curl_urldecode (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x4E75868: tftp_state_machine (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x4E761B6: tftp_do (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x4E711B6: multi_runsingle (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x4E71D00: curl_multi_perform (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x4E6950D: curl_easy_perform (in /home/even/install-curl-git/lib/libcurl.so.4.4.0) - ==9752== by 0x40E0B7: operate_do (in /home/even/install-curl-git/bin/curl) - ==9752== by 0x40E849: operate (in /home/even/install-curl-git/bin/curl) - ==9752== by 0x402693: main (in /home/even/install-curl-git/bin/curl) - - Fixes https://oss-fuzz.com/v2/testcase-detail/5232311106797568 - Credit to OSS Fuzz - - Closes #1808 - -Dan Fandrich (19 Aug 2017) -- runtests: fixed case insensitive matching of keywords - - Commit 5c2aac71 didn't work in the case of mixed-case keywords given on - the command-line. - -- tests: Make sure libtests call curl_global_cleanup() - - This ensures that global data allocations are freed so Valgrind stays - happy. This was a problem with at least PolarSSL and mbedTLS. - -Daniel Stenberg (18 Aug 2017) -- RELEASE-NOTES: synced with 8baead425 - -- scripts/contri*sh: use "git log --use-mailmap" - -- mailmap: de-duplify some git authors - -- http2_recv: return error better on fatal h2 errors - - Ref #1012 - Figured-out-by: Tatsuhiro Tsujikawa - -- KNOWN_BUGS: HTTP test server 'connection-monitor' problems - - Closes #868 - -- curl/system.h: check for __ppc__ as well - - ... regression since issue #1774 (commit 10b3df10596a) since obviously - some older gcc doesn't know __powerpc__ while some newer doesn't know - __ppc__ ... - - Fixes #1797 - Closes #1798 - Reported-by: Ryan Schmidt - -- [Jan Alexander Steffens (heftig) brought this change] - - http: Don't wait on CONNECT when there is no proxy - - Since curl 7.55.0, NetworkManager almost always failed its connectivity - check by timeout. I bisected this to 5113ad04 (http-proxy: do the HTTP - CONNECT process entirely non-blocking). - - This patch replaces !Curl_connect_complete with Curl_connect_ongoing, - which returns false if the CONNECT state was left uninitialized and lets - the connection continue. - - Closes #1803 - Fixes #1804 - - Also-fixed-by: Gergely Nagy - -- [Johannes Schindelin brought this change] - - metalink: adjust source code style - - Signed-off-by: Johannes Schindelin - -- CURL_SIZEOF_LONG: removed, use only SIZEOF_LONG - -- lib557: no longer use CURL_SIZEOF_* defines - -- config-win32: define SIZEOF_CURL_OFF_T - -- cmake: sizeof curl_off_t, remove unused detections - -- system.h: remove all CURL_SIZEOF_* defines - - ... as they're not used externally and internally we check for the sizes - already in configure etc. - - Closes #1767 - -- ftp: fix CWD when doing multicwd then nocwd on same connection - - Fixes #1782 - Closes #1787 - Reported-by: Peter Lamare - -- CURLOPT_SSH_COMPRESSION.3: enable with 1L - - (leaves other values reserved for the future) - -- compressed-ssh.d: "Added: 7.56.0" - -- curl/system.h: checksrc compliance - -Jay Satiro (17 Aug 2017) -- [Viktor Szakats brought this change] - - ssh: add the ability to enable compression (for SCP/SFTP) - - The required low-level logic was already available as part of - `libssh2` (via `LIBSSH2_FLAG_COMPRESS` `libssh2_session_flag()`[1] - option.) - - This patch adds the new `libcurl` option `CURLOPT_SSH_COMPRESSION` - (boolean) and the new `curl` command-line option `--compressed-ssh` - to request this `libssh2` feature. To have compression enabled, it - is required that the SSH server supports a (zlib) compatible - compression method and that `libssh2` was built with `zlib` support - enabled. - - [1] https://www.libssh2.org/libssh2_session_flag.html - - Ref: https://github.com/curl/curl/issues/1732 - Closes https://github.com/curl/curl/pull/1735 - -- examples/ftpuploadresume: checksrc compliance - -- [Maksim Stsepanenka brought this change] - - http_proxy: fix build error for CURL_DOES_CONVERSIONS - - Closes https://github.com/curl/curl/pull/1793 - -GitHub (16 Aug 2017) -- [Nick Zitzmann brought this change] - - configure: check for __builtin_available() availability (#1788) - - This change does two things: - 1. It un-breaks the build in Xcode 9.0. (Xcode 9.0 is currently - failing trying to compile connectx() in lib/connect.c.) - 2. It finally weak-links the connectx() function, and falls back on - connect() when run on older operating systems. - -Daniel Stenberg (16 Aug 2017) -- travis: add metalink to some osx builds - - Closes #1790 - -- [Max Dymond brought this change] - - coverage: Use two coveralls commands to get lib/vtls results - - closes #1747 - -- darwinssi: fix error: variable length array used - -- m4/curl-compilers.m4: use proper quotes around string, not backticks - - ... when setting clang version to assume 3.7 - - Caused a lot of "integer expression expected" warnings by configure. - -- [Benbuck Nason brought this change] - - cmake: remove dead code for DISABLED_THREADSAFE - - Closes #1786 - -Jay Satiro (15 Aug 2017) -- [Jakub Zakrzewski brought this change] - - curl-confopts.m4: fix --disable-threaded-resolver - - Closes https://github.com/curl/curl/issues/1784 - -Daniel Stenberg (15 Aug 2017) -- [Ryan Winograd brought this change] - - progress: Track total times following redirects - - Update the progress timers `t_nslookup`, `t_connect`, `t_appconnect`, - `t_pretransfer`, and `t_starttransfer` to track the total times for - these activities when a redirect is followed. Previously, only the times - for the most recent request would be tracked. - - Related changes: - - - Rename `Curl_pgrsResetTimesSizes` to `Curl_pgrsResetTransferSizes` - now that the function only resets transfer sizes and no longer - modifies any of the progress timers. - - - Add a bool to the `Progress` struct that is used to prevent - double-counting `t_starttransfer` times. - - Added test case 1399. - - Fixes #522 and Known Bug 1.8 - Closes #1602 - Reported-by: joshhe on github - -- [Benbuck Nason brought this change] - - cmake: remove dead code for CURL_DISABLE_RTMP - - Closes #1785 - -Kamil Dudka (15 Aug 2017) -- zsh.pl: produce a working completion script again - - Commit curl-7_54_0-118-g8b2f22e changed the output format of curl --help - to use and instead of FILE and DIR, which caused zsh.pl to - produce a broken completion script: - - % curl -- - _curl:10: no such file or directory: seconds - - Closes #1779 - -Daniel Stenberg (15 Aug 2017) -- curlver: toward 7.56.0? - -- RELEASE-NOTES: synced with 91c46dc44 - -- test1449: FTP download range with an too large size - -- strtoofft: reduce integer overflow risks globally - - ... make sure we bail out on overflows. - - Reported-by: Brian Carpenter - Closes #1758 - -- travis: build the examples too - - to make sure they keep building warning-free - - Closes #1777 - -- runtests: match keywords case insensitively - -- examples/ftpuploadresume.c: use portable code - - ... converted from the MS specific _snscanf() - -Version 7.55.1 (13 Aug 2017) - -Daniel Stenberg (13 Aug 2017) -- RELEASE-NOTES/THANKS: curl 7.55.1 release time - -- gitignore: ignore .xz now instead of .lzma - -- [Sergei Nikulov brought this change] - - cmake: Threads detection update. ref: #1702 - - Closes #1719 - -- ipv6_scope: support unique local addresses - - Fixes #1764 - Closes #1773 - Reported-by: James Slaughter - -- [Alex Potapenko brought this change] - - curl/system.h: GCC doesn't define __ppc__ on PowerPC, uses __powerpc__ - - Closes #1774 - -- test1448: verify redirect to IDN using URL - - Closes #1772 - -- [Salah-Eddin Shaban brought this change] - - redirect: skip URL encoding for host names - - This fixes redirects to IDN URLs - - Fixes #1441 - Closes #1762 - Reported by: David Lord - -- test2032: mark as flaky (again) - -- travis: test cmake build on tarball too - - Could've prevented #1755 - -- [Simon Warta brought this change] - - cmake: allow user to override CMAKE_DEBUG_POSTFIX - - Closes #1763 - -- connect-to.d: better language - -- connect-to.d: clarified - -- bagder/Curl_tvdiff_us: fix the math - - Regression since adef394ac5 (released in 7.55.0) - - Reported-by: Han Qiao - Fixes #1769 - Closes #1771 - -- curl/system.h: add Oracle Solaris Studio - - Fixes #1752 - -- [Alessandro Ghedini brought this change] - - docs: fix typo funtion -> function - - Closes #1770 - -Alessandro Ghedini (12 Aug 2017) -- docs: fix grammar in CURL_SSLVERSION_MAX_DEFAULT description - -- docs: fix typo stuct -> struct - -Dan Fandrich (12 Aug 2017) -- test1447: require a curl with http support - -Daniel Stenberg (11 Aug 2017) -- [Thomas Petazzoni brought this change] - - curl/system.h: support more architectures - - The long list of architectures in include/curl/system.h is annoying to - maintain, and needs to be extended for each and every architecture to - support. - - Instead, let's rely on the __SIZEOF_LONG__ define of the gcc compiler - (we are in the GNUC condition anyway), which tells us if long is 4 - bytes or 8 bytes. - - This fixes the build of libcurl 7.55.0 on architectures such as - OpenRISC or ARC. - - Closes #1766 - - Signed-off-by: Thomas Petazzoni - -- test2033: this went flaky again - - Suspicion: when we enabled the threaded resolver by default. - -- test1447: verifies the parse proxy fix in 6e0e152ce5c - -- [Even Rouault brought this change] - - parse_proxy(): fix memory leak in case of invalid proxy server name - - Fixes the below leak: - - $ valgrind --leak-check=full ~/install-curl-git/bin/curl --proxy "http://a:b@/x" http://127.0.0.1 - curl: (5) Couldn't resolve proxy name - ==5048== - ==5048== HEAP SUMMARY: - ==5048== in use at exit: 532 bytes in 12 blocks - ==5048== total heap usage: 5,288 allocs, 5,276 frees, 445,271 bytes allocated - ==5048== - ==5048== 2 bytes in 1 blocks are definitely lost in loss record 1 of 12 - ==5048== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) - ==5048== by 0x4E6CB79: parse_login_details (url.c:5614) - ==5048== by 0x4E6BA82: parse_proxy (url.c:5091) - ==5048== by 0x4E6C46D: create_conn_helper_init_proxy (url.c:5346) - ==5048== by 0x4E6EA18: create_conn (url.c:6498) - ==5048== by 0x4E6F9B4: Curl_connect (url.c:6967) - ==5048== by 0x4E86D05: multi_runsingle (multi.c:1436) - ==5048== by 0x4E88432: curl_multi_perform (multi.c:2160) - ==5048== by 0x4E7C515: easy_transfer (easy.c:708) - ==5048== by 0x4E7C74A: easy_perform (easy.c:794) - ==5048== by 0x4E7C7B1: curl_easy_perform (easy.c:813) - ==5048== by 0x414025: operate_do (tool_operate.c:1563) - ==5048== - ==5048== 2 bytes in 1 blocks are definitely lost in loss record 2 of 12 - ==5048== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) - ==5048== by 0x4E6CBB6: parse_login_details (url.c:5621) - ==5048== by 0x4E6BA82: parse_proxy (url.c:5091) - ==5048== by 0x4E6C46D: create_conn_helper_init_proxy (url.c:5346) - ==5048== by 0x4E6EA18: create_conn (url.c:6498) - ==5048== by 0x4E6F9B4: Curl_connect (url.c:6967) - ==5048== by 0x4E86D05: multi_runsingle (multi.c:1436) - ==5048== by 0x4E88432: curl_multi_perform (multi.c:2160) - ==5048== by 0x4E7C515: easy_transfer (easy.c:708) - ==5048== by 0x4E7C74A: easy_perform (easy.c:794) - ==5048== by 0x4E7C7B1: curl_easy_perform (easy.c:813) - ==5048== by 0x414025: operate_do (tool_operate.c:1563) - - Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2984 - Credit to OSS Fuzz for discovery - - Closes #1761 - -- RELEASE-NOTES: synced with 37f2195a9 - -- curlver: bump to 7.55.1 - -- openssl: fix "error: this statement may fall through" - - A gcc7 warning. - -- [David Benjamin brought this change] - - openssl: remove CONST_ASN1_BIT_STRING. - - Just making the pointer as const works for the pre-1.1.0 path too. - - Closes #1759 - -- maketgz: remove old *.dist files before making the tarball - - To avoid "old crap" unintentionally getting shipped. - - Bug: https://curl.haxx.se/mail/lib-2017-08/0050.html - Reported-by: Christian Weisgerber - -Jay Satiro (10 Aug 2017) -- mkhelp.pl: allow executing this script directly - - - Enable execute permission (chmod +x) - - - Change interpreter to /usr/bin/env perl - - Ref: https://github.com/curl/curl/issues/1743 - -Daniel Stenberg (10 Aug 2017) -- configure: use the threaded resolver backend by default if possible - - Closes #1647 - -- cmake: move cmake_uninstall.cmake to CMake/ - - Closes #1756 - -- metalink: fix error: ‘*’ in boolean context, suggest ‘&&’ instead - -- dist: fix the cmake build by shipping cmake_uninstall.cmake.in too - - Fixes #1755 - -- travis: verify "make install" - - Help-by: Jay Satiro - Closes #1753 - -Marcel Raad (10 Aug 2017) -- build: check out *.sln files with Windows line endings - - Visual Studio doesn't like LF line endings in solution files and always - converts them to CRLF when doing changes to the solution. Notably, this - affects the solutions in the release archive. - - Closes https://github.com/curl/curl/pull/1746 - -- gitignore: ignore top-level .vs folder - - This folder is generated when using the CMake build system from within - Visual Studio. - - Closes https://github.com/curl/curl/pull/1746 - -Jay Satiro (10 Aug 2017) -- digest_sspi: Don't reuse context if the user/passwd has changed - - Bug: https://github.com/curl/curl/issues/1685 - Reported-by: paulharris@users.noreply.github.com - - Assisted-by: Isaac Boukris - - Closes https://github.com/curl/curl/pull/1742 - -Daniel Stenberg (9 Aug 2017) -- [Adam Sampson brought this change] - - dist: Add dictserver.py/negtelnetserver.py to EXTRA_DIST - - These weren't included in the 7.55.0 release, but are required in order - to run the full test suite. - - Closes #1744 - -- [Adam Sampson brought this change] - - curl: do bounds check using a double comparison - - The fix for this in 8661a0aacc01492e0436275ff36a21734f2541bb wasn't - complete: if the parsed number in num is larger than will fit in a long, - the conversion is undefined behaviour (causing test1427 to fail for me - on IA32 with GCC 7.1, although it passes on AMD64 and ARMv7). Getting - rid of the cast means the comparison will be done using doubles. - - It might make more sense for the max argument to also be a double... - - Fixes #1750 - Closes #1749 - -- make install: add 8 missing man pages to the installation - -- build: fix 'make install' with configure, install docs/libcurl/* too - - Broken since d24838d4da9faa - - Reported-by: Bernard Spil - -Version 7.55.0 (9 Aug 2017) - -Daniel Stenberg (9 Aug 2017) -- RELEASE-NOTES: curl 7.55.0 - -- THANKS: 20 new contributors in 7.55.0 - -- [Viktor Szakats brought this change] - - docs/comments: Update to secure URL versions - - Closes #1741 - -- configure: fix recv/send/select detection on Android - - ... since they now provide several functions as - __attribute__((overloadable)), the argument detection logic need - updates. - - Patched-by: destman at github - - Fixes #1738 - Closes #1739 - -Marcel Raad (8 Aug 2017) -- ax_code_coverage.m4: update to latest version - - This updates the script to aad5ad5fedb306b39f901a899b7bd305b66c418d - from August 01, 2017. Notably, this removes the lconv version whitelist. - - Closes https://github.com/curl/curl/pull/1716 - -Daniel Stenberg (7 Aug 2017) -- test1427: verify command line parser integer overflow detection - -- curl: detect and bail out early on parameter integer overflows - - Make the number parser aware of the maximum limit curl accepts for a - value and return an error immediately if larger, instead of running an - integer overflow later. - - Fixes #1730 - Closes #1736 - -- glob: do not continue parsing after a strtoul() overflow range - - Added test 1289 to verify. - - CVE-2017-1000101 - - Bug: https://curl.haxx.se/docs/adv_20170809A.html - Reported-by: Brian Carpenter - -- tftp: reject file name lengths that don't fit - - ... and thereby avoid telling send() to send off more bytes than the - size of the buffer! - - CVE-2017-1000100 - - Bug: https://curl.haxx.se/docs/adv_20170809B.html - Reported-by: Even Rouault - - Credit to OSS-Fuzz for the discovery - -- [Even Rouault brought this change] - - file: output the correct buffer to the user - - Regression brought by 7c312f84ea930d8 (April 2017) - - CVE-2017-1000099 - - Bug: https://curl.haxx.se/docs/adv_20170809C.html - - Credit to OSS-Fuzz for the discovery - -- easy_events: make event data static - - First: this function is only used in debug-builds and not in - release/real builds. It is used to drive tests using the event-based - API. - - A pointer to the local struct is passed to CURLMOPT_TIMERDATA, but the - CURLMOPT_TIMERFUNCTION calback can in fact be called even after this - funtion returns, namely when curl_multi_remove_handle() is called. - - Reported-by: Brian Carpenter - -- getparameter: avoid returning uninitialized 'usedarg' - - Fixes #1728 - -Marcel Raad (5 Aug 2017) -- [Isaac Boukris brought this change] - - gssapi: fix memory leak of output token in multi round context - - When multiple rounds are needed to establish a security context - (usually ntlm), we overwrite old token with a new one without free. - Found by proposed gss tests using stub a gss implementation (by - valgrind error), though I have confirmed the leak with a real - gssapi implementation as well. - - Closes https://github.com/curl/curl/pull/1733 - -- darwinssl: fix compiler warning - - clang complains: - vtls/darwinssl.c:40:8: error: extra tokens at end of #endif directive - [-Werror,-Wextra-tokens] - - This breaks the darwinssl build on Travis. Fix it by making this token - a comment. - - Closes https://github.com/curl/curl/pull/1734 - -- CMake: fix CURL_WERROR for MSVC - - When using CURL_WERROR in MSVC builds, the debug flags were overridden - by the release flags and /WX got added twice in debug mode. - - Closes https://github.com/curl/curl/pull/1715 - -Daniel Stenberg (4 Aug 2017) -- RELEASE-NOTES: synced with 561e9217c - -- test1010: verify that #1718 is fixed - - ... by doing two transfers in nocwd mode and check that there's no - superfluous CWD command. - -- FTP: skip unnecessary CWD when in nocwd mode - - ... when reusing a connection. If it didn't do any CWD previously. - - Fixes #1718 - -Marcel Raad (4 Aug 2017) -- travis: explicitly specify dist - - This makes the builds more reproducible as travis is currently rolling - out trusty as default dist [1]. Specifically, this avoids coverage - check failures when trusty is used as seen in [2] until we figure out - what's wrong. - - [1] https://blog.travis-ci.com/2017-07-11-trusty-as-default-linux-is-coming - [2] https://github.com/curl/curl/pull/1692 - - Closes https://github.com/curl/curl/pull/1725 - -Daniel Stenberg (4 Aug 2017) -- travis: BUILD_TYPE => T - - (to make the full line appear nicer on travis web UI) - -- travis: add osx build with darwinssl - - Closes #1706 - -- darwin: silence compiler warnings - - With a clang pragma and three type fixes - - Fixes #1722 - -- BUILD.WINDOWS: mention buildconf.bat for builds off git - -- darwinssl: fix curlssl_sha256sum() compiler warnings on first argument - -- test130: verify comments in .netrc - -- [Gisle Vanem brought this change] - - netrc: skip lines starting with '#' - - Bug: https://curl.haxx.se/mail/lib-2017-08/0008.html - -Marcel Raad (3 Aug 2017) -- CMake: set MSVC warning level to 4 - - The MSVC warning level defaults to 3 in CMake. Change it to 4, which is - consistent with the Visual Studio and NMake builds. Disable level 4 - warning C4127 for the library and additionally C4306 for the test - servers to get a clean CURL_WERROR build as that warning is raised in - some macros in older Visual Studio versions. - - Ref: https://github.com/curl/curl/pull/1667#issuecomment-314082794 - Closes https://github.com/curl/curl/pull/1711 - -Daniel Stenberg (2 Aug 2017) -- CURLOPT_NETRC.3: fix typo in 7e48aa386156f9c2 - - Reported-by: Viktor Szakats - -- CURLOPT_NETRC.3: mention the file name on windows - - ... and CURLOPT_NETRC_FILE(3). - -- travis: build osx with libressl too - -- travis: build osx with openssl too - -- tests/server/util: fix curltime mistake from 4dee50b9c80f9 - -Marcel Raad (1 Aug 2017) -- curl_threads: fix MSVC compiler warning - - Use LongToHandle to convert from long to HANDLE in the Win32 - implementation. - This should fix the following warning when compiling with - MSVC 11 (2012) in 64-bit mode: - lib\curl_threads.c(113): warning C4306: - 'type cast' : conversion from 'long' to 'HANDLE' of greater size - - Closes https://github.com/curl/curl/pull/1717 - -Daniel Stenberg (1 Aug 2017) -- BUGS: improved phrasing about security bugs - - Reported-by: Max Dymond - -- BUGS: clarify how to report security related bugs - -- [Brad Spencer brought this change] - - multi: fix request timer management - - There are some bugs in how timers are managed for a single easy handle - that causes the wrong "next timeout" value to be reported to the - application when a new minimum needs to be recomputed and that new - minimum should be an existing timer that isn't currently set for the - easy handle. When the application drives a set of easy handles via the - `curl_multi_socket_action()` API (for example), it gets told to wait the - wrong amount of time before the next call, which causes requests to - linger for a long time (or, it is my guess, possibly forever). - - Bug: https://curl.haxx.se/mail/lib-2017-07/0033.html - -Jay Satiro (1 Aug 2017) -- curl_setup: Define CURL_NO_OLDIES for building libcurl - - .. to catch accidental use of deprecated error codes. - - Ref: https://github.com/curl/curl/issues/1688#issuecomment-316764237 - -Daniel Stenberg (1 Aug 2017) -- [Jeremy Tan brought this change] - - configure: fix the check for IdnToUnicode - - Fixes #1669 - Closes #1713 - -- http: fix response code parser to avoid integer overflow - - test 1429 and 1433 were updated to work with the stricter HTTP status line - parser. - - Closes #1714 - Reported-by: Brian Carpenter - -Jay Satiro (31 Jul 2017) -- [Dwarakanath Yadavalli brought this change] - - libcurl: Stop using error codes defined under CURL_NO_OLDIES - - Fixes https://github.com/curl/curl/issues/1688 - Closes https://github.com/curl/curl/pull/1712 - -- include.d: clarify --include is only for response headers - - Follow-up to 171f8de and de6de94. - - Bug: https://github.com/curl/curl/commit/de6de94#commitcomment-23370851 - Reported-by: Daniel Stenberg - -Daniel Stenberg (30 Jul 2017) -- [jasjuang brought this change] - - cmake: support make uninstall - - Closes #1674 - -- RELEASE-NOTES: synced with 001701c47 - -Marcel Raad (29 Jul 2017) -- AppVeyor: now really use CURL_WERROR - - It was misspelled as CURL_ERROR in commit - 2d86e8d1286e0fbe3d811e2e87fa0b5e53722db4. - - Closes https://github.com/curl/curl/pull/1686 - -Jay Satiro (29 Jul 2017) -- tool_help: clarify --include is only for response headers - - Follow-up to 171f8de. - - Ref: https://github.com/curl/curl/issues/1704 - -- splay: fix signed/unsigned mismatch warning - - Follow-up to 4dee50b. - - Ref: https://github.com/curl/curl/pull/1693 - -Daniel Stenberg (28 Jul 2017) -- include.d: clarify that it concerns the response headers - - Reported-by: olesteban at github - Fixes #1704 - -- [Johannes Schindelin brought this change] - - curl_rtmp: fix a compiler warning - - The headers of librtmp declare the socket as `int`, and on Windows, that - disagrees with curl_socket_t. - - Bug: #1652 - - Signed-off-by: Johannes Schindelin - -- test1323: verify curlx_tvdiff - -- timeval: struct curltime is a struct timeval replacement - - ... to make all libcurl internals able to use the same data types for - the struct members. The timeval struct differs subtly on several - platforms so it makes it cumbersome to use everywhere. - - Ref: #1652 - Closes #1693 - -- darwinssl: fix variable type mistake (regression) - - ... which made --tlsv1.2 not work because it would blank the max tls - version variable. - - Reported-by: Nick Miyake - Bug: #1703 - -- multi: mention integer overflow risk if using > 500 million sockets - - Reported-by: ovidiu-benea@users.noreply.github.com - - Closes #1675 - Closes #1683 - -- checksrc: escape open brace in regex - - ... to silence warning. - -Kamil Dudka (20 Jul 2017) -- nss: fix a possible use-after-free in SelectClientCert() - - ... causing a SIGSEGV in showit() in case the handle used to initiate - the connection has already been freed. - - This commit fixes a bug introduced in curl-7_19_5-204-g5f0cae803. - - Reported-by: Rob Sanders - Bug: https://bugzilla.redhat.com/1436158 - -- nss: unify the coding style of nss_send() and nss_recv() - - No changes in behavior intended by this commit. - -Marcel Raad (18 Jul 2017) -- tests/server/resolve.c: fix deprecation warning - - MSVC warns that gethostbyname is deprecated. Always use getaddrinfo - instead to fix this when IPv6 is enabled, also for IPv4 resolves. This - is also consistent with what libcurl does. - - Closes https://github.com/curl/curl/pull/1682 - -Jay Satiro (17 Jul 2017) -- darwinssl: fix pinnedpubkey build error - - - s/SessionHandle/Curl_easy/ - - Bug: https://github.com/curl/curl/commit/eb16305#commitcomment-23035670 - Reported-by: Gisle Vanem - -Marcel Raad (16 Jul 2017) -- rtspd: fix GCC warning after MSVC warning fix - - Older GCC warns: - /tests/server/rtspd.c:1194:10: warning: missing braces around - initializer [-Wmissing-braces] - - Fix this by using memset instead of an initializer. - -- libtest: fix MSVC warning C4706 - - With warning level 4, MSVC warns about assignments within conditional - expressions. Change the while loop to a do-while loop to fix this. This - change is also consistent with CODE_STYLE.md. - -- sockfilt: suppress conversion warning with explicit cast - - MSVC warns when implicitly casting -1 to unsigned long. - -- rtspd: fix MSVC level 4 warning - - warning C4701: potentially uninitialized local variable 'req' used - -- winbuild: re-enable warning C4127 for curl tool - - Disabled in cda19a345f6970e22fe8b7a808aeb8f086a21eac. It only needs to - be disabled for libcurl. - -- winbuild: build with warning level 4 - - This is consistent with 7bc64561a2e63ca93e4b0b31d350773ba80955c2, which - changed the warning level from 3 to 4 for the Visual Studio project - files. But disable the level 4 warning C4127 "conditional expression is - constant", as that one is issued by older versions of the Windows SDK - as well as curl itself under some circumstances. - - Closes https://github.com/curl/curl/pull/1667 - -Jay Satiro (12 Jul 2017) -- [Max Dymond brought this change] - - travis: install libidn2 - - Install libidn2 to increase test coverage (IDN tests) - - Closes https://github.com/curl/curl/pull/1673 - -Marcel Raad (12 Jul 2017) -- travis: enable warnings also in release mode - - ... to get warnings also on Linux/GCC and OSX/clang. - - Closes https://github.com/curl/curl/pull/1666 - -Daniel Stenberg (12 Jul 2017) -- [Max Dymond brought this change] - - travis: install libssh2 - - Install libssh2 to increase test coverage (SFTP, SCP) - -Marcel Raad (12 Jul 2017) -- system.h: include winsock2.h before windows.h - - ... to avoid compiler warnings if the user doesn't want - WIN32_LEAN_AND_MEAN. - -- build: remove WIN32_LEAN_AND_MEAN from individual build systems - - It's defined for all build systems in curl_setup.h since commit - beb08481d01a07a8b10938b1078a5e298b1c2912. This caused macro - redefinition warnings in the configure builds. - - Closes https://github.com/curl/curl/pull/1677 - -Jay Satiro (11 Jul 2017) -- ISSUE_TEMPLATE: Add a comment not to file security issues on github - -Marcel Raad (11 Jul 2017) -- curl_setup: always define WIN32_LEAN_AND_MEAN on Windows - - Make sure to always define WIN32_LEAN_AND_MEAN before including any - Windows headers to avoid pulling in unnecessary headers. This avoids - unnecessary macro clashes and compiler warnings. - - Ref: https://github.com/curl/curl/issues/1562 - Closes https://github.com/curl/curl/pull/1672 - -Jay Satiro (11 Jul 2017) -- strerror: Preserve Windows error code in some functions - - This is a follow-up to af02162 which removed (SET_)ERRNO macros. That - commit was an earlier draft that I committed by mistake, which was then - remedied by a5834e5 and e909de6, and now this commit. With this commit - there is now no difference between the current code and the changes that - were approved in the final draft. - - Thanks-to: Max Dymond, Marcel Raad, Daniel Stenberg, Gisle Vanem - Ref: https://github.com/curl/curl/pull/1589 - -Marcel Raad (10 Jul 2017) -- [Max Dymond brought this change] - - tests: Fix up issues with errno in test files - - Closes https://github.com/curl/curl/pull/1671 - -Daniel Stenberg (10 Jul 2017) -- errno: fix non-windows builds after af0216251b94e7 - -- [Ryan Winograd brought this change] - - make: fix docs build on OpenBSD - - Ref: #1591 - -Marcel Raad (10 Jul 2017) -- ldap: fix MinGW compiler warning - - ldap_bind_s is marked as deprecated in w32api's winldap.h shipping with - the latest original MinGW, resulting in compiler warnings since commit - f0fe66f13c93d3d0af45d9fb1231c9164e0f9dc8. Fix this for the non-SSPI - case by using ldap_simple_bind_s again instead of ldap_bind_s with - LDAP_AUTH_SIMPLE. - - Closes https://github.com/curl/curl/pull/1664 - -- curl-compilers.m4: disable warning spam with Cygwin's clang - - When building with Cygwin or MinGW, libtool uses a wrapper executable - instead of a wrapper script [1], which is written in C and throws - missing-variable-declarations warnings. Don't enable these warnings on - Cygwin and MinGW in order to avoid warnings for every executable built, - which spams the test suite output when using Cygwin's clang. - - [1] https://www.gnu.org/software/libtool/manual/html_node/Wrapper-executables.html - - Closes https://github.com/curl/curl/pull/1665 - -Jay Satiro (10 Jul 2017) -- curl_setup_once: Remove ERRNO/SET_ERRNO macros - - Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError - for Win32 and regular errno otherwise. - - I reviewed the code and found no justifiable reason for conflating errno - on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno, - and any Win32 multithreaded CRT supports thread-local errno. - - Fixes https://github.com/curl/curl/issues/895 - Closes https://github.com/curl/curl/pull/1589 - -- tool_getparam: fix potentially uninitialized err - -Marcel Raad (9 Jul 2017) -- smb: rename variable to fix shadowing warning - - GCC 4.6.3 on travis complains: - smb.c: In function ‘get_posix_time’: - smb.c:725:13: error: declaration of ‘time’ shadows a global declaration - [-Werror=shadow] - - Fix this by renaming the variable. - -- tool_cb_wrt: fix variable shadowing warning - - GCC 4.4 complains: - tool_cb_wrt.c:81: error: declaration of ‘isatty’ shadows a global - declaration - /usr/include/unistd.h:782: error: shadowed declaration is here - - Fix this by renaming the variable. - - Closes https://github.com/curl/curl/pull/1661 - -Daniel Stenberg (8 Jul 2017) -- RELEASE-NOTES: synced with be2c999b8 - -- travis: install stunnel - -- valgrind.supp: supress OpenSSL false positive seen on travis - -- travis: detect and use valgrind for normal builds - - Closes #1653 - -- travis: add SMB, DICT, TELNET torture to coverage test - -- [Paul Harris brought this change] - - cmake: offer CMAKE_DEBUG_POSTFIX when building with MSVC - - Removes BUILD_RELEASE_DEBUG_DIRS since it wasn't used anywhere. - - Closes #1649 - -- CURLOPT_POSTFIELDS.3: explain the 100-continue magic better - -- [Max Dymond brought this change] - - test1452: add telnet negotiation - - Add a basic telnet server for negotiating some telnet options before - echoing back any data that's sent to it. - - Closes #1645 - -- travis: do more tests in the coverage run - - I added a selection of torture and event tests that run "fast enough" - -- curl_easy_escape.3: mention the (lack of) encoding - - Fixes #1612 - Reported-by: Jeroen Ooms - -- [Gisle Vanem brought this change] - - memdebug: don't setbuf() if the file open failed - - Bug: https://github.com/curl/curl/issues/828#issuecomment-313475151 - -- appveyor: enable CURL_WERROR on all builds - -- cmake: add CURL_WERROR for enabling "warning as errors" - -- [Hannes Magnusson brought this change] - - cmake: remove spurious "-l" from linker flags - - Fixes #1552 - -- test506: skip if threaded-resolver - -- runtests: support "threaded-resolver" as a feature - - ... to let tests require it or skip if present - -- asyn-thread.c: fix unused variable warnings on macOS - -- http: s/TINY_INITIAL_POST_SIZE/EXPECT_100_THRESHOLD - - Make the name reflect its use better, and add a short comment describing - what it's for. - -- cmake: if inet_pton is used, bump _WIN32_WINNT - - ... and make sure inet_pton is always checked for when *not* using Windows, - which is a regression from 4fc6ebe18. - - Idea-by: Sergei Nikulov - -- select.h: avoid macro redefinition harder - - ... by checking the POLLIN define, as the header file checks don't work - on Windows. - -- inet_pton: fix include on windows to get prototype - - inet_pton() exists on Windows and gets used by our cmake builds. Make - sure the correct header file is included to avoid compiler warnings. - - Closes #1639 - -- TODO: 1.10 auto-detect proxy - - Closes #1572 - -- TODO: HTTP proxy CONNECT is non-blocking now - -- cmake: fix send/recv argument scanner for windows - - ... by simply trying the Windows argument types first. - - Fixes #1640 - -- RELEASE-NOTES: synced with 596cfb6c0 - -- [Gisle Vanem brought this change] - - smb: add support for CURLOPT_FILETIME - - Bug: https://curl.haxx.se/mail/lib-2017-07/0005.html - - Closes #1643 - -- travis: install nghttp2 on linux builds - - Closes #1642 - -- [Gisle Vanem brought this change] - - smb: fix build for djgpp/MSDOS - - bug: https://curl.haxx.se/mail/lib-2017-07/0005.html - -- configure: try ldap/lber in reversed order first - - When scanning for which LDAP libraries to use, try the -lldap -llber - combination before the reversed order since it has a greater chance of - working when linking with libcurl statically. - - Fixes #1619 - Closes #1634 - Reported-by: David E. Narváez - -- configure: remove checks for 5 functions never used - - fork, getprotobyname, inet_addr, perror, uname - - closes #1638 - -- dist: add SMB python deps into the tarball - -- [Max Dymond brought this change] - - test1451: add SMB support to the testbed - - Add test 1451 which does some very basic SMB testing using the impacket - SMB server. - - Closes #1630 - -- [Max Dymond brought this change] - - test: add impacket for SMB testing - - Import impacket 0.9.15 for use in SMB testing. This was generated by - doing "pip2.7 install -t . impacket" - - Unnecessary files for current testing were deleted. - -- travis.yml: use --enable-werror on debug builds - - ... to better detect and fault on compiler warnings/errors - - Closes #1637 - -- tool_sleep: typecast to avoid macos compiler warning - - tool_sleep.c:54:24: error: implicit conversion loses integer precision: - 'long' to '__darwin_suseconds_t' (aka 'int') - [-Werror,-Wshorten-64-to-32] - -- [Martin Kepplinger brought this change] - - timeval.c: Use long long constant type for timeval assignment - - On a 64 bit host, sparse says: - - timeval.c:148:15: warning: constant 0x7fffffffffffffff is so big it is long - timeval.c:149:12: warning: constant 0x7fffffffffffffff is so big it is long - - so let's use long long constant types in order to prevent undesired overflow - failures. - - Bug: https://curl.haxx.se/mail/lib-2017-07/0003.html - - Closes #1636 - - Signed-off-by: Martin Kepplinger - -- url: make the original string get used on subsequent transfers - - ... since CURLOPT_URL should follow the same rules as other options: - they remain set until changed or cleared. - - Added test 1551 to verify. - - Fixes #1631 - Closes #1632 - Reported-by: Pavel Rochnyak - -- [Johannes Schindelin brought this change] - - gtls: fix build when sizeof(long) < sizeof(void *) - - - Change gnutls pointer/int macros to pointer/curl_socket_t. - Prior to this change they used long type as well. - - The size of the `long` data type can be shorter than that of pointer - types. This is the case most notably on Windows. - - If C99 were acceptable, we could simply use `intptr_t` here. But we - want to retain C89 compatibility. - - Simply use the trick of performing pointer arithmetic with the NULL - pointer: to convert an integer `i` to a pointer, simply take the - address of the `i`th element of a hypothetical character array - starting at address NULL. To convert back, simply cast the pointer - difference. - - Thanks to Jay Satiro for the initial modification to use curl_socket_t - instead of int/long. - - Closes #1617 - - Signed-off-by: Johannes Schindelin - -- [Ryan Winograd brought this change] - - unit1399: fix integer overflow - - Bug: #1616 - Closes #1633 - -- [Per Malmberg brought this change] - - cmake: Added compatibility options for older Windows versions - - CURL_STATIC_CRT and ENABLE_INET_PTON - - Closes #1621 - -- unit1399: add logging to time comparison - - ... to enable tracking down why autobuilds fail on this - - Bug: #1616 - -- make: build the docs subdir only from within src - - ... and don't build at all in include - - Prompted-by-work-by: Simon Warta - Ref: #1590 - Closes #1591 - -- [Max Dymond brought this change] - - test1450: fix up DICT server in torture mode - - As per https://github.com/curl/curl/pull/1615, the DICT server is a - little spammy in torture mode due to the sockets being torn down - unexpectedly. Fix this by adding some error handling to the handling - function. - - Closes #1629 - -- [Max Dymond brought this change] - - test1450: add simple testing for DICT - - Add a new server which provides a DICT interface. This is intended to - begin coverage testing for lib/dict.c - - Closes #1615 - -- [Dan Fandrich brought this change] - - test1521: fix out-of-tree builds, broken with 467da3af - - The test.h file is no longer in the same directory as the source file, - so that directory needs to be added to the include path. - - Fixes #1627 - Closes #1628 - -- [Max Dymond brought this change] - - http2: handle PING frames - - Add a connection check function to HTTP2 based off RTSP. This causes - PINGs to be handled the next time the connection is reused. - - Closes #1521 - -- [Max Dymond brought this change] - - handler: refactor connection checking - - Add a new type of callback to Curl_handler which performs checks on - the connection. Alter RTSP so that it uses this callback to do its - own check on connection health. - -- [dmitrykos brought this change] - - openssl: improve fallback seed of PRNG with a time based hash - - Fixes #1620 - -- [Ryan Winograd brought this change] - - progress: prevent resetting t_starttransfer - - Prevent `Curl_pgrsTime` from modifying `t_starttransfer` when invoked - with `TIMER_STARTTRANSFER` more than once during a single request. - - When a redirect occurs, this is considered a new request and - `t_starttransfer` can be updated to reflect the `t_starttransfer` time - of the redirect request. - - Closes #1616 - - Bug: https://github.com/curl/curl/pull/1602#issuecomment-310267370 - -- curl_strequal.3: fix typo in SYNOPSIS - - Reported-by: Jesse Chisholm - - Fixes #1623 - -- RELEASE-NOTES: synced with ce2c3ebda - -Kamil Dudka (28 Jun 2017) -- curl --socks5-{basic,gssapi}: control socks5 auth - - Closes https://github.com/curl/curl/pull/1454 - -- CURLOPT_SOCKS5_AUTH: allowed methods for SOCKS5 proxy auth - - If libcurl was built with GSS-API support, it unconditionally advertised - GSS-API authentication while connecting to a SOCKS5 proxy. This caused - problems in environments with improperly configured Kerberos: a stock - libcurl failed to connect, despite libcurl built without GSS-API - connected fine using username and password. - - This commit introduces the CURLOPT_SOCKS5_AUTH option to control the - allowed methods for SOCKS5 authentication at run time. - - Note that a new option was preferred over reusing CURLOPT_PROXYAUTH - for compatibility reasons because the set of authentication methods - allowed by default was different for HTTP and SOCKS5 proxies. - - Bug: https://curl.haxx.se/mail/lib-2017-01/0005.html - Closes https://github.com/curl/curl/pull/1454 - -- socks: deduplicate the code for auth request - -- socks: use proxy_user instead of proxy_name - - ... to make it obvious what the data is used for - -Daniel Stenberg (27 Jun 2017) -- libtest/make: generate lib1521.c - - ... instead of having the generated code checked in. This saves space in - the tarball but primarily automatically adapts to newly added options. - - Closes #1614 - -Jay Satiro (26 Jun 2017) -- tool_getparam: fix memory leak on test 1147 OOM (torture tests) - - Bug: https://github.com/curl/curl/pull/1486#issuecomment-310926872 - Reported-by: Dan Fandrich - -Dan Fandrich (25 Jun 2017) -- test1537: fixed memory leak on OOM - -Marcel Raad (25 Jun 2017) -- test1521: fix compiler warnings - - The integer literal 3123123123 doesn't fit into a 32-bit signed - integer, so GCC with 32-bit long warns in C90 mode: - this decimal constant is unsigned only in ISO C90 [enabled by default] - Fix this by using ULONG_MAX, which should fit in any curl_off_t and has - the correct suffix to not issue any warnings. - Also adds the missing CURLOPT_REQUEST_TARGET from commit - 9b167fd090f596eac828817d48c247eeae53407f. - - Closes https://github.com/curl/curl/pull/1611 - -Daniel Stenberg (24 Jun 2017) -- curl/system.h: add check for XTENSA for 32bit gcc - - Reported-by: Neil Kolban - Fixes: 1598 - -- [Henrik S. Gaßmann brought this change] - - winbuild: fix boringssl build - - Compile with `WIN32_LEAN_AND_MEAN` which prevents `windows.h` from - including too much clutter including `wincrypt.h` which in turn contains - some preprocessor macros that clash with boringssl symbols. - - Detect boringssl by checking the existance of `is_boringssl.h` and set - the corresponding `HAVE_BORINGSSL` for compilation which is used in - `ldap.c` to undefine the evil macros. - - Closes #1610 - -- progress: progress.timespent needs to be us - - follow-up to 64ed44a815e4e to fix test 500 failures - -Marcel Raad (24 Jun 2017) -- curl-compilers.m4: fix unknown-warning-option on Apple clang - - Since 5598b0bd63f690c151074494ce47ef872f004ab4, clang -v is used to - detect the clang version. The version number was expected to come after - the word "version". For Apple clang, this doesn't work as it has its - own versioning scheme. - The version number is now first searched after the string - "based on LLVM". This works for Apple clang before version 7, and also - for e.g. Ubuntu's clang up to version 3.7. If it's not found and the - version string contains "Apple LLVM version", clang version 3.7 is - assumed, which is the version that comes with Xcode 7. Otherwise, the - version number is still expected after the word "version", which works - for very old Apple clang versions. - - Ref: https://trac.macports.org/wiki/XcodeVersionInfo - Fixes https://github.com/curl/curl/issues/1606 - Closes https://github.com/curl/curl/pull/1607 - -Daniel Stenberg (24 Jun 2017) -- progress: fix "time spent", broke in adef394ac - -- CURLINFO_REDIRECT_URL.3: mention the CURLOPT_MAXREDIRS case - - ... supported since 7.54.1 - -- maketgz: switch to -6e for xz - - To reduce the memory requirement for decompress, and still do almost as - good compression as with -9e. - - Pointed-out-by: Dan Fandrich - -- libtest/Makefile: remove unused lib1541 variables - -- CONTRIBUTE.md: mention the out-of-tree build test too - -- maketgz: switch to xz instead of lzma - - The compressed output size seems to be a tad bit smaller, but generally - xz seems more preferred these days and is used directly by for example - gentoo instead of bz2. - - "Users of LZMA Utils should move to XZ Utils" => - https://tukaani.org/lzma/ - - Closes #1604 - -- --request-target: instead of --strip-path-slash - - ... and CURLOPT_REQUEST_TARGET instead of CURLOPT_STRIP_PATH_SLASH. - - This option instead provides the full "alternative" target to use in the - request, instead of extracting the path from the URL. - - Test 1298 and 1299 updated accordingly. - - Idea-by: Evert Pot - Suggestion: https://daniel.haxx.se/blog/2017/06/19/options-with-curl/comment-page-1/#comment-18373 - - Closes #1593 - -Marcel Raad (21 Jun 2017) -- lib1521: fix missing-variable-declarations clang warnings - - Declare TU-local variables static. - -- travis: enable typecheck-gcc warnings - - - switch debug and release configurations so that we get an optimized - build with GCC 4.3+ as required by typecheck-gcc - - enable warnings-as-errors for release builds - (which have warnings disabled) - - Closes https://github.com/curl/curl/pull/1595 - -- typecheck-gcc: add support for CURLINFO_OFF_T - - typecheck-gcc expected curl_socket_t instead of curl_off_t arguments - for CURLINFO_OFF_T. Detected by test1521, unfortunately only when run - locally. - - Closes https://github.com/curl/curl/pull/1592 - -Daniel Stenberg (21 Jun 2017) -- [Simon Warta brought this change] - - ci: whitelist branches to avoid testing feature branches twice - -- [Gisle Vanem brought this change] - - lib: fix the djgpp build - - Bug: https://github.com/curl/curl/commit/73a2fcea0b4adea6ba342cd7ed1149782c214ae3#commitcomment-22655993 - -Marcel Raad (20 Jun 2017) -- if2ip: fix compiler warning in ISO C90 mode - - remote_scope_id is only used when both HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - and ENABLE_IPV6 are defined instead of only one of them. - -Daniel Stenberg (20 Jun 2017) -- travis: do the distcheck test build out-of-tree as well - -- http: add --strip-path-slash and CURLOPT_STRIP_PATH_SLASH - - ... to enable sending "OPTIONS *" which wasn't possible previously. - - This option currently only works for HTTP. - - Added test cases 1298 + 1299 to verify - - Fixes #1280 - Closes #1462 - -- test1521: test getinfo's OFF_T types too - - Closes #1588 - -- lib1521: add curl_easy_getinfo calls to the test set - - Also added return value checks to make sure no unexpected return codes - are used. - -- [Simon Warta brought this change] - - automake: use $(MKHELP) variable instead if constant mkhelp.pl - - this improves symmetry with the rule above - -- [Simon Warta brought this change] - - mkhelp.pl: fix script name in usage text - -- RELEASE-NOTES: synced with 3b80d3ca4 - -- getinfo: return sizes as curl_off_t - - This change introduces new alternatives for the existing six - curl_easy_getinfo() options that return sizes or speeds as doubles. The - new versions are named like the old ones but with an appended '_T': - - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T - CURLINFO_CONTENT_LENGTH_UPLOAD_T - CURLINFO_SIZE_DOWNLOAD_T - CURLINFO_SIZE_UPLOAD_T - CURLINFO_SPEED_DOWNLOAD_T - CURLINFO_SPEED_UPLOAD_T - - Closes #1511 - -- PIPELINING_SERVER_BL: cleanup the internal list use - - The list was freed incorrectly since the llist refactor of - cbae73e1dd959. Added test 1550 to verify that it works and avoid future - regressions. - - Reported-by: Pascal Terjan - - Fixes #1584 - Closes #1585 - -- http2: fix OOM crash - - torture mode with test 1021 found it - -- CURLOPT_PREQUOTE.3: spellfix man page reference - -Marcel Raad (18 Jun 2017) -- http_proxy: fix build with http and proxy - - After deff7de0eb0e22d2d142b96b9cc84cd8db5d2a48, the build without - CURL_DISABLE_PROXY and CURL_DISABLE_HTTP was failing because of missing - includes. - -- http_proxy: fix compiler warning - - With CURL_DISABLE_PROXY or CURL_DISABLE_HTTP, GCC complained about a - missing prototype for Curl_connect_free. - -Daniel Stenberg (18 Jun 2017) -- TODO: update the TOC too - -- TODO: implement support for CURLOPT_PREQUOTE with SFTP - - ... also updated the CURLOPT_PREQUOTE.3 man page to mention the correct - protocol support. - - Closes #1514 - -- tool_wrte_cb: remove check for config == NULL - - ... as it really cannot have reached this far with config being NULL, - thus this is unnecesary and misleading. - - Bug: https://news.ycombinator.com/item?id=14577585 and - https://daniel.haxx.se/blog/2017/06/17/curl-doesnt-spew-binary-anymore/comment-page-1/#comment-18356 - - Forwarded-to-us-by: Jakub Wilk - -- curl: prevent binary output spewed to terminal - - ... unless "--output -" is used. Binary detection is done by simply - checking for a binary zero in early data. - - Added test 1425 1426 to verify. - - Closes #1512 - -Marcel Raad (16 Jun 2017) -- Makefile.m32: enable -W for MinGW32 build - - The configure-based build also has this in addition to -Wall. - - Closes https://github.com/curl/curl/pull/1578 - -- curl-compilers.m4: enable comma clang warning - - It usually warns when using commas instead of semicolons or other - operators by accident. - - Closes https://github.com/curl/curl/pull/1578 - -- curl-compilers.m4: enable missing-variable-declarations clang warning - - It usually warns when forgetting to declare TU-local variables static. - - Closes https://github.com/curl/curl/pull/1578 - -- curl-compilers.m4: enable double-promotion warning - - Enable -Wdouble-promotion for both GCC and clang. It warns on implicit - promotion from float to double. - - Closes https://github.com/curl/curl/pull/1578 - -- curl-compilers.m4: enable vla warning for clang - - Previously, that warning was only implicitly active in C90 mode. - Enable it unconditionally as already done for GCC. - - Closes https://github.com/curl/curl/pull/1578 - -Daniel Stenberg (16 Jun 2017) -- http-proxy: fix chunked-encoded CONNECT responses - - Regression since 5113ad0424. - - ... and remove 'flaky' from test 1061 again - - Closes #1579 - -- http-proxy: deal with EAGAIN - - ... the previous code would reset the header length wrongly (since - 5113ad0424). This makes test 1060 reliable again. - - Also: make sws send even smaller chunks of data to increase the - likeliness of this happening. - -- libtest/libntlmconnect: fix compiler warnings from f94fcdb - -- [Jay Satiro brought this change] - - HTTPS-Proxy: don't offer h2 for https proxy connections - - Bug: https://github.com/curl/curl/issues/1254 - - Closes #1546 - -- tests: stabilize test 2032 and 2033 - - Both these tests run the same underlying test code: libntlmconnect.c - - this test code made some assumptions about socket ordering when it used - curl_easy_fdset() and when we changed timing or got accidental changes - in libcurl the tests would fail. - - The tests verify that the different transfers keep using the same - connections, which I now instead made sure by adding the number of bytes - each transfer gets and then verifies that they always get the same - amount as when these tests worked. - - Closes #1576 - -- test1148: verify the -# progressbar - - Closes #1569 - -- test1061: mark as flaky - - Fails intermittently on travis builds since a few days. Likely due to - 5113ad0424. - -Jay Satiro (16 Jun 2017) -- url: refactor the check for Windows drive letter in path - - - Move the logic to detect a Windows drive letter prefix - (eg c: in c:foo) into a function-like macro. - - Closes https://github.com/curl/curl/pull/1571 - -- mk-ca-bundle.pl: Check curl's exit code after certdata download - - - No longer allow partial downloads of certdata. - - Prior to this change partial downloads were (erroneously?) allowed since - only the server code was checked to be 200. - - Bug: https://github.com/curl/curl/pull/1577 - Reported-by: Matteo B. - -Daniel Stenberg (16 Jun 2017) -- dist: add the fuzz dir to the tarball - -- configure: disable nghttp2 too if HTTP has been disabled - -- http-proxy: fix build with --disable-proxy or --disable-http - - Reported-by: Dan Fandrich - -- fuzz/README: document how to build - - Fixes #1476 - -- [Frederik B brought this change] - - fuzz: corpora file structure, initial commit - -- [Frederik B brought this change] - - fuzz: bring oss-fuzz initial code converted to C89 - -- http-proxy: only attempt FTP over HTTP proxy - - ... all other non-HTTP protocol schemes are now defaulting to "tunnel - trough" mode if a HTTP proxy is specified. In reality there are no HTTP - proxies out there that allow those other schemes. - - Assisted-by: Ray Satiro, Michael Kaufmann - - Closes #1505 - -- TODO: the generated include file is gone - - ... since commit 73a2fcea0b - -- curl_setup.h: error out on CURL_WANTS_CA_BUNDLE_ENV use - - ... to make it really apparent if there's any user using this on purpose. - - Suggested-by: Jay Satiro - - Closes #1542 - -- lib/curl_setup.h: remove CURL_WANTS_CA_BUNDLE_ENV - - When this define was set, libcurl would check the environment variable - named CURL_CA_BUNDLE at run-time and use that CA cert bundle. This - feature was only defined by the watcom and m32 makefiles and caused - inconsistent behaviours among libcurls built on different platforms. - - The curl tool does already feature its own similar logic and the library - does not really need it, and it isn't documented libcurl behavior. So - this change removes it. - - Ref: #1538 - -- test1147: verify -H on a file - -- curl: allow --header and --proxy-header read from file - - So many headers can be provided as @filename. - - Suggested-by: Timothe Litt - - Closes #1486 - -- RELEASE-NOTES: synced with 2ad80eec5 - -- curl/curlver.h: start working on 7.55.0 - -- http-proxy: do the HTTP CONNECT process entirely non-blocking - - Mentioned as a problem since 2007 (8f87c15bdac63) and of course it - existed even before that. - - Closes #1547 - -- progress: let "current speed" be UL + DL speeds combined - - Bug #1556 - Reported-by: Paul Harris - Closes #1559 - -Marcel Raad (14 Jun 2017) -- system.h: fix MinGW build - - CURLSYS_PULL_WS2TCPIP_H got renamed to CURL_PULL_WS2TCPIP_H in commit - 73a2fcea0b4adea6ba342cd7ed1149782c214ae3. - -Daniel Stenberg (14 Jun 2017) -- timers: store internal time stamps as time_t instead of doubles - - This gives us accurate precision and it allows us to avoid storing "no - time" for systems with too low timer resolution as we then bump the time - up to 1 microsecond. Should fix test 573 on windows. - - Remove the now unused curlx_tvdiff_secs() function. - - Maintains the external getinfo() API with using doubles. - - Fixes #1531 - -- dist: make the hugehelp.c not get regenerated unnecessarily - - The maketgz script now makes sure the generated hugehelp.c file in the - tarball is newer than the generated curl.1 man page, so that it doesn't - have to get unnecessarily rebuilt first thing in a typical build. It - thus also removes the need for perl to build off a plain release - tarball. - - Fixes #1565 - -- includes: remove curl/curlbuild.h and curl/curlrules.h - - Rely entirely on curl/system.h now. - - Introduced in Aug 2008 with commit 14240e9e109f. Now gone. - - Fixes #1456 - -Version 7.54.1 (14 Jun 2017) - -Daniel Stenberg (14 Jun 2017) -- release: 7.54.1 - -Dan Fandrich (13 Jun 2017) -- mk-lib1521.pl: updated to match the test changes in 916ec30a - -Daniel Stenberg (13 Jun 2017) -- [Stuart Henderson brought this change] - - libressl: OCSP and intermediate certs workaround no longer needed - - lib/vtls/openssl.c has a workaround for a bug with OCSP responses signed - by intermediate certs, this was fixed in LibreSSL in - https://github.com/libressl-portable/openbsd/commit/912c64f68f7ac4f225b7d1fdc8fbd43168912ba0 - - Bug: https://curl.haxx.se/mail/lib-2017-06/0038.html - -- url: fix buffer overwrite with file protocol (CVE-2017-9502) - - Bug: https://github.com/curl/curl/issues/1540 - Advisory: https://curl.haxx.se/docs/adv_20170614.html - - Assisted-by: Ray Satiro - Reported-by: Marcel Raad - -- urlglob: fix division by zero - - The multiply() function that is used to avoid integer overflows, was - itself reason for a possible division by zero error when passed a - specially formatted glob. - - Reported-by: GwanYeong Kim - -- configure: update the copyright year in the output - -- [ygrek brought this change] - - BINDINGS: update SP-Forth and OCaml urls - -Michael Kaufmann (11 Jun 2017) -- FindWin32CACert: Use a temporary buffer on the stack - - Don't malloc() the temporary buffer, and use the correct type: - SearchPath() works with TCHAR, but SearchPathA() works with char. - Set the buffer size to MAX_PATH, because the terminating null byte - is already included in MAX_PATH. - - Reviewed-by: Daniel Stenberg - Reviewed-by: Marcel Raad - - Closes #1548 - -Dan Fandrich (11 Jun 2017) -- test1521: fixed OOM handling - -Daniel Stenberg (9 Jun 2017) -- RELEASE-PROCEDURE: updated future release dates - -- [Paul Harris brought this change] - - gitignore: ignore all vim swap files - - Closes #1561 - -- lib1521: fix compiler warnings on the use of bad 'long' values - - Reported-by: Marcel Raad - Bug: https://github.com/curl/curl/commit/cccac4fb2b20d6ed87da7978408c3ecacc464fe4#commitcomment-22453387 - -- setopt: check CURLOPT_ADDRESS_SCOPE option range - - ... and return error instead of triggering an assert() when being way - out of range. - -Jay Satiro (8 Jun 2017) -- [TheAssassin brought this change] - - cmake: Fix inconsistency regarding mbed TLS include directory - - Previously, one had to set MBEDTLS_INCLUDE_DIR to make CMake find the - headers, but the system complained that mbed TLS wasn't found due to - MBEDTLS_INCLUDE_DIRS (note the trailing s) was not set. This commit - attempts to fix that. - - Closes https://github.com/curl/curl/pull/1541 - -Daniel Stenberg (8 Jun 2017) -- [Ryuichi KAWAMATA brought this change] - - examples/multi-uv.c: fix deprecated symbol - - Closes #1557 - -- asyn-ares: s/Curl_expire_latest/Curl_expire - -- expire: remove Curl_expire_latest() - - With the introduction of expire IDs and the fact that existing timers - can be removed now and thus never expire, the concept with adding a - "latest" timer is not working anymore as it risks to not expire at all. - - So, to be certain the timers actually are in line and will expire, the - plain Curl_expire() needs to be used. The _latest() function was added - as a sort of shortcut in the past that's quite simply not necessary - anymore. - - Follow-up to 31b39c40cf90 - - Reported-by: Paul Harris - - Closes #1555 - -- [Chris Carlmar brought this change] - - configure: fix link with librtmp when specifying path - - Bug: https://curl.haxx.se/mail/lib-2017-06/0017.html - -- file: make speedcheck use current time for checks - - ... as it would previously just get the "now" timestamp before the - transfer starts and then not update it again. - - Closes #1550 - -- metalink: remove unused printf() argument - -- travis: let some builds *not* use --enable-debug - - typecheck-gcc and other things require optimized builds - - Closes #1544 - -- README.md: show the coverall coverage on github - -- lib1521: fix compiler warnings - -- test1521: make the code < 80 columns wide - -- test1121: use stricter types to work with typcheck-gcc - -- typecheck-gcc: allow CURLOPT_STDERR to be NULL too - -- test1521: test *all* curl_easy_setopt options - - mk-lib1521.pl generates a test program (lib1521.c) that calls - curl_easy_setopt() for every known option with a few typical values to - make sure they work (ignoring the return codes). - - Some small changes were necessary to avoid asserts and NULL accesses - when doing this. - - The perl script needs to be manually rerun when we add new options. - - Closes #1543 - -Dan Fandrich (5 Jun 2017) -- test1538: added "verbose logs" keyword - - These error messages are not displayed with --disable-verbose - -Daniel Stenberg (5 Jun 2017) -- test1262: verify ftp download with -z for "if older than this" - -Marcel Raad (5 Jun 2017) -- curl_ntlm_core: use Curl_raw_toupper instead of toupper - - This was the only remaining use of toupper in the entire source code. - - Suggested-by: Daniel Stenberg - -Daniel Stenberg (4 Jun 2017) -- RELEASE-NOTES: synced with 65ba92650 - -Marcel Raad (4 Jun 2017) -- curl_ntlm_core: pass unsigned char to toupper - - Otherwise, clang on Cygwin64 warns: - curl_ntlm_core.c:525:35: error: array subscript is of type 'char' - [-Werror,-Wchar-subscripts] - dest[2 * i] = (unsigned char)(toupper(src[i])); - ^~~~~~~~~~~~~~~ - /usr/include/ctype.h:152:25: note: expanded from macro 'toupper' - (void) __CTYPE_PTR[__x]; (toupper) (__x);}) - ^~~~ - -Jay Satiro (3 Jun 2017) -- [Mahmoud Samir Fayed brought this change] - - BINDINGS: add Ring binding - - Closes https://github.com/curl/curl/pull/1539 - -Daniel Stenberg (4 Jun 2017) -- CONTRIBUTE.md: mention tests done on pull requests - -- travis: add coverage, distcheck and cmake builds - - Closes #1534 - -Marcel Raad (3 Jun 2017) -- libtest: fix int-in-bool-context warnings - - GCC 7 complained: - ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context] - -- libtest: fix implicit-fallthrough warnings with GCC 7 - -- x509asn1: fix implicit-fallthrough warning with GCC 7 - -- curl_sasl: fix unused-variable warning - - This fixes the following warning with CURL_DISABLE_CRYPTO_AUTH, - as seen in the autobuilds: - - curl_sasl.c:417:9: warning: unused variable 'serverdata' - [-Wunused-variable] - -Daniel Stenberg (3 Jun 2017) -- updatemanpages.pl: error out on too old git version - -Marcel Raad (3 Jun 2017) -- cyassl: define build macros before including ssl.h - - cyassl/ssl.h needs the macros from cyassl/options.h, so define them - before including cyassl/ssl.h the first time, which happens in - urldata.h. - This broke the build on Ubuntu Xenial, which comes with WolfSSL 3.4.8 - and therefore redefines the symbols from cyassl/options.h instead of - including the header. - - Closes https://github.com/curl/curl/pull/1536 - -Daniel Stenberg (3 Jun 2017) -- tool_util: remove unused tvdiff_secs and remove tool_ prefix - - Closes #1532 - -- dedotdot: fixed output for ".." and "." only input - - Found when updating test 1395, which I did to increase test coverage of - this source file... - - Closes #1535 - -Marcel Raad (2 Jun 2017) -- mbedtls: make TU-local variable static - - mbedtls_x509_crt_profile_fr is only used locally. - This fixes a missing-variable-declarations warning with clang. - -- MD(4|5): silence cast-align clang warning - - Unaligned access is on purpose here and the warning is harmless on - affected architectures. GCC knows that, while clang warns on all - architectures. - -Daniel Stenberg (2 Jun 2017) -- test1538: fix typo - -- test1538: verify the libcurl strerror API calls - -- curl_endian: remove unused functions - - Closes #1529 - -- test1537: dedicated tests of the URL (un)escape API calls - - Closes #1530 - -- coverage: run event tests too - - ... the torture ones are commented out only because they are slooooow. - -- build: provide easy code coverage measuring - - Closes #1528 - -- typecheck-gcc.h: check CURLINFO_CERTINFO - - ... and update the certinfo.c example accordingly. - - Fixes https://github.com/curl/curl/issues/846 - -- typecheck-gcc.h: check CURLINFO_TLS_SSL_PTR and CURLINFO_TLS_SESSION - - ... so that they get the required "struct curl_tlssessioninfo **" - arguments. - -- typecheck-gcc.h: separate getinfo slist checks from other pointers - - Fixes #1524 - -Marcel Raad (1 Jun 2017) -- curl-compilers.m4: escape square brackets in regex - - Otherwise, they are removed in the final configure file. - Also changed sed to "$SED" like in most other calls in this file. - -- curl-compilers.m4: fix compiler_num for clang - - "clang -dumpversion" always returns "4.2.1", the GCC version that clang - was initially compatible to. Use "clang -v" instead, which returns the - actual clang version. - - Fixes https://github.com/curl/curl/issues/1522 - Closes https://github.com/curl/curl/pull/1523 - -Daniel Stenberg (31 May 2017) -- examples/externalsocket.c: s/closesocket/closecb - - ... since closesocket is a function in WinSock. - - Reported-by: Marcel Raad - Bug: https://github.com/curl/curl/commit/55fcb8485914700132fd1854c9509b66c955efbe#co - mmitcomment-22347818 - -Marcel Raad (31 May 2017) -- lib583: fix compiler warning - - Use CURLMcode for variable 'res' and cast to int where necessary - instead of the other way around. Other tests do the same. - - This fixes the following clang warning: - lib583.c:68:15: warning: cast from function call of type 'CURLMcode' to - non-matching type 'int' [-Wbad-function-cast] - -Daniel Stenberg (31 May 2017) -- CURLOPT_SSH_KEY*.3: typos - - Reported-by: Gisle Vanem - -- CURLOPT_STREAM_DEPENDS.3: typo - -- CURLOPT_FNMATCH_FUNCTION.3: also modified example to avoid fcpp issues - -- CURLOPT_FNMATCH_DATA.3: modified example to avoid fcpp issues - -- opts: more than 100 more examples for man pages... - -- libtest/lib574.c: use correct callback proto - -- examples/sampleconv.c: indent changes, made callbacks static - -- example/externalsocket.c: make it use CLOSESOCKETFUNCTION too - -Marcel Raad (31 May 2017) -- curl-compilers.m4: enable -Wshift-sign-overflow for clang - - clang 2.9+ supports -Wshift-sign-overflow, which warns about undefined - behavior on signed left shifts when shifting by too many places. - - Ref: https://github.com/curl/curl/issues/1516 - Closes https://github.com/curl/curl/pull/1517 - -Daniel Stenberg (31 May 2017) -- CURLOPT_PROXY.3: fix test 1140 breakage - -Jay Satiro (31 May 2017) -- build-wolfssl: Sync config with wolfSSL 3.11 - - wolfSSL configure script relevant changes from 3.10 to 3.11: - - - Async threading support added; disabled by default without async - crypto, which continues to be disabled by default. - - wolfSSL configure script relevant changes from 3.11 to 3.11.1 (beta): - - - TLS 1.3 beta support added; disabled by default. - - For experimenting I put in a comment block the defines needed to enable - TLS 1.3 support (ie the equivalent of --enable-tls13). - -Daniel Stenberg (30 May 2017) -- opts: more examples added to man pages - -- docs: clarify NO_PROXY further - - Fixes #1208 - -- CURLOPT_PROXY.3: describe the environment variables more - -- transfer: init the infilesize from the postfields... - - ... with a strlen() if no size was set, and do this in the pretransfer - function so that the info is set early. Otherwise, the default strlen() - done on the POSTFIELDS data never sets state.infilesize. - - Reported-by: Vincas Razma - Bug: #1294 - -Jay Satiro (29 May 2017) -- test557: fix ubsan runtime error due to int left shift - - - Test curl_msnprintf negative int width arg using INT_MIN instead of - 1 << 31 which is undefined behavior. - - Closes https://github.com/curl/curl/issues/1516 - -- mbedtls: fix variable shadow warning - - vtls/mbedtls.c:804:69: warning: declaration of 'entropy' shadows a global declaration [-Wshadow] - CURLcode Curl_mbedtls_random(struct Curl_easy *data, unsigned char *entropy, - ^~~~~~~ - -Daniel Stenberg (29 May 2017) -- RELEASE-NOTES: synced with 3aaac8c2f - -Dan Fandrich (28 May 2017) -- tests: removed some redundant empty sections - -- runtests.pl: removed feature - - This hasn't been used in over a decade. can still be used to - run commands before the main test. - -Daniel Stenberg (27 May 2017) -- opts: more examples added in option man pages - -Dan Fandrich (27 May 2017) -- runtests.pl: removed unused arguments to valgrindparse - -Daniel Stenberg (25 May 2017) -- TODO: 6.4 is done, send telnet data in chunks - -- [Phil Crump brought this change] - - docs/CURLOPT_SSLVERSION.3: Correct define name in example - - Closes #1509 - -- ssh: fix 'left' may be used uninitialized - - follow-up to f31760e63b4e - - Reported-by: Michael Kaufmann - Bug: https://github.com/curl/curl/pull/1495#issuecomment-303982793 - -Michael Kaufmann (24 May 2017) -- time: fix type conversions and compiler warnings - - Fix bugs and compiler warnings on systems with 32-bit long and - 64-bit time_t. - - Reviewed-by: Daniel Stenberg - - Closes #1499 - -Marcel Raad (24 May 2017) -- examples: fix Wimplicit-fallthrough warnings - - This is contained in -Wextra with GCC 7. - -Daniel Stenberg (24 May 2017) -- [Anatol Belski brought this change] - - winbuild: fix the nghttp2 build - - Closes #1321 - -GitHub (24 May 2017) -- [Sergei Nikulov brought this change] - - LDAP: documentation update per #878 changes (#1506) - -Daniel Stenberg (23 May 2017) -- redirect: store the "would redirect to" URL when max redirs is reached - - Test 1261 added to verify. - - Reported-by: Lloyd Fournier - - Fixes #1489 - Closes #1497 - -GitHub (24 May 2017) -- [Sergei Nikulov brought this change] - - LDAP: fixed checksrc issue - -- [Sergei Nikulov brought this change] - - LDAP: using ldap_bind_s on Windows with methods (#878) - - * LDAP: using ldap_bind_s on Windows with methods(BASIC/DIGEST/NTLM/AUTONEG) - - * ldap: updated per build options handling - - * ldap: fixed logic for auth selection - -Daniel Stenberg (23 May 2017) -- [Akhil Kedia brought this change] - - cmake: fix build on Ubuntu 14.04 - - Fixed a syntax error with setting cache variables (The type and - docstring were missing), resulting in build errors. Quoted the - CURL_CA_PATH and CURL_CA_BUNDLE otherwise the path was written without - quotes in C code, resulting in build errors. - - Closes #1503 - - Signed-off-by: Akhil - -- url: fix declaration of 'pipe' shadows a global declaration - - follow-up to 4cdb1be8246c - -Kamil Dudka (22 May 2017) -- memdebug: fix compilation failure - - .... caused by a typo in the last commit (fixing issue #1504): - - memdebug.c: In function ‘curl_fclose’: - memdebug.c:444:3: error: implicit declaration of function - ‘DEBUGDEBUGASSERT’ [-Werror=implicit-function-declaration] - -Daniel Stenberg (22 May 2017) -- assert: avoid, use DEBUGASSERT instead! - - ... as it does extra checks to actually work. - - Reported-by: jonrumsey at github - Fixes #1504 - -- [Simon Warta brought this change] - - cmake: remove unused variables: GNUTLS_ENABLED, NSS_ENABLED - -- [Simon Warta brought this change] - - cmake: remove CURL_CA_BUNDLE from cmake TODO - -- [Simon Warta brought this change] - - cmake: auto detection of CURL_CA_BUNDLE/CURL_CA_PATH - - Closes #1461 - -- [Simon Warta brought this change] - - cmake: add CURL_CA_BUNDLE/CURL_CA_FALLBACK/CURL_CA_PATH options - -- [Simon Warta brought this change] - - cmake: Add CURL_CA_FALLBACK to curl_config.h.cmake - - This is for symmetry with the autoconf generated curl_config.h.in - -- RELEASE-NOTES: synced with 052a14e3c - -Michael Kaufmann (20 May 2017) -- tests: stabilize test 1034 - - Pass the invalid domain name on stdin. On some systems, the test - framework cannot pass invalid UTF-8 sequences on the command line. - - Closes #1488 - -Daniel Stenberg (20 May 2017) -- ssh: ignore timeouts during disconnect - - ... as otherwise it risks not cleaning up the libssh2 handle properly - which leads to memory leak! - - Assisted-by: Joel Depooter - - Closes #1495 - Closes #1479 - - Bug: https://curl.haxx.se/mail/lib-2017-04/0024.html - -- ghiper.c/hiperfifo.c: add comment about missing timer functionality - - It takes someone to read up on the APIs of these libraries to figure out - how to do this correctly. - - Reported-by: Michael Kaufmann - - Closes #1253 - -- asiohiper.cpp / evhiperfifo.c: deal with negative timerfunction input - - That means delete the timer. - - Reported-by: Michael Kaufmann - Ref: #1253 - -- cmdline-opts/write-out.d: s/-L/--location - - Since the man page generator wants the long option name version to - generate the proper output. - -- [Bernhard M. Wiedemann brought this change] - - mkhelp.pl: do not add current time into curl binary - - ... as part of hugehelpgz rodata to make build reproducible. - - See https://reproducible-builds.org/ for why this is good - - Closes #1490 - -- oauth2-bearer.d: mention the argument - -Nick Zitzmann (16 May 2017) -- darwinssl: Fix exception when processing a client-side certificate file - if no error was raised by the API but the SecIdentityRef was null - - Fixes #1450 - -Daniel Stenberg (16 May 2017) -- curl_sasl: fix build error with CURL_DISABLE_CRYPTO_AUTH + USE_NTLM - - Reported-by: wyattoday at github - Fixes #1487 - -- docs/cmdline-opts/config.d: edit for language - -- RELEASE-NOTES: synced with eb16305e6 - -- [moparisthebest brought this change] - - SecureTransport/DarwinSSL: Implement public key pinning - - Closes #1400 - -- man pages: fix example syntax errors - - follow-up to 5ddad099b42b50 - -- docs/libcurl/opts: added more examples in man pages - -- CURLOPT_HTTPPROXYTUNNEL: clarify, add example - -- curl: show the libcurl release date in --version output - - ... and support and additional "security patched" date for those who - enhance older versions that way. Pass on the define CURL_PATCHSTAMP with - a date for that. - - Building with non-release headers shows the date as [unreleased]. - - Also: this changes the date format generated in the curlver.h file to be - "YYYY-MM-DD" (no name of the day or month, no time, no time zone) to - make it easier on the eye and easier to parse. Example (new) date - string: 2017-05-09 - - Suggested-by: Brian Childs - - Closes #1474 - -Dan Fandrich (13 May 2017) -- url.c: add a compile-time check that CURL_MAX_WRITE_SIZE is large enough - - Some code (e.g. Curl_fillreadbuffer) assumes that this buffer is not - exceedingly tiny and will break if it is. This same check is already - done at run time in the CURLOPT_BUFFERSIZE option. - -- lib510: don't write past the end of the buffer if it's too small - -- tests: added missing keywords "chunked Transfer-Encoding" - -Daniel Stenberg (13 May 2017) -- THANKS: add a few missing names - - ... I found them in the commit logs from the early years - -Dan Fandrich (13 May 2017) -- tests: made a couple of prechecks consistent with others - - Also removed a TODO suggesting caching the precheck results. Tests - showed this would save about 0.1 sec on the total test run time on a - relatively modern system, an unnoticeable gain at the cost of longer and - more complicated code. There would also be a danger that a cached test - result would be inappropriately returned, such as when other test - dependencies (like environment variables) are different or when the - precheck causes side effects (like filesystem changes). - -Daniel Stenberg (12 May 2017) -- FAQ: add 7.4 to toc - - ... and delete trailing whitespace - - Fixes #1484 - -- multi: remove leftover debug infof() calls from e9fd794a6 - -- pipeline: fix mistakenly trying to pipeline POSTs - - The function IsPipeliningPossible() would return TRUE if either - pipelining OR HTTP/2 were possible on a connection, which would lead to - it returning TRUE even for POSTs on HTTP/1 connections. - - It now returns a bitmask so that the caller can differentiate which kind - the connection allows. - - Fixes #1481 - Closes #1483 - Reported-by: stootill at github - -Jay Satiro (12 May 2017) -- [Ron Eldor brought this change] - - mbedtls: Support server renegotiation request - - Tested with servers: IIS 7.5; OpenSSL 1.0.2. - - Closes https://github.com/curl/curl/pull/1475 - -Marcel Raad (11 May 2017) -- cookie_interface: fix -Wcomma warning - - clang 5.0 complains: - possible misuse of comma operator here [-Wcomma] - -- formdata: fix -Wcomma warning - - clang 5.0 complains: - possible misuse of comma operator here [-Wcomma] - - Change the comma to a semicolon to fix that. - -Daniel Stenberg (10 May 2017) -- multi: use a fixed array of timers instead of malloc - - ... since the total amount is low this is faster, easier and reduces - memory overhead. - - Also, Curl_expire_done() can now mark an expire timeout as done so that - it never times out. - - Closes #1472 - -- multi: assign IDs to all timers and make each timer singleton - - A) reduces the timeout lists drastically - - B) prevents a lot of superfluous loops for timers that expires "in vain" - when it has actually already been extended to fire later on - -- [Richard Hsu brought this change] - - tests: remove superfluous test 1399 - - @MarcelRaad noted that `test1399` causes infinite loop on MinGW. - Looking into this, seems like it is related to how Windows handles - CRLF. See https://github.com/curl/curl/commit/9e093f by @mback2k. - Removing `test1399` as it's identical to `test1326` then with such a - fix. - - Test 1399 was broughy by commit 862b02f8947039e - - Closes #1478 - -Dan Fandrich (9 May 2017) -- tests: make test file names more unique - - Include the test number in the names of files written out by tests to - reduce the chance of accidental duplication and to make it more clear - which test is associated with which file. - -- tests: removed redundant --trace-ascii arguments - - This is already added by the test suite; it's not clear why all these - tests had it, unless it's cargo-culting. - -Marcel Raad (9 May 2017) -- tool: fix remaining -Wcast-qual warnings - - Avoid casting away low-level const. - -Daniel Stenberg (9 May 2017) -- formboundary: convert assert into run-time check - - ... to really make sure the boundary fits in the target buffer. - - Fixes unused parameter 'buflen' warning. - - Reported-by: Michael Kaufmann - Bug: https://github.com/curl/curl/pull/1468#issuecomment-300078754 - -Dan Fandrich (9 May 2017) -- tests: list the primary server first in the server section - -Daniel Stenberg (8 May 2017) -- curl: generate the --help output - - ... using the docs/cmdline-opts/gen.pl script, so that we get all the - command line option documentation from the same source. - - The generation of the list has to be done manually and pasted into the - source code. - - Closes #1465 - -- tests: updated for modified fake random - -- [Jay Satiro brought this change] - - rand: treat fake entropy the same regardless of endianness - - When the random seed is purposely made predictable for testing purposes - by using the CURL_ENTROPY environment variable, process that data in an - endian agnostic way so the the initial random seed is the same - regardless of endianness. - - - Change Curl_rand to write to a char array instead of int array. - - - Add Curl_rand_hex to write random hex characters to a buffer. - - Fixes #1315 - Closes #1468 - - Co-authored-by: Daniel Stenberg - Reported-by: Michael Kaufmann - -Dan Fandrich (8 May 2017) -- tests: give each stunnel.conf file a unique name - - Otherwise, subsequent uses of stunnel overwrite the configuration file - of previous invocations so they can no longer be inspected. - -Marcel Raad (8 May 2017) -- tool_msgs: remove wrong cast - - Commit 481e0de00a9003b9c5220b120e3fc302d9b0932d changed the variable - type from int to size_t, so don't cast the result of strlen to int - anymore. - -- tftpd: fix signed/unsigned mismatch warnings - - alarm's argument is unsigned. - -- libtest: fix MinGW-w64 warnings - - long is 32 bits while size_t is 64 bits on MinGW-w64, so - typecheck-gcc.h complains when using size_t for a long option. - Also, curl_socket_t is unsigned long long rather than int. - -Daniel Stenberg (8 May 2017) -- curl.1: depend the build on the Makefile.inc too - - ... to also make it update when we remove files, like we did for - --environment in commit a8e388dd1095. - -- RELEASE-NOTES: synced with e3f84efc32d6b01a - -- runtests: fix "use of undefined value" warning in -R handling - -Marcel Raad (8 May 2017) -- test537: use correct variable type - - Avoids narrowing conversion warnings because rlim_t is usually - unsigned long. - - Closes https://github.com/curl/curl/pull/1469 - -- sendrecv: fix MinGW-w64 warning - - The first argument to select is an int, while curl_socket_t is - unsigned long long when using WinSock. It's ignored anyway [1]. - - [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms740141.aspx - -- tool_parsecfg: fix -Wcast-qual warning - - Don't convert string literal to char * before assigning it to - const char *. - -- asyn-thread: fix unused macro warnings - - Don't do anything in this file if CURLRES_THREADED is not defined. - -- tftp: silence bad-function-cast warning - - The cases this warns about are handled elsewhere, so just use an - intermediate variable to silence the warning. - -Daniel Stenberg (7 May 2017) -- [canavan at github brought this change] - - buildconf: fix hang on IRIX - - Apparently, /usr/bin/m4 ignores the --version parameter and waits for - input from stdin. - - Fixes #1471 - -- opts: fix bad example formatting \n => \\n - - ...to render properly nroff. - -- opts: examples added to 8 more libcurl option man pages - -- curl: remove tool_writeenv.[ch] - - ... and USE_ENVIRONMENT and --environment. It was once added for RISC OS - support and its platform specific behavior has been annoying ever - since. Added in commit c3c8bbd3b2688da8e, mostly unchanged since - then. Most probably not actually used for years. - - Closes #1463 - -Dan Fandrich (6 May 2017) -- runtests.pl: simplify the datacheck read section - - Also, document that numbered datacheck sections are possible. - -Marcel Raad (5 May 2017) -- tests: fix -Wcast-qual warnings - - Avoid casting string literals to non-const char *. - -Daniel Stenberg (5 May 2017) -- docs/opts: 24 more man pages now have examples - -- docs/opts: 23 more man pages now have examples - -- tests/server: run checksrc by default in debug-builds - -- curl_slist_append.3: clarify a NULL input creates a new list - -Marcel Raad (5 May 2017) -- unit1305: fix compiler warning - - calloc and ai_addrlen expect different (usually unsigned) types. - -Daniel Stenberg (5 May 2017) -- runtests: use -R for random order - - Suggested-by: Dan Fandrich - -- runtests: add -o to run test cases in scrambled order - - ... instead of numerical order. - - Closes #1466 - -Dan Fandrich (4 May 2017) -- sockfilt.c: shortened too long line - -Marcel Raad (4 May 2017) -- tests/server: make string literals const - - assign string literals to const char * instead of char * in order to - avoid a lot of these warnings: - cast from 'const char *' to 'char *' drops const qualifier - [-Wcast-qual] - -Dan Fandrich (4 May 2017) -- schannel: return a more specific error code for SEC_E_UNTRUSTED_ROOT - -- test557: set a known good numeric locale - - Windows does not allow setting the locale with environment variables (as - the test attempted to do), so the test failed when run with a user - locale that has a comma as radixchar. Changed the test to call - setlocale() explicitly to ensure that a known working locale is set even - on Windows. - -Daniel Stenberg (4 May 2017) -- curl: fix warning "comma at end of enumerator list" - -- test559: verify use of minimum CURLOPT_BUFFERSIZE - -Marcel Raad (4 May 2017) -- curl_setup_once: use SEND_QUAL_ARG2 for swrite - - SEND_QUAL_ARG2 had to be set, but was never used. Use it in swrite to - avoid warnings about casting away low-level const. - - Closes https://github.com/curl/curl/pull/1464 - -Daniel Stenberg (4 May 2017) -- CURLINFO_REDIRECT_URL.3: add example - -- CURLINFO_EFFECTIVE_URL.3: add example - -Marcel Raad (3 May 2017) -- lib: fix compiler warnings - - Fix the following warnings when building the tests by using the correct - types: - cast from 'const char *' to 'void *' drops const qualifier - [-Wcast-qual] - implicit conversion changes signedness [-Wsign-conversion] - -- typecheck-gcc: add support for CURLINFO_SOCKET - - Closes https://github.com/curl/curl/pull/1452 - -- typecheck-gcc: add missing string options - - Closes https://github.com/curl/curl/pull/1452 - -Daniel Stenberg (3 May 2017) -- abstract-unix-socket.d: shorten the help text to fit within 79 cols - -- RELEASE-NOTES: synced with 862b02f89 - -- [Richard Hsu brought this change] - - Telnet: Write full buffer instead of byte-by-byte - - Previous TODO wanting to write in chunks. We should support writing more - at once since some TELNET servers may respond immediately upon first - byte written such as WHOIS servers. - - Closes #1389 - -- curl: non-boolean command line args reject --no- prefixes - - ... and instead properly respond with an error message to the user - instead of silently ignoring. - - Fixes #1453 - Closes #1458 - -Marcel Raad (2 May 2017) -- testpart: remove _MPRINTF_REPLACE - - Support for _MPRINTF_REPLACE in mprintf.h was removed in - 55452ebdff47f98bf3cc383f1dfc3623fcaefefd, replaced with curl_printf.h. - -Dan Fandrich (2 May 2017) -- gtls: fixed a lingering BUFSIZE reference - -Daniel Stenberg (2 May 2017) -- ssh: fix compiler warning from e40e9d7f0de - -- url: let CURLOPT_BUFFERSIZE realloc to smaller sizes too - - Closes #1449 - -- BUFSIZE: rename to READBUFFER_*, make separate MASTERBUF_SIZE - -- openssl: use local stack for temp storage - -- sendf: remove use of BUFSIZE from debug data conversions - - The buffer can have other sizes. - -- buffer: use data->set.buffer_size instead of BUFSIZE - - ... to properly use the dynamically set buffer size! - -- krb5: use private buffer for temp string, not receive buffer - -- upload: UPLOAD_BUFSIZE is now for the upload buffer - -- unit1606: do not print/access buffer - - It was a wrong assumption that it could do that! - -- http-proxy: use a dedicated CONNECT response buffer - - To make it suitably independent of the receive buffer and its flexible - size. - -- transfer: fix minor buffer_size mistake - -- failf: use private buffer, don't clobber receive buffer - -- pingpong: use the set buffer size - -- http2: use the correct set buffer size - -- http: don't clobber the receive buffer for timecond - -- buffer_size: make sure it always has the correct size - - Removes the need for CURL_BUFSIZE - -- file: use private buffer for C-L output - - ... instead of clobbering the download buffer. - -- CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size - - The buffer is needed to receive FTP, HTTP CONNECT responses etc so - already at this size things risk breaking and smaller is certainly not - wise. - -- ftp: use private buffer for temp storage, not receive buffer - -- http: use private user:password output buffer - - Don't clobber the receive buffer. - -Marcel Raad (1 May 2017) -- anyauthput: remove unused code - - The definition of TRUE was introduced in - 4a728747e6f8845e500910e397dfc99aaf4a7984 and is not used anymore since - e664cd5826d43930fcc5b5dbaedbec94af33184b. - The usage of intptr_t was removed in - 32e38b8f42477cf5ce3c3fef2fcc9db82f7fb7be. - -Jay Satiro (1 May 2017) -- tool: Fix missing prototype warnings for CURL_DOES_CONVERSIONS - - - Include tool_convert.h where needed. - - Bug: https://github.com/curl/curl/issues/1460 - Reported-by: Gisle Vanem - -- curl_setup: Ensure no more than one IDN lib is enabled - - Prior to this change it was possible for libcurl to be built with both - Windows' native IDN lib (normaliz) and libidn2 enabled. It appears that - doesn't offer any benefit --and could cause a bug-- since libcurl's IDN - handling is written to use either one but not both. - - Bug: https://github.com/curl/curl/issues/1441#issuecomment-297689856 - Reported-by: Gisle Vanem - -Marcel Raad (1 May 2017) -- getpart: use correct variable type - - This fixes the following clang warning: - getpart.c:201:17: warning: cast from function call of type 'CURLcode' - to non-matching type 'int' [-Wbad-function-cast] - -- tests: declare TU-local variables static - - This fixes missing-variable-declarations warnings when building with - clang. - -- tool_cb_prg: fix double-promotion warning - - clang complains: - tool_cb_prg.c:86:22: error: implicit conversion increases - floating-point precision: 'float' to 'double' - [-Werror,-Wdouble-promotion] - - Fix this by using a double instead of a float constant. - -Dan Fandrich (1 May 2017) -- examples: fixed too long line and too long string warnings - -Marcel Raad (30 Apr 2017) -- examples: declare TU-local variables static - - This fixes missing-variable-declarations warnings when building with - clang. - -- http2: declare TU-local variables static - - This fixes the following clang warnings: - - http2.c:184:27: error: no previous extern declaration for non-static - variable 'Curl_handler_http2' [-Werror,-Wmissing-variable-declarations] - http2.c:204:27: error: no previous extern declaration for non-static - variable 'Curl_handler_http2_ssl' - [-Werror,-Wmissing-variable-declarations] - -Dan Fandrich (30 Apr 2017) -- unit1604: fixed indentation - -- unit1604: fixed compilation under Windows, broken in the previous commit - -- tests: fixed OOM handling of unit tests to abort test - - It's dangerous to continue to run the test when a memory alloc fails. - -Marcel Raad (29 Apr 2017) -- curl_rtmp: fix missing-variable-declarations warnings - - clang complains: - - curl_rtmp.c:61:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmp' [-Werror,-Wmissing-variable-declarations] - curl_rtmp.c:81:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmpt' [-Werror,-Wmissing-variable-declarations] - curl_rtmp.c:101:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmpe' [-Werror,-Wmissing-variable-declarations] - curl_rtmp.c:121:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmpte' [-Werror,-Wmissing-variable-declarations] - curl_rtmp.c:141:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmps' [-Werror,-Wmissing-variable-declarations] - curl_rtmp.c:161:27: error: no previous extern declaration for non-static variable 'Curl_handler_rtmpts' [-Werror,-Wmissing-variable-declarations] - - Fix this by including the header file. - -Dan Fandrich (29 Apr 2017) -- url: fixed a memory leak on OOM while setting CURLOPT_BUFFERSIZE - -- tests: added --remote-time tests for remaining protocols that support it - -- runtests.pl: support multiline commands - -- tool_operate: use utimes instead of obsolescent utime when available - -- test1443: test --remote-time - -- http-proxy: removed unused argument in CURL_DISABLE_PROXY case - - Missed in commit 55c3c02e - -Daniel Stenberg (27 Apr 2017) -- cookie_interface.c: changed the other domain to example.com too - -- cookie_interface.c: fix cookie domain so the example works - -Dan Fandrich (26 Apr 2017) -- Makefile: fix make dist - - Commit 80a87e8a broke 'make dist' as it can't handle installing from - absolute target names. Rearranged the dependencies so the absolute name - is used for building but the relative name is use for distributing. - -Marcel Raad (26 Apr 2017) -- lib: remove unused code - - This fixes the following clang warnings: - macro is not used [-Wunused-macros] - will never be executed [-Wunreachable-code] - - Closes https://github.com/curl/curl/pull/1448 - -Daniel Stenberg (26 Apr 2017) -- http-proxy: remove unused argument from Curl_proxyCONNECT() - -- [Martin Kepplinger brought this change] - - url: declare get_protocol_family() static - - get_protocol_family() is not defined static even though there is a - static local forward declaration. Let's simply make the definition match - it's declaration. - - Bug: https://curl.haxx.se/mail/lib-2017-04/0127.html - -- examples: ftpuploadfrommem.c - - Uploads data to an FTP site, directly from memory. - - Closes #1451 - -Kamil Dudka (25 Apr 2017) -- nss: load libnssckbi.so if no other trust is specified - - The module contains a more comprehensive set of trust information than - supported by nss-pem, because libnssckbi.so also includes information - about distrusted certificates. - - Reviewed-by: Kai Engert - Closes #1414 - -- nss: factorize out nss_{un,}load_module to separate fncs - - No change of behavior is intended by this commit. - -- nss: do not leak PKCS #11 slot while loading a key - - It could prevent nss-pem from being unloaded later on. - - Bug: https://bugzilla.redhat.com/1444860 - -Marcel Raad (25 Apr 2017) -- typecheck-gcc: fix _curl_is_slist_info - - Info values starting with CURLINFO_SOCKET expect a curl_socket_t, not a - curl_slist argument. - - This fixes the following GCC warning when building the examples with - --enable-optimize: - - ../../include/curl/typecheck-gcc.h:126:42: warning: call to - ‘_curl_easy_getinfo_err_curl_slist’ declared with attribute warning: - curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this - info [enabled by default] - sendrecv.c:90:11: note: in expansion of macro ‘curl_easy_getinfo’ - res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd); - - Closes https://github.com/curl/curl/pull/1447 - -Daniel Stenberg (25 Apr 2017) -- curl: set a 100K buffer size by default - - Test command 'time curl http://localhost/80GB -so /dev/null' on a Debian - Linux. - - Before (middle performing run out 9): - - real 0m28.078s - user 0m11.240s - sys 0m12.876s - - After (middle performing run out 9) - - real 0m26.356s (93.9%) - user 0m5.324s (47.4%) - sys 0m8.368s (65.0%) - - Also, doing SFTP over a 200 millsecond latency link is now about 6 times - faster. - - Closes #1446 - -- transfer: remove 'uploadbuf' pointer and cleanup readwrite_upload() - - The data->req.uploadbuf struct member served no good purpose, instead we - use ->state.uploadbuffer directly. It makes it clearer in the code which - buffer that's being used. - - Removed the 'SingleRequest *' argument from the readwrite_upload() proto - as it can be derived from the Curl_easy struct. Also made the code in - the readwrite_upload() function use the 'k->' shortcut to all references - to struct fields in 'data->req', which previously was made with a mix of - both. - -Jay Satiro (25 Apr 2017) -- configure: stop prepending to LDFLAGS, CPPFLAGS - - - Change prepends to appends because user's LDFLAGS and CPPFLAGS should - always come first so they're searched before ours. - - Bug: https://github.com/curl/curl/issues/1420 - Reported-by: Helmut K. C. Tessarek - -Marcel Raad (25 Apr 2017) -- if2ip: fix -Wcast-align warning - - Follow-up to 119037325de02579f5c58256ca2ed2a0aa592c86, which fixed the - warning in the HAVE_GETIFADDRS block, but not in the - HAVE_IOCTL_SIOCGIFADDR block. - -Dan Fandrich (24 Apr 2017) -- Makefile: avoid use of GNU-specific form of $< - - $< is only allowed in implicit rules in some non-GNU makes (e.g. BSD, - AIX) so avoid use elsewhere by referencing the dependent curl.1 file - directly instead. This is somewhat tricky because the file is supplied - in the packaged tar ball (but not in git) but must still be able to be - rebuilt when its dependencies change. The right thing must happen in - both tar ball and git source trees, as well as in both in-tree and - out-of-tree builds. - -Kamil Dudka (24 Apr 2017) -- nss: adapt to the new Curl_llist API - - This commit fixes compilation failure caused by - cbae73e1dd95946597ea74ccb580c30f78e3fa73. - -Marcel Raad (24 Apr 2017) -- curl-compilers.m4: accept -Og and -Ofast GCC flags - - -Og, introduced in GCC 4.8, optimizes for debugging experience. - -Ofast, introduced in GCC 4.7, builds on -O3 and enables further - optimizations breaking strict standards compliance. - When specified in CFLAGS, these were always overridden by -O0 or -O2. - Fix this by adding them to flags_opt_all. - - Ref: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html - Ref: https://github.com/curl/curl/pull/1404#issuecomment-296401570 - Closes https://github.com/curl/curl/pull/1440 - -Daniel Stenberg (24 Apr 2017) -- RELEASE-NOTES: synced with c68fed875 - -- configure: fix the -ldl check for openssl, add -lpthread check - - The check for if -ldl is needed to build with (a statically built) - openssl was broken. This repairs the check, and adds a check for - -lpthread as well since OpenSSL 1.1.0+ does in fact require -lpthread so - only adding -ldl for a static openssl build is no longer enough. - - Reported-by: Jay Satiro - Ref: #1426 - Closes #1427 - -- llist: fix a comment after cbae73e1dd9 - - Pointed-it-by: Kevin Ji - URL: https://github.com/curl/curl/commit/cbae73e1dd95946597ea74ccb580c30f78e3fa73#commitcomment-21872622 - -Jay Satiro (22 Apr 2017) -- schannel: Don't treat encrypted partial record as pending data - - - Track when the cached encrypted data contains only a partial record - that can't be decrypted without more data (SEC_E_INCOMPLETE_MESSAGE). - - - Change Curl_schannel_data_pending to return false in such a case. - - Other SSL libraries have pending data functions that behave similarly. - - Ref: https://github.com/curl/curl/pull/1387 - - Closes https://github.com/curl/curl/pull/1392 - -Daniel Stenberg (22 Apr 2017) -- [Alan Jenkins brought this change] - - multi: clarify condition in curl_multi_wait - - `if(nfds || extra_nfds) {` is followed by `malloc(nfds * ...)`. - - If `extra_fs` could be non-zero when `nfds` was zero, then we have - `malloc(0)` which is allowed to return `NULL`. But, malloc returning - NULL can be confusing. In this code, the next line would treat the NULL - as an allocation failure. - - It turns out, if `nfds` is zero then `extra_nfds` must also be zero. - The final value of `nfds` includes `extra_nfds`. So the test for - `extra_nfds` is redundant. It can only confuse the reader. - - Closes #1439 - -Marcel Raad (22 Apr 2017) -- lib: fix maybe-uninitialized warnings - - With -Og, GCC complains: - - easy.c:628:7: error: ‘mcode’ may be used uninitialized in this function [-Werror=maybe-uninitialized] - - ../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] - vauth/digest.c:208:9: note: ‘tok_buf’ was declared here - - ../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] - vauth/digest.c:566:15: note: ‘tok_buf’ was declared here - - Fix this by initializing the variables. - -Dan Fandrich (22 Apr 2017) -- gnutls: removed some code when --disable-verbose is configured - - This reduces the binary size and fixes a compile warning. - -Daniel Stenberg (22 Apr 2017) -- llist: no longer uses malloc - - The 'list element' struct now has to be within the data that is being - added to the list. Removes 16.6% (tiny) mallocs from a simple HTTP - transfer. (96 => 80) - - Also removed return codes since the llist functions can't fail now. - - Test 1300 updated accordingly. - - Closes #1435 - -Marcel Raad (21 Apr 2017) -- typecheck-gcc: handle function pointers properly - - All the callbacks passed to curl_easy_setopt are defined as function - pointers. The possibility to pass both functions and function pointers - was handled for the callbacks that typecheck-gcc.h defined as - compatible, but not for the public callback types themselves. - - This makes all compatible callback types defined in typecheck-gcc.h - function pointers too and checks all functions uniformly with - _curl_callback_compatible, which handles both functions and function - pointers. - - A symptom of the problem was a warning in tool_operate.c with - --disable-libcurl-option and without --enable-debug as that file - passes the callback functions to curl_easy_setopt directly. - - Fixes https://github.com/curl/curl/issues/1403 - Closes https://github.com/curl/curl/pull/1404 - -Dan Fandrich (21 Apr 2017) -- mbedtls: enable NTLM (& SMB) even if MD4 support is unavailable - - In that case, use libcurl's internal MD4 routine. This fixes tests 1013 - and 1014 which were failing due to configure assuming NTLM and SMB were - always available whenever mbed TLS was in use (which is now true). - -Daniel Stenberg (21 Apr 2017) -- tests: remove the html and PDF versions from the tarball - -- openssl: fix memory leak in servercert - - ... when failing to get the server certificate. - -- Revert "src/Makefile.am: avoid explicit $<" - - This reverts commit 5b4cbcf11d5100ff793a8e9edbaa6fe1fc7495f5. - - Since it broke out-of-tree builds from tarballs. See discussion in #1432 - -- bump: start working on next release - -- src/Makefile.am: avoid explicit $< - - ... since apparently "BSD make" doesn't support it. - - Reported-by: Thomas Klausner - Fixes #1432 - -Version 7.54.0 (19 Apr 2017) - -Daniel Stenberg (19 Apr 2017) -- THANKS: add contributors from 7.54.0 release notes - -- RELEASE-NOTES: curl 7.54.0 - -Marcel Raad (18 Apr 2017) -- nss: fix MinGW compiler warnings - - This fixes 3 warnings issued by MinGW: - 1. PR_ImportTCPSocket actually has a paramter of type PROsfd instead of - PRInt32, which is 64 bits on Windows. Fixed this by including the - corresponding header file instead of redeclaring the function, which is - supported even though it is in the private include folder. [1] - 2. In 64-bit mode, size_t is 64 bits while CK_ULONG is 32 bits, so an explicit - narrowing cast is needed. - 3. Curl_timeleft returns time_t instead of long since commit - 21aa32d30dbf319f2d336e0cb68d3a3235869fbb. - - [1] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_ImportTCPSocket - - Closes https://github.com/curl/curl/pull/1393 - -Daniel Stenberg (18 Apr 2017) -- [Jay Satiro brought this change] - - TLS: Fix switching off SSL session id when client cert is used - - Move the sessionid flag to ssl_primary_config so that ssl and proxy_ssl - will each have their own sessionid flag. - - Regression since HTTPS-Proxy support was added in cb4e2be. Prior to that - this issue had been fixed in 247d890, CVE-2016-5419. - - Bug: https://github.com/curl/curl/issues/1341 - Reported-by: lijian996@users.noreply.github.com - - The new incarnation of this bug is called CVE-2017-7468 and is documented - here: https://curl.haxx.se/docs/adv_20170419.html - -- [David Benjamin brought this change] - - openssl: don't try to print nonexistant peer private keys - - X.509 certificates carry public keys, not private keys. Fields - corresponding to the private half of the key will always be NULL. - - Closes #1425 - -- [David Benjamin brought this change] - - openssl: fix thread-safety bugs in error-handling - - ERR_error_string with NULL parameter is not thread-safe. The library - writes the string into some static buffer. Two threads doing this at - once may clobber each other and run into problems. Switch to - ERR_error_string_n which avoids this problem and is explicitly - bounds-checked. - - Also clean up some remnants of OpenSSL 0.9.5 around here. A number of - comments (fixed buffer size, explaining that ERR_error_string_n was - added in a particular version) date to when ossl_strerror tried to - support pre-ERR_error_string_n OpenSSLs. - - Closes #1424 - -- [David Benjamin brought this change] - - openssl: make SSL_ERROR_to_str more future-proof - - Rather than making assumptions about the values, use a switch-case. - - Closes #1424 - -- [Daniel Gustafsson brought this change] - - code: fix typos and style in comments - - A few random typos, and minor whitespace cleanups, found in comments - while reading code. - - Closes #1423 - -Marcel Raad (17 Apr 2017) -- extern-scan.pl: strip trailing CR - - This makes test 1135 pass with CRLF checkouts. - - Ref: https://github.com/curl/curl/pull/1344#issuecomment-289243166 - Closes https://github.com/curl/curl/pull/1422 - -- configure.ac: ignore CR after version numbers - - Ignore everything after the version numbers in LIBCURL_VERSION and - LIBCURL_VERSION_NUM to ged rid of the extra CR character. - This makes tests 1022 and 1023 pass on Linux with a CRLF checkout. - - Ref: https://github.com/curl/curl/pull/1344#issuecomment-289243166 - Closes https://github.com/curl/curl/pull/1422 - -- .gitattributes: force shell scripts to LF - - Bash on Linux errors out on CR characters. - This makes tests 1221 and 1222 pass on Linux with a CRLF checkout. - - Ref: https://github.com/curl/curl/pull/1344#issuecomment-289243166 - Closes https://github.com/curl/curl/pull/1422 - -- unit1303: fix compiler warning - - MinGW-w64 complains: - warning: conversion to 'long int' from 'time_t {aka long long int}' may - alter its value [-Wconversion] - Fix this by using the correct type. - -Daniel Stenberg (16 Apr 2017) -- RELEASE-NOTES: synced with 1451271e0 - -- [Larry Stefani brought this change] - - http2: fix handle leak in error path - - Add missing newhandle free call in push_promise(). - - Closes #1416 - -- [Larry Stefani brought this change] - - mbedtls: fix memory leak in error path - - Add missing our_ssl_sessionid free call in mbed_connect_step3(). - - Closes #1417 - -Marcel Raad (15 Apr 2017) -- curl-compilers.m4: turn implicit function declarations into errors - - This adds -Werror-implicit-function-declaration for GCC 2.95+ so that - these errors are visible at the point where they occur instead of only - at link time. - Implicit function declarations are illegal in C99 and C++ anyway, and - the same warning has been turned into an error for ICC in commit - 3072c5b8a127057aa922b7c51051bbb4a630b091. - - Ref: https://gcc.gnu.org/onlinedocs/gcc-2.95.2/gcc_2.html#SEC8 - Ref: https://curl.haxx.se/mail/lib-2017-04/0001.html - Closes https://github.com/curl/curl/pull/1419 - -- test1541: also test for CURL_PULL_WS2TCPIP_H - - Ref: https://github.com/curl/curl/issues/1408 - Closes https://github.com/curl/curl/pull/1412 - -- tests/server/util: prefer over - - Follow-up to aa573c3c55cda72ec5ef677d87f6f46a53385f0c - - Ref: https://github.com/curl/curl/pull/1406 - -Daniel Stenberg (11 Apr 2017) -- Curl_expire_latest: ignore already expired timers - - If the existing timer is still in there but has expired, the new timer - should be added. - - Reported-by: Rainer Canavan - Bug: https://curl.haxx.se/mail/lib-2017-04/0030.html - Closes #1407 - -- system.h: fix mingw section - - Reported-by: Marcel Raad - Fixes #1408 - Closes #1409 - -Marcel Raad (11 Apr 2017) -- polarssl: unbreak build with versions < 1.3.8 - - ssl_session_init was only introduced in version 1.3.8, the penultimate - version. The function only contains a memset, so replace it with that. - - Suggested-by: Jay Satiro - Fixes https://github.com/curl/curl/issues/1401 - -- poll: prefer over - - The POSIX standard location is . Using results in - warning spam when using the musl standard library. - - Closes https://github.com/curl/curl/pull/1406 - -Daniel Stenberg (10 Apr 2017) -- [Alexis La Goutte brought this change] - - openssl: fix this statement may fall through [-Wimplicit-fallthrough=] - - Closes #1402 - -Kamil Dudka (10 Apr 2017) -- nss: load CA certificates even with --insecure - - ... because they may include an intermediate certificate for a client - certificate and the intermediate certificate needs to be presented to - the server, no matter if we verify the peer or not. - - Reported-by: thraidh - Closes #851 - -Daniel Stenberg (10 Apr 2017) -- RELEASE-NOTES: synced with f9d1e9a27f7e1 - -Dan Fandrich (10 Apr 2017) -- libcurl-thread.3: fixed a bad macro that caused test 1140 to fail - -Daniel Stenberg (9 Apr 2017) -- libcurl-thread.3: also mention threaded-resolver - - Reported-by: Alex Bligh - Bug: https://curl.haxx.se/mail/lib-2017-04/0044.html - -- .github/stale.yml: enable the stale bot - - Issues and PRs with no activity for 180 days will get marked as stale, - and if no further activity happens within 14 more days, the issue gets - closed. - - This follows our established policy of not letting stalled bugs "get in - the way": https://curl.haxx.se/docs/bugs.html#Closing_off_stalled_bugs - - Closes #1398 - -Jay Satiro (8 Apr 2017) -- CURLINFO_SCHEME.3: fix variable type - - - Change documented param type to char ** from incorrect long *. - -Marcel Raad (8 Apr 2017) -- INSTALL.md: fix secure transport configure arguments - - --without-ssl is needed instead of --with-winssl. - -- vtls: fix unreferenced variable warnings - - ... by moving the variables into the correct #ifdef block. - -Daniel Stenberg (7 Apr 2017) -- BUGS: "Bugs in old versions" - -- system.h: add section for tcc - - Closes #1397 - -Marcel Raad (7 Apr 2017) -- schannel: fix compiler warnings - - When UNICODE is not defined, the Curl_convert_UTF8_to_tchar macro maps - directly to its argument. As it is declared as a pointer to const and - InitializeSecurityContext expects a pointer to non-const, both MSVC and MinGW - issue a warning about implicitly casting away the const. Fix this by declaring - the variables as pointers to non-const. - - Closes https://github.com/curl/curl/pull/1394 - -- [Isaac Boukris brought this change] - - sspi: print out InitializeSecurityContext() error message - - Reported-by: Carsten (talksinmath) - - Fixes #1384 - Closes #1395 - -- gtls: fix compiler warning - - Curl_timeleft returns time_t instead of long since commit - 21aa32d30dbf319f2d336e0cb68d3a3235869fbb. - -Daniel Stenberg (6 Apr 2017) -- test1606: verify speedcheck - -- low_speed_limit: improved function for longer time periods - - Previously, periods of fast speed between periods of slow speed would - not count and could still erroneously trigger a timeout. - - Reported-by: Paul Harris - Fixes #1345 - Closes #1390 - -- system.h: set sizeof long to 4 on "default 32 bit" systems - - Triggered a test failure on test 1541 for the build known as - "Linux 4.4 i686 tcc 0.9.26 glibc 2.20" - -Marcel Raad (6 Apr 2017) -- nss: fix build after e60fe20fdf94e829ba5fce33f7a9d6c281149f7d - - Curl_llist_alloc is now Curl_llist_init. - - Closes https://github.com/curl/curl/pull/1391 - -Daniel Stenberg (6 Apr 2017) -- INSTALL.cmake: more problems - - and mention specific issues where they are discussed - -- test1541: ignore the curl_off_t variable type name comparison - - ... the sizes and the formatting strings are what's really important and - avoids problems with int64_t vs "long long". - - Bug: https://curl.haxx.se/mail/lib-2017-04/0019.html - -- Revert "configure: prefer 'long long' to int64_t for curl_off_t" - - This reverts commit 81284374bf3c670d2050f8562edeb69f060b07cc. - - Due to mingw32 brekage. - -Marcel Raad (5 Apr 2017) -- tool_operate: fix MinGW compiler warning - - MinGW complains: - tool_operate.c:197:15: error: comparison is always true due to limited range - of data type [-Werror=type-limits] - - Fix this by only doing the comparison if 'long' is large enough to hold the - constant it is compared with. - - Closes https://github.com/curl/curl/pull/1378 - -- tool_operate: move filetime code to its own function - - Ref: https://github.com/curl/curl/pull/1378 - -Daniel Stenberg (5 Apr 2017) -- configure: prefer 'long long' to int64_t for curl_off_t - - Since it is a native type and it makes it less complicated to find a - matching one in system.h - - Bug: https://curl.haxx.se/mail/lib-2017-04/0010.html - Reported-by: Dan Fandrich - - Closes #1388 - -- [Dániel Bakai brought this change] - - tests: added test for Curl_splaygetbest to unit1309 - - This checks the new behavior of Curl_splaygetbest, so that the smallest - node not larger than the key is removed, and FIFO behavior is kept even - when there are multiple nodes with the same key. - - Closes #1358 - -- [Dániel Bakai brought this change] - - multi: fix queueing of pending easy handles - - Multi handles repeatedly invert the queue of pending easy handles when - used with CURLMOPT_MAX_TOTAL_CONNECTIONS. This is caused by a multistep - process involving Curl_splaygetbest and violates the FIFO property of - the multi handle. - This patch fixes this issue by redefining the "best" node in the - context of timeouts as the "smallest not larger than now", and - implementing the necessary data structure modifications to do this - effectively, namely: - - splay nodes with the same key are now stored in a doubly-linked - circular list instead of a non-circular one to enable O(1) - insertion to the tail of the list - - Curl_splayinsert inserts nodes with the same key to the tail of - the same list - - in case of multiple nodes with the same key, the one on the head of - the list gets selected - -Marcel Raad (4 Apr 2017) -- tool: fix Windows Unicode build - - ... by explicitly calling the ANSI versions of Windows API functions where - required. - -Daniel Stenberg (4 Apr 2017) -- [Martin Kepplinger brought this change] - - curl_sasl: declare mechtable static - - struct mechtable is only used locally here. It can be declared static. - -Jay Satiro (4 Apr 2017) -- [Antti Hätälä brought this change] - - url: don't free postponed data on connection reuse - - - Don't free postponed data on a connection that will be reused since - doing so can cause data loss when pipelining. - - Only Windows builds are affected by this. - - Closes https://github.com/curl/curl/issues/1380 - -Daniel Stenberg (4 Apr 2017) -- RELEASE-NOTES: synced with 4f2e348f9b42c69c480 - -- hash: move key into hash struct to reduce mallocs - - This removes one tiny malloc for each hash struct allocated. In a simple - case like "curl localhost", this save three mallocs. - - Closes #1376 - -- llist: replace Curl_llist_alloc with Curl_llist_init - - No longer allocate the curl_llist head struct for lists separately. - - Removes 17 (15%) tiny allocations in a normal "curl localhost" invoke. - - closes #1381 - -Jay Satiro (4 Apr 2017) -- easy: silence compiler warning - - Safe to silence warning adding time delta of poll, which can trigger on - Windows since sizeof time_t > sizeof long. - - warning C4244: '+=' : conversion from 'time_t' to 'long', possible loss - of data - -Daniel Stenberg (4 Apr 2017) -- [Richlv brought this change] - - docs: minor typo in write-out.d - - Closes #1382 - -- include: curl/system.h is a run-time version of curlbuild.h - - system.h is aimed to replace curlbuild.h at a later point in time when - we feel confident system.h works sufficiently well. - - curl/system.h is currently used in parallel with curl/curlbuild.h - - curl/system.h determines a data sizes, data types and include file - status based on available preprocessor defines instead of getting - generated at build-time. This, in order to avoid relying on a build-time - generated file that makes it complicated to do 32 and 64 bit bields from - the same installed set of headers. - - Test 1541 verifies that system.h comes to the same conclusion that - curlbuild.h offers. - - Closes #1373 - -- multi: make curl_multi_wait avoid malloc in the typical case - - When only a few additional file descriptors are used, avoid the malloc. - - Closes #1377 - -Marcel Raad (3 Apr 2017) -- tests/server/util: remove in6addr_any for recent MinGW - - In ancient MinGW versions, in6addr_any was declared as extern, but not - defined. Because of that, 22a0c57746ae12506b1ba0f0fafffd26c1907d6a added - definitions for in6addr_any when compiling with MinGW. The bug was fixed in - w32api version 3.6 from 2006, so this workaround is not needed anymore for - recent versions. - - This fixes the following MinGW-w64 warnings because the MinGW-w64 version of - IN6ADDR_ANY_INIT has the two additional braces inside the macro: - util.c:59:14: warning: braces around scalar initializer - util.c:59:40: warning: excess elements in scalar initializer - - Ref: https://sourceforge.net/p/mingw/mingw-org-wsl/ci/e4803e0da25c57ae1ad0fa75ae2b7182ff7fa339/tree/w32api/ChangeLog - Closes https://github.com/curl/curl/pull/1379 - -Daniel Stenberg (3 Apr 2017) -- docs: added examples for CURLINFO_FILETIME.3 and CURLOPT_FILETIME.3 - -Jay Satiro (31 Mar 2017) -- fail-early.d: fix typos - -- docs: Explain --fail-early does not imply --fail - - Closes https://github.com/curl/curl/pull/1375 - -Daniel Stenberg (1 Apr 2017) -- telnet: (win32) fix read callback return variable - - telnet.c(1427,21): warning: comparison of constant 268435456 with - expression of type 'CURLcode' is always false - - telnet.c(1433,21): warning: comparison of constant 268435457 with - expression of type 'CURLcode' is always false - - Reviewed-by: Jay Satiro - Reported-by: Gisle Vanem - Bug: https://github.com/curl/curl/issues/1225#issuecomment-290340890 - - Closes #1374 - -- CTestConfig.cmake: removed, unused - -- libcurl.def: removed, unused - -- docs/index.html: removed, was not shipped anyway - -- dist: add missing files to the tarball - -Peter Wu (30 Mar 2017) -- cmake: fix build with cmake 2.8.12.2 - - For some reason, CMake 2.8.12.2 did not expand the list argument in a - single DEPENDS argument. Remove the quotes, so it gets expanded into - multiple arguments for add_custom_command and add_custom_target. - - Fixes https://github.com/curl/curl/issues/1370 - Closes #1372 - -Marcel Raad (30 Mar 2017) -- ssh: fix narrowing conversion warning - - 'left' is used as time_t but declared as long. - MinGW complains: - error: conversion to 'long int' from 'time_t {aka long long int}' may alter - its value [-Werror=conversion] - Changed the declaration to time_t. - -- http2: silence unused parameter warnings - - In release mode, MinGW complains: - error: unused parameter 'lib_error_code' [-Werror=unused-parameter] - -Daniel Stenberg (30 Mar 2017) -- [Hanno Böck brought this change] - - curl: fix callback functions to match prototype - - The function tool_debug_cb doesn't match curl_debug_callback in curl.h - (unsigned vs. signed char* for 3rd param). - - Bug: https://curl.haxx.se/mail/lib-2017-03/0120.html - -- [Alexis La Goutte brought this change] - - gcc7: fix ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context] - - Closes #1371 - -Marcel Raad (30 Mar 2017) -- schannel: fix unused variable warning - - If CURL_DISABLE_VERBOSE_STRINGS is defined, hostname is not used in - schannel_connect_step3. - -- connect: fix unreferenced parameter warning - - When CURL_DISABLE_VERBOSE_STRINGS is defined, the reason parameter in - Curl_conncontrol is not used as the infof macro expands to nothing. - -- select: use correct SIZEOF_ constant - - At least under Windows, there is no SIZEOF_LONG, so it evaluates to 0 even - though sizeof(int) == sizeof(long). This should probably have been - CURL_SIZEOF_LONG, but the type of timeout_ms changed from long to time_t - anyway. - This triggered MSVC warning C4668 about implicitly replacing undefined - macros with '0'. - - Closes https://github.com/curl/curl/pull/1362 - -Daniel Stenberg (30 Mar 2017) -- cmake: add cmake file in docs/libcurl/opts/ to dist - -- cmake: add more missing files to the dist - -- docs/Makefile.am: include CMakeLists.txt in the dist tarball - -Marcel Raad (29 Mar 2017) -- NTLM: check for features with #ifdef instead of #if - - Feature defines are normally checked with #ifdef instead of #if in the rest of - the codebase. Additionally, some compilers warn when a macro is implicitly - evaluated to 0 because it is not defined, which was the case here. - - Ref: https://github.com/curl/curl/pull/1362#discussion_r108605101 - Closes https://github.com/curl/curl/pull/1367 - -Daniel Stenberg (29 Mar 2017) -- [Hanno Böck brought this change] - - curl: fix callback argument inconsistency - - As you can see the callback definition uses a char* for the first - argument, while the function uses a void*. - - URL: https://curl.haxx.se/mail/lib-2017-03/0116.html - -- RELEASE-NOTES: synced with 556c51a2df - -- [madblobfish brought this change] - - KNOWN_BUGS: typo - - Closes #1364 - -- [Maksim Stsepanenka brought this change] - - make: use the variable MAKE for recursive calls - - Closes #1366 - -- conncache: make hashkey avoid malloc - - ... to make it much faster. Idea developed with primepie on IRC. - - Closes #1365 - -Kamil Dudka (28 Mar 2017) -- http: do not treat FTPS over CONNECT as HTTPS - - If we use FTPS over CONNECT, the TLS handshake for the FTPS control - connection needs to be initiated in the SENDPROTOCONNECT state, not - the WAITPROXYCONNECT state. Otherwise, if the TLS handshake completed - without blocking, the information about the completed TLS handshake - would be saved to a wrong flag. Consequently, the TLS handshake would - be initiated in the SENDPROTOCONNECT state once again on the same - connection, resulting in a failure of the TLS handshake. I was able to - observe the failure with the NSS backend if curl ran through valgrind. - - Note that this commit partially reverts curl-7_21_6-52-ge34131d. - -Daniel Stenberg (28 Mar 2017) -- pause: handle mixed types of data when paused - - When receiving chunked encoded data with trailers, and the write - callback returns PAUSE, there might be both body and header to store to - resend on unpause. Previously libcurl returned error for that case. - - Added test case 1540 to verify. - - Reported-by: Stephen Toub - Fixes #1354 - Closes #1357 - -Jay Satiro (28 Mar 2017) -- [Isaac Boukris brought this change] - - http: Fix proxy connection reuse with basic-auth - - When using basic-auth, connections and proxy connections - can be re-used with different Authorization headers since - it does not authenticate the connection (like NTLM does). - - For instance, the below command should re-use the proxy - connection, but it currently doesn't: - curl -v -U alice:a -x http://localhost:8181 http://localhost/ - --next -U bob:b -x http://localhost:8181 http://localhost/ - - This is a regression since refactoring of ConnectionExists() - as part of: cb4e2be7c6d42ca0780f8e0a747cecf9ba45f151 - - Fix the above by removing the username and password compare - when re-using proxy connection at proxy_info_matches(). - - However, this fix brings back another bug would make curl - to re-print the old proxy-authorization header of previous - proxy basic-auth connection because it wasn't cleared. - - For instance, in the below command the second request should - fail if the proxy requires authentication, but would succeed - after the above fix (and before aforementioned commit): - curl -v -U alice:a -x http://localhost:8181 http://localhost/ - --next -x http://localhost:8181 http://localhost/ - - Fix this by clearing conn->allocptr.proxyuserpwd after use - unconditionally, same as we do for conn->allocptr.userpwd. - - Also fix test 540 to not expect digest auth header to be - resent when connection is reused. - - Signed-off-by: Isaac Boukris - - Closes https://github.com/curl/curl/pull/1350 - -- openssl: exclude DSA code when OPENSSL_NO_DSA is defined - - - Fix compile errors that occur in openssl.c when OpenSSL lib was - built without DSA support. - - Bug: https://github.com/curl/curl/issues/1361 - Reported-by: neheb@users.noreply.github.com - -- examples/fopen: checksrc compliance - -Marcel Raad (28 Mar 2017) -- schannel: fix variable shadowing warning - - No need to redeclare the variable. - -- multi: fix MinGW-w64 compiler warnings - - error: conversion to 'long int' from 'time_t {aka long long int}' may alter - its value [-Werror=conversion] - -- .gitattributes: turn off CRLF for *.am - - If Makefile.am uses CRLF, buildconf in a Windows checkout fails with: - ".ibtoolize: error: AC_CONFIG_MACRO_DIRS([m4]) conflicts with - ACLOCAL_AMFLAGS=-I m4" - -Daniel Stenberg (26 Mar 2017) -- [klemens brought this change] - - spelling fixes - - Closes #1356 - -- curl: check for end of input in writeout backslash handling - - Reported-by: Brian Carpenter - - Added test 1442 to verify - -Marcel Raad (24 Mar 2017) -- tests/README: make "Run" section foolproof - - curl must be built before building the tests. - - Closes https://github.com/curl/curl/pull/1352 - -Daniel Stenberg (23 Mar 2017) -- openssl: fix comparison between signed and unsigned integer expressions - -Marcel Raad (23 Mar 2017) -- [Edward Kimmel brought this change] - - asiohiper: make sure socket is open in event_cb - - Send curl_socket_t to event_cb and make sure it hasn't been closed yet. - - Closes https://github.com/curl/curl/pull/1318 - -Dan Fandrich (23 Mar 2017) -- openssl: made the error table static const - -Jay Satiro (23 Mar 2017) -- openssl: fall back on SSL_ERROR_* string when no error detail - - - If SSL_get_error is called but no extended error detail is available - then show that SSL_ERROR_* as a string. - - Prior to this change there was some inconsistency in that case: the - SSL_ERROR_* code may or may not have been shown, or may have been shown - as unknown even if it was known. - - Ref: https://github.com/curl/curl/issues/1300 - - Closes https://github.com/curl/curl/pull/1348 - -Dan Fandrich (23 Mar 2017) -- mkhelp: disable compression if the perl gzip module is unavailable - - This is nowadays included with the base perl distribution, but wasn't - prior to about perl 5.14 - -Daniel Stenberg (23 Mar 2017) -- [Anders Roxell brought this change] - - tests/README: mention nroff for --manual tests - - Signed-off-by: Anders Roxell - - Closes #1342 - -- CURLINFO_PRIMARY_IP.3: add example - -- travis: run tests-nonflaky instead of tests-full - -- make: introduce 'test-nonflaky' target - - Running this in the root build dir will invoke the test suite to only - run tests not marked as 'flaky'. - -- test2033: flaky - -Jay Satiro (21 Mar 2017) -- [Ales Mlakar brought this change] - - mbedtls: add support for CURLOPT_SSL_CTX_FUNCTION - - Ref: https://curl.haxx.se/mail/lib-2017-02/0097.html - - Closes https://github.com/curl/curl/pull/1272 - -Peter Wu (21 Mar 2017) -- cmake: add support for building HTML and PDF docs - - Note that for some reason there is this warning (that also exists with - autotools, added since curl-7_15_1-94-ga718cb05f): - - docs/libcurl/curl_multi_socket_all.3:1: can't open `man3/curl_multi_socket.3': No such file or directory - - Additionally, adjust the roffit --mandir option to support creating - links when doing out-of-tree builds. - - Ref: https://github.com/curl/curl/pull/1288 - -- cmake: build manual pages (including curl.1) - - Also make Perl mandatory to allow building the docs. - - While CMakeLists.txt could probably read the list of manual pages from - Makefile.am, actually putting those in CMakeLists.txt is cleaner so that - is what is done here. - - Fixes #1230 - Ref: https://github.com/curl/curl/pull/1288 - -- docs: split file lists into Makefile.inc - - For easier sharing with CMake. The contents were reformatted to use - two-space indent and expanded tabs (matching lib/Makefile.common). - - Ref: https://github.com/curl/curl/pull/1288 - -Daniel Stenberg (21 Mar 2017) -- examples: comment typos in http2 examples - -- RELEASE-NOTES: typo - -- RELEASE-NOTES: synced with 6e0f26c8a8c28df - -- multi: fix streamclose() crash in debug mode - - The code would refer to the wrong data pointer. Only debug builds do - this - for verbosity. - - Reported-by: zelinchen@users.noreply.github.com - Fixes #1329 - -- CONTRIBUTE: mention referring to github issues in commit msgs - -Dan Fandrich (20 Mar 2017) -- runtests.pl: fixed display of the Gopher IPv6 port number - -- tests: fixed the documented test server port numbers - -- test714/5: added HTTP as a required feature - - These tests use an HTTP proxy so require that curl be built with HTTP - support. - -- tests: strip more options from non-HTTP --libcurl tests - - The CURLOPT_USERAGENT and CURLOPT_MAXREDIRS options are only set if HTTP - support is available, so ignore them in tests where HTTP is not - guaranteed. - -Jay Satiro (18 Mar 2017) -- [Palo Markovic brought this change] - - darwinssl: fix typo in variable name - - Broken a week ago in 6448f98. - - Closes https://github.com/curl/curl/pull/1337 - -- tool_operate: Fix showing HTTPS-Proxy options on CURLE_SSL_CACERT - - - Show the HTTPS-proxy options on CURLE_SSL_CACERT if libcurl was built - with HTTPS-proxy support. - - Prior to this change those options were shown only if an HTTPS-proxy was - specified by --proxy, but that did not take into account environment - variables such as http_proxy, https_proxy, etc. Follow-up to e1187c4. - - Bug: https://github.com/curl/curl/issues/1331 - Reported-by: Nehal J Wani - -- CURLINFO_LOCAL_PORT.3: fix typo - -Daniel Stenberg (16 Mar 2017) -- CURLINFO_LOCAL_PORT.3: added example - -- SSLCERTS.md: mention HTTPS proxies and their separate options - -- BINDINGS: a Delphi binding - -- KNOWN_BUGS: remove libidn related issue - - ... as we no longer use libidn - -Dan Fandrich (14 Mar 2017) -- build: removed redundant DEPENDENCIES from makefiles - -Daniel Stenberg (13 Mar 2017) -- [Sylvestre Ledru brought this change] - - Improve code readbility - - ... by removing the else branch after a return, break or continue. - - Closes #1310 - -Jay Satiro (13 Mar 2017) -- [Anatol Belski brought this change] - - winbuild: add basic support for OpenSSL 1.1.x - - - Auto-detect OpenSSL 1.1 libs - - Closes https://github.com/curl/curl/pull/1322 - -Daniel Stenberg (13 Mar 2017) -- RELEASE-NOTES: synced with c25e0761d0fc49c4 - -- make: regenerate docs/curl.1 by runinng make in docs - - ... previously, docs/ was only a dist subdir, now also a build subdir. - - Reported-by: Dan Fandrich - Bug: https://curl.haxx.se/mail/lib-2017-03/0017.html - -Dan Fandrich (12 Mar 2017) -- test1440/1: depend on well-defined file: behaviour - - Depend on the known behaviour of URLs for nonexistent files rather than - the undefined behaviour of URLs for directories (which fails on Windows). - The test isn't about file: URLs at all, so the URL used doesn't really - matter. - -- tests: clear the SSL_CERT_FILE variable on --libcurl tests - - Otherwise, the contents will end up in the output and fail the - verification. - -- test1287: added verbose logs keyword - -- tool_writeout: fixed a buffer read overrun on --write-out - - If a % ended the statement, the string's trailing NUL would be skipped - and memory past the end of the buffer would be accessed and potentially - displayed as part of the --write-out output. Added tests 1440 and 1441 - to check for this kind of condition. - - Reported-by: Brian Carpenter - -Jay Satiro (12 Mar 2017) -- [Desmond O. Chang brought this change] - - url: add option CURLOPT_SUPPRESS_CONNECT_HEADERS - - - Add new option CURLOPT_SUPPRESS_CONNECT_HEADERS to allow suppressing - proxy CONNECT response headers from the user callback functions - CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION. - - - Add new tool option --suppress-connect-headers to expose - CURLOPT_SUPPRESS_CONNECT_HEADERS and allow suppressing proxy CONNECT - response headers from --dump-header and --include. - - Assisted-by: Jay Satiro - Assisted-by: CarloCannas@users.noreply.github.com - Closes https://github.com/curl/curl/pull/783 - -- http_proxy: Ignore TE and CL in CONNECT 2xx responses - - A client MUST ignore any Content-Length or Transfer-Encoding header - fields received in a successful response to CONNECT. - "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 - - Prior to this change such a case would cause an error. - - In some ways this bug appears to be a regression since c50b878. Prior to - that libcurl may have appeared to function correctly in such cases by - acting on those headers instead of causing an error. But that behavior - was also incorrect. - - Bug: https://github.com/curl/curl/issues/1317 - Reported-by: mkzero@users.noreply.github.com - -- [Thomas Glanzmann brought this change] - - mbedtls: fix typo in variable name - - Broken a few days ago in 6448f98. - - Bug: https://curl.haxx.se/mail/lib-2017-03/0015.html - -Michael Kaufmann (11 Mar 2017) -- tests: fix the authretry tests - - Do not call curl_easy_reset() between the requests, because the - auth state must be preserved for these tests. - - Follow-up to 0afbcfd - -- proxy: skip SSL initialization for closed connections - - This prevents a "Descriptor is not a socket" error for WinSSL. - - Reported-by: Antony74@users.noreply.github.com - Reviewed-by: Jay Satiro - - Fixes https://github.com/curl/curl/issues/1239 - -- curl_easy_reset: Also reset the authentication state - - Follow-up to 5278462 - See https://github.com/curl/curl/issues/1095 - -- [Isaac Boukris brought this change] - - authneg: clear auth.multi flag at http_done - - This flag is meant for the current request based on authentication - state, once the request is done we can clear the flag. - - Also change auth.multi to auth.multipass for better readability. - - Fixes https://github.com/curl/curl/issues/1095 - Closes https://github.com/curl/curl/pull/1326 - - Signed-off-by: Isaac Boukris - Reported-by: Michael Kaufmann - -Dan Fandrich (11 Mar 2017) -- url: don't compile detect_proxy if HTTP support is disabled - -- cmdline-opts: fixed a few typos - -Daniel Stenberg (10 Mar 2017) -- README.md: add coverity and travis badges - -- ISSUE_TEMPLATE: for bugs, ask questions on the mailing list - - and try to add the top comment within an HTML comment in the hope - that it might get hidden if the text is kept - -- openssl: add two /* FALLTHROUGH */ to satisfy coverity - - CID 1402159 and 1402158 - -- tests: disabled 1903 now - - Test 1903 is doing HTTP pipelining, and that is a timing and ordering - sensitive operation and this fails far too often on the Travis CI - leading to people more or less ignoring test failures there. Not good. - - The end of pipelning is probably coming sooner rather than later - anyway... - -Dan Fandrich (9 Mar 2017) -- tls-max.d: added to the makefile - -- build: fixed making man page in out-of-tree tarball builds - - The man page taken from the release package is found in a different - location than if it's built from source. It must be referenced as $< in - the rule to get its correct location in the VPATH. - -- mkhelp: simplified the gzip code - - This eliminates the need for an external gzip program, which wasn't - working with Busybox's gzip, anyway. It now compresses using perl's - IO::Compress::Gzip - -- polarssl: fixed compile errors introduced in 6448f98c - -Daniel Stenberg (8 Mar 2017) -- bump: next release will be known as 7.54.0 - - ...due to the newly added CURL_SSLVERSION_MAX_* functionality - -- openssl: unbreak the build after 6448f98c1857de - - Verified with OpenSSL 1.1.0e and OpenSSL master (1.1.1) - -Kamil Dudka (8 Mar 2017) -- [Jozef Kralik brought this change] - - vtls: add options to specify range of enabled TLS versions - - This commit introduces the CURL_SSLVERSION_MAX_* constants as well as - the --tls-max option of the curl tool. - - Closes https://github.com/curl/curl/pull/1166 - -Daniel Stenberg (8 Mar 2017) -- RELEASE-NOTES: synced with 6888a670aa01 - -- MANPAGE: clarify the dash situation in meta data - -- insecure.d: clarify that this is for server connections - - Assisted-by: Ray Satiro - Bug: https://curl.haxx.se/mail/lib-2017-03/0002.html - -Dan Fandrich (8 Mar 2017) -- test1260: added http as a required feature - -Daniel Stenberg (7 Mar 2017) -- [Steve Brokenshire brought this change] - - maketgz: Run updatemanpages.pl to update man pages - - maketgz now runs scripts/updatemanpages.pl to update the man pages .TH - section to use the current date and curl/libcurl version. - - (TODO Section 3.1) - - Closes #1058 - -- [Steve Brokenshire brought this change] - - gitignore: Ignore man page dist files - - Ignore man page dist files generated by scripts/updatemanpages.pl - -- [Steve Brokenshire brought this change] - - Makefile.am: Remove distribution man pages when running 'make clean' - -- [Steve Brokenshire brought this change] - - Makefile.am: Added scripts/updatemanpages.pl to EXTRA_DIST - -- [Steve Brokenshire brought this change] - - updatemanpages.pl: Update man pages to use current date and versions - - Added script to update man pages to use the current date and - curl/libcurl versions. - - updatemanpages.pl has three arrays: list of directories to look in, - list of extensions to process, list of files to exclude from - processing. - - Check man page in git repoistory using the date from the existing man - page before updating to avoid updating the man page if no change is - made. - - If data is received from the git command then update the man page with - the current date and version otherwise leave alone. - - Applied patch from badger to make the date argument optional, change the - git command used, added date argument to processfile subroutine and - print to STDERR if no date is found in a man page. - - Added code to process the changed man page into a new man page with - .dist added to the filename to keep the original source files unchanged. - Updated POD documentation to reflect that the date argument optional. - - Code style is in line with CODE_STYLE.md. - - Directories: docs/ docs/libcurl/ docs/libcurl/opts/ tests/ - Extensions: .1 .3 - Excluded files: mk-ca-bundle.1 template.3 - - (TODO Section 3.1) - -- [Tatsuhiro Tsujikawa brought this change] - - http2: Fix assertion error on redirect with CL=0 - - This fixes assertion error which occurs when redirect is done with 0 - length body via HTTP/2, and the easy handle is reused, but new - connection is established due to hostname change: - - curl: http2.c:1572: ssize_t http2_recv(struct connectdata *, - int, char *, size_t, CURLcode *): - Assertion `httpc->drain_total >= data->state.drain' failed. - - To fix this bug, ensure that http2_handle_stream is called. - - Fixes #1286 - Closes #1302 - -- ares: Curl_resolver_wait_resolv: clear *entry first in function - -- ares: better error return on timeouts - - Assisted-by: Ray Satiro - - Bug: https://curl.haxx.se/mail/lib-2017-03/0009.html - -Jay Satiro (6 Mar 2017) -- KNOWN_BUGS: Add DarwinSSL won't import PKCS#12 without a password - - Bug: https://github.com/curl/curl/issues/1308 - Reported-by: Justin Clift - -Dan Fandrich (6 Mar 2017) -- test1260: removed errant XML tag - -Daniel Stenberg (6 Mar 2017) -- URL: return error on malformed URLs with junk after port number - - ... because it causes confusion with users. Example URLs: - - "http://[127.0.0.1]:11211:80" which a lot of languages' URL parsers will - parse and claim uses port number 80, while libcurl would use port number - 11211. - - "http://user@example.com:80@localhost" which by the WHATWG URL spec will - be treated to contain user name 'user@example.com' but according to - RFC3986 is user name 'user' for the host 'example.com' and then port 80 - is followed by "@localhost" - - Both these formats are now rejected, and verified so in test 1260. - - Reported-by: Orange Tsai - -- BINDINGS: update the Lua-cURL URL - -- [Sylvestre Ledru brought this change] - - BINDINGS: add Scilab binding - - Closes #1312 - -- BINDINGS: add go-curl and perl6-net-curl - - Reported-by: Peter Pentchev - -- BINDINGS: add misssing C++ bindings - - Reported-by: Giuseppe Persico +$ git log --pretty=fuller --no-color --date=short --decorate=full | \ + ./scripts/log2changes.pl diff --git a/curl/CMake/CMakeConfigurableFile.in b/curl/CMake/CMakeConfigurableFile.in index 4cf74a12..8ccd016a 100644 --- a/curl/CMake/CMakeConfigurableFile.in +++ b/curl/CMake/CMakeConfigurableFile.in @@ -1,2 +1,22 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### @CMAKE_CONFIGURABLE_FILE_CONTENT@ - diff --git a/curl/CMake/CurlSymbolHiding.cmake b/curl/CMake/CurlSymbolHiding.cmake index 9f7d2963..e99ea6f6 100644 --- a/curl/CMake/CurlSymbolHiding.cmake +++ b/curl/CMake/CurlSymbolHiding.cmake @@ -1,60 +1,75 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### include(CheckCSourceCompiles) option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON) mark_as_advanced(CURL_HIDDEN_SYMBOLS) if(CURL_HIDDEN_SYMBOLS) - set(SUPPORTS_SYMBOL_HIDING FALSE) + set(SUPPORTS_SYMBOL_HIDING FALSE) - if(CMAKE_C_COMPILER_ID MATCHES "Clang") - set(SUPPORTS_SYMBOL_HIDING TRUE) - set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") - set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") - elseif(CMAKE_COMPILER_IS_GNUCC) - if(NOT CMAKE_VERSION VERSION_LESS 2.8.10) - set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION}) - else() - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion - OUTPUT_VARIABLE GCC_VERSION) - endif() - if(NOT GCC_VERSION VERSION_LESS 3.4) - # note: this is considered buggy prior to 4.0 but the autotools don't care, so let's ignore that fact - set(SUPPORTS_SYMBOL_HIDING TRUE) - set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") - set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - set(SUPPORTS_SYMBOL_HIDING TRUE) - set(_SYMBOL_EXTERN "__global") - set(_CFLAG_SYMBOLS_HIDE "-xldscope=hidden") - elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - # note: this should probably just check for version 9.1.045 but I'm not 100% sure - # so let's to it the same way autotools do. - set(SUPPORTS_SYMBOL_HIDING TRUE) - set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") - set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") - check_c_source_compiles("#include - int main (void) { printf(\"icc fvisibility bug test\"); return 0; }" _no_bug) - if(NOT _no_bug) - set(SUPPORTS_SYMBOL_HIDING FALSE) - set(_SYMBOL_EXTERN "") - set(_CFLAG_SYMBOLS_HIDE "") - endif() - elseif(MSVC) - set(SUPPORTS_SYMBOL_HIDING TRUE) + if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC) + set(SUPPORTS_SYMBOL_HIDING TRUE) + set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") + set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") + elseif(CMAKE_COMPILER_IS_GNUCC) + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + # note: this is considered buggy prior to 4.0 but the autotools don't care, so let's ignore that fact + set(SUPPORTS_SYMBOL_HIDING TRUE) + set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") + set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) + set(SUPPORTS_SYMBOL_HIDING TRUE) + set(_SYMBOL_EXTERN "__global") + set(_CFLAG_SYMBOLS_HIDE "-xldscope=hidden") + elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) + # note: this should probably just check for version 9.1.045 but I'm not 100% sure + # so let's do it the same way autotools do. + set(SUPPORTS_SYMBOL_HIDING TRUE) + set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))") + set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden") + check_c_source_compiles("#include + int main (void) { printf(\"icc fvisibility bug test\"); return 0; }" _no_bug) + if(NOT _no_bug) + set(SUPPORTS_SYMBOL_HIDING FALSE) + set(_SYMBOL_EXTERN "") + set(_CFLAG_SYMBOLS_HIDE "") + endif() + elseif(MSVC) + set(SUPPORTS_SYMBOL_HIDING TRUE) + endif() - set(HIDES_CURL_PRIVATE_SYMBOLS ${SUPPORTS_SYMBOL_HIDING}) + set(HIDES_CURL_PRIVATE_SYMBOLS ${SUPPORTS_SYMBOL_HIDING}) elseif(MSVC) - if(NOT CMAKE_VERSION VERSION_LESS 3.7) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) #present since 3.4.3 but broken - set(HIDES_CURL_PRIVATE_SYMBOLS FALSE) - else() - message(WARNING "Hiding private symbols regardless CURL_HIDDEN_SYMBOLS being disabled.") - set(HIDES_CURL_PRIVATE_SYMBOLS TRUE) - endif() -elseif() + if(NOT CMAKE_VERSION VERSION_LESS 3.7) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) #present since 3.4.3 but broken set(HIDES_CURL_PRIVATE_SYMBOLS FALSE) + else() + message(WARNING "Hiding private symbols regardless CURL_HIDDEN_SYMBOLS being disabled.") + set(HIDES_CURL_PRIVATE_SYMBOLS TRUE) + endif() +else() + set(HIDES_CURL_PRIVATE_SYMBOLS FALSE) endif() set(CURL_CFLAG_SYMBOLS_HIDE ${_CFLAG_SYMBOLS_HIDE}) diff --git a/curl/CMake/CurlTests.c b/curl/CMake/CurlTests.c index bc36c8ef..e418146b 100644 --- a/curl/CMake/CurlTests.c +++ b/curl/CMake/CurlTests.c @@ -5,11 +5,11 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms - * are also available at https://curl.haxx.se/docs/copyright.html. + * are also available at https://curl.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is @@ -71,21 +71,15 @@ main () } #endif -/* tests for gethostbyaddr_r or gethostbyname_r */ -#if defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT) || \ - defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT) || \ - defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT) || \ - defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \ +/* tests for gethostbyname_r */ +#if defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT) # define _REENTRANT /* no idea whether _REENTRANT is always set, just invent a new flag */ # define TEST_GETHOSTBYFOO_REENTRANT #endif -#if defined(HAVE_GETHOSTBYADDR_R_5) || \ - defined(HAVE_GETHOSTBYADDR_R_7) || \ - defined(HAVE_GETHOSTBYADDR_R_8) || \ - defined(HAVE_GETHOSTBYNAME_R_3) || \ +#if defined(HAVE_GETHOSTBYNAME_R_3) || \ defined(HAVE_GETHOSTBYNAME_R_5) || \ defined(HAVE_GETHOSTBYNAME_R_6) || \ defined(TEST_GETHOSTBYFOO_REENTRANT) @@ -98,18 +92,10 @@ int main(void) int type = 0; struct hostent h; int rc = 0; -#if defined(HAVE_GETHOSTBYADDR_R_5) || \ - defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT) || \ - \ - defined(HAVE_GETHOSTBYNAME_R_3) || \ +#if defined(HAVE_GETHOSTBYNAME_R_3) || \ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) struct hostent_data hdata; -#elif defined(HAVE_GETHOSTBYADDR_R_7) || \ - defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT) || \ - defined(HAVE_GETHOSTBYADDR_R_8) || \ - defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT) || \ - \ - defined(HAVE_GETHOSTBYNAME_R_5) || \ +#elif defined(HAVE_GETHOSTBYNAME_R_5) || \ defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \ defined(HAVE_GETHOSTBYNAME_R_6) || \ defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT) @@ -118,22 +104,6 @@ int main(void) struct hostent *hp; #endif -#ifndef gethostbyaddr_r - (void)gethostbyaddr_r; -#endif - -#if defined(HAVE_GETHOSTBYADDR_R_5) || \ - defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT) - rc = gethostbyaddr_r(address, length, type, &h, &hdata); -#elif defined(HAVE_GETHOSTBYADDR_R_7) || \ - defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT) - hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop); - (void)hp; -#elif defined(HAVE_GETHOSTBYADDR_R_8) || \ - defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT) - rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop); -#endif - #if defined(HAVE_GETHOSTBYNAME_R_3) || \ defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) rc = gethostbyname_r(address, &h, &hdata); @@ -212,53 +182,6 @@ if (sizeof (bool *) ) #include int main() { return 0; } #endif -#ifdef RETSIGTYPE_TEST -#include -#include -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - -int -main () -{ - return 0; -} -#endif -#ifdef HAVE_INET_NTOA_R_DECL -#include - -typedef void (*func_type)(); - -int main() -{ -#ifndef inet_ntoa_r - func_type func; - func = (func_type)inet_ntoa_r; -#endif - return 0; -} -#endif -#ifdef HAVE_INET_NTOA_R_DECL_REENTRANT -#define _REENTRANT -#include - -typedef void (*func_type)(); - -int main() -{ -#ifndef inet_ntoa_r - func_type func; - func = (func_type)&inet_ntoa_r; -#endif - return 0; -} -#endif #ifdef HAVE_GETADDRINFO #include #include @@ -375,7 +298,7 @@ main () /* IoctlSocket source code */ long flags = 0; - if(0 != ioctlsocket(0, FIONBIO, &flags)) + if(0 != IoctlSocket(0, FIONBIO, &flags)) return 1; ; return 0; @@ -507,30 +430,30 @@ main () #ifdef HAVE_GLIBC_STRERROR_R #include #include + +void check(char c) {} + int main () { - char buffer[1024]; /* big enough to play with */ - char *string = - strerror_r(EACCES, buffer, sizeof(buffer)); - /* this should've returned a string */ - if(!string || !string[0]) - return 99; - return 0; + char buffer[1024]; + /* This will not compile if strerror_r does not return a char* */ + check(strerror_r(EACCES, buffer, sizeof(buffer))[0]); + return 0; } #endif #ifdef HAVE_POSIX_STRERROR_R #include #include + +/* float, because a pointer can't be implicitly cast to float */ +void check(float f) {} + int main () { - char buffer[1024]; /* big enough to play with */ - int error = - strerror_r(EACCES, buffer, sizeof(buffer)); - /* This should've returned zero, and written an error string in the - buffer.*/ - if(!buffer[0] || error) - return 99; - return 0; + char buffer[1024]; + /* This will not compile if strerror_r does not return an int */ + check(strerror_r(EACCES, buffer, sizeof(buffer))); + return 0; } #endif #ifdef HAVE_FSETXATTR_6 @@ -549,3 +472,65 @@ main() { return 0; } #endif +#ifdef HAVE_CLOCK_GETTIME_MONOTONIC +#include +int +main() { + struct timespec ts = {0, 0}; + clock_gettime(CLOCK_MONOTONIC, &ts); + return 0; +} +#endif +#ifdef HAVE_BUILTIN_AVAILABLE +int +main() { + if(__builtin_available(macOS 10.12, *)) {} + return 0; +} +#endif +#ifdef HAVE_VARIADIC_MACROS_C99 +#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__) +#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__) + +int fun3(int arg1, int arg2, int arg3); +int fun2(int arg1, int arg2); + +int fun3(int arg1, int arg2, int arg3) { + return arg1 + arg2 + arg3; +} +int fun2(int arg1, int arg2) { + return arg1 + arg2; +} + +int +main() { + int res3 = c99_vmacro3(1, 2, 3); + int res2 = c99_vmacro2(1, 2); + (void)res3; + (void)res2; + return 0; +} +#endif +#ifdef HAVE_VARIADIC_MACROS_GCC +#define gcc_vmacro3(first, args...) fun3(first, args) +#define gcc_vmacro2(first, args...) fun2(first, args) + +int fun3(int arg1, int arg2, int arg3); +int fun2(int arg1, int arg2); + +int fun3(int arg1, int arg2, int arg3) { + return arg1 + arg2 + arg3; +} +int fun2(int arg1, int arg2) { + return arg1 + arg2; +} + +int +main() { + int res3 = gcc_vmacro3(1, 2, 3); + int res2 = gcc_vmacro2(1, 2); + (void)res3; + (void)res2; + return 0; +} +#endif diff --git a/curl/CMake/FindBearSSL.cmake b/curl/CMake/FindBearSSL.cmake new file mode 100644 index 00000000..9455f4ba --- /dev/null +++ b/curl/CMake/FindBearSSL.cmake @@ -0,0 +1,30 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +find_path(BEARSSL_INCLUDE_DIRS bearssl.h) + +find_library(BEARSSL_LIBRARY bearssl) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BEARSSL DEFAULT_MSG + BEARSSL_INCLUDE_DIRS BEARSSL_LIBRARY) + +mark_as_advanced(BEARSSL_INCLUDE_DIRS BEARSSL_LIBRARY) diff --git a/curl/CMake/FindBrotli.cmake b/curl/CMake/FindBrotli.cmake new file mode 100644 index 00000000..0ed08550 --- /dev/null +++ b/curl/CMake/FindBrotli.cmake @@ -0,0 +1,41 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +include(FindPackageHandleStandardArgs) + +find_path(BROTLI_INCLUDE_DIR "brotli/decode.h") + +find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon) +find_library(BROTLIDEC_LIBRARY NAMES brotlidec) + +find_package_handle_standard_args(BROTLI + FOUND_VAR + BROTLI_FOUND + REQUIRED_VARS + BROTLIDEC_LIBRARY + BROTLICOMMON_LIBRARY + BROTLI_INCLUDE_DIR + FAIL_MESSAGE + "Could NOT find BROTLI" +) + +set(BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR}) +set(BROTLI_LIBRARIES ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY}) diff --git a/curl/CMake/FindCARES.cmake b/curl/CMake/FindCARES.cmake index c4ab5f13..71806823 100644 --- a/curl/CMake/FindCARES.cmake +++ b/curl/CMake/FindCARES.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # - Find c-ares # Find the c-ares includes and library # This module defines @@ -7,36 +28,18 @@ # also defined, but not for general use are # CARES_LIBRARY, where to find the c-ares library. -FIND_PATH(CARES_INCLUDE_DIR ares.h - /usr/local/include - /usr/include - ) +find_path(CARES_INCLUDE_DIR ares.h) -SET(CARES_NAMES ${CARES_NAMES} cares) -FIND_LIBRARY(CARES_LIBRARY +set(CARES_NAMES ${CARES_NAMES} cares) +find_library(CARES_LIBRARY NAMES ${CARES_NAMES} - PATHS /usr/lib /usr/local/lib ) -IF (CARES_LIBRARY AND CARES_INCLUDE_DIR) - SET(CARES_LIBRARIES ${CARES_LIBRARY}) - SET(CARES_FOUND "YES") -ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR) - SET(CARES_FOUND "NO") -ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR) - - -IF (CARES_FOUND) - IF (NOT CARES_FIND_QUIETLY) - MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}") - ENDIF (NOT CARES_FIND_QUIETLY) -ELSE (CARES_FOUND) - IF (CARES_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find c-ares library") - ENDIF (CARES_FIND_REQUIRED) -ENDIF (CARES_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CARES + REQUIRED_VARS CARES_LIBRARY CARES_INCLUDE_DIR) -MARK_AS_ADVANCED( +mark_as_advanced( CARES_LIBRARY CARES_INCLUDE_DIR ) diff --git a/curl/CMake/FindGSS.cmake b/curl/CMake/FindGSS.cmake index 60dcb73c..4e4747d6 100644 --- a/curl/CMake/FindGSS.cmake +++ b/curl/CMake/FindGSS.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # - Try to find the GSS Kerberos library # Once done this will define # @@ -28,211 +49,213 @@ set(_GSS_ROOT_HINTS # try to find library using system pkg-config if user didn't specify root dir if(NOT GSS_ROOT_DIR AND NOT "$ENV{GSS_ROOT_DIR}") - if(UNIX) - find_package(PkgConfig QUIET) - pkg_search_module(_GSS_PKG ${_MIT_MODNAME} ${_HEIMDAL_MODNAME}) - list(APPEND _GSS_ROOT_HINTS "${_GSS_PKG_PREFIX}") - elseif(WIN32) - list(APPEND _GSS_ROOT_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos;InstallDir]") - endif() + if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(_GSS_PKG ${_MIT_MODNAME} ${_HEIMDAL_MODNAME}) + list(APPEND _GSS_ROOT_HINTS "${_GSS_PKG_PREFIX}") + elseif(WIN32) + list(APPEND _GSS_ROOT_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos;InstallDir]") + endif() endif() if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approach. - find_file(_GSS_CONFIGURE_SCRIPT - NAMES - "krb5-config" - HINTS - ${_GSS_ROOT_HINTS} - PATH_SUFFIXES - bin - NO_CMAKE_PATH - NO_CMAKE_ENVIRONMENT_PATH + find_file(_GSS_CONFIGURE_SCRIPT + NAMES + "krb5-config" + HINTS + ${_GSS_ROOT_HINTS} + PATH_SUFFIXES + bin + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + ) + + # if not found in user-supplied directories, maybe system knows better + find_file(_GSS_CONFIGURE_SCRIPT + NAMES + "krb5-config" + PATH_SUFFIXES + bin + ) + + if(_GSS_CONFIGURE_SCRIPT) + execute_process( + COMMAND ${_GSS_CONFIGURE_SCRIPT} "--cflags" "gssapi" + OUTPUT_VARIABLE _GSS_CFLAGS + RESULT_VARIABLE _GSS_CONFIGURE_FAILED + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + message(STATUS "CFLAGS: ${_GSS_CFLAGS}") + if(NOT _GSS_CONFIGURE_FAILED) # 0 means success + # should also work in an odd case when multiple directories are given + string(STRIP "${_GSS_CFLAGS}" _GSS_CFLAGS) + string(REGEX REPLACE " +-I" ";" _GSS_CFLAGS "${_GSS_CFLAGS}") + string(REGEX REPLACE " +-([^I][^ \\t;]*)" ";-\\1" _GSS_CFLAGS "${_GSS_CFLAGS}") + + foreach(_flag ${_GSS_CFLAGS}) + if(_flag MATCHES "^-I.*") + string(REGEX REPLACE "^-I" "" _val "${_flag}") + list(APPEND _GSS_INCLUDE_DIR "${_val}") + else() + list(APPEND _GSS_COMPILER_FLAGS "${_flag}") + endif() + endforeach() + endif() + + execute_process( + COMMAND ${_GSS_CONFIGURE_SCRIPT} "--libs" "gssapi" + OUTPUT_VARIABLE _GSS_LIB_FLAGS + RESULT_VARIABLE _GSS_CONFIGURE_FAILED + OUTPUT_STRIP_TRAILING_WHITESPACE ) + message(STATUS "LDFLAGS: ${_GSS_LIB_FLAGS}") + + if(NOT _GSS_CONFIGURE_FAILED) # 0 means success + # this script gives us libraries and link directories. Blah. We have to deal with it. + string(STRIP "${_GSS_LIB_FLAGS}" _GSS_LIB_FLAGS) + string(REGEX REPLACE " +-(L|l)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}") + string(REGEX REPLACE " +-([^Ll][^ \\t;]*)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}") + + foreach(_flag ${_GSS_LIB_FLAGS}) + if(_flag MATCHES "^-l.*") + string(REGEX REPLACE "^-l" "" _val "${_flag}") + list(APPEND _GSS_LIBRARIES "${_val}") + elseif(_flag MATCHES "^-L.*") + string(REGEX REPLACE "^-L" "" _val "${_flag}") + list(APPEND _GSS_LINK_DIRECTORIES "${_val}") + else() + list(APPEND _GSS_LINKER_FLAGS "${_flag}") + endif() + endforeach() + endif() - # if not found in user-supplied directories, maybe system knows better - find_file(_GSS_CONFIGURE_SCRIPT - NAMES - "krb5-config" - PATH_SUFFIXES - bin + execute_process( + COMMAND ${_GSS_CONFIGURE_SCRIPT} "--version" + OUTPUT_VARIABLE _GSS_VERSION + RESULT_VARIABLE _GSS_CONFIGURE_FAILED + OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(_GSS_CONFIGURE_SCRIPT) - execute_process( - COMMAND ${_GSS_CONFIGURE_SCRIPT} "--cflags" "gssapi" - OUTPUT_VARIABLE _GSS_CFLAGS - RESULT_VARIABLE _GSS_CONFIGURE_FAILED - ) -message(STATUS "CFLAGS: ${_GSS_CFLAGS}") - if(NOT _GSS_CONFIGURE_FAILED) # 0 means success - # should also work in an odd case when multiple directories are given - string(STRIP "${_GSS_CFLAGS}" _GSS_CFLAGS) - string(REGEX REPLACE " +-I" ";" _GSS_CFLAGS "${_GSS_CFLAGS}") - string(REGEX REPLACE " +-([^I][^ \\t;]*)" ";-\\1"_GSS_CFLAGS "${_GSS_CFLAGS}") - - foreach(_flag ${_GSS_CFLAGS}) - if(_flag MATCHES "^-I.*") - string(REGEX REPLACE "^-I" "" _val "${_flag}") - list(APPEND _GSS_INCLUDE_DIR "${_val}") - else() - list(APPEND _GSS_COMPILER_FLAGS "${_flag}") - endif() - endforeach() - endif() + # older versions may not have the "--version" parameter. In this case we just don't care. + if(_GSS_CONFIGURE_FAILED) + set(_GSS_VERSION 0) + endif() - execute_process( - COMMAND ${_GSS_CONFIGURE_SCRIPT} "--libs" "gssapi" - OUTPUT_VARIABLE _GSS_LIB_FLAGS - RESULT_VARIABLE _GSS_CONFIGURE_FAILED - ) -message(STATUS "LDFLAGS: ${_GSS_LIB_FLAGS}") - if(NOT _GSS_CONFIGURE_FAILED) # 0 means success - # this script gives us libraries and link directories. Blah. We have to deal with it. - string(STRIP "${_GSS_LIB_FLAGS}" _GSS_LIB_FLAGS) - string(REGEX REPLACE " +-(L|l)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}") - string(REGEX REPLACE " +-([^Ll][^ \\t;]*)" ";-\\1"_GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}") - - foreach(_flag ${_GSS_LIB_FLAGS}) - if(_flag MATCHES "^-l.*") - string(REGEX REPLACE "^-l" "" _val "${_flag}") - list(APPEND _GSS_LIBRARIES "${_val}") - elseif(_flag MATCHES "^-L.*") - string(REGEX REPLACE "^-L" "" _val "${_flag}") - list(APPEND _GSS_LINK_DIRECTORIES "${_val}") - else() - list(APPEND _GSS_LINKER_FLAGS "${_flag}") - endif() - endforeach() - endif() + execute_process( + COMMAND ${_GSS_CONFIGURE_SCRIPT} "--vendor" + OUTPUT_VARIABLE _GSS_VENDOR + RESULT_VARIABLE _GSS_CONFIGURE_FAILED + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + # older versions may not have the "--vendor" parameter. In this case we just don't care. + if(_GSS_CONFIGURE_FAILED) + set(GSS_FLAVOUR "Heimdal") # most probably, shouldn't really matter + else() + if(_GSS_VENDOR MATCHES ".*H|heimdal.*") + set(GSS_FLAVOUR "Heimdal") + else() + set(GSS_FLAVOUR "MIT") + endif() + endif() - execute_process( - COMMAND ${_GSS_CONFIGURE_SCRIPT} "--version" - OUTPUT_VARIABLE _GSS_VERSION - RESULT_VARIABLE _GSS_CONFIGURE_FAILED - ) + else() # either there is no config script or we are on a platform that doesn't provide one (Windows?) - # older versions may not have the "--version" parameter. In this case we just don't care. - if(_GSS_CONFIGURE_FAILED) - set(_GSS_VERSION 0) - endif() + find_path(_GSS_INCLUDE_DIR + NAMES + "gssapi/gssapi.h" + HINTS + ${_GSS_ROOT_HINTS} + PATH_SUFFIXES + include + inc + ) + if(_GSS_INCLUDE_DIR) #jay, we've found something + set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIR}") + check_include_files( "gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _GSS_HAVE_MIT_HEADERS) + + if(_GSS_HAVE_MIT_HEADERS) + set(GSS_FLAVOUR "MIT") + else() + # prevent compiling the header - just check if we can include it + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D__ROKEN_H__") + check_include_file( "roken.h" _GSS_HAVE_ROKEN_H) + + check_include_file( "heimdal/roken.h" _GSS_HAVE_HEIMDAL_ROKEN_H) + if(_GSS_HAVE_ROKEN_H OR _GSS_HAVE_HEIMDAL_ROKEN_H) + set(GSS_FLAVOUR "Heimdal") + endif() + set(CMAKE_REQUIRED_DEFINITIONS "") + endif() + else() + # I'm not convinced if this is the right way but this is what autotools do at the moment + find_path(_GSS_INCLUDE_DIR + NAMES + "gssapi.h" + HINTS + ${_GSS_ROOT_HINTS} + PATH_SUFFIXES + include + inc + ) + + if(_GSS_INCLUDE_DIR) + set(GSS_FLAVOUR "Heimdal") + endif() + endif() - execute_process( - COMMAND ${_GSS_CONFIGURE_SCRIPT} "--vendor" - OUTPUT_VARIABLE _GSS_VENDOR - RESULT_VARIABLE _GSS_CONFIGURE_FAILED - ) + # if we have headers, check if we can link libraries + if(GSS_FLAVOUR) + set(_GSS_LIBDIR_SUFFIXES "") + set(_GSS_LIBDIR_HINTS ${_GSS_ROOT_HINTS}) + get_filename_component(_GSS_CALCULATED_POTENTIAL_ROOT "${_GSS_INCLUDE_DIR}" PATH) + list(APPEND _GSS_LIBDIR_HINTS ${_GSS_CALCULATED_POTENTIAL_ROOT}) - # older versions may not have the "--vendor" parameter. In this case we just don't care. - if(_GSS_CONFIGURE_FAILED) - set(GSS_FLAVOUR "Heimdal") # most probably, shouldn't really matter + if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND _GSS_LIBDIR_SUFFIXES "lib/AMD64") + if(GSS_FLAVOUR STREQUAL "MIT") + set(_GSS_LIBNAME "gssapi64") + else() + set(_GSS_LIBNAME "libgssapi") + endif() else() - if(_GSS_VENDOR MATCHES ".*H|heimdal.*") - set(GSS_FLAVOUR "Heimdal") - else() - set(GSS_FLAVOUR "MIT") - endif() + list(APPEND _GSS_LIBDIR_SUFFIXES "lib/i386") + if(GSS_FLAVOUR STREQUAL "MIT") + set(_GSS_LIBNAME "gssapi32") + else() + set(_GSS_LIBNAME "libgssapi") + endif() endif() - - else() # either there is no config script or we are on platform that doesn't provide one (Windows?) - - find_path(_GSS_INCLUDE_DIR - NAMES - "gssapi/gssapi.h" - HINTS - ${_GSS_ROOT_HINTS} - PATH_SUFFIXES - include - inc - ) - - if(_GSS_INCLUDE_DIR) #jay, we've found something - set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIR}") - check_include_files( "gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _GSS_HAVE_MIT_HEADERS) - - if(_GSS_HAVE_MIT_HEADERS) - set(GSS_FLAVOUR "MIT") - else() - # prevent compiling the header - just check if we can include it - set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D__ROKEN_H__") - check_include_file( "roken.h" _GSS_HAVE_ROKEN_H) - - check_include_file( "heimdal/roken.h" _GSS_HAVE_HEIMDAL_ROKEN_H) - if(_GSS_HAVE_ROKEN_H OR _GSS_HAVE_HEIMDAL_ROKEN_H) - set(GSS_FLAVOUR "Heimdal") - endif() - set(CMAKE_REQUIRED_DEFINITIONS "") - endif() + else() + list(APPEND _GSS_LIBDIR_SUFFIXES "lib;lib64") # those suffixes are not checked for HINTS + if(GSS_FLAVOUR STREQUAL "MIT") + set(_GSS_LIBNAME "gssapi_krb5") else() - # I'm not convienced if this is the right way but this is what autotools do at the moment - find_path(_GSS_INCLUDE_DIR - NAMES - "gssapi.h" - HINTS - ${_GSS_ROOT_HINTS} - PATH_SUFFIXES - include - inc - ) - - if(_GSS_INCLUDE_DIR) - set(GSS_FLAVOUR "Heimdal") - endif() + set(_GSS_LIBNAME "gssapi") endif() + endif() - # if we have headers, check if we can link libraries - if(GSS_FLAVOUR) - set(_GSS_LIBDIR_SUFFIXES "") - set(_GSS_LIBDIR_HINTS ${_GSS_ROOT_HINTS}) - get_filename_component(_GSS_CALCULATED_POTENTIAL_ROOT "${_GSS_INCLUDE_DIR}" PATH) - list(APPEND _GSS_LIBDIR_HINTS ${_GSS_CALCULATED_POTENTIAL_ROOT}) - - if(WIN32) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND _GSS_LIBDIR_SUFFIXES "lib/AMD64") - if(GSS_FLAVOUR STREQUAL "MIT") - set(_GSS_LIBNAME "gssapi64") - else() - set(_GSS_LIBNAME "libgssapi") - endif() - else() - list(APPEND _GSS_LIBDIR_SUFFIXES "lib/i386") - if(GSS_FLAVOUR STREQUAL "MIT") - set(_GSS_LIBNAME "gssapi32") - else() - set(_GSS_LIBNAME "libgssapi") - endif() - endif() - else() - list(APPEND _GSS_LIBDIR_SUFFIXES "lib;lib64") # those suffixes are not checked for HINTS - if(GSS_FLAVOUR STREQUAL "MIT") - set(_GSS_LIBNAME "gssapi_krb5") - else() - set(_GSS_LIBNAME "gssapi") - endif() - endif() - - find_library(_GSS_LIBRARIES - NAMES - ${_GSS_LIBNAME} - HINTS - ${_GSS_LIBDIR_HINTS} - PATH_SUFFIXES - ${_GSS_LIBDIR_SUFFIXES} - ) - - endif() + find_library(_GSS_LIBRARIES + NAMES + ${_GSS_LIBNAME} + HINTS + ${_GSS_LIBDIR_HINTS} + PATH_SUFFIXES + ${_GSS_LIBDIR_SUFFIXES} + ) endif() + endif() else() - if(_GSS_PKG_${_MIT_MODNAME}_VERSION) - set(GSS_FLAVOUR "MIT") - set(_GSS_VERSION _GSS_PKG_${_MIT_MODNAME}_VERSION) - else() - set(GSS_FLAVOUR "Heimdal") - set(_GSS_VERSION _GSS_PKG_${_MIT_HEIMDAL}_VERSION) - endif() + if(_GSS_PKG_${_MIT_MODNAME}_VERSION) + set(GSS_FLAVOUR "MIT") + set(_GSS_VERSION _GSS_PKG_${_MIT_MODNAME}_VERSION) + else() + set(GSS_FLAVOUR "Heimdal") + set(_GSS_VERSION _GSS_PKG_${_MIT_HEIMDAL}_VERSION) + endif() endif() set(GSS_INCLUDE_DIR ${_GSS_INCLUDE_DIR}) @@ -243,36 +266,34 @@ set(GSS_COMPILER_FLAGS ${_GSS_COMPILER_FLAGS}) set(GSS_VERSION ${_GSS_VERSION}) if(GSS_FLAVOUR) + if(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "Heimdal") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.amd64.manifest") + else() + set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.x86.manifest") + endif() - if(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "Heimdal") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.amd64.manifest") - else() - set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.x86.manifest") - endif() - - if(EXISTS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}") - file(STRINGS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}" heimdal_version_str - REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$") + if(EXISTS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}") + file(STRINGS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}" heimdal_version_str + REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$") - string(REGEX MATCH "[0-9]\\.[^\"]+" - GSS_VERSION "${heimdal_version_str}") - endif() + string(REGEX MATCH "[0-9]\\.[^\"]+" + GSS_VERSION "${heimdal_version_str}") + endif() - if(NOT GSS_VERSION) - set(GSS_VERSION "Heimdal Unknown") - endif() - elseif(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "MIT") - get_filename_component(_MIT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos\\SDK\\CurrentVersion;VersionString]" NAME CACHE) - if(WIN32 AND _MIT_VERSION) - set(GSS_VERSION "${_MIT_VERSION}") - else() - set(GSS_VERSION "MIT Unknown") - endif() + if(NOT GSS_VERSION) + set(GSS_VERSION "Heimdal Unknown") endif() + elseif(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "MIT") + get_filename_component(_MIT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos\\SDK\\CurrentVersion;VersionString]" NAME CACHE) + if(WIN32 AND _MIT_VERSION) + set(GSS_VERSION "${_MIT_VERSION}") + else() + set(GSS_VERSION "MIT Unknown") + endif() + endif() endif() - include(FindPackageHandleStandardArgs) set(_GSS_REQUIRED_VARS GSS_LIBRARIES GSS_FLAVOUR) diff --git a/curl/CMake/FindLibSSH2.cmake b/curl/CMake/FindLibSSH2.cmake index 12a7c612..ce46a408 100644 --- a/curl/CMake/FindLibSSH2.cmake +++ b/curl/CMake/FindLibSSH2.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # - Try to find the libssh2 library # Once done this will define # @@ -5,31 +26,18 @@ # LIBSSH2_INCLUDE_DIR - the libssh2 include directory # LIBSSH2_LIBRARY - the libssh2 library name -if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) - set(LibSSH2_FIND_QUIETLY TRUE) -endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) +find_path(LIBSSH2_INCLUDE_DIR libssh2.h) -FIND_PATH(LIBSSH2_INCLUDE_DIR libssh2.h -) - -FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2 -) +find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2) if(LIBSSH2_INCLUDE_DIR) - file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*") - - string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MAJOR "${libssh2_version_str}") - string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MINOR "${libssh2_version_str}") - string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_PATCH "${libssh2_version_str}") - - string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MAJOR "${LIBSSH2_VERSION_MAJOR}") - string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MINOR "${LIBSSH2_VERSION_MINOR}") - string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_PATCH "${LIBSSH2_VERSION_PATCH}") - - set(LIBSSH2_VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}") -endif(LIBSSH2_INCLUDE_DIR) + file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION[\t ]+\"(.*)\"") + string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBSSH2_VERSION "${libssh2_version_str}") +endif() include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY ) +find_package_handle_standard_args(LibSSH2 + REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR + VERSION_VAR LIBSSH2_VERSION) -MARK_AS_ADVANCED(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION) +mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY) diff --git a/curl/CMake/FindMbedTLS.cmake b/curl/CMake/FindMbedTLS.cmake index a9163958..1746093d 100644 --- a/curl/CMake/FindMbedTLS.cmake +++ b/curl/CMake/FindMbedTLS.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h) find_library(MBEDTLS_LIBRARY mbedtls) diff --git a/curl/CMake/FindNGHTTP2.cmake b/curl/CMake/FindNGHTTP2.cmake index 4e566cf0..8614492b 100644 --- a/curl/CMake/FindNGHTTP2.cmake +++ b/curl/CMake/FindNGHTTP2.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### include(FindPackageHandleStandardArgs) find_path(NGHTTP2_INCLUDE_DIR "nghttp2/nghttp2.h") @@ -10,9 +31,9 @@ find_package_handle_standard_args(NGHTTP2 REQUIRED_VARS NGHTTP2_LIBRARY NGHTTP2_INCLUDE_DIR - FAIL_MESSAGE - "Could NOT find NGHTTP2" ) -set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR} ) +set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR}) set(NGHTTP2_LIBRARIES ${NGHTTP2_LIBRARY}) + +mark_as_advanced(NGHTTP2_INCLUDE_DIRS NGHTTP2_LIBRARIES) diff --git a/curl/CMake/FindNGHTTP3.cmake b/curl/CMake/FindNGHTTP3.cmake new file mode 100644 index 00000000..643b6009 --- /dev/null +++ b/curl/CMake/FindNGHTTP3.cmake @@ -0,0 +1,76 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +#[=======================================================================[.rst: +FindNGHTTP3 +---------- + +Find the nghttp3 library + +Result Variables +^^^^^^^^^^^^^^^^ + +``NGHTTP3_FOUND`` + System has nghttp3 +``NGHTTP3_INCLUDE_DIRS`` + The nghttp3 include directories. +``NGHTTP3_LIBRARIES`` + The libraries needed to use nghttp3 +``NGHTTP3_VERSION`` + version of nghttp3. +#]=======================================================================] + +if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(PC_NGHTTP3 libnghttp3) +endif() + +find_path(NGHTTP3_INCLUDE_DIR nghttp3/nghttp3.h + HINTS + ${PC_NGHTTP3_INCLUDEDIR} + ${PC_NGHTTP3_INCLUDE_DIRS} +) + +find_library(NGHTTP3_LIBRARY NAMES nghttp3 + HINTS + ${PC_NGHTTP3_LIBDIR} + ${PC_NGHTTP3_LIBRARY_DIRS} +) + +if(PC_NGHTTP3_VERSION) + set(NGHTTP3_VERSION ${PC_NGHTTP3_VERSION}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NGHTTP3 + REQUIRED_VARS + NGHTTP3_LIBRARY + NGHTTP3_INCLUDE_DIR + VERSION_VAR NGHTTP3_VERSION +) + +if(NGHTTP3_FOUND) + set(NGHTTP3_LIBRARIES ${NGHTTP3_LIBRARY}) + set(NGHTTP3_INCLUDE_DIRS ${NGHTTP3_INCLUDE_DIR}) +endif() + +mark_as_advanced(NGHTTP3_INCLUDE_DIRS NGHTTP3_LIBRARIES) diff --git a/curl/CMake/FindNGTCP2.cmake b/curl/CMake/FindNGTCP2.cmake new file mode 100644 index 00000000..5757009a --- /dev/null +++ b/curl/CMake/FindNGTCP2.cmake @@ -0,0 +1,113 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +#[=======================================================================[.rst: +FindNGTCP2 +---------- + +Find the ngtcp2 library + +This module accepts optional COMPONENTS to control the crypto library (these are +mutually exclusive):: + + OpenSSL: Use libngtcp2_crypto_openssl + GnuTLS: Use libngtcp2_crypto_gnutls + +Result Variables +^^^^^^^^^^^^^^^^ + +``NGTCP2_FOUND`` + System has ngtcp2 +``NGTCP2_INCLUDE_DIRS`` + The ngtcp2 include directories. +``NGTCP2_LIBRARIES`` + The libraries needed to use ngtcp2 +``NGTCP2_VERSION`` + version of ngtcp2. +#]=======================================================================] + +if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(PC_NGTCP2 libngtcp2) +endif() + +find_path(NGTCP2_INCLUDE_DIR ngtcp2/ngtcp2.h + HINTS + ${PC_NGTCP2_INCLUDEDIR} + ${PC_NGTCP2_INCLUDE_DIRS} +) + +find_library(NGTCP2_LIBRARY NAMES ngtcp2 + HINTS + ${PC_NGTCP2_LIBDIR} + ${PC_NGTCP2_LIBRARY_DIRS} +) + +if(PC_NGTCP2_VERSION) + set(NGTCP2_VERSION ${PC_NGTCP2_VERSION}) +endif() + +if(NGTCP2_FIND_COMPONENTS) + set(NGTCP2_CRYPTO_BACKEND "") + foreach(component IN LISTS NGTCP2_FIND_COMPONENTS) + if(component MATCHES "^(OpenSSL|GnuTLS)") + if(NGTCP2_CRYPTO_BACKEND) + message(FATAL_ERROR "NGTCP2: Only one crypto library can be selected") + endif() + set(NGTCP2_CRYPTO_BACKEND ${component}) + endif() + endforeach() + + if(NGTCP2_CRYPTO_BACKEND) + string(TOLOWER "ngtcp2_crypto_${NGTCP2_CRYPTO_BACKEND}" _crypto_library) + if(UNIX) + pkg_search_module(PC_${_crypto_library} lib${_crypto_library}) + endif() + find_library(${_crypto_library}_LIBRARY + NAMES + ${_crypto_library} + HINTS + ${PC_${_crypto_library}_LIBDIR} + ${PC_${_crypto_library}_LIBRARY_DIRS} + ) + if(${_crypto_library}_LIBRARY) + set(NGTCP2_${NGTCP2_CRYPTO_BACKEND}_FOUND TRUE) + set(NGTCP2_CRYPTO_LIBRARY ${${_crypto_library}_LIBRARY}) + endif() + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NGTCP2 + REQUIRED_VARS + NGTCP2_LIBRARY + NGTCP2_INCLUDE_DIR + VERSION_VAR NGTCP2_VERSION + HANDLE_COMPONENTS +) + +if(NGTCP2_FOUND) + set(NGTCP2_LIBRARIES ${NGTCP2_LIBRARY} ${NGTCP2_CRYPTO_LIBRARY}) + set(NGTCP2_INCLUDE_DIRS ${NGTCP2_INCLUDE_DIR}) +endif() + +mark_as_advanced(NGTCP2_INCLUDE_DIRS NGTCP2_LIBRARIES) diff --git a/curl/CMake/FindNSS.cmake b/curl/CMake/FindNSS.cmake new file mode 100644 index 00000000..899c6b07 --- /dev/null +++ b/curl/CMake/FindNSS.cmake @@ -0,0 +1,38 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(PC_NSS nss) +endif() +if(NOT PC_NSS_FOUND) + return() +endif() + +set(NSS_LIBRARIES ${PC_NSS_LINK_LIBRARIES}) +set(NSS_INCLUDE_DIRS ${PC_NSS_INCLUDE_DIRS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NSS + REQUIRED_VARS NSS_LIBRARIES NSS_INCLUDE_DIRS + VERSION_VAR PC_NSS_VERSION) + +mark_as_advanced(NSS_INCLUDE_DIRS NSS_LIBRARIES) diff --git a/curl/CMake/FindQUICHE.cmake b/curl/CMake/FindQUICHE.cmake new file mode 100644 index 00000000..0247364d --- /dev/null +++ b/curl/CMake/FindQUICHE.cmake @@ -0,0 +1,68 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +#[=======================================================================[.rst: +FindQUICHE +---------- + +Find the quiche library + +Result Variables +^^^^^^^^^^^^^^^^ + +``QUICHE_FOUND`` + System has quiche +``QUICHE_INCLUDE_DIRS`` + The quiche include directories. +``QUICHE_LIBRARIES`` + The libraries needed to use quiche +#]=======================================================================] +if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(PC_QUICHE quiche) +endif() + +find_path(QUICHE_INCLUDE_DIR quiche.h + HINTS + ${PC_QUICHE_INCLUDEDIR} + ${PC_QUICHE_INCLUDE_DIRS} +) + +find_library(QUICHE_LIBRARY NAMES quiche + HINTS + ${PC_QUICHE_LIBDIR} + ${PC_QUICHE_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(QUICHE + REQUIRED_VARS + QUICHE_LIBRARY + QUICHE_INCLUDE_DIR +) + +if(QUICHE_FOUND) + set(QUICHE_LIBRARIES ${QUICHE_LIBRARY}) + set(QUICHE_INCLUDE_DIRS ${QUICHE_INCLUDE_DIR}) +endif() + +mark_as_advanced(QUICHE_INCLUDE_DIRS QUICHE_LIBRARIES) diff --git a/curl/CMake/FindWolfSSL.cmake b/curl/CMake/FindWolfSSL.cmake new file mode 100644 index 00000000..42256b3c --- /dev/null +++ b/curl/CMake/FindWolfSSL.cmake @@ -0,0 +1,34 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +find_path(WolfSSL_INCLUDE_DIR NAMES wolfssl/ssl.h) +find_library(WolfSSL_LIBRARY NAMES wolfssl) +mark_as_advanced(WolfSSL_INCLUDE_DIR WolfSSL_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WolfSSL + REQUIRED_VARS WolfSSL_INCLUDE_DIR WolfSSL_LIBRARY + ) + +if(WolfSSL_FOUND) + set(WolfSSL_INCLUDE_DIRS ${WolfSSL_INCLUDE_DIR}) + set(WolfSSL_LIBRARIES ${WolfSSL_LIBRARY}) +endif() diff --git a/curl/CMake/FindZstd.cmake b/curl/CMake/FindZstd.cmake new file mode 100644 index 00000000..eaba3974 --- /dev/null +++ b/curl/CMake/FindZstd.cmake @@ -0,0 +1,69 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +#[=======================================================================[.rst: +FindZstd +---------- + +Find the zstd library + +Result Variables +^^^^^^^^^^^^^^^^ + +``Zstd_FOUND`` + System has zstd +``Zstd_INCLUDE_DIRS`` + The zstd include directories. +``Zstd_LIBRARIES`` + The libraries needed to use zstd +#]=======================================================================] + +if(UNIX) + find_package(PkgConfig QUIET) + pkg_search_module(PC_Zstd libzstd) +endif() + +find_path(Zstd_INCLUDE_DIR zstd.h + HINTS + ${PC_Zstd_INCLUDEDIR} + ${PC_Zstd_INCLUDE_DIRS} +) + +find_library(Zstd_LIBRARY NAMES zstd + HINTS + ${PC_Zstd_LIBDIR} + ${PC_Zstd_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Zstd + REQUIRED_VARS + Zstd_LIBRARY + Zstd_INCLUDE_DIR +) + +if(Zstd_FOUND) + set(Zstd_LIBRARIES ${Zstd_LIBRARY}) + set(Zstd_INCLUDE_DIRS ${Zstd_INCLUDE_DIR}) +endif() + +mark_as_advanced(Zstd_INCLUDE_DIRS Zstd_LIBRARIES) diff --git a/curl/CMake/Macros.cmake b/curl/CMake/Macros.cmake index 82aadca9..d57dd6ad 100644 --- a/curl/CMake/Macros.cmake +++ b/curl/CMake/Macros.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### #File defines convenience macros for available feature testing # This macro checks if the symbol exists in the library and if it @@ -5,35 +26,35 @@ # multiple times with a sequence of possibly dependent libraries in # order of least-to-most-dependent. Some libraries depend on others # to link correctly. -macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) +macro(check_library_exists_concat LIBRARY SYMBOL VARIABLE) check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "${CMAKE_LIBRARY_PATH}" ${VARIABLE}) if(${VARIABLE}) set(CURL_LIBS ${LIBRARY} ${CURL_LIBS}) - endif(${VARIABLE}) -endmacro(CHECK_LIBRARY_EXISTS_CONCAT) + endif() +endmacro() # Check if header file exists and add it to the list. # This macro is intended to be called multiple times with a sequence of # possibly dependent header files. Some headers depend on others to be # compiled correctly. -macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) +macro(check_include_file_concat FILE VARIABLE) check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE}) if(${VARIABLE}) set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE}) set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}") - endif(${VARIABLE}) -endmacro(CHECK_INCLUDE_FILE_CONCAT) + endif() +endmacro() # For other curl specific tests, use this macro. -macro(CURL_INTERNAL_TEST CURL_TEST) +macro(curl_internal_test CURL_TEST) if(NOT DEFINED "${CURL_TEST}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) set(CURL_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif(CMAKE_REQUIRED_LIBRARIES) + endif() message(STATUS "Performing Curl Test ${CURL_TEST}") try_compile(${CURL_TEST} @@ -48,53 +69,17 @@ macro(CURL_INTERNAL_TEST CURL_TEST) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing Curl Test ${CURL_TEST} passed with the following output:\n" "${OUTPUT}\n") - else(${CURL_TEST}) + else() message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Curl Test ${CURL_TEST} failed with the following output:\n" "${OUTPUT}\n") - endif(${CURL_TEST}) - endif() -endmacro(CURL_INTERNAL_TEST) - -macro(CURL_INTERNAL_TEST_RUN CURL_TEST) - if(NOT DEFINED "${CURL_TEST}_COMPILE") - set(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") - if(CMAKE_REQUIRED_LIBRARIES) - set(CURL_TEST_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif(CMAKE_REQUIRED_LIBRARIES) - - message(STATUS "Performing Curl Test ${CURL_TEST}") - try_run(${CURL_TEST} ${CURL_TEST}_COMPILE - ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CURL_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT) - if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") - message(STATUS "Performing Curl Test ${CURL_TEST} - Success") - else(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") - set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") - file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "Performing Curl Test ${CURL_TEST} failed with the following output:\n" - "${OUTPUT}") - if(${CURL_TEST}_COMPILE) - file(APPEND - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "There was a problem running this test\n") - endif(${CURL_TEST}_COMPILE) - file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\n\n") - endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) + endif() endif() -endmacro(CURL_INTERNAL_TEST_RUN) +endmacro() -macro(CURL_NROFF_CHECK) +macro(curl_nroff_check) find_program(NROFF NAMES gnroff nroff) if(NROFF) # Need a way to write to stdin, this will do @@ -121,4 +106,15 @@ macro(CURL_NROFF_CHECK) else() message(WARNING "Found no *nroff program") endif() -endmacro(CURL_NROFF_CHECK) +endmacro() + +macro(optional_dependency DEPENDENCY) + set(CURL_${DEPENDENCY} AUTO CACHE STRING "Build curl with ${DEPENDENCY} support (AUTO, ON or OFF)") + set_property(CACHE CURL_${DEPENDENCY} PROPERTY STRINGS AUTO ON OFF) + + if(CURL_${DEPENDENCY} STREQUAL AUTO) + find_package(${DEPENDENCY}) + elseif(CURL_${DEPENDENCY}) + find_package(${DEPENDENCY} REQUIRED) + endif() +endmacro() diff --git a/curl/CMake/OtherTests.cmake b/curl/CMake/OtherTests.cmake index 989f04eb..5cddf4af 100644 --- a/curl/CMake/OtherTests.cmake +++ b/curl/CMake/OtherTests.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### include(CheckCSourceCompiles) # The begin of the sources (macros and includes) set(_source_epilogue "#undef inline") @@ -5,8 +26,8 @@ set(_source_epilogue "#undef inline") macro(add_header_include check header) if(${check}) set(_source_epilogue "${_source_epilogue}\n#include <${header}>") - endif(${check}) -endmacro(add_header_include) + endif() +endmacro() set(signature_call_conv) if(HAVE_WINDOWS_H) @@ -19,10 +40,46 @@ if(HAVE_WINDOWS_H) if(HAVE_LIBWS2_32) set(CMAKE_REQUIRED_LIBRARIES ws2_32) endif() -else(HAVE_WINDOWS_H) +else() add_header_include(HAVE_SYS_TYPES_H "sys/types.h") add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") -endif(HAVE_WINDOWS_H) +endif() + +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +function(curl_cv_func_recv_run_test recv_retv recv_arg1 recv_arg2 recv_arg3 recv_arg4) + unset(curl_cv_func_recv_test CACHE) + check_c_source_compiles(" + ${_source_epilogue} + #ifdef WINSOCK_API_LINKAGE + WINSOCK_API_LINKAGE + #endif + extern ${recv_retv} ${signature_call_conv} + recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4}); + int main(void) { + ${recv_arg1} s=0; + ${recv_arg2} buf=0; + ${recv_arg3} len=0; + ${recv_arg4} flags=0; + ${recv_retv} res = recv(s, buf, len, flags); + (void) res; + return 0; + }" + curl_cv_func_recv_test) + message(STATUS + "Tested: ${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})") + if(curl_cv_func_recv_test) + set(curl_cv_func_recv_args + "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}" PARENT_SCOPE) + set(RECV_TYPE_ARG1 "${recv_arg1}" PARENT_SCOPE) + set(RECV_TYPE_ARG2 "${recv_arg2}" PARENT_SCOPE) + set(RECV_TYPE_ARG3 "${recv_arg3}" PARENT_SCOPE) + set(RECV_TYPE_ARG4 "${recv_arg4}" PARENT_SCOPE) + set(RECV_TYPE_RETV "${recv_retv}" PARENT_SCOPE) + set(HAVE_RECV 1 PARENT_SCOPE) + set(curl_cv_func_recv_done 1 PARENT_SCOPE) + endif() +endfunction() check_c_source_compiles("${_source_epilogue} int main(void) { @@ -30,47 +87,23 @@ int main(void) { return 0; }" curl_cv_recv) if(curl_cv_recv) - if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") + if(NOT DEFINED curl_cv_func_recv_args OR curl_cv_func_recv_args STREQUAL "unknown") + if(APPLE) + curl_cv_func_recv_run_test("ssize_t" "int" "void *" "size_t" "int") + endif() foreach(recv_retv "int" "ssize_t" ) foreach(recv_arg1 "SOCKET" "int" ) foreach(recv_arg2 "char *" "void *" ) foreach(recv_arg3 "int" "size_t" "socklen_t" "unsigned int") foreach(recv_arg4 "int" "unsigned int") if(NOT curl_cv_func_recv_done) - unset(curl_cv_func_recv_test CACHE) - check_c_source_compiles(" - ${_source_epilogue} - extern ${recv_retv} ${signature_call_conv} - recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4}); - int main(void) { - ${recv_arg1} s=0; - ${recv_arg2} buf=0; - ${recv_arg3} len=0; - ${recv_arg4} flags=0; - ${recv_retv} res = recv(s, buf, len, flags); - (void) res; - return 0; - }" - curl_cv_func_recv_test) - message(STATUS - "Tested: ${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})") - if(curl_cv_func_recv_test) - set(curl_cv_func_recv_args - "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}") - set(RECV_TYPE_ARG1 "${recv_arg1}") - set(RECV_TYPE_ARG2 "${recv_arg2}") - set(RECV_TYPE_ARG3 "${recv_arg3}") - set(RECV_TYPE_ARG4 "${recv_arg4}") - set(RECV_TYPE_RETV "${recv_retv}") - set(HAVE_RECV 1) - set(curl_cv_func_recv_done 1) - endif(curl_cv_func_recv_test) - endif(NOT curl_cv_func_recv_done) - endforeach(recv_arg4) - endforeach(recv_arg3) - endforeach(recv_arg2) - endforeach(recv_arg1) - endforeach(recv_retv) + curl_cv_func_recv_run_test(${recv_retv} ${recv_arg1} ${recv_arg2} ${recv_arg3} ${recv_arg4}) + endif() + endforeach() + endforeach() + endforeach() + endforeach() + endforeach() else() string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}") string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}") @@ -79,15 +112,51 @@ if(curl_cv_recv) string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}") endif() - if("${curl_cv_func_recv_args}" STREQUAL "unknown") + if(curl_cv_func_recv_args STREQUAL "unknown") message(FATAL_ERROR "Cannot find proper types to use for recv args") - endif("${curl_cv_func_recv_args}" STREQUAL "unknown") -else(curl_cv_recv) + endif() +else() message(FATAL_ERROR "Unable to link function recv") -endif(curl_cv_recv) +endif() set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv") set(HAVE_RECV 1) +function(curl_cv_func_send_run_test send_retv send_arg1 send_arg2 send_arg3 send_arg4) + unset(curl_cv_func_send_test CACHE) + check_c_source_compiles(" + ${_source_epilogue} + #ifdef WINSOCK_API_LINKAGE + WINSOCK_API_LINKAGE + #endif + extern ${send_retv} ${signature_call_conv} + send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4}); + int main(void) { + ${send_arg1} s=0; + ${send_arg2} buf=0; + ${send_arg3} len=0; + ${send_arg4} flags=0; + ${send_retv} res = send(s, buf, len, flags); + (void) res; + return 0; + }" + curl_cv_func_send_test) + message(STATUS + "Tested: ${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})") + if(curl_cv_func_send_test) + string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}") + string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}") + set(curl_cv_func_send_args + "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}" PARENT_SCOPE) + set(SEND_TYPE_ARG1 "${send_arg1}" PARENT_SCOPE) + set(SEND_TYPE_ARG2 "${send_arg2}" PARENT_SCOPE) + set(SEND_TYPE_ARG3 "${send_arg3}" PARENT_SCOPE) + set(SEND_TYPE_ARG4 "${send_arg4}" PARENT_SCOPE) + set(SEND_TYPE_RETV "${send_retv}" PARENT_SCOPE) + set(HAVE_SEND 1 PARENT_SCOPE) + set(curl_cv_func_send_done 1 PARENT_SCOPE) + endif() +endfunction() + check_c_source_compiles("${_source_epilogue} int main(void) { send(0, 0, 0, 0); @@ -95,48 +164,22 @@ int main(void) { }" curl_cv_send) if(curl_cv_send) if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") + if(APPLE) + curl_cv_func_send_run_test("ssize_t" "int" "const void *" "size_t" "int") + endif() foreach(send_retv "int" "ssize_t" ) foreach(send_arg1 "SOCKET" "int" "ssize_t" ) foreach(send_arg2 "const char *" "const void *" "void *" "char *") foreach(send_arg3 "int" "size_t" "socklen_t" "unsigned int") foreach(send_arg4 "int" "unsigned int") if(NOT curl_cv_func_send_done) - unset(curl_cv_func_send_test CACHE) - check_c_source_compiles(" - ${_source_epilogue} - extern ${send_retv} ${signature_call_conv} - send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4}); - int main(void) { - ${send_arg1} s=0; - ${send_arg2} buf=0; - ${send_arg3} len=0; - ${send_arg4} flags=0; - ${send_retv} res = send(s, buf, len, flags); - (void) res; - return 0; - }" - curl_cv_func_send_test) - message(STATUS - "Tested: ${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})") - if(curl_cv_func_send_test) - string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}") - string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}") - set(curl_cv_func_send_args - "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}") - set(SEND_TYPE_ARG1 "${send_arg1}") - set(SEND_TYPE_ARG2 "${send_arg2}") - set(SEND_TYPE_ARG3 "${send_arg3}") - set(SEND_TYPE_ARG4 "${send_arg4}") - set(SEND_TYPE_RETV "${send_retv}") - set(HAVE_SEND 1) - set(curl_cv_func_send_done 1) - endif(curl_cv_func_send_test) - endif(NOT curl_cv_func_send_done) - endforeach(send_arg4) - endforeach(send_arg3) - endforeach(send_arg2) - endforeach(send_arg1) - endforeach(send_retv) + curl_cv_func_send_run_test("${send_retv}" "${send_arg1}" "${send_arg2}" "${send_arg3}" "${send_arg4}") + endif() + endforeach() + endforeach() + endforeach() + endforeach() + endforeach() else() string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}") string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}") @@ -148,11 +191,11 @@ if(curl_cv_send) if("${curl_cv_func_send_args}" STREQUAL "unknown") message(FATAL_ERROR "Cannot find proper types to use for send args") - endif("${curl_cv_func_send_args}" STREQUAL "unknown") + endif() set(SEND_QUAL_ARG2 "const") -else(curl_cv_send) +else() message(FATAL_ERROR "Unable to link function send") -endif(curl_cv_send) +endif() set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send") set(HAVE_SEND 1) @@ -177,56 +220,68 @@ int main(void) { return 0; }" HAVE_STRUCT_TIMEVAL) - -include(CheckCSourceRuns) -# See HAVE_POLL in CMakeLists.txt for why poll is disabled on macOS -if(NOT APPLE) - set(CMAKE_REQUIRED_FLAGS) - if(HAVE_SYS_POLL_H) - set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H") - endif(HAVE_SYS_POLL_H) - check_c_source_runs(" - #ifdef HAVE_SYS_POLL_H - # include - #endif - int main(void) { - return poll((void *)0, 0, 10 /*ms*/); - }" HAVE_POLL_FINE) -endif() - -set(HAVE_SIG_ATOMIC_T 1) -set(CMAKE_REQUIRED_FLAGS) -if(HAVE_SIGNAL_H) - set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H") - set(CMAKE_EXTRA_INCLUDE_FILES "signal.h") -endif(HAVE_SIGNAL_H) -check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) -if(HAVE_SIZEOF_SIG_ATOMIC_T) - check_c_source_compiles(" - #ifdef HAVE_SIGNAL_H - # include - #endif - int main(void) { - static volatile sig_atomic_t dummy = 0; - (void)dummy; - return 0; - }" HAVE_SIG_ATOMIC_T_NOT_VOLATILE) - if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) - set(HAVE_SIG_ATOMIC_T_VOLATILE 1) - endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) -endif(HAVE_SIZEOF_SIG_ATOMIC_T) - if(HAVE_WINDOWS_H) set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h) else() set(CMAKE_EXTRA_INCLUDE_FILES) if(HAVE_SYS_SOCKET_H) set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) - endif(HAVE_SYS_SOCKET_H) + endif() endif() check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) set(HAVE_STRUCT_SOCKADDR_STORAGE 1) -endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) +endif() + +unset(CMAKE_TRY_COMPILE_TARGET_TYPE) + +if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # only try this on non-macOS + + # if not cross-compilation... + include(CheckCSourceRuns) + set(CMAKE_REQUIRED_FLAGS "") + if(HAVE_SYS_POLL_H) + set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H") + elseif(HAVE_POLL_H) + set(CMAKE_REQUIRED_FLAGS "-DHAVE_POLL_H") + endif() + check_c_source_runs(" + #include + #include + + #ifdef HAVE_SYS_POLL_H + # include + #elif HAVE_POLL_H + # include + #endif + + int main(void) + { + if(0 != poll(0, 0, 10)) { + return 1; /* fail */ + } + else { + /* detect the 10.12 poll() breakage */ + struct timeval before, after; + int rc; + size_t us; + + gettimeofday(&before, NULL); + rc = poll(NULL, 0, 500); + gettimeofday(&after, NULL); + + us = (after.tv_sec - before.tv_sec) * 1000000 + + (after.tv_usec - before.tv_usec); + + if(us < 400000) { + return 1; + } + } + return 0; + }" HAVE_POLL_FINE) + endif() +endif() diff --git a/curl/CMake/Platforms/WindowsCache.cmake b/curl/CMake/Platforms/WindowsCache.cmake index 6fc2991c..fb803f8a 100644 --- a/curl/CMake/Platforms/WindowsCache.cmake +++ b/curl/CMake/Platforms/WindowsCache.cmake @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### if(NOT UNIX) if(WIN32) set(HAVE_LIBDL 0) @@ -7,7 +28,6 @@ if(NOT UNIX) set(HAVE_LIBNSL 0) set(HAVE_GETHOSTNAME 1) set(HAVE_LIBZ 0) - set(HAVE_LIBCRYPTO 0) set(HAVE_DLOPEN 0) @@ -26,7 +46,6 @@ if(NOT UNIX) set(HAVE_PROCESS_H 1) set(HAVE_PWD_H 0) set(HAVE_SETJMP_H 1) - set(HAVE_SGTTY_H 0) set(HAVE_SIGNAL_H 1) set(HAVE_SOCKIO_H 0) set(HAVE_STDINT_H 0) @@ -64,14 +83,8 @@ if(NOT UNIX) set(HAVE_STRCASECMP 0) set(HAVE_STRICMP 1) set(HAVE_STRCMPI 1) - set(HAVE_GETHOSTBYADDR 1) set(HAVE_GETTIMEOFDAY 0) set(HAVE_INET_ADDR 1) - set(HAVE_INET_NTOA 1) - set(HAVE_INET_NTOA_R 0) - set(HAVE_TCGETATTR 0) - set(HAVE_TCSETATTR 0) - set(HAVE_PERROR 1) set(HAVE_CLOSESOCKET 1) set(HAVE_SETVBUF 0) set(HAVE_SIGSETJMP 0) @@ -85,17 +98,10 @@ if(NOT UNIX) set(HAVE_RAND_STATUS 0) set(HAVE_GMTIME_R 0) set(HAVE_LOCALTIME_R 0) - set(HAVE_GETHOSTBYADDR_R 0) set(HAVE_GETHOSTBYNAME_R 0) set(HAVE_SIGNAL_FUNC 1) set(HAVE_SIGNAL_MACRO 0) - set(HAVE_GETHOSTBYADDR_R_5 0) - set(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0) - set(HAVE_GETHOSTBYADDR_R_7 0) - set(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0) - set(HAVE_GETHOSTBYADDR_R_8 0) - set(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0) set(HAVE_GETHOSTBYNAME_R_3 0) set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0) set(HAVE_GETHOSTBYNAME_R_5 0) @@ -106,20 +112,16 @@ if(NOT UNIX) set(TIME_WITH_SYS_TIME 0) set(HAVE_O_NONBLOCK 0) set(HAVE_IN_ADDR_T 0) - set(HAVE_INET_NTOA_R_DECL 0) - set(HAVE_INET_NTOA_R_DECL_REENTRANT 0) if(ENABLE_IPV6) set(HAVE_GETADDRINFO 1) else() set(HAVE_GETADDRINFO 0) endif() set(STDC_HEADERS 1) - set(RETSIGTYPE_TEST 1) set(HAVE_SIGACTION 0) set(HAVE_MACRO_SIGSETJMP 0) - else(WIN32) + else() message("This file should be included on Windows platform only") - endif(WIN32) -endif(NOT UNIX) - + endif() +endif() diff --git a/curl/CMake/Utilities.cmake b/curl/CMake/Utilities.cmake index 8b6276df..8f9b861b 100644 --- a/curl/CMake/Utilities.cmake +++ b/curl/CMake/Utilities.cmake @@ -1,44 +1,33 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # File containing various utilities -# Converts a CMake list to a string containing elements separated by spaces -function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR) - set(NEW_LIST_SPACE) - foreach(ITEM ${${_LIST_NAME}}) - set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}") - endforeach() - string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE) - set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE) -endfunction() - -# Appends a lis of item to a string which is a space-separated list, if they don't already exist. -function(LIST_SPACES_APPEND_ONCE LIST_NAME) - string(REPLACE " " ";" _LIST ${${LIST_NAME}}) - list(APPEND _LIST ${ARGN}) - list(REMOVE_DUPLICATES _LIST) - to_list_spaces(_LIST NEW_LIST_SPACE) - set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE) -endfunction() - -# Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value. -# Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND) -function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL) - list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS) - if(${FIND_POS} EQUAL -1) - set(${RETVAL} FALSE PARENT_SCOPE) - else() - set(${RETVAL} TRUE PARENT_SCOPE) - endif() -endfunction() - # Returns a list of arguments that evaluate to true -function(collect_true output_var output_count_var) - set(${output_var}) +function(count_true output_count_var) + set(lst_len 0) foreach(option_var IN LISTS ARGN) if(${option_var}) - list(APPEND ${output_var} ${option_var}) + math(EXPR lst_len "${lst_len} + 1") endif() endforeach() - set(${output_var} ${${output_var}} PARENT_SCOPE) - list(LENGTH ${output_var} ${output_count_var}) - set(${output_count_var} ${${output_count_var}} PARENT_SCOPE) + set(${output_count_var} ${lst_len} PARENT_SCOPE) endfunction() diff --git a/curl/CMake/cmake_uninstall.cmake.in b/curl/CMake/cmake_uninstall.cmake.in index d00a5166..e96c1432 100644 --- a/curl/CMake/cmake_uninstall.cmake.in +++ b/curl/CMake/cmake_uninstall.cmake.in @@ -1,11 +1,32 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif() -if (NOT DEFINED CMAKE_INSTALL_PREFIX) - set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") -endif () - message(${CMAKE_INSTALL_PREFIX}) +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") +endif() +message(${CMAKE_INSTALL_PREFIX}) file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") @@ -19,8 +40,8 @@ foreach(file ${files}) ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + endif() + else() message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) + endif() +endforeach() diff --git a/curl/CMake/curl-config.cmake.in b/curl/CMake/curl-config.cmake.in new file mode 100644 index 00000000..957148ec --- /dev/null +++ b/curl/CMake/curl-config.cmake.in @@ -0,0 +1,33 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +if(@USE_OPENSSL@) + find_dependency(OpenSSL @OPENSSL_VERSION_MAJOR@) +endif() +if(@USE_ZLIB@) + find_dependency(ZLIB @ZLIB_VERSION_MAJOR@) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/curl/CMakeLists.txt b/curl/CMakeLists.txt index 3bfb5feb..d8084de8 100644 --- a/curl/CMakeLists.txt +++ b/curl/CMakeLists.txt @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -26,7 +26,6 @@ # The output .so file lacks the soname number which we currently have within the lib/Makefile.am file # Add full (4 or 5 libs) SSL support # Add INSTALL target (EXTRA_DIST variables in Makefile.am may be moved to Makefile.inc so that CMake/CPack is aware of what's to include). -# Add CTests(?) # Check on all possible platforms # Test with as many configurations possible (With or without any option) # Create scripts that help keeping the CMake build system up to date (to reduce maintenance). According to Tetetest: @@ -38,26 +37,24 @@ # To check: # (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not. # (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options. -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 3.2...3.16 FATAL_ERROR) + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") include(Utilities) include(Macros) include(CMakeDependentOption) include(CheckCCompilerFlag) -project( CURL C ) - -message(WARNING "the curl cmake build system is poorly maintained. Be aware") +project(CURL C) -file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS) -string (REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" +file(STRINGS ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS REGEX "#define LIBCURL_VERSION( |_NUM )") +string(REGEX MATCH "#define LIBCURL_VERSION \"[^\"]*" CURL_VERSION ${CURL_VERSION_H_CONTENTS}) -string (REGEX REPLACE "[^\"]+\"" "" CURL_VERSION ${CURL_VERSION}) -string (REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+" +string(REGEX REPLACE "[^\"]+\"" "" CURL_VERSION ${CURL_VERSION}) +string(REGEX MATCH "#define LIBCURL_VERSION_NUM 0x[0-9a-fA-F]+" CURL_VERSION_NUM ${CURL_VERSION_H_CONTENTS}) -string (REGEX REPLACE "[^0]+0x" "" CURL_VERSION_NUM ${CURL_VERSION_NUM}) +string(REGEX REPLACE "[^0]+0x" "" CURL_VERSION_NUM ${CURL_VERSION_NUM}) -include_regular_expression("^.*$") # Sukender: Is it necessary? # Setup package meta-data # SET(PACKAGE "curl") @@ -66,24 +63,44 @@ message(STATUS "curl version=[${CURL_VERSION}]") # SET(PACKAGE_NAME "curl") # SET(PACKAGE_VERSION "-") # SET(PACKAGE_STRING "curl-") -# SET(PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.haxx.se/mail/") +# SET(PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.se/mail/") set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}") set(OS "\"${CMAKE_SYSTEM_NAME}\"") -include_directories(${PROJECT_BINARY_DIR}/include/curl) -include_directories( ${CURL_SOURCE_DIR}/include ) +include_directories(${CURL_SOURCE_DIR}/include) option(CURL_WERROR "Turn compiler warnings into errors" OFF) option(PICKY_COMPILER "Enable picky compiler options" ON) option(BUILD_CURL_EXE "Set to ON to build curl executable." ON) -option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF) +option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(ENABLE_ARES "Set to ON to enable c-ares support" OFF) if(WIN32) option(CURL_STATIC_CRT "Set to ON to build libcurl with static CRT on Windows (/MT)." OFF) option(ENABLE_INET_PTON "Set to OFF to prevent usage of inet_pton when building against modern SDKs while still requiring compatibility with older Windows versions, such as Windows XP, Windows Server 2003 etc." ON) + option(ENABLE_UNICODE "Set to ON to use the Unicode version of the Windows API functions" OFF) + set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string") + if(CURL_TARGET_WINDOWS_VERSION) + add_definitions(-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}) + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") + elseif(ENABLE_INET_PTON) + # _WIN32_WINNT_VISTA (0x0600) + add_definitions(-D_WIN32_WINNT=0x0600) + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0600") + else() + # _WIN32_WINNT_WINXP (0x0501) + add_definitions(-D_WIN32_WINNT=0x0501) + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0501") + endif() + if(ENABLE_UNICODE) + add_definitions(-DUNICODE -D_UNICODE) + if(MINGW) + add_compile_options(-municode) + endif() + endif() endif() +option(CURL_LTO "Turn on compiler Link Time Optimizations" OFF) -CMAKE_DEPENDENT_OPTION(ENABLE_THREADED_RESOLVER "Set to ON to enable threaded DNS lookup" +cmake_dependent_option(ENABLE_THREADED_RESOLVER "Set to ON to enable threaded DNS lookup" ON "NOT ENABLE_ARES" OFF) @@ -91,34 +108,42 @@ option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF) option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) - if (PICKY_COMPILER) - foreach (_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wdouble-promotion -Wno-system-headers) + if(PICKY_COMPILER) + foreach(_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wfloat-equal -Wsign-compare -Wundef -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wvla -Wdouble-promotion) # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new # test result in. - CHECK_C_COMPILER_FLAG(${_CCOPT} OPT${_CCOPT}) - if(OPT${_CCOPT}) + string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname) + check_c_compiler_flag(${_CCOPT} ${_optvarname}) + if(${_optvarname}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}") endif() endforeach() - endif(PICKY_COMPILER) -endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + foreach(_CCOPT long-long multichar format-nonliteral sign-conversion system-headers pedantic-ms-format) + # GCC only warns about unknown -Wno- options if there are also other diagnostic messages, + # so test for the positive form instead + string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname) + check_c_compiler_flag("-W${_CCOPT}" ${_optvarname}) + if(${_optvarname}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-${_CCOPT}") + endif() + endforeach() + endif() +endif() -if (ENABLE_DEBUG) +if(ENABLE_DEBUG) # DEBUGBUILD will be defined only for Debug builds - if(NOT CMAKE_VERSION VERSION_LESS 3.0) - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:DEBUGBUILD>) - else() - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUGBUILD) - endif() + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:DEBUGBUILD>) set(ENABLE_CURLDEBUG ON) endif() -if (ENABLE_CURLDEBUG) +if(ENABLE_CURLDEBUG) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CURLDEBUG) endif() # For debug libs and exes, add "-d" postfix -set(CMAKE_DEBUG_POSTFIX "-d" CACHE STRING "Set debug library postfix") +if(NOT DEFINED CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX "-d") +endif() # initialize CURL_LIBS set(CURL_LIBS "") @@ -126,67 +151,100 @@ set(CURL_LIBS "") if(ENABLE_ARES) set(USE_ARES 1) find_package(CARES REQUIRED) - list(APPEND CURL_LIBS ${CARES_LIBRARY} ) - set(CURL_LIBS ${CURL_LIBS} ${CARES_LIBRARY}) + list(APPEND CURL_LIBS ${CARES_LIBRARY}) endif() include(CurlSymbolHiding) -option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF) -mark_as_advanced(HTTP_ONLY) -option(CURL_DISABLE_FTP "disables FTP" OFF) -mark_as_advanced(CURL_DISABLE_FTP) -option(CURL_DISABLE_LDAP "disables LDAP" OFF) -mark_as_advanced(CURL_DISABLE_LDAP) -option(CURL_DISABLE_TELNET "disables Telnet" OFF) -mark_as_advanced(CURL_DISABLE_TELNET) +option(CURL_ENABLE_EXPORT_TARGET "to enable cmake export target" ON) +mark_as_advanced(CURL_ENABLE_EXPORT_TARGET) + +option(CURL_DISABLE_ALTSVC "disables alt-svc support" OFF) +mark_as_advanced(CURL_DISABLE_ALTSVC) +option(CURL_DISABLE_COOKIES "disables cookies support" OFF) +mark_as_advanced(CURL_DISABLE_COOKIES) +option(CURL_DISABLE_CRYPTO_AUTH "disables cryptographic authentication" OFF) +mark_as_advanced(CURL_DISABLE_CRYPTO_AUTH) option(CURL_DISABLE_DICT "disables DICT" OFF) mark_as_advanced(CURL_DISABLE_DICT) +option(CURL_DISABLE_DOH "disables DNS-over-HTTPS" OFF) +mark_as_advanced(CURL_DISABLE_DOH) option(CURL_DISABLE_FILE "disables FILE" OFF) mark_as_advanced(CURL_DISABLE_FILE) -option(CURL_DISABLE_TFTP "disables TFTP" OFF) -mark_as_advanced(CURL_DISABLE_TFTP) +option(CURL_DISABLE_FTP "disables FTP" OFF) +mark_as_advanced(CURL_DISABLE_FTP) +option(CURL_DISABLE_GETOPTIONS "disables curl_easy_options API for existing options to curl_easy_setopt" OFF) +mark_as_advanced(CURL_DISABLE_GETOPTIONS) +option(CURL_DISABLE_GOPHER "disables Gopher" OFF) +mark_as_advanced(CURL_DISABLE_GOPHER) +option(CURL_DISABLE_HSTS "disables HSTS support" OFF) +mark_as_advanced(CURL_DISABLE_HSTS) option(CURL_DISABLE_HTTP "disables HTTP" OFF) mark_as_advanced(CURL_DISABLE_HTTP) - -option(CURL_DISABLE_LDAPS "to disable LDAPS" OFF) +option(CURL_DISABLE_HTTP_AUTH "disables all HTTP authentication methods" OFF) +mark_as_advanced(CURL_DISABLE_HTTP_AUTH) +option(CURL_DISABLE_IMAP "disables IMAP" OFF) +mark_as_advanced(CURL_DISABLE_IMAP) +option(CURL_DISABLE_LDAP "disables LDAP" OFF) +mark_as_advanced(CURL_DISABLE_LDAP) +option(CURL_DISABLE_LDAPS "disables LDAPS" OFF) mark_as_advanced(CURL_DISABLE_LDAPS) - -option(CURL_DISABLE_RTSP "to disable RTSP" OFF) -mark_as_advanced(CURL_DISABLE_RTSP) -option(CURL_DISABLE_PROXY "to disable proxy" OFF) -mark_as_advanced(CURL_DISABLE_PROXY) -option(CURL_DISABLE_POP3 "to disable POP3" OFF) +option(CURL_DISABLE_LIBCURL_OPTION "disables --libcurl option from the curl tool" OFF) +mark_as_advanced(CURL_DISABLE_LIBCURL_OPTION) +option(CURL_DISABLE_MIME "disables MIME support" OFF) +mark_as_advanced(CURL_DISABLE_MIME) +option(CURL_DISABLE_MQTT "disables MQTT" OFF) +mark_as_advanced(CURL_DISABLE_MQTT) +option(CURL_DISABLE_NETRC "disables netrc parser" OFF) +mark_as_advanced(CURL_DISABLE_NETRC) +option(CURL_DISABLE_NTLM "disables NTLM support" OFF) +mark_as_advanced(CURL_DISABLE_NTLM) +option(CURL_DISABLE_PARSEDATE "disables date parsing" OFF) +mark_as_advanced(CURL_DISABLE_PARSEDATE) +option(CURL_DISABLE_POP3 "disables POP3" OFF) mark_as_advanced(CURL_DISABLE_POP3) -option(CURL_DISABLE_IMAP "to disable IMAP" OFF) -mark_as_advanced(CURL_DISABLE_IMAP) -option(CURL_DISABLE_SMTP "to disable SMTP" OFF) +option(CURL_DISABLE_PROGRESS_METER "disables built-in progress meter" OFF) +mark_as_advanced(CURL_DISABLE_PROGRESS_METER) +option(CURL_DISABLE_PROXY "disables proxy support" OFF) +mark_as_advanced(CURL_DISABLE_PROXY) +option(CURL_DISABLE_RTSP "disables RTSP" OFF) +mark_as_advanced(CURL_DISABLE_RTSP) +option(CURL_DISABLE_SHUFFLE_DNS "disables shuffle DNS feature" OFF) +mark_as_advanced(CURL_DISABLE_SHUFFLE_DNS) +option(CURL_DISABLE_SMB "disables SMB" OFF) +mark_as_advanced(CURL_DISABLE_SMB) +option(CURL_DISABLE_SMTP "disables SMTP" OFF) mark_as_advanced(CURL_DISABLE_SMTP) -option(CURL_DISABLE_GOPHER "to disable Gopher" OFF) -mark_as_advanced(CURL_DISABLE_GOPHER) +option(CURL_DISABLE_SOCKETPAIR "disables use of socketpair for curl_multi_poll" OFF) +mark_as_advanced(CURL_DISABLE_SOCKETPAIR) +option(CURL_DISABLE_TELNET "disables Telnet" OFF) +mark_as_advanced(CURL_DISABLE_TELNET) +option(CURL_DISABLE_TFTP "disables TFTP" OFF) +mark_as_advanced(CURL_DISABLE_TFTP) +option(CURL_DISABLE_VERBOSE_STRINGS "disables verbose strings" OFF) +mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS) + +# Corresponds to HTTP_ONLY in lib/curl_setup.h +option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF) +mark_as_advanced(HTTP_ONLY) if(HTTP_ONLY) + set(CURL_DISABLE_DICT ON) + set(CURL_DISABLE_FILE ON) set(CURL_DISABLE_FTP ON) + set(CURL_DISABLE_GOPHER ON) + set(CURL_DISABLE_IMAP ON) set(CURL_DISABLE_LDAP ON) set(CURL_DISABLE_LDAPS ON) - set(CURL_DISABLE_TELNET ON) - set(CURL_DISABLE_DICT ON) - set(CURL_DISABLE_FILE ON) - set(CURL_DISABLE_TFTP ON) - set(CURL_DISABLE_RTSP ON) + set(CURL_DISABLE_MQTT ON) set(CURL_DISABLE_POP3 ON) - set(CURL_DISABLE_IMAP ON) + set(CURL_DISABLE_RTSP ON) + set(CURL_DISABLE_SMB ON) set(CURL_DISABLE_SMTP ON) - set(CURL_DISABLE_GOPHER ON) + set(CURL_DISABLE_TELNET ON) + set(CURL_DISABLE_TFTP ON) endif() -option(CURL_DISABLE_COOKIES "to disable cookies support" OFF) -mark_as_advanced(CURL_DISABLE_COOKIES) - -option(CURL_DISABLE_CRYPTO_AUTH "to disable cryptographic authentication" OFF) -mark_as_advanced(CURL_DISABLE_CRYPTO_AUTH) -option(CURL_DISABLE_VERBOSE_STRINGS "to disable verbose strings" OFF) -mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS) option(ENABLE_IPV6 "Define if you want to enable IPv6 support" ON) mark_as_advanced(ENABLE_IPV6) if(ENABLE_IPV6 AND NOT WIN32) @@ -203,26 +261,22 @@ if(ENABLE_IPV6 AND NOT WIN32) endif() endif() -CURL_NROFF_CHECK() +if(USE_MANUAL) + #nroff is currently only used when USE_MANUAL is set, so we can prevent the warning of no *NROFF if USE_MANUAL is OFF (or not defined), by not even looking for NROFF.. + curl_nroff_check() +endif() find_package(Perl) -CMAKE_DEPENDENT_OPTION(ENABLE_MANUAL "to provide the built-in manual" +cmake_dependent_option(ENABLE_MANUAL "to provide the built-in manual" ON "NROFF_USEFUL;PERL_FOUND" OFF) -if(NOT PERL_FOUND) - message(STATUS "Perl not found, testing disabled.") - set(BUILD_TESTING OFF) -endif() if(ENABLE_MANUAL) set(USE_MANUAL ON) endif() -# We need ansi c-flags, especially on HP -set(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") -set(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS}) - if(CURL_STATIC_CRT) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") endif() @@ -230,38 +284,28 @@ endif() # Disable warnings on Borland to avoid changing 3rd party code. if(BORLAND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") -endif(BORLAND) - -if(CURL_WERROR) - if(MSVC_VERSION) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") - else() - # this assumes clang or gcc style options - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - endif() -endif(CURL_WERROR) +endif() # If we are on AIX, do the _ALL_SOURCE magic if(${CMAKE_SYSTEM_NAME} MATCHES AIX) set(_ALL_SOURCE 1) -endif(${CMAKE_SYSTEM_NAME} MATCHES AIX) +endif() # Include all the necessary files for macros -include (CheckFunctionExists) -include (CheckIncludeFile) -include (CheckIncludeFiles) -include (CheckLibraryExists) -include (CheckSymbolExists) -include (CheckTypeSize) -include (CheckCSourceCompiles) -include (CMakeDependentOption) +include(CMakePushCheckState) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(CheckSymbolExists) +include(CheckTypeSize) +include(CheckCSourceCompiles) # On windows preload settings if(WIN32) set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WINSOCKAPI_=") include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake) -endif(WIN32) +endif() if(ENABLE_THREADED_RESOLVER) find_package(Threads REQUIRED) @@ -275,7 +319,7 @@ if(ENABLE_THREADED_RESOLVER) endif() # Check for all needed libraries -check_library_exists_concat("dl" dlopen HAVE_LIBDL) +check_library_exists_concat("${CMAKE_DL_LIBS}" dlopen HAVE_LIBDL) check_library_exists_concat("socket" connect HAVE_LIBSOCKET) check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL) @@ -284,11 +328,11 @@ if(BEOS) set(NOT_NEED_LIBNSL 1) check_library_exists_concat("bind" gethostbyname HAVE_LIBBIND) check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI) -endif(BEOS) +endif() if(NOT NOT_NEED_LIBNSL) check_library_exists_concat("nsl" gethostbyname HAVE_LIBNSL) -endif(NOT NOT_NEED_LIBNSL) +endif() check_function_exists(gethostname HAVE_GETHOSTNAME) @@ -298,39 +342,48 @@ if(WIN32) endif() # check SSL libraries -# TODO support GNUTLS, NSS, POLARSSL, AXTLS, CYASSL +# TODO support GnuTLS +if(CMAKE_USE_WINSSL) + message(FATAL_ERROR "The cmake option CMAKE_USE_WINSSL was renamed to CMAKE_USE_SCHANNEL.") +endif() if(APPLE) - option(CMAKE_USE_DARWINSSL "enable Apple OS native SSL/TLS" OFF) + option(CMAKE_USE_SECTRANSP "enable Apple OS native SSL/TLS" OFF) endif() if(WIN32) - option(CMAKE_USE_WINSSL "enable Windows native SSL/TLS" OFF) + option(CMAKE_USE_SCHANNEL "enable Windows native SSL/TLS" OFF) cmake_dependent_option(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON - CMAKE_USE_WINSSL OFF) + CMAKE_USE_SCHANNEL OFF) endif() option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF) +option(CMAKE_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF) +option(CMAKE_USE_NSS "Enable NSS for SSL/TLS" OFF) +option(CMAKE_USE_WOLFSSL "enable wolfSSL for SSL/TLS" OFF) set(openssl_default ON) -if(WIN32 OR CMAKE_USE_DARWINSSL OR CMAKE_USE_WINSSL OR CMAKE_USE_MBEDTLS) +if(WIN32 OR CMAKE_USE_SECTRANSP OR CMAKE_USE_SCHANNEL OR CMAKE_USE_MBEDTLS OR CMAKE_USE_NSS OR CMAKE_USE_WOLFSSL) set(openssl_default OFF) endif() option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ${openssl_default}) +option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF) -collect_true(enabled_ssl_options enabled_ssl_options_count - CMAKE_USE_WINSSL - CMAKE_USE_DARWINSSL +count_true(enabled_ssl_options_count + CMAKE_USE_SCHANNEL + CMAKE_USE_SECTRANSP CMAKE_USE_OPENSSL CMAKE_USE_MBEDTLS + CMAKE_USE_BEARSSL + CMAKE_USE_NSS + CMAKE_USE_WOLFSSL ) -if(enabled_ssl_options_count GREATER 1) - message(FATAL_ERROR "Multiple SSL options specified: ${enabled_ssl_options}. Please pick at most one and disable the rest.") +if(enabled_ssl_options_count GREATER "1") + set(CURL_WITH_MULTI_SSL ON) endif() -if(CMAKE_USE_WINSSL) +if(CMAKE_USE_SCHANNEL) set(SSL_ENABLED ON) set(USE_SCHANNEL ON) # Windows native SSL/TLS support - set(USE_WINDOWS_SSPI ON) # CMAKE_USE_WINSSL implies CURL_WINDOWS_SSPI - list(APPEND CURL_LIBS "crypt32") + set(USE_WINDOWS_SSPI ON) # CMAKE_USE_SCHANNEL implies CURL_WINDOWS_SSPI endif() if(CURL_WINDOWS_SSPI) set(USE_WINDOWS_SSPI ON) @@ -338,32 +391,51 @@ if(CURL_WINDOWS_SSPI) endif() if(CMAKE_USE_DARWINSSL) + message(FATAL_ERROR "The cmake option CMAKE_USE_DARWINSSL was renamed to CMAKE_USE_SECTRANSP.") +endif() + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation") if(NOT COREFOUNDATION_FRAMEWORK) message(FATAL_ERROR "CoreFoundation framework not found") endif() - find_library(SECURITY_FRAMEWORK "Security") - if(NOT SECURITY_FRAMEWORK) - message(FATAL_ERROR "Security framework not found") + find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration") + if(NOT SYSTEMCONFIGURATION_FRAMEWORK) + message(FATAL_ERROR "SystemConfiguration framework not found") endif() - set(SSL_ENABLED ON) - set(USE_DARWINSSL ON) - list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}") + list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework SystemConfiguration") + + if(CMAKE_USE_SECTRANSP) + find_library(SECURITY_FRAMEWORK "Security") + if(NOT SECURITY_FRAMEWORK) + message(FATAL_ERROR "Security framework not found") + endif() + + set(SSL_ENABLED ON) + set(USE_SECTRANSP ON) + list(APPEND CURL_LIBS "-framework Security") + endif() endif() if(CMAKE_USE_OPENSSL) find_package(OpenSSL REQUIRED) set(SSL_ENABLED ON) set(USE_OPENSSL ON) - set(HAVE_LIBCRYPTO ON) - set(HAVE_LIBSSL ON) - list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES}) - include_directories(${OPENSSL_INCLUDE_DIR}) + + # Depend on OpenSSL via imported targets if supported by the running + # version of CMake. This allows our dependents to get our dependencies + # transitively. + if(NOT CMAKE_VERSION VERSION_LESS 3.4) + list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto) + else() + list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES}) + include_directories(${OPENSSL_INCLUDE_DIR}) + endif() + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H) - check_include_file("openssl/engine.h" HAVE_OPENSSL_ENGINE_H) check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H) check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H) check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H) @@ -383,6 +455,35 @@ if(CMAKE_USE_MBEDTLS) include_directories(${MBEDTLS_INCLUDE_DIRS}) endif() +if(CMAKE_USE_BEARSSL) + find_package(BearSSL REQUIRED) + set(SSL_ENABLED ON) + set(USE_BEARSSL ON) + list(APPEND CURL_LIBS ${BEARSSL_LIBRARY}) + include_directories(${BEARSSL_INCLUDE_DIRS}) +endif() + +if(CMAKE_USE_WOLFSSL) + find_package(WolfSSL REQUIRED) + set(SSL_ENABLED ON) + set(USE_WOLFSSL ON) + list(APPEND CURL_LIBS ${WolfSSL_LIBRARIES}) + include_directories(${WolfSSL_INCLUDE_DIRS}) +endif() + +if(CMAKE_USE_NSS) + find_package(NSS REQUIRED) + include_directories(${NSS_INCLUDE_DIRS}) + list(APPEND CURL_LIBS ${NSS_LIBRARIES}) + set(SSL_ENABLED ON) + set(USE_NSS ON) + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES ${NSS_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${NSS_LIBRARIES}) + check_symbol_exists(PK11_CreateManagedGenericObject "pk11pub.h" HAVE_PK11_CREATEMANAGEDGENERICOBJECT) + cmake_pop_check_state() +endif() + option(USE_NGHTTP2 "Use Nghttp2 library" OFF) if(USE_NGHTTP2) find_package(NGHTTP2 REQUIRED) @@ -390,6 +491,56 @@ if(USE_NGHTTP2) list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES}) endif() +function(CheckQuicSupportInOpenSSL) + # Be sure that the OpenSSL library actually supports QUIC. + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}") + check_symbol_exists(SSL_CTX_set_quic_method "openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD) + if(NOT HAVE_SSL_CTX_SET_QUIC_METHOD) + message(FATAL_ERROR "QUIC support is missing in OpenSSL/boringssl. Try setting -DOPENSSL_ROOT_DIR") + endif() + cmake_pop_check_state() +endfunction() + +option(USE_NGTCP2 "Use ngtcp2 and nghttp3 libraries for HTTP/3 support" OFF) +if(USE_NGTCP2) + if(USE_OPENSSL) + find_package(NGTCP2 REQUIRED OpenSSL) + CheckQuicSupportInOpenSSL() + elseif(USE_GNUTLS) + # TODO add GnuTLS support as vtls library. + find_package(NGTCP2 REQUIRED GnuTLS) + else() + message(FATAL_ERROR "ngtcp2 requires OpenSSL or GnuTLS") + endif() + set(USE_NGTCP2 ON) + include_directories(${NGTCP2_INCLUDE_DIRS}) + list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES}) + + find_package(NGHTTP3 REQUIRED) + set(USE_NGHTTP3 ON) + include_directories(${NGHTTP3_INCLUDE_DIRS}) + list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES}) +endif() + +option(USE_QUICHE "Use quiche library for HTTP/3 support" OFF) +if(USE_QUICHE) + if(USE_NGTCP2) + message(FATAL_ERROR "Only one HTTP/3 backend can be selected!") + endif() + find_package(QUICHE REQUIRED) + CheckQuicSupportInOpenSSL() + set(USE_QUICHE ON) + include_directories(${QUICHE_INCLUDE_DIRS}) + list(APPEND CURL_LIBS ${QUICHE_LIBRARIES}) + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${QUICHE_LIBRARIES}") + check_symbol_exists(quiche_conn_set_qlog_fd "quiche.h" HAVE_QUICHE_CONN_SET_QLOG_FD) + cmake_pop_check_state() +endif() + if(NOT CURL_DISABLE_LDAP) if(WIN32) option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON) @@ -475,6 +626,7 @@ if(NOT CURL_DISABLE_LDAP) list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_LBER_LIB}) endif() check_c_source_compiles("${_SRC_STRING}" NOT_NEED_LBER_H) + unset(CMAKE_REQUIRED_LIBRARIES) if(NOT_NEED_LBER_H) set(NEED_LBER_H OFF) @@ -483,7 +635,6 @@ if(NOT CURL_DISABLE_LDAP) endif() endif() endif() - endif() # No ldap, no ldaps. @@ -500,24 +651,69 @@ if(NOT CURL_DISABLE_LDAPS) endif() # Check for idn -check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) +option(USE_LIBIDN2 "Use libidn2 for IDN support" ON) +set(HAVE_LIBIDN2 OFF) +if(USE_LIBIDN2) + check_library_exists_concat("idn2" idn2_lookup_ul HAVE_LIBIDN2) +endif() + +if(WIN32) + option(USE_WIN32_IDN "Use WinIDN for IDN support" OFF) + if(USE_WIN32_IDN) + list(APPEND CURL_LIBS "Normaliz") + set(WANT_IDN_PROTOTYPES ON) + endif() +endif() # Check for symbol dlopen (same as HAVE_LIBDL) check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN) -option(CURL_ZLIB "Set to ON to enable building curl with zlib support." ON) set(HAVE_LIBZ OFF) set(HAVE_ZLIB_H OFF) -set(HAVE_ZLIB OFF) -if(CURL_ZLIB) - find_package(ZLIB QUIET) - if(ZLIB_FOUND) - set(HAVE_ZLIB_H ON) - set(HAVE_ZLIB ON) - set(HAVE_LIBZ ON) +set(USE_ZLIB OFF) +optional_dependency(ZLIB) +if(ZLIB_FOUND) + set(HAVE_ZLIB_H ON) + set(HAVE_LIBZ ON) + set(USE_ZLIB ON) + + # Depend on ZLIB via imported targets if supported by the running + # version of CMake. This allows our dependents to get our dependencies + # transitively. + if(NOT CMAKE_VERSION VERSION_LESS 3.4) + list(APPEND CURL_LIBS ZLIB::ZLIB) + else() list(APPEND CURL_LIBS ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIRS}) - list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) + endif() + list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) +endif() + +option(CURL_BROTLI "Set to ON to enable building curl with brotli support." OFF) +set(HAVE_BROTLI OFF) +if(CURL_BROTLI) + find_package(Brotli QUIET) + if(BROTLI_FOUND) + set(HAVE_BROTLI ON) + list(APPEND CURL_LIBS ${BROTLI_LIBRARIES}) + include_directories(${BROTLI_INCLUDE_DIRS}) + list(APPEND CMAKE_REQUIRED_INCLUDES ${BROTLI_INCLUDE_DIRS}) + endif() +endif() + +option(CURL_ZSTD "Set to ON to enable building curl with zstd support." OFF) +set(HAVE_ZSTD OFF) +if(CURL_ZSTD) + find_package(Zstd REQUIRED) + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES ${Zstd_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${Zstd_LIBRARIES}) + check_symbol_exists(ZSTD_createDStream "zstd.h" HAVE_ZSTD_CREATEDSTREAM) + cmake_pop_check_state() + if(Zstd_FOUND AND HAVE_ZSTD_CREATEDSTREAM) + set(HAVE_ZSTD ON) + list(APPEND CURL_LIBS ${Zstd_LIBRARIES}) + include_directories(${Zstd_INCLUDE_DIRS}) endif() endif() @@ -542,18 +738,23 @@ if(CMAKE_USE_LIBSSH2) set(HAVE_LIBSSH2_H ON) set(CURL_INCLUDES ${CURL_INCLUDES} "${LIBSSH2_INCLUDE_DIR}/libssh2.h") set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DHAVE_LIBSSH2_H") + unset(CMAKE_REQUIRED_LIBRARIES) + endif() +endif() - # now check for specific libssh2 symbols as they were added in different versions - set(CMAKE_EXTRA_INCLUDE_FILES "libssh2.h") - check_function_exists(libssh2_version HAVE_LIBSSH2_VERSION) - check_function_exists(libssh2_init HAVE_LIBSSH2_INIT) - check_function_exists(libssh2_exit HAVE_LIBSSH2_EXIT) - check_function_exists(libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64) - check_function_exists(libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE) - set(CMAKE_EXTRA_INCLUDE_FILES "") - - endif(LIBSSH2_FOUND) -endif(CMAKE_USE_LIBSSH2) +# libssh +option(CMAKE_USE_LIBSSH "Use libSSH" OFF) +mark_as_advanced(CMAKE_USE_LIBSSH) +if(NOT HAVE_LIBSSH2 AND CMAKE_USE_LIBSSH) + find_package(libssh CONFIG) + if(libssh_FOUND) + message(STATUS "Found libssh ${libssh_VERSION}") + # Use imported target for include and library paths. + list(APPEND CURL_LIBS ssh) + set(USE_LIBSSH ON) + set(HAVE_LIBSSH_LIBSSH_H 1) + endif() +endif() option(CMAKE_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF) mark_as_advanced(CMAKE_USE_GSSAPI) @@ -566,7 +767,7 @@ if(CMAKE_USE_GSSAPI) message(STATUS "Found ${GSS_FLAVOUR} GSSAPI version: \"${GSS_VERSION}\"") - list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIRECTORIES}) + list(APPEND CMAKE_REQUIRED_INCLUDES ${GSS_INCLUDE_DIR}) check_include_file_concat("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H) check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H) check_include_file_concat("gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H) @@ -599,14 +800,16 @@ if(CMAKE_USE_GSSAPI) if(NOT HAVE_GSS_C_NT_HOSTBASED_SERVICE) set(HAVE_OLD_GSSMIT ON) endif() + unset(CMAKE_REQUIRED_LIBRARIES) endif() - include_directories(${GSS_INCLUDE_DIRECTORIES}) + include_directories(${GSS_INCLUDE_DIR}) link_directories(${GSS_LINK_DIRECTORIES}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_COMPILER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${GSS_LINKER_FLAGS}") list(APPEND CURL_LIBS ${GSS_LIBRARIES}) else() @@ -617,7 +820,11 @@ endif() option(ENABLE_UNIX_SOCKETS "Define if you want Unix domain sockets support" ON) if(ENABLE_UNIX_SOCKETS) include(CheckStructHasMember) - check_struct_has_member("struct sockaddr_un" sun_path "sys/un.h" USE_UNIX_SOCKETS) + if(WIN32) + set(USE_UNIX_SOCKETS ON) + else() + check_struct_has_member("struct sockaddr_un" sun_path "sys/un.h" USE_UNIX_SOCKETS) + endif() else() unset(USE_UNIX_SOCKETS CACHE) endif() @@ -634,77 +841,78 @@ set(CURL_CA_PATH "auto" CACHE STRING "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.") if("${CURL_CA_BUNDLE}" STREQUAL "") - message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.") + message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or file path.") elseif("${CURL_CA_BUNDLE}" STREQUAL "none") - unset(CURL_CA_BUNDLE CACHE) + unset(CURL_CA_BUNDLE CACHE) elseif("${CURL_CA_BUNDLE}" STREQUAL "auto") - unset(CURL_CA_BUNDLE CACHE) - set(CURL_CA_BUNDLE_AUTODETECT TRUE) + unset(CURL_CA_BUNDLE CACHE) + set(CURL_CA_BUNDLE_AUTODETECT TRUE) else() - set(CURL_CA_BUNDLE_SET TRUE) + set(CURL_CA_BUNDLE_SET TRUE) endif() if("${CURL_CA_PATH}" STREQUAL "") - message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or directory path.") + message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or directory path.") elseif("${CURL_CA_PATH}" STREQUAL "none") - unset(CURL_CA_PATH CACHE) + unset(CURL_CA_PATH CACHE) elseif("${CURL_CA_PATH}" STREQUAL "auto") - unset(CURL_CA_PATH CACHE) + unset(CURL_CA_PATH CACHE) + if(NOT USE_NSS) set(CURL_CA_PATH_AUTODETECT TRUE) + endif() else() - set(CURL_CA_PATH_SET TRUE) + set(CURL_CA_PATH_SET TRUE) endif() if(CURL_CA_BUNDLE_SET AND CURL_CA_PATH_AUTODETECT) - # Skip autodetection of unset CA path because CA bundle is set explicitly + # Skip autodetection of unset CA path because CA bundle is set explicitly elseif(CURL_CA_PATH_SET AND CURL_CA_BUNDLE_AUTODETECT) - # Skip autodetection of unset CA bundle because CA path is set explicitly + # Skip autodetection of unset CA bundle because CA path is set explicitly elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT) - # first try autodetecting a CA bundle, then a CA path - - if(CURL_CA_BUNDLE_AUTODETECT) - set(SEARCH_CA_BUNDLE_PATHS - /etc/ssl/certs/ca-certificates.crt - /etc/pki/tls/certs/ca-bundle.crt - /usr/share/ssl/certs/ca-bundle.crt - /usr/local/share/certs/ca-root-nss.crt - /etc/ssl/cert.pem) - - foreach(SEARCH_CA_BUNDLE_PATH ${SEARCH_CA_BUNDLE_PATHS}) - if(EXISTS "${SEARCH_CA_BUNDLE_PATH}") - message(STATUS "Found CA bundle: ${SEARCH_CA_BUNDLE_PATH}") - set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}") - set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set") - break() - endif() - endforeach() - endif() + # first try autodetecting a CA bundle, then a CA path + + if(CURL_CA_BUNDLE_AUTODETECT) + set(SEARCH_CA_BUNDLE_PATHS + /etc/ssl/certs/ca-certificates.crt + /etc/pki/tls/certs/ca-bundle.crt + /usr/share/ssl/certs/ca-bundle.crt + /usr/local/share/certs/ca-root-nss.crt + /etc/ssl/cert.pem) + + foreach(SEARCH_CA_BUNDLE_PATH ${SEARCH_CA_BUNDLE_PATHS}) + if(EXISTS "${SEARCH_CA_BUNDLE_PATH}") + message(STATUS "Found CA bundle: ${SEARCH_CA_BUNDLE_PATH}") + set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}" CACHE STRING + "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.") + set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set") + break() + endif() + endforeach() + endif() - if(CURL_CA_PATH_AUTODETECT AND (NOT CURL_CA_PATH_SET)) - if(EXISTS "/etc/ssl/certs") - set(CURL_CA_PATH "/etc/ssl/certs") - set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set") - endif() + if(CURL_CA_PATH_AUTODETECT AND (NOT CURL_CA_PATH_SET)) + if(EXISTS "/etc/ssl/certs") + set(CURL_CA_PATH "/etc/ssl/certs" CACHE STRING + "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.") + set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set") endif() + endif() endif() if(CURL_CA_PATH_SET AND NOT USE_OPENSSL AND NOT USE_MBEDTLS) - message(FATAL_ERROR - "CA path only supported by OpenSSL, GnuTLS or mbed TLS. " - "Set CURL_CA_PATH=none or enable one of those TLS backends.") + message(STATUS + "CA path only supported by OpenSSL, GnuTLS or mbed TLS. " + "Set CURL_CA_PATH=none or enable one of those TLS backends.") endif() - # Check for header files if(NOT UNIX) check_include_file_concat("windows.h" HAVE_WINDOWS_H) check_include_file_concat("winsock.h" HAVE_WINSOCK_H) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) - if(NOT CURL_WINDOWS_SSPI AND USE_OPENSSL) - set(CURL_LIBS ${CURL_LIBS} "crypt32") - endif() -endif(NOT UNIX) + check_include_file_concat("wincrypt.h" HAVE_WINCRYPT_H) +endif() check_include_file_concat("stdio.h" HAVE_STDIO_H) check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) @@ -727,9 +935,6 @@ check_include_file_concat("alloca.h" HAVE_ALLOCA_H) check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H) check_include_file_concat("arpa/tftp.h" HAVE_ARPA_TFTP_H) check_include_file_concat("assert.h" HAVE_ASSERT_H) -check_include_file_concat("crypto.h" HAVE_CRYPTO_H) -check_include_file_concat("des.h" HAVE_DES_H) -check_include_file_concat("err.h" HAVE_ERR_H) check_include_file_concat("errno.h" HAVE_ERRNO_H) check_include_file_concat("fcntl.h" HAVE_FCNTL_H) check_include_file_concat("idn2.h" HAVE_IDN2_H) @@ -737,19 +942,17 @@ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H) check_include_file_concat("io.h" HAVE_IO_H) check_include_file_concat("krb.h" HAVE_KRB_H) check_include_file_concat("libgen.h" HAVE_LIBGEN_H) -check_include_file_concat("limits.h" HAVE_LIMITS_H) check_include_file_concat("locale.h" HAVE_LOCALE_H) check_include_file_concat("net/if.h" HAVE_NET_IF_H) check_include_file_concat("netdb.h" HAVE_NETDB_H) check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H) check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H) +check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H) check_include_file_concat("pem.h" HAVE_PEM_H) check_include_file_concat("poll.h" HAVE_POLL_H) check_include_file_concat("pwd.h" HAVE_PWD_H) -check_include_file_concat("rsa.h" HAVE_RSA_H) check_include_file_concat("setjmp.h" HAVE_SETJMP_H) -check_include_file_concat("sgtty.h" HAVE_SGTTY_H) check_include_file_concat("signal.h" HAVE_SIGNAL_H) check_include_file_concat("ssl.h" HAVE_SSL_H) check_include_file_concat("stdbool.h" HAVE_STDBOOL_H) @@ -788,17 +991,17 @@ check_type_size("time_t" SIZEOF_TIME_T) if(NOT HAVE_SIZEOF_SSIZE_T) if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) set(ssize_t long) - endif(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) + endif() if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) set(ssize_t __int64) - endif(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) -endif(NOT HAVE_SIZEOF_SSIZE_T) + endif() +endif() # off_t is sized later, after the HAVE_FILE_OFFSET_BITS test if(HAVE_SIZEOF_LONG_LONG) set(HAVE_LONGLONG 1) set(HAVE_LL 1) -endif(HAVE_SIZEOF_LONG_LONG) +endif() find_file(RANDOM_FILE urandom /dev) mark_as_advanced(RANDOM_FILE) @@ -812,12 +1015,8 @@ endif() check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME) check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET) -# poll on macOS is unreliable, it first did not exist, then was broken until -# fixed in 10.9 only to break again in 10.12. -if(NOT APPLE) - check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL) -endif() check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT) +check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL) check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP) check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR) check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R) @@ -830,23 +1029,19 @@ check_symbol_exists(strncmpi "${CURL_INCLUDES}" HAVE_STRNCMPI) check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM) if(NOT HAVE_STRNCMPI) set(HAVE_STRCMPI) -endif(NOT HAVE_STRNCMPI) -check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR) -check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R) +endif() +check_symbol_exists(getppid "${CURL_INCLUDES}" HAVE_GETPPID) +check_symbol_exists(utimes "${CURL_INCLUDES}" HAVE_UTIMES) + check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY) check_symbol_exists(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR) -check_symbol_exists(inet_ntoa "${CURL_INCLUDES}" HAVE_INET_NTOA) -check_symbol_exists(inet_ntoa_r "${CURL_INCLUDES}" HAVE_INET_NTOA_R) -check_symbol_exists(tcsetattr "${CURL_INCLUDES}" HAVE_TCSETATTR) -check_symbol_exists(tcgetattr "${CURL_INCLUDES}" HAVE_TCGETATTR) -check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR) check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET) -check_symbol_exists(setvbuf "${CURL_INCLUDES}" HAVE_SETVBUF) check_symbol_exists(sigsetjmp "${CURL_INCLUDES}" HAVE_SIGSETJMP) check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R) -check_symbol_exists(strlcat "${CURL_INCLUDES}" HAVE_STRLCAT) check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID) +check_symbol_exists(getpwuid_r "${CURL_INCLUDES}" HAVE_GETPWUID_R) check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID) +check_symbol_exists(usleep "${CURL_INCLUDES}" HAVE_USLEEP) check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME) check_symbol_exists(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R) check_symbol_exists(localtime_r "${CURL_INCLUDES}" HAVE_LOCALTIME_R) @@ -858,67 +1053,66 @@ check_symbol_exists(signal "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC) check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO) if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) set(HAVE_SIGNAL 1) -endif(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) +endif() check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME) check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL) check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64) check_symbol_exists(strerror_r "${CURL_INCLUDES}" HAVE_STRERROR_R) check_symbol_exists(siginterrupt "${CURL_INCLUDES}" HAVE_SIGINTERRUPT) -check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR) -check_symbol_exists(fork "${CURL_INCLUDES}" HAVE_FORK) check_symbol_exists(getaddrinfo "${CURL_INCLUDES}" HAVE_GETADDRINFO) check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO) -check_symbol_exists(freeifaddrs "${CURL_INCLUDES}" HAVE_FREEIFADDRS) check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE) check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE) check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME) +check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME) +check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME) +check_symbol_exists(if_nametoindex "${CURL_INCLUDES}" HAVE_IF_NAMETOINDEX) check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT) check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE) +check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE) check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT) check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL) check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL) check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT) - -# symbol exists in win32, but function does not. -if(WIN32) - if(ENABLE_INET_PTON) - check_function_exists(inet_pton HAVE_INET_PTON) - # _WIN32_WINNT_VISTA (0x0600) - add_definitions(-D_WIN32_WINNT=0x0600) - else() - # _WIN32_WINNT_WINXP (0x0501) - add_definitions(-D_WIN32_WINNT=0x0501) - endif() -else() - check_function_exists(inet_pton HAVE_INET_PTON) -endif() +check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME) +check_symbol_exists(inet_pton "${CURL_INCLUDES}" HAVE_INET_PTON) check_symbol_exists(fsetxattr "${CURL_INCLUDES}" HAVE_FSETXATTR) if(HAVE_FSETXATTR) foreach(CURL_TEST HAVE_FSETXATTR_5 HAVE_FSETXATTR_6) - curl_internal_test_run(${CURL_TEST}) - endforeach(CURL_TEST) -endif(HAVE_FSETXATTR) + curl_internal_test(${CURL_TEST}) + endforeach() +endif() + +set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h") +check_type_size("sa_family_t" SIZEOF_SA_FAMILY_T) +set(HAVE_SA_FAMILY_T ${HAVE_SIZEOF_SA_FAMILY_T}) +set(CMAKE_EXTRA_INCLUDE_FILES "") + +set(CMAKE_EXTRA_INCLUDE_FILES "ws2def.h") +check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY) +set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY}) +set(CMAKE_EXTRA_INCLUDE_FILES "") # sigaction and sigsetjmp are special. Use special mechanism for # detecting those, but only if previous attempt failed. if(HAVE_SIGNAL_H) check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) -endif(HAVE_SIGNAL_H) +endif() if(NOT HAVE_SIGSETJMP) if(HAVE_SETJMP_H) check_symbol_exists(sigsetjmp "setjmp.h" HAVE_MACRO_SIGSETJMP) if(HAVE_MACRO_SIGSETJMP) set(HAVE_SIGSETJMP 1) - endif(HAVE_MACRO_SIGSETJMP) - endif(HAVE_SETJMP_H) -endif(NOT HAVE_SIGSETJMP) + endif() + endif() +endif() # If there is no stricmp(), do not allow LDAP to parse URLs if(NOT HAVE_STRICMP) set(HAVE_LDAP_URL_PARSE 1) -endif(NOT HAVE_STRICMP) +endif() # Do curl specific tests foreach(CURL_TEST @@ -933,35 +1127,27 @@ foreach(CURL_TEST HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID TIME_WITH_SYS_TIME HAVE_O_NONBLOCK - HAVE_GETHOSTBYADDR_R_5 - HAVE_GETHOSTBYADDR_R_7 - HAVE_GETHOSTBYADDR_R_8 - HAVE_GETHOSTBYADDR_R_5_REENTRANT - HAVE_GETHOSTBYADDR_R_7_REENTRANT - HAVE_GETHOSTBYADDR_R_8_REENTRANT HAVE_GETHOSTBYNAME_R_3 HAVE_GETHOSTBYNAME_R_5 HAVE_GETHOSTBYNAME_R_6 HAVE_GETHOSTBYNAME_R_3_REENTRANT HAVE_GETHOSTBYNAME_R_5_REENTRANT HAVE_GETHOSTBYNAME_R_6_REENTRANT - HAVE_SOCKLEN_T HAVE_IN_ADDR_T HAVE_BOOL_T STDC_HEADERS - RETSIGTYPE_TEST - HAVE_INET_NTOA_R_DECL - HAVE_INET_NTOA_R_DECL_REENTRANT HAVE_GETADDRINFO HAVE_FILE_OFFSET_BITS + HAVE_VARIADIC_MACROS_C99 + HAVE_VARIADIC_MACROS_GCC ) curl_internal_test(${CURL_TEST}) -endforeach(CURL_TEST) +endforeach() if(HAVE_FILE_OFFSET_BITS) set(_FILE_OFFSET_BITS 64) set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64") -endif(HAVE_FILE_OFFSET_BITS) +endif() check_type_size("off_t" SIZEOF_OFF_T) # include this header to get the type @@ -976,62 +1162,56 @@ foreach(CURL_TEST HAVE_GLIBC_STRERROR_R HAVE_POSIX_STRERROR_R ) - curl_internal_test_run(${CURL_TEST}) -endforeach(CURL_TEST) + curl_internal_test(${CURL_TEST}) +endforeach() # Check for reentrant foreach(CURL_TEST - HAVE_GETHOSTBYADDR_R_5 - HAVE_GETHOSTBYADDR_R_7 - HAVE_GETHOSTBYADDR_R_8 HAVE_GETHOSTBYNAME_R_3 HAVE_GETHOSTBYNAME_R_5 - HAVE_GETHOSTBYNAME_R_6 - HAVE_INET_NTOA_R_DECL_REENTRANT) + HAVE_GETHOSTBYNAME_R_6) if(NOT ${CURL_TEST}) if(${CURL_TEST}_REENTRANT) set(NEED_REENTRANT 1) - endif(${CURL_TEST}_REENTRANT) - endif(NOT ${CURL_TEST}) -endforeach(CURL_TEST) + endif() + endif() +endforeach() if(NEED_REENTRANT) foreach(CURL_TEST - HAVE_GETHOSTBYADDR_R_5 - HAVE_GETHOSTBYADDR_R_7 - HAVE_GETHOSTBYADDR_R_8 HAVE_GETHOSTBYNAME_R_3 HAVE_GETHOSTBYNAME_R_5 HAVE_GETHOSTBYNAME_R_6) set(${CURL_TEST} 0) if(${CURL_TEST}_REENTRANT) set(${CURL_TEST} 1) - endif(${CURL_TEST}_REENTRANT) - endforeach(CURL_TEST) -endif(NEED_REENTRANT) + endif() + endforeach() +endif() + +# Check clock_gettime(CLOCK_MONOTONIC, x) support +curl_internal_test(HAVE_CLOCK_GETTIME_MONOTONIC) -if(HAVE_INET_NTOA_R_DECL_REENTRANT) - set(HAVE_INET_NTOA_R_DECL 1) - set(NEED_REENTRANT 1) -endif(HAVE_INET_NTOA_R_DECL_REENTRANT) +# Check compiler support of __builtin_available() +curl_internal_test(HAVE_BUILTIN_AVAILABLE) # Some other minor tests if(NOT HAVE_IN_ADDR_T) set(in_addr_t "unsigned long") -endif(NOT HAVE_IN_ADDR_T) +endif() # Fix libz / zlib.h if(NOT CURL_SPECIAL_LIBZ) if(NOT HAVE_LIBZ) set(HAVE_ZLIB_H 0) - endif(NOT HAVE_LIBZ) + endif() if(NOT HAVE_ZLIB_H) set(HAVE_LIBZ 0) - endif(NOT HAVE_ZLIB_H) -endif(NOT CURL_SPECIAL_LIBZ) + endif() +endif() # Check for nonblocking set(HAVE_DISABLED_NONBLOCKING 1) @@ -1040,16 +1220,7 @@ if(HAVE_FIONBIO OR HAVE_IOCTLSOCKET_CASE OR HAVE_O_NONBLOCK) set(HAVE_DISABLED_NONBLOCKING) -endif(HAVE_FIONBIO OR - HAVE_IOCTLSOCKET OR - HAVE_IOCTLSOCKET_CASE OR - HAVE_O_NONBLOCK) - -if(RETSIGTYPE_TEST) - set(RETSIGTYPE void) -else(RETSIGTYPE_TEST) - set(RETSIGTYPE int) -endif(RETSIGTYPE_TEST) +endif() if(CMAKE_COMPILER_IS_GNUCC AND APPLE) include(CheckCCompilerFlag) @@ -1059,30 +1230,12 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE) get_source_file_property(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS) if(MPRINTF_COMPILE_FLAGS) set(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double") - else(MPRINTF_COMPILE_FLAGS) + else() set(MPRINTF_COMPILE_FLAGS "-Wno-long-double") - endif(MPRINTF_COMPILE_FLAGS) + endif() set_source_files_properties(mprintf.c PROPERTIES COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS}) - endif(HAVE_C_FLAG_Wno_long_double) -endif(CMAKE_COMPILER_IS_GNUCC AND APPLE) - -if(HAVE_SOCKLEN_T) - set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t") - if(WIN32) - set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h;ws2tcpip.h") - elseif(HAVE_SYS_SOCKET_H) - set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h") endif() - check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T) - set(CMAKE_EXTRA_INCLUDE_FILES) - if(NOT HAVE_CURL_SIZEOF_CURL_SOCKLEN_T) - message(FATAL_ERROR - "Check for sizeof socklen_t failed, see CMakeFiles/CMakerror.log") - endif() -else() - set(CURL_TYPEOF_CURL_SOCKLEN_T int) - set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT}) endif() # TODO test which of these headers are required @@ -1100,22 +1253,72 @@ include(CMake/OtherTests.cmake) add_definitions(-DHAVE_CONFIG_H) -# For windows, all compilers used by cmake should support large files +# For Windows, all compilers used by CMake should support large files if(WIN32) set(USE_WIN32_LARGE_FILES ON) -endif(WIN32) + + # Use the manifest embedded in the Windows Resource + set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST") + + # Check if crypto functions in wincrypt.h are actually available + if(HAVE_WINCRYPT_H) + check_symbol_exists(CryptAcquireContext "${CURL_INCLUDES}" USE_WINCRYPT) + endif() + if(USE_WINCRYPT) + set(USE_WIN32_CRYPTO ON) + endif() + + # Link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL + if(USE_WIN32_CRYPTO OR USE_SCHANNEL) + list(APPEND CURL_LIBS "advapi32" "crypt32") + endif() +endif() if(MSVC) + # Disable default manifest added by CMake + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) if(CMAKE_C_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - else(CMAKE_C_FLAGS MATCHES "/W[0-4]") + else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") - endif(CMAKE_C_FLAGS MATCHES "/W[0-4]") -endif(MSVC) + endif() + + # Use multithreaded compilation on VS 2008+ + if(MSVC_VERSION GREATER_EQUAL 1500) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + endif() +endif() + +if(CURL_WERROR) + if(MSVC_VERSION) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + else() + # this assumes clang or gcc style options + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + endif() +endif() + +if(CURL_LTO) + if(CMAKE_VERSION VERSION_LESS 3.9) + message(FATAL_ERROR "Requested LTO but your cmake version ${CMAKE_VERSION} is to old. You need at least 3.9") + endif() + + cmake_policy(SET CMP0069 NEW) + + include(CheckIPOSupported) + check_ipo_supported(RESULT CURL_HAS_LTO OUTPUT CURL_LTO_ERROR LANGUAGES C) + if(CURL_HAS_LTO) + message(STATUS "LTO supported and enabled") + else() + message(FATAL_ERROR "LTO was requested - but compiler doesn't support it\n${CURL_LTO_ERROR}") + endif() +endif() + # Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it). -function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE) +function(transform_makefile_inc INPUT_FILE OUTPUT_FILE) file(READ ${INPUT_FILE} MAKEFILE_INC_TEXT) string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) @@ -1127,9 +1330,17 @@ function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE) string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${} string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts. file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT}) - + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${INPUT_FILE}") endfunction() +include(GNUInstallDirs) + +set(CURL_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) +set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") +set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") +set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") +set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") + if(USE_MANUAL) add_subdirectory(docs) endif() @@ -1140,36 +1351,46 @@ if(BUILD_CURL_EXE) add_subdirectory(src) endif() -include(CTest) +cmake_dependent_option(BUILD_TESTING "Build tests" + ON "PERL_FOUND;NOT CURL_DISABLE_TESTS" + OFF) if(BUILD_TESTING) add_subdirectory(tests) endif() # Helper to populate a list (_items) with a label when conditions (the remaining # args) are satisfied -function(_add_if label) - # TODO need to disable policy CMP0054 (CMake 3.1) to allow this indirection +macro(_add_if label) + # needs to be a macro to allow this indirection if(${ARGN}) - set(_items ${_items} "${label}" PARENT_SCOPE) + set(_items ${_items} "${label}") endif() -endfunction() +endmacro() + +# NTLM support requires crypto function adaptions from various SSL libs +# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS +if(NOT (CURL_DISABLE_CRYPTO_AUTH OR CURL_DISABLE_NTLM) AND + (USE_OPENSSL OR USE_MBEDTLS OR USE_DARWINSSL OR USE_WIN32_CRYPTO)) + set(use_curl_ntlm_core ON) +endif() # Clear list and try to detect available features set(_items) -_add_if("WinSSL" SSL_ENABLED AND USE_WINDOWS_SSPI) -_add_if("OpenSSL" SSL_ENABLED AND USE_OPENSSL) -_add_if("DarwinSSL" SSL_ENABLED AND USE_DARWINSSL) -_add_if("mbedTLS" SSL_ENABLED AND USE_MBEDTLS) +_add_if("SSL" SSL_ENABLED) _add_if("IPv6" ENABLE_IPV6) -_add_if("unix-sockets" USE_UNIX_SOCKETS) +_add_if("unixsockets" USE_UNIX_SOCKETS) _add_if("libz" HAVE_LIBZ) +_add_if("brotli" HAVE_BROTLI) +_add_if("zstd" HAVE_ZSTD) _add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32) -_add_if("IDN" HAVE_LIBIDN2) -_add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND +_add_if("IDN" HAVE_LIBIDN2 OR USE_WIN32_IDN) +_add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES)) -# TODO SSP1 (WinSSL) check is missing +# TODO SSP1 (Schannel) check is missing _add_if("SSPI" USE_WINDOWS_SSPI) _add_if("GSS-API" HAVE_GSSAPI) +_add_if("alt-svc" NOT CURL_DISABLE_ALTSVC) +_add_if("HSTS" NOT CURL_DISABLE_HSTS) # TODO SSP1 missing for SPNEGO _add_if("SPNEGO" NOT CURL_DISABLE_CRYPTO_AUTH AND (HAVE_GSSAPI OR USE_WINDOWS_SSPI)) @@ -1177,15 +1398,20 @@ _add_if("Kerberos" NOT CURL_DISABLE_CRYPTO_AUTH AND (HAVE_GSSAPI OR USE_WINDOWS_SSPI)) # NTLM support requires crypto function adaptions from various SSL libs # TODO alternative SSL libs tests for SSP1, GNUTLS, NSS -if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_WINDOWS_SSPI OR USE_DARWINSSL OR USE_MBEDTLS)) - _add_if("NTLM" 1) - # TODO missing option (autoconf: --enable-ntlm-wb) - _add_if("NTLM_WB" NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED) -endif() +_add_if("NTLM" NOT (CURL_DISABLE_CRYPTO_AUTH OR CURL_DISABLE_NTLM) AND + (use_curl_ntlm_core OR USE_WINDOWS_SSPI)) +# TODO missing option (autoconf: --enable-ntlm-wb) +_add_if("NTLM_WB" NOT (CURL_DISABLE_CRYPTO_AUTH OR CURL_DISABLE_NTLM) AND + (use_curl_ntlm_core OR USE_WINDOWS_SSPI) AND + NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED) # TODO missing option (--enable-tls-srp), depends on GNUTLS_SRP/OPENSSL_SRP _add_if("TLS-SRP" USE_TLS_SRP) # TODO option --with-nghttp2 tests for nghttp2 lib and nghttp2/nghttp2.h header _add_if("HTTP2" USE_NGHTTP2) +_add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE) +_add_if("MultiSSL" CURL_WITH_MULTI_SSL) +_add_if("HTTPS-proxy" SSL_ENABLED AND (USE_OPENSSL OR USE_GNUTLS OR USE_NSS)) +_add_if("unicode" ENABLE_UNICODE) string(REPLACE ";" " " SUPPORT_FEATURES "${_items}") message(STATUS "Enabled features: ${SUPPORT_FEATURES}") @@ -1206,20 +1432,43 @@ _add_if("LDAPS" NOT CURL_DISABLE_LDAPS AND _add_if("DICT" NOT CURL_DISABLE_DICT) _add_if("TFTP" NOT CURL_DISABLE_TFTP) _add_if("GOPHER" NOT CURL_DISABLE_GOPHER) +_add_if("GOPHERS" NOT CURL_DISABLE_GOPHER AND SSL_ENABLED) _add_if("POP3" NOT CURL_DISABLE_POP3) _add_if("POP3S" NOT CURL_DISABLE_POP3 AND SSL_ENABLED) _add_if("IMAP" NOT CURL_DISABLE_IMAP) _add_if("IMAPS" NOT CURL_DISABLE_IMAP AND SSL_ENABLED) +_add_if("SMB" NOT CURL_DISABLE_SMB AND + use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4)) +_add_if("SMBS" NOT CURL_DISABLE_SMB AND SSL_ENABLED AND + use_curl_ntlm_core AND (SIZEOF_CURL_OFF_T GREATER 4)) _add_if("SMTP" NOT CURL_DISABLE_SMTP) _add_if("SMTPS" NOT CURL_DISABLE_SMTP AND SSL_ENABLED) -_add_if("SCP" USE_LIBSSH2) -_add_if("SFTP" USE_LIBSSH2) +_add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH) +_add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH) _add_if("RTSP" NOT CURL_DISABLE_RTSP) _add_if("RTMP" USE_LIBRTMP) -list(SORT _items) +_add_if("MQTT" NOT CURL_DISABLE_MQTT) +if(_items) + list(SORT _items) +endif() string(REPLACE ";" " " SUPPORT_PROTOCOLS "${_items}") message(STATUS "Enabled protocols: ${SUPPORT_PROTOCOLS}") +# Clear list and collect SSL backends +set(_items) +_add_if("Schannel" SSL_ENABLED AND USE_SCHANNEL) +_add_if("OpenSSL" SSL_ENABLED AND USE_OPENSSL) +_add_if("Secure Transport" SSL_ENABLED AND USE_SECTRANSP) +_add_if("mbedTLS" SSL_ENABLED AND USE_MBEDTLS) +_add_if("BearSSL" SSL_ENABLED AND USE_BEARSSL) +_add_if("NSS" SSL_ENABLED AND USE_NSS) +_add_if("wolfSSL" SSL_ENABLED AND USE_WOLFSSL) +if(_items) + list(SORT _items) +endif() +string(REPLACE ";" " " SSL_BACKENDS "${_items}") +message(STATUS "Enabled SSL backends: ${SSL_BACKENDS}") + # curl-config needs the following options to be set. set(CC "${CMAKE_C_COMPILER}") # TODO probably put a -D... options here? @@ -1227,24 +1476,43 @@ set(CONFIGURE_OPTIONS "") # TODO when to set "-DCURL_STATICLIB" for CPPFLAG_CURL_STATICLIB? set(CPPFLAG_CURL_STATICLIB "") set(CURLVERSION "${CURL_VERSION}") -set(ENABLE_SHARED "yes") -if(CURL_STATICLIB) - set(ENABLE_STATIC "yes") -else() - set(ENABLE_STATIC "no") -endif() set(exec_prefix "\${prefix}") set(includedir "\${prefix}/include") set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}") set(LIBCURL_LIBS "") set(libdir "${CMAKE_INSTALL_PREFIX}/lib") foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS}) + if(TARGET "${_lib}") + set(_libname "${_lib}") + get_target_property(_libtype "${_libname}" TYPE) + if(_libtype STREQUAL INTERFACE_LIBRARY) + # Interface libraries can occur when an external project embeds curl and + # defined targets such as ZLIB::ZLIB by themselves. Ignore these as + # reading the LOCATION property will error out. Assume the user won't need + # this information in the .pc file. + continue() + endif() + get_target_property(_lib "${_libname}" LOCATION) + if(NOT _lib) + message(WARNING "Bad lib in library list: ${_libname}") + continue() + endif() + endif() if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-") set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}") else() set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}") endif() endforeach() +if(BUILD_SHARED_LIBS) + set(ENABLE_SHARED "yes") + set(ENABLE_STATIC "no") + set(LIBCURL_NO_SHARED "") +else() + set(ENABLE_SHARED "no") + set(ENABLE_STATIC "yes") + set(LIBCURL_NO_SHARED "${LIBCURL_LIBS}") +endif() # "a" (Linux) or "lib" (Windows) string(REPLACE "." "" libext "${CMAKE_STATIC_LIBRARY_SUFFIX}") set(prefix "${CMAKE_INSTALL_PREFIX}") @@ -1255,10 +1523,13 @@ set(REQUIRE_LIB_DEPS "no") set(VERSIONNUM "${CURL_VERSION_NUM}") # Finally generate a "curl-config" matching this config +# Use: +# * ENABLE_SHARED +# * ENABLE_STATIC configure_file("${CURL_SOURCE_DIR}/curl-config.in" "${CURL_BINARY_DIR}/curl-config" @ONLY) install(FILES "${CURL_BINARY_DIR}/curl-config" - DESTINATION bin + DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -1268,18 +1539,41 @@ install(FILES "${CURL_BINARY_DIR}/curl-config" configure_file("${CURL_SOURCE_DIR}/libcurl.pc.in" "${CURL_BINARY_DIR}/libcurl.pc" @ONLY) install(FILES "${CURL_BINARY_DIR}/libcurl.pc" - DESTINATION lib/pkgconfig) - -# This needs to be run very last so other parts of the scripts can take advantage of this. -if(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE) - set(CURL_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before") -endif() + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # install headers install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/curl" - DESTINATION include + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h") +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${version_config}" + VERSION ${CURL_VERSION} + COMPATIBILITY SameMajorVersion +) + +# Use: +# * TARGETS_EXPORT_NAME +# * PROJECT_NAME +configure_package_config_file(CMake/curl-config.cmake.in + "${project_config}" + INSTALL_DESTINATION ${CURL_INSTALL_CMAKE_DIR} +) + +if(CURL_ENABLE_EXPORT_TARGET) + install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${PROJECT_NAME}::" + DESTINATION ${CURL_INSTALL_CMAKE_DIR} + ) +endif() + +install( + FILES ${version_config} ${project_config} + DESTINATION ${CURL_INSTALL_CMAKE_DIR} +) + # Workaround for MSVS10 to avoid the Dialog Hell # FIXME: This could be removed with future version of CMake. if(MSVC_VERSION EQUAL 1600) diff --git a/curl/COPYING b/curl/COPYING index 1e45a5e2..48f14475 100644 --- a/curl/COPYING +++ b/curl/COPYING @@ -1,6 +1,6 @@ COPYRIGHT AND PERMISSION NOTICE -Copyright (c) 1996 - 2017, Daniel Stenberg, , and many +Copyright (c) 1996 - 2021, Daniel Stenberg, , and many contributors, see the THANKS file. All rights reserved. diff --git a/curl/GIT-INFO b/curl/GIT-INFO new file mode 100644 index 00000000..1d08d74e --- /dev/null +++ b/curl/GIT-INFO @@ -0,0 +1,44 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +GIT-INFO + +This file is only present in git - never in release archives. It contains +information about other files and things that the git repository keeps in its +inner sanctum. + +To build in environments that support configure, after having extracted +everything from git, do this: + +autoreconf -fi +./configure +make + + Daniel uses a ./configure line similar to this for easier development: + + ./configure --disable-shared --enable-debug --enable-maintainer-mode + +In environments that don't support configure (i.e. Microsoft), do this: + +buildconf.bat + + +REQUIREMENTS + + For buildconf (not buildconf.bat) to work, you need the following software +installed: + + o autoconf 2.57 (or later) + o automake 1.7 (or later) + o libtool 1.4.2 (or later) + o GNU m4 (required by autoconf) + + o nroff + perl + + If you don't have nroff and perl and you for some reason don't want to + install them, you can rename the source file src/tool_hugehelp.c.cvs to + src/tool_hugehelp.c and avoid having to generate this file. This will + give you a stubbed version of the file that doesn't contain actual content. diff --git a/curl/MacOSX-Framework b/curl/MacOSX-Framework index e6badcde..c12fd731 100644 --- a/curl/MacOSX-Framework +++ b/curl/MacOSX-Framework @@ -1,4 +1,25 @@ -#!/bin/bash +#!/usr/bin/env bash +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # This script performs all of the steps needed to build a # universal binary libcurl.framework for Mac OS X 10.4 or greater. # @@ -82,7 +103,7 @@ MINVER64='-mmacosx-version-min='$MACVER64 if test ! -z $SDK32; then echo "----Configuring libcurl for 32 bit universal framework..." make clean - ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \ + ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-secure-transport \ CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32" \ LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 -Wl,-headerpad_max_install_names" \ CC=$CC @@ -111,7 +132,7 @@ if test ! -z $SDK32; then popd make clean echo "----Configuring libcurl for 64 bit universal framework..." - ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \ + ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-secure-transport \ CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64" \ LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 -Wl,-headerpad_max_install_names" \ CC=$CC diff --git a/curl/Makefile b/curl/Makefile index 8577c8a1..1a531c15 100644 --- a/curl/Makefile +++ b/curl/Makefile @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -25,45 +25,9 @@ all: make ssl: - ./configure --with-ssl + ./configure --with-openssl make -borland: - cd lib - $(MAKE) -f Makefile.b32 - cd ..\src - $(MAKE) -f Makefile.b32 - -borland-ssl: - cd lib - $(MAKE) -f Makefile.b32 WITH_SSL=1 - cd ..\src - $(MAKE) -f Makefile.b32 WITH_SSL=1 - -borland-ssl-zlib: - cd lib - $(MAKE) -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1 - cd ..\src - $(MAKE) -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1 - -borland-clean: - cd lib - $(MAKE) -f Makefile.b32 clean - cd ..\src - $(MAKE) -f Makefile.b32 clean - -watcom: .SYMBOLIC - cd lib && $(MAKE) -u -f Makefile.Watcom - cd src && $(MAKE) -u -f Makefile.Watcom - -watcom-clean: .SYMBOLIC - cd lib && $(MAKE) -u -f Makefile.Watcom clean - cd src && $(MAKE) -u -f Makefile.Watcom clean - -watcom-vclean: .SYMBOLIC - cd lib && $(MAKE) -u -f Makefile.Watcom vclean - cd src && $(MAKE) -u -f Makefile.Watcom vclean - mingw32: $(MAKE) -C lib -f Makefile.m32 $(MAKE) -C src -f Makefile.m32 @@ -102,7 +66,7 @@ cygwin: make cygwin-ssl: - ./configure --with-ssl + ./configure --with-openssl make amiga: diff --git a/curl/Makefile.am b/curl/Makefile.am index ab8f11cb..16adc983 100644 --- a/curl/Makefile.am +++ b/curl/Makefile.am @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -24,13 +24,30 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 -CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in \ - CMake/CurlTests.c CMake/FindGSS.cmake CMake/OtherTests.cmake \ - CMake/Platforms/WindowsCache.cmake CMake/Utilities.cmake \ - CMake/Macros.cmake \ - CMake/CurlSymbolHiding.cmake CMake/FindCARES.cmake \ - CMake/FindLibSSH2.cmake CMake/FindNGHTTP2.cmake \ - CMake/FindMbedTLS.cmake CMake/cmake_uninstall.cmake.in +CMAKE_DIST = \ + CMake/cmake_uninstall.cmake.in \ + CMake/CMakeConfigurableFile.in \ + CMake/curl-config.cmake.in \ + CMake/CurlSymbolHiding.cmake \ + CMake/CurlTests.c \ + CMake/FindBearSSL.cmake \ + CMake/FindBrotli.cmake \ + CMake/FindCARES.cmake \ + CMake/FindGSS.cmake \ + CMake/FindLibSSH2.cmake \ + CMake/FindMbedTLS.cmake \ + CMake/FindNGHTTP2.cmake \ + CMake/FindNGHTTP3.cmake \ + CMake/FindNGTCP2.cmake \ + CMake/FindNSS.cmake \ + CMake/FindQUICHE.cmake \ + CMake/FindWolfSSL.cmake \ + CMake/FindZstd.cmake \ + CMake/Macros.cmake \ + CMake/OtherTests.cmake \ + CMake/Platforms/WindowsCache.cmake \ + CMake/Utilities.cmake \ + CMakeLists.txt VC6_LIBTMPL = projects/Windows/VC6/lib/libcurl.tmpl VC6_LIBDSP = projects/Windows/VC6/lib/libcurl.dsp.dist @@ -95,6 +112,13 @@ VC14_SRCTMPL = projects/Windows/VC14/src/curl.tmpl VC14_SRCVCXPROJ = projects/Windows/VC14/src/curl.vcxproj.dist VC14_SRCVCXPROJ_DEPS = $(VC14_SRCTMPL) Makefile.am src/Makefile.inc +VC15_LIBTMPL = projects/Windows/VC15/lib/libcurl.tmpl +VC15_LIBVCXPROJ = projects/Windows/VC15/lib/libcurl.vcxproj.dist +VC15_LIBVCXPROJ_DEPS = $(VC15_LIBTMPL) Makefile.am lib/Makefile.inc +VC15_SRCTMPL = projects/Windows/VC15/src/curl.tmpl +VC15_SRCVCXPROJ = projects/Windows/VC15/src/curl.vcxproj.dist +VC15_SRCVCXPROJ_DEPS = $(VC15_SRCTMPL) Makefile.am src/Makefile.inc + VC_DIST = projects/README \ projects/build-openssl.bat \ projects/build-wolfssl.bat \ @@ -134,23 +158,39 @@ VC_DIST = projects/README \ projects/Windows/VC14/lib/libcurl.vcxproj.filters \ projects/Windows/VC14/src/curl.sln \ projects/Windows/VC14/src/curl.vcxproj.filters \ + projects/Windows/VC15/curl-all.sln \ + projects/Windows/VC15/lib/libcurl.sln \ + projects/Windows/VC15/lib/libcurl.vcxproj.filters \ + projects/Windows/VC15/src/curl.sln \ + projects/Windows/VC15/src/curl.vcxproj.filters \ projects/generate.bat \ projects/wolfssl_options.h \ projects/wolfssl_override.props -WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat \ +WINBUILD_DIST = winbuild/README.md winbuild/gen_resp_file.bat \ winbuild/MakefileBuild.vc winbuild/Makefile.vc -EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ - RELEASE-NOTES buildconf libcurl.pc.in MacOSX-Framework scripts/zsh.pl \ - scripts/updatemanpages.pl $(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) \ - lib/libcurl.vers.in buildconf.bat scripts/coverage.sh - -CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ) \ - $(VC71_LIBVCPROJ) $(VC71_SRCVCPROJ) $(VC8_LIBVCPROJ) $(VC8_SRCVCPROJ) \ - $(VC9_LIBVCPROJ) $(VC9_SRCVCPROJ) $(VC10_LIBVCXPROJ) $(VC10_SRCVCXPROJ) \ - $(VC11_LIBVCXPROJ) $(VC11_SRCVCXPROJ) $(VC12_LIBVCXPROJ) $(VC12_SRCVCXPROJ) \ - $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) +PLAN9_DIST = plan9/include/mkfile \ + plan9/include/mkfile \ + plan9/mkfile.proto \ + plan9/mkfile \ + plan9/README \ + plan9/lib/mkfile.inc \ + plan9/lib/mkfile \ + plan9/src/mkfile.inc \ + plan9/src/mkfile + +EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ + RELEASE-NOTES buildconf libcurl.pc.in MacOSX-Framework \ + scripts/updatemanpages.pl $(CMAKE_DIST) \ + $(VC_DIST) $(WINBUILD_DIST) $(PLAN9_DIST) \ + lib/libcurl.vers.in buildconf.bat scripts/coverage.sh scripts/completion.pl + +CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ) \ + $(VC71_LIBVCPROJ) $(VC71_SRCVCPROJ) $(VC8_LIBVCPROJ) $(VC8_SRCVCPROJ) \ + $(VC9_LIBVCPROJ) $(VC9_SRCVCPROJ) $(VC10_LIBVCXPROJ) $(VC10_SRCVCXPROJ) \ + $(VC11_LIBVCXPROJ) $(VC11_SRCVCXPROJ) $(VC12_LIBVCXPROJ) $(VC12_SRCVCXPROJ) \ + $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) $(VC15_LIBVCXPROJ) $(VC15_SRCVCXPROJ) bin_SCRIPTS = curl-config @@ -216,15 +256,6 @@ examples: check-docs: @(cd docs/libcurl; $(MAKE) check) -# This is a hook to have 'make clean' also clean up the docs and the tests -# dir. The extra check for the Makefiles being present is necessary because -# 'make distcheck' will make clean first in these directories _before_ it runs -# this hook. -clean-local: - @(if test -f tests/Makefile; then cd tests; $(MAKE) clean; fi) - @(if test -f docs/Makefile; then cd docs; $(MAKE) clean; fi) - -# # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros # must contain the following line: # %_topdir /home/loic/local/rpm @@ -274,15 +305,15 @@ cygwinbin: # We extend the standard install with a custom hook: install-data-hook: - cd include && $(MAKE) install - cd docs && $(MAKE) install - cd docs/libcurl && $(MAKE) install + (cd include && $(MAKE) install) + (cd docs && $(MAKE) install) + (cd docs/libcurl && $(MAKE) install) # We extend the standard uninstall with a custom hook: uninstall-hook: - cd include && $(MAKE) uninstall - cd docs && $(MAKE) uninstall - cd docs/libcurl && $(MAKE) uninstall + (cd include && $(MAKE) uninstall) + (cd docs && $(MAKE) uninstall) + (cd docs/libcurl && $(MAKE) uninstall) ca-bundle: lib/mk-ca-bundle.pl @echo "generating a fresh ca-bundle.crt" @@ -293,25 +324,31 @@ ca-firefox: lib/firefox-db2pem.sh ./lib/firefox-db2pem.sh lib/ca-bundle.crt checksrc: - cd lib && $(MAKE) checksrc - cd src && $(MAKE) checksrc - cd tests && $(MAKE) checksrc - cd include/curl && $(MAKE) checksrc - cd docs/examples && $(MAKE) checksrc + (cd lib && $(MAKE) checksrc) + (cd src && $(MAKE) checksrc) + (cd tests && $(MAKE) checksrc) + (cd include/curl && $(MAKE) checksrc) + (cd docs/examples && $(MAKE) checksrc) + (cd packages && $(MAKE) checksrc) .PHONY: vc-ide -vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \ - $(VC7_SRCVCPROJ_DEPS) $(VC71_LIBVCPROJ_DEPS) $(VC71_SRCVCPROJ_DEPS) \ - $(VC8_LIBVCPROJ_DEPS) $(VC8_SRCVCPROJ_DEPS) $(VC9_LIBVCPROJ_DEPS) \ - $(VC9_SRCVCPROJ_DEPS) $(VC10_LIBVCXPROJ_DEPS) $(VC10_SRCVCXPROJ_DEPS) \ - $(VC11_LIBVCXPROJ_DEPS) $(VC11_SRCVCXPROJ_DEPS) $(VC12_LIBVCXPROJ_DEPS) \ - $(VC12_SRCVCXPROJ_DEPS) $(VC14_LIBVCXPROJ_DEPS) $(VC14_SRCVCXPROJ_DEPS) +vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \ + $(VC7_SRCVCPROJ_DEPS) $(VC71_LIBVCPROJ_DEPS) $(VC71_SRCVCPROJ_DEPS) \ + $(VC8_LIBVCPROJ_DEPS) $(VC8_SRCVCPROJ_DEPS) $(VC9_LIBVCPROJ_DEPS) \ + $(VC9_SRCVCPROJ_DEPS) $(VC10_LIBVCXPROJ_DEPS) $(VC10_SRCVCXPROJ_DEPS) \ + $(VC11_LIBVCXPROJ_DEPS) $(VC11_SRCVCXPROJ_DEPS) $(VC12_LIBVCXPROJ_DEPS) \ + $(VC12_SRCVCXPROJ_DEPS) $(VC14_LIBVCXPROJ_DEPS) $(VC14_SRCVCXPROJ_DEPS) \ + $(VC15_LIBVCXPROJ_DEPS) $(VC15_SRCVCXPROJ_DEPS) @(win32_lib_srcs='$(LIB_CFILES)'; \ win32_lib_hdrs='$(LIB_HFILES) config-win32.h'; \ win32_lib_rc='$(LIB_RCFILES)'; \ win32_lib_vauth_srcs='$(LIB_VAUTH_CFILES)'; \ win32_lib_vauth_hdrs='$(LIB_VAUTH_HFILES)'; \ + win32_lib_vquic_srcs='$(LIB_VQUIC_CFILES)'; \ + win32_lib_vquic_hdrs='$(LIB_VQUIC_HFILES)'; \ + win32_lib_vssh_srcs='$(LIB_VSSH_CFILES)'; \ + win32_lib_vssh_hdrs='$(LIB_VSSH_HFILES)'; \ win32_lib_vtls_srcs='$(LIB_VTLS_CFILES)'; \ win32_lib_vtls_hdrs='$(LIB_VTLS_HFILES)'; \ win32_src_srcs='$(CURL_CFILES)'; \ @@ -324,6 +361,10 @@ vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \ sorted_lib_hdrs=`for file in $$win32_lib_hdrs; do echo $$file; done | sort`; \ sorted_lib_vauth_srcs=`for file in $$win32_lib_vauth_srcs; do echo $$file; done | sort`; \ sorted_lib_vauth_hdrs=`for file in $$win32_lib_vauth_hdrs; do echo $$file; done | sort`; \ + sorted_lib_vquic_srcs=`for file in $$win32_lib_vquic_srcs; do echo $$file; done | sort`; \ + sorted_lib_vquic_hdrs=`for file in $$win32_lib_vquic_hdrs; do echo $$file; done | sort`; \ + sorted_lib_vssh_srcs=`for file in $$win32_lib_vssh_srcs; do echo $$file; done | sort`; \ + sorted_lib_vssh_hdrs=`for file in $$win32_lib_vssh_hdrs; do echo $$file; done | sort`; \ sorted_lib_vtls_srcs=`for file in $$win32_lib_vtls_srcs; do echo $$file; done | sort`; \ sorted_lib_vtls_hdrs=`for file in $$win32_lib_vtls_hdrs; do echo $$file; done | sort`; \ sorted_src_srcs=`for file in $$win32_src_srcs; do echo $$file; done | sort`; \ @@ -335,10 +376,15 @@ vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \ function gen_element(type, dir, file)\ {\ sub(/vauth\//, "", file);\ + sub(/vquic\//, "", file);\ + sub(/vssh\//, "", file);\ sub(/vtls\//, "", file);\ \ spaces=" ";\ - if(dir == "lib\\vauth" || dir == "lib\\vtls")\ + if(dir == "lib\\vauth" ||\ + dir == "lib\\vquic" ||\ + dir == "lib\\vssh" ||\ + dir == "lib\\vtls")\ tabs=" ";\ else\ tabs=" ";\ @@ -400,6 +446,22 @@ function gen_element(type, dir, file)\ split(lib_vauth_hdrs, arr);\ for(val in arr) gen_element(proj_type, "lib\\vauth", arr[val]);\ }\ + else if($$0 == "CURL_LIB_VQUIC_C_FILES") {\ + split(lib_vquic_srcs, arr);\ + for(val in arr) gen_element(proj_type, "lib\\vquic", arr[val]);\ + }\ + else if($$0 == "CURL_LIB_VQUIC_H_FILES") {\ + split(lib_vquic_hdrs, arr);\ + for(val in arr) gen_element(proj_type, "lib\\vquic", arr[val]);\ + }\ + else if($$0 == "CURL_LIB_VSSH_C_FILES") {\ + split(lib_vssh_srcs, arr);\ + for(val in arr) gen_element(proj_type, "lib\\vssh", arr[val]);\ + }\ + else if($$0 == "CURL_LIB_VSSH_H_FILES") {\ + split(lib_vssh_hdrs, arr);\ + for(val in arr) gen_element(proj_type, "lib\\vssh", arr[val]);\ + }\ else if($$0 == "CURL_LIB_VTLS_C_FILES") {\ split(lib_vtls_srcs, arr);\ for(val in arr) gen_element(proj_type, "lib\\vtls", arr[val]);\ @@ -445,6 +507,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC6_LIBTMPL) > $(VC6_LIBDSP) || { exit 1; }; \ @@ -465,6 +531,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC7_LIBTMPL) > $(VC7_LIBVCPROJ) || { exit 1; }; \ @@ -485,6 +555,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC71_LIBTMPL) > $(VC71_LIBVCPROJ) || { exit 1; }; \ @@ -505,6 +579,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC8_LIBTMPL) > $(VC8_LIBVCPROJ) || { exit 1; }; \ @@ -525,6 +603,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC9_LIBTMPL) > $(VC9_LIBVCPROJ) || { exit 1; }; \ @@ -545,6 +627,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC10_LIBTMPL) > $(VC10_LIBVCXPROJ) || { exit 1; }; \ @@ -565,6 +651,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC11_LIBTMPL) > $(VC11_LIBVCXPROJ) || { exit 1; }; \ @@ -585,6 +675,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC12_LIBTMPL) > $(VC12_LIBVCXPROJ) || { exit 1; }; \ @@ -605,6 +699,10 @@ function gen_element(type, dir, file)\ -v lib_rc="$$win32_lib_rc" \ -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ "$$awk_code" $(srcdir)/$(VC14_LIBTMPL) > $(VC14_LIBVCXPROJ) || { exit 1; }; \ @@ -616,4 +714,32 @@ function gen_element(type, dir, file)\ -v src_rc="$$win32_src_rc" \ -v src_x_srcs="$$sorted_src_x_srcs" \ -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC14_SRCTMPL) > $(VC14_SRCVCXPROJ) || { exit 1; };) + "$$awk_code" $(srcdir)/$(VC14_SRCTMPL) > $(VC14_SRCVCXPROJ) || { exit 1; }; \ + \ + echo "generating '$(VC15_LIBVCXPROJ)'"; \ + awk -v proj_type=vcxproj \ + -v lib_srcs="$$sorted_lib_srcs" \ + -v lib_hdrs="$$sorted_lib_hdrs" \ + -v lib_rc="$$win32_lib_rc" \ + -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ + -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ + -v lib_vquic_srcs="$$sorted_lib_vquic_srcs" \ + -v lib_vquic_hdrs="$$sorted_lib_vquic_hdrs" \ + -v lib_vssh_srcs="$$sorted_lib_vssh_srcs" \ + -v lib_vssh_hdrs="$$sorted_lib_vssh_hdrs" \ + -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ + -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ + "$$awk_code" $(srcdir)/$(VC15_LIBTMPL) > $(VC15_LIBVCXPROJ) || { exit 1; }; \ + \ + echo "generating '$(VC15_SRCVCXPROJ)'"; \ + awk -v proj_type=vcxproj \ + -v src_srcs="$$sorted_src_srcs" \ + -v src_hdrs="$$sorted_src_hdrs" \ + -v src_rc="$$win32_src_rc" \ + -v src_x_srcs="$$sorted_src_x_srcs" \ + -v src_x_hdrs="$$sorted_src_x_hdrs" \ + "$$awk_code" $(srcdir)/$(VC15_SRCTMPL) > $(VC15_SRCVCXPROJ) || { exit 1; };) + +tidy: + (cd src && $(MAKE) tidy) + (cd lib && $(MAKE) tidy) diff --git a/curl/Makefile.dist b/curl/Makefile.dist new file mode 100644 index 00000000..1a531c15 --- /dev/null +++ b/curl/Makefile.dist @@ -0,0 +1,115 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +all: + ./configure + make + +ssl: + ./configure --with-openssl + make + +mingw32: + $(MAKE) -C lib -f Makefile.m32 + $(MAKE) -C src -f Makefile.m32 + +mingw32-clean: + $(MAKE) -C lib -f Makefile.m32 clean + $(MAKE) -C src -f Makefile.m32 clean + $(MAKE) -C docs/examples -f Makefile.m32 clean + +mingw32-vclean mingw32-distclean: + $(MAKE) -C lib -f Makefile.m32 vclean + $(MAKE) -C src -f Makefile.m32 vclean + $(MAKE) -C docs/examples -f Makefile.m32 vclean + +mingw32-examples%: + $(MAKE) -C docs/examples -f Makefile.m32 CFG=$@ + +mingw32%: + $(MAKE) -C lib -f Makefile.m32 CFG=$@ + $(MAKE) -C src -f Makefile.m32 CFG=$@ + +vc: + cd winbuild + nmake /f Makefile.vc MACHINE=x86 + +vc-x64: + cd winbuild + nmake /f Makefile.vc MACHINE=x64 + +djgpp: + $(MAKE) -C lib -f Makefile.dj + $(MAKE) -C src -f Makefile.dj + +cygwin: + ./configure + make + +cygwin-ssl: + ./configure --with-openssl + make + +amiga: + cd ./lib && make -f makefile.amiga + cd ./src && make -f makefile.amiga + +netware: + $(MAKE) -C lib -f Makefile.netware + $(MAKE) -C src -f Makefile.netware + +netware-clean: + $(MAKE) -C lib -f Makefile.netware clean + $(MAKE) -C src -f Makefile.netware clean + $(MAKE) -C docs/examples -f Makefile.netware clean + +netware-vclean netware-distclean: + $(MAKE) -C lib -f Makefile.netware vclean + $(MAKE) -C src -f Makefile.netware vclean + $(MAKE) -C docs/examples -f Makefile.netware vclean + +netware-install: + $(MAKE) -C lib -f Makefile.netware install + $(MAKE) -C src -f Makefile.netware install + +netware-examples-%: + $(MAKE) -C docs/examples -f Makefile.netware CFG=$@ + +netware-%: + $(MAKE) -C lib -f Makefile.netware CFG=$@ + $(MAKE) -C src -f Makefile.netware CFG=$@ + +unix: all + +unix-ssl: ssl + +linux: all + +linux-ssl: ssl + +ca-bundle: lib/mk-ca-bundle.pl + @echo "generate a fresh ca-bundle.crt" + @perl $< -b -l -u lib/ca-bundle.crt + +ca-firefox: lib/firefox-db2pem.sh + @echo "generate a fresh ca-bundle.crt" + ./lib/firefox-db2pem.sh lib/ca-bundle.crt diff --git a/curl/Makefile.in b/curl/Makefile.in deleted file mode 100644 index 711e7015..00000000 --- a/curl/Makefile.in +++ /dev/null @@ -1,1780 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# ./src/Makefile.inc -# Using the backslash as line continuation character might be problematic -# with some make flavours, as Watcom's wmake showed us already. If we -# ever want to change this in a portable manner then we should consider -# this idea (posted to the libcurl list by Adam Kellas): -# CSRC1 = file1.c file2.c file3.c -# CSRC2 = file4.c file5.c file6.c -# CSOURCES = $(CSRC1) $(CSRC2) - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ - $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/xc-am-iface.m4 \ - $(top_srcdir)/m4/xc-cc-check.m4 \ - $(top_srcdir)/m4/xc-lt-iface.m4 \ - $(top_srcdir)/m4/xc-translit.m4 \ - $(top_srcdir)/m4/xc-val-flgs.m4 \ - $(top_srcdir)/m4/zz40-xc-ovr.m4 \ - $(top_srcdir)/m4/zz50-xc-ovr.m4 \ - $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h -CONFIG_CLEAN_FILES = curl-config libcurl.pc -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" -SCRIPTS = $(bin_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(pkgconfig_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/curl-config.in \ - $(srcdir)/lib/Makefile.inc $(srcdir)/libcurl.pc.in \ - $(srcdir)/src/Makefile.inc COPYING README compile config.guess \ - config.sub depcomp install-sh ltmain.sh missing -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMB = @CURL_DISABLE_SMB@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ -CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@ -CYGPATH_W = @CYGPATH_W@ -DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -ENABLE_STATIC = @ENABLE_STATIC@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ -LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ -LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NROFF = @NROFF@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SSL_ENABLED = @SSL_ENABLED@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_DARWINSSL = @USE_DARWINSSL@ -USE_GNUTLS = @USE_GNUTLS@ -USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_MBEDTLS = @USE_MBEDTLS@ -USE_NGHTTP2 = @USE_NGHTTP2@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SCHANNEL = @USE_SCHANNEL@ -USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONNUM = @VERSIONNUM@ -ZLIB_LIBS = @ZLIB_LIBS@ -ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS = -I m4 -CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in \ - CMake/CurlTests.c CMake/FindGSS.cmake CMake/OtherTests.cmake \ - CMake/Platforms/WindowsCache.cmake CMake/Utilities.cmake \ - CMake/Macros.cmake \ - CMake/CurlSymbolHiding.cmake CMake/FindCARES.cmake \ - CMake/FindLibSSH2.cmake CMake/FindNGHTTP2.cmake \ - CMake/FindMbedTLS.cmake CMake/cmake_uninstall.cmake.in - -VC6_LIBTMPL = projects/Windows/VC6/lib/libcurl.tmpl -VC6_LIBDSP = projects/Windows/VC6/lib/libcurl.dsp.dist -VC6_LIBDSP_DEPS = $(VC6_LIBTMPL) Makefile.am lib/Makefile.inc -VC6_SRCTMPL = projects/Windows/VC6/src/curl.tmpl -VC6_SRCDSP = projects/Windows/VC6/src/curl.dsp.dist -VC6_SRCDSP_DEPS = $(VC6_SRCTMPL) Makefile.am src/Makefile.inc -VC7_LIBTMPL = projects/Windows/VC7/lib/libcurl.tmpl -VC7_LIBVCPROJ = projects/Windows/VC7/lib/libcurl.vcproj.dist -VC7_LIBVCPROJ_DEPS = $(VC7_LIBTMPL) Makefile.am lib/Makefile.inc -VC7_SRCTMPL = projects/Windows/VC7/src/curl.tmpl -VC7_SRCVCPROJ = projects/Windows/VC7/src/curl.vcproj.dist -VC7_SRCVCPROJ_DEPS = $(VC7_SRCTMPL) Makefile.am src/Makefile.inc -VC71_LIBTMPL = projects/Windows/VC7.1/lib/libcurl.tmpl -VC71_LIBVCPROJ = projects/Windows/VC7.1/lib/libcurl.vcproj.dist -VC71_LIBVCPROJ_DEPS = $(VC71_LIBTMPL) Makefile.am lib/Makefile.inc -VC71_SRCTMPL = projects/Windows/VC7.1/src/curl.tmpl -VC71_SRCVCPROJ = projects/Windows/VC7.1/src/curl.vcproj.dist -VC71_SRCVCPROJ_DEPS = $(VC71_SRCTMPL) Makefile.am src/Makefile.inc -VC8_LIBTMPL = projects/Windows/VC8/lib/libcurl.tmpl -VC8_LIBVCPROJ = projects/Windows/VC8/lib/libcurl.vcproj.dist -VC8_LIBVCPROJ_DEPS = $(VC8_LIBTMPL) Makefile.am lib/Makefile.inc -VC8_SRCTMPL = projects/Windows/VC8/src/curl.tmpl -VC8_SRCVCPROJ = projects/Windows/VC8/src/curl.vcproj.dist -VC8_SRCVCPROJ_DEPS = $(VC8_SRCTMPL) Makefile.am src/Makefile.inc -VC9_LIBTMPL = projects/Windows/VC9/lib/libcurl.tmpl -VC9_LIBVCPROJ = projects/Windows/VC9/lib/libcurl.vcproj.dist -VC9_LIBVCPROJ_DEPS = $(VC9_LIBTMPL) Makefile.am lib/Makefile.inc -VC9_SRCTMPL = projects/Windows/VC9/src/curl.tmpl -VC9_SRCVCPROJ = projects/Windows/VC9/src/curl.vcproj.dist -VC9_SRCVCPROJ_DEPS = $(VC9_SRCTMPL) Makefile.am src/Makefile.inc -VC10_LIBTMPL = projects/Windows/VC10/lib/libcurl.tmpl -VC10_LIBVCXPROJ = projects/Windows/VC10/lib/libcurl.vcxproj.dist -VC10_LIBVCXPROJ_DEPS = $(VC10_LIBTMPL) Makefile.am lib/Makefile.inc -VC10_SRCTMPL = projects/Windows/VC10/src/curl.tmpl -VC10_SRCVCXPROJ = projects/Windows/VC10/src/curl.vcxproj.dist -VC10_SRCVCXPROJ_DEPS = $(VC10_SRCTMPL) Makefile.am src/Makefile.inc -VC11_LIBTMPL = projects/Windows/VC11/lib/libcurl.tmpl -VC11_LIBVCXPROJ = projects/Windows/VC11/lib/libcurl.vcxproj.dist -VC11_LIBVCXPROJ_DEPS = $(VC11_LIBTMPL) Makefile.am lib/Makefile.inc -VC11_SRCTMPL = projects/Windows/VC11/src/curl.tmpl -VC11_SRCVCXPROJ = projects/Windows/VC11/src/curl.vcxproj.dist -VC11_SRCVCXPROJ_DEPS = $(VC11_SRCTMPL) Makefile.am src/Makefile.inc -VC12_LIBTMPL = projects/Windows/VC12/lib/libcurl.tmpl -VC12_LIBVCXPROJ = projects/Windows/VC12/lib/libcurl.vcxproj.dist -VC12_LIBVCXPROJ_DEPS = $(VC12_LIBTMPL) Makefile.am lib/Makefile.inc -VC12_SRCTMPL = projects/Windows/VC12/src/curl.tmpl -VC12_SRCVCXPROJ = projects/Windows/VC12/src/curl.vcxproj.dist -VC12_SRCVCXPROJ_DEPS = $(VC12_SRCTMPL) Makefile.am src/Makefile.inc -VC14_LIBTMPL = projects/Windows/VC14/lib/libcurl.tmpl -VC14_LIBVCXPROJ = projects/Windows/VC14/lib/libcurl.vcxproj.dist -VC14_LIBVCXPROJ_DEPS = $(VC14_LIBTMPL) Makefile.am lib/Makefile.inc -VC14_SRCTMPL = projects/Windows/VC14/src/curl.tmpl -VC14_SRCVCXPROJ = projects/Windows/VC14/src/curl.vcxproj.dist -VC14_SRCVCXPROJ_DEPS = $(VC14_SRCTMPL) Makefile.am src/Makefile.inc -VC_DIST = projects/README \ - projects/build-openssl.bat \ - projects/build-wolfssl.bat \ - projects/checksrc.bat \ - projects/Windows/VC6/curl-all.dsw \ - projects/Windows/VC6/lib/libcurl.dsw \ - projects/Windows/VC6/src/curl.dsw \ - projects/Windows/VC7/curl-all.sln \ - projects/Windows/VC7/lib/libcurl.sln \ - projects/Windows/VC7/src/curl.sln \ - projects/Windows/VC7.1/curl-all.sln \ - projects/Windows/VC7.1/lib/libcurl.sln \ - projects/Windows/VC7.1/src/curl.sln \ - projects/Windows/VC8/curl-all.sln \ - projects/Windows/VC8/lib/libcurl.sln \ - projects/Windows/VC8/src/curl.sln \ - projects/Windows/VC9/curl-all.sln \ - projects/Windows/VC9/lib/libcurl.sln \ - projects/Windows/VC9/src/curl.sln \ - projects/Windows/VC10/curl-all.sln \ - projects/Windows/VC10/lib/libcurl.sln \ - projects/Windows/VC10/lib/libcurl.vcxproj.filters \ - projects/Windows/VC10/src/curl.sln \ - projects/Windows/VC10/src/curl.vcxproj.filters \ - projects/Windows/VC11/curl-all.sln \ - projects/Windows/VC11/lib/libcurl.sln \ - projects/Windows/VC11/lib/libcurl.vcxproj.filters \ - projects/Windows/VC11/src/curl.sln \ - projects/Windows/VC11/src/curl.vcxproj.filters \ - projects/Windows/VC12/curl-all.sln \ - projects/Windows/VC12/lib/libcurl.sln \ - projects/Windows/VC12/lib/libcurl.vcxproj.filters \ - projects/Windows/VC12/src/curl.sln \ - projects/Windows/VC12/src/curl.vcxproj.filters \ - projects/Windows/VC14/curl-all.sln \ - projects/Windows/VC14/lib/libcurl.sln \ - projects/Windows/VC14/lib/libcurl.vcxproj.filters \ - projects/Windows/VC14/src/curl.sln \ - projects/Windows/VC14/src/curl.vcxproj.filters \ - projects/generate.bat \ - projects/wolfssl_options.h \ - projects/wolfssl_override.props - -WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat \ - winbuild/MakefileBuild.vc winbuild/Makefile.vc - -EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ - RELEASE-NOTES buildconf libcurl.pc.in MacOSX-Framework scripts/zsh.pl \ - scripts/updatemanpages.pl $(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) \ - lib/libcurl.vers.in buildconf.bat scripts/coverage.sh - -CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ) \ - $(VC71_LIBVCPROJ) $(VC71_SRCVCPROJ) $(VC8_LIBVCPROJ) $(VC8_SRCVCPROJ) \ - $(VC9_LIBVCPROJ) $(VC9_SRCVCPROJ) $(VC10_LIBVCXPROJ) $(VC10_SRCVCXPROJ) \ - $(VC11_LIBVCXPROJ) $(VC11_SRCVCXPROJ) $(VC12_LIBVCXPROJ) $(VC12_SRCVCXPROJ) \ - $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) - -bin_SCRIPTS = curl-config -SUBDIRS = lib src -DIST_SUBDIRS = $(SUBDIRS) tests packages scripts include docs -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libcurl.pc -LIB_VAUTH_CFILES = vauth/vauth.c vauth/cleartext.c vauth/cram.c \ - vauth/digest.c vauth/digest_sspi.c vauth/krb5_gssapi.c \ - vauth/krb5_sspi.c vauth/ntlm.c vauth/ntlm_sspi.c vauth/oauth2.c \ - vauth/spnego_gssapi.c vauth/spnego_sspi.c - -LIB_VAUTH_HFILES = vauth/vauth.h vauth/digest.h vauth/ntlm.h -LIB_VTLS_CFILES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c \ - vtls/polarssl.c vtls/polarssl_threadlock.c vtls/axtls.c \ - vtls/cyassl.c vtls/schannel.c vtls/darwinssl.c vtls/gskit.c \ - vtls/mbedtls.c - -LIB_VTLS_HFILES = vtls/openssl.h vtls/vtls.h vtls/gtls.h \ - vtls/nssg.h vtls/polarssl.h vtls/polarssl_threadlock.h vtls/axtls.h \ - vtls/cyassl.h vtls/schannel.h vtls/darwinssl.h vtls/gskit.h \ - vtls/mbedtls.h - -LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ - cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ - ldap.c version.c getenv.c escape.c mprintf.c telnet.c netrc.c \ - getinfo.c transfer.c strcase.c easy.c security.c curl_fnmatch.c \ - fileinfo.c ftplistparser.c wildcard.c krb5.c memdebug.c http_chunks.c \ - strtok.c connect.c llist.c hash.c multi.c content_encoding.c share.c \ - http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c \ - strerror.c amigaos.c hostasyn.c hostip4.c hostip6.c hostsyn.c \ - inet_ntop.c parsedate.c select.c tftp.c splay.c strdup.c socks.c \ - ssh.c curl_addrinfo.c socks_gssapi.c socks_sspi.c \ - curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c pop3.c smtp.c \ - pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c \ - openldap.c curl_gethostname.c gopher.c idn_win32.c \ - http_proxy.c non-ascii.c asyn-ares.c asyn-thread.c curl_gssapi.c \ - http_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c rand.c \ - curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c \ - x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \ - mime.c - -LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \ - formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \ - speedcheck.h urldata.h curl_ldap.h escape.h telnet.h getinfo.h \ - strcase.h curl_sec.h memdebug.h http_chunks.h curl_fnmatch.h \ - wildcard.h fileinfo.h ftplistparser.h strtok.h connect.h llist.h \ - hash.h content_encoding.h share.h curl_md4.h curl_md5.h http_digest.h \ - http_negotiate.h inet_pton.h amigaos.h strtoofft.h strerror.h \ - inet_ntop.h curlx.h curl_memory.h curl_setup.h transfer.h select.h \ - easyif.h multiif.h parsedate.h tftp.h sockaddr.h splay.h strdup.h \ - socks.h ssh.h curl_base64.h curl_addrinfo.h curl_sspi.h \ - slist.h nonblock.h curl_memrchr.h imap.h pop3.h smtp.h pingpong.h \ - rtsp.h curl_threads.h warnless.h curl_hmac.h curl_rtmp.h \ - curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h \ - http_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h \ - curl_sasl.h curl_multibyte.h hostcheck.h conncache.h \ - curl_setup_once.h multihandle.h setup-vms.h pipeline.h dotdot.h \ - x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \ - curl_printf.h system_win32.h rand.h mime.h - -LIB_RCFILES = libcurl.rc -CSOURCES = $(LIB_CFILES) $(LIB_VAUTH_CFILES) $(LIB_VTLS_CFILES) -HHEADERS = $(LIB_HFILES) $(LIB_VAUTH_HFILES) $(LIB_VTLS_HFILES) - -# libcurl has sources that provide functions named curlx_* that aren't part of -# the official API, but we re-use the code here to avoid duplication. -CURLX_CFILES = \ - ../lib/strtoofft.c \ - ../lib/nonblock.c \ - ../lib/warnless.c - -CURLX_HFILES = \ - ../lib/curl_setup.h \ - ../lib/strtoofft.h \ - ../lib/nonblock.h \ - ../lib/warnless.h - -CURL_CFILES = \ - slist_wc.c \ - tool_binmode.c \ - tool_bname.c \ - tool_cb_dbg.c \ - tool_cb_hdr.c \ - tool_cb_prg.c \ - tool_cb_rea.c \ - tool_cb_see.c \ - tool_cb_wrt.c \ - tool_cfgable.c \ - tool_convert.c \ - tool_dirhie.c \ - tool_doswin.c \ - tool_easysrc.c \ - tool_formparse.c \ - tool_getparam.c \ - tool_getpass.c \ - tool_help.c \ - tool_helpers.c \ - tool_homedir.c \ - tool_hugehelp.c \ - tool_libinfo.c \ - tool_main.c \ - tool_metalink.c \ - tool_msgs.c \ - tool_operate.c \ - tool_operhlp.c \ - tool_panykey.c \ - tool_paramhlp.c \ - tool_parsecfg.c \ - tool_strdup.c \ - tool_setopt.c \ - tool_sleep.c \ - tool_urlglob.c \ - tool_util.c \ - tool_vms.c \ - tool_writeout.c \ - tool_xattr.c - -CURL_HFILES = \ - slist_wc.h \ - tool_binmode.h \ - tool_bname.h \ - tool_cb_dbg.h \ - tool_cb_hdr.h \ - tool_cb_prg.h \ - tool_cb_rea.h \ - tool_cb_see.h \ - tool_cb_wrt.h \ - tool_cfgable.h \ - tool_convert.h \ - tool_dirhie.h \ - tool_doswin.h \ - tool_easysrc.h \ - tool_formparse.h \ - tool_getparam.h \ - tool_getpass.h \ - tool_help.h \ - tool_helpers.h \ - tool_homedir.h \ - tool_hugehelp.h \ - tool_libinfo.h \ - tool_main.h \ - tool_metalink.h \ - tool_msgs.h \ - tool_operate.h \ - tool_operhlp.h \ - tool_panykey.h \ - tool_paramhlp.h \ - tool_parsecfg.h \ - tool_sdecls.h \ - tool_setopt.h \ - tool_setup.h \ - tool_sleep.h \ - tool_strdup.h \ - tool_urlglob.h \ - tool_util.h \ - tool_version.h \ - tool_vms.h \ - tool_writeout.h \ - tool_xattr.h - -CURL_RCFILES = curl.rc - -# curl_SOURCES is special and gets assigned in src/Makefile.am -CURL_FILES = $(CURL_CFILES) $(CURLX_CFILES) $(CURL_HFILES) -all: all-recursive - -.SUFFIXES: -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/lib/Makefile.inc $(srcdir)/src/Makefile.inc $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; -$(srcdir)/lib/Makefile.inc $(srcdir)/src/Makefile.inc $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): -curl-config: $(top_builddir)/config.status $(srcdir)/curl-config.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -libcurl.pc: $(top_builddir)/config.status $(srcdir)/libcurl.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool config.lt -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile $(SCRIPTS) $(DATA) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-pkgconfigDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-data-hook -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-binSCRIPTS - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-hook -.MAKE: $(am__recursive_targets) install-am install-data-am \ - install-strip uninstall-am - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ - dist dist-all dist-bzip2 dist-gzip dist-hook dist-lzip \ - dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ - distclean-generic distclean-libtool distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-binSCRIPTS \ - install-data install-data-am install-data-hook install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-binSCRIPTS uninstall-hook \ - uninstall-pkgconfigDATA - -.PRECIOUS: Makefile - - -# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files - -dist-hook: - rm -rf $(top_builddir)/tests/log - find $(distdir) -name "*.dist" -exec rm {} \; - (distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \ - for file in $$distit; do \ - strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ - cp -p $$file $(distdir)$$strip; \ - done) - -html: - cd docs && $(MAKE) html - -pdf: - cd docs && $(MAKE) pdf - -check: test examples check-docs - -@CROSSCOMPILING_TRUE@test-full: test -@CROSSCOMPILING_TRUE@test-torture: test - -@CROSSCOMPILING_TRUE@test: -@CROSSCOMPILING_TRUE@ @echo "NOTICE: we can't run the tests when cross-compiling!" - -@CROSSCOMPILING_FALSE@test: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all quiet-test) - -@CROSSCOMPILING_FALSE@test-full: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all full-test) - -@CROSSCOMPILING_FALSE@test-nonflaky: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all nonflaky-test) - -@CROSSCOMPILING_FALSE@test-torture: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all torture-test) - -@CROSSCOMPILING_FALSE@test-event: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all event-test) - -@CROSSCOMPILING_FALSE@test-am: -@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all am-test) - -examples: - @(cd docs/examples; $(MAKE) check) - -check-docs: - @(cd docs/libcurl; $(MAKE) check) - -# This is a hook to have 'make clean' also clean up the docs and the tests -# dir. The extra check for the Makefiles being present is necessary because -# 'make distcheck' will make clean first in these directories _before_ it runs -# this hook. -clean-local: - @(if test -f tests/Makefile; then cd tests; $(MAKE) clean; fi) - @(if test -f docs/Makefile; then cd docs; $(MAKE) clean; fi) - -# -# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros -# must contain the following line: -# %_topdir /home/loic/local/rpm -# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc. -# -# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS -# -# If additional configure flags are needed to build the package, add the -# following in ~/.rpmmacros -# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS} -# and run make rpm in the following way: -# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm -# - -rpms: - $(MAKE) RPMDIST=curl rpm - $(MAKE) RPMDIST=curl-ssl rpm - -rpm: - RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \ - cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \ - cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \ - rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \ - mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \ - mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm . - -# -# Build a Solaris pkgadd format file -# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format -# file (which ends up back in this directory). -# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do -# pkgadd -d ./HAXXcurl-* -# - -# gak - libtool requires an absolute directory, hence the pwd below... -pkgadd: - umask 022 ; \ - $(MAKE) install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \ - cat COPYING > $(srcdir)/packages/Solaris/copyright ; \ - cd $(srcdir)/packages/Solaris && $(MAKE) package - -# -# Build a cygwin binary tarball installation file -# resulting .tar.bz2 file will end up at packages/Win32/cygwin -cygwinbin: - $(MAKE) -C packages/Win32/cygwin cygwinbin - -# We extend the standard install with a custom hook: -install-data-hook: - cd include && $(MAKE) install - cd docs && $(MAKE) install - cd docs/libcurl && $(MAKE) install - -# We extend the standard uninstall with a custom hook: -uninstall-hook: - cd include && $(MAKE) uninstall - cd docs && $(MAKE) uninstall - cd docs/libcurl && $(MAKE) uninstall - -ca-bundle: lib/mk-ca-bundle.pl - @echo "generating a fresh ca-bundle.crt" - @perl $< -b -l -u lib/ca-bundle.crt - -ca-firefox: lib/firefox-db2pem.sh - @echo "generating a fresh ca-bundle.crt" - ./lib/firefox-db2pem.sh lib/ca-bundle.crt - -checksrc: - cd lib && $(MAKE) checksrc - cd src && $(MAKE) checksrc - cd tests && $(MAKE) checksrc - cd include/curl && $(MAKE) checksrc - cd docs/examples && $(MAKE) checksrc - -.PHONY: vc-ide - -vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \ - $(VC7_SRCVCPROJ_DEPS) $(VC71_LIBVCPROJ_DEPS) $(VC71_SRCVCPROJ_DEPS) \ - $(VC8_LIBVCPROJ_DEPS) $(VC8_SRCVCPROJ_DEPS) $(VC9_LIBVCPROJ_DEPS) \ - $(VC9_SRCVCPROJ_DEPS) $(VC10_LIBVCXPROJ_DEPS) $(VC10_SRCVCXPROJ_DEPS) \ - $(VC11_LIBVCXPROJ_DEPS) $(VC11_SRCVCXPROJ_DEPS) $(VC12_LIBVCXPROJ_DEPS) \ - $(VC12_SRCVCXPROJ_DEPS) $(VC14_LIBVCXPROJ_DEPS) $(VC14_SRCVCXPROJ_DEPS) - @(win32_lib_srcs='$(LIB_CFILES)'; \ - win32_lib_hdrs='$(LIB_HFILES) config-win32.h'; \ - win32_lib_rc='$(LIB_RCFILES)'; \ - win32_lib_vauth_srcs='$(LIB_VAUTH_CFILES)'; \ - win32_lib_vauth_hdrs='$(LIB_VAUTH_HFILES)'; \ - win32_lib_vtls_srcs='$(LIB_VTLS_CFILES)'; \ - win32_lib_vtls_hdrs='$(LIB_VTLS_HFILES)'; \ - win32_src_srcs='$(CURL_CFILES)'; \ - win32_src_hdrs='$(CURL_HFILES)'; \ - win32_src_rc='$(CURL_RCFILES)'; \ - win32_src_x_srcs='$(CURLX_CFILES)'; \ - win32_src_x_hdrs='$(CURLX_HFILES) ../lib/config-win32.h'; \ - \ - sorted_lib_srcs=`for file in $$win32_lib_srcs; do echo $$file; done | sort`; \ - sorted_lib_hdrs=`for file in $$win32_lib_hdrs; do echo $$file; done | sort`; \ - sorted_lib_vauth_srcs=`for file in $$win32_lib_vauth_srcs; do echo $$file; done | sort`; \ - sorted_lib_vauth_hdrs=`for file in $$win32_lib_vauth_hdrs; do echo $$file; done | sort`; \ - sorted_lib_vtls_srcs=`for file in $$win32_lib_vtls_srcs; do echo $$file; done | sort`; \ - sorted_lib_vtls_hdrs=`for file in $$win32_lib_vtls_hdrs; do echo $$file; done | sort`; \ - sorted_src_srcs=`for file in $$win32_src_srcs; do echo $$file; done | sort`; \ - sorted_src_hdrs=`for file in $$win32_src_hdrs; do echo $$file; done | sort`; \ - sorted_src_x_srcs=`for file in $$win32_src_x_srcs; do echo $$file; done | sort`; \ - sorted_src_x_hdrs=`for file in $$win32_src_x_hdrs; do echo $$file; done | sort`; \ - \ - awk_code='\ -function gen_element(type, dir, file)\ -{\ - sub(/vauth\//, "", file);\ - sub(/vtls\//, "", file);\ -\ - spaces=" ";\ - if(dir == "lib\\vauth" || dir == "lib\\vtls")\ - tabs=" ";\ - else\ - tabs=" ";\ -\ - if(type == "dsp") {\ - printf("# Begin Source File\r\n");\ - printf("\r\n");\ - printf("SOURCE=..\\..\\..\\..\\%s\\%s\r\n", dir, file);\ - printf("# End Source File\r\n");\ - }\ - else if(type == "vcproj1") {\ - printf("%s\r\n",\ - tabs, dir, file);\ - printf("%s\r\n", tabs);\ - }\ - else if(type == "vcproj2") {\ - printf("%s\r\n", tabs);\ - printf("%s\r\n", tabs);\ - }\ - else if(type == "vcxproj") {\ - i = index(file, ".");\ - ext = substr(file, i == 0 ? 0 : i + 1);\ -\ - if(ext == "c")\ - printf("%s\r\n",\ - spaces, dir, file);\ - else if(ext == "h")\ - printf("%s\r\n",\ - spaces, dir, file);\ - else if(ext == "rc")\ - printf("%s\r\n",\ - spaces, dir, file);\ - }\ -}\ -\ -{\ -\ - if($$0 == "CURL_LIB_C_FILES") {\ - split(lib_srcs, arr);\ - for(val in arr) gen_element(proj_type, "lib", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_H_FILES") {\ - split(lib_hdrs, arr);\ - for(val in arr) gen_element(proj_type, "lib", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_RC_FILES") {\ - split(lib_rc, arr);\ - for(val in arr) gen_element(proj_type, "lib", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_VAUTH_C_FILES") {\ - split(lib_vauth_srcs, arr);\ - for(val in arr) gen_element(proj_type, "lib\\vauth", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_VAUTH_H_FILES") {\ - split(lib_vauth_hdrs, arr);\ - for(val in arr) gen_element(proj_type, "lib\\vauth", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_VTLS_C_FILES") {\ - split(lib_vtls_srcs, arr);\ - for(val in arr) gen_element(proj_type, "lib\\vtls", arr[val]);\ - }\ - else if($$0 == "CURL_LIB_VTLS_H_FILES") {\ - split(lib_vtls_hdrs, arr);\ - for(val in arr) gen_element(proj_type, "lib\\vtls", arr[val]);\ - }\ - else if($$0 == "CURL_SRC_C_FILES") {\ - split(src_srcs, arr);\ - for(val in arr) gen_element(proj_type, "src", arr[val]);\ - }\ - else if($$0 == "CURL_SRC_H_FILES") {\ - split(src_hdrs, arr);\ - for(val in arr) gen_element(proj_type, "src", arr[val]);\ - }\ - else if($$0 == "CURL_SRC_RC_FILES") {\ - split(src_rc, arr);\ - for(val in arr) gen_element(proj_type, "src", arr[val]);\ - }\ - else if($$0 == "CURL_SRC_X_C_FILES") {\ - split(src_x_srcs, arr);\ - for(val in arr) {\ - sub(/..\/lib\//, "", arr[val]);\ - gen_element(proj_type, "lib", arr[val]);\ - }\ - }\ - else if($$0 == "CURL_SRC_X_H_FILES") {\ - split(src_x_hdrs, arr);\ - for(val in arr) {\ - sub(/..\/lib\//, "", arr[val]);\ - gen_element(proj_type, "lib", arr[val]);\ - }\ - }\ - else\ - printf("%s\r\n", $$0);\ -}';\ - \ - echo "generating '$(VC6_LIBDSP)'"; \ - awk -v proj_type=dsp \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC6_LIBTMPL) > $(VC6_LIBDSP) || { exit 1; }; \ - \ - echo "generating '$(VC6_SRCDSP)'"; \ - awk -v proj_type=dsp \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC6_SRCTMPL) > $(VC6_SRCDSP) || { exit 1; }; \ - \ - echo "generating '$(VC7_LIBVCPROJ)'"; \ - awk -v proj_type=vcproj1 \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC7_LIBTMPL) > $(VC7_LIBVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC7_SRCVCPROJ)'"; \ - awk -v proj_type=vcproj1 \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC7_SRCTMPL) > $(VC7_SRCVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC71_LIBVCPROJ)'"; \ - awk -v proj_type=vcproj1 \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC71_LIBTMPL) > $(VC71_LIBVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC71_SRCVCPROJ)'"; \ - awk -v proj_type=vcproj1 \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC71_SRCTMPL) > $(VC71_SRCVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC8_LIBVCPROJ)'"; \ - awk -v proj_type=vcproj2 \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC8_LIBTMPL) > $(VC8_LIBVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC8_SRCVCPROJ)'"; \ - awk -v proj_type=vcproj2 \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC8_SRCTMPL) > $(VC8_SRCVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC9_LIBVCPROJ)'"; \ - awk -v proj_type=vcproj2 \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC9_LIBTMPL) > $(VC9_LIBVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC9_SRCVCPROJ)'"; \ - awk -v proj_type=vcproj2 \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC9_SRCTMPL) > $(VC9_SRCVCPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC10_LIBVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC10_LIBTMPL) > $(VC10_LIBVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC10_SRCVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC10_SRCTMPL) > $(VC10_SRCVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC11_LIBVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC11_LIBTMPL) > $(VC11_LIBVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC11_SRCVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC11_SRCTMPL) > $(VC11_SRCVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC12_LIBVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC12_LIBTMPL) > $(VC12_LIBVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC12_SRCVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC12_SRCTMPL) > $(VC12_SRCVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC14_LIBVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v lib_srcs="$$sorted_lib_srcs" \ - -v lib_hdrs="$$sorted_lib_hdrs" \ - -v lib_rc="$$win32_lib_rc" \ - -v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \ - -v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \ - -v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \ - -v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \ - "$$awk_code" $(srcdir)/$(VC14_LIBTMPL) > $(VC14_LIBVCXPROJ) || { exit 1; }; \ - \ - echo "generating '$(VC14_SRCVCXPROJ)'"; \ - awk -v proj_type=vcxproj \ - -v src_srcs="$$sorted_src_srcs" \ - -v src_hdrs="$$sorted_src_hdrs" \ - -v src_rc="$$win32_src_rc" \ - -v src_x_srcs="$$sorted_src_x_srcs" \ - -v src_x_hdrs="$$sorted_src_x_hdrs" \ - "$$awk_code" $(srcdir)/$(VC14_SRCTMPL) > $(VC14_SRCVCXPROJ) || { exit 1; };) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/curl/README b/curl/README index f0b3b939..b690816e 100644 --- a/curl/README +++ b/curl/README @@ -17,22 +17,22 @@ README You find answers to the most frequent questions we get in the FAQ document. - Study the COPYING file for distribution terms and similar. If you distribute - curl binaries or other binaries that involve libcurl, you might enjoy the - LICENSE-MIXING document. + Study the COPYING file for distribution terms. + + Those documents and more can be found in the docs/ directory. CONTACT If you have problems, questions, ideas or suggestions, please contact us - by posting to a suitable mailing list. See https://curl.haxx.se/mail/ + by posting to a suitable mailing list. See https://curl.se/mail/ All contributors to the project are listed in the THANKS document. -WEB SITE +WEBSITE - Visit the curl web site for the latest news and downloads: + Visit the curl website for the latest news and downloads: - https://curl.haxx.se/ + https://curl.se/ GIT @@ -42,6 +42,12 @@ GIT (you'll get a directory named curl created, filled with the source code) +SECURITY PROBLEMS + + Report suspected security problems via our HackerOne page and not in public! + + https://hackerone.com/curl + NOTICE Curl contains pieces of source code that is Copyright (c) 1998, 1999 diff --git a/curl/README.md b/curl/README.md new file mode 100644 index 00000000..0ba5b781 --- /dev/null +++ b/curl/README.md @@ -0,0 +1,88 @@ +![curl logo](https://curl.se/logo/curl-logo.svg) + +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/63/badge)](https://bestpractices.coreinfrastructure.org/projects/63) +[![Coverity passed](https://scan.coverity.com/projects/curl/badge.svg)](https://scan.coverity.com/projects/curl) +[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/l1vv31029huhf4g4?svg=true)](https://ci.appveyor.com/project/curlorg/curl) +[![Azure DevOps Build Status](https://dev.azure.com/daniel0244/curl/_apis/build/status/curl.curl?branchName=master)](https://dev.azure.com/daniel0244/curl/_build/latest?definitionId=1&branchName=master) +[![Cirrus Build Status](https://api.cirrus-ci.com/github/curl/curl.svg?branch=master)](https://cirrus-ci.com/github/curl/curl) +[![Backers on Open Collective](https://opencollective.com/curl/backers/badge.svg)](#backers) +[![Sponsors on Open Collective](https://opencollective.com/curl/sponsors/badge.svg)](#sponsors) +[![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/curl/curl.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/curl/curl/context:cpp) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d11483a0cc5c4ebd9da4ff9f7cd56690)](https://app.codacy.com/app/curl/curl) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/curl.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:curl) + +Curl is a command-line tool for transferring data specified with URL +syntax. Find out how to use curl by reading [the curl.1 man +page](https://curl.se/docs/manpage.html) or [the MANUAL +document](https://curl.se/docs/manual.html). Find out how to install Curl +by reading [the INSTALL document](https://curl.se/docs/install.html). + +libcurl is the library curl is using to do its job. It is readily available to +be used by your software. Read [the libcurl.3 man +page](https://curl.se/libcurl/c/libcurl.html) to learn how! + +You can find answers to the most frequent questions we get in [the FAQ +document](https://curl.se/docs/faq.html). + +Study [the COPYING file](https://curl.se/docs/copyright.html) for +distribution terms. + +## Contact + +If you have problems, questions, ideas or suggestions, please contact us by +posting to a suitable [mailing list](https://curl.se/mail/). + +All contributors to the project are listed in [the THANKS +document](https://curl.se/docs/thanks.html). + +## Commercial support + +For commercial support, maybe private and dedicated help with your problems or +applications using (lib)curl: https://curl.se/support.html + +## Website + +Visit the [curl website](https://curl.se/) for the latest news and +downloads. + +## Git + +To download the very latest source from the Git server do this: + + git clone https://github.com/curl/curl.git + +(you'll get a directory named curl created, filled with the source code) + +## Security problems + +Report suspected security problems via [our HackerOne +page](https://hackerone.com/curl) and not in public! + +## Notice + +Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga +Tekniska Högskolan. This notice is included here to comply with the +distribution terms. + +## Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/curl#backer)] + + + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a +link to your website. [[Become a +sponsor](https://opencollective.com/curl#sponsor)] + + + + + + + + + + + diff --git a/curl/RELEASE-NOTES b/curl/RELEASE-NOTES index 7da35d2e..1829b788 100644 --- a/curl/RELEASE-NOTES +++ b/curl/RELEASE-NOTES @@ -1,115 +1,44 @@ -Curl and libcurl 7.56.1 +curl and libcurl 7.79.1 - Public curl releases: 170 - Command line options: 211 - curl_easy_setopt() options: 249 - Public functions in libcurl: 74 - Contributors: 1626 + Public curl releases: 203 + Command line options: 242 + curl_easy_setopt() options: 290 + Public functions in libcurl: 85 + Contributors: 2489 This release includes the following bugfixes: - o imap: if a FETCH response has no size, don't call write callback [32] - o ftp: UBsan fixup 'pointer index expression overflowed [1] - o failf: skip the sprintf() if there are no consumers [2] - o fuzzer: move to using external curl-fuzzer [3] - o lib/Makefile.m32: allow customizing dll suffixes [4] - o docs: fix typo in curl_mime_data_cb man page [5] - o darwinssl: add support for TLSv1.3 [6] - o build: fix --disable-crypto-auth [7] - o lib/config-win32.h: let SMB/SMBS be enabled with OpenSSL/NSS [8] - o openssl: fix build without HAVE_OPAQUE_EVP_PKEY [9] - o strtoofft: Remove extraneous null check [10] - o multi_cleanup: call DONE on handles that never got that [11] - o tests: added flaky keyword to tests 587 and 644 - o pingpong: return error when trying to send without connection [12] - o remove_handle: call multi_done() first, then clear dns cache pointer [13] - o mime: be tolerant about setting twice the same header list in a part. - o mime: improve unbinding top multipart from easy handle. - o mime: avoid resetting a part's encoder when part's contents change. - o mime: refuse to add subparts to one of their own descendants [14] - o RTSP: avoid integer overflow on funny RTSP responses [15] - o curl: don't pass semicolons when parsing Content-Disposition [16] - o openssl: enable PKCS12 support for !BoringSSL [17] - o FAQ: s/CURLOPT_PROGRESSFUNCTION/CURLOPT_XFERINFOFUNCTION - o CURLOPT_NOPROGRESS.3: also refer to xferinfofunction - o CURLOPT_XFERINFODATA.3: fix duplicate see also - o test298: verify --ftp-method nowcwd with URL encoded path [18] - o FTP: URL decode path for dir listing in nocwd mode [19] - o smtp_done: fix memory leak on send failure [20] - o ftpserver: support case insensitive commands - o test950; verify SMTP with custom request - o openssl: don't use old BORINGSSL_YYYYMM macros [21] - o setopt: update current connection SSL verify params [22] - o winbuild/BUILD.WINDOWS.txt: mention WITH_NGHTTP2 - o curl: reimplement stdin buffering in -F option [23] - o mime: keep "text/plain" content type if user-specified [24] - o mime: fix the content reader to handle >16K data properly [25] - o configure: remove the C++ compiler check [26] - o memdebug: trace send, recv and socket [27] - o runtests: use valgrind for torture as well - o ldap: silence clang warning [28] - o makefile.m32: allow to override gcc, ar and ranlib [29] - o setopt: avoid integer overflows when setting millsecond values [30] - o setopt: range check most long options [31] - o ftp: reject illegal IP/port in PASV 227 response [33] - o mime: do not reuse previously computed multipart size [34] - o vtls: change struct Curl_ssl `close' field name to `close_one' - o os400: add missing symbols in config file - o mime: limit bas64-encoded lines length to 76 characters - o mk-ca-bundle: Remove URL for aurora [35] - o mk-ca-bundle: Fix URL for NSS [36] + o Curl_http2_setup: don't change connection data on repeat invokes [10] + o curl_multi_fdset: make FD_SET() not operate on sockets out of range [4] + o dist: provide lib/.checksrc in the tarball [6] + o FAQ: add GOPHERS + curl works on data, not files + o hsts: CURLSTS_FAIL from hsts read callback should fail transfer [8] + o hsts: handle unlimited expiry [3] + o http: fix the broken >3 digit response code detection [1] + o strerror: use sys_errlist instead of strerror on Windows [5] + o test1184: disable [9] + o tests/sshserver.pl: make it work with openssh-8.7p1 [2] This release includes the following known bugs: - o see docs/KNOWN_BUGS (https://curl.haxx.se/docs/knownbugs.html) + o see docs/KNOWN_BUGS (https://curl.se/docs/knownbugs.html) This release would not have looked like this without help, code, reports and advice from friends like these: - Alexey Melnichuk, Artak Galoyan, Benbuck Nason, Brian Carpenter, - Christian Schmitz, Dan Fandrich, Daniel Stenberg, David Benjamin, - Felix Kaiser, Javier Sixto, Jeroen Ooms, Jon DeVree, Kristiyan Tsaklev, - Marcel Raad, Max Dymond, Nick Zitzmann, Patrick Monnerat, Viktor Szakáts, - Wyatt O'Day, Zenju on github, 0xd34db347 - (21 contributors) - - Thanks! (and sorry if I forgot to mention someone) + 0xee on github, Daniel Stenberg, Evangelos Foutras, Glenn de boer, + Jonathan Cardoso Machado, Kamil Dudka, Marcel Raad, Ray Satiro, + RiderALT on github, tawmoto on github, Viktor Szakats, + (11 contributors) References to bug reports and discussions on issues: - [1] = https://curl.haxx.se/bug/?i=1939 - [2] = https://curl.haxx.se/bug/?i=1936 - [3] = https://curl.haxx.se/bug/?i=1923 - [4] = https://curl.haxx.se/bug/?i=1942 - [5] = https://curl.haxx.se/bug/?i=1946 - [6] = https://curl.haxx.se/bug/?i=1794 - [7] = https://curl.haxx.se/bug/?i=1945 - [8] = https://curl.haxx.se/bug/?i=1943 - [9] = https://curl.haxx.se/bug/?i=1955 - [10] = https://curl.haxx.se/bug/?i=1950 - [11] = https://curl.haxx.se/bug/?i=1954 - [12] = https://curl.haxx.se/bug/?i=1953 - [13] = https://curl.haxx.se/bug/?i=1960 - [14] = https://curl.haxx.se/bug/?i=1962 - [15] = https://curl.haxx.se/bug/?i=1969 - [16] = https://curl.haxx.se/bug/?i=1964 - [17] = https://curl.haxx.se/bug/?i=1948 - [18] = https://curl.haxx.se/bug/?i=1974 - [19] = https://curl.haxx.se/bug/?i=1974 - [20] = https://curl.haxx.se/bug/?i=1977 - [21] = https://curl.haxx.se/bug/?i=1979 - [22] = https://curl.haxx.se/bug/?i=1941 - [23] = https://curl.haxx.se/bug/?i=1985 - [24] = https://curl.haxx.se/bug/?i=1986 - [25] = https://curl.haxx.se/bug/?i=1988 - [26] = https://curl.haxx.se/bug/?i=1990 - [27] = https://curl.haxx.se/bug/?i=1980 - [28] = https://curl.haxx.se/bug/?i=1992 - [29] = https://curl.haxx.se/bug/?i=1993 - [30] = https://curl.haxx.se/bug/?i=1938 - [31] = https://curl.haxx.se/bug/?i=1938 - [32] = https://curl.haxx.se/docs/adv_20171023.html - [33] = https://curl.haxx.se/bug/?i=1997 - [34] = https://curl.haxx.se/bug/?i=1999 - [35] = https://curl.haxx.se/bug/?i=1998 - [36] = https://curl.haxx.se/bug/?i=1998 + [1] = https://curl.se/bug/?i=7738 + [2] = https://curl.se/bug/?i=7724 + [3] = https://curl.se/bug/?i=7720 + [4] = https://curl.se/bug/?i=7718 + [5] = https://curl.se/bug/?i=7735 + [6] = https://curl.se/bug/?i=7733 + [8] = https://curl.se/bug/?i=7726 + [9] = https://curl.se/bug/?i=7725 + [10] = https://curl.se/bug/?i=7730 diff --git a/curl/SECURITY.md b/curl/SECURITY.md new file mode 100644 index 00000000..4e84fbef --- /dev/null +++ b/curl/SECURITY.md @@ -0,0 +1,10 @@ +# Security Policy + +See [docs/SECURITY-PROCESS.md](docs/SECURITY-PROCESS.md) for full details. + +## Reporting a Vulnerability + +If you have found or just suspect a security problem somewhere in curl or libcurl, +report it on [https://hackerone.com/curl](https://hackerone.com/curl). + +We treat security issues with confidentiality until controlled and disclosed responsibly. diff --git a/curl/acinclude.m4 b/curl/acinclude.m4 index 69bb6c00..277902da 100644 --- a/curl/acinclude.m4 +++ b/curl/acinclude.m4 @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -143,7 +143,7 @@ int main (void) dnl CURL_CHECK_AIX_ALL_SOURCE dnl ------------------------------------------------- dnl Provides a replacement of traditional AC_AIX with -dnl an uniform behaviour across all autoconf versions, +dnl an uniform behavior across all autoconf versions, dnl and with our own placement rules. AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [ @@ -347,6 +347,39 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ ]) +dnl CURL_CHECK_HEADER_WINCRYPT +dnl ------------------------------------------------- +dnl Check for compilable and valid wincrypt.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINCRYPT], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([for wincrypt.h], [curl_cv_header_wincrypt_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + ]],[[ + int dummy=2*PROV_RSA_FULL; + ]]) + ],[ + curl_cv_header_wincrypt_h="yes" + ],[ + curl_cv_header_wincrypt_h="no" + ]) + ]) + case "$curl_cv_header_wincrypt_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1, + [Define to 1 if you have the wincrypt.h header file.]) + ;; + esac +]) + + dnl CURL_CHECK_HEADER_WINLDAP dnl ------------------------------------------------- dnl Check for compilable and valid winldap.h header @@ -661,7 +694,7 @@ dnl ------------------------------------------------- dnl Check for libraries needed for WINLDAP support, dnl and prepended to LIBS any needed libraries. dnl This macro can take an optional parameter with a -dnl white space separated list of libraries to check +dnl whitespace separated list of libraries to check dnl before the WINLDAP default ones. AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [ @@ -755,7 +788,7 @@ dnl ------------------------------------------------- dnl Check for libraries needed for LDAP support, dnl and prepended to LIBS any needed libraries. dnl This macro can take an optional parameter with a -dnl white space separated list of libraries to check +dnl whitespace separated list of libraries to check dnl before the default ones. AC_DEFUN([CURL_CHECK_LIBS_LDAP], [ @@ -791,7 +824,9 @@ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [ '-lldap -llber' \ '-llber -lldap' \ '-lldapssl -lldapx -lldapsdk' \ - '-lldapsdk -lldapx -lldapssl' ; do + '-lldapsdk -lldapx -lldapssl' \ + '-lldap -llber -lssl -lcrypto' ; do + if test "$curl_cv_ldap_LIBS" = "unknown"; then if test -z "$x_nlibs"; then LIBS="$curl_cv_save_LIBS" @@ -960,212 +995,6 @@ AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ fi ]) - -dnl CURL_CHECK_FUNC_GETNAMEINFO -dnl ------------------------------------------------- -dnl Test if the getnameinfo function is available, -dnl and check the types of five of its arguments. -dnl If the function succeeds HAVE_GETNAMEINFO will be -dnl defined, defining the types of the arguments in -dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2, -dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7, -dnl and also defining the type qualifier of first -dnl argument in GETNAMEINFO_QUAL_ARG1. - -AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ - AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) - # - AC_MSG_CHECKING([for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([getnameinfo]) - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([no]) - curl_cv_getnameinfo="no" - ]) - # - if test "$curl_cv_getnameinfo" != "yes"; then - AC_MSG_CHECKING([deeper for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ - getnameinfo(); - ]]) - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - curl_cv_getnameinfo="no" - ]) - fi - # - if test "$curl_cv_getnameinfo" != "yes"; then - AC_MSG_CHECKING([deeper and deeper for getnameinfo]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#endif - ]],[[ - getnameinfo(0, 0, 0, 0, 0, 0, 0); - ]]) - ],[ - AC_MSG_RESULT([yes]) - curl_cv_getnameinfo="yes" - ],[ - AC_MSG_RESULT([but still no]) - curl_cv_getnameinfo="no" - ]) - fi - # - if test "$curl_cv_getnameinfo" = "yes"; then - AC_CACHE_CHECK([types of arguments for getnameinfo], - [curl_cv_func_getnameinfo_args], [ - curl_cv_func_getnameinfo_args="unknown" - for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do - for gni_arg2 in 'socklen_t' 'size_t' 'int'; do - for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do - for gni_arg7 in 'int' 'unsigned int'; do - if test "$curl_cv_func_getnameinfo_args" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#define GNICALLCONV WSAAPI -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#define GNICALLCONV -#endif - extern int GNICALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - getnameinfo($gni_arg1, $gni_arg2, - char *, $gni_arg46, - char *, $gni_arg46, - $gni_arg7); - ]],[[ - $gni_arg2 salen=0; - $gni_arg46 hostlen=0; - $gni_arg46 servlen=0; - $gni_arg7 flags=0; - int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); - ]]) - ],[ - curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" - ]) - fi - done - done - done - done - ]) # AC-CACHE-CHECK - if test "$curl_cv_func_getnameinfo_args" = "unknown"; then - AC_MSG_WARN([Cannot find proper types to use for getnameinfo args]) - AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined]) - else - gni_prev_IFS=$IFS; IFS=',' - set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` - IFS=$gni_prev_IFS - shift - # - gni_qual_type_arg1=$[1] - # - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2], - [Define to the type of arg 2 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3], - [Define to the type of args 4 and 6 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4], - [Define to the type of arg 7 for getnameinfo.]) - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$gni_qual_type_arg1" in - const*) - gni_qual_arg1=const - gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` - ;; - *) - gni_qual_arg1= - gni_type_arg1=$gni_qual_type_arg1 - ;; - esac - # - AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1, - [Define to the type qualifier of arg 1 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1, - [Define to the type of arg 1 for getnameinfo.]) - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1, - [Define to 1 if you have the getnameinfo function.]) - curl_cv_func_getnameinfo="yes" - fi - fi -]) - - dnl TYPE_SOCKADDR_STORAGE dnl ------------------------------------------------- dnl Check for struct sockaddr_storage. Most IPv6-enabled @@ -1203,107 +1032,6 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE], ]) ]) - -dnl CURL_CHECK_NI_WITHSCOPEID -dnl ------------------------------------------------- -dnl Check for working NI_WITHSCOPEID in getnameinfo() - -AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [ - AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl - AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl - AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \ - netdb.h netinet/in.h arpa/inet.h) - # - AC_CACHE_CHECK([for working NI_WITHSCOPEID], - [curl_cv_working_ni_withscopeid], [ - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - ]],[[ -#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE - struct sockaddr_storage sa; -#else - unsigned char sa[256]; -#endif - char hostbuf[NI_MAXHOST]; - int rc; - GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); - GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); - GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - int fd = socket(AF_INET6, SOCK_STREAM, 0); - if(fd < 0) { - perror("socket()"); - return 1; /* Error creating socket */ - } - rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); - if(rc) { - perror("getsockname()"); - return 2; /* Error retrieving socket name */ - } - rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); - if(rc) { - printf("rc = %s\n", gai_strerror(rc)); - return 3; /* Error translating socket address */ - } - return 0; /* Ok, NI_WITHSCOPEID works */ -#else - return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ -#endif - ]]) # AC-LANG-PROGRAM - ],[ - # Exit code == 0. Program worked. - curl_cv_working_ni_withscopeid="yes" - ],[ - # Exit code != 0. Program failed. - curl_cv_working_ni_withscopeid="no" - ],[ - # Program is not run when cross-compiling. So we assume - # NI_WITHSCOPEID will work if we are able to compile it. - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include -#include -#include - ]],[[ - unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - ]]) - ],[ - curl_cv_working_ni_withscopeid="yes" - ],[ - curl_cv_working_ni_withscopeid="no" - ]) # AC-COMPILE-IFELSE - ]) # AC-RUN-IFELSE - ]) # AC-CACHE-CHECK - case "$curl_cv_working_ni_withscopeid" in - yes) - AC_DEFINE(HAVE_NI_WITHSCOPEID, 1, - [Define to 1 if NI_WITHSCOPEID exists and works.]) - ;; - esac -]) - - dnl CURL_CHECK_FUNC_RECV dnl ------------------------------------------------- dnl Test if the socket recv() function is available, @@ -1336,6 +1064,10 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [ #endif #endif #else +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#endif #ifdef HAVE_SYS_TYPES_H #include #endif @@ -1381,6 +1113,10 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [ #endif #define RECVCALLCONV PASCAL #else +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#endif #ifdef HAVE_SYS_TYPES_H #include #endif @@ -1389,11 +1125,10 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [ #endif #define RECVCALLCONV #endif +#ifndef HAVE_PROTO_BSDSOCKET_H extern $recv_retv RECVCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); +#endif ]],[[ $recv_arg1 s=0; $recv_arg2 buf=0; @@ -1473,6 +1208,10 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ #endif #endif #else +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#endif #ifdef HAVE_SYS_TYPES_H #include #endif @@ -1518,6 +1257,10 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ #endif #define SENDCALLCONV PASCAL #else +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#endif #ifdef HAVE_SYS_TYPES_H #include #endif @@ -1526,11 +1269,10 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ #endif #define SENDCALLCONV #endif +#ifndef HAVE_PROTO_BSDSOCKET_H extern $send_retv SENDCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif send($send_arg1, $send_arg2, $send_arg3, $send_arg4); +#endif ]],[[ $send_arg1 s=0; $send_arg3 len=0; @@ -1632,6 +1374,10 @@ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [ #endif #endif #else +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#endif #ifdef HAVE_SYS_TYPES_H #include #endif @@ -1662,10 +1408,9 @@ dnl ------------------------------------------------- dnl Check for timeval struct AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ - AC_REQUIRE([AC_HEADER_TIME])dnl AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl - AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) + AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h) AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ @@ -1688,14 +1433,8 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif #ifdef HAVE_SYS_SOCKET_H #include #endif @@ -1719,50 +1458,6 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ ]) -dnl TYPE_SIG_ATOMIC_T -dnl ------------------------------------------------- -dnl Check if the sig_atomic_t type is available, and -dnl verify if it is already defined as volatile. - -AC_DEFUN([TYPE_SIG_ATOMIC_T], [ - AC_CHECK_HEADERS(signal.h) - AC_CHECK_TYPE([sig_atomic_t],[ - AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, - [Define to 1 if sig_atomic_t is an available typedef.]) - ], ,[ -#ifdef HAVE_SIGNAL_H -#include -#endif - ]) - case "$ac_cv_type_sig_atomic_t" in - yes) - # - AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#ifdef HAVE_SIGNAL_H -#include -#endif - ]],[[ - static volatile sig_atomic_t dummy = 0; - ]]) - ],[ - AC_MSG_RESULT([no]) - curl_cv_sig_atomic_t_volatile="no" - ],[ - AC_MSG_RESULT([yes]) - curl_cv_sig_atomic_t_volatile="yes" - ]) - # - if test "$curl_cv_sig_atomic_t_volatile" = "yes"; then - AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, - [Define to 1 if sig_atomic_t is already defined as volatile.]) - fi - ;; - esac -]) - - dnl TYPE_IN_ADDR_T dnl ------------------------------------------------- dnl Check for in_addr_t: it is used to receive the return code of inet_addr() @@ -1860,8 +1555,7 @@ dnl ------------------------------------------------- dnl Check if monotonic clock_gettime is available. AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ - AC_REQUIRE([AC_HEADER_TIME])dnl - AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) + AC_CHECK_HEADERS(sys/types.h sys/time.h) AC_MSG_CHECKING([for monotonic clock_gettime]) # if test "x$dontwant_rt" = "xno" ; then @@ -1872,14 +1566,8 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif ]],[[ struct timespec ts; (void)clock_gettime(CLOCK_MONOTONIC, &ts); @@ -1926,14 +1614,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif ]],[[ struct timespec ts; (void)clock_gettime(CLOCK_MONOTONIC, &ts); @@ -1971,7 +1653,7 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ if test "x$cross_compiling" != "xyes" && test "$curl_func_clock_gettime" = "yes"; then AC_MSG_CHECKING([if monotonic clock_gettime works]) - AC_RUN_IFELSE([ + CURL_RUN_IFELSE([ AC_LANG_PROGRAM([[ #ifdef HAVE_STDLIB_H #include @@ -1981,14 +1663,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif ]],[[ struct timespec ts; if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) @@ -2025,6 +1701,7 @@ dnl using current libraries or if another one is required. AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [ AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl AC_MSG_CHECKING([for connect in libraries]) tst_connect_save_LIBS="$LIBS" tst_connect_need_LIBS="unknown" @@ -2034,7 +1711,8 @@ AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [ AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ $curl_includes_winsock2 - #ifndef HAVE_WINDOWS_H + $curl_includes_bsdsocket + #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H) int connect(int, void*, int); #endif ]],[[ @@ -2083,130 +1761,6 @@ cat >>confdefs.h <<_EOF _EOF ]) - -dnl CURL_CONFIGURE_CURL_SOCKLEN_T -dnl ------------------------------------------------- -dnl The need for the curl_socklen_t definition arises mainly to properly -dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t -dnl data type which is 32 or 64-Bit wide depending on the data model being -dnl used, and that on the other hand is only actually used when interfacing -dnl the X/Open sockets provided in the xnet library. - -AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [ - AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl - AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl - AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl - # - AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl - # - AC_MSG_CHECKING([for curl_socklen_t data type]) - curl_typeof_curl_socklen_t="unknown" - for arg1 in int SOCKET; do - for arg2 in 'struct sockaddr' void; do - for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do - if test "$curl_typeof_curl_socklen_t" = "unknown"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_preprocess_callconv - extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); - ]],[[ - $t *lenptr = 0; - if(0 != getpeername(0, 0, lenptr)) - return 1; - ]]) - ],[ - curl_typeof_curl_socklen_t="$t" - ]) - fi - done - done - done - for t in socklen_t int; do - if test "$curl_typeof_curl_socklen_t" = "void"; then - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_sys_socket - typedef $t curl_socklen_t; - ]],[[ - curl_socklen_t dummy; - ]]) - ],[ - curl_typeof_curl_socklen_t="$t" - ]) - fi - done - AC_MSG_RESULT([$curl_typeof_curl_socklen_t]) - if test "$curl_typeof_curl_socklen_t" = "void" || - test "$curl_typeof_curl_socklen_t" = "unknown"; then - AC_MSG_ERROR([cannot find data type for curl_socklen_t.]) - fi - # - AC_MSG_CHECKING([size of curl_socklen_t]) - curl_sizeof_curl_socklen_t="unknown" - curl_pull_headers_socklen_t="unknown" - if test "$curl_cv_header_ws2tcpip_h" = "yes"; then - tst_pull_header_checks='none ws2tcpip' - tst_size_checks='4' - else - tst_pull_header_checks='none systypes syssocket' - tst_size_checks='4 8 2' - fi - for tst_size in $tst_size_checks; do - for tst_pull_headers in $tst_pull_header_checks; do - if test "$curl_sizeof_curl_socklen_t" = "unknown"; then - case $tst_pull_headers in - ws2tcpip) - tmp_includes="$curl_includes_ws2tcpip" - ;; - systypes) - tmp_includes="$curl_includes_sys_types" - ;; - syssocket) - tmp_includes="$curl_includes_sys_socket" - ;; - *) - tmp_includes="" - ;; - esac - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $tmp_includes - typedef $curl_typeof_curl_socklen_t curl_socklen_t; - typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1]; - ]],[[ - curl_socklen_t dummy; - ]]) - ],[ - curl_sizeof_curl_socklen_t="$tst_size" - curl_pull_headers_socklen_t="$tst_pull_headers" - ]) - fi - done - done - AC_MSG_RESULT([$curl_sizeof_curl_socklen_t]) - if test "$curl_sizeof_curl_socklen_t" = "unknown"; then - AC_MSG_ERROR([cannot find out size of curl_socklen_t.]) - fi - # - case $curl_pull_headers_socklen_t in - ws2tcpip) - CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H]) - ;; - systypes) - CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) - ;; - syssocket) - CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) - CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H]) - ;; - esac - CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t]) - CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t]) -]) - - dnl CURL_CONFIGURE_PULL_SYS_POLL dnl ------------------------------------------------- dnl The need for the sys/poll.h inclusion arises mainly to properly @@ -2280,21 +1834,22 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif #ifndef HAVE_WINDOWS_H #ifdef HAVE_SYS_SELECT_H #include +#elif defined(HAVE_UNISTD_H) +#include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +#endif #endif ]],[[ select(0, 0, 0, 0, 0); @@ -2338,21 +1893,22 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [ #endif #ifdef HAVE_SYS_TIME_H #include -#ifdef TIME_WITH_SYS_TIME -#include #endif -#else -#ifdef HAVE_TIME_H #include -#endif -#endif #ifndef HAVE_WINDOWS_H #ifdef HAVE_SYS_SELECT_H #include +#elif defined(HAVE_UNISTD_H) +#include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_PROTO_BSDSOCKET_H +#include +struct Library *SocketBase = NULL; +#define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +#endif #define SELECTCALLCONV #endif #ifndef HAVE_STRUCT_TIMEVAL @@ -2361,15 +1917,14 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [ long tv_usec; }; #endif +#ifndef HAVE_PROTO_BSDSOCKET_H extern $sel_retv SELECTCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - select($sel_arg1, + select($sel_arg1, $sel_arg234, $sel_arg234, $sel_arg234, $sel_arg5); +#endif ]],[[ $sel_arg1 nfds=0; $sel_arg234 rfds=0; @@ -2464,8 +2019,8 @@ AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [ dnl just run a program to verify that the libs checked for previous to this dnl point also is available run-time! AC_MSG_CHECKING([run-time libs availability]) - AC_TRY_RUN([ -main() + CURL_RUN_IFELSE([ +int main() { return 0; } @@ -2561,9 +2116,9 @@ AC_DEFUN([CURL_CHECK_CA_BUNDLE], [ AC_MSG_CHECKING([default CA cert bundle/path]) AC_ARG_WITH(ca-bundle, -AC_HELP_STRING([--with-ca-bundle=FILE], +AS_HELP_STRING([--with-ca-bundle=FILE], [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)]) -AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]), +AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]), [ want_ca="$withval" if test "x$want_ca" = "xyes"; then @@ -2572,12 +2127,12 @@ AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]), ], [ want_ca="unset" ]) AC_ARG_WITH(ca-path, -AC_HELP_STRING([--with-ca-path=DIRECTORY], +AS_HELP_STRING([--with-ca-path=DIRECTORY], [Path to a directory containing CA certificates stored individually, with \ -their filenames in a hash format. This option can be used with OpenSSL, \ -GnuTLS and PolarSSL backends. Refer to OpenSSL c_rehash for details. \ +their filenames in a hash format. This option can be used with the OpenSSL, \ +GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \ (example: /etc/certificates)]) -AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]), +AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]), [ want_capath="$withval" if test "x$want_capath" = "xyes"; then @@ -2601,8 +2156,8 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]), capath="no" elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then dnl --with-ca-path given - if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$POLARSSL_ENABLED" != "x1"; then - AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or PolarSSL]) + if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then + AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS]) fi capath="$want_capath" ca="no" @@ -2687,8 +2242,8 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]), AC_MSG_CHECKING([whether to use builtin CA store of SSL library]) AC_ARG_WITH(ca-fallback, -AC_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library]) -AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]), +AS_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library]) +AS_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]), [ if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter]) @@ -2749,11 +2304,54 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ AC_MSG_RESULT([yes (large file enabled)]) AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1, [Define to 1 if you are building a Windows target with large file support.]) + AC_SUBST(USE_WIN32_LARGE_FILES, [1]) ;; win32_small_files) AC_MSG_RESULT([yes (large file disabled)]) AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1, [Define to 1 if you are building a Windows target without large file support.]) + AC_SUBST(USE_WIN32_SMALL_FILES, [1]) + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +]) + +dnl CURL_CHECK_WIN32_CRYPTO +dnl ------------------------------------------------- +dnl Check if curl's WIN32 crypto lib can be used + +AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINCRYPT])dnl + AC_MSG_CHECKING([whether build target supports WIN32 crypto API]) + curl_win32_crypto_api="no" + if test "$curl_cv_header_wincrypt_h" = "yes"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + ]],[[ + HCRYPTPROV hCryptProv; + if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + CryptReleaseContext(hCryptProv, 0); + } + ]]) + ],[ + curl_win32_crypto_api="yes" + ]) + fi + case "$curl_win32_crypto_api" in + yes) + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1, + [Define to 1 if you are building a Windows target with crypto API support.]) + AC_SUBST(USE_WIN32_CRYPTO, [1]) ;; *) AC_MSG_RESULT([no]) @@ -2902,14 +2500,13 @@ TEST EINVAL TEST ]) -dnl CURL_MAC_CFLAGS +dnl CURL_DARWIN_CFLAGS dnl -dnl Check if -mmacosx-version-min, -miphoneos-version-min or any -dnl similar are set manually, otherwise do. And set -dnl -Werror=partial-availability. +dnl Set -Werror=partial-availability to detect possible breaking code +dnl with very low deployment targets. dnl -AC_DEFUN([CURL_MAC_CFLAGS], [ +AC_DEFUN([CURL_DARWIN_CFLAGS], [ tst_cflags="no" case $host_os in @@ -2918,22 +2515,10 @@ AC_DEFUN([CURL_MAC_CFLAGS], [ ;; esac - AC_MSG_CHECKING([for good-to-use Mac CFLAGS]) + AC_MSG_CHECKING([for good-to-use Darwin CFLAGS]) AC_MSG_RESULT([$tst_cflags]); if test "$tst_cflags" = "yes"; then - AC_MSG_CHECKING([for *version-min in CFLAGS]) - min="" - if test -z "$(echo $CFLAGS | grep m.*os.*-version-min)"; then - min="-mmacosx-version-min=10.8" - CFLAGS="$CFLAGS $min" - fi - if test -z "$min"; then - AC_MSG_RESULT([set by user]) - else - AC_MSG_RESULT([$min set]) - fi - old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror=partial-availability" AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability]) diff --git a/curl/aclocal.m4 b/curl/aclocal.m4 deleted file mode 100644 index c17bd614..00000000 --- a/curl/aclocal.m4 +++ /dev/null @@ -1,1209 +0,0 @@ -# generated automatically by aclocal 1.15.1 -*- Autoconf -*- - -# Copyright (C) 1996-2017 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# Copyright (C) 2002-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi -dnl The trailing newline in this macro's definition is deliberate, for -dnl backward compatibility and to allow trailing 'dnl'-style comments -dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. -]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- -# From Jim Meyering - -# Copyright (C) 1996-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAINTAINER_MODE([DEFAULT-MODE]) -# ---------------------------------- -# Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless 'enable' is passed literally. -# For symmetry, 'disable' may be passed as well. Anyway, the user -# can override the default with the --enable/--disable switch. -AC_DEFUN([AM_MAINTAINER_MODE], -[m4_case(m4_default([$1], [disable]), - [enable], [m4_define([am_maintainer_other], [disable])], - [disable], [m4_define([am_maintainer_other], [enable])], - [m4_define([am_maintainer_other], [enable]) - m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode's default is 'disable' unless 'enable' is passed - AC_ARG_ENABLE([maintainer-mode], - [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], - am_maintainer_other[ make rules and dependencies not useful - (and sometimes confusing) to the casual installer])], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) - AC_MSG_RESULT([$USE_MAINTAINER_MODE]) - AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST([MAINT])dnl -] -) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2017 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([m4/ax_code_coverage.m4]) -m4_include([m4/curl-compilers.m4]) -m4_include([m4/curl-confopts.m4]) -m4_include([m4/curl-functions.m4]) -m4_include([m4/curl-openssl.m4]) -m4_include([m4/curl-override.m4]) -m4_include([m4/curl-reentrant.m4]) -m4_include([m4/libtool.m4]) -m4_include([m4/ltoptions.m4]) -m4_include([m4/ltsugar.m4]) -m4_include([m4/ltversion.m4]) -m4_include([m4/lt~obsolete.m4]) -m4_include([m4/xc-am-iface.m4]) -m4_include([m4/xc-cc-check.m4]) -m4_include([m4/xc-lt-iface.m4]) -m4_include([m4/xc-translit.m4]) -m4_include([m4/xc-val-flgs.m4]) -m4_include([m4/zz40-xc-ovr.m4]) -m4_include([m4/zz50-xc-ovr.m4]) -m4_include([m4/zz60-xc-ovr.m4]) -m4_include([acinclude.m4]) diff --git a/curl/appveyor.yml b/curl/appveyor.yml new file mode 100644 index 00000000..255b436e --- /dev/null +++ b/curl/appveyor.yml @@ -0,0 +1,318 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +version: 7.50.0.{build} + +environment: + matrix: + # generated CMake-based Visual Studio Release builds + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 9 2008" + PRJ_CFG: Release + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: OFF + SHARED: ON + DISABLED_TESTS: "" + COMPILER_PATH: "" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 16 2019" + TARGET: "-A x64" + PRJ_CFG: Release + OPENSSL: ON + SCHANNEL: OFF + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: OFF + SHARED: ON + DISABLED_TESTS: "" + COMPILER_PATH: "" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 16 2019" + TARGET: "-A ARM64" + PRJ_CFG: Release + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: OFF + SHARED: OFF + DISABLED_TESTS: "" + COMPILER_PATH: "" + # generated CMake-based Visual Studio Debug builds + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 10 2010 Win64" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: OFF + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 16 2019" + TARGET: "-A x64" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: ON + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "~571 !1139 !1501 " + COMPILER_PATH: "" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 16 2019" + TARGET: "-A x64" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: OFF + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "~571 !1139 !1501" + COMPILER_PATH: "" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: CMake + PRJ_GEN: "Visual Studio 16 2019" + TARGET: "-A x64" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: OFF + ENABLE_UNICODE: OFF + HTTP_ONLY: ON + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "" + # generated CMake-based MSYS Makefiles builds (mingw cross-compiling) + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: CMake + PRJ_GEN: "MSYS Makefiles" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: ON + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "C:\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin" + MSYS2_ARG_CONV_EXCL: "/*" + BUILD_OPT: -k + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: CMake + PRJ_GEN: "MSYS Makefiles" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: ON + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "C:\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev1\\mingw64\\bin" + MSYS2_ARG_CONV_EXCL: "/*" + BUILD_OPT: -k + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: CMake + PRJ_GEN: "MSYS Makefiles" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: ON + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "C:\\mingw-w64\\i686-6.3.0-posix-dwarf-rt_v5-rev1\\mingw32\\bin" + MSYS2_ARG_CONV_EXCL: "/*" + BUILD_OPT: -k + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: CMake + PRJ_GEN: "MSYS Makefiles" + PRJ_CFG: Debug + OPENSSL: OFF + SCHANNEL: OFF + ENABLE_UNICODE: OFF + HTTP_ONLY: OFF + TESTING: ON + SHARED: OFF + DISABLED_TESTS: "!1139 !1501" + COMPILER_PATH: "C:\\MinGW\\bin" + MSYS2_ARG_CONV_EXCL: "/*" + BUILD_OPT: -k + # winbuild-based builds + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: winbuild_vs2015 + DEBUG: yes + PATHPART: debug + TESTING: OFF + ENABLE_UNICODE: no + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: winbuild_vs2015 + DEBUG: no + PATHPART: release + TESTING: OFF + ENABLE_UNICODE: no + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: winbuild_vs2017 + DEBUG: yes + PATHPART: debug + TESTING: OFF + ENABLE_UNICODE: no + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: winbuild_vs2017 + DEBUG: no + PATHPART: release + TESTING: OFF + ENABLE_UNICODE: no + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: winbuild_vs2015 + DEBUG: yes + PATHPART: debug + TESTING: OFF + ENABLE_UNICODE: yes + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: winbuild_vs2015 + DEBUG: no + PATHPART: release + TESTING: OFF + ENABLE_UNICODE: yes + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: winbuild_vs2017 + DEBUG: yes + PATHPART: debug + TESTING: OFF + ENABLE_UNICODE: yes + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: winbuild_vs2017 + DEBUG: no + PATHPART: release + TESTING: OFF + ENABLE_UNICODE: yes + # generated VisualStudioSolution-based builds + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + BUILD_SYSTEM: VisualStudioSolution + PRJ_CFG: "DLL Debug - DLL Windows SSPI - DLL WinIDN" + TESTING: OFF + VC_VERSION: VC15 + # autotools-based builds (NOT mingw cross-compiling, but msys2 native) + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2015" + BUILD_SYSTEM: autotools + TESTING: ON + DISABLED_TESTS: "!19 ~1056 !1233" + CONFIG_ARGS: "--enable-debug --enable-werror --disable-threaded-resolver --disable-proxy --with-schannel" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: autotools + TESTING: ON + DISABLED_TESTS: "!19 !504 !704 !705 ~1056 !1233" + CONFIG_ARGS: "--enable-debug --enable-werror --disable-threaded-resolver --with-schannel" + - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" + BUILD_SYSTEM: autotools + TESTING: ON + DISABLED_TESTS: "!19 !504 !704 !705 ~1056 !1233" + CONFIG_ARGS: "--enable-warnings --enable-werror --with-schannel" + +install: + - set "PATH=C:\msys64\usr\bin;%PATH%" + - if not "%COMPILER_PATH%"=="" ( + set "PATH=%COMPILER_PATH%;%PATH%" ) + +build_script: + - if %BUILD_SYSTEM%==CMake ( + cmake . + -G"%PRJ_GEN%" + %TARGET% + -DCMAKE_USE_OPENSSL=%OPENSSL% + -DCMAKE_USE_SCHANNEL=%SCHANNEL% + -DHTTP_ONLY=%HTTP_ONLY% + -DBUILD_SHARED_LIBS=%SHARED% + -DBUILD_TESTING=%TESTING% + -DCURL_WERROR=ON + -DENABLE_DEBUG=ON + -DENABLE_UNICODE=%ENABLE_UNICODE% + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE="" + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG="" + -DCMAKE_INSTALL_PREFIX="C:/CURL" + -DCMAKE_BUILD_TYPE=%PRJ_CFG% && + cmake --build . --config %PRJ_CFG% --parallel 2 --clean-first -- %BUILD_OPT% + ) else ( + if %BUILD_SYSTEM%==VisualStudioSolution ( + cd projects && + .\\generate.bat %VC_VERSION% && + msbuild.exe /p:Configuration="%PRJ_CFG%" "Windows\\%VC_VERSION%\\curl-all.sln" + ) else ( + if %BUILD_SYSTEM%==winbuild_vs2015 ( + call buildconf.bat && + cd winbuild && + call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 && + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 && + nmake /f Makefile.vc mode=dll VC=14 "SSL_PATH=C:\OpenSSL-v111-Win64" WITH_SSL=dll MACHINE=x64 DEBUG=%DEBUG% ENABLE_UNICODE=%ENABLE_UNICODE% && + ..\builds\libcurl-vc14-x64-%PATHPART%-dll-ssl-dll-ipv6-sspi\bin\curl.exe -V + ) else ( + if %BUILD_SYSTEM%==winbuild_vs2017 ( + call buildconf.bat && + cd winbuild && + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" && + nmake /f Makefile.vc mode=dll VC=15 "SSL_PATH=C:\OpenSSL-v111-Win64" WITH_SSL=dll MACHINE=x64 DEBUG=%DEBUG% ENABLE_UNICODE=%ENABLE_UNICODE% && + ..\builds\libcurl-vc15-x64-%PATHPART%-dll-ssl-dll-ipv6-sspi\bin\curl.exe -V + ) else ( + if %BUILD_SYSTEM%==autotools ( + bash.exe -e -l -c "cd /c/projects/curl && ./buildconf && ./configure %CONFIG_ARGS% && make && make examples && cd tests && make" + ))))) + - if %TESTING%==ON ( + if %BUILD_SYSTEM%==CMake ( + cmake --build . --config %PRJ_CFG% --parallel 2 --target testdeps + )) + +test_script: + - if %TESTING%==ON ( + if %BUILD_SYSTEM%==CMake ( + set TFLAGS=%DISABLED_TESTS% && + cmake --build . --config %PRJ_CFG% --target test-nonflaky + ) else ( + echo APPVEYOR_API_URL=%APPVEYOR_API_URL% && + bash.exe -e -l -c "cd /c/projects/curl/tests && ./runtests.pl -a -p -u !flaky %DISABLED_TESTS%" )) + +# select branches to avoid testing feature branches twice (as branch and as pull request) +branches: + only: + - master + - /\/ci$/ + +artifacts: + - path: '**/curl.exe' + name: curl + - path: '**/*curl*.dll' + name: libcurl diff --git a/curl/buildconf b/curl/buildconf index 50957531..4e4c17e9 100644 --- a/curl/buildconf +++ b/curl/buildconf @@ -1,448 +1,4 @@ #!/bin/sh -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -#-------------------------------------------------------------------------- -# die prints argument string to stdout and exits this shell script. -# -die(){ - echo "buildconf: $@" - exit 1 -} - -#-------------------------------------------------------------------------- -# findtool works as 'which' but we use a different name to make it more -# obvious we aren't using 'which'! ;-) -# Unlike 'which' does, the current directory is ignored. -# -findtool(){ - file="$1" - - if { echo "$file" | grep "/" >/dev/null 2>&1; } then - # when file is given with a path check it first - if test -f "$file"; then - echo "$file" - return - fi - fi - - old_IFS=$IFS; IFS=':' - for path in $PATH - do - IFS=$old_IFS - # echo "checks for $file in $path" >&2 - if test "$path" -a "$path" != '.' -a -f "$path/$file"; then - echo "$path/$file" - return - fi - done - IFS=$old_IFS -} - -#-------------------------------------------------------------------------- -# removethis() removes all files and subdirectories with the given name, -# inside and below the current subdirectory at invocation time. -# -removethis(){ - if test "$#" = "1"; then - find . -depth -name $1 -print > buildconf.tmp.$$ - while read fdname - do - if test -f "$fdname"; then - rm -f "$fdname" - elif test -d "$fdname"; then - rm -f -r "$fdname" - fi - done < buildconf.tmp.$$ - rm -f buildconf.tmp.$$ - fi -} - -#-------------------------------------------------------------------------- -# Ensure that buildconf runs from the subdirectory where configure.ac lives -# -if test ! -f configure.ac || - test ! -f src/tool_main.c || - test ! -f lib/urldata.h || - test ! -f include/curl/curl.h || - test ! -f m4/curl-functions.m4; then - echo "Can not run buildconf from outside of curl's source subdirectory!" - echo "Change to the subdirectory where buildconf is found, and try again." - exit 1 -fi - -#-------------------------------------------------------------------------- -# autoconf 2.57 or newer. Unpatched version 2.67 does not generate proper -# configure script. Unpatched version 2.68 is simply unusable, we should -# disallow 2.68 usage. -# -need_autoconf="2.57" -ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` -if test -z "$ac_version"; then - echo "buildconf: autoconf not found." - echo " You need autoconf version $need_autoconf or newer installed." - exit 1 -fi -old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS -if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then - echo "buildconf: autoconf version $ac_version found." - echo " You need autoconf version $need_autoconf or newer installed." - echo " If you have a sufficient autoconf installed, but it" - echo " is not named 'autoconf', then try setting the" - echo " AUTOCONF environment variable." - exit 1 -fi - -if test "$1" = "2" -a "$2" -eq "67"; then - echo "buildconf: autoconf version $ac_version (BAD)" - echo " Unpatched version generates broken configure script." -elif test "$1" = "2" -a "$2" -eq "68"; then - echo "buildconf: autoconf version $ac_version (BAD)" - echo " Unpatched version generates unusable configure script." -else - echo "buildconf: autoconf version $ac_version (ok)" -fi - -am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` -if test -z "$am4te_version"; then - echo "buildconf: autom4te not found. Weird autoconf installation!" - exit 1 -fi -if test "$am4te_version" = "$ac_version"; then - echo "buildconf: autom4te version $am4te_version (ok)" -else - echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)" - exit 1 -fi - -#-------------------------------------------------------------------------- -# autoheader 2.50 or newer -# -ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` -if test -z "$ah_version"; then - echo "buildconf: autoheader not found." - echo " You need autoheader version 2.50 or newer installed." - exit 1 -fi -old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS -if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then - echo "buildconf: autoheader version $ah_version found." - echo " You need autoheader version 2.50 or newer installed." - echo " If you have a sufficient autoheader installed, but it" - echo " is not named 'autoheader', then try setting the" - echo " AUTOHEADER environment variable." - exit 1 -fi - -echo "buildconf: autoheader version $ah_version (ok)" - -#-------------------------------------------------------------------------- -# automake 1.7 or newer -# -need_automake="1.7" -am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'` -if test -z "$am_version"; then - echo "buildconf: automake not found." - echo " You need automake version $need_automake or newer installed." - exit 1 -fi -old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS -if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then - echo "buildconf: automake version $am_version found." - echo " You need automake version $need_automake or newer installed." - echo " If you have a sufficient automake installed, but it" - echo " is not named 'automake', then try setting the" - echo " AUTOMAKE environment variable." - exit 1 -fi - -echo "buildconf: automake version $am_version (ok)" - -acloc_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'` -if test -z "$acloc_version"; then - echo "buildconf: aclocal not found. Weird automake installation!" - exit 1 -fi -if test "$acloc_version" = "$am_version"; then - echo "buildconf: aclocal version $acloc_version (ok)" -else - echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)" - exit 1 -fi - -#-------------------------------------------------------------------------- -# GNU libtoolize preliminary check -# -want_lt_major=1 -want_lt_minor=4 -want_lt_patch=2 -want_lt_version=1.4.2 - -# This approach that tries 'glibtoolize' first is intended for systems that -# have GNU libtool named as 'glibtoolize' and libtoolize not being GNU's. - -libtoolize=`findtool glibtoolize 2>/dev/null` -if test ! -x "$libtoolize"; then - libtoolize=`findtool ${LIBTOOLIZE:-libtoolize}` -fi -if test -z "$libtoolize"; then - echo "buildconf: libtoolize not found." - echo " You need GNU libtoolize $want_lt_version or newer installed." - exit 1 -fi - -lt_pver=`$libtoolize --version 2>/dev/null|head -n 1` -lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"` -lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"` -if test -z "$lt_version"; then - echo "buildconf: libtoolize not found." - echo " You need GNU libtoolize $want_lt_version or newer installed." - exit 1 -fi -old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS -lt_major=$1 -lt_minor=$2 -lt_patch=$3 - -if test -z "$lt_major"; then - lt_status="bad" -elif test "$lt_major" -gt "$want_lt_major"; then - lt_status="good" -elif test "$lt_major" -lt "$want_lt_major"; then - lt_status="bad" -elif test -z "$lt_minor"; then - lt_status="bad" -elif test "$lt_minor" -gt "$want_lt_minor"; then - lt_status="good" -elif test "$lt_minor" -lt "$want_lt_minor"; then - lt_status="bad" -elif test -z "$lt_patch"; then - lt_status="bad" -elif test "$lt_patch" -gt "$want_lt_patch"; then - lt_status="good" -elif test "$lt_patch" -lt "$want_lt_patch"; then - lt_status="bad" -else - lt_status="good" -fi -if test "$lt_status" != "good"; then - echo "buildconf: libtoolize version $lt_version found." - echo " You need GNU libtoolize $want_lt_version or newer installed." - exit 1 -fi - -echo "buildconf: libtoolize version $lt_version (ok)" - -#-------------------------------------------------------------------------- -# m4 check -# -m4=`(${M4:-m4} --version 0<&- || ${M4:-gm4} --version) 2>/dev/null 0<&- | head -n 1`; -m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'` - -if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then - echo "buildconf: GNU m4 version $m4_version (ok)" -else - if test -z "$m4"; then - echo "buildconf: m4 version not recognized. You need a GNU m4 installed!" - else - echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!" - fi - exit 1 -fi - -#-------------------------------------------------------------------------- -# perl check -# -PERL=`findtool ${PERL:-perl}` -if test -z "$PERL"; then - echo "buildconf: perl not found" - exit 1 -fi - -#-------------------------------------------------------------------------- -# Remove files generated on previous buildconf/configure run. -# -for fname in .deps \ - .libs \ - *.la \ - *.lo \ - *.a \ - *.o \ - Makefile \ - Makefile.in \ - aclocal.m4 \ - aclocal.m4.bak \ - ares_build.h \ - ares_config.h \ - ares_config.h.in \ - autom4te.cache \ - compile \ - config.guess \ - curl_config.h \ - curl_config.h.in \ - config.log \ - config.lt \ - config.status \ - config.sub \ - configure \ - configurehelp.pm \ - curl-config \ - depcomp \ - libcares.pc \ - libcurl.pc \ - libtool \ - libtool.m4 \ - libtool.m4.tmp \ - ltmain.sh \ - ltoptions.m4 \ - ltsugar.m4 \ - ltversion.m4 \ - lt~obsolete.m4 \ - missing \ - install-sh \ - stamp-h1 \ - stamp-h2 \ - stamp-h3 ; do - removethis "$fname" -done - -#-------------------------------------------------------------------------- -# run the correct scripts now -# - -echo "buildconf: running libtoolize" -${libtoolize} --copy --force || die "libtoolize command failed" - -# When using libtool 1.5.X (X < 26) we copy libtool.m4 to our local m4 -# subdirectory and this local copy is patched to fix some warnings that -# are triggered when running aclocal and using autoconf 2.62 or later. - -if test "$lt_major" = "1" && test "$lt_minor" = "5"; then - if test -z "$lt_patch" || test "$lt_patch" -lt "26"; then - echo "buildconf: copying libtool.m4 to local m4 subdir" - ac_dir=`${ACLOCAL:-aclocal} --print-ac-dir` - if test -f $ac_dir/libtool.m4; then - cp -f $ac_dir/libtool.m4 m4/libtool.m4 - else - echo "buildconf: $ac_dir/libtool.m4 not found" - fi - if test -f m4/libtool.m4; then - echo "buildconf: renaming some variables in local m4/libtool.m4" - $PERL -i.tmp -pe \ - 's/lt_prog_compiler_pic_works/lt_cv_prog_compiler_pic_works/g; \ - s/lt_prog_compiler_static_works/lt_cv_prog_compiler_static_works/g;' \ - m4/libtool.m4 - rm -f m4/libtool.m4.tmp - fi - fi -fi - -if test -f m4/libtool.m4; then - echo "buildconf: converting all mv to mv -f in local m4/libtool.m4" - $PERL -i.tmp -pe 's/\bmv +([^-\s])/mv -f $1/g' m4/libtool.m4 - rm -f m4/libtool.m4.tmp -fi - -echo "buildconf: running aclocal" -${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "aclocal command failed" - -echo "buildconf: converting all mv to mv -f in local aclocal.m4" -$PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4 - -echo "buildconf: running autoheader" -${AUTOHEADER:-autoheader} || die "autoheader command failed" - -echo "buildconf: running autoconf" -${AUTOCONF:-autoconf} || die "autoconf command failed" - -if test -d ares; then - cd ares - echo "buildconf: running in ares" - ./buildconf - cd .. -fi - -echo "buildconf: running automake" -${AUTOMAKE:-automake} --add-missing --copy || die "automake command failed" - -#-------------------------------------------------------------------------- -# GNU libtool complementary check -# -# Depending on the libtool and automake versions being used, config.guess -# might not be installed in the subdirectory until automake has finished. -# So we can not attempt to use it until this very last buildconf stage. -# -if test ! -f ./config.guess; then - echo "buildconf: config.guess not found" -else - buildhost=`./config.guess 2>/dev/null|head -n 1` - case $buildhost in - *-*-darwin*) - need_lt_major=1 - need_lt_minor=5 - need_lt_patch=26 - need_lt_check="yes" - ;; - *-*-hpux*) - need_lt_major=1 - need_lt_minor=5 - need_lt_patch=24 - need_lt_check="yes" - ;; - esac - if test ! -z "$need_lt_check"; then - if test -z "$lt_major"; then - lt_status="bad" - elif test "$lt_major" -gt "$need_lt_major"; then - lt_status="good" - elif test "$lt_major" -lt "$need_lt_major"; then - lt_status="bad" - elif test -z "$lt_minor"; then - lt_status="bad" - elif test "$lt_minor" -gt "$need_lt_minor"; then - lt_status="good" - elif test "$lt_minor" -lt "$need_lt_minor"; then - lt_status="bad" - elif test -z "$lt_patch"; then - lt_status="bad" - elif test "$lt_patch" -gt "$need_lt_patch"; then - lt_status="good" - elif test "$lt_patch" -lt "$need_lt_patch"; then - lt_status="bad" - else - lt_status="good" - fi - if test "$lt_status" != "good"; then - need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch" - echo "buildconf: libtool version $lt_version found." - echo " $buildhost requires GNU libtool $need_lt_version or newer installed." - rm -f configure - exit 1 - fi - fi -fi - -#-------------------------------------------------------------------------- -# Finished successfully. -# -echo "buildconf: OK" -exit 0 +echo "*** Do not use buildconf. Instead, just use: autoreconf -fi" >&2 +exec ${AUTORECONF:-autoreconf} -fi "${@}" diff --git a/curl/buildconf.bat b/curl/buildconf.bat index da5c0391..13ae07e1 100644 --- a/curl/buildconf.bat +++ b/curl/buildconf.bat @@ -6,11 +6,11 @@ rem * / __| | | | |_) | | rem * | (__| |_| | _ <| |___ rem * \___|\___/|_| \_\_____| rem * -rem * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +rem * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. rem * rem * This software is licensed as described in the file COPYING, which rem * you should have received as part of this distribution. The terms -rem * are also available at https://curl.haxx.se/docs/copyright.html. +rem * are also available at https://curl.se/docs/copyright.html. rem * rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell rem * copies of the Software, and permit persons to whom the Software is @@ -93,7 +93,7 @@ rem rem Returns: rem rem 0 - success -rem 1 - success with simplified tool_hugehelp.c +rem 1 - success with simplified tool_hugehelp.c rem 2 - failed to generate Makefile rem 3 - failed to generate tool_hugehelp.c rem @@ -193,7 +193,7 @@ rem if defined ROFFCMD ( echo #include "tool_setup.h"> src\tool_hugehelp.c - echo #include "tool_hugehelp.h">> src\tool_hugehelp.c + echo #include "tool_hugehelp.h">> src\tool_hugehelp.c if defined HAVE_GZIP ( echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c @@ -212,7 +212,7 @@ rem copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1 ) else ( echo #include "tool_setup.h"> src\tool_hugehelp.c - echo #include "tool_hugehelp.hd">> src\tool_hugehelp.c + echo #include "tool_hugehelp.h">> src\tool_hugehelp.c echo.>> src\tool_hugehelp.c echo void hugehelp(void^)>> src\tool_hugehelp.c echo {>> src\tool_hugehelp.c diff --git a/curl/compile b/curl/compile deleted file mode 100644 index a85b723c..00000000 --- a/curl/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/curl/config.guess b/curl/config.guess deleted file mode 100644 index 2e9ad7fe..00000000 --- a/curl/config.guess +++ /dev/null @@ -1,1462 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. - -timestamp='2016-10-02' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess -# -# Please send patches to . - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case "${UNAME_MACHINE_ARCH}" in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE=alpha ;; - "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; - "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; - "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; - "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; - "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; - "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; - "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; - "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; - "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; - "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; - "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = hppa2.0w ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH=hppa2.0w - else - HP_ARCH=hppa64 - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - k1om:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - mips64el:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = 386; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; - amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; -esac - -cat >&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/curl/config.sub b/curl/config.sub deleted file mode 100644 index dd2ca93c..00000000 --- a/curl/config.sub +++ /dev/null @@ -1,1825 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. - -timestamp='2016-11-04' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2016 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -ios) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/curl/configure b/curl/configure deleted file mode 100644 index c6701b52..00000000 --- a/curl/configure +++ /dev/null @@ -1,43759 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for curl -. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -# -# Copyright (c) 1998 - 2017 Daniel Stenberg, -# This configure script may be copied, distributed and modified under the -# terms of the curl license; see COPYING for more details - -## -------------------------------- ## -## XC_CONFIGURE_PREAMBLE ver: 1.0 ## -## -------------------------------- ## - -xc_configure_preamble_ver_major='1' -xc_configure_preamble_ver_minor='0' - -# -# Set IFS to space, tab and newline. -# - -xc_space=' ' -xc_tab=' ' -xc_newline=' -' -IFS="$xc_space$xc_tab$xc_newline" - -# -# Set internationalization behavior variables. -# - -LANG='C' -LC_ALL='C' -LANGUAGE='C' -export LANG -export LC_ALL -export LANGUAGE - -# -# Some useful variables. -# - -xc_msg_warn='configure: WARNING:' -xc_msg_abrt='Can not continue.' -xc_msg_err='configure: error:' - -# -# Verify that 'echo' command is available, otherwise abort. -# - -xc_tst_str='unknown' -(`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - # Try built-in echo, and fail. - echo "$xc_msg_err 'echo' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'test' command is available, otherwise abort. -# - -xc_tst_str='unknown' -(`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'test' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'PATH' variable is set, otherwise abort. -# - -xc_tst_str='unknown' -(`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'PATH' variable not set. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'expr' command is available, otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null` -case "x$xc_tst_str" in # (( - x7) - : - ;; - *) - echo "$xc_msg_err 'expr' command not found. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'sed' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | sed -e 's:unknown:success:' 2>/dev/null` -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'sed' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'grep' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -(`echo "$xc_tst_str" 2>/dev/null \ - | grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success' -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'grep' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'tr' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str="${xc_tab}98s7u6c5c4e3s2s10" -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | tr -d "0123456789$xc_tab" 2>/dev/null` -case "x$xc_tst_str" in # (( - xsuccess) - : - ;; - *) - echo "$xc_msg_err 'tr' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'wc' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown unknown unknown unknown' -xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \ - | wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null` -case "x$xc_tst_str" in # (( - x4) - : - ;; - *) - echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Verify that 'cat' utility is found within 'PATH', otherwise abort. -# - -xc_tst_str='unknown' -xc_tst_str=`cat <<_EOT 2>/dev/null \ - | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null -unknown -unknown -unknown -_EOT` -case "x$xc_tst_str" in # (( - x3) - : - ;; - *) - echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2 - exit 1 - ;; -esac - -# -# Auto-detect and set 'PATH_SEPARATOR', unless it is already non-empty set. -# - -# Directory count in 'PATH' when using a colon separator. -xc_tst_dirs_col='x' -xc_tst_prev_IFS=$IFS; IFS=':' -for xc_tst_dir in $PATH; do - IFS=$xc_tst_prev_IFS - xc_tst_dirs_col="x$xc_tst_dirs_col" -done -IFS=$xc_tst_prev_IFS -xc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'` - -# Directory count in 'PATH' when using a semicolon separator. -xc_tst_dirs_sem='x' -xc_tst_prev_IFS=$IFS; IFS=';' -for xc_tst_dir in $PATH; do - IFS=$xc_tst_prev_IFS - xc_tst_dirs_sem="x$xc_tst_dirs_sem" -done -IFS=$xc_tst_prev_IFS -xc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'` - -if test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then - # When both counting methods give the same result we do not want to - # chose one over the other, and consider auto-detection not possible. - if test -z "$PATH_SEPARATOR"; then - # Stop dead until user provides 'PATH_SEPARATOR' definition. - echo "$xc_msg_err 'PATH_SEPARATOR' variable not set. $xc_msg_abrt" >&2 - exit 1 - fi -else - # Separator with the greater directory count is the auto-detected one. - if test $xc_tst_dirs_sem -gt $xc_tst_dirs_col; then - xc_tst_auto_separator=';' - else - xc_tst_auto_separator=':' - fi - if test -z "$PATH_SEPARATOR"; then - # Simply use the auto-detected one when not already set. - PATH_SEPARATOR=$xc_tst_auto_separator - elif test "x$PATH_SEPARATOR" != "x$xc_tst_auto_separator"; then - echo "$xc_msg_warn 'PATH_SEPARATOR' does not match auto-detected one." >&2 - fi -fi -xc_PATH_SEPARATOR=$PATH_SEPARATOR - -xc_configure_preamble_result='yes' - - -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and a suitable curl -$0: mailing list: https://curl.haxx.se/mail/ about your -$0: system, including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='curl' -PACKAGE_TARNAME='curl' -PACKAGE_VERSION='-' -PACKAGE_STRING='curl -' -PACKAGE_BUGREPORT='a suitable curl mailing list: https://curl.haxx.se/mail/' -PACKAGE_URL='' - -ac_unique_file="lib/urldata.h" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -enable_option_checking=no -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -SUPPORT_PROTOCOLS -SUPPORT_FEATURES -ENABLE_STATIC -ENABLE_SHARED -CROSSCOMPILING_FALSE -CROSSCOMPILING_TRUE -BLANK_AT_MAKETIME -CURL_NETWORK_AND_TIME_LIBS -CURL_NETWORK_LIBS -LIBCURL_LIBS -CFLAG_CURL_SYMBOL_HIDING -DOING_CURL_SYMBOL_HIDING_FALSE -DOING_CURL_SYMBOL_HIDING_TRUE -USE_UNIX_SOCKETS -BUILD_LIBHOSTNAME_FALSE -BUILD_LIBHOSTNAME_TRUE -USE_EMBEDDED_ARES_FALSE -USE_EMBEDDED_ARES_TRUE -USE_ARES -subdirs -USE_MANUAL_FALSE -USE_MANUAL_TRUE -MANOPT -NROFF -PERL -IPV6_ENABLED -ZSH_FUNCTIONS_DIR -USE_NGHTTP2 -IDN_ENABLED -CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_FALSE -CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_TRUE -CURL_LT_SHLIB_VERSIONED_FLAVOUR -USE_LIBRTMP -USE_LIBSSH2 -LIBMETALINK_CPPFLAGS -LIBMETALINK_LDFLAGS -LIBMETALINK_LIBS -USE_LIBPSL_FALSE -USE_LIBPSL_TRUE -CURL_CA_BUNDLE -CURL_WITH_MULTI_SSL -SSL_ENABLED -USE_AXTLS -NSS_LIBS -USE_NSS -USE_CYASSL -USE_MBEDTLS -USE_POLARSSL -HAVE_GNUTLS_SRP -USE_GNUTLS_NETTLE -USE_GNUTLS -HAVE_OPENSSL_SRP -RANDOM_FILE -SSL_LIBS -USE_DARWINSSL -USE_WINDOWS_SSPI -USE_SCHANNEL -DEFAULT_SSL_BACKEND -BUILD_STUB_GSS_FALSE -BUILD_STUB_GSS_TRUE -USE_OPENLDAP -ZLIB_LIBS -HAVE_LIBZ_FALSE -HAVE_LIBZ_TRUE -HAVE_LIBZ -PKGCONFIG -CURL_DISABLE_GOPHER -CURL_DISABLE_SMTP -CURL_DISABLE_SMB -CURL_DISABLE_IMAP -CURL_DISABLE_POP3 -CURL_DISABLE_TFTP -CURL_DISABLE_TELNET -CURL_DISABLE_DICT -CURL_DISABLE_PROXY -HAVE_LDAP_SSL -CURL_DISABLE_LDAPS -CURL_DISABLE_LDAP -CURL_DISABLE_FILE -CURL_DISABLE_FTP -CURL_DISABLE_RTSP -CURL_DISABLE_HTTP -DOING_NATIVE_WINDOWS_FALSE -DOING_NATIVE_WINDOWS_TRUE -BUILD_UNITTESTS_FALSE -BUILD_UNITTESTS_TRUE -CURLDEBUG_FALSE -CURLDEBUG_TRUE -USE_EXPLICIT_LIB_DEPS_FALSE -USE_EXPLICIT_LIB_DEPS_TRUE -REQUIRE_LIB_DEPS -CPPFLAG_CURL_STATICLIB -USE_CPPFLAG_CURL_STATICLIB_FALSE -USE_CPPFLAG_CURL_STATICLIB_TRUE -CURL_LT_SHLIB_USE_MIMPURE_TEXT_FALSE -CURL_LT_SHLIB_USE_MIMPURE_TEXT_TRUE -CURL_LT_SHLIB_USE_NO_UNDEFINED_FALSE -CURL_LT_SHLIB_USE_NO_UNDEFINED_TRUE -CURL_LT_SHLIB_USE_VERSION_INFO_FALSE -CURL_LT_SHLIB_USE_VERSION_INFO_TRUE -LT_SYS_LIBRARY_PATH -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -RANLIB -ac_ct_AR -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -LIBTOOL -OBJDUMP -DLLTOOL -AS -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -PKGADD_VENDOR -PKGADD_NAME -PKGADD_PKG -VERSIONNUM -CURLVERSION -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -libext -AR -EGREP -GREP -CURL_CFLAG_EXTRAS -CONFIGURE_OPTIONS -CODE_COVERAGE_RULES -CODE_COVERAGE_LDFLAGS -CODE_COVERAGE_LIBS -CODE_COVERAGE_CXXFLAGS -CODE_COVERAGE_CFLAGS -CODE_COVERAGE_CPPFLAGS -GENHTML -LCOV -GCOV -CODE_COVERAGE_ENABLED -CODE_COVERAGE_ENABLED_FALSE -CODE_COVERAGE_ENABLED_TRUE -SED -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -runstatedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -SHELL -PATH_SEPARATOR' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_maintainer_mode -enable_silent_rules -enable_debug -enable_optimize -enable_warnings -enable_werror -enable_curldebug -enable_symbol_hiding -enable_hidden_symbols -enable_ares -enable_rt -with_gcov -enable_code_coverage -enable_dependency_tracking -enable_largefile -enable_shared -enable_static -with_pic -enable_fast_install -with_aix_soname -with_gnu_ld -with_sysroot -enable_libtool_lock -enable_http -enable_ftp -enable_file -enable_ldap -enable_ldaps -enable_rtsp -enable_proxy -enable_dict -enable_telnet -enable_tftp -enable_pop3 -enable_imap -enable_smb -enable_smtp -enable_gopher -enable_manual -enable_libcurl_option -enable_libgcc -with_zlib -with_ldap_lib -with_lber_lib -enable_ipv6 -with_gssapi_includes -with_gssapi_libs -with_gssapi -with_default_ssl_backend -with_winssl -with_darwinssl -with_ssl -with_egd_socket -with_random -with_gnutls -with_polarssl -with_mbedtls -with_cyassl -with_nss -with_axtls -with_ca_bundle -with_ca_path -with_ca_fallback -with_libpsl -with_libmetalink -with_libssh2 -with_librtmp -enable_versioned_symbols -with_winidn -with_libidn2 -with_nghttp2 -with_zsh_functions_dir -enable_threaded_resolver -enable_pthreads -enable_verbose -enable_sspi -enable_crypto_auth -enable_ntlm_wb -enable_tls_srp -enable_unix_sockets -enable_cookies -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -LT_SYS_LIBRARY_PATH' -ac_subdirs_all='ares' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures curl - to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/curl] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of curl -:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode - enable make rules and dependencies not useful (and - sometimes confusing) to the casual installer - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-debug Enable debug build options - --disable-debug Disable debug build options - --enable-optimize Enable compiler optimizations - --disable-optimize Disable compiler optimizations - --enable-warnings Enable strict compiler warnings - --disable-warnings Disable strict compiler warnings - --enable-werror Enable compiler warnings as errors - --disable-werror Disable compiler warnings as errors - --enable-curldebug Enable curl debug memory tracking - --disable-curldebug Disable curl debug memory tracking - --enable-symbol-hiding Enable hiding of library internal symbols - --disable-symbol-hiding Disable hiding of library internal symbols - --enable-hidden-symbols To be deprecated, use --enable-symbol-hiding - --disable-hidden-symbols - To be deprecated, use --disable-symbol-hiding - --enable-ares[=PATH] Enable c-ares for DNS lookups - --disable-ares Disable c-ares for DNS lookups - --disable-rt disable dependency on -lrt - --enable-code-coverage Whether to enable code coverage support - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - --disable-largefile omit support for large files - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - --enable-http Enable HTTP support - --disable-http Disable HTTP support - --enable-ftp Enable FTP support - --disable-ftp Disable FTP support - --enable-file Enable FILE support - --disable-file Disable FILE support - --enable-ldap Enable LDAP support - --disable-ldap Disable LDAP support - --enable-ldaps Enable LDAPS support - --disable-ldaps Disable LDAPS support - --enable-rtsp Enable RTSP support - --disable-rtsp Disable RTSP support - --enable-proxy Enable proxy support - --disable-proxy Disable proxy support - --enable-dict Enable DICT support - --disable-dict Disable DICT support - --enable-telnet Enable TELNET support - --disable-telnet Disable TELNET support - --enable-tftp Enable TFTP support - --disable-tftp Disable TFTP support - --enable-pop3 Enable POP3 support - --disable-pop3 Disable POP3 support - --enable-imap Enable IMAP support - --disable-imap Disable IMAP support - --enable-smb Enable SMB/CIFS support - --disable-smb Disable SMB/CIFS support - --enable-smtp Enable SMTP support - --disable-smtp Disable SMTP support - --enable-gopher Enable Gopher support - --disable-gopher Disable Gopher support - --enable-manual Enable built-in manual - --disable-manual Disable built-in manual - --enable-libcurl-option Enable --libcurl C code generation support - --disable-libcurl-option - Disable --libcurl C code generation support - --enable-libgcc use libgcc when linking - --enable-ipv6 Enable IPv6 (with IPv4) support - --disable-ipv6 Disable IPv6 support - --enable-versioned-symbols - Enable versioned symbols in shared library - --disable-versioned-symbols - Disable versioned symbols in shared library - --enable-threaded-resolver - Enable threaded resolver - --disable-threaded-resolver - Disable threaded resolver - --enable-pthreads Enable POSIX threads (default for threaded resolver) - --disable-pthreads Disable POSIX threads - --enable-verbose Enable verbose strings - --disable-verbose Disable verbose strings - --enable-sspi Enable SSPI - --disable-sspi Disable SSPI - --enable-crypto-auth Enable cryptographic authentication - --disable-crypto-auth Disable cryptographic authentication - --enable-ntlm-wb[=FILE] Enable NTLM delegation to winbind's ntlm_auth - helper, where FILE is ntlm_auth's absolute filename - (default: /usr/bin/ntlm_auth) - --disable-ntlm-wb Disable NTLM delegation to winbind's ntlm_auth - helper - --enable-tls-srp Enable TLS-SRP authentication - --disable-tls-srp Disable TLS-SRP authentication - --enable-unix-sockets Enable Unix domain sockets - --disable-unix-sockets Disable Unix domain sockets - --enable-cookies Enable cookies support - --disable-cookies Disable cookies support - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gcov=GCOV use given GCOV for coverage (GCOV=gcov). - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-aix-soname=aix|svr4|both - shared library versioning (aka "SONAME") variant to - provide on AIX, [default=aix]. - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot[=DIR] Search for dependent libraries within DIR (or the - compiler's sysroot if not specified). - --with-zlib=PATH search for zlib in PATH - --without-zlib disable use of zlib - --with-ldap-lib=libname Specify name of ldap lib file - --with-lber-lib=libname Specify name of lber lib file - --with-gssapi-includes=DIR - Specify location of GSS-API headers - --with-gssapi-libs=DIR Specify location of GSS-API libs - --with-gssapi=DIR Where to look for GSS-API - --with-default-ssl-backend=NAME - Use NAME as default SSL backend - --without-default-ssl-backend - Use implicit default SSL backend - --with-winssl enable Windows native SSL/TLS - --without-winssl disable Windows native SSL/TLS - --with-darwinssl enable Apple OS native SSL/TLS - --without-darwinssl disable Apple OS native SSL/TLS - --with-ssl=PATH Where to look for OpenSSL, PATH points to the SSL - installation (default: /usr/local/ssl); when - possible, set the PKG_CONFIG_PATH environment - variable instead of using this option - --without-ssl disable OpenSSL - --with-egd-socket=FILE Entropy Gathering Daemon socket pathname - --with-random=FILE read randomness from FILE (default=/dev/urandom) - --with-gnutls=PATH where to look for GnuTLS, PATH points to the - installation root - --without-gnutls disable GnuTLS detection - --with-polarssl=PATH where to look for PolarSSL, PATH points to the - installation root - --without-polarssl disable PolarSSL detection - --with-mbedtls=PATH where to look for mbedTLS, PATH points to the - installation root - --without-mbedtls disable mbedTLS detection - --with-cyassl=PATH where to look for CyaSSL, PATH points to the - installation root (default: system lib default) - --without-cyassl disable CyaSSL detection - --with-nss=PATH where to look for NSS, PATH points to the - installation root - --without-nss disable NSS detection - --with-axtls=PATH Where to look for axTLS, PATH points to the axTLS - installation prefix (default: /usr/local). Ignored - if another SSL engine is selected. - --without-axtls disable axTLS - --with-ca-bundle=FILE Path to a file containing CA certificates (example: - /etc/ca-bundle.crt) - --without-ca-bundle Don't use a default CA bundle - --with-ca-path=DIRECTORY - Path to a directory containing CA certificates - stored individually, with their filenames in a hash - format. This option can be used with OpenSSL, GnuTLS - and PolarSSL backends. Refer to OpenSSL c_rehash for - details. (example: /etc/certificates) - --without-ca-path Don't use a default CA path - --with-ca-fallback Use the built in CA store of the SSL library - --without-ca-fallback Don't use the built in CA store of the SSL library - --without-libpsl disable support for libpsl cookie checking - --with-libmetalink=PATH where to look for libmetalink, PATH points to the - installation root - --without-libmetalink disable libmetalink detection - --with-libssh2=PATH Where to look for libssh2, PATH points to the - LIBSSH2 installation; when possible, set the - PKG_CONFIG_PATH environment variable instead of - using this option - --without-libssh2 disable LIBSSH2 - --with-librtmp=PATH Where to look for librtmp, PATH points to the - LIBRTMP installation; when possible, set the - PKG_CONFIG_PATH environment variable instead of - using this option - --without-librtmp disable LIBRTMP - --with-winidn=PATH enable Windows native IDN - --without-winidn disable Windows native IDN - --with-libidn2=PATH Enable libidn2 usage - --without-libidn2 Disable libidn2 usage - --with-nghttp2=PATH Enable nghttp2 usage - --without-nghttp2 Disable nghttp2 usage - --with-zsh-functions-dir=PATH - Install zsh completions to PATH - --without-zsh-functions-dir - Do not install zsh completions - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - LT_SYS_LIBRARY_PATH - User-defined run-time library search path. - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -curl configure - -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. - -Copyright (c) 1998 - 2017 Daniel Stenberg, -This configure script may be copied, distributed and modified under the -terms of the curl license; see COPYING for more details -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define $2 innocuous_$2 -#ifdef __STDC__ -# include -#else -# include -#endif -#undef $2 -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int main (void) -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ----------------------------------------------------------------------- ## -## Report this to a suitable curl mailing list: https://curl.haxx.se/mail/ ## -## ----------------------------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int main (void) -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int main (void) -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int main (void) -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int main (void) -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by curl $as_me -, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - -# using curl-override.m4 - - - - - -ac_config_headers="$ac_config_headers lib/curl_config.h" - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=0;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debug build options" >&5 -$as_echo_n "checking whether to enable debug build options... " >&6; } - OPT_DEBUG_BUILD="default" - # Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; OPT_DEBUG_BUILD=$enableval -fi - - case "$OPT_DEBUG_BUILD" in - no) - want_debug="no" - ;; - default) - want_debug="no" - ;; - *) - want_debug="yes" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_debug" >&5 -$as_echo "$want_debug" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler optimizer" >&5 -$as_echo_n "checking whether to enable compiler optimizer... " >&6; } - OPT_COMPILER_OPTIMIZE="default" - # Check whether --enable-optimize was given. -if test "${enable_optimize+set}" = set; then : - enableval=$enable_optimize; OPT_COMPILER_OPTIMIZE=$enableval -fi - - case "$OPT_COMPILER_OPTIMIZE" in - no) - want_optimize="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - default) - if test "$want_debug" = "yes"; then - want_optimize="assume_no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) no" >&5 -$as_echo "(assumed) no" >&6; } - else - want_optimize="assume_yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) yes" >&5 -$as_echo "(assumed) yes" >&6; } - fi - ;; - *) - want_optimize="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable strict compiler warnings" >&5 -$as_echo_n "checking whether to enable strict compiler warnings... " >&6; } - OPT_COMPILER_WARNINGS="default" - # Check whether --enable-warnings was given. -if test "${enable_warnings+set}" = set; then : - enableval=$enable_warnings; OPT_COMPILER_WARNINGS=$enableval -fi - - case "$OPT_COMPILER_WARNINGS" in - no) - want_warnings="no" - ;; - default) - want_warnings="$want_debug" - ;; - *) - want_warnings="yes" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_warnings" >&5 -$as_echo "$want_warnings" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler warnings as errors" >&5 -$as_echo_n "checking whether to enable compiler warnings as errors... " >&6; } - OPT_COMPILER_WERROR="default" - # Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : - enableval=$enable_werror; OPT_COMPILER_WERROR=$enableval -fi - - case "$OPT_COMPILER_WERROR" in - no) - want_werror="no" - ;; - default) - want_werror="no" - ;; - *) - want_werror="yes" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_werror" >&5 -$as_echo "$want_werror" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable curl debug memory tracking" >&5 -$as_echo_n "checking whether to enable curl debug memory tracking... " >&6; } - OPT_CURLDEBUG_BUILD="default" - # Check whether --enable-curldebug was given. -if test "${enable_curldebug+set}" = set; then : - enableval=$enable_curldebug; OPT_CURLDEBUG_BUILD=$enableval -fi - - case "$OPT_CURLDEBUG_BUILD" in - no) - want_curldebug="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - default) - if test "$want_debug" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) yes" >&5 -$as_echo "(assumed) yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - want_curldebug_assumed="yes" - want_curldebug="$want_debug" - ;; - *) - want_curldebug="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable hiding of library internal symbols" >&5 -$as_echo_n "checking whether to enable hiding of library internal symbols... " >&6; } - OPT_SYMBOL_HIDING="default" - # Check whether --enable-symbol-hiding was given. -if test "${enable_symbol_hiding+set}" = set; then : - enableval=$enable_symbol_hiding; OPT_SYMBOL_HIDING=$enableval -fi - - # Check whether --enable-hidden-symbols was given. -if test "${enable_hidden_symbols+set}" = set; then : - enableval=$enable_hidden_symbols; OPT_SYMBOL_HIDING=$enableval -fi - - case "$OPT_SYMBOL_HIDING" in - no) - want_symbol_hiding="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - default) - want_symbol_hiding="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - *) - want_symbol_hiding="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable c-ares for DNS lookups" >&5 -$as_echo_n "checking whether to enable c-ares for DNS lookups... " >&6; } - OPT_ARES="default" - # Check whether --enable-ares was given. -if test "${enable_ares+set}" = set; then : - enableval=$enable_ares; OPT_ARES=$enableval -fi - - case "$OPT_ARES" in - no) - want_ares="no" - ;; - default) - want_ares="no" - ;; - *) - want_ares="yes" - if test -n "$enableval" && test "$enableval" != "yes"; then - want_ares_path="$enableval" - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_ares" >&5 -$as_echo "$want_ares" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to disable dependency on -lrt" >&5 -$as_echo_n "checking whether to disable dependency on -lrt... " >&6; } - OPT_RT="default" - # Check whether --enable-rt was given. -if test "${enable_rt+set}" = set; then : - enableval=$enable_rt; OPT_RT=$enableval -fi - - case "$OPT_RT" in - no) - dontwant_rt="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - default) - dontwant_rt="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed no)" >&5 -$as_echo "(assumed no)" >&6; } - ;; - *) - dontwant_rt="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac - - -# -# Check that 'XC_CONFIGURE_PREAMBLE' has already run. -# - -if test -z "$xc_configure_preamble_result"; then - as_fn_error $? "xc_configure_preamble_result not set (internal problem)" "$LINENO" 5 -fi - -# -# Check that 'PATH_SEPARATOR' has already been set. -# - -if test -z "$xc_PATH_SEPARATOR"; then - as_fn_error $? "xc_PATH_SEPARATOR not set (internal problem)" "$LINENO" 5 -fi -if test -z "$PATH_SEPARATOR"; then - as_fn_error $? "PATH_SEPARATOR not set (internal or config.site problem)" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for path separator" >&5 -$as_echo_n "checking for path separator... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_SEPARATOR" >&5 -$as_echo "$PATH_SEPARATOR" >&6; } -if test "x$PATH_SEPARATOR" != "x$xc_PATH_SEPARATOR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initial path separator" >&5 -$as_echo_n "checking for initial path separator... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_PATH_SEPARATOR" >&5 -$as_echo "$xc_PATH_SEPARATOR" >&6; } - as_fn_error $? "path separator mismatch (internal or config.site problem)" "$LINENO" 5 -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - - - - - # allow to override gcov location - -# Check whether --with-gcov was given. -if test "${with_gcov+set}" = set; then : - withval=$with_gcov; _AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov -else - _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with code coverage support" >&5 -$as_echo_n "checking whether to build with code coverage support... " >&6; } - # Check whether --enable-code-coverage was given. -if test "${enable_code_coverage+set}" = set; then : - enableval=$enable_code_coverage; -else - enable_code_coverage=no -fi - - - if test x$enable_code_coverage = xyes; then - CODE_COVERAGE_ENABLED_TRUE= - CODE_COVERAGE_ENABLED_FALSE='#' -else - CODE_COVERAGE_ENABLED_TRUE='#' - CODE_COVERAGE_ENABLED_FALSE= -fi - - CODE_COVERAGE_ENABLED=$enable_code_coverage - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_code_coverage" >&5 -$as_echo "$enable_code_coverage" >&6; } - - if test "$enable_code_coverage" = "yes" ; then : - - # check for gcov - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args. -set dummy ${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_GCOV+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GCOV"; then - ac_cv_prog_GCOV="$GCOV" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_GCOV="${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -GCOV=$ac_cv_prog_GCOV -if test -n "$GCOV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCOV" >&5 -$as_echo "$GCOV" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_GCOV"; then - ac_ct_GCOV=$GCOV - # Extract the first word of "$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args. -set dummy $_AX_CODE_COVERAGE_GCOV_PROG_WITH; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_GCOV+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_GCOV"; then - ac_cv_prog_ac_ct_GCOV="$ac_ct_GCOV" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_GCOV="$_AX_CODE_COVERAGE_GCOV_PROG_WITH" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_GCOV=$ac_cv_prog_ac_ct_GCOV -if test -n "$ac_ct_GCOV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GCOV" >&5 -$as_echo "$ac_ct_GCOV" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_GCOV" = x; then - GCOV=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - GCOV=$ac_ct_GCOV - fi -else - GCOV="$ac_cv_prog_GCOV" -fi - - if test "X$GCOV" = "X:"; then : - as_fn_error $? "gcov is needed to do coverage" "$LINENO" 5 -fi - - - if test "$GCC" = "no" ; then : - - as_fn_error $? "not compiling with gcc, which is required for gcov code coverage" "$LINENO" 5 - -fi - - # Extract the first word of "lcov", so it can be a program name with args. -set dummy lcov; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LCOV+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LCOV"; then - ac_cv_prog_LCOV="$LCOV" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LCOV="lcov" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LCOV=$ac_cv_prog_LCOV -if test -n "$LCOV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 -$as_echo "$LCOV" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - # Extract the first word of "genhtml", so it can be a program name with args. -set dummy genhtml; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_GENHTML+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GENHTML"; then - ac_cv_prog_GENHTML="$GENHTML" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_GENHTML="genhtml" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -GENHTML=$ac_cv_prog_GENHTML -if test -n "$GENHTML"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5 -$as_echo "$GENHTML" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - if test -z "$LCOV" ; then : - - as_fn_error $? "To enable code coverage reporting you must have lcov installed" "$LINENO" 5 - -fi - - if test -z "$GENHTML" ; then : - - as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5 - -fi - - CODE_COVERAGE_CPPFLAGS="-DNDEBUG" - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LIBS="-lgcov" - CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" - - - - - - - - CODE_COVERAGE_RULES_CHECK=' - -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check - $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -' - CODE_COVERAGE_RULES_CAPTURE=' - $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) - $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -' - CODE_COVERAGE_RULES_CLEAN=' -clean: code-coverage-clean -distclean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete -' - -else - - CODE_COVERAGE_RULES_CHECK=' - @echo "Need to reconfigure with --enable-code-coverage" -' - CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" - CODE_COVERAGE_RULES_CLEAN='' - -fi - -CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# Multiple directories may be specified, separated by whitespace. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, -# set to 0 to disable it and leave empty to stay with the default. -# (Default: empty) -# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov -# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov -# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov -# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the -# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov -# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering -# lcov instance. (Default: empty) -# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov -# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the -# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_BRANCH_COVERAGE ?= -CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" -CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= -CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ -$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -CODE_COVERAGE_IGNORE_PATTERN ?= - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) -code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ - $(CODE_COVERAGE_OUTPUT_FILE); -code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) -code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ - $(CODE_COVERAGE_IGNORE_PATTERN); -code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) -code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# sanitizes the test-name: replaces with underscores: dashes and dots -code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) - -# Use recursive makes in order to ignore errors during check -check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -'"$CODE_COVERAGE_RULES_CLEAN"' - -A''M_DISTCHECK_CONFIGURE_FLAGS ?= -A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -' - - - - - -# -# save the configure arguments -# -CONFIGURE_OPTIONS="\"$ac_configure_args\"" - - -CURL_CFLAG_EXTRAS="" -if test X"$want_werror" = Xyes; then - CURL_CFLAG_EXTRAS="-Werror" -fi - - -if test -z "$SED"; then - # Extract the first word of "sed", so it can be a program name with args. -set dummy sed; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $SED in - [\\/]* | ?:[\\/]*) - ac_cv_path_SED="$SED" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_SED" && ac_cv_path_SED="not_found" - ;; -esac -fi -SED=$ac_cv_path_SED -if test -n "$SED"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 -$as_echo "$SED" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -z "$SED" || test "$SED" = "not_found"; then - as_fn_error $? "sed not found in PATH. Cannot continue without sed." "$LINENO" 5 - fi -fi - - -if test -z "$GREP"; then - # Extract the first word of "grep", so it can be a program name with args. -set dummy grep; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $GREP in - [\\/]* | ?:[\\/]*) - ac_cv_path_GREP="$GREP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="not_found" - ;; -esac -fi -GREP=$ac_cv_path_GREP -if test -n "$GREP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 -$as_echo "$GREP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -z "$GREP" || test "$GREP" = "not_found"; then - as_fn_error $? "grep not found in PATH. Cannot continue without grep." "$LINENO" 5 - fi -fi - - -if test -z "$EGREP"; then - if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } - EGREP="$GREP -E" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 -$as_echo "$EGREP" >&6; } - else - # Extract the first word of "egrep", so it can be a program name with args. -set dummy egrep; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $EGREP in - [\\/]* | ?:[\\/]*) - ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_EGREP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_EGREP" && ac_cv_path_EGREP="not_found" - ;; -esac -fi -EGREP=$ac_cv_path_EGREP -if test -n "$EGREP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 -$as_echo "$EGREP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$EGREP" || test "$EGREP" = "not_found"; then - as_fn_error $? "egrep not found in PATH. Cannot continue without egrep." "$LINENO" 5 -fi - - -if test -z "$AR"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $AR in - [\\/]* | ?:[\\/]*) - ac_cv_path_AR="$AR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -AR=$ac_cv_path_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_AR"; then - ac_pt_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_AR in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_AR=$ac_cv_path_ac_pt_AR -if test -n "$ac_pt_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5 -$as_echo "$ac_pt_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_AR" = x; then - AR="not_found" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_pt_AR - fi -else - AR="$ac_cv_path_AR" -fi - - if test -z "$AR" || test "$AR" = "not_found"; then - as_fn_error $? "ar not found in PATH. Cannot continue without ar." "$LINENO" 5 - fi -fi - - - - -CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h` - - xc_prog_cc_prev_IFS=$IFS - xc_prog_cc_prev_LIBS=$LIBS - xc_prog_cc_prev_CFLAGS=$CFLAGS - xc_prog_cc_prev_LDFLAGS=$LDFLAGS - xc_prog_cc_prev_CPPFLAGS=$CPPFLAGS - - - - xc_bad_var_libs=no - for xc_word in $LIBS; do - case "$xc_word" in - -l* | --library=*) - : - ;; - *) - xc_bad_var_libs=yes - ;; - esac - done - if test $xc_bad_var_libs = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using LIBS: $LIBS" >&5 -$as_echo "$as_me: using LIBS: $LIBS" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: LIBS note: LIBS should only be used to specify libraries (-lname)." >&5 -$as_echo "$as_me: LIBS note: LIBS should only be used to specify libraries (-lname)." >&6;} - fi - - - xc_bad_var_ldflags=no - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_ldflags=yes - ;; - -U*) - xc_bad_var_ldflags=yes - ;; - -I*) - xc_bad_var_ldflags=yes - ;; - -l* | --library=*) - xc_bad_var_ldflags=yes - ;; - esac - done - if test $xc_bad_var_ldflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using LDFLAGS: $LDFLAGS" >&5 -$as_echo "$as_me: using LDFLAGS: $LDFLAGS" >&6;} - xc_bad_var_msg="LDFLAGS note: LDFLAGS should only be used to specify linker flags, not" - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -U*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -I*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - - xc_bad_var_cppflags=no - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - xc_bad_var_cppflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cppflags=yes - ;; - -l* | --library=*) - xc_bad_var_cppflags=yes - ;; - esac - done - if test $xc_bad_var_cppflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using CPPFLAGS: $CPPFLAGS" >&5 -$as_echo "$as_me: using CPPFLAGS: $CPPFLAGS" >&6;} - xc_bad_var_msg="CPPFLAGS note: CPPFLAGS should only be used to specify C preprocessor flags, not" - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -L* | --library-path=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - - xc_bad_var_cflags=no - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_cflags=yes - ;; - -U*) - xc_bad_var_cflags=yes - ;; - -I*) - xc_bad_var_cflags=yes - ;; - -rpath*) - xc_bad_var_cflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cflags=yes - ;; - -l* | --library=*) - xc_bad_var_cflags=yes - ;; - esac - done - if test $xc_bad_var_cflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using CFLAGS: $CFLAGS" >&5 -$as_echo "$as_me: using CFLAGS: $CFLAGS" >&6;} - xc_bad_var_msg="CFLAGS note: CFLAGS should only be used to specify C compiler flags, not" - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -U*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -I*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -rpath*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -L* | --library-path=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - if test $xc_bad_var_libs = yes || - test $xc_bad_var_cflags = yes || - test $xc_bad_var_ldflags = yes || - test $xc_bad_var_cppflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Continuing even with errors mentioned immediately above this line." >&5 -$as_echo "$as_me: WARNING: Continuing even with errors mentioned immediately above this line." >&2;} - fi - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int main (void) -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int main (void) -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - IFS=$xc_prog_cc_prev_IFS - LIBS=$xc_prog_cc_prev_LIBS - CFLAGS=$xc_prog_cc_prev_CFLAGS - LDFLAGS=$xc_prog_cc_prev_LDFLAGS - CPPFLAGS=$xc_prog_cc_prev_CPPFLAGS - - - - - -am__api_version='1.15' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -## --------------------------------------- ## -## Start of automake initialization code ## -## --------------------------------------- ## - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='curl' - VERSION='-' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - -## ------------------------------------- ## -## End of automake initialization code ## -## ------------------------------------- ## - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking curl version" >&5 -$as_echo_n "checking curl version... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURLVERSION" >&5 -$as_echo "$CURLVERSION" >&6; } - - - -VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\([0-9A-Fa-f]*\).*/\1/p' ${srcdir}/include/curl/curlver.h` - - -PKGADD_PKG="HAXXcurl" -PKGADD_NAME="curl - a client that groks URLs" -PKGADD_VENDOR="curl.haxx.se" - - - - - curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )" - curl_ssh_msg="no (--with-libssh2)" - curl_zlib_msg="no (--with-zlib)" - curl_gss_msg="no (--with-gssapi)" -curl_tls_srp_msg="no (--enable-tls-srp)" - curl_res_msg="default (--enable-ares / --enable-threaded-resolver)" - curl_ipv6_msg="no (--enable-ipv6)" -curl_unix_sockets_msg="no (--enable-unix-sockets)" - curl_idn_msg="no (--with-{libidn2,winidn})" - 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)" - curl_ldaps_msg="no (--enable-ldaps)" - curl_rtsp_msg="no (--enable-rtsp)" - curl_rtmp_msg="no (--with-librtmp)" - curl_mtlnk_msg="no (--with-libmetalink)" - curl_psl_msg="no (--with-libpsl)" - - ssl_backends= - -INITIAL_LDFLAGS=$LDFLAGS -INITIAL_LIBS=$LIBS - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -cat >>confdefs.h <<_ACEOF -#define OS "${host}" -_ACEOF - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OS is AIX (to define _ALL_SOURCE)" >&5 -$as_echo_n "checking if OS is AIX (to define _ALL_SOURCE)... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef _AIX - yes_this_is_aix -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes_this_is_aix" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f conftest* - - - - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is already defined" >&5 -$as_echo_n "checking if _THREAD_SAFE is already defined... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#ifdef _THREAD_SAFE - int dummy=1; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tmp_thread_safe_initially_defined="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tmp_thread_safe_initially_defined="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - if test "$tmp_thread_safe_initially_defined" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is actually needed" >&5 -$as_echo_n "checking if _THREAD_SAFE is actually needed... " >&6; } - - case $host_os in - aix[123].* | aix4.[012].*) - tmp_need_thread_safe="no" - ;; - aix*) - tmp_need_thread_safe="yes" - ;; - *) - tmp_need_thread_safe="no" - ;; - esac - - if test "$tmp_need_thread_safe" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is onwards defined" >&5 -$as_echo_n "checking if _THREAD_SAFE is onwards defined... " >&6; } - if test "$tmp_thread_safe_initially_defined" = "yes" || - test "$tmp_need_thread_safe" = "yes"; then - - -$as_echo "#define NEED_THREAD_SAFE 1" >>confdefs.h - -cat >>confdefs.h <<_EOF -#ifndef _THREAD_SAFE -# define _THREAD_SAFE -#endif -_EOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - # - - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is already defined" >&5 -$as_echo_n "checking if _REENTRANT is already defined... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#ifdef _REENTRANT - int dummy=1; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tmp_reentrant_initially_defined="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tmp_reentrant_initially_defined="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - if test "$tmp_reentrant_initially_defined" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is actually needed" >&5 -$as_echo_n "checking if _REENTRANT is actually needed... " >&6; } - - case $host_os in - solaris*) - tmp_need_reentrant="yes" - ;; - *) - tmp_need_reentrant="no" - ;; - esac - - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - if(0 != errno) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_errno="yes" - -else - - tmp_errno="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tmp_errno" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - -#ifdef errno - int dummy=1; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_errno="errno_macro_defined" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define _REENTRANT -#include - -int main (void) -{ - -#ifdef errno - int dummy=1; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_errno="errno_macro_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gmtime_r innocuous_gmtime_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gmtime_r -#ifdef __cplusplus -extern "C" -#endif -char gmtime_r (); -#if defined __stub_gmtime_r || defined __stub___gmtime_r -choke me -#endif - -int main (void) -{ -return gmtime_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_gmtime_r="yes" - -else - - tmp_gmtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_gmtime_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gmtime_r" >/dev/null 2>&1; then : - - tmp_gmtime_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gmtime_r" >/dev/null 2>&1; then : - - tmp_gmtime_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define localtime_r innocuous_localtime_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef localtime_r -#ifdef __cplusplus -extern "C" -#endif -char localtime_r (); -#if defined __stub_localtime_r || defined __stub___localtime_r -choke me -#endif - -int main (void) -{ -return localtime_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_localtime_r="yes" - -else - - tmp_localtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_localtime_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "localtime_r" >/dev/null 2>&1; then : - - tmp_localtime_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "localtime_r" >/dev/null 2>&1; then : - - tmp_localtime_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strerror_r innocuous_strerror_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strerror_r -#ifdef __cplusplus -extern "C" -#endif -char strerror_r (); -#if defined __stub_strerror_r || defined __stub___strerror_r -choke me -#endif - -int main (void) -{ -return strerror_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_strerror_r="yes" - -else - - tmp_strerror_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_strerror_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strerror_r" >/dev/null 2>&1; then : - - tmp_strerror_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strerror_r" >/dev/null 2>&1; then : - - tmp_strerror_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strtok_r innocuous_strtok_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strtok_r -#ifdef __cplusplus -extern "C" -#endif -char strtok_r (); -#if defined __stub_strtok_r || defined __stub___strtok_r -choke me -#endif - -int main (void) -{ -return strtok_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_strtok_r="yes" - -else - - tmp_strtok_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_strtok_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtok_r" >/dev/null 2>&1; then : - - tmp_strtok_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtok_r" >/dev/null 2>&1; then : - - tmp_strtok_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define inet_ntoa_r innocuous_inet_ntoa_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef inet_ntoa_r -#ifdef __cplusplus -extern "C" -#endif -char inet_ntoa_r (); -#if defined __stub_inet_ntoa_r || defined __stub___inet_ntoa_r -choke me -#endif - -int main (void) -{ -return inet_ntoa_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_inet_ntoa_r="yes" - -else - - tmp_inet_ntoa_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_inet_ntoa_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : - - tmp_inet_ntoa_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : - - tmp_inet_ntoa_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gethostbyaddr_r innocuous_gethostbyaddr_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gethostbyaddr_r -#ifdef __cplusplus -extern "C" -#endif -char gethostbyaddr_r (); -#if defined __stub_gethostbyaddr_r || defined __stub___gethostbyaddr_r -choke me -#endif - -int main (void) -{ -return gethostbyaddr_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_gethostbyaddr_r="yes" - -else - - tmp_gethostbyaddr_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_gethostbyaddr_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : - - tmp_gethostbyaddr_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : - - tmp_gethostbyaddr_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gethostbyname_r innocuous_gethostbyname_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gethostbyname_r -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname_r (); -#if defined __stub_gethostbyname_r || defined __stub___gethostbyname_r -choke me -#endif - -int main (void) -{ -return gethostbyname_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_gethostbyname_r="yes" - -else - - tmp_gethostbyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_gethostbyname_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyname_r" >/dev/null 2>&1; then : - - tmp_gethostbyname_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyname_r" >/dev/null 2>&1; then : - - tmp_gethostbyname_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define getprotobyname_r innocuous_getprotobyname_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getprotobyname_r -#ifdef __cplusplus -extern "C" -#endif -char getprotobyname_r (); -#if defined __stub_getprotobyname_r || defined __stub___getprotobyname_r -choke me -#endif - -int main (void) -{ -return getprotobyname_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_getprotobyname_r="yes" - -else - - tmp_getprotobyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_getprotobyname_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getprotobyname_r" >/dev/null 2>&1; then : - - tmp_getprotobyname_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getprotobyname_r" >/dev/null 2>&1; then : - - tmp_getprotobyname_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - if test "$tmp_need_reentrant" = "no"; then - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define getservbyport_r innocuous_getservbyport_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getservbyport_r -#ifdef __cplusplus -extern "C" -#endif -char getservbyport_r (); -#if defined __stub_getservbyport_r || defined __stub___getservbyport_r -choke me -#endif - -int main (void) -{ -return getservbyport_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_getservbyport_r="yes" - -else - - tmp_getservbyport_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$tmp_getservbyport_r" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getservbyport_r" >/dev/null 2>&1; then : - - tmp_getservbyport_r="proto_declared" - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _REENTRANT -#include -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getservbyport_r" >/dev/null 2>&1; then : - - tmp_getservbyport_r="proto_needs_reentrant" - tmp_need_reentrant="yes" - -fi -rm -f conftest* - - -fi -rm -f conftest* - - fi - - fi - - fi - if test "$tmp_need_reentrant" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is onwards defined" >&5 -$as_echo_n "checking if _REENTRANT is onwards defined... " >&6; } - if test "$tmp_reentrant_initially_defined" = "yes" || - test "$tmp_need_reentrant" = "yes"; then - - -$as_echo "#define NEED_REENTRANT 1" >>confdefs.h - -cat >>confdefs.h <<_EOF -#ifndef _REENTRANT -# define _REENTRANT -#endif -_EOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - # - - -# Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : - enableval=$enable_largefile; -fi - -if test "$enable_largefile" != no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if ${ac_cv_sys_largefile_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int main (void) -{ - - ; - return 0; -} -_ACEOF - if ac_fn_c_try_compile "$LINENO"; then : - break -fi -rm -f core conftest.err conftest.$ac_objext - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_largefile_CC=' -n32'; break -fi -rm -f core conftest.err conftest.$ac_objext - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -$as_echo "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if ${ac_cv_sys_file_offset_bits+:} false; then : - $as_echo_n "(cached) " >&6 -else - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=64; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -$as_echo "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF -;; -esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if ${ac_cv_sys_large_files+:} false; then : - $as_echo_n "(cached) " >&6 -else - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=1; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -$as_echo "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF -;; -esac -rm -rf conftest* - fi - - -fi - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.6' -macro_revision='2.4.6' - - - - - - - - - - - - - -ltmain=$ac_aux_dir/ltmain.sh - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM=$NM -else - lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring=ABCD - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then - reload_cmds=false - fi - ;; - darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -eq "$ac_status"; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test 0 -ne "$ac_status"; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test no = "$lt_cv_ar_at_file"; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test ia64 = "$host_cpu"; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined __osf__ -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv -f conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case $with_sysroot in #( - yes) - if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -if test -z "$lt_DD"; then - ac_path_lt_DD_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_lt_DD" || continue -if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi - $ac_path_lt_DD_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_lt_DD"; then - : - fi -else - ac_cv_path_lt_DD=$lt_DD -fi - -rm -f conftest.i conftest2.i conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : - $as_echo_n "(cached) " >&6 -else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" -fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } - - - - - - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test no = "$enable_libtool_lock" || enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE=32 - ;; - *ELF-64*) - HPUX_IA64_MODE=64 - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test yes = "$lt_cv_prog_gnu_ld"; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - emul=elf - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test yes != "$lt_cv_cc_needs_belf"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS - fi - ;; -*-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*|x86_64-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks=$enable_libtool_lock - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test yes != "$lt_cv_path_mainfest_tool"; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[012][,.]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test yes = "$lt_cv_apple_cc_single_mod"; then - _lt_dar_single_mod='$single_module' - fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' - fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - -# ------------------------------------ # -# Determine libtool default behavior # -# ------------------------------------ # - -# -# Default behavior is to enable shared and static libraries on systems -# where libtool knows how to build both library versions, and does not -# require separate configuration and build runs for each flavor. -# - -xc_lt_want_enable_shared='yes' -xc_lt_want_enable_static='yes' - -# -# User may have disabled shared or static libraries. -# -case "x$enable_shared" in # ( - xno) - xc_lt_want_enable_shared='no' - ;; -esac -case "x$enable_static" in # ( - xno) - xc_lt_want_enable_static='no' - ;; -esac -if test "x$xc_lt_want_enable_shared" = 'xno' && - test "x$xc_lt_want_enable_static" = 'xno'; then - as_fn_error $? "can not disable shared and static libraries simultaneously" "$LINENO" 5 -fi - -# -# Default behavior on systems that require independent configuration -# and build runs for shared and static is to enable shared libraries -# and disable static ones. On these systems option '--disable-shared' -# must be used in order to build a proper static library. -# - -if test "x$xc_lt_want_enable_shared" = 'xyes' && - test "x$xc_lt_want_enable_static" = 'xyes'; then - case $host_os in # ( - pw32* | cegcc* | os2* | aix*) - xc_lt_want_enable_static='no' - ;; - esac -fi - -# -# Make libtool aware of current shared and static library preferences -# taking in account that, depending on host characteristics, libtool -# may modify these option preferences later in this configure script. -# - -enable_shared=$xc_lt_want_enable_shared -enable_static=$xc_lt_want_enable_static - -# -# Default behavior is to build PIC objects for shared libraries and -# non-PIC objects for static libraries. -# - -xc_lt_want_with_pic='default' - -# -# User may have specified PIC preference. -# - -case "x$with_pic" in # (( - xno) - xc_lt_want_with_pic='no' - ;; - xyes) - xc_lt_want_with_pic='yes' - ;; -esac - -# -# Default behavior on some systems where building a shared library out -# of non-PIC compiled objects will fail with following linker error -# "relocation R_X86_64_32 can not be used when making a shared object" -# is to build PIC objects even for static libraries. This behavior may -# be overridden using 'configure --disable-shared --without-pic'. -# - -if test "x$xc_lt_want_with_pic" = 'xdefault'; then - case $host_cpu in # ( - x86_64 | amd64 | ia64) - case $host_os in # ( - linux* | freebsd*) - xc_lt_want_with_pic='yes' - ;; - esac - ;; - esac -fi - -# -# Make libtool aware of current PIC preference taking in account that, -# depending on host characteristics, libtool may modify PIC default -# behavior to fit host system idiosyncrasies later in this script. -# - -with_pic=$xc_lt_want_with_pic - -## ----------------------- ## -## Start of libtool code ## -## ----------------------- ## - - - - -# Set options -enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; -esac - -test -z "$AS" && AS=as - - - - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - enable_dlopen=no - - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else - pic_mode=default -fi - - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS=$lt_save_ifs - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } - -# Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : - withval=$with_aix_soname; case $withval in - aix|svr4|both) - ;; - *) - as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_with_aix_soname=aix -fi - - with_aix_soname=$lt_cv_with_aix_soname -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr - fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld=$lt_cv_prog_gnu_ld - -old_CC=$CC -old_CFLAGS=$CFLAGS - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -func_cc_basename $compiler -cc_basename=$func_cc_basename_result - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/${ac_tool_prefix}file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi - -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac -fi - -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC=$CC -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test yes = "$GCC"; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test yes = "$GCC"; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - lt_prog_compiler_pic='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='$wl-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test yes = "$lt_cv_prog_compiler_pic_works"; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test yes = "$lt_cv_prog_compiler_static_works"; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test yes != "$GCC"; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test yes = "$lt_use_gnu_ld_interface"; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='$wl--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='$wl--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test linux-dietlibc = "$host_os"; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - tcc*) - export_dynamic_flag_spec='-rdynamic' - ;; - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test no = "$ld_shlibs"; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then - aix_use_runtimelinking=yes - break - fi - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct=no - hardcode_direct_absolute=no - ;; - esac - - if test yes = "$GCC"; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - - export_dynamic_flag_spec='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' $wl-bernotok' - allow_undefined_flag=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag=$_lt_dar_allow_undefined - case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test yes = "$_lt_dar_can_shared"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test yes = "$GCC"; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv -f $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv -f $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='$wl-E' - ;; - - hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test yes = "$lt_cv_prog_compiler__b"; then - archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test yes = "$lt_cv_irix_exported_symbol"; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi - link_all_deplibs=no - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - ld_shlibs=yes - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' - else - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - ;; - - osf3*) - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='$wl' - archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test sequent = "$host_vendor"; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='$wl-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='$wl-z,text' - allow_undefined_flag='$wl-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test sni = "$host_vendor"; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='$wl-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test no = "$ld_shlibs" && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test yes,yes = "$GCC,$enable_shared"; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test yes = "$GCC"; then - case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([A-Za-z]:\)|\1|g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=.so -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - - - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then - # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec=$LIB - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 - fi - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test yes = "$lt_cv_prog_gnu_ld"; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec='-L$libdir' - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd* | bitrig*) - version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib - need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -os2*) - libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec -fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec -fi - -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test yes = "$hardcode_automatic"; then - - # We can hardcode non-existent directories. - if test no != "$hardcode_direct" && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && - test no != "$hardcode_minus_L"; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test relink = "$hardcode_action" || - test yes = "$inherit_rpath"; then - # Fast installation is not supported - enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test yes != "$enable_dlopen"; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen=load_add_on - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - - lt_cv_dlopen=dyld - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen=shl_load -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int main (void) -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen=dlopen -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int main (void) -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else - enable_dlopen=yes - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS=$LDFLAGS - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS=$LIBS - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test yes = "$lt_cv_dlopen_self"; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test yes = "$cross_compiling"; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report what library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test no = "$can_build_shared" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC=$lt_save_CC - - - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - -## --------------------- ## -## End of libtool code ## -## --------------------- ## - -# -# Verify if finally libtool shared libraries will be built -# - -case "x$enable_shared" in # (( - xyes | xno) - xc_lt_build_shared=$enable_shared - ;; - *) - as_fn_error $? "unexpected libtool enable_shared value: $enable_shared" "$LINENO" 5 - ;; -esac - -# -# Verify if finally libtool static libraries will be built -# - -case "x$enable_static" in # (( - xyes | xno) - xc_lt_build_static=$enable_static - ;; - *) - as_fn_error $? "unexpected libtool enable_static value: $enable_static" "$LINENO" 5 - ;; -esac - -# -# Verify if libtool shared libraries should be linked using flag -version-info -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries with -version-info" >&5 -$as_echo_n "checking whether to build shared libraries with -version-info... " >&6; } -xc_lt_shlib_use_version_info='yes' -if test "x$version_type" = 'xnone'; then - xc_lt_shlib_use_version_info='no' -fi -case $host_os in # ( - amigaos*) - xc_lt_shlib_use_version_info='yes' - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_shlib_use_version_info" >&5 -$as_echo "$xc_lt_shlib_use_version_info" >&6; } - -# -# Verify if libtool shared libraries should be linked using flag -no-undefined -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries with -no-undefined" >&5 -$as_echo_n "checking whether to build shared libraries with -no-undefined... " >&6; } -xc_lt_shlib_use_no_undefined='no' -if test "x$allow_undefined" = 'xno'; then - xc_lt_shlib_use_no_undefined='yes' -elif test "x$allow_undefined_flag" = 'xunsupported'; then - xc_lt_shlib_use_no_undefined='yes' -fi -case $host_os in # ( - cygwin* | mingw* | pw32* | cegcc* | os2* | aix*) - xc_lt_shlib_use_no_undefined='yes' - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_shlib_use_no_undefined" >&5 -$as_echo "$xc_lt_shlib_use_no_undefined" >&6; } - -# -# Verify if libtool shared libraries should be linked using flag -mimpure-text -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries with -mimpure-text" >&5 -$as_echo_n "checking whether to build shared libraries with -mimpure-text... " >&6; } -xc_lt_shlib_use_mimpure_text='no' -case $host_os in # ( - solaris2*) - if test "x$GCC" = 'xyes'; then - xc_lt_shlib_use_mimpure_text='yes' - fi - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_shlib_use_mimpure_text" >&5 -$as_echo "$xc_lt_shlib_use_mimpure_text" >&6; } - -# -# Find out whether libtool libraries would be built wit PIC -# - -case "x$pic_mode" in # (((( - xdefault) - xc_lt_build_shared_with_pic='yes' - xc_lt_build_static_with_pic='no' - ;; - xyes) - xc_lt_build_shared_with_pic='yes' - xc_lt_build_static_with_pic='yes' - ;; - xno) - xc_lt_build_shared_with_pic='no' - xc_lt_build_static_with_pic='no' - ;; - *) - xc_lt_build_shared_with_pic='unknown' - xc_lt_build_static_with_pic='unknown' - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unexpected libtool pic_mode value: $pic_mode" >&5 -$as_echo "$as_me: WARNING: unexpected libtool pic_mode value: $pic_mode" >&2;} - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries with PIC" >&5 -$as_echo_n "checking whether to build shared libraries with PIC... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_build_shared_with_pic" >&5 -$as_echo "$xc_lt_build_shared_with_pic" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries with PIC" >&5 -$as_echo_n "checking whether to build static libraries with PIC... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_build_static_with_pic" >&5 -$as_echo "$xc_lt_build_static_with_pic" >&6; } - -# -# Verify if libtool shared libraries will be built while static not built -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries only" >&5 -$as_echo_n "checking whether to build shared libraries only... " >&6; } -if test "$xc_lt_build_shared" = 'yes' && - test "$xc_lt_build_static" = 'no'; then - xc_lt_build_shared_only='yes' -else - xc_lt_build_shared_only='no' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_build_shared_only" >&5 -$as_echo "$xc_lt_build_shared_only" >&6; } - -# -# Verify if libtool static libraries will be built while shared not built -# - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries only" >&5 -$as_echo_n "checking whether to build static libraries only... " >&6; } -if test "$xc_lt_build_static" = 'yes' && - test "$xc_lt_build_shared" = 'no'; then - xc_lt_build_static_only='yes' -else - xc_lt_build_static_only='no' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xc_lt_build_static_only" >&5 -$as_echo "$xc_lt_build_static_only" >&6; } - - - - -# -# Automake conditionals based on libtool related checks -# - - if test "x$xc_lt_shlib_use_version_info" = 'xyes'; then - CURL_LT_SHLIB_USE_VERSION_INFO_TRUE= - CURL_LT_SHLIB_USE_VERSION_INFO_FALSE='#' -else - CURL_LT_SHLIB_USE_VERSION_INFO_TRUE='#' - CURL_LT_SHLIB_USE_VERSION_INFO_FALSE= -fi - - if test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then - CURL_LT_SHLIB_USE_NO_UNDEFINED_TRUE= - CURL_LT_SHLIB_USE_NO_UNDEFINED_FALSE='#' -else - CURL_LT_SHLIB_USE_NO_UNDEFINED_TRUE='#' - CURL_LT_SHLIB_USE_NO_UNDEFINED_FALSE= -fi - - if test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'; then - CURL_LT_SHLIB_USE_MIMPURE_TEXT_TRUE= - CURL_LT_SHLIB_USE_MIMPURE_TEXT_FALSE='#' -else - CURL_LT_SHLIB_USE_MIMPURE_TEXT_TRUE='#' - CURL_LT_SHLIB_USE_MIMPURE_TEXT_FALSE= -fi - - -# -# Due to libtool and automake machinery limitations of not allowing -# specifying separate CPPFLAGS or CFLAGS when compiling objects for -# inclusion of these in shared or static libraries, we are forced to -# build using separate configure runs for shared and static libraries -# on systems where different CPPFLAGS or CFLAGS are mandatory in order -# to compile objects for each kind of library. Notice that relying on -# the '-DPIC' CFLAG that libtool provides is not valid given that the -# user might for example choose to build static libraries with PIC. -# - -# -# Make our Makefile.am files use the staticlib CPPFLAG only when strictly -# targeting a static library and not building its shared counterpart. -# - - if test "x$xc_lt_build_static_only" = 'xyes'; then - USE_CPPFLAG_CURL_STATICLIB_TRUE= - USE_CPPFLAG_CURL_STATICLIB_FALSE='#' -else - USE_CPPFLAG_CURL_STATICLIB_TRUE='#' - USE_CPPFLAG_CURL_STATICLIB_FALSE= -fi - - -# -# Make staticlib CPPFLAG variable and its definition visible in output -# files unconditionally, providing an empty definition unless strictly -# targeting a static library and not building its shared counterpart. -# - -CPPFLAG_CURL_STATICLIB= -if test "x$xc_lt_build_static_only" = 'xyes'; then - CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB' -fi - - - -# Determine whether all dependent libraries must be specified when linking -if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno" -then - REQUIRE_LIB_DEPS=no -else - REQUIRE_LIB_DEPS=yes -fi - - if test x$REQUIRE_LIB_DEPS = xyes; then - USE_EXPLICIT_LIB_DEPS_TRUE= - USE_EXPLICIT_LIB_DEPS_FALSE='#' -else - USE_EXPLICIT_LIB_DEPS_TRUE='#' - USE_EXPLICIT_LIB_DEPS_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cpp -P is needed" >&5 -$as_echo_n "checking if cpp -P is needed... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include -TEST EINVAL TEST - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "TEST.*TEST" >/dev/null 2>&1; then : - cpp=no -else - cpp=yes -fi -rm -f conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpp" >&5 -$as_echo "$cpp" >&6; } - - if test "x$cpp" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cpp -P works" >&5 -$as_echo_n "checking if cpp -P works... " >&6; } - OLDCPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -P" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include -TEST EINVAL TEST - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "TEST.*TEST" >/dev/null 2>&1; then : - cpp_p=yes -else - cpp_p=no -fi -rm -f conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cpp_p" >&5 -$as_echo "$cpp_p" >&6; } - - if test "x$cpp_p" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: failed to figure out cpp -P alternative" >&5 -$as_echo "$as_me: WARNING: failed to figure out cpp -P alternative" >&2;} - # without -P - CPPPFLAG="" - else - # with -P - CPPPFLAG="-P" - fi - CPPFLAGS=$OLDCPPFLAGS - else - # without -P - CPPPFLAG="" - fi - - - # - compiler_id="unknown" - compiler_num="0" - # - flags_dbg_all="unknown" - flags_dbg_yes="unknown" - flags_dbg_off="unknown" - flags_opt_all="unknown" - flags_opt_yes="unknown" - flags_opt_off="unknown" - # - flags_prefer_cppflags="no" - # - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is DEC/Compaq/HP C" >&5 -$as_echo_n "checking if compiler is DEC/Compaq/HP C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __DECC -CURL_DEF_TOKEN __DECC -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___DECC=no - - else - curl_cv_have_def___DECC=yes - curl_cv_def___DECC=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __DECC_VER -CURL_DEF_TOKEN __DECC_VER -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC_VER"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___DECC_VER=no - - else - curl_cv_have_def___DECC_VER=yes - curl_cv_def___DECC_VER=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___DECC" = "yes" && - test "$curl_cv_have_def___DECC_VER" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="DEC_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g2" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" - flags_opt_yes="-O1" - flags_opt_off="-O0" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is HP-UX C" >&5 -$as_echo_n "checking if compiler is HP-UX C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __HP_cc -CURL_DEF_TOKEN __HP_cc -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__HP_cc"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___HP_cc=no - - else - curl_cv_have_def___HP_cc=yes - curl_cv_def___HP_cc=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___HP_cc" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="HP_UX_C" - flags_dbg_all="-g -s" - flags_dbg_yes="-g" - flags_dbg_off="-s" - flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" - flags_opt_yes="+O2" - flags_opt_off="+O0" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is IBM C" >&5 -$as_echo_n "checking if compiler is IBM C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __IBMC__ -CURL_DEF_TOKEN __IBMC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__IBMC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___IBMC__=no - - else - curl_cv_have_def___IBMC__=yes - curl_cv_def___IBMC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___IBMC__" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="IBM_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" - flags_opt_all="$flags_opt_all -qnooptimize" - flags_opt_all="$flags_opt_all -qoptimize=0" - flags_opt_all="$flags_opt_all -qoptimize=1" - flags_opt_all="$flags_opt_all -qoptimize=2" - flags_opt_all="$flags_opt_all -qoptimize=3" - flags_opt_all="$flags_opt_all -qoptimize=4" - flags_opt_all="$flags_opt_all -qoptimize=5" - flags_opt_yes="-O2" - flags_opt_off="-qnooptimize" - flags_prefer_cppflags="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Intel C" >&5 -$as_echo_n "checking if compiler is Intel C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __INTEL_COMPILER -CURL_DEF_TOKEN __INTEL_COMPILER -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__INTEL_COMPILER"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___INTEL_COMPILER=no - - else - curl_cv_have_def___INTEL_COMPILER=yes - curl_cv_def___INTEL_COMPILER=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_num="$curl_cv_def___INTEL_COMPILER" - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __unix__ -CURL_DEF_TOKEN __unix__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = ""; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___unix__=no - - else - curl_cv_have_def___unix__=yes - curl_cv_def___unix__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___unix__" = "yes"; then - compiler_id="INTEL_UNIX_C" - flags_dbg_all="-g -g0" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - compiler_id="INTEL_WINDOWS_C" - flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" - flags_dbg_all="$flags_dbg_all /debug" - flags_dbg_all="$flags_dbg_all /debug:none" - flags_dbg_all="$flags_dbg_all /debug:minimal" - flags_dbg_all="$flags_dbg_all /debug:partial" - flags_dbg_all="$flags_dbg_all /debug:full" - flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" - flags_dbg_all="$flags_dbg_all /debug:extended" - flags_dbg_yes="/Zi /Oy-" - flags_dbg_off="/debug:none /Oy-" - flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" - flags_opt_yes="/O2" - flags_opt_off="/Od" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is clang" >&5 -$as_echo_n "checking if compiler is clang... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __clang__ -CURL_DEF_TOKEN __clang__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__clang__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___clang__=no - - else - curl_cv_have_def___clang__=yes - curl_cv_def___clang__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___clang__" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="CLANG" - fullclangver=`$CC -v 2>&1 | grep version` - clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \([0-9]*\.[0-9]*\).*)/\1/'` - if test -z "$clangver"; then - if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then - clangver="3.7" - else - clangver=`echo $fullclangver | "$SED" 's/.*version \([0-9]*\.[0-9]*\).*/\1/'` - fi - fi - clangvhi=`echo $clangver | cut -d . -f1` - clangvlo=`echo $clangver | cut -d . -f2` - compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_all="$flags_dbg_all -ggdb" - flags_dbg_all="$flags_dbg_all -gstabs" - flags_dbg_all="$flags_dbg_all -gstabs+" - flags_dbg_all="$flags_dbg_all -gcoff" - flags_dbg_all="$flags_dbg_all -gxcoff" - flags_dbg_all="$flags_dbg_all -gdwarf-2" - flags_dbg_all="$flags_dbg_all -gvms" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" - flags_opt_yes="-Os" - flags_opt_off="-O0" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is GNU C" >&5 -$as_echo_n "checking if compiler is GNU C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __GNUC__ -CURL_DEF_TOKEN __GNUC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___GNUC__=no - - else - curl_cv_have_def___GNUC__=yes - curl_cv_def___GNUC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___GNUC__" = "yes" && - test "$compiler_id" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="GNU_C" - gccver=`$CC -dumpversion` - gccvhi=`echo $gccver | cut -d . -f1` - gccvlo=`echo $gccver | cut -d . -f2` - compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_all="$flags_dbg_all -ggdb" - flags_dbg_all="$flags_dbg_all -gstabs" - flags_dbg_all="$flags_dbg_all -gstabs+" - flags_dbg_all="$flags_dbg_all -gcoff" - flags_dbg_all="$flags_dbg_all -gxcoff" - flags_dbg_all="$flags_dbg_all -gdwarf-2" - flags_dbg_all="$flags_dbg_all -gvms" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast" - flags_opt_yes="-O2" - flags_opt_off="-O0" - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef _WIN32 -CURL_DEF_TOKEN _WIN32 -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "_WIN32"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def__WIN32=no - - else - curl_cv_have_def__WIN32=yes - curl_cv_def__WIN32=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is LCC" >&5 -$as_echo_n "checking if compiler is LCC... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __LCC__ -CURL_DEF_TOKEN __LCC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__LCC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___LCC__=no - - else - curl_cv_have_def___LCC__=yes - curl_cv_def___LCC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___LCC__" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="LCC" - flags_dbg_all="-g" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPSpro C" >&5 -$as_echo_n "checking if compiler is SGI MIPSpro C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __GNUC__ -CURL_DEF_TOKEN __GNUC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___GNUC__=no - - else - curl_cv_have_def___GNUC__=yes - curl_cv_def___GNUC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef _COMPILER_VERSION -CURL_DEF_TOKEN _COMPILER_VERSION -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "_COMPILER_VERSION"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def__COMPILER_VERSION=no - - else - curl_cv_have_def__COMPILER_VERSION=yes - curl_cv_def__COMPILER_VERSION=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef _SGI_COMPILER_VERSION -CURL_DEF_TOKEN _SGI_COMPILER_VERSION -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "_SGI_COMPILER_VERSION"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def__SGI_COMPILER_VERSION=no - - else - curl_cv_have_def__SGI_COMPILER_VERSION=yes - curl_cv_def__SGI_COMPILER_VERSION=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___GNUC__" = "no" && - (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" || - test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="SGI_MIPSPRO_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPS C" >&5 -$as_echo_n "checking if compiler is SGI MIPS C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __GNUC__ -CURL_DEF_TOKEN __GNUC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___GNUC__=no - - else - curl_cv_have_def___GNUC__=yes - curl_cv_def___GNUC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __sgi -CURL_DEF_TOKEN __sgi -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__sgi"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___sgi=no - - else - curl_cv_have_def___sgi=yes - curl_cv_def___sgi=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___GNUC__" = "no" && - test "$curl_cv_have_def___sgi" = "yes" && - test "$compiler_id" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="SGI_MIPS_C" - flags_dbg_all="-g -g0 -g1 -g2 -g3" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SunPro C" >&5 -$as_echo_n "checking if compiler is SunPro C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __SUNPRO_C -CURL_DEF_TOKEN __SUNPRO_C -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__SUNPRO_C"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___SUNPRO_C=no - - else - curl_cv_have_def___SUNPRO_C=yes - curl_cv_def___SUNPRO_C=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="SUNPRO_C" - flags_dbg_all="-g -s" - flags_dbg_yes="-g" - flags_dbg_off="-s" - flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" - flags_opt_yes="-xO2" - flags_opt_off="" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Tiny C" >&5 -$as_echo_n "checking if compiler is Tiny C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __TINYC__ -CURL_DEF_TOKEN __TINYC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__TINYC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___TINYC__=no - - else - curl_cv_have_def___TINYC__=yes - curl_cv_def___TINYC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___TINYC__" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler_id="TINY_C" - flags_dbg_all="-g -b" - flags_dbg_yes="-g" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Watcom C" >&5 -$as_echo_n "checking if compiler is Watcom C... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __WATCOMC__ -CURL_DEF_TOKEN __WATCOMC__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__WATCOMC__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___WATCOMC__=no - - else - curl_cv_have_def___WATCOMC__=yes - curl_cv_def___WATCOMC__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___WATCOMC__" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __UNIX__ -CURL_DEF_TOKEN __UNIX__ -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "__UNIX__"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def___UNIX__=no - - else - curl_cv_have_def___UNIX__=yes - curl_cv_def___UNIX__=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def___UNIX__" = "yes"; then - compiler_id="WATCOM_UNIX_C" - flags_dbg_all="-g1 -g1+ -g2 -g3" - flags_dbg_yes="-g2" - flags_dbg_off="" - flags_opt_all="-O0 -O1 -O2 -O3" - flags_opt_yes="-O2" - flags_opt_off="-O0" - else - compiler_id="WATCOM_WINDOWS_C" - flags_dbg_all="" - flags_dbg_yes="" - flags_dbg_off="" - flags_opt_all="" - flags_opt_yes="" - flags_opt_off="" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - # - if test "$compiler_id" = "unknown"; then - cat <<_EOF 1>&2 -*** -*** Warning: This configure script does not have information about the -*** compiler you are using, relative to the flags required to enable or -*** disable generation of debug info, optimization options or warnings. -*** -*** Whatever settings are present in CFLAGS will be used for this run. -*** -*** If you wish to help the curl project to better support your compiler -*** you can report this and the required info on the libcurl development -*** mailing list: https://cool.haxx.se/mailman/listinfo/curl-library/ -*** -_EOF - fi - - -squeeze() { - _sqz_result="" - eval _sqz_input=\$$1 - for _sqz_token in $_sqz_input; do - if test -z "$_sqz_result"; then - _sqz_result="$_sqz_token" - else - _sqz_result="$_sqz_result $_sqz_token" - fi - done - eval $1=\$_sqz_result - return 0 -} - - - # - if test "$compiler_id" != "unknown"; then - # - if test "$compiler_id" = "GNU_C" || - test "$compiler_id" = "CLANG"; then - - if test "$compiler_id" = "GNU_C" || - test "$compiler_id" = "CLANG"; then - tmp_has_include="no" - tmp_chg_FLAGS="$CFLAGS" - for word1 in $tmp_chg_FLAGS; do - case "$word1" in - -I*) - tmp_has_include="yes" - ;; - esac - done - if test "$tmp_has_include" = "yes"; then - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` - CFLAGS="$tmp_chg_FLAGS" - squeeze CFLAGS - fi - tmp_has_include="no" - tmp_chg_FLAGS="$CPPFLAGS" - for word1 in $tmp_chg_FLAGS; do - case "$word1" in - -I*) - tmp_has_include="yes" - ;; - esac - done - if test "$tmp_has_include" = "yes"; then - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` - tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` - CPPFLAGS="$tmp_chg_FLAGS" - squeeze CPPFLAGS - fi - fi - - fi - # - tmp_save_CPPFLAGS="$CPPFLAGS" - tmp_save_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="" - tmp_CFLAGS="" - # - case "$compiler_id" in - # - CLANG) - # - tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" - ;; - # - DEC_C) - # - tmp_CFLAGS="$tmp_CFLAGS -std1" - tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" - tmp_CFLAGS="$tmp_CFLAGS -warnprotos" - tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" - ;; - # - GNU_C) - # - if test "$compiler_num" -ge "295"; then - tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration" - fi - ;; - # - HP_UX_C) - # - tmp_CFLAGS="$tmp_CFLAGS -z" - tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" - ;; - # - IBM_C) - # - tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded" - tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias" - tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e" - ;; - # - INTEL_UNIX_C) - # - tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" - tmp_CPPFLAGS="$tmp_CPPFLAGS -we140,147,165,266" - tmp_CPPFLAGS="$tmp_CPPFLAGS -wd279,981,1469" - ;; - # - INTEL_WINDOWS_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - LCC) - # - tmp_CFLAGS="$tmp_CFLAGS -n" - ;; - # - SGI_MIPS_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - SGI_MIPSPRO_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - SUNPRO_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - TINY_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - WATCOM_UNIX_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - WATCOM_WINDOWS_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - esac - # - squeeze tmp_CPPFLAGS - squeeze tmp_CFLAGS - # - if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts some basic options" >&5 -$as_echo_n "checking if compiler accepts some basic options... " >&6; } - CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CPPFLAGS - squeeze CFLAGS - - tmp_compiler_works="unknown" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/cc-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tmp_compiler_works" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/link-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "x$cross_compiling" != "xyes" && - test "$tmp_compiler_works" = "yes"; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef __STDC__ -# include -# endif - -int main (void) -{ - - int i = 0; - exit(i); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - echo "run-fail: test program exited with status $ac_status" >&6 - echo " " >&6 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - if test "$tmp_compiler_works" = "yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 -$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} - - else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 -$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - - fi - - fi - # - fi - - - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CFLAGS="$CFLAGS" - tmp_save_CPPFLAGS="$CPPFLAGS" - # - tmp_options="" - tmp_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="$CPPFLAGS" - - ac_var_stripped="" - for word1 in $tmp_CFLAGS; do - ac_var_strip_word="no" - for word2 in $flags_dbg_all; do - if test "$word1" = "$word2"; then - ac_var_strip_word="yes" - fi - done - if test "$ac_var_strip_word" = "no"; then - ac_var_stripped="$ac_var_stripped $word1" - fi - done - tmp_CFLAGS="$ac_var_stripped" - squeeze tmp_CFLAGS - - - ac_var_stripped="" - for word1 in $tmp_CPPFLAGS; do - ac_var_strip_word="no" - for word2 in $flags_dbg_all; do - if test "$word1" = "$word2"; then - ac_var_strip_word="yes" - fi - done - if test "$ac_var_strip_word" = "no"; then - ac_var_stripped="$ac_var_stripped $word1" - fi - done - tmp_CPPFLAGS="$ac_var_stripped" - squeeze tmp_CPPFLAGS - - # - if test "$want_debug" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug enabling options" >&5 -$as_echo_n "checking if compiler accepts debug enabling options... " >&6; } - tmp_options="$flags_dbg_yes" - fi - if test "$want_debug" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug disabling options" >&5 -$as_echo_n "checking if compiler accepts debug disabling options... " >&6; } - tmp_options="$flags_dbg_off" - fi - # - if test "$flags_prefer_cppflags" = "yes"; then - CPPFLAGS="$tmp_CPPFLAGS $tmp_options" - CFLAGS="$tmp_CFLAGS" - else - CPPFLAGS="$tmp_CPPFLAGS" - CFLAGS="$tmp_CFLAGS $tmp_options" - fi - squeeze CPPFLAGS - squeeze CFLAGS - - tmp_compiler_works="unknown" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/cc-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tmp_compiler_works" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/link-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "x$cross_compiling" != "xyes" && - test "$tmp_compiler_works" = "yes"; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef __STDC__ -# include -# endif - -int main (void) -{ - - int i = 0; - exit(i); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - echo "run-fail: test program exited with status $ac_status" >&6 - echo " " >&6 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - if test "$tmp_compiler_works" = "yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 -$as_echo "$as_me: compiler options added: $tmp_options" >&6;} - - else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 -$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - - fi - - # - fi - - - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CFLAGS="$CFLAGS" - tmp_save_CPPFLAGS="$CPPFLAGS" - # - tmp_options="" - tmp_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="$CPPFLAGS" - honor_optimize_option="yes" - # - # - if test "$want_optimize" = "assume_no" || - test "$want_optimize" = "assume_yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler optimizer assumed setting might be used" >&5 -$as_echo_n "checking if compiler optimizer assumed setting might be used... " >&6; } - - - ac_var_match_word="no" - for word1 in $tmp_CFLAGS; do - for word2 in $flags_opt_all; do - if test "$word1" = "$word2"; then - ac_var_match_word="yes" - fi - done - done - - if test "$ac_var_match_word" = "yes"; then - - honor_optimize_option="no" - - - fi - - - - ac_var_match_word="no" - for word1 in $tmp_CPPFLAGS; do - for word2 in $flags_opt_all; do - if test "$word1" = "$word2"; then - ac_var_match_word="yes" - fi - done - done - - if test "$ac_var_match_word" = "yes"; then - - honor_optimize_option="no" - - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $honor_optimize_option" >&5 -$as_echo "$honor_optimize_option" >&6; } - if test "$honor_optimize_option" = "yes"; then - if test "$want_optimize" = "assume_yes"; then - want_optimize="yes" - fi - if test "$want_optimize" = "assume_no"; then - want_optimize="no" - fi - fi - fi - # - if test "$honor_optimize_option" = "yes"; then - - ac_var_stripped="" - for word1 in $tmp_CFLAGS; do - ac_var_strip_word="no" - for word2 in $flags_opt_all; do - if test "$word1" = "$word2"; then - ac_var_strip_word="yes" - fi - done - if test "$ac_var_strip_word" = "no"; then - ac_var_stripped="$ac_var_stripped $word1" - fi - done - tmp_CFLAGS="$ac_var_stripped" - squeeze tmp_CFLAGS - - - ac_var_stripped="" - for word1 in $tmp_CPPFLAGS; do - ac_var_strip_word="no" - for word2 in $flags_opt_all; do - if test "$word1" = "$word2"; then - ac_var_strip_word="yes" - fi - done - if test "$ac_var_strip_word" = "no"; then - ac_var_stripped="$ac_var_stripped $word1" - fi - done - tmp_CPPFLAGS="$ac_var_stripped" - squeeze tmp_CPPFLAGS - - if test "$want_optimize" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer enabling options" >&5 -$as_echo_n "checking if compiler accepts optimizer enabling options... " >&6; } - tmp_options="$flags_opt_yes" - fi - if test "$want_optimize" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer disabling options" >&5 -$as_echo_n "checking if compiler accepts optimizer disabling options... " >&6; } - tmp_options="$flags_opt_off" - fi - if test "$flags_prefer_cppflags" = "yes"; then - CPPFLAGS="$tmp_CPPFLAGS $tmp_options" - CFLAGS="$tmp_CFLAGS" - else - CPPFLAGS="$tmp_CPPFLAGS" - CFLAGS="$tmp_CFLAGS $tmp_options" - fi - squeeze CPPFLAGS - squeeze CFLAGS - - tmp_compiler_works="unknown" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/cc-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tmp_compiler_works" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/link-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "x$cross_compiling" != "xyes" && - test "$tmp_compiler_works" = "yes"; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef __STDC__ -# include -# endif - -int main (void) -{ - - int i = 0; - exit(i); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - echo "run-fail: test program exited with status $ac_status" >&6 - echo " " >&6 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - if test "$tmp_compiler_works" = "yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 -$as_echo "$as_me: compiler options added: $tmp_options" >&6;} - - else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 -$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - - fi - - fi - # - fi - - - # - if test "$compiler_id" != "unknown"; then - # - tmp_save_CPPFLAGS="$CPPFLAGS" - tmp_save_CFLAGS="$CFLAGS" - tmp_CPPFLAGS="" - tmp_CFLAGS="" - # - case "$compiler_id" in - # - CLANG) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -pedantic" - tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" - tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" - tmp_CFLAGS="$tmp_CFLAGS -Wshadow" - tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" - tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" - tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" - tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" - tmp_CFLAGS="$tmp_CFLAGS -Wundef" - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" - tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" - tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" - tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" - tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" - tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32" - # - if test "$compiler_num" -ge "101"; then - tmp_CFLAGS="$tmp_CFLAGS -Wunused" - fi - # - if test "$compiler_num" -ge "208"; then - tmp_CFLAGS="$tmp_CFLAGS -Wvla" - fi - # - if test "$compiler_num" -ge "209"; then - tmp_CFLAGS="$tmp_CFLAGS -Wshift-sign-overflow" - fi - # - if test "$compiler_num" -ge "302"; then - case $host_os in - cygwin* | mingw*) - ;; - *) - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-variable-declarations" - ;; - esac - fi - # - if test "$compiler_num" -ge "306"; then - tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion" - fi - # - if test "$compiler_num" -ge "309"; then - tmp_CFLAGS="$tmp_CFLAGS -Wcomma" - # avoid the varargs warning, fixed in 4.0 - # https://bugs.llvm.org/show_bug.cgi?id=29140 - if test "$compiler_num" -lt "400"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-varargs" - fi - fi - fi - ;; - # - DEC_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" - fi - ;; - # - GNU_C) - # - if test "$want_warnings" = "yes"; then - # - if test "x$cross_compiling" != "xyes" || - test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -pedantic" - fi - # - tmp_CFLAGS="$tmp_CFLAGS -Wall -W" - # - if test "$compiler_num" -ge "104"; then - tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" - if test "x$cross_compiling" != "xyes" || - test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow" - fi - fi - # - if test "$compiler_num" -ge "207"; then - tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" - if test "x$cross_compiling" != "xyes" || - test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" - fi - fi - # - if test "$compiler_num" -ge "295"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" - fi - # - if test "$compiler_num" -ge "296"; then - tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" - tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" - tmp_CFLAGS="$tmp_CFLAGS -Wundef" - fi - # - if test "$compiler_num" -ge "297"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" - fi - # - if test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS" - fi - # - if test "$compiler_num" -ge "303"; then - tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" - fi - # - if test "$compiler_num" -ge "304"; then - tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" - fi - # - if test "$compiler_num" -ge "400"; then - tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3" - fi - # - if test "$compiler_num" -ge "402"; then - tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" - fi - # - if test "$compiler_num" -ge "403"; then - tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" - tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" - tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" - tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla" - fi - # - if test "$compiler_num" -ge "405"; then - if test "$curl_cv_have_def__WIN32" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format" - fi - fi - # - if test "$compiler_num" -ge "406"; then - tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion" - fi - # - fi - # - if test "$compiler_num" -ge "300"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" - else - if test "x$cross_compiling" = "xyes"; then - if test "$compiler_num" -ge "104"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" - fi - if test "$compiler_num" -ge "207"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" - tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" - fi - fi - fi - ;; - # - HP_UX_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS +w1" - fi - ;; - # - IBM_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - INTEL_UNIX_C) - # - if test "$want_warnings" = "yes"; then - if test "$compiler_num" -gt "600"; then - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" - tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" - fi - fi - tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" - tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" - tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" - if test "$compiler_num" -ge "1000"; then - tmp_CFLAGS="$tmp_CFLAGS -vec-report0" - fi - ;; - # - INTEL_WINDOWS_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - LCC) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS" - fi - ;; - # - SGI_MIPS_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -fullwarn" - fi - ;; - # - SGI_MIPSPRO_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -fullwarn" - tmp_CFLAGS="$tmp_CFLAGS -woff 1209" - fi - ;; - # - SUNPRO_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -v" - fi - ;; - # - TINY_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -Wall" - tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings" - tmp_CFLAGS="$tmp_CFLAGS -Wunsupported" - fi - ;; - # - WATCOM_UNIX_C) - # - if test "$want_warnings" = "yes"; then - tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" - fi - ;; - # - WATCOM_WINDOWS_C) - # - tmp_CFLAGS="$tmp_CFLAGS" - ;; - # - esac - # - squeeze tmp_CPPFLAGS - squeeze tmp_CFLAGS - # - if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts strict warning options" >&5 -$as_echo_n "checking if compiler accepts strict warning options... " >&6; } - CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CPPFLAGS - squeeze CFLAGS - - tmp_compiler_works="unknown" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/cc-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tmp_compiler_works" = "yes"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - int i = 1; - return i; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - sed 's/^/link-fail: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "x$cross_compiling" != "xyes" && - test "$tmp_compiler_works" = "yes"; then - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef __STDC__ -# include -# endif - -int main (void) -{ - - int i = 0; - exit(i); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - tmp_compiler_works="yes" - -else - - tmp_compiler_works="no" - echo " " >&6 - echo "run-fail: test program exited with status $ac_status" >&6 - echo " " >&6 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - if test "$tmp_compiler_works" = "yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 -$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} - - else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 -$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} - CPPFLAGS="$tmp_save_CPPFLAGS" - CFLAGS="$tmp_save_CFLAGS" - - fi - - fi - # - fi - - -if test "$compiler_id" = "INTEL_UNIX_C"; then - # - if test "$compiler_num" -ge "1000"; then - CFLAGS="$CFLAGS -shared-intel" - elif test "$compiler_num" -ge "900"; then - CFLAGS="$CFLAGS -i-dynamic" - fi - # -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on compilation errors" >&5 -$as_echo_n "checking if compiler halts on compilation errors... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - force compilation error - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "compiler does not halt on compilation errors." "$LINENO" 5 - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on negative sized arrays" >&5 -$as_echo_n "checking if compiler halts on negative sized arrays... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; - -int main (void) -{ - - bad_t dummy; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "compiler does not halt on negative sized arrays." "$LINENO" 5 - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on function prototype mismatch" >&5 -$as_echo_n "checking if compiler halts on function prototype mismatch... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# include - int rand(int n); - int rand(int n) - { - if(n) - return ++n; - else - return n; - } - -int main (void) -{ - - int i[2]={0,0}; - int j = rand(i[0]); - if(j) - return j; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "compiler does not halt on function prototype mismatch." "$LINENO" 5 - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports hiding library internal symbols" >&5 -$as_echo_n "checking if compiler supports hiding library internal symbols... " >&6; } - supports_symbol_hiding="no" - symbol_hiding_CFLAGS="" - symbol_hiding_EXTERN="" - tmp_CFLAGS="" - tmp_EXTERN="" - case "$compiler_id" in - CLANG) - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - ;; - GNU_C) - if test "$compiler_num" -ge "304"; then - if $CC --help --verbose 2>/dev/null | grep fvisibility= >/dev/null ; then - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - fi - fi - ;; - INTEL_UNIX_C) - if test "$compiler_num" -ge "900"; then - if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# include - -int main (void) -{ - - printf("icc fvisibility bug test"); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))" - tmp_CFLAGS="-fvisibility=hidden" - supports_symbol_hiding="yes" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$tmp_save_CFLAGS" - fi - fi - ;; - SUNPRO_C) - if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then - tmp_EXTERN="__global" - tmp_CFLAGS="-xldscope=hidden" - supports_symbol_hiding="yes" - fi - ;; - esac - if test "$supports_symbol_hiding" = "yes"; then - tmp_save_CFLAGS="$CFLAGS" - CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" - squeeze CFLAGS - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $tmp_EXTERN char *dummy(char *buff); - char *dummy(char *buff) - { - if(buff) - return ++buff; - else - return buff; - } - -int main (void) -{ - - char b[16]; - char *r = dummy(&b[0]); - if(r) - return (int)*r; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - supports_symbol_hiding="yes" - if test -f conftest.err; then - grep 'visibility' conftest.err >/dev/null - if test "$?" -eq "0"; then - supports_symbol_hiding="no" - fi - fi - -else - - supports_symbol_hiding="no" - echo " " >&6 - sed 's/^/cc-src: /' conftest.$ac_ext >&6 - sed 's/^/cc-err: /' conftest.err >&6 - echo " " >&6 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$tmp_save_CFLAGS" - fi - if test "$supports_symbol_hiding" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - symbol_hiding_CFLAGS="$tmp_CFLAGS" - symbol_hiding_EXTERN="$tmp_EXTERN" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - - - supports_curldebug="unknown" - if test "$want_curldebug" = "yes"; then - if test "x$enable_shared" != "xno" && - test "x$enable_shared" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_shared setting." >&5 -$as_echo "$as_me: WARNING: unknown enable_shared setting." >&2;} - supports_curldebug="no" - fi - if test "x$enable_static" != "xno" && - test "x$enable_static" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_static setting." >&5 -$as_echo "$as_me: WARNING: unknown enable_static setting." >&2;} - supports_curldebug="no" - fi - if test "$supports_curldebug" != "no"; then - if test "$enable_shared" = "yes" && - test "x$xc_lt_shlib_use_no_undefined" = 'xyes'; then - supports_curldebug="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared library does not support undefined symbols." >&5 -$as_echo "$as_me: WARNING: shared library does not support undefined symbols." >&2;} - fi - fi - fi - # - if test "$want_curldebug" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if curl debug memory tracking can be enabled" >&5 -$as_echo_n "checking if curl debug memory tracking can be enabled... " >&6; } - test "$supports_curldebug" = "no" || supports_curldebug="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports_curldebug" >&5 -$as_echo "$supports_curldebug" >&6; } - if test "$supports_curldebug" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable curl debug memory tracking." >&5 -$as_echo "$as_me: WARNING: cannot enable curl debug memory tracking." >&2;} - want_curldebug="no" - fi - fi - # - if test "$want_curldebug" = "yes"; then - CPPFLAGS="-DCURLDEBUG $CPPFLAGS" - squeeze CPPFLAGS - fi - if test "$want_debug" = "yes"; then - CPPFLAGS="-DDEBUGBUILD $CPPFLAGS" - squeeze CPPFLAGS - fi - - if test x$want_curldebug = xyes; then - CURLDEBUG_TRUE= - CURLDEBUG_FALSE='#' -else - CURLDEBUG_TRUE='#' - CURLDEBUG_FALSE= -fi - - -supports_unittests=yes -# cross-compilation of unit tests static library/programs fails when -# libcurl shared library is built. This might be due to a libtool or -# automake issue. In this case we disable unit tests. -if test "x$cross_compiling" != "xno" && - test "x$enable_shared" != "xno"; then - supports_unittests=no -fi - -# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to -# a problem related with OpenSSL headers and library versions not matching. -# Disable unit tests while time to further investigate this is found. -case $host in - mips-sgi-irix6.5) - if test "$compiler_id" = "GNU_C"; then - supports_unittests=no - fi - ;; -esac - -# All AIX autobuilds fails unit tests linking against unittests library -# due to unittests library being built with no symbols or members. Libtool ? -# Disable unit tests while time to further investigate this is found. -case $host_os in - aix*) - supports_unittests=no - ;; -esac - -if test "x$want_debug" = "xyes" && - test "x$supports_unittests" = "xyes"; then - want_unittests=yes -else - want_unittests=no -fi - if test x$want_unittests = xyes; then - BUILD_UNITTESTS_TRUE= - BUILD_UNITTESTS_FALSE='#' -else - BUILD_UNITTESTS_TRUE='#' - BUILD_UNITTESTS_FALSE= -fi - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 -$as_echo_n "checking for windows.h... " >&6; } -if ${curl_cv_header_windows_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_windows_h="yes" - -else - - curl_cv_header_windows_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_windows_h" >&5 -$as_echo "$curl_cv_header_windows_h" >&6; } - case "$curl_cv_header_windows_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build target is a native Windows one" >&5 -$as_echo_n "checking whether build target is a native Windows one... " >&6; } -if ${curl_cv_native_windows+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$curl_cv_header_windows_h" = "no"; then - curl_cv_native_windows="no" - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ - (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) - int dummy=1; -#else - Not a native Windows build target. -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_native_windows="yes" - -else - - curl_cv_native_windows="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_native_windows" >&5 -$as_echo "$curl_cv_native_windows" >&6; } - if test "x$curl_cv_native_windows" = xyes; then - DOING_NATIVE_WINDOWS_TRUE= - DOING_NATIVE_WINDOWS_FALSE='#' -else - DOING_NATIVE_WINDOWS_TRUE='#' - DOING_NATIVE_WINDOWS_FALSE= -fi - - -case X-"$curl_cv_native_windows" in - X-yes) - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 -$as_echo_n "checking for winsock.h... " >&6; } -if ${curl_cv_header_winsock_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINSOCK_H shall not be defined. -#else - int dummy=WSACleanup(); -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winsock_h="yes" - -else - - curl_cv_header_winsock_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winsock_h" >&5 -$as_echo "$curl_cv_header_winsock_h" >&6; } - case "$curl_cv_header_winsock_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 -$as_echo_n "checking for winsock2.h... " >&6; } -if ${curl_cv_header_winsock2_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winsock2_h="yes" - -else - - curl_cv_header_winsock2_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winsock2_h" >&5 -$as_echo "$curl_cv_header_winsock2_h" >&6; } - case "$curl_cv_header_winsock2_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 -$as_echo_n "checking for ws2tcpip.h... " >&6; } -if ${curl_cv_header_ws2tcpip_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WS2TCPIP_H shall not be defined. -#else - int dummy=2*IP_PKTINFO; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_ws2tcpip_h="yes" - -else - - curl_cv_header_ws2tcpip_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_ws2tcpip_h" >&5 -$as_echo "$curl_cv_header_ws2tcpip_h" >&6; } - case "$curl_cv_header_ws2tcpip_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WS2TCPIP_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winldap.h" >&5 -$as_echo_n "checking for winldap.h... " >&6; } -if ${curl_cv_header_winldap_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#endif -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINLDAP_H shall not be defined. -#else - LDAP *ldp = ldap_init("dummy", LDAP_PORT); - ULONG res = ldap_unbind(ldp); -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winldap_h="yes" - -else - - curl_cv_header_winldap_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winldap_h" >&5 -$as_echo "$curl_cv_header_winldap_h" >&6; } - case "$curl_cv_header_winldap_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINLDAP_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winber.h" >&5 -$as_echo_n "checking for winber.h... " >&6; } -if ${curl_cv_header_winber_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINBER_H shall not be defined. -#else - BERVAL *bvp = NULL; - BerElement *bep = ber_init(bvp); - ber_free(bep, 1); -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winber_h="yes" - -else - - curl_cv_header_winber_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winber_h" >&5 -$as_echo "$curl_cv_header_winber_h" >&6; } - case "$curl_cv_header_winber_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINBER_H 1 -_ACEOF - - ;; - esac - - ;; - *) - curl_cv_header_winsock_h="no" - curl_cv_header_winsock2_h="no" - curl_cv_header_ws2tcpip_h="no" - curl_cv_header_winldap_h="no" - curl_cv_header_winber_h="no" - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build target supports WIN32 file API" >&5 -$as_echo_n "checking whether build target supports WIN32 file API... " >&6; } - curl_win32_file_api="no" - if test "$curl_cv_header_windows_h" = "yes"; then - if test x"$enable_largefile" != "xno"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#if !defined(_WIN32_WCE) && \ - (defined(__MINGW32__) || \ - (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))) - int dummy=1; -#else - WIN32 large file API not supported. -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_win32_file_api="win32_large_files" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$curl_win32_file_api" = "no"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER) - int dummy=1; -#else - WIN32 small file API not supported. -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_win32_file_api="win32_small_files" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - fi - case "$curl_win32_file_api" in - win32_large_files) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (large file enabled)" >&5 -$as_echo "yes (large file enabled)" >&6; } - -cat >>confdefs.h <<_ACEOF -#define USE_WIN32_LARGE_FILES 1 -_ACEOF - - ;; - win32_small_files) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (large file disabled)" >&5 -$as_echo "yes (large file disabled)" >&6; } - -cat >>confdefs.h <<_ACEOF -#define USE_WIN32_SMALL_FILES 1 -_ACEOF - - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac - - - - - tst_cflags="no" - case $host_os in - darwin*) - tst_cflags="yes" - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for good-to-use Mac CFLAGS" >&5 -$as_echo_n "checking for good-to-use Mac CFLAGS... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_cflags" >&5 -$as_echo "$tst_cflags" >&6; }; - - if test "$tst_cflags" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for *version-min in CFLAGS" >&5 -$as_echo_n "checking for *version-min in CFLAGS... " >&6; } - min="" - if test -z "$(echo $CFLAGS | grep m.*os.*-version-min)"; then - min="-mmacosx-version-min=10.8" - CFLAGS="$CFLAGS $min" - fi - if test -z "$min"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: set by user" >&5 -$as_echo "set by user" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $min set" >&5 -$as_echo "$min set" >&6; } - fi - - old_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror=partial-availability" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Werror=partial-availability" >&5 -$as_echo_n "checking whether $CC accepts -Werror=partial-availability... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CFLAGS=$old_CFLAGS -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if the compiler supports __builtin_available()" >&5 -$as_echo_n "checking to see if the compiler supports __builtin_available()... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - if (__builtin_available(macOS 10.8, iOS 5.0, *)) {} - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_BUILTIN_AVAILABLE 1 -_ACEOF - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support http" >&5 -$as_echo_n "checking whether to support http... " >&6; } -# Check whether --enable-http was given. -if test "${enable_http+set}" = set; then : - enableval=$enable_http; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_HTTP 1" >>confdefs.h - - disable_http="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disable HTTP disables FTP over proxy and RTSP" >&5 -$as_echo "$as_me: WARNING: disable HTTP disables FTP over proxy and RTSP" >&2;} - CURL_DISABLE_HTTP=1 - - -$as_echo "#define CURL_DISABLE_RTSP 1" >>confdefs.h - - CURL_DISABLE_RTSP=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ftp" >&5 -$as_echo_n "checking whether to support ftp... " >&6; } -# Check whether --enable-ftp was given. -if test "${enable_ftp+set}" = set; then : - enableval=$enable_ftp; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_FTP 1" >>confdefs.h - - CURL_DISABLE_FTP=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support file" >&5 -$as_echo_n "checking whether to support file... " >&6; } -# Check whether --enable-file was given. -if test "${enable_file+set}" = set; then : - enableval=$enable_file; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_FILE 1" >>confdefs.h - - CURL_DISABLE_FILE=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ldap" >&5 -$as_echo_n "checking whether to support ldap... " >&6; } -# Check whether --enable-ldap was given. -if test "${enable_ldap+set}" = set; then : - enableval=$enable_ldap; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h - - CURL_DISABLE_LDAP=1 - - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ldaps" >&5 -$as_echo_n "checking whether to support ldaps... " >&6; } -# Check whether --enable-ldaps was given. -if test "${enable_ldaps+set}" = set; then : - enableval=$enable_ldaps; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - - ;; - *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: LDAP needs to be enabled to support LDAPS" >&5 -$as_echo "LDAP needs to be enabled to support LDAPS" >&6; } - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_LDAP_SSL 1" >>confdefs.h - - HAVE_LDAP_SSL=1 - - fi - ;; - esac -else - - if test "x$CURL_DISABLE_LDAP" = "x1" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_LDAP_SSL 1" >>confdefs.h - - HAVE_LDAP_SSL=1 - - fi - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support rtsp" >&5 -$as_echo_n "checking whether to support rtsp... " >&6; } -# Check whether --enable-rtsp was given. -if test "${enable_rtsp+set}" = set; then : - enableval=$enable_rtsp; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_RTSP 1" >>confdefs.h - - CURL_DISABLE_RTSP=1 - - ;; - *) if test x$CURL_DISABLE_HTTP = x1 ; then - as_fn_error $? "HTTP support needs to be enabled in order to enable RTSP support!" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_rtsp_msg="enabled" - fi - ;; - esac -else - if test "x$CURL_DISABLE_HTTP" != "x1"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_rtsp_msg="enabled" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support proxies" >&5 -$as_echo_n "checking whether to support proxies... " >&6; } -# Check whether --enable-proxy was given. -if test "${enable_proxy+set}" = set; then : - enableval=$enable_proxy; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_PROXY 1" >>confdefs.h - - CURL_DISABLE_PROXY=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support dict" >&5 -$as_echo_n "checking whether to support dict... " >&6; } -# Check whether --enable-dict was given. -if test "${enable_dict+set}" = set; then : - enableval=$enable_dict; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_DICT 1" >>confdefs.h - - CURL_DISABLE_DICT=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support telnet" >&5 -$as_echo_n "checking whether to support telnet... " >&6; } -# Check whether --enable-telnet was given. -if test "${enable_telnet+set}" = set; then : - enableval=$enable_telnet; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_TELNET 1" >>confdefs.h - - CURL_DISABLE_TELNET=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support tftp" >&5 -$as_echo_n "checking whether to support tftp... " >&6; } -# Check whether --enable-tftp was given. -if test "${enable_tftp+set}" = set; then : - enableval=$enable_tftp; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_TFTP 1" >>confdefs.h - - CURL_DISABLE_TFTP=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support pop3" >&5 -$as_echo_n "checking whether to support pop3... " >&6; } -# Check whether --enable-pop3 was given. -if test "${enable_pop3+set}" = set; then : - enableval=$enable_pop3; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_POP3 1" >>confdefs.h - - CURL_DISABLE_POP3=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support imap" >&5 -$as_echo_n "checking whether to support imap... " >&6; } -# Check whether --enable-imap was given. -if test "${enable_imap+set}" = set; then : - enableval=$enable_imap; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_IMAP 1" >>confdefs.h - - CURL_DISABLE_IMAP=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support smb" >&5 -$as_echo_n "checking whether to support smb... " >&6; } -# Check whether --enable-smb was given. -if test "${enable_smb+set}" = set; then : - enableval=$enable_smb; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_SMB 1" >>confdefs.h - - CURL_DISABLE_SMB=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support smtp" >&5 -$as_echo_n "checking whether to support smtp... " >&6; } -# Check whether --enable-smtp was given. -if test "${enable_smtp+set}" = set; then : - enableval=$enable_smtp; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_SMTP 1" >>confdefs.h - - CURL_DISABLE_SMTP=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support gopher" >&5 -$as_echo_n "checking whether to support gopher... " >&6; } -# Check whether --enable-gopher was given. -if test "${enable_gopher+set}" = set; then : - enableval=$enable_gopher; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_GOPHER 1" >>confdefs.h - - CURL_DISABLE_GOPHER=1 - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to provide built-in manual" >&5 -$as_echo_n "checking whether to provide built-in manual... " >&6; } -# Check whether --enable-manual was given. -if test "${enable_manual+set}" = set; then : - enableval=$enable_manual; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - USE_MANUAL="1" - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - USE_MANUAL="1" - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable generation of C code" >&5 -$as_echo_n "checking whether to enable generation of C code... " >&6; } -# Check whether --enable-libcurl_option was given. -if test "${enable_libcurl_option+set}" = set; then : - enableval=$enable_libcurl_option; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_LIBCURL_OPTION 1" >>confdefs.h - - curl_libcurl_msg="no" - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5 -$as_echo_n "checking whether to use libgcc... " >&6; } -# Check whether --enable-libgcc was given. -if test "${enable_libgcc+set}" = set; then : - enableval=$enable_libgcc; case "$enableval" in - yes) - LIBS="-lgcc $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if X/Open network library is required" >&5 -$as_echo_n "checking if X/Open network library is required... " >&6; } - tst_lib_xnet_required="no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int main (void) -{ -#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) - return 0; -#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) - return 0; -#else - force compilation error -#endif -} - - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_lib_xnet_required="yes" - LIBS="-lxnet $LIBS" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_lib_xnet_required" >&5 -$as_echo "$tst_lib_xnet_required" >&6; } - - -ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_gethostbyname=yes -else - ac_cv_lib_nsl_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - LIBS="-lnsl $LIBS" - -fi - - -fi - - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lsocket" >&5 -$as_echo_n "checking for gethostbyname in -lsocket... " >&6; } -if ${ac_cv_lib_socket_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_gethostbyname=yes -else - ac_cv_lib_socket_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_gethostbyname" >&5 -$as_echo "$ac_cv_lib_socket_gethostbyname" >&6; } -if test "x$ac_cv_lib_socket_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - LIBS="-lsocket $LIBS" - -fi - -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lwatt" >&5 -$as_echo_n "checking for gethostbyname in -lwatt... " >&6; } -if ${ac_cv_lib_watt_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lwatt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_watt_gethostbyname=yes -else - ac_cv_lib_watt_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_watt_gethostbyname" >&5 -$as_echo "$ac_cv_lib_watt_gethostbyname" >&6; } -if test "x$ac_cv_lib_watt_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - CPPFLAGS="-I/dev/env/WATT_ROOT/inc" - LDFLAGS="-L/dev/env/WATT_ROOT/lib" - LIBS="-lwatt $LIBS" - -fi - -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname with both nsl and socket libs" >&5 -$as_echo_n "checking for gethostbyname with both nsl and socket libs... " >&6; } - my_ac_save_LIBS=$LIBS - LIBS="-lnsl -lsocket $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - gethostbyname(); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_GETHOSTBYNAME="1" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS=$my_ac_save_LIBS - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - if test "$curl_cv_header_windows_h" = "yes"; then - if test "$curl_cv_header_winsock_h" = "yes"; then - case $host in - *-*-mingw32ce*) - winsock_LIB="-lwinsock" - ;; - *) - winsock_LIB="-lwsock32" - ;; - esac - fi - if test "$curl_cv_header_winsock2_h" = "yes"; then - winsock_LIB="-lws2_32" - fi - if test ! -z "$winsock_LIB"; then - my_ac_save_LIBS=$LIBS - LIBS="$winsock_LIB $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in $winsock_LIB" >&5 -$as_echo_n "checking for gethostbyname in $winsock_LIB... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#endif - -int main (void) -{ - - gethostbyname("www.dummysite.com"); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_GETHOSTBYNAME="1" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - winsock_LIB="" - LIBS=$my_ac_save_LIBS - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - fi -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for Minix 3" >&5 -$as_echo_n "checking for gethostbyname for Minix 3... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* Older Minix versions may need here instead */ -#include - -int main (void) -{ - - gethostbyname("www.dummysite.com"); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_GETHOSTBYNAME="1" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for eCos" >&5 -$as_echo_n "checking for gethostbyname for eCos... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include -#include - -int main (void) -{ - - gethostbyname("www.dummysite.com"); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_GETHOSTBYNAME="1" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnetwork" >&5 -$as_echo_n "checking for gethostbyname in -lnetwork... " >&6; } -if ${ac_cv_lib_network_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnetwork $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_network_gethostbyname=yes -else - ac_cv_lib_network_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_gethostbyname" >&5 -$as_echo "$ac_cv_lib_network_gethostbyname" >&6; } -if test "x$ac_cv_lib_network_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - LIBS="-lnetwork $LIBS" - -fi - -fi - -if test "$HAVE_GETHOSTBYNAME" != "1" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnet" >&5 -$as_echo_n "checking for gethostbyname in -lnet... " >&6; } -if ${ac_cv_lib_net_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnet $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_net_gethostbyname=yes -else - ac_cv_lib_net_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_gethostbyname" >&5 -$as_echo "$ac_cv_lib_net_gethostbyname" >&6; } -if test "x$ac_cv_lib_net_gethostbyname" = xyes; then : - HAVE_GETHOSTBYNAME="1" - LIBS="-lnet $LIBS" - -fi - -fi - - -if test "$HAVE_GETHOSTBYNAME" != "1"; then - as_fn_error $? "couldn't find libraries for gethostbyname()" "$LINENO" 5 -fi - - -curl_includes_winsock2="\ -/* includes start */ -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# else -# ifdef HAVE_WINSOCK_H -# include -# endif -# endif -#endif -/* includes end */" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 -$as_echo_n "checking for windows.h... " >&6; } -if ${curl_cv_header_windows_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_windows_h="yes" - -else - - curl_cv_header_windows_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_windows_h" >&5 -$as_echo "$curl_cv_header_windows_h" >&6; } - case "$curl_cv_header_windows_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 -$as_echo_n "checking for winsock.h... " >&6; } -if ${curl_cv_header_winsock_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINSOCK_H shall not be defined. -#else - int dummy=WSACleanup(); -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winsock_h="yes" - -else - - curl_cv_header_winsock_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winsock_h" >&5 -$as_echo "$curl_cv_header_winsock_h" >&6; } - case "$curl_cv_header_winsock_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 -$as_echo_n "checking for winsock2.h... " >&6; } -if ${curl_cv_header_winsock2_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winsock2_h="yes" - -else - - curl_cv_header_winsock2_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winsock2_h" >&5 -$as_echo "$curl_cv_header_winsock2_h" >&6; } - case "$curl_cv_header_winsock2_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF - - ;; - esac - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in libraries" >&5 -$as_echo_n "checking for connect in libraries... " >&6; } - tst_connect_save_LIBS="$LIBS" - tst_connect_need_LIBS="unknown" - for tst_lib in '' '-lsocket' ; do - if test "$tst_connect_need_LIBS" = "unknown"; then - LIBS="$tst_lib $tst_connect_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - #ifndef HAVE_WINDOWS_H - int connect(int, void*, int); - #endif - -int main (void) -{ - - if(0 != connect(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_connect_need_LIBS="$tst_lib" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - done - LIBS="$tst_connect_save_LIBS" - # - case X-"$tst_connect_need_LIBS" in - X-unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find connect" >&5 -$as_echo "cannot find connect" >&6; } - as_fn_error $? "cannot find connect function in libraries." "$LINENO" 5 - ;; - X-) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_connect_need_LIBS" >&5 -$as_echo "$tst_connect_need_LIBS" >&6; } - LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" - ;; - esac - - -CURL_NETWORK_LIBS=$LIBS - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int main (void) -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - - - for ac_header in sys/types.h sys/time.h time.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for monotonic clock_gettime" >&5 -$as_echo_n "checking for monotonic clock_gettime... " >&6; } - # - if test "x$dontwant_rt" = "xno" ; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -int main (void) -{ - - struct timespec ts; - (void)clock_gettime(CLOCK_MONOTONIC, &ts); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_func_clock_gettime="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_func_clock_gettime="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - - # - if test "$curl_func_clock_gettime" = "yes"; then - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in libraries" >&5 -$as_echo_n "checking for clock_gettime in libraries... " >&6; } - # - curl_cv_save_LIBS="$LIBS" - curl_cv_gclk_LIBS="unknown" - # - for x_xlibs in '' '-lrt' '-lposix4' ; do - if test "$curl_cv_gclk_LIBS" = "unknown"; then - if test -z "$x_xlibs"; then - LIBS="$curl_cv_save_LIBS" - else - LIBS="$x_xlibs $curl_cv_save_LIBS" - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -int main (void) -{ - - struct timespec ts; - (void)clock_gettime(CLOCK_MONOTONIC, &ts); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - curl_cv_gclk_LIBS="$x_xlibs" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - done - # - LIBS="$curl_cv_save_LIBS" - # - case X-"$curl_cv_gclk_LIBS" in - X-unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find clock_gettime" >&5 -$as_echo "cannot find clock_gettime" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 -$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} - curl_func_clock_gettime="no" - ;; - X-) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no additional lib required" >&5 -$as_echo "no additional lib required" >&6; } - curl_func_clock_gettime="yes" - ;; - *) - if test -z "$curl_cv_save_LIBS"; then - LIBS="$curl_cv_gclk_LIBS" - else - LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_gclk_LIBS" >&5 -$as_echo "$curl_cv_gclk_LIBS" >&6; } - curl_func_clock_gettime="yes" - ;; - esac - # - if test "x$cross_compiling" != "xyes" && - test "$curl_func_clock_gettime" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if monotonic clock_gettime works" >&5 -$as_echo_n "checking if monotonic clock_gettime works... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif - -int main (void) -{ - - struct timespec ts; - if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) - exit(0); - else - exit(1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 -$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} - curl_func_clock_gettime="no" - LIBS="$curl_cv_save_LIBS" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - case "$curl_func_clock_gettime" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_CLOCK_GETTIME_MONOTONIC 1 -_ACEOF - - ;; - esac - # - fi - # - - -CURL_NETWORK_AND_TIME_LIBS=$LIBS - - - -clean_CPPFLAGS=$CPPFLAGS -clean_LDFLAGS=$LDFLAGS -clean_LIBS=$LIBS -ZLIB_LIBS="" - -# Check whether --with-zlib was given. -if test "${with_zlib+set}" = set; then : - withval=$with_zlib; OPT_ZLIB="$withval" -fi - - -if test "$OPT_ZLIB" = "no" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5 -$as_echo "$as_me: WARNING: zlib disabled" >&2;} -else - if test "$OPT_ZLIB" = "yes" ; then - OPT_ZLIB="" - fi - - if test -z "$OPT_ZLIB" ; then - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib options with pkg-config" >&5 -$as_echo_n "checking for zlib options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists zlib >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS" - LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`" - CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`" - OPT_ZLIB="" - HAVE_LIBZ="1" - fi - - if test -z "$HAVE_LIBZ"; then - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5 -$as_echo_n "checking for inflateEnd in -lz... " >&6; } -if ${ac_cv_lib_z_inflateEnd+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char inflateEnd (); -int main (void) -{ -return inflateEnd (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_inflateEnd=yes -else - ac_cv_lib_z_inflateEnd=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5 -$as_echo "$ac_cv_lib_z_inflateEnd" >&6; } -if test "x$ac_cv_lib_z_inflateEnd" = xyes; then : - HAVE_LIBZ="1" - LIBS="-lz $LIBS" -else - OPT_ZLIB="/usr/local" -fi - - fi - fi - - if test -n "$OPT_ZLIB"; then - CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include" - LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff" - fi - - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - - HAVE_ZLIB_H="1" - if test "$HAVE_LIBZ" != "1"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gzread (); -int main (void) -{ -return gzread (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_gzread=yes -else - ac_cv_lib_z_gzread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : - - HAVE_LIBZ="1" - LIBS="-lz $LIBS" - -else - CPPFLAGS=$clean_CPPFLAGS - LDFLAGS=$clean_LDFLAGS -fi - - fi - -else - - CPPFLAGS=$clean_CPPFLAGS - LDFLAGS=$clean_LDFLAGS - -fi - - - - if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1" - then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: configure found only the libz lib, not the header file!" >&5 -$as_echo "$as_me: WARNING: configure found only the libz lib, not the header file!" >&2;} - HAVE_LIBZ="" - CPPFLAGS=$clean_CPPFLAGS - LDFLAGS=$clean_LDFLAGS - LIBS=$clean_LIBS - elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1" - then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: configure found only the libz header file, not the lib!" >&5 -$as_echo "$as_me: WARNING: configure found only the libz header file, not the lib!" >&2;} - CPPFLAGS=$clean_CPPFLAGS - LDFLAGS=$clean_LDFLAGS - LIBS=$clean_LIBS - elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1" - then - - -$as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h - - -$as_echo "#define HAVE_LIBZ 1" >>confdefs.h - - - ZLIB_LIBS="-lz" - LIBS="-lz $clean_LIBS" - - AMFIXLIB="1" - { $as_echo "$as_me:${as_lineno-$LINENO}: found both libz and libz.h header" >&5 -$as_echo "$as_me: found both libz and libz.h header" >&6;} - curl_zlib_msg="enabled" - fi -fi - - if test x"$AMFIXLIB" = x1; then - HAVE_LIBZ_TRUE= - HAVE_LIBZ_FALSE='#' -else - HAVE_LIBZ_TRUE='#' - HAVE_LIBZ_FALSE= -fi - - - - -LDAPLIBNAME="" - -# Check whether --with-ldap-lib was given. -if test "${with_ldap_lib+set}" = set; then : - withval=$with_ldap_lib; LDAPLIBNAME="$withval" -fi - - -LBERLIBNAME="" - -# Check whether --with-lber-lib was given. -if test "${with_lber_lib+set}" = set; then : - withval=$with_lber_lib; LBERLIBNAME="$withval" -fi - - -if test x$CURL_DISABLE_LDAP != x1 ; then - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lber.h" >&5 -$as_echo_n "checking for lber.h... " >&6; } -if ${curl_cv_header_lber_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef NULL -#define NULL (void *)0 -#endif -#include - -int main (void) -{ - - BerValue *bvp = NULL; - BerElement *bep = ber_init(bvp); - ber_free(bep, 1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_lber_h="yes" - -else - - curl_cv_header_lber_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_lber_h" >&5 -$as_echo "$curl_cv_header_lber_h" >&6; } - if test "$curl_cv_header_lber_h" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_LBER_H 1 -_ACEOF - - # - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef NULL -#define NULL (void *)0 -#endif -#ifndef LDAP_DEPRECATED -#define LDAP_DEPRECATED 1 -#endif -#include - -int main (void) -{ - - BerValue *bvp = NULL; - BerElement *bep = ber_init(bvp); - ber_free(bep, 1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_need_header_lber_h="no" - -else - - curl_cv_need_header_lber_h="yes" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - case "$curl_cv_need_header_lber_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define NEED_LBER_H 1 -_ACEOF - - ;; - esac - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap.h" >&5 -$as_echo_n "checking for ldap.h... " >&6; } -if ${curl_cv_header_ldap_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef LDAP_DEPRECATED -#define LDAP_DEPRECATED 1 -#endif -#ifdef NEED_LBER_H -#include -#endif -#include - -int main (void) -{ - - LDAP *ldp = ldap_init("dummy", LDAP_PORT); - int res = ldap_unbind(ldp); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_ldap_h="yes" - -else - - curl_cv_header_ldap_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_ldap_h" >&5 -$as_echo "$curl_cv_header_ldap_h" >&6; } - case "$curl_cv_header_ldap_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_LDAP_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldapssl.h" >&5 -$as_echo_n "checking for ldapssl.h... " >&6; } -if ${curl_cv_header_ldapssl_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef NULL -#define NULL (void *)0 -#endif -#ifndef LDAP_DEPRECATED -#define LDAP_DEPRECATED 1 -#endif -#ifdef NEED_LBER_H -#include -#endif -#ifdef HAVE_LDAP_H -#include -#endif -#include - -int main (void) -{ - - char *cert_label = NULL; - LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_ldapssl_h="yes" - -else - - curl_cv_header_ldapssl_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_ldapssl_h" >&5 -$as_echo "$curl_cv_header_ldapssl_h" >&6; } - case "$curl_cv_header_ldapssl_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_LDAPSSL_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_ssl.h" >&5 -$as_echo_n "checking for ldap_ssl.h... " >&6; } -if ${curl_cv_header_ldap_ssl_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef LDAP_DEPRECATED -#define LDAP_DEPRECATED 1 -#endif -#ifdef NEED_LBER_H -#include -#endif -#ifdef HAVE_LDAP_H -#include -#endif -#include - -int main (void) -{ - - LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_ldap_ssl_h="yes" - -else - - curl_cv_header_ldap_ssl_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_ldap_ssl_h" >&5 -$as_echo "$curl_cv_header_ldap_ssl_h" >&6; } - case "$curl_cv_header_ldap_ssl_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_LDAP_SSL_H 1 -_ACEOF - - ;; - esac - - - if test -z "$LDAPLIBNAME" ; then - if test "$curl_cv_native_windows" = "yes"; then - LDAPLIBNAME="wldap32" - LBERLIBNAME="no" - fi - fi - - if test "$LDAPLIBNAME" ; then - as_ac_Lib=`$as_echo "ac_cv_lib_"$LDAPLIBNAME"''_ldap_init" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_init in -l\"$LDAPLIBNAME\"" >&5 -$as_echo_n "checking for ldap_init in -l\"$LDAPLIBNAME\"... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l"$LDAPLIBNAME" $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char ldap_init (); -int main (void) -{ -return ldap_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_LIB"$LDAPLIBNAME"" | $as_tr_cpp` 1 -_ACEOF - - LIBS="-l"$LDAPLIBNAME" $LIBS" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$LDAPLIBNAME\" is not an LDAP library: LDAP disabled" >&5 -$as_echo "$as_me: WARNING: \"$LDAPLIBNAME\" is not an LDAP library: LDAP disabled" >&2;} - -$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h - - CURL_DISABLE_LDAP=1 - - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - -fi - - else - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LDAP libraries" >&5 -$as_echo_n "checking for LDAP libraries... " >&6; } - # - u_libs="" - # - - # - curl_cv_save_LIBS="$LIBS" - curl_cv_ldap_LIBS="unknown" - # - for x_nlibs in '' "$u_libs" \ - '-lldap' \ - '-lldap -llber' \ - '-llber -lldap' \ - '-lldapssl -lldapx -lldapsdk' \ - '-lldapsdk -lldapx -lldapssl' ; do - if test "$curl_cv_ldap_LIBS" = "unknown"; then - if test -z "$x_nlibs"; then - LIBS="$curl_cv_save_LIBS" - else - LIBS="$x_nlibs $curl_cv_save_LIBS" - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#endif -#ifndef NULL -#define NULL (void *)0 -#endif -#ifndef LDAP_DEPRECATED -#define LDAP_DEPRECATED 1 -#endif -#ifdef NEED_LBER_H -#include -#endif -#ifdef HAVE_LDAP_H -#include -#endif - -int main (void) -{ - - BerValue *bvp = NULL; - BerElement *bep = ber_init(bvp); - LDAP *ldp = ldap_init("dummy", LDAP_PORT); - int res = ldap_unbind(ldp); - ber_free(bep, 1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - curl_cv_ldap_LIBS="$x_nlibs" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - done - # - LIBS="$curl_cv_save_LIBS" - # - case X-"$curl_cv_ldap_LIBS" in - X-unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find LDAP libraries" >&5 -$as_echo "cannot find LDAP libraries" >&6; } - ;; - X-) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no additional lib required" >&5 -$as_echo "no additional lib required" >&6; } - ;; - *) - if test -z "$curl_cv_save_LIBS"; then - LIBS="$curl_cv_ldap_LIBS" - else - LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_ldap_LIBS" >&5 -$as_echo "$curl_cv_ldap_LIBS" >&6; } - ;; - esac - # - - case X-"$curl_cv_ldap_LIBS" in - X-unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find libraries for LDAP support: LDAP disabled" >&5 -$as_echo "$as_me: WARNING: Cannot find libraries for LDAP support: LDAP disabled" >&2;} - -$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h - - CURL_DISABLE_LDAP=1 - - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - - ;; - esac - fi -fi - -if test x$CURL_DISABLE_LDAP != x1 ; then - - if test "$LBERLIBNAME" ; then - if test "$LBERLIBNAME" != "no" ; then - as_ac_Lib=`$as_echo "ac_cv_lib_"$LBERLIBNAME"''_ber_free" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ber_free in -l\"$LBERLIBNAME\"" >&5 -$as_echo_n "checking for ber_free in -l\"$LBERLIBNAME\"... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l"$LBERLIBNAME" $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char ber_free (); -int main (void) -{ -return ber_free (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_LIB"$LBERLIBNAME"" | $as_tr_cpp` 1 -_ACEOF - - LIBS="-l"$LBERLIBNAME" $LIBS" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$LBERLIBNAME\" is not an LBER library: LDAP disabled" >&5 -$as_echo "$as_me: WARNING: \"$LBERLIBNAME\" is not an LBER library: LDAP disabled" >&2;} - -$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h - - CURL_DISABLE_LDAP=1 - - -$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h - - CURL_DISABLE_LDAPS=1 - -fi - - fi - fi -fi - -if test x$CURL_DISABLE_LDAP != x1 ; then - for ac_func in ldap_url_parse ldap_init_fd -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - if test "$LDAPLIBNAME" = "wldap32"; then - curl_ldap_msg="enabled (winldap)" - -$as_echo "#define USE_WIN32_LDAP 1" >>confdefs.h - - else - curl_ldap_msg="enabled (OpenLDAP)" - if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then - -$as_echo "#define USE_OPENLDAP 1" >>confdefs.h - - USE_OPENLDAP=1 - - fi - fi -fi - -if test x$CURL_DISABLE_LDAPS != x1 ; then - curl_ldaps_msg="enabled" -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable IPv6" >&5 -$as_echo_n "checking whether to enable IPv6... " >&6; } -# Check whether --enable-ipv6 was given. -if test "${enable_ipv6+set}" = set; then : - enableval=$enable_ipv6; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ipv6=no - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ipv6=yes - ;; - esac -else - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ipv6=yes - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* is AF_INET6 available? */ -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#include -#endif -#include /* for exit() */ -main() -{ - if (socket(AF_INET6, SOCK_STREAM, 0) < 0) - exit(1); - else - exit(0); -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ipv6=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ipv6=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi - - -if test "$ipv6" = "yes"; then - curl_ipv6_msg="enabled" -fi - -# Check if struct sockaddr_in6 have sin6_scope_id member -if test "$ipv6" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct sockaddr_in6 has sin6_scope_id member" >&5 -$as_echo_n "checking if struct sockaddr_in6 has sin6_scope_id member... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#ifdef HAVE_WINSOCK2_H -#include -#include -#else -#include -#endif -int main (void) -{ -struct sockaddr_in6 s; s.sin6_scope_id = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - have_sin6_scope_id=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$have_sin6_scope_id" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if argv can be written to" >&5 -$as_echo_n "checking if argv can be written to... " >&6; } -if test "$cross_compiling" = yes; then : - - curl_cv_writable_argv=cross - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int main(int argc, char ** argv) { - argv[0][0] = ' '; - return (argv[0][0] == ' ')?0:1; -} - - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - curl_cv_writable_argv=yes - -else - - curl_cv_writable_argv=no - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -case $curl_cv_writable_argv in -yes) - -$as_echo "#define HAVE_WRITABLE_ARGV 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; -no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; -*) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the previous check could not be made default was used" >&5 -$as_echo "$as_me: WARNING: the previous check could not be made default was used" >&2;} - ;; -esac - - - -GSSAPI_ROOT="/usr" - -# Check whether --with-gssapi-includes was given. -if test "${with_gssapi_includes+set}" = set; then : - withval=$with_gssapi_includes; GSSAPI_INCS="-I$withval" - want_gss="yes" - -fi - - - -# Check whether --with-gssapi-libs was given. -if test "${with_gssapi_libs+set}" = set; then : - withval=$with_gssapi_libs; GSSAPI_LIB_DIR="-L$withval" - want_gss="yes" - -fi - - - -# Check whether --with-gssapi was given. -if test "${with_gssapi+set}" = set; then : - withval=$with_gssapi; - GSSAPI_ROOT="$withval" - if test x"$GSSAPI_ROOT" != xno; then - want_gss="yes" - if test x"$GSSAPI_ROOT" = xyes; then - GSSAPI_ROOT="/usr" - fi - fi - -fi - - -: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"} - -save_CPPFLAGS="$CPPFLAGS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GSS-API support is requested" >&5 -$as_echo_n "checking if GSS-API support is requested... " >&6; } -if test x"$want_gss" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - if test -z "$GSSAPI_INCS"; then - if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then - GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi` - elif test -f "$KRB5CONFIG"; then - GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi` - elif test "$GSSAPI_ROOT" != "yes"; then - GSSAPI_INCS="-I$GSSAPI_ROOT/include" - fi - fi - - CPPFLAGS="$CPPFLAGS $GSSAPI_INCS" - - ac_fn_c_check_header_mongrel "$LINENO" "gss.h" "ac_cv_header_gss_h" "$ac_includes_default" -if test "x$ac_cv_header_gss_h" = xyes; then : - - -$as_echo "#define HAVE_GSSGNU 1" >>confdefs.h - - gnu_gss=yes - -else - - for ac_header in gssapi/gssapi.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi.h" "ac_cv_header_gssapi_gssapi_h" "$ac_includes_default" -if test "x$ac_cv_header_gssapi_gssapi_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GSSAPI_GSSAPI_H 1 -_ACEOF - -else - not_mit=1 -fi - -done - - for ac_header in gssapi/gssapi_generic.h gssapi/gssapi_krb5.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " -$ac_includes_default -#ifdef HAVE_GSSAPI_GSSAPI_H -#include -#endif - -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -else - not_mit=1 -fi - -done - - if test "x$not_mit" = "x1"; then - ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" -if test "x$ac_cv_header_gssapi_h" = xyes; then : - - -$as_echo "#define HAVE_GSSHEIMDAL 1" >>confdefs.h - - -else - - want_gss=no - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling GSS-API support since no header files were found" >&5 -$as_echo "$as_me: WARNING: disabling GSS-API support since no header files were found" >&2;} - - -fi - - - else - -$as_echo "#define HAVE_GSSMIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE" >&5 -$as_echo_n "checking if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include -#include -#include - -int main (void) -{ - - gss_import_name( - (OM_uint32 *)0, - (gss_buffer_t)0, - GSS_C_NT_HOSTBASED_SERVICE, - (gss_name_t *)0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define HAVE_OLD_GSSMIT 1" >>confdefs.h - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - -fi - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -if test x"$want_gss" = xyes; then - -$as_echo "#define HAVE_GSSAPI 1" >>confdefs.h - - HAVE_GSSAPI=1 - curl_gss_msg="enabled (MIT Kerberos/Heimdal)" - - if test -n "$gnu_gss"; then - curl_gss_msg="enabled (GNU GSS)" - LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" - LIBS="-lgss $LIBS" - elif test -z "$GSSAPI_LIB_DIR"; then - case $host in - *-*-darwin*) - LIBS="-lgssapi_krb5 -lresolv $LIBS" - ;; - *) - if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then - gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi` - LIBS="$gss_libs $LIBS" - elif test -f "$KRB5CONFIG"; then - gss_libs=`$KRB5CONFIG --libs gssapi` - LIBS="$gss_libs $LIBS" - else - case $host in - *-hp-hpux*) - gss_libname="gss" - ;; - *) - gss_libname="gssapi" - ;; - esac - - if test "$GSSAPI_ROOT" != "yes"; then - LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" - LIBS="-l$gss_libname $LIBS" - else - LIBS="-l$gss_libname $LIBS" - fi - fi - ;; - esac - else - LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" - case $host in - *-hp-hpux*) - LIBS="-lgss $LIBS" - ;; - *) - LIBS="-lgssapi $LIBS" - ;; - esac - fi -else - CPPFLAGS="$save_CPPFLAGS" -fi - -build_libstubgss=no -if test x"$want_gss" = "xyes"; then - build_libstubgss=yes -fi - - if test "x$build_libstubgss" = "xyes"; then - BUILD_STUB_GSS_TRUE= - BUILD_STUB_GSS_FALSE='#' -else - BUILD_STUB_GSS_TRUE='#' - BUILD_STUB_GSS_FALSE= -fi - - - -DEFAULT_SSL_BACKEND=no -VALID_DEFAULT_SSL_BACKEND= - -# Check whether --with-default-ssl-backend was given. -if test "${with_default_ssl_backend+set}" = set; then : - withval=$with_default_ssl_backend; DEFAULT_SSL_BACKEND=$withval -fi - -case "$DEFAULT_SSL_BACKEND" in - no) - ;; - default|yes) - as_fn_error $? "The name of the default SSL backend is required." "$LINENO" 5 - ;; - *) - - VALID_DEFAULT_SSL_BACKEND=no - ;; -esac - - - -OPT_WINSSL=no - -# Check whether --with-winssl was given. -if test "${with_winssl+set}" = set; then : - withval=$with_winssl; OPT_WINSSL=$withval -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Windows native SSL/TLS (Windows native builds only)" >&5 -$as_echo_n "checking whether to enable Windows native SSL/TLS (Windows native builds only)... " >&6; } -if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then - ssl_msg= - if test "x$OPT_WINSSL" != "xno" && - test "x$curl_cv_native_windows" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define USE_SCHANNEL 1" >>confdefs.h - - USE_SCHANNEL=1 - - ssl_msg="Windows-native" - test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - WINSSL_ENABLED=1 - # --with-winssl implies --enable-sspi - -$as_echo "#define USE_WINDOWS_SSPI 1" >>confdefs.h - - USE_WINDOWS_SSPI=1 - - curl_sspi_msg="enabled" - LIBS="-lcrypt32 $LIBS" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -OPT_DARWINSSL=no - -# Check whether --with-darwinssl was given. -if test "${with_darwinssl+set}" = set; then : - withval=$with_darwinssl; OPT_DARWINSSL=$withval -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Apple OS native SSL/TLS" >&5 -$as_echo_n "checking whether to enable Apple OS native SSL/TLS... " >&6; } -if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then - if test "x$OPT_DARWINSSL" != "xno" && - test -d "/System/Library/Frameworks/Security.framework"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define USE_DARWINSSL 1" >>confdefs.h - - USE_DARWINSSL=1 - - ssl_msg="Apple OS-native" - test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - DARWINSSL_ENABLED=1 - LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -OPT_SSL=off -ca="no" - -# Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then : - withval=$with_ssl; OPT_SSL=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_SSL" != xno && - test X"$OPT_SSL" != Xno; then - ssl_msg= - - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - case $host in - *-*-msys* | *-*-mingw*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdi32" >&5 -$as_echo_n "checking for gdi32... " >&6; } - my_ac_save_LIBS=$LIBS - LIBS="-lgdi32 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int main (void) -{ -GdiFlush(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - LIBS=$my_ac_save_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ;; - esac - - case "$OPT_SSL" in - yes) - if test x$cross_compiling != xyes; then - PKGTEST="yes" - fi - PREFIX_OPENSSL=/usr/local/ssl - LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" - ;; - off) - if test x$cross_compiling != xyes; then - PKGTEST="yes" - fi - PREFIX_OPENSSL= - ;; - *) - PKGTEST="no" - PREFIX_OPENSSL=$OPT_SSL - - OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig" - { $as_echo "$as_me:${as_lineno-$LINENO}: PKG_CONFIG_LIBDIR will be set to \"$OPENSSL_PCDIR\"" >&5 -$as_echo "$as_me: PKG_CONFIG_LIBDIR will be set to \"$OPENSSL_PCDIR\"" >&6;} - if test -f "$OPENSSL_PCDIR/openssl.pc"; then - PKGTEST="yes" - fi - - LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" - if test "$PREFIX_OPENSSL" != "/usr" ; then - SSL_LDFLAGS="-L$LIB_OPENSSL" - SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include" - fi - SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl" - ;; - esac - - if test "$PKGTEST" = "yes"; then - - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl options with pkg-config" >&5 -$as_echo_n "checking for openssl options with pkg-config... " >&6; } - itexists=` - if test -n "$OPENSSL_PCDIR"; then - PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists openssl >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - SSL_LIBS=` - if test -n "$OPENSSL_PCDIR"; then - PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-l openssl 2>/dev/null` - - SSL_LDFLAGS=` - if test -n "$OPENSSL_PCDIR"; then - PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-L openssl 2>/dev/null` - - SSL_CPPFLAGS=` - if test -n "$OPENSSL_PCDIR"; then - PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --cflags-only-I openssl 2>/dev/null` - - - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_LIBS: \"$SSL_LIBS\"" >&5 -$as_echo "$as_me: pkg-config: SSL_LIBS: \"$SSL_LIBS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_LDFLAGS: \"$SSL_LDFLAGS\"" >&5 -$as_echo "$as_me: pkg-config: SSL_LDFLAGS: \"$SSL_LDFLAGS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_CPPFLAGS: \"$SSL_CPPFLAGS\"" >&5 -$as_echo "$as_me: pkg-config: SSL_CPPFLAGS: \"$SSL_CPPFLAGS\"" >&6;} - - LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` - - LIBS="$SSL_LIBS $LIBS" - fi - fi - - CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" - LDFLAGS="$LDFLAGS $SSL_LDFLAGS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Update in -lcrypto" >&5 -$as_echo_n "checking for HMAC_Update in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_HMAC_Update+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char HMAC_Update (); -int main (void) -{ -return HMAC_Update (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_HMAC_Update=yes -else - ac_cv_lib_crypto_HMAC_Update=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_HMAC_Update" >&5 -$as_echo "$ac_cv_lib_crypto_HMAC_Update" >&6; } -if test "x$ac_cv_lib_crypto_HMAC_Update" = xyes; then : - - HAVECRYPTO="yes" - LIBS="-lcrypto $LIBS" - -else - - LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL" - CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Init_ex in -lcrypto" >&5 -$as_echo_n "checking for HMAC_Init_ex in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_HMAC_Init_ex+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char HMAC_Init_ex (); -int main (void) -{ -return HMAC_Init_ex (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_HMAC_Init_ex=yes -else - ac_cv_lib_crypto_HMAC_Init_ex=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_HMAC_Init_ex" >&5 -$as_echo "$ac_cv_lib_crypto_HMAC_Init_ex" >&6; } -if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes; then : - - HAVECRYPTO="yes" - LIBS="-lcrypto $LIBS" -else - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl" >&5 -$as_echo_n "checking OpenSSL linking with -ldl... " >&6; } - LIBS="-ldl $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int main (void) -{ - - ERR_clear_error(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVECRYPTO="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl and -lpthread" >&5 -$as_echo_n "checking OpenSSL linking with -ldl and -lpthread... " >&6; } - LIBS="-lpthread $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int main (void) -{ - - ERR_clear_error(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVECRYPTO="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LDFLAGS="$CLEANLDFLAGS" - CPPFLAGS="$CLEANCPPFLAGS" - LIBS="$CLEANLIBS" - - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -fi - - -fi - - - if test X"$HAVECRYPTO" = X"yes"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_connect in -lssl" >&5 -$as_echo_n "checking for SSL_connect in -lssl... " >&6; } -if ${ac_cv_lib_ssl_SSL_connect+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lssl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char SSL_connect (); -int main (void) -{ -return SSL_connect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssl_SSL_connect=yes -else - ac_cv_lib_ssl_SSL_connect=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_connect" >&5 -$as_echo "$ac_cv_lib_ssl_SSL_connect" >&6; } -if test "x$ac_cv_lib_ssl_SSL_connect" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSSL 1 -_ACEOF - - LIBS="-lssl $LIBS" - -fi - - - if test "$ac_cv_lib_ssl_SSL_connect" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl with RSAglue/rsaref libs in use" >&5 -$as_echo_n "checking for ssl with RSAglue/rsaref libs in use... " >&6; }; - OLIBS=$LIBS - LIBS="-lRSAglue -lrsaref $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_connect in -lssl" >&5 -$as_echo_n "checking for SSL_connect in -lssl... " >&6; } -if ${ac_cv_lib_ssl_SSL_connect+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lssl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char SSL_connect (); -int main (void) -{ -return SSL_connect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssl_SSL_connect=yes -else - ac_cv_lib_ssl_SSL_connect=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_connect" >&5 -$as_echo "$ac_cv_lib_ssl_SSL_connect" >&6; } -if test "x$ac_cv_lib_ssl_SSL_connect" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSSL 1 -_ACEOF - - LIBS="-lssl $LIBS" - -fi - - if test "$ac_cv_lib_ssl_SSL_connect" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS=$OLIBS - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - fi - - else - - for ac_header in openssl/x509.h openssl/rsa.h openssl/crypto.h \ - openssl/pem.h openssl/ssl.h openssl/err.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - ssl_msg="OpenSSL" - test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - OPENSSL_ENABLED=1 - -$as_echo "#define USE_OPENSSL 1" >>confdefs.h - -fi - -done - - - if test $ac_cv_header_openssl_x509_h = no; then - for ac_header in x509.h rsa.h crypto.h pem.h ssl.h err.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - if test $ac_cv_header_x509_h = yes && - test $ac_cv_header_crypto_h = yes && - test $ac_cv_header_ssl_h = yes; then - ssl_msg="OpenSSL" - OPENSSL_ENABLED=1 - fi - fi - fi - - if test X"$OPENSSL_ENABLED" != X"1"; then - LIBS="$CLEANLIBS" - fi - - if test X"$OPT_SSL" != Xoff && - test "$OPENSSL_ENABLED" != "1"; then - as_fn_error $? "OpenSSL libs and/or directories were not found where specified!" "$LINENO" 5 - fi - fi - - if test X"$OPENSSL_ENABLED" = X"1"; then - ac_fn_c_check_func "$LINENO" "ENGINE_init" "ac_cv_func_ENGINE_init" -if test "x$ac_cv_func_ENGINE_init" = xyes; then : - - for ac_header in openssl/engine.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "openssl/engine.h" "ac_cv_header_openssl_engine_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_engine_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_ENGINE_H 1 -_ACEOF - -fi - -done - - for ac_func in ENGINE_load_builtin_engines -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -fi - - - - for ac_func in RAND_egd \ - ENGINE_cleanup \ - SSL_get_shutdown \ - SSLv2_client_method -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BoringSSL" >&5 -$as_echo_n "checking for BoringSSL... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - #include - -int main (void) -{ - - #ifndef OPENSSL_IS_BORINGSSL - #error not boringssl - #endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_BORINGSSL 1 -_ACEOF - - ssl_msg="BoringSSL" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libressl" >&5 -$as_echo_n "checking for libressl... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - int dummy = LIBRESSL_VERSION_NUMBER; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRESSL 1 -_ACEOF - - ssl_msg="libressl" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - - if test "$OPENSSL_ENABLED" = "1"; then - if test -n "$LIB_OPENSSL"; then - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $LIB_OPENSSL to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $LIB_OPENSSL to LD_LIBRARY_PATH" >&6;} - fi - fi - - # - - # - tst_api="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL headers version" >&5 -$as_echo_n "checking for OpenSSL headers version... " >&6; } - - OLDCPPFLAGS=$CPPFLAGS - # CPPPFLAG comes from CURL_CPP_P - CPPFLAGS="$CPPFLAGS $CPPPFLAG" - if test -z "$SED"; then - as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 - fi - if test -z "$GREP"; then - as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 - fi - - tmp_exp="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# ifdef USE_OPENSSL -# include -# else -# include -# endif - -#ifdef OPENSSL_VERSION_NUMBER -CURL_DEF_TOKEN OPENSSL_VERSION_NUMBER -#endif - - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - - tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ - "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ - "$SED" 's/.*CURL_DEF_TOKEN[ ][ ]*//' 2>/dev/null | \ - "$SED" 's/["][ ]*["]//g' 2>/dev/null` - if test -z "$tmp_exp" || test "$tmp_exp" = "OPENSSL_VERSION_NUMBER"; then - tmp_exp="" - fi - -fi -rm -f conftest.err conftest.i conftest.$ac_ext - if test -z "$tmp_exp"; then - curl_cv_have_def_OPENSSL_VERSION_NUMBER=no - - else - curl_cv_have_def_OPENSSL_VERSION_NUMBER=yes - curl_cv_def_OPENSSL_VERSION_NUMBER=$tmp_exp - - fi - CPPFLAGS=$OLDCPPFLAGS - - if test "$curl_cv_have_def_OPENSSL_VERSION_NUMBER" = "yes"; then - tst_verlen=`expr "$curl_cv_def_OPENSSL_VERSION_NUMBER" : '.*'` - case "x$tst_verlen" in - x6) - tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3` - tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 4` - tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5` - tst_api=0x$tst_vermaj$tst_vermin$tst_verfix - ;; - x11|x10) - tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3` - tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5` - tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 7` - tst_api=0x$tst_vermaj$tst_vermin$tst_verfix - ;; - *) - tst_api="unknown" - ;; - esac - case $tst_api in - 0x110) tst_show="1.1.0" ;; - 0x102) tst_show="1.0.2" ;; - 0x101) tst_show="1.0.1" ;; - 0x100) tst_show="1.0.0" ;; - 0x099) tst_show="0.9.9" ;; - 0x098) tst_show="0.9.8" ;; - 0x097) tst_show="0.9.7" ;; - 0x096) tst_show="0.9.6" ;; - 0x095) tst_show="0.9.5" ;; - 0x094) tst_show="0.9.4" ;; - 0x093) tst_show="0.9.3" ;; - 0x092) tst_show="0.9.2" ;; - 0x091) tst_show="0.9.1" ;; - *) tst_show="unknown" ;; - esac - tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER" - else - tst_show="unknown" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_show" >&5 -$as_echo "$tst_show" >&6; } - # - curl_openssl_api_headers=$tst_api - - - # - tst_api="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL library version" >&5 -$as_echo_n "checking for OpenSSL library version... " >&6; } - if test "$tst_api" = "unknown"; then - case $host in - *-*-vms*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_CTX_set_not_resumbl_sess_cb innocuous_SSL_CTX_set_not_resumbl_sess_cb -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_CTX_set_not_resumbl_sess_cb -#ifdef __cplusplus -extern "C" -#endif -char SSL_CTX_set_not_resumbl_sess_cb (); -#if defined __stub_SSL_CTX_set_not_resumbl_sess_cb || defined __stub___SSL_CTX_set_not_resumbl_sess_cb -choke me -#endif - -int main (void) -{ -return SSL_CTX_set_not_resumbl_sess_cb (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x110" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ;; - *) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_CTX_set_not_resumable_session_callback innocuous_SSL_CTX_set_not_resumable_session_callback -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_CTX_set_not_resumable_session_callback -#ifdef __cplusplus -extern "C" -#endif -char SSL_CTX_set_not_resumable_session_callback (); -#if defined __stub_SSL_CTX_set_not_resumable_session_callback || defined __stub___SSL_CTX_set_not_resumable_session_callback -choke me -#endif - -int main (void) -{ -return SSL_CTX_set_not_resumable_session_callback (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x110" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ;; - esac - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_CONF_CTX_new innocuous_SSL_CONF_CTX_new -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_CONF_CTX_new -#ifdef __cplusplus -extern "C" -#endif -char SSL_CONF_CTX_new (); -#if defined __stub_SSL_CONF_CTX_new || defined __stub___SSL_CONF_CTX_new -choke me -#endif - -int main (void) -{ -return SSL_CONF_CTX_new (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x102" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_renegotiate_abbreviated innocuous_SSL_renegotiate_abbreviated -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_renegotiate_abbreviated -#ifdef __cplusplus -extern "C" -#endif -char SSL_renegotiate_abbreviated (); -#if defined __stub_SSL_renegotiate_abbreviated || defined __stub___SSL_renegotiate_abbreviated -choke me -#endif - -int main (void) -{ -return SSL_renegotiate_abbreviated (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x101" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define OBJ_add_sigid innocuous_OBJ_add_sigid -#ifdef __STDC__ -# include -#else -# include -#endif -#undef OBJ_add_sigid -#ifdef __cplusplus -extern "C" -#endif -char OBJ_add_sigid (); -#if defined __stub_OBJ_add_sigid || defined __stub___OBJ_add_sigid -choke me -#endif - -int main (void) -{ -return OBJ_add_sigid (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x100" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define ERR_set_mark innocuous_ERR_set_mark -#ifdef __STDC__ -# include -#else -# include -#endif -#undef ERR_set_mark -#ifdef __cplusplus -extern "C" -#endif -char ERR_set_mark (); -#if defined __stub_ERR_set_mark || defined __stub___ERR_set_mark -choke me -#endif - -int main (void) -{ -return ERR_set_mark (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x098" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define ERR_peek_last_error innocuous_ERR_peek_last_error -#ifdef __STDC__ -# include -#else -# include -#endif -#undef ERR_peek_last_error -#ifdef __cplusplus -extern "C" -#endif -char ERR_peek_last_error (); -#if defined __stub_ERR_peek_last_error || defined __stub___ERR_peek_last_error -choke me -#endif - -int main (void) -{ -return ERR_peek_last_error (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x097" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define c2i_ASN1_OBJECT innocuous_c2i_ASN1_OBJECT -#ifdef __STDC__ -# include -#else -# include -#endif -#undef c2i_ASN1_OBJECT -#ifdef __cplusplus -extern "C" -#endif -char c2i_ASN1_OBJECT (); -#if defined __stub_c2i_ASN1_OBJECT || defined __stub___c2i_ASN1_OBJECT -choke me -#endif - -int main (void) -{ -return c2i_ASN1_OBJECT (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x096" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_CTX_set_purpose innocuous_SSL_CTX_set_purpose -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_CTX_set_purpose -#ifdef __cplusplus -extern "C" -#endif -char SSL_CTX_set_purpose (); -#if defined __stub_SSL_CTX_set_purpose || defined __stub___SSL_CTX_set_purpose -choke me -#endif - -int main (void) -{ -return SSL_CTX_set_purpose (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x095" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define OBJ_obj2txt innocuous_OBJ_obj2txt -#ifdef __STDC__ -# include -#else -# include -#endif -#undef OBJ_obj2txt -#ifdef __cplusplus -extern "C" -#endif -char OBJ_obj2txt (); -#if defined __stub_OBJ_obj2txt || defined __stub___OBJ_obj2txt -choke me -#endif - -int main (void) -{ -return OBJ_obj2txt (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x094" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_get_verify_depth innocuous_SSL_get_verify_depth -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_get_verify_depth -#ifdef __cplusplus -extern "C" -#endif -char SSL_get_verify_depth (); -#if defined __stub_SSL_get_verify_depth || defined __stub___SSL_get_verify_depth -choke me -#endif - -int main (void) -{ -return SSL_get_verify_depth (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x093" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_library_init innocuous_SSL_library_init -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_library_init -#ifdef __cplusplus -extern "C" -#endif -char SSL_library_init (); -#if defined __stub_SSL_library_init || defined __stub___SSL_library_init -choke me -#endif - -int main (void) -{ -return SSL_library_init (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x092" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$tst_api" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define SSL_CTX_set_cipher_list innocuous_SSL_CTX_set_cipher_list -#ifdef __STDC__ -# include -#else -# include -#endif -#undef SSL_CTX_set_cipher_list -#ifdef __cplusplus -extern "C" -#endif -char SSL_CTX_set_cipher_list (); -#if defined __stub_SSL_CTX_set_cipher_list || defined __stub___SSL_CTX_set_cipher_list -choke me -#endif - -int main (void) -{ -return SSL_CTX_set_cipher_list (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - tst_api="0x091" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - case $tst_api in - 0x110) tst_show="1.1.0" ;; - 0x102) tst_show="1.0.2" ;; - 0x101) tst_show="1.0.1" ;; - 0x100) tst_show="1.0.0" ;; - 0x099) tst_show="0.9.9" ;; - 0x098) tst_show="0.9.8" ;; - 0x097) tst_show="0.9.7" ;; - 0x096) tst_show="0.9.6" ;; - 0x095) tst_show="0.9.5" ;; - 0x094) tst_show="0.9.4" ;; - 0x093) tst_show="0.9.3" ;; - 0x092) tst_show="0.9.2" ;; - 0x091) tst_show="0.9.1" ;; - *) tst_show="unknown" ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_show" >&5 -$as_echo "$tst_show" >&6; } - # - curl_openssl_api_library=$tst_api - - # - tst_match="yes" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL headers and library versions matching" >&5 -$as_echo_n "checking for OpenSSL headers and library versions matching... " >&6; } - if test "$curl_openssl_api_headers" = "unknown" || - test "$curl_openssl_api_library" = "unknown"; then - tst_match="fail" - tst_warns="Can not compare OpenSSL headers and library versions." - elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then - tst_match="no" - tst_warns="OpenSSL headers and library versions do not match." - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_match" >&5 -$as_echo "$tst_match" >&6; } - if test "$tst_match" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $tst_warns" >&5 -$as_echo "$as_me: WARNING: $tst_warns" >&2;} - fi - - fi - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - - -if test X"$OPENSSL_ENABLED" = X"1"; then - -# Check whether --with-egd-socket was given. -if test "${with_egd_socket+set}" = set; then : - withval=$with_egd_socket; EGD_SOCKET="$withval" - -fi - - if test -n "$EGD_SOCKET" ; then - -cat >>confdefs.h <<_ACEOF -#define EGD_SOCKET "$EGD_SOCKET" -_ACEOF - - fi - - -# Check whether --with-random was given. -if test "${with_random+set}" = set; then : - withval=$with_random; RANDOM_FILE="$withval" -else - - if test x$cross_compiling != xyes; then - as_ac_File=`$as_echo "ac_cv_file_"/dev/urandom"" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/urandom\"" >&5 -$as_echo_n "checking for \"/dev/urandom\"... " >&6; } -if eval \${$as_ac_File+:} false; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r ""/dev/urandom""; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_File"\" = x"yes"; then : - RANDOM_FILE="/dev/urandom" -fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: skipped the /dev/urandom detection when cross-compiling" >&5 -$as_echo "$as_me: WARNING: skipped the /dev/urandom detection when cross-compiling" >&2;} - fi - - -fi - - if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then - - -cat >>confdefs.h <<_ACEOF -#define RANDOM_FILE "$RANDOM_FILE" -_ACEOF - - fi -fi - -if test "$OPENSSL_ENABLED" = "1"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SRP_Calc_client_key in -lcrypto" >&5 -$as_echo_n "checking for SRP_Calc_client_key in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_SRP_Calc_client_key+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char SRP_Calc_client_key (); -int main (void) -{ -return SRP_Calc_client_key (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_SRP_Calc_client_key=yes -else - ac_cv_lib_crypto_SRP_Calc_client_key=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_SRP_Calc_client_key" >&5 -$as_echo "$ac_cv_lib_crypto_SRP_Calc_client_key" >&6; } -if test "x$ac_cv_lib_crypto_SRP_Calc_client_key" = xyes; then : - - -$as_echo "#define HAVE_OPENSSL_SRP 1" >>confdefs.h - - HAVE_OPENSSL_SRP=1 - - -fi - -fi - - -OPT_GNUTLS=no - - -# Check whether --with-gnutls was given. -if test "${with_gnutls+set}" = set; then : - withval=$with_gnutls; OPT_GNUTLS=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then - ssl_msg= - - if test X"$OPT_GNUTLS" != Xno; then - - addld="" - addlib="" - gtlslib="" - version="" - addcflags="" - - if test "x$OPT_GNUTLS" = "xyes"; then - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls options with pkg-config" >&5 -$as_echo_n "checking for gnutls options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists gnutls >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - addlib=`$PKGCONFIG --libs-only-l gnutls` - addld=`$PKGCONFIG --libs-only-L gnutls` - addcflags=`$PKGCONFIG --cflags-only-I gnutls` - version=`$PKGCONFIG --modversion gnutls` - gtlslib=`echo $addld | $SED -e 's/-L//'` - else - check=`libgnutls-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`libgnutls-config --libs` - addcflags=`libgnutls-config --cflags` - version=`libgnutls-config --version` - gtlslib=`libgnutls-config --prefix`/lib$libsuff - fi - fi - else - cfg=$OPT_GNUTLS/bin/libgnutls-config - check=`$cfg --version 2>/dev/null` - if test -n "$check"; then - addlib=`$cfg --libs` - addcflags=`$cfg --cflags` - version=`$cfg --version` - gtlslib=`$cfg --prefix`/lib$libsuff - else - addlib=-lgnutls - addld=-L$OPT_GNUTLS/lib$libsuff - addcflags=-I$OPT_GNUTLS/include - version="" # we just don't know - gtlslib=$OPT_GNUTLS/lib$libsuff - fi - fi - - if test -z "$version"; then - version="unknown" - fi - - if test -n "$addlib"; then - - CLEANLIBS="$LIBS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLDFLAGS="$LDFLAGS" - - LIBS="$addlib $LIBS" - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_check_version in -lgnutls" >&5 -$as_echo_n "checking for gnutls_check_version in -lgnutls... " >&6; } -if ${ac_cv_lib_gnutls_gnutls_check_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgnutls $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gnutls_check_version (); -int main (void) -{ -return gnutls_check_version (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gnutls_gnutls_check_version=yes -else - ac_cv_lib_gnutls_gnutls_check_version=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_check_version" >&5 -$as_echo "$ac_cv_lib_gnutls_gnutls_check_version" >&6; } -if test "x$ac_cv_lib_gnutls_gnutls_check_version" = xyes; then : - - -$as_echo "#define USE_GNUTLS 1" >>confdefs.h - - USE_GNUTLS=1 - - GNUTLS_ENABLED=1 - USE_GNUTLS="yes" - ssl_msg="GnuTLS" - test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - LIBS="$CLEANLIBS" - CPPFLAGS="$CLEANCPPFLAGS" - -fi - - - if test "x$USE_GNUTLS" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: detected GnuTLS version $version" >&5 -$as_echo "$as_me: detected GnuTLS version $version" >&6;} - - if test -n "$gtlslib"; then - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $gtlslib to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $gtlslib to LD_LIBRARY_PATH" >&6;} - fi - fi - for ac_func in gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - fi - - fi - - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - - -if test "$GNUTLS_ENABLED" = "1"; then - USE_GNUTLS_NETTLE= - # First check if we can detect either crypto library via transitive linking - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nettle_MD5Init in -lgnutls" >&5 -$as_echo_n "checking for nettle_MD5Init in -lgnutls... " >&6; } -if ${ac_cv_lib_gnutls_nettle_MD5Init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgnutls $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char nettle_MD5Init (); -int main (void) -{ -return nettle_MD5Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gnutls_nettle_MD5Init=yes -else - ac_cv_lib_gnutls_nettle_MD5Init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_nettle_MD5Init" >&5 -$as_echo "$ac_cv_lib_gnutls_nettle_MD5Init" >&6; } -if test "x$ac_cv_lib_gnutls_nettle_MD5Init" = xyes; then : - USE_GNUTLS_NETTLE=1 -fi - - if test "$USE_GNUTLS_NETTLE" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_control in -lgnutls" >&5 -$as_echo_n "checking for gcry_control in -lgnutls... " >&6; } -if ${ac_cv_lib_gnutls_gcry_control+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgnutls $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gcry_control (); -int main (void) -{ -return gcry_control (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gnutls_gcry_control=yes -else - ac_cv_lib_gnutls_gcry_control=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gcry_control" >&5 -$as_echo "$ac_cv_lib_gnutls_gcry_control" >&6; } -if test "x$ac_cv_lib_gnutls_gcry_control" = xyes; then : - USE_GNUTLS_NETTLE=0 -fi - - fi - # If not, try linking directly to both of them to see if they are available - if test "$USE_GNUTLS_NETTLE" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nettle_MD5Init in -lnettle" >&5 -$as_echo_n "checking for nettle_MD5Init in -lnettle... " >&6; } -if ${ac_cv_lib_nettle_nettle_MD5Init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnettle $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char nettle_MD5Init (); -int main (void) -{ -return nettle_MD5Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nettle_nettle_MD5Init=yes -else - ac_cv_lib_nettle_nettle_MD5Init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nettle_nettle_MD5Init" >&5 -$as_echo "$ac_cv_lib_nettle_nettle_MD5Init" >&6; } -if test "x$ac_cv_lib_nettle_nettle_MD5Init" = xyes; then : - USE_GNUTLS_NETTLE=1 -fi - - fi - if test "$USE_GNUTLS_NETTLE" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_control in -lgcrypt" >&5 -$as_echo_n "checking for gcry_control in -lgcrypt... " >&6; } -if ${ac_cv_lib_gcrypt_gcry_control+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgcrypt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gcry_control (); -int main (void) -{ -return gcry_control (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gcrypt_gcry_control=yes -else - ac_cv_lib_gcrypt_gcry_control=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_control" >&5 -$as_echo "$ac_cv_lib_gcrypt_gcry_control" >&6; } -if test "x$ac_cv_lib_gcrypt_gcry_control" = xyes; then : - USE_GNUTLS_NETTLE=0 -fi - - fi - if test "$USE_GNUTLS_NETTLE" = ""; then - as_fn_error $? "GnuTLS found, but neither gcrypt nor nettle found" "$LINENO" 5 - fi - if test "$USE_GNUTLS_NETTLE" = "1"; then - -$as_echo "#define USE_GNUTLS_NETTLE 1" >>confdefs.h - - USE_GNUTLS_NETTLE=1 - - LIBS="-lnettle $LIBS" - else - LIBS="-lgcrypt $LIBS" - fi -fi - -if test "$GNUTLS_ENABLED" = "1"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_srp_verifier in -lgnutls" >&5 -$as_echo_n "checking for gnutls_srp_verifier in -lgnutls... " >&6; } -if ${ac_cv_lib_gnutls_gnutls_srp_verifier+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgnutls $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char gnutls_srp_verifier (); -int main (void) -{ -return gnutls_srp_verifier (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gnutls_gnutls_srp_verifier=yes -else - ac_cv_lib_gnutls_gnutls_srp_verifier=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_srp_verifier" >&5 -$as_echo "$ac_cv_lib_gnutls_gnutls_srp_verifier" >&6; } -if test "x$ac_cv_lib_gnutls_gnutls_srp_verifier" = xyes; then : - - -$as_echo "#define HAVE_GNUTLS_SRP 1" >>confdefs.h - - HAVE_GNUTLS_SRP=1 - - -fi - -fi - - -OPT_POLARSSL=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS - -# Check whether --with-polarssl was given. -if test "${with_polarssl+set}" = set; then : - withval=$with_polarssl; OPT_POLARSSL=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then - ssl_msg= - - if test X"$OPT_POLARSSL" != Xno; then - - if test "$OPT_POLARSSL" = "yes"; then - OPT_POLARSSL="" - fi - - if test -z "$OPT_POLARSSL" ; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for havege_init in -lpolarssl" >&5 -$as_echo_n "checking for havege_init in -lpolarssl... " >&6; } -if ${ac_cv_lib_polarssl_havege_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpolarssl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char havege_init (); -int main (void) -{ -return havege_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_polarssl_havege_init=yes -else - ac_cv_lib_polarssl_havege_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_polarssl_havege_init" >&5 -$as_echo "$ac_cv_lib_polarssl_havege_init" >&6; } -if test "x$ac_cv_lib_polarssl_havege_init" = xyes; then : - - -$as_echo "#define USE_POLARSSL 1" >>confdefs.h - - USE_POLARSSL=1 - - POLARSSL_ENABLED=1 - USE_POLARSSL="yes" - ssl_msg="PolarSSL" - test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -fi - - fi - - addld="" - addlib="" - addcflags="" - polarssllib="" - - if test "x$USE_POLARSSL" != "xyes"; then - addld=-L$OPT_POLARSSL/lib$libsuff - addcflags=-I$OPT_POLARSSL/include - polarssllib=$OPT_POLARSSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl_init in -lpolarssl" >&5 -$as_echo_n "checking for ssl_init in -lpolarssl... " >&6; } -if ${ac_cv_lib_polarssl_ssl_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpolarssl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char ssl_init (); -int main (void) -{ -return ssl_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_polarssl_ssl_init=yes -else - ac_cv_lib_polarssl_ssl_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_polarssl_ssl_init" >&5 -$as_echo "$ac_cv_lib_polarssl_ssl_init" >&6; } -if test "x$ac_cv_lib_polarssl_ssl_init" = xyes; then : - - -$as_echo "#define USE_POLARSSL 1" >>confdefs.h - - USE_POLARSSL=1 - - POLARSSL_ENABLED=1 - USE_POLARSSL="yes" - ssl_msg="PolarSSL" - test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - -fi - - fi - - if test "x$USE_POLARSSL" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: detected PolarSSL" >&5 -$as_echo "$as_me: detected PolarSSL" >&6;} - - LIBS="-lpolarssl $LIBS" - - if test -n "$polarssllib"; then - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $polarssllib to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $polarssllib to LD_LIBRARY_PATH" >&6;} - fi - fi - fi - - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - - -OPT_MBEDTLS=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS - -# Check whether --with-mbedtls was given. -if test "${with_mbedtls+set}" = set; then : - withval=$with_mbedtls; OPT_MBEDTLS=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then - ssl_msg= - - if test X"$OPT_MBEDTLS" != Xno; then - - if test "$OPT_MBEDTLS" = "yes"; then - OPT_MBEDTLS="" - fi - - if test -z "$OPT_MBEDTLS" ; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbedtls_havege_init in -lmbedtls" >&5 -$as_echo_n "checking for mbedtls_havege_init in -lmbedtls... " >&6; } -if ${ac_cv_lib_mbedtls_mbedtls_havege_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char mbedtls_havege_init (); -int main (void) -{ -return mbedtls_havege_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_mbedtls_mbedtls_havege_init=yes -else - ac_cv_lib_mbedtls_mbedtls_havege_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mbedtls_mbedtls_havege_init" >&5 -$as_echo "$ac_cv_lib_mbedtls_mbedtls_havege_init" >&6; } -if test "x$ac_cv_lib_mbedtls_mbedtls_havege_init" = xyes; then : - - -$as_echo "#define USE_MBEDTLS 1" >>confdefs.h - - USE_MBEDTLS=1 - - MBEDTLS_ENABLED=1 - USE_MBEDTLS="yes" - ssl_msg="mbedTLS" - test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -fi - - fi - - addld="" - addlib="" - addcflags="" - mbedtlslib="" - - if test "x$USE_MBEDTLS" != "xyes"; then - addld=-L$OPT_MBEDTLS/lib$libsuff - addcflags=-I$OPT_MBEDTLS/include - mbedtlslib=$OPT_MBEDTLS/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbedtls_ssl_init in -lmbedtls" >&5 -$as_echo_n "checking for mbedtls_ssl_init in -lmbedtls... " >&6; } -if ${ac_cv_lib_mbedtls_mbedtls_ssl_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char mbedtls_ssl_init (); -int main (void) -{ -return mbedtls_ssl_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_mbedtls_mbedtls_ssl_init=yes -else - ac_cv_lib_mbedtls_mbedtls_ssl_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mbedtls_mbedtls_ssl_init" >&5 -$as_echo "$ac_cv_lib_mbedtls_mbedtls_ssl_init" >&6; } -if test "x$ac_cv_lib_mbedtls_mbedtls_ssl_init" = xyes; then : - - -$as_echo "#define USE_MBEDTLS 1" >>confdefs.h - - USE_MBEDTLS=1 - - MBEDTLS_ENABLED=1 - USE_MBEDTLS="yes" - ssl_msg="mbedTLS" - test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - -fi - - fi - - if test "x$USE_MBEDTLS" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: detected mbedTLS" >&5 -$as_echo "$as_me: detected mbedTLS" >&6;} - - LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS" - - if test -n "$mbedtlslib"; then - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $mbedtlslib to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $mbedtlslib to LD_LIBRARY_PATH" >&6;} - fi - fi - fi - - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - - -OPT_CYASSL=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS - -# Check whether --with-cyassl was given. -if test "${with_cyassl+set}" = set; then : - withval=$with_cyassl; OPT_CYASSL=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then - ssl_msg= - - if test X"$OPT_CYASSL" != Xno; then - - if test "$OPT_CYASSL" = "yes"; then - OPT_CYASSL="" - fi - - - cyassllibname=cyassl - - if test -z "$OPT_CYASSL" ; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CyaSSL_Init in -lcyassl" >&5 -$as_echo_n "checking for CyaSSL_Init in -lcyassl... " >&6; } -if ${ac_cv_lib_cyassl_CyaSSL_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcyassl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char CyaSSL_Init (); -int main (void) -{ -return CyaSSL_Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_cyassl_CyaSSL_Init=yes -else - ac_cv_lib_cyassl_CyaSSL_Init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cyassl_CyaSSL_Init" >&5 -$as_echo "$ac_cv_lib_cyassl_CyaSSL_Init" >&6; } -if test "x$ac_cv_lib_cyassl_CyaSSL_Init" = xyes; then : - - -$as_echo "#define USE_CYASSL 1" >>confdefs.h - - USE_CYASSL=1 - - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="CyaSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -fi - - fi - - addld="" - addlib="" - addcflags="" - cyassllib="" - - if test "x$USE_CYASSL" != "xyes"; then - addld=-L$OPT_CYASSL/lib$libsuff - addcflags=-I$OPT_CYASSL/include - cyassllib=$OPT_CYASSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CyaSSL_Init in -lcyassl" >&5 -$as_echo_n "checking for CyaSSL_Init in -lcyassl... " >&6; } -if ${ac_cv_lib_cyassl_CyaSSL_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcyassl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char CyaSSL_Init (); -int main (void) -{ -return CyaSSL_Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_cyassl_CyaSSL_Init=yes -else - ac_cv_lib_cyassl_CyaSSL_Init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cyassl_CyaSSL_Init" >&5 -$as_echo "$ac_cv_lib_cyassl_CyaSSL_Init" >&6; } -if test "x$ac_cv_lib_cyassl_CyaSSL_Init" = xyes; then : - - -$as_echo "#define USE_CYASSL 1" >>confdefs.h - - USE_CYASSL=1 - - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="CyaSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - cyassllib="" - -fi - - fi - - addld="" - addlib="" - addcflags="" - - if test "x$USE_CYASSL" != "xyes"; then - addld=-L$OPT_CYASSL/lib$libsuff - addcflags=-I$OPT_CYASSL/include - cyassllib=$OPT_CYASSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - cyassllibname=wolfssl - my_ac_save_LIBS="$LIBS" - LIBS="-l$cyassllibname -lm $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CyaSSL_Init in -lwolfssl" >&5 -$as_echo_n "checking for CyaSSL_Init in -lwolfssl... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* These aren't needed for detection and confuse WolfSSL. - They are set up properly later if it is detected. */ -#undef SIZEOF_LONG -#undef SIZEOF_LONG_LONG -#include - -int main (void) -{ - - return CyaSSL_Init(); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define USE_CYASSL 1" >>confdefs.h - - USE_CYASSL=1 - - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="WolfSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - cyassllib="" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$my_ac_save_LIBS" - fi - - if test "x$USE_CYASSL" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: detected $cyassllibname" >&5 -$as_echo "$as_me: detected $cyassllibname" >&6;} - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 -$as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 -$as_echo "$ac_cv_sizeof_long_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF - - - - for ac_header in cyassl/options.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "cyassl/options.h" "ac_cv_header_cyassl_options_h" "$ac_includes_default" -if test "x$ac_cv_header_cyassl_options_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CYASSL_OPTIONS_H 1 -_ACEOF - -fi - -done - - - for ac_header in cyassl/error-ssl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "cyassl/error-ssl.h" "ac_cv_header_cyassl_error_ssl_h" "$ac_includes_default" -if test "x$ac_cv_header_cyassl_error_ssl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CYASSL_ERROR_SSL_H 1 -_ACEOF - -fi - -done - - - LIBS="-l$cyassllibname -lm $LIBS" - - if test "x$cyassllibname" = "xwolfssl"; then - for ac_func in wolfSSLv3_client_method \ - wolfSSL_CTX_UseSupportedCurve \ - wolfSSL_get_peer_certificate \ - wolfSSL_UseALPN -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - else - for ac_func in CyaSSL_CTX_UseSupportedCurve \ - CyaSSL_get_peer_certificate -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - fi - - if test -n "$cyassllib"; then - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $cyassllib to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $cyassllib to LD_LIBRARY_PATH" >&6;} - fi - fi - - fi - - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - - -OPT_NSS=no - - -# Check whether --with-nss was given. -if test "${with_nss+set}" = set; then : - withval=$with_nss; OPT_NSS=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then - ssl_msg= - - if test X"$OPT_NSS" != Xno; then - - addld="" - addlib="" - addcflags="" - nssprefix="" - version="" - - if test "x$OPT_NSS" = "xyes"; then - - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nss options with pkg-config" >&5 -$as_echo_n "checking for nss options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists nss >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - addlib=`$PKGCONFIG --libs nss` - addcflags=`$PKGCONFIG --cflags nss` - version=`$PKGCONFIG --modversion nss` - nssprefix=`$PKGCONFIG --variable=prefix nss` - else - - check=`nss-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`nss-config --libs` - addcflags=`nss-config --cflags` - version=`nss-config --version` - nssprefix=`nss-config --prefix` - else - addlib="-lnss3" - addcflags="" - version="unknown" - fi - fi - else - NSS_PCDIR="$OPT_NSS/lib/pkgconfig" - if test -f "$NSS_PCDIR/nss.pc"; then - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nss options with pkg-config" >&5 -$as_echo_n "checking for nss options with pkg-config... " >&6; } - itexists=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists nss >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - if test "$PKGCONFIG" != "no" ; then - addld=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-L nss` - addlib=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-l nss` - addcflags=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --cflags nss` - version=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --modversion nss` - nssprefix=` - if test -n "$NSS_PCDIR"; then - PKG_CONFIG_LIBDIR="$NSS_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --variable=prefix nss` - fi - fi - fi - - if test -z "$addlib"; then - # Without pkg-config, we'll kludge in some defaults - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5 -$as_echo "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;} - addld="-L$OPT_NSS/lib" - addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4" - addcflags="-I$OPT_NSS/include" - version="unknown" - nssprefix=$OPT_NSS - fi - - CLEANLDFLAGS="$LDFLAGS" - CLEANLIBS="$LIBS" - CLEANCPPFLAGS="$CPPFLAGS" - - LDFLAGS="$addld $LDFLAGS" - LIBS="$addlib $LIBS" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_VersionRangeSet in -lnss3" >&5 -$as_echo_n "checking for SSL_VersionRangeSet in -lnss3... " >&6; } -if ${ac_cv_lib_nss3_SSL_VersionRangeSet+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnss3 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char SSL_VersionRangeSet (); -int main (void) -{ -return SSL_VersionRangeSet (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nss3_SSL_VersionRangeSet=yes -else - ac_cv_lib_nss3_SSL_VersionRangeSet=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss3_SSL_VersionRangeSet" >&5 -$as_echo "$ac_cv_lib_nss3_SSL_VersionRangeSet" >&6; } -if test "x$ac_cv_lib_nss3_SSL_VersionRangeSet" = xyes; then : - - -$as_echo "#define USE_NSS 1" >>confdefs.h - - USE_NSS=1 - - USE_NSS="yes" - NSS_ENABLED=1 - ssl_msg="NSS" - test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - -else - - LDFLAGS="$CLEANLDFLAGS" - LIBS="$CLEANLIBS" - CPPFLAGS="$CLEANCPPFLAGS" - -fi - - - if test "x$USE_NSS" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: detected NSS version $version" >&5 -$as_echo "$as_me: detected NSS version $version" >&6;} - - NSS_LIBS=$addlib - - - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH" >&6;} - fi - - fi - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -OPT_AXTLS=off - - -# Check whether --with-axtls was given. -if test "${with_axtls+set}" = set; then : - withval=$with_axtls; OPT_AXTLS=$withval -fi - - -if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then - ssl_msg= - if test X"$OPT_AXTLS" != Xno; then - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - case "$OPT_AXTLS" in - yes) - PREFIX_AXTLS=/usr/local - LIB_AXTLS="$PREFIX_AXTLS/lib" - LDFLAGS="$LDFLAGS -L$LIB_AXTLS" - CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include" - ;; - off) - PREFIX_AXTLS= - ;; - *) - PREFIX_AXTLS=$OPT_AXTLS - LIB_AXTLS="$PREFIX_AXTLS/lib" - LDFLAGS="$LDFLAGS -L$LIB_AXTLS" - CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include" - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl_version in -laxtls" >&5 -$as_echo_n "checking for ssl_version in -laxtls... " >&6; } -if ${ac_cv_lib_axtls_ssl_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-laxtls $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char ssl_version (); -int main (void) -{ -return ssl_version (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_axtls_ssl_version=yes -else - ac_cv_lib_axtls_ssl_version=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_axtls_ssl_version" >&5 -$as_echo "$ac_cv_lib_axtls_ssl_version" >&6; } -if test "x$ac_cv_lib_axtls_ssl_version" = xyes; then : - - LIBS="-laxtls $LIBS" - -$as_echo "#define USE_AXTLS 1" >>confdefs.h - - USE_AXTLS=1 - - AXTLS_ENABLED=1 - USE_AXTLS="yes" - ssl_msg="axTLS" - test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $LIB_AXTLS to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $LIB_AXTLS to LD_LIBRARY_PATH" >&6;} - fi - -else - - LDFLAGS="$CLEANLDFLAGS" - CPPFLAGS="$CLEANCPPFLAGS" - LIBS="$CLEANLIBS" - -fi - - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in -x) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more." >&5 -$as_echo "$as_me: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more." >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this." >&5 -$as_echo "$as_me: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this." >&2;} - ;; -x1) - # one SSL backend is enabled - - SSL_ENABLED="1" - { $as_echo "$as_me:${as_lineno-$LINENO}: built with one SSL backend" >&5 -$as_echo "$as_me: built with one SSL backend" >&6;} - ;; -*) - # more than one SSL backend is enabled - - SSL_ENABLED="1" - - CURL_WITH_MULTI_SSL="1" - -$as_echo "#define CURL_WITH_MULTI_SSL 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: built with multiple SSL backends" >&5 -$as_echo "$as_me: built with multiple SSL backends" >&6;} - ;; -esac - -if test -n "$ssl_backends"; then - curl_ssl_msg="enabled ($ssl_backends)" -fi - -if test no = "$VALID_DEFAULT_SSL_BACKEND" -then - if test -n "$SSL_ENABLED" - then - as_fn_error $? "Default SSL backend $DEFAULT_SSL_BACKEND not enabled!" "$LINENO" 5 - else - as_fn_error $? "Default SSL backend requires SSL!" "$LINENO" 5 - fi -elif test yes = "$VALID_DEFAULT_SSL_BACKEND" -then - -cat >>confdefs.h <<_ACEOF -#define CURL_DEFAULT_SSL_BACKEND "$DEFAULT_SSL_BACKEND" -_ACEOF - -fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking default CA cert bundle/path" >&5 -$as_echo_n "checking default CA cert bundle/path... " >&6; } - - -# Check whether --with-ca-bundle was given. -if test "${with_ca_bundle+set}" = set; then : - withval=$with_ca_bundle; - want_ca="$withval" - if test "x$want_ca" = "xyes"; then - as_fn_error $? "--with-ca-bundle=FILE requires a path to the CA bundle" "$LINENO" 5 - fi - -else - want_ca="unset" -fi - - -# Check whether --with-ca-path was given. -if test "${with_ca_path+set}" = set; then : - withval=$with_ca_path; - want_capath="$withval" - if test "x$want_capath" = "xyes"; then - as_fn_error $? "--with-ca-path=DIRECTORY requires a path to the CA path directory" "$LINENO" 5 - fi - -else - want_capath="unset" -fi - - - ca_warning=" (warning: certs not found)" - capath_warning=" (warning: certs not found)" - check_capath="" - - if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \ - "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then - ca="$want_ca" - capath="$want_capath" - elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then - ca="$want_ca" - capath="no" - elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then - if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$POLARSSL_ENABLED" != "x1"; then - as_fn_error $? "--with-ca-path only works with OpenSSL, GnuTLS or PolarSSL" "$LINENO" 5 - fi - capath="$want_capath" - ca="no" - else - ca="no" - capath="no" - if test "x$cross_compiling" != "xyes"; then - if test "x$want_ca" = "xunset"; then - if test "x$prefix" != xNONE; then - cac="${prefix}/share/curl/curl-ca-bundle.crt" - else - cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt" - fi - - for a in /etc/ssl/certs/ca-certificates.crt \ - /etc/pki/tls/certs/ca-bundle.crt \ - /usr/share/ssl/certs/ca-bundle.crt \ - /usr/local/share/certs/ca-root-nss.crt \ - /etc/ssl/cert.pem \ - "$cac"; do - if test -f "$a"; then - ca="$a" - break - fi - done - fi - if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \ - "x$OPENSSL_ENABLED" = "x1"; then - check_capath="/etc/ssl/certs/" - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: skipped the ca-cert path detection when cross-compiling" >&5 -$as_echo "$as_me: WARNING: skipped the ca-cert path detection when cross-compiling" >&2;} - fi - fi - - if test "x$ca" = "xno" || test -f "$ca"; then - ca_warning="" - fi - - if test "x$capath" != "xno"; then - check_capath="$capath" - fi - - if test ! -z "$check_capath"; then - for a in "$check_capath"; do - if test -d "$a" && ls "$a"/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0 >/dev/null 2>/dev/null; then - if test "x$capath" = "xno"; then - capath="$a" - fi - capath_warning="" - break - fi - done - fi - - if test "x$capath" = "xno"; then - capath_warning="" - fi - - if test "x$ca" != "xno"; then - CURL_CA_BUNDLE='"'$ca'"' - -cat >>confdefs.h <<_ACEOF -#define CURL_CA_BUNDLE "$ca" -_ACEOF - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ca" >&5 -$as_echo "$ca" >&6; } - fi - if test "x$capath" != "xno"; then - CURL_CA_PATH="\"$capath\"" - -cat >>confdefs.h <<_ACEOF -#define CURL_CA_PATH "$capath" -_ACEOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $capath (capath)" >&5 -$as_echo "$capath (capath)" >&6; } - fi - if test "x$ca" = "xno" && test "x$capath" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use builtin CA store of SSL library" >&5 -$as_echo_n "checking whether to use builtin CA store of SSL library... " >&6; } - -# Check whether --with-ca-fallback was given. -if test "${with_ca_fallback+set}" = set; then : - withval=$with_ca_fallback; - if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then - as_fn_error $? "--with-ca-fallback only allows yes or no as parameter" "$LINENO" 5 - fi - -else - with_ca_fallback="no" -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_ca_fallback" >&5 -$as_echo "$with_ca_fallback" >&6; } - if test "x$with_ca_fallback" = "xyes"; then - if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then - as_fn_error $? "--with-ca-fallback only works with OpenSSL or GnuTLS" "$LINENO" 5 - fi - -cat >>confdefs.h <<_ACEOF -#define CURL_CA_FALLBACK 1 -_ACEOF - - fi - - - - -# Check whether --with-libpsl was given. -if test "${with_libpsl+set}" = set; then : - withval=$with_libpsl; with_libpsl=$withval -else - with_libpsl=yes -fi - -if test $with_libpsl != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing psl_builtin" >&5 -$as_echo_n "checking for library containing psl_builtin... " >&6; } -if ${ac_cv_search_psl_builtin+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char psl_builtin (); -int main (void) -{ -return psl_builtin (); - ; - return 0; -} -_ACEOF -for ac_lib in '' psl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_psl_builtin=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_psl_builtin+:} false; then : - break -fi -done -if ${ac_cv_search_psl_builtin+:} false; then : - -else - ac_cv_search_psl_builtin=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_psl_builtin" >&5 -$as_echo "$ac_cv_search_psl_builtin" >&6; } -ac_res=$ac_cv_search_psl_builtin -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - curl_psl_msg="yes"; - -$as_echo "#define USE_LIBPSL 1" >>confdefs.h - - -else - curl_psl_msg="no (libpsl not found)"; - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libpsl was not found" >&5 -$as_echo "$as_me: WARNING: libpsl was not found" >&2;} - - -fi - -fi - if test "$curl_psl_msg" = "yes"; then - USE_LIBPSL_TRUE= - USE_LIBPSL_FALSE='#' -else - USE_LIBPSL_TRUE='#' - USE_LIBPSL_FALSE= -fi - - - -OPT_LIBMETALINK=no - - -# Check whether --with-libmetalink was given. -if test "${with_libmetalink+set}" = set; then : - withval=$with_libmetalink; OPT_LIBMETALINK=$withval -fi - - -if test X"$OPT_LIBMETALINK" != Xno; then - - addld="" - addlib="" - addcflags="" - version="" - libmetalinklib="" - - PKGTEST="no" - if test "x$OPT_LIBMETALINK" = "xyes"; then - PKGTEST="yes" - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmetalink options with pkg-config" >&5 -$as_echo_n "checking for libmetalink options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libmetalink >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - else - LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig" - { $as_echo "$as_me:${as_lineno-$LINENO}: PKG_CONFIG_LIBDIR will be set to \"$LIBMETALINK_PCDIR\"" >&5 -$as_echo "$as_me: PKG_CONFIG_LIBDIR will be set to \"$LIBMETALINK_PCDIR\"" >&6;} - if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then - PKGTEST="yes" - fi - if test "$PKGTEST" = "yes"; then - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmetalink options with pkg-config" >&5 -$as_echo_n "checking for libmetalink options with pkg-config... " >&6; } - itexists=` - if test -n "$LIBMETALINK_PCDIR"; then - PKG_CONFIG_LIBDIR="$LIBMETALINK_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libmetalink >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - fi - fi - if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then - addlib=` - if test -n "$LIBMETALINK_PCDIR"; then - PKG_CONFIG_LIBDIR="$LIBMETALINK_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-l libmetalink` - addld=` - if test -n "$LIBMETALINK_PCDIR"; then - PKG_CONFIG_LIBDIR="$LIBMETALINK_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-L libmetalink` - addcflags=` - if test -n "$LIBMETALINK_PCDIR"; then - PKG_CONFIG_LIBDIR="$LIBMETALINK_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --cflags-only-I libmetalink` - version=` - if test -n "$LIBMETALINK_PCDIR"; then - PKG_CONFIG_LIBDIR="$LIBMETALINK_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --modversion libmetalink` - libmetalinklib=`echo $addld | $SED -e 's/-L//'` - fi - if test -n "$addlib"; then - - clean_CPPFLAGS="$CPPFLAGS" - clean_LDFLAGS="$LDFLAGS" - clean_LIBS="$LIBS" - CPPFLAGS="$clean_CPPFLAGS $addcflags" - LDFLAGS="$clean_LDFLAGS $addld" - LIBS="$addlib $clean_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libmetalink is recent enough" >&5 -$as_echo_n "checking if libmetalink is recent enough... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -# include - -int main (void) -{ - - if(0 != metalink_strerror(0)) /* added in 0.1.0 */ - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($version)" >&5 -$as_echo "yes ($version)" >&6; } - want_metalink="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no ($version)" >&5 -$as_echo "no ($version)" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: libmetalink library defective or too old" >&5 -$as_echo "$as_me: libmetalink library defective or too old" >&6;} - want_metalink="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS="$clean_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS" - LIBS="$clean_LIBS" - if test "$want_metalink" = "yes"; then - -$as_echo "#define USE_METALINK 1" >>confdefs.h - - LIBMETALINK_LIBS=$addlib - LIBMETALINK_LDFLAGS=$addld - LIBMETALINK_CPPFLAGS=$addcflags - - - - curl_mtlnk_msg="enabled" - fi - - fi -fi - - -OPT_LIBSSH2=off - -# Check whether --with-libssh2 was given. -if test "${with_libssh2+set}" = set; then : - withval=$with_libssh2; OPT_LIBSSH2=$withval -fi - - -if test X"$OPT_LIBSSH2" != Xno; then - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - case "$OPT_LIBSSH2" in - yes) - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2 options with pkg-config" >&5 -$as_echo_n "checking for libssh2 options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libssh2 >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2` - LD_SSH2=`$PKGCONFIG --libs-only-L libssh2` - CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2` - version=`$PKGCONFIG --modversion libssh2` - DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'` - fi - - ;; - off) - ;; - *) - PREFIX_SSH2=$OPT_LIBSSH2 - ;; - esac - - if test -n "$PREFIX_SSH2"; then - LIB_SSH2="-lssh2" - LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff - CPP_SSH2=-I${PREFIX_SSH2}/include - DIR_SSH2=${PREFIX_SSH2}/lib$libsuff - fi - - LDFLAGS="$LDFLAGS $LD_SSH2" - CPPFLAGS="$CPPFLAGS $CPP_SSH2" - LIBS="$LIB_SSH2 $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_channel_open_ex in -lssh2" >&5 -$as_echo_n "checking for libssh2_channel_open_ex in -lssh2... " >&6; } -if ${ac_cv_lib_ssh2_libssh2_channel_open_ex+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lssh2 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char libssh2_channel_open_ex (); -int main (void) -{ -return libssh2_channel_open_ex (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssh2_libssh2_channel_open_ex=yes -else - ac_cv_lib_ssh2_libssh2_channel_open_ex=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_channel_open_ex" >&5 -$as_echo "$ac_cv_lib_ssh2_libssh2_channel_open_ex" >&6; } -if test "x$ac_cv_lib_ssh2_libssh2_channel_open_ex" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSSH2 1 -_ACEOF - - LIBS="-lssh2 $LIBS" - -fi - - - for ac_header in libssh2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" -if test "x$ac_cv_header_libssh2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSSH2_H 1 -_ACEOF - curl_ssh_msg="enabled (libSSH2)" - LIBSSH2_ENABLED=1 - -$as_echo "#define USE_LIBSSH2 1" >>confdefs.h - - USE_LIBSSH2=1 - - -fi - -done - - - if test X"$OPT_LIBSSH2" != Xoff && - test "$LIBSSH2_ENABLED" != "1"; then - as_fn_error $? "libSSH2 libs and/or directories were not found where specified!" "$LINENO" 5 - fi - - if test "$LIBSSH2_ENABLED" = "1"; then - if test -n "$DIR_SSH2"; then - - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $DIR_SSH2 to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $DIR_SSH2 to LD_LIBRARY_PATH" >&6;} - fi - fi - else - LDFLAGS=$CLEANLDFLAGS - CPPFLAGS=$CLEANCPPFLAGS - LIBS=$CLEANLIBS - fi -fi - - -OPT_LIBRTMP=off - -# Check whether --with-librtmp was given. -if test "${with_librtmp+set}" = set; then : - withval=$with_librtmp; OPT_LIBRTMP=$withval -fi - - -if test X"$OPT_LIBRTMP" != Xno; then - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - case "$OPT_LIBRTMP" in - yes) - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for librtmp options with pkg-config" >&5 -$as_echo_n "checking for librtmp options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists librtmp >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp` - LD_RTMP=`$PKGCONFIG --libs-only-L librtmp` - CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp` - version=`$PKGCONFIG --modversion librtmp` - DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'` - else - as_fn_error $? "--librtmp was specified but could not find librtmp pkgconfig file." "$LINENO" 5 - fi - - ;; - off) - LIB_RTMP="-lrtmp" - ;; - *) - LIB_RTMP="-lrtmp" - PREFIX_RTMP=$OPT_LIBRTMP - ;; - esac - - if test -n "$PREFIX_RTMP"; then - LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff - CPP_RTMP=-I${PREFIX_RTMP}/include - DIR_RTMP=${PREFIX_RTMP}/lib$libsuff - fi - - LDFLAGS="$LDFLAGS $LD_RTMP" - CPPFLAGS="$CPPFLAGS $CPP_RTMP" - LIBS="$LIB_RTMP $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTMP_Init in -lrtmp" >&5 -$as_echo_n "checking for RTMP_Init in -lrtmp... " >&6; } -if ${ac_cv_lib_rtmp_RTMP_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrtmp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char RTMP_Init (); -int main (void) -{ -return RTMP_Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rtmp_RTMP_Init=yes -else - ac_cv_lib_rtmp_RTMP_Init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rtmp_RTMP_Init" >&5 -$as_echo "$ac_cv_lib_rtmp_RTMP_Init" >&6; } -if test "x$ac_cv_lib_rtmp_RTMP_Init" = xyes; then : - - for ac_header in librtmp/rtmp.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "librtmp/rtmp.h" "ac_cv_header_librtmp_rtmp_h" "$ac_includes_default" -if test "x$ac_cv_header_librtmp_rtmp_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRTMP_RTMP_H 1 -_ACEOF - curl_rtmp_msg="enabled (librtmp)" - LIBRTMP_ENABLED=1 - -$as_echo "#define USE_LIBRTMP 1" >>confdefs.h - - USE_LIBRTMP=1 - - -fi - -done - - -else - LDFLAGS=$CLEANLDFLAGS - CPPFLAGS=$CLEANCPPFLAGS - LIBS=$CLEANLIBS - -fi - - - if test X"$OPT_LIBRTMP" != Xoff && - test "$LIBRTMP_ENABLED" != "1"; then - as_fn_error $? "librtmp libs and/or directories were not found where specified!" "$LINENO" 5 - fi - -fi - - -versioned_symbols_flavour= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether versioned symbols are wanted" >&5 -$as_echo_n "checking whether versioned symbols are wanted... " >&6; } -# Check whether --enable-versioned-symbols was given. -if test "${enable_versioned_symbols+set}" = set; then : - enableval=$enable_versioned_symbols; case "$enableval" in - yes) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libraries can be versioned" >&5 -$as_echo_n "checking if libraries can be versioned... " >&6; } - GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script` - if test -z "$GLD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You need an ld version supporting the --version-script option" >&5 -$as_echo "$as_me: WARNING: You need an ld version supporting the --version-script option" >&2;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - if test "x$CURL_WITH_MULTI_SSL" = "x1"; then - versioned_symbols_flavour="MULTISSL_" - elif test "x$OPENSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="OPENSSL_" - elif test "x$GNUTLS_ENABLED" = "x1"; then - versioned_symbols_flavour="GNUTLS_" - elif test "x$NSS_ENABLED" = "x1"; then - versioned_symbols_flavour="NSS_" - elif test "x$POLARSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="POLARSSL_" - elif test "x$CYASSL_ENABLED" = "x1"; then - versioned_symbols_flavour="CYASSL_" - elif test "x$AXTLS_ENABLED" = "x1"; then - versioned_symbols_flavour="AXTLS_" - elif test "x$WINSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="WINSSL_" - elif test "x$DARWINSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="DARWINSSL_" - else - versioned_symbols_flavour="" - fi - versioned_symbols="yes" - fi - ;; - - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac - -else - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - -fi - - -CURL_LT_SHLIB_VERSIONED_FLAVOUR="$versioned_symbols_flavour" - - if test "x$versioned_symbols" = 'xyes'; then - CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_TRUE= - CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_FALSE='#' -else - CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_TRUE='#' - CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_FALSE= -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Windows native IDN (Windows native builds only)" >&5 -$as_echo_n "checking whether to enable Windows native IDN (Windows native builds only)... " >&6; } -OPT_WINIDN="default" - -# Check whether --with-winidn was given. -if test "${with_winidn+set}" = set; then : - withval=$with_winidn; OPT_WINIDN=$withval -fi - -case "$OPT_WINIDN" in - no|default) - want_winidn="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - yes) - want_winidn="yes" - want_winidn_path="default" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - *) - want_winidn="yes" - want_winidn_path="$withval" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($withval)" >&5 -$as_echo "yes ($withval)" >&6; } - ;; -esac - -if test "$want_winidn" = "yes"; then - clean_CPPFLAGS="$CPPFLAGS" - clean_LDFLAGS="$LDFLAGS" - clean_LIBS="$LIBS" - WINIDN_LIBS="-lnormaliz" - WINIDN_CPPFLAGS="-DWINVER=0x0600" - # - if test "$want_winidn_path" != "default"; then - WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff" - WINIDN_CPPFLAGS="-I$want_winidn_path/include" - WINIDN_DIR="$want_winidn_path/lib$libsuff" - fi - # - CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS" - LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS" - LIBS="$WINIDN_LIBS $LIBS" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IdnToUnicode can be linked" >&5 -$as_echo_n "checking if IdnToUnicode can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - #include - -int main (void) -{ - - IdnToUnicode(0, NULL, 0, NULL, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_winidn="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_winidn="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_winidn" = "yes"; then - -$as_echo "#define USE_WIN32_IDN 1" >>confdefs.h - - -$as_echo "#define WANT_IDN_PROTOTYPES 1" >>confdefs.h - - IDN_ENABLED=1 - - curl_idn_msg="enabled (Windows-native)" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find libraries for IDN support: IDN disabled" >&5 -$as_echo "$as_me: WARNING: Cannot find libraries for IDN support: IDN disabled" >&2;} - CPPFLAGS="$clean_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS" - LIBS="$clean_LIBS" - fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with libidn2" >&5 -$as_echo_n "checking whether to build with libidn2... " >&6; } -OPT_IDN="default" - -# Check whether --with-libidn2 was given. -if test "${with_libidn2+set}" = set; then : - withval=$with_libidn2; OPT_IDN=$withval -fi - -case "$OPT_IDN" in - no) - want_idn="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - default) - want_idn="yes" - want_idn_path="default" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) yes" >&5 -$as_echo "(assumed) yes" >&6; } - ;; - yes) - want_idn="yes" - want_idn_path="default" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - *) - want_idn="yes" - want_idn_path="$withval" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($withval)" >&5 -$as_echo "yes ($withval)" >&6; } - ;; -esac - -if test "$want_idn" = "yes"; then - clean_CPPFLAGS="$CPPFLAGS" - clean_LDFLAGS="$LDFLAGS" - clean_LIBS="$LIBS" - PKGCONFIG="no" - # - if test "$want_idn_path" != "default"; then - IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig" - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libidn2 options with pkg-config" >&5 -$as_echo_n "checking for libidn2 options with pkg-config... " >&6; } - itexists=` - if test -n "$IDN_PCDIR"; then - PKG_CONFIG_LIBDIR="$IDN_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libidn2 >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - if test "$PKGCONFIG" != "no"; then - IDN_LIBS=` - if test -n "$IDN_PCDIR"; then - PKG_CONFIG_LIBDIR="$IDN_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-l libidn2 2>/dev/null` - IDN_LDFLAGS=` - if test -n "$IDN_PCDIR"; then - PKG_CONFIG_LIBDIR="$IDN_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --libs-only-L libidn2 2>/dev/null` - IDN_CPPFLAGS=` - if test -n "$IDN_PCDIR"; then - PKG_CONFIG_LIBDIR="$IDN_PCDIR" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --cflags-only-I libidn2 2>/dev/null` - IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'` - else - IDN_LIBS="-lidn2" - IDN_LDFLAGS="-L$want_idn_path/lib$libsuff" - IDN_CPPFLAGS="-I$want_idn_path/include" - IDN_DIR="$want_idn_path/lib$libsuff" - fi - else - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libidn2 options with pkg-config" >&5 -$as_echo_n "checking for libidn2 options with pkg-config... " >&6; } - itexists=` - if test -n ""; then - PKG_CONFIG_LIBDIR="" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libidn2 >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - if test "$PKGCONFIG" != "no"; then - IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null` - IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null` - IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null` - IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'` - else - IDN_LIBS="-lidn2" - fi - fi - # - if test "$PKGCONFIG" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: IDN_LIBS: \"$IDN_LIBS\"" >&5 -$as_echo "$as_me: pkg-config: IDN_LIBS: \"$IDN_LIBS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: IDN_LDFLAGS: \"$IDN_LDFLAGS\"" >&5 -$as_echo "$as_me: pkg-config: IDN_LDFLAGS: \"$IDN_LDFLAGS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: IDN_CPPFLAGS: \"$IDN_CPPFLAGS\"" >&5 -$as_echo "$as_me: pkg-config: IDN_CPPFLAGS: \"$IDN_CPPFLAGS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: IDN_DIR: \"$IDN_DIR\"" >&5 -$as_echo "$as_me: pkg-config: IDN_DIR: \"$IDN_DIR\"" >&6;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: IDN_LIBS: \"$IDN_LIBS\"" >&5 -$as_echo "$as_me: IDN_LIBS: \"$IDN_LIBS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IDN_LDFLAGS: \"$IDN_LDFLAGS\"" >&5 -$as_echo "$as_me: IDN_LDFLAGS: \"$IDN_LDFLAGS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IDN_CPPFLAGS: \"$IDN_CPPFLAGS\"" >&5 -$as_echo "$as_me: IDN_CPPFLAGS: \"$IDN_CPPFLAGS\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IDN_DIR: \"$IDN_DIR\"" >&5 -$as_echo "$as_me: IDN_DIR: \"$IDN_DIR\"" >&6;} - fi - # - CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS" - LDFLAGS="$LDFLAGS $IDN_LDFLAGS" - LIBS="$IDN_LIBS $LIBS" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if idn2_lookup_ul can be linked" >&5 -$as_echo_n "checking if idn2_lookup_ul can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define idn2_lookup_ul innocuous_idn2_lookup_ul -#ifdef __STDC__ -# include -#else -# include -#endif -#undef idn2_lookup_ul -#ifdef __cplusplus -extern "C" -#endif -char idn2_lookup_ul (); -#if defined __stub_idn2_lookup_ul || defined __stub___idn2_lookup_ul -choke me -#endif - -int main (void) -{ -return idn2_lookup_ul (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_libidn="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_libidn="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - for ac_header in idn2.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - if test "$tst_links_libidn" = "yes"; then - -$as_echo "#define HAVE_LIBIDN2 1" >>confdefs.h - - - IDN_ENABLED=1 - - curl_idn_msg="enabled (libidn2)" - if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR" - export LD_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: Added $IDN_DIR to LD_LIBRARY_PATH" >&5 -$as_echo "$as_me: Added $IDN_DIR to LD_LIBRARY_PATH" >&6;} - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find libraries for IDN support: IDN disabled" >&5 -$as_echo "$as_me: WARNING: Cannot find libraries for IDN support: IDN disabled" >&2;} - CPPFLAGS="$clean_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS" - LIBS="$clean_LIBS" - fi -fi - - - - - -OPT_H2="yes" - -if test "x$disable_http" = "xyes"; then - # without HTTP, nghttp2 is no use - OPT_H2="no" -fi - - -# Check whether --with-nghttp2 was given. -if test "${with_nghttp2+set}" = set; then : - withval=$with_nghttp2; OPT_H2=$withval -fi - -case "$OPT_H2" in - no) - want_h2="no" - ;; - yes) - want_h2="default" - want_h2_path="" - ;; - *) - want_h2="yes" - want_h2_path="$withval/lib/pkgconfig" - ;; -esac - -curl_h2_msg="disabled (--with-nghttp2)" -if test X"$want_h2" != Xno; then - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - - if test -n "$PKG_CONFIG"; then - PKGCONFIG="$PKG_CONFIG" - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKGCONFIG"; then - ac_pt_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin:/usr/local/bin" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG -if test -n "$ac_pt_PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 -$as_echo "$ac_pt_PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKGCONFIG" = x; then - PKGCONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKGCONFIG=$ac_pt_PKGCONFIG - fi -else - PKGCONFIG="$ac_cv_path_PKGCONFIG" -fi - - fi - - if test "x$PKGCONFIG" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnghttp2 options with pkg-config" >&5 -$as_echo_n "checking for libnghttp2 options with pkg-config... " >&6; } - itexists=` - if test -n "$want_h2_path"; then - PKG_CONFIG_LIBDIR="$want_h2_path" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --exists libnghttp2 >/dev/null 2>&1 && echo 1` - - if test -z "$itexists"; then - PKGCONFIG="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - fi - fi - - - if test "$PKGCONFIG" != "no" ; then - LIB_H2=` - if test -n "$want_h2_path"; then - PKG_CONFIG_LIBDIR="$want_h2_path" - export PKG_CONFIG_LIBDIR - fi - - $PKGCONFIG --libs-only-l libnghttp2` - { $as_echo "$as_me:${as_lineno-$LINENO}: -l is $LIB_H2" >&5 -$as_echo "$as_me: -l is $LIB_H2" >&6;} - - CPP_H2=` - if test -n "$want_h2_path"; then - PKG_CONFIG_LIBDIR="$want_h2_path" - export PKG_CONFIG_LIBDIR - fi - $PKGCONFIG --cflags-only-I libnghttp2` - { $as_echo "$as_me:${as_lineno-$LINENO}: -I is $CPP_H2" >&5 -$as_echo "$as_me: -I is $CPP_H2" >&6;} - - LD_H2=` - if test -n "$want_h2_path"; then - PKG_CONFIG_LIBDIR="$want_h2_path" - export PKG_CONFIG_LIBDIR - fi - - $PKGCONFIG --libs-only-L libnghttp2` - { $as_echo "$as_me:${as_lineno-$LINENO}: -L is $LD_H2" >&5 -$as_echo "$as_me: -L is $LD_H2" >&6;} - - LDFLAGS="$LDFLAGS $LD_H2" - CPPFLAGS="$CPPFLAGS $CPP_H2" - LIBS="$LIB_H2 $LIBS" - - # use nghttp2_option_set_no_recv_client_magic to require nghttp2 - # >= 1.0.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nghttp2_option_set_no_recv_client_magic in -lnghttp2" >&5 -$as_echo_n "checking for nghttp2_option_set_no_recv_client_magic in -lnghttp2... " >&6; } -if ${ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnghttp2 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char nghttp2_option_set_no_recv_client_magic (); -int main (void) -{ -return nghttp2_option_set_no_recv_client_magic (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic=yes -else - ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic" >&5 -$as_echo "$ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic" >&6; } -if test "x$ac_cv_lib_nghttp2_nghttp2_option_set_no_recv_client_magic" = xyes; then : - - for ac_header in nghttp2/nghttp2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "nghttp2/nghttp2.h" "ac_cv_header_nghttp2_nghttp2_h" "$ac_includes_default" -if test "x$ac_cv_header_nghttp2_nghttp2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NGHTTP2_NGHTTP2_H 1 -_ACEOF - curl_h2_msg="enabled (nghttp2)" - NGHTTP2_ENABLED=1 - -$as_echo "#define USE_NGHTTP2 1" >>confdefs.h - - USE_NGHTTP2=1 - - -fi - -done - - -else - LDFLAGS=$CLEANLDFLAGS - CPPFLAGS=$CLEANCPPFLAGS - LIBS=$CLEANLIBS - -fi - - - else - if test X"$want_h2" != Xdefault; then - as_fn_error $? "--with-nghttp2 was specified but could not find libnghttp2 pkg-config file." "$LINENO" 5 - fi - fi - -fi - - -OPT_ZSH_FPATH=default - -# Check whether --with-zsh-functions-dir was given. -if test "${with_zsh_functions_dir+set}" = set; then : - withval=$with_zsh_functions_dir; OPT_ZSH_FPATH=$withval -fi - -case "$OPT_ZSH_FPATH" in - no) - ;; - default|yes) - ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions" - - ;; - *) - ZSH_FUNCTIONS_DIR="$withval" - - ;; -esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc.h" >&5 -$as_echo_n "checking for malloc.h... " >&6; } -if ${curl_cv_header_malloc_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_malloc_h="yes" - -else - - curl_cv_header_malloc_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_malloc_h" >&5 -$as_echo "$curl_cv_header_malloc_h" >&6; } - if test "$curl_cv_header_malloc_h" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_MALLOC_H 1 -_ACEOF - - # - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_need_header_malloc_h="no" - -else - - curl_cv_need_header_malloc_h="yes" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - case "$curl_cv_need_header_malloc_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define NEED_MALLOC_H 1 -_ACEOF - - ;; - esac - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory.h" >&5 -$as_echo_n "checking for memory.h... " >&6; } -if ${curl_cv_header_memory_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_memory_h="yes" - -else - - curl_cv_header_memory_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_memory_h" >&5 -$as_echo "$curl_cv_header_memory_h" >&6; } - if test "$curl_cv_header_memory_h" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_MEMORY_H 1 -_ACEOF - - # - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - -int main (void) -{ - - void *p = malloc(10); - void *q = calloc(10,10); - free(p); - free(q); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_need_header_memory_h="no" - -else - - curl_cv_need_header_memory_h="yes" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - case "$curl_cv_need_header_memory_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define NEED_MEMORY_H 1 -_ACEOF - - ;; - esac - fi - - -for ac_header in sys/types.h \ - sys/time.h \ - sys/select.h \ - sys/socket.h \ - sys/ioctl.h \ - sys/uio.h \ - assert.h \ - unistd.h \ - stdlib.h \ - limits.h \ - arpa/inet.h \ - net/if.h \ - netinet/in.h \ - sys/un.h \ - netinet/tcp.h \ - netdb.h \ - sys/sockio.h \ - sys/stat.h \ - sys/param.h \ - termios.h \ - termio.h \ - sgtty.h \ - fcntl.h \ - alloca.h \ - time.h \ - io.h \ - pwd.h \ - utime.h \ - sys/utime.h \ - sys/poll.h \ - poll.h \ - socket.h \ - sys/resource.h \ - libgen.h \ - locale.h \ - errno.h \ - stdbool.h \ - arpa/tftp.h \ - sys/filio.h \ - sys/wait.h \ - setjmp.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_UN_H -#include -#endif - - -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int main (void) -{ - -#ifndef __cplusplus - /* Ultrix mips cc rejects this sort of thing. */ - typedef int charset[2]; - const charset cs = { 0, 0 }; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this sort of thing. */ - char tx; - char *t = &tx; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; } bx; - struct s *b = &bx; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler support of C99 variadic macro style" >&5 -$as_echo_n "checking for compiler support of C99 variadic macro style... " >&6; } -if ${curl_cv_variadic_macros_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__) -#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__) - int fun3(int arg1, int arg2, int arg3); - int fun2(int arg1, int arg2); - int fun3(int arg1, int arg2, int arg3) - { return arg1 + arg2 + arg3; } - int fun2(int arg1, int arg2) - { return arg1 + arg2; } - -int main (void) -{ - - int res3 = c99_vmacro3(1, 2, 3); - int res2 = c99_vmacro2(1, 2); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_variadic_macros_c99="yes" - -else - - curl_cv_variadic_macros_c99="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_variadic_macros_c99" >&5 -$as_echo "$curl_cv_variadic_macros_c99" >&6; } - case "$curl_cv_variadic_macros_c99" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_VARIADIC_MACROS_C99 1 -_ACEOF - - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler support of old gcc variadic macro style" >&5 -$as_echo_n "checking for compiler support of old gcc variadic macro style... " >&6; } -if ${curl_cv_variadic_macros_gcc+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gcc_vmacro3(first, args...) fun3(first, args) -#define gcc_vmacro2(first, args...) fun2(first, args) - int fun3(int arg1, int arg2, int arg3); - int fun2(int arg1, int arg2); - int fun3(int arg1, int arg2, int arg3) - { return arg1 + arg2 + arg3; } - int fun2(int arg1, int arg2) - { return arg1 + arg2; } - -int main (void) -{ - - int res3 = gcc_vmacro3(1, 2, 3); - int res2 = gcc_vmacro2(1, 2); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_variadic_macros_gcc="yes" - -else - - curl_cv_variadic_macros_gcc="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_variadic_macros_gcc" >&5 -$as_echo "$curl_cv_variadic_macros_gcc" >&6; } - case "$curl_cv_variadic_macros_gcc" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_VARIADIC_MACROS_GCC 1 -_ACEOF - - ;; - esac - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -int main (void) -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - - - for ac_header in sys/types.h sys/time.h time.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 -$as_echo_n "checking for struct timeval... " >&6; } -if ${curl_cv_struct_timeval+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -int main (void) -{ - - struct timeval ts; - ts.tv_sec = 0; - ts.tv_usec = 0; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_struct_timeval="yes" - -else - - curl_cv_struct_timeval="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_struct_timeval" >&5 -$as_echo "$curl_cv_struct_timeval" >&6; } - case "$curl_cv_struct_timeval" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TIMEVAL 1 -_ACEOF - - ;; - esac - - - - if test "x$cross_compiling" != xyes; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking run-time libs availability" >&5 -$as_echo_n "checking run-time libs availability... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -main() -{ - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: fine" >&5 -$as_echo "fine" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } - as_fn_error $? "one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS" "$LINENO" 5 - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - fi - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 -$as_echo_n "checking size of size_t... " >&6; } -if ${ac_cv_sizeof_size_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_size_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_size_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 -$as_echo "$ac_cv_sizeof_size_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } -if ${ac_cv_sizeof_short+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_short=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 -$as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_time_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_time_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 -$as_echo "$ac_cv_sizeof_time_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_TIME_T $ac_cv_sizeof_time_t -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 -$as_echo_n "checking size of off_t... " >&6; } -if ${ac_cv_sizeof_off_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_off_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_off_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 -$as_echo "$ac_cv_sizeof_off_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_OFF_T $ac_cv_sizeof_off_t -_ACEOF - - - -o=$CPPFLAGS -CPPFLAGS="-I$srcdir/include $CPPFLAGS" -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of curl_off_t" >&5 -$as_echo_n "checking size of curl_off_t... " >&6; } -if ${ac_cv_sizeof_curl_off_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (curl_off_t))" "ac_cv_sizeof_curl_off_t" " -#include - -"; then : - -else - if test "$ac_cv_type_curl_off_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (curl_off_t) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_curl_off_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_curl_off_t" >&5 -$as_echo "$ac_cv_sizeof_curl_off_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_CURL_OFF_T $ac_cv_sizeof_curl_off_t -_ACEOF - - -CPPFLAGS=$o - -ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" -if test "x$ac_cv_type_long_long" = xyes; then : - -$as_echo "#define HAVE_LONGLONG 1" >>confdefs.h - - longlong="yes" - -fi - - -if test "xyes" = "x$longlong"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if numberLL works" >&5 -$as_echo_n "checking if numberLL works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - long long val = 1000LL; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_LL 1" >>confdefs.h - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - -# check for ssize_t -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : - -else - -$as_echo "#define ssize_t int" >>confdefs.h - -fi - - -# check for bool type -ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_STDBOOL_H -#include -#endif - -" -if test "x$ac_cv_type_bool" = xyes; then : - - -$as_echo "#define HAVE_BOOL_T 1" >>confdefs.h - - -fi - - - -curl_includes_ws2tcpip="\ -/* includes start */ -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -#endif -/* includes end */" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 -$as_echo_n "checking for windows.h... " >&6; } -if ${curl_cv_header_windows_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_windows_h="yes" - -else - - curl_cv_header_windows_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_windows_h" >&5 -$as_echo "$curl_cv_header_windows_h" >&6; } - case "$curl_cv_header_windows_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 -$as_echo_n "checking for winsock2.h... " >&6; } -if ${curl_cv_header_winsock2_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_winsock2_h="yes" - -else - - curl_cv_header_winsock2_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_winsock2_h" >&5 -$as_echo "$curl_cv_header_winsock2_h" >&6; } - case "$curl_cv_header_winsock2_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 -$as_echo_n "checking for ws2tcpip.h... " >&6; } -if ${curl_cv_header_ws2tcpip_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#include - -int main (void) -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WS2TCPIP_H shall not be defined. -#else - int dummy=2*IP_PKTINFO; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_header_ws2tcpip_h="yes" - -else - - curl_cv_header_ws2tcpip_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_header_ws2tcpip_h" >&5 -$as_echo "$curl_cv_header_ws2tcpip_h" >&6; } - case "$curl_cv_header_ws2tcpip_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WS2TCPIP_H 1 -_ACEOF - - ;; - esac - - - -curl_includes_sys_socket="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_socket -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -curl_preprocess_callconv="\ -/* preprocess start */ -#ifdef HAVE_WINDOWS_H -# define FUNCALLCONV __stdcall -#else -# define FUNCALLCONV -#endif -/* preprocess end */" - - - # - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_socklen_t data type" >&5 -$as_echo_n "checking for curl_socklen_t data type... " >&6; } - curl_typeof_curl_socklen_t="unknown" - for arg1 in int SOCKET; do - for arg2 in 'struct sockaddr' void; do - for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do - if test "$curl_typeof_curl_socklen_t" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_preprocess_callconv - extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); - -int main (void) -{ - - $t *lenptr = 0; - if(0 != getpeername(0, 0, lenptr)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_typeof_curl_socklen_t="$t" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - done - for t in socklen_t int; do - if test "$curl_typeof_curl_socklen_t" = "void"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - typedef $t curl_socklen_t; - -int main (void) -{ - - curl_socklen_t dummy; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_typeof_curl_socklen_t="$t" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_typeof_curl_socklen_t" >&5 -$as_echo "$curl_typeof_curl_socklen_t" >&6; } - if test "$curl_typeof_curl_socklen_t" = "void" || - test "$curl_typeof_curl_socklen_t" = "unknown"; then - as_fn_error $? "cannot find data type for curl_socklen_t." "$LINENO" 5 - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of curl_socklen_t" >&5 -$as_echo_n "checking size of curl_socklen_t... " >&6; } - curl_sizeof_curl_socklen_t="unknown" - curl_pull_headers_socklen_t="unknown" - if test "$curl_cv_header_ws2tcpip_h" = "yes"; then - tst_pull_header_checks='none ws2tcpip' - tst_size_checks='4' - else - tst_pull_header_checks='none systypes syssocket' - tst_size_checks='4 8 2' - fi - for tst_size in $tst_size_checks; do - for tst_pull_headers in $tst_pull_header_checks; do - if test "$curl_sizeof_curl_socklen_t" = "unknown"; then - case $tst_pull_headers in - ws2tcpip) - tmp_includes="$curl_includes_ws2tcpip" - ;; - systypes) - tmp_includes="$curl_includes_sys_types" - ;; - syssocket) - tmp_includes="$curl_includes_sys_socket" - ;; - *) - tmp_includes="" - ;; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $tmp_includes - typedef $curl_typeof_curl_socklen_t curl_socklen_t; - typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1]; - -int main (void) -{ - - curl_socklen_t dummy; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_sizeof_curl_socklen_t="$tst_size" - curl_pull_headers_socklen_t="$tst_pull_headers" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_sizeof_curl_socklen_t" >&5 -$as_echo "$curl_sizeof_curl_socklen_t" >&6; } - if test "$curl_sizeof_curl_socklen_t" = "unknown"; then - as_fn_error $? "cannot find out size of curl_socklen_t." "$LINENO" 5 - fi - # - case $curl_pull_headers_socklen_t in - ws2tcpip) - -cat >>confdefs.h <<_EOF -#define CURL_PULL_WS2TCPIP_H 1 -_EOF - - ;; - systypes) - -cat >>confdefs.h <<_EOF -#define CURL_PULL_SYS_TYPES_H 1 -_EOF - - ;; - syssocket) - -cat >>confdefs.h <<_EOF -#define CURL_PULL_SYS_TYPES_H 1 -_EOF - - -cat >>confdefs.h <<_EOF -#define CURL_PULL_SYS_SOCKET_H 1 -_EOF - - ;; - esac - -cat >>confdefs.h <<_EOF -#define CURL_TYPEOF_CURL_SOCKLEN_T $curl_typeof_curl_socklen_t -_EOF - - -cat >>confdefs.h <<_EOF -#define CURL_SIZEOF_CURL_SOCKLEN_T $curl_sizeof_curl_socklen_t -_EOF - - - - -curl_includes_poll="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_POLL_H -# include -#endif -#ifdef HAVE_SYS_POLL_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h poll.h sys/poll.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_poll -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_poll_events_macro_defined="unknown" - # - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_poll - -int main (void) -{ - -#if defined(events) || defined(revents) - return 0; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_poll_events_macro_defined="yes" - -else - - tst_poll_events_macro_defined="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # - if test "$tst_poll_events_macro_defined" = "yes"; then - if test "x$ac_cv_header_sys_poll_h" = "xyes"; then - -cat >>confdefs.h <<_EOF -#define CURL_PULL_SYS_POLL_H 1 -_EOF - - fi - fi - # - - - - ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - -" -if test "x$ac_cv_type_in_addr_t" = xyes; then : - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in_addr_t equivalent" >&5 -$as_echo_n "checking for in_addr_t equivalent... " >&6; } -if ${curl_cv_in_addr_t_equiv+:} false; then : - $as_echo_n "(cached) " >&6 -else - - curl_cv_in_addr_t_equiv="unknown" - for t in "unsigned long" int size_t unsigned long; do - if test "$curl_cv_in_addr_t_equiv" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - -int main (void) -{ - - $t data = inet_addr ("1.2.3.4"); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - curl_cv_in_addr_t_equiv="$t" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_in_addr_t_equiv" >&5 -$as_echo "$curl_cv_in_addr_t_equiv" >&6; } - case "$curl_cv_in_addr_t_equiv" in - unknown) - as_fn_error $? "Cannot find a type to use in place of in_addr_t" "$LINENO" 5 - ;; - *) - -cat >>confdefs.h <<_ACEOF -#define in_addr_t $curl_cv_in_addr_t_equiv -_ACEOF - - ;; - esac - -fi - - - - - ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#endif - -" -if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : - -$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h - -fi - - - - - for ac_header in signal.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_signal_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNAL_H 1 -_ACEOF - -fi - -done - - ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" " -#ifdef HAVE_SIGNAL_H -#include -#endif - -" -if test "x$ac_cv_type_sig_atomic_t" = xyes; then : - - -$as_echo "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h - - -fi - - case "$ac_cv_type_sig_atomic_t" in - yes) - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sig_atomic_t is already defined as volatile" >&5 -$as_echo_n "checking if sig_atomic_t is already defined as volatile... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_SIGNAL_H -#include -#endif - -int main (void) -{ - - static volatile sig_atomic_t dummy = 0; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_sig_atomic_t_volatile="no" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_sig_atomic_t_volatile="yes" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$curl_cv_sig_atomic_t_volatile" = "yes"; then - -$as_echo "#define HAVE_SIG_ATOMIC_T_VOLATILE 1" >>confdefs.h - - fi - ;; - esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if ${ac_cv_type_signal+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int main (void) -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int -else - ac_cv_type_signal=void -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - - - - for ac_header in sys/select.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for select" >&5 -$as_echo_n "checking for select... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif -#ifndef HAVE_WINDOWS_H -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - -int main (void) -{ - - select(0, 0, 0, 0, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_select="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_select="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$curl_cv_select" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for select" >&5 -$as_echo_n "checking types of args and return type for select... " >&6; } -if ${curl_cv_func_select_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - - curl_cv_func_select_args="unknown" - for sel_retv in 'int' 'ssize_t'; do - for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do - for sel_arg234 in 'fd_set *' 'int *' 'void *'; do - for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do - if test "$curl_cv_func_select_args" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define SELECTCALLCONV PASCAL -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#ifdef TIME_WITH_SYS_TIME -#include -#endif -#else -#ifdef HAVE_TIME_H -#include -#endif -#endif -#ifndef HAVE_WINDOWS_H -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define SELECTCALLCONV -#endif -#ifndef HAVE_STRUCT_TIMEVAL - struct timeval { - long tv_sec; - long tv_usec; - }; -#endif - extern $sel_retv SELECTCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - select($sel_arg1, - $sel_arg234, - $sel_arg234, - $sel_arg234, - $sel_arg5); - -int main (void) -{ - - $sel_arg1 nfds=0; - $sel_arg234 rfds=0; - $sel_arg234 wfds=0; - $sel_arg234 efds=0; - $sel_retv res = select(nfds, rfds, wfds, efds, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - done - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_select_args" >&5 -$as_echo "$curl_cv_func_select_args" >&6; } # AC-CACHE-CHECK - if test "$curl_cv_func_select_args" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for select args" >&5 -$as_echo "$as_me: WARNING: Cannot find proper types to use for select args" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_SELECT will not be defined" >&5 -$as_echo "$as_me: WARNING: HAVE_SELECT will not be defined" >&2;} - else - select_prev_IFS=$IFS; IFS=',' - set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'` - IFS=$select_prev_IFS - shift - # - sel_qual_type_arg5=$3 - # - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG1 $1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG234 $2 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_RETV $4 -_ACEOF - - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$sel_qual_type_arg5" in - const*) - sel_qual_arg5=const - sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'` - ;; - *) - sel_qual_arg5= - sel_type_arg5=$sel_qual_type_arg5 - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define SELECT_QUAL_ARG5 $sel_qual_arg5 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG5 $sel_type_arg5 -_ACEOF - - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define HAVE_SELECT 1 -_ACEOF - - curl_cv_func_select="yes" - fi - fi - - - - for ac_header in sys/types.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recv" >&5 -$as_echo_n "checking for recv... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - -int main (void) -{ - - recv(0, 0, 0, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_recv="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_recv="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$curl_cv_recv" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for recv" >&5 -$as_echo_n "checking types of args and return type for recv... " >&6; } -if ${curl_cv_func_recv_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - - curl_cv_func_recv_args="unknown" - for recv_retv in 'int' 'ssize_t'; do - for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do - for recv_arg2 in 'char *' 'void *'; do - for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do - for recv_arg4 in 'int' 'unsigned int'; do - if test "$curl_cv_func_recv_args" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define RECVCALLCONV PASCAL -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define RECVCALLCONV -#endif - extern $recv_retv RECVCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); - -int main (void) -{ - - $recv_arg1 s=0; - $recv_arg2 buf=0; - $recv_arg3 len=0; - $recv_arg4 flags=0; - $recv_retv res = recv(s, buf, len, flags); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - done - done - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_recv_args" >&5 -$as_echo "$curl_cv_func_recv_args" >&6; } # AC-CACHE-CHECK - if test "$curl_cv_func_recv_args" = "unknown"; then - as_fn_error $? "Cannot find proper types to use for recv args" "$LINENO" 5 - else - recv_prev_IFS=$IFS; IFS=',' - set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'` - IFS=$recv_prev_IFS - shift - # - -cat >>confdefs.h <<_ACEOF -#define RECV_TYPE_ARG1 $1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define RECV_TYPE_ARG2 $2 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define RECV_TYPE_ARG3 $3 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define RECV_TYPE_ARG4 $4 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define RECV_TYPE_RETV $5 -_ACEOF - - # - -cat >>confdefs.h <<_ACEOF -#define HAVE_RECV 1 -_ACEOF - - curl_cv_func_recv="yes" - fi - else - as_fn_error $? "Unable to link function recv" "$LINENO" 5 - fi - - - for ac_header in sys/types.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for send" >&5 -$as_echo_n "checking for send... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - -int main (void) -{ - - send(0, 0, 0, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_send="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_send="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$curl_cv_send" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for send" >&5 -$as_echo_n "checking types of args and return type for send... " >&6; } -if ${curl_cv_func_send_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - - curl_cv_func_send_args="unknown" - for send_retv in 'int' 'ssize_t'; do - for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do - for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do - for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do - for send_arg4 in 'int' 'unsigned int'; do - if test "$curl_cv_func_send_args" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#define SENDCALLCONV PASCAL -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#define SENDCALLCONV -#endif - extern $send_retv SENDCALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - send($send_arg1, $send_arg2, $send_arg3, $send_arg4); - -int main (void) -{ - - $send_arg1 s=0; - $send_arg3 len=0; - $send_arg4 flags=0; - $send_retv res = send(s, 0, len, flags); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - done - done - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_send_args" >&5 -$as_echo "$curl_cv_func_send_args" >&6; } # AC-CACHE-CHECK - if test "$curl_cv_func_send_args" = "unknown"; then - as_fn_error $? "Cannot find proper types to use for send args" "$LINENO" 5 - else - send_prev_IFS=$IFS; IFS=',' - set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'` - IFS=$send_prev_IFS - shift - # - send_qual_type_arg2=$2 - # - -cat >>confdefs.h <<_ACEOF -#define SEND_TYPE_ARG1 $1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SEND_TYPE_ARG3 $3 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SEND_TYPE_ARG4 $4 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SEND_TYPE_RETV $5 -_ACEOF - - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$send_qual_type_arg2" in - const*) - send_qual_arg2=const - send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` - ;; - *) - send_qual_arg2= - send_type_arg2=$send_qual_type_arg2 - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define SEND_QUAL_ARG2 $send_qual_arg2 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SEND_TYPE_ARG2 $send_type_arg2 -_ACEOF - - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define HAVE_SEND 1 -_ACEOF - - curl_cv_func_send="yes" - fi - else - as_fn_error $? "Unable to link function send" "$LINENO" 5 - fi - - - for ac_header in sys/types.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 -$as_echo_n "checking for MSG_NOSIGNAL... " >&6; } -if ${curl_cv_msg_nosignal+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#else -#ifdef HAVE_WINSOCK_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#endif - -int main (void) -{ - - int flag=MSG_NOSIGNAL; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_msg_nosignal="yes" - -else - - curl_cv_msg_nosignal="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_msg_nosignal" >&5 -$as_echo "$curl_cv_msg_nosignal" >&6; } - case "$curl_cv_msg_nosignal" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_MSG_NOSIGNAL 1 -_ACEOF - - ;; - esac - - - -curl_includes_unistd="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_unistd -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_alarm="unknown" - tst_proto_alarm="unknown" - tst_compi_alarm="unknown" - tst_allow_alarm="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm can be linked" >&5 -$as_echo_n "checking if alarm can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define alarm innocuous_alarm -#ifdef __STDC__ -# include -#else -# include -#endif -#undef alarm -#ifdef __cplusplus -extern "C" -#endif -char alarm (); -#if defined __stub_alarm || defined __stub___alarm -choke me -#endif - -int main (void) -{ -return alarm (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_alarm="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_alarm="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_alarm" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm is prototyped" >&5 -$as_echo_n "checking if alarm is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_unistd - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "alarm" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_alarm="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_alarm="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_alarm" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm is compilable" >&5 -$as_echo_n "checking if alarm is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_unistd - -int main (void) -{ - - if(0 != alarm(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_alarm="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_alarm="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_alarm" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm usage allowed" >&5 -$as_echo_n "checking if alarm usage allowed... " >&6; } - if test "x$curl_disallow_alarm" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_alarm="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_alarm="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm might be used" >&5 -$as_echo_n "checking if alarm might be used... " >&6; } - if test "$tst_links_alarm" = "yes" && - test "$tst_proto_alarm" = "yes" && - test "$tst_compi_alarm" = "yes" && - test "$tst_allow_alarm" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_ALARM 1 -_ACEOF - - curl_cv_func_alarm="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_alarm="no" - fi - - -curl_includes_string="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h string.h strings.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_string -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -curl_includes_libgen="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_LIBGEN_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h libgen.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_libgen -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_basename="unknown" - tst_proto_basename="unknown" - tst_compi_basename="unknown" - tst_allow_basename="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename can be linked" >&5 -$as_echo_n "checking if basename can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define basename innocuous_basename -#ifdef __STDC__ -# include -#else -# include -#endif -#undef basename -#ifdef __cplusplus -extern "C" -#endif -char basename (); -#if defined __stub_basename || defined __stub___basename -choke me -#endif - -int main (void) -{ -return basename (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_basename="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_basename="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_basename" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename is prototyped" >&5 -$as_echo_n "checking if basename is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - $curl_includes_libgen - $curl_includes_unistd - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "basename" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_basename="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_basename="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_basename" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename is compilable" >&5 -$as_echo_n "checking if basename is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - $curl_includes_libgen - $curl_includes_unistd - -int main (void) -{ - - if(0 != basename(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_basename="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_basename="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_basename" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename usage allowed" >&5 -$as_echo_n "checking if basename usage allowed... " >&6; } - if test "x$curl_disallow_basename" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_basename="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_basename="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename might be used" >&5 -$as_echo_n "checking if basename might be used... " >&6; } - if test "$tst_links_basename" = "yes" && - test "$tst_proto_basename" = "yes" && - test "$tst_compi_basename" = "yes" && - test "$tst_allow_basename" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_BASENAME 1 -_ACEOF - - curl_cv_func_basename="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_basename="no" - fi - - -curl_includes_socket="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SOCKET_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_socket -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_closesocket="unknown" - tst_proto_closesocket="unknown" - tst_compi_closesocket="unknown" - tst_allow_closesocket="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket can be linked" >&5 -$as_echo_n "checking if closesocket can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_socket - -int main (void) -{ - - if(0 != closesocket(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_closesocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_closesocket="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_closesocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is prototyped" >&5 -$as_echo_n "checking if closesocket is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "closesocket" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_closesocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_closesocket="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_closesocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is compilable" >&5 -$as_echo_n "checking if closesocket is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_socket - -int main (void) -{ - - if(0 != closesocket(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_closesocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_closesocket="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_closesocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket usage allowed" >&5 -$as_echo_n "checking if closesocket usage allowed... " >&6; } - if test "x$curl_disallow_closesocket" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_closesocket="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_closesocket="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket might be used" >&5 -$as_echo_n "checking if closesocket might be used... " >&6; } - if test "$tst_links_closesocket" = "yes" && - test "$tst_proto_closesocket" = "yes" && - test "$tst_compi_closesocket" = "yes" && - test "$tst_allow_closesocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_CLOSESOCKET 1 -_ACEOF - - curl_cv_func_closesocket="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_closesocket="no" - fi - - - # - tst_links_closesocket_camel="unknown" - tst_proto_closesocket_camel="unknown" - tst_compi_closesocket_camel="unknown" - tst_allow_closesocket_camel="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket can be linked" >&5 -$as_echo_n "checking if CloseSocket can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - -int main (void) -{ - - if(0 != CloseSocket(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_closesocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_closesocket_camel="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_closesocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is prototyped" >&5 -$as_echo_n "checking if CloseSocket is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_sys_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "CloseSocket" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_closesocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_closesocket_camel="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_closesocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is compilable" >&5 -$as_echo_n "checking if CloseSocket is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - -int main (void) -{ - - if(0 != CloseSocket(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_closesocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_closesocket_camel="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_closesocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket usage allowed" >&5 -$as_echo_n "checking if CloseSocket usage allowed... " >&6; } - if test "x$curl_disallow_closesocket_camel" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_closesocket_camel="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_closesocket_camel="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket might be used" >&5 -$as_echo_n "checking if CloseSocket might be used... " >&6; } - if test "$tst_links_closesocket_camel" = "yes" && - test "$tst_proto_closesocket_camel" = "yes" && - test "$tst_compi_closesocket_camel" = "yes" && - test "$tst_allow_closesocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_CLOSESOCKET_CAMEL 1 -_ACEOF - - curl_cv_func_closesocket_camel="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_closesocket_camel="no" - fi - - - # - tst_links_connect="unknown" - tst_proto_connect="unknown" - tst_compi_connect="unknown" - tst_allow_connect="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect can be linked" >&5 -$as_echo_n "checking if connect can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -int main (void) -{ - - if(0 != connect(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_connect="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_connect="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_connect" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is prototyped" >&5 -$as_echo_n "checking if connect is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "connect" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_connect="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_connect="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_connect" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is compilable" >&5 -$as_echo_n "checking if connect is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -int main (void) -{ - - if(0 != connect(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_connect="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_connect="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_connect" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect usage allowed" >&5 -$as_echo_n "checking if connect usage allowed... " >&6; } - if test "x$curl_disallow_connect" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_connect="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_connect="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect might be used" >&5 -$as_echo_n "checking if connect might be used... " >&6; } - if test "$tst_links_connect" = "yes" && - test "$tst_proto_connect" = "yes" && - test "$tst_compi_connect" = "yes" && - test "$tst_allow_connect" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_CONNECT 1 -_ACEOF - - curl_cv_func_connect="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_connect="no" - fi - - -curl_includes_fcntl="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h unistd.h fcntl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_fcntl -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_fcntl="unknown" - tst_proto_fcntl="unknown" - tst_compi_fcntl="unknown" - tst_allow_fcntl="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl can be linked" >&5 -$as_echo_n "checking if fcntl can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define fcntl innocuous_fcntl -#ifdef __STDC__ -# include -#else -# include -#endif -#undef fcntl -#ifdef __cplusplus -extern "C" -#endif -char fcntl (); -#if defined __stub_fcntl || defined __stub___fcntl -choke me -#endif - -int main (void) -{ -return fcntl (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_fcntl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_fcntl="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_fcntl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is prototyped" >&5 -$as_echo_n "checking if fcntl is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_fcntl - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "fcntl" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_fcntl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_fcntl="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_fcntl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is compilable" >&5 -$as_echo_n "checking if fcntl is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_fcntl - -int main (void) -{ - - if(0 != fcntl(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_fcntl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_fcntl="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_fcntl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl usage allowed" >&5 -$as_echo_n "checking if fcntl usage allowed... " >&6; } - if test "x$curl_disallow_fcntl" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_fcntl="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_fcntl="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl might be used" >&5 -$as_echo_n "checking if fcntl might be used... " >&6; } - if test "$tst_links_fcntl" = "yes" && - test "$tst_proto_fcntl" = "yes" && - test "$tst_compi_fcntl" = "yes" && - test "$tst_allow_fcntl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FCNTL 1 -_ACEOF - - curl_cv_func_fcntl="yes" - - # - tst_compi_fcntl_o_nonblock="unknown" - tst_allow_fcntl_o_nonblock="unknown" - # - case $host_os in - sunos4* | aix3* | beos*) - curl_disallow_fcntl_o_nonblock="yes" - ;; - esac - # - if test "$curl_cv_func_fcntl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK is compilable" >&5 -$as_echo_n "checking if fcntl O_NONBLOCK is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_fcntl - -int main (void) -{ - - int flags = 0; - if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_fcntl_o_nonblock="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_fcntl_o_nonblock="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_fcntl_o_nonblock" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK usage allowed" >&5 -$as_echo_n "checking if fcntl O_NONBLOCK usage allowed... " >&6; } - if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_fcntl_o_nonblock="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_fcntl_o_nonblock="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK might be used" >&5 -$as_echo_n "checking if fcntl O_NONBLOCK might be used... " >&6; } - if test "$tst_compi_fcntl_o_nonblock" = "yes" && - test "$tst_allow_fcntl_o_nonblock" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FCNTL_O_NONBLOCK 1 -_ACEOF - - curl_cv_func_fcntl_o_nonblock="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_fcntl_o_nonblock="no" - fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_fcntl="no" - fi - - -curl_includes_stdio="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STDIO_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h stdio.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stdio -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_fdopen="unknown" - tst_proto_fdopen="unknown" - tst_compi_fdopen="unknown" - tst_allow_fdopen="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen can be linked" >&5 -$as_echo_n "checking if fdopen can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define fdopen innocuous_fdopen -#ifdef __STDC__ -# include -#else -# include -#endif -#undef fdopen -#ifdef __cplusplus -extern "C" -#endif -char fdopen (); -#if defined __stub_fdopen || defined __stub___fdopen -choke me -#endif - -int main (void) -{ -return fdopen (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_fdopen="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_fdopen="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_fdopen" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen is prototyped" >&5 -$as_echo_n "checking if fdopen is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_stdio - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "fdopen" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_fdopen="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_fdopen="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_fdopen" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen is compilable" >&5 -$as_echo_n "checking if fdopen is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdio - -int main (void) -{ - - if(0 != fdopen(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_fdopen="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_fdopen="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_fdopen" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen usage allowed" >&5 -$as_echo_n "checking if fdopen usage allowed... " >&6; } - if test "x$curl_disallow_fdopen" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_fdopen="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_fdopen="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen might be used" >&5 -$as_echo_n "checking if fdopen might be used... " >&6; } - if test "$tst_links_fdopen" = "yes" && - test "$tst_proto_fdopen" = "yes" && - test "$tst_compi_fdopen" = "yes" && - test "$tst_allow_fdopen" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FDOPEN 1 -_ACEOF - - curl_cv_func_fdopen="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_fdopen="no" - fi - - -curl_includes_netdb="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_NETDB_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h netdb.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_netdb -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_freeaddrinfo="unknown" - tst_proto_freeaddrinfo="unknown" - tst_compi_freeaddrinfo="unknown" - tst_allow_freeaddrinfo="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo can be linked" >&5 -$as_echo_n "checking if freeaddrinfo can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - freeaddrinfo(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_freeaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_freeaddrinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_freeaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is prototyped" >&5 -$as_echo_n "checking if freeaddrinfo is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "freeaddrinfo" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_freeaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_freeaddrinfo="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_freeaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is compilable" >&5 -$as_echo_n "checking if freeaddrinfo is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - freeaddrinfo(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_freeaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_freeaddrinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_freeaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo usage allowed" >&5 -$as_echo_n "checking if freeaddrinfo usage allowed... " >&6; } - if test "x$curl_disallow_freeaddrinfo" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_freeaddrinfo="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_freeaddrinfo="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo might be used" >&5 -$as_echo_n "checking if freeaddrinfo might be used... " >&6; } - if test "$tst_links_freeaddrinfo" = "yes" && - test "$tst_proto_freeaddrinfo" = "yes" && - test "$tst_compi_freeaddrinfo" = "yes" && - test "$tst_allow_freeaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FREEADDRINFO 1 -_ACEOF - - curl_cv_func_freeaddrinfo="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_freeaddrinfo="no" - fi - - -curl_includes_ifaddrs="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_IFADDRS_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h sys/socket.h netinet/in.h ifaddrs.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_ifaddrs -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_freeifaddrs="unknown" - tst_proto_freeifaddrs="unknown" - tst_compi_freeifaddrs="unknown" - tst_allow_freeifaddrs="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs can be linked" >&5 -$as_echo_n "checking if freeifaddrs can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define freeifaddrs innocuous_freeifaddrs -#ifdef __STDC__ -# include -#else -# include -#endif -#undef freeifaddrs -#ifdef __cplusplus -extern "C" -#endif -char freeifaddrs (); -#if defined __stub_freeifaddrs || defined __stub___freeifaddrs -choke me -#endif - -int main (void) -{ -return freeifaddrs (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_freeifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_freeifaddrs="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_freeifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs is prototyped" >&5 -$as_echo_n "checking if freeifaddrs is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_ifaddrs - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "freeifaddrs" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_freeifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_freeifaddrs="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_freeifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs is compilable" >&5 -$as_echo_n "checking if freeifaddrs is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ifaddrs - -int main (void) -{ - - freeifaddrs(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_freeifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_freeifaddrs="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_freeifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs usage allowed" >&5 -$as_echo_n "checking if freeifaddrs usage allowed... " >&6; } - if test "x$curl_disallow_freeifaddrs" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_freeifaddrs="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_freeifaddrs="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs might be used" >&5 -$as_echo_n "checking if freeifaddrs might be used... " >&6; } - if test "$tst_links_freeifaddrs" = "yes" && - test "$tst_proto_freeifaddrs" = "yes" && - test "$tst_compi_freeifaddrs" = "yes" && - test "$tst_allow_freeifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FREEIFADDRS 1 -_ACEOF - - curl_cv_func_freeifaddrs="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_freeifaddrs="no" - fi - - -curl_includes_sys_xattr="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_XATTR_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h sys/xattr.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_xattr -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_fsetxattr="unknown" - tst_proto_fsetxattr="unknown" - tst_compi_fsetxattr="unknown" - tst_allow_fsetxattr="unknown" - tst_nargs_fsetxattr="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr can be linked" >&5 -$as_echo_n "checking if fsetxattr can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define fsetxattr innocuous_fsetxattr -#ifdef __STDC__ -# include -#else -# include -#endif -#undef fsetxattr -#ifdef __cplusplus -extern "C" -#endif -char fsetxattr (); -#if defined __stub_fsetxattr || defined __stub___fsetxattr -choke me -#endif - -int main (void) -{ -return fsetxattr (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_fsetxattr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_fsetxattr="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_fsetxattr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr is prototyped" >&5 -$as_echo_n "checking if fsetxattr is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_sys_xattr - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "fsetxattr" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_fsetxattr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_fsetxattr="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_fsetxattr" = "yes"; then - if test "$tst_nargs_fsetxattr" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr takes 5 args." >&5 -$as_echo_n "checking if fsetxattr takes 5 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_xattr - -int main (void) -{ - - if(0 != fsetxattr(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_fsetxattr="yes" - tst_nargs_fsetxattr="5" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_fsetxattr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_fsetxattr" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr takes 6 args." >&5 -$as_echo_n "checking if fsetxattr takes 6 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_xattr - -int main (void) -{ - - if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_fsetxattr="yes" - tst_nargs_fsetxattr="6" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_fsetxattr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr is compilable" >&5 -$as_echo_n "checking if fsetxattr is compilable... " >&6; } - if test "$tst_compi_fsetxattr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - if test "$tst_compi_fsetxattr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr usage allowed" >&5 -$as_echo_n "checking if fsetxattr usage allowed... " >&6; } - if test "x$curl_disallow_fsetxattr" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_fsetxattr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_fsetxattr="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr might be used" >&5 -$as_echo_n "checking if fsetxattr might be used... " >&6; } - if test "$tst_links_fsetxattr" = "yes" && - test "$tst_proto_fsetxattr" = "yes" && - test "$tst_compi_fsetxattr" = "yes" && - test "$tst_allow_fsetxattr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FSETXATTR 1 -_ACEOF - - # - if test "$tst_nargs_fsetxattr" -eq "5"; then - -$as_echo "#define HAVE_FSETXATTR_5 1" >>confdefs.h - - elif test "$tst_nargs_fsetxattr" -eq "6"; then - -$as_echo "#define HAVE_FSETXATTR_6 1" >>confdefs.h - - fi - # - curl_cv_func_fsetxattr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_fsetxattr="no" - fi - - - # - tst_links_ftruncate="unknown" - tst_proto_ftruncate="unknown" - tst_compi_ftruncate="unknown" - tst_allow_ftruncate="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate can be linked" >&5 -$as_echo_n "checking if ftruncate can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define ftruncate innocuous_ftruncate -#ifdef __STDC__ -# include -#else -# include -#endif -#undef ftruncate -#ifdef __cplusplus -extern "C" -#endif -char ftruncate (); -#if defined __stub_ftruncate || defined __stub___ftruncate -choke me -#endif - -int main (void) -{ -return ftruncate (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_ftruncate="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_ftruncate="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_ftruncate" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate is prototyped" >&5 -$as_echo_n "checking if ftruncate is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_unistd - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "ftruncate" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_ftruncate="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_ftruncate="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_ftruncate" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate is compilable" >&5 -$as_echo_n "checking if ftruncate is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_unistd - -int main (void) -{ - - if(0 != ftruncate(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ftruncate="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ftruncate="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ftruncate" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate usage allowed" >&5 -$as_echo_n "checking if ftruncate usage allowed... " >&6; } - if test "x$curl_disallow_ftruncate" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ftruncate="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ftruncate="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate might be used" >&5 -$as_echo_n "checking if ftruncate might be used... " >&6; } - if test "$tst_links_ftruncate" = "yes" && - test "$tst_proto_ftruncate" = "yes" && - test "$tst_compi_ftruncate" = "yes" && - test "$tst_allow_ftruncate" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_FTRUNCATE 1 -_ACEOF - - curl_cv_func_ftruncate="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ftruncate="no" - fi - - -curl_includes_stdlib="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h stdlib.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stdlib -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_getaddrinfo="unknown" - tst_proto_getaddrinfo="unknown" - tst_compi_getaddrinfo="unknown" - tst_works_getaddrinfo="unknown" - tst_allow_getaddrinfo="unknown" - tst_tsafe_getaddrinfo="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo can be linked" >&5 -$as_echo_n "checking if getaddrinfo can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - if(0 != getaddrinfo(0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_getaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_getaddrinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_getaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is prototyped" >&5 -$as_echo_n "checking if getaddrinfo is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getaddrinfo" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_getaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_getaddrinfo="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_getaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is compilable" >&5 -$as_echo_n "checking if getaddrinfo is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - if(0 != getaddrinfo(0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_getaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_getaddrinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_getaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo seems to work" >&5 -$as_echo_n "checking if getaddrinfo seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ws2tcpip - $curl_includes_stdlib - $curl_includes_string - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - struct addrinfo hints; - struct addrinfo *ai = 0; - int error; - - #ifdef HAVE_WINSOCK2_H - WSADATA wsa; - if (WSAStartup(MAKEWORD(2,2), &wsa)) - exit(2); - #endif - - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_NUMERICHOST; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo("127.0.0.1", 0, &hints, &ai); - if(error || !ai) - exit(1); /* fail */ - else - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_getaddrinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_getaddrinfo="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_getaddrinfo" = "yes" && - test "$tst_works_getaddrinfo" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo usage allowed" >&5 -$as_echo_n "checking if getaddrinfo usage allowed... " >&6; } - if test "x$curl_disallow_getaddrinfo" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_getaddrinfo="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_getaddrinfo="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo might be used" >&5 -$as_echo_n "checking if getaddrinfo might be used... " >&6; } - if test "$tst_links_getaddrinfo" = "yes" && - test "$tst_proto_getaddrinfo" = "yes" && - test "$tst_compi_getaddrinfo" = "yes" && - test "$tst_allow_getaddrinfo" = "yes" && - test "$tst_works_getaddrinfo" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETADDRINFO 1 -_ACEOF - - curl_cv_func_getaddrinfo="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_getaddrinfo="no" - curl_cv_func_getaddrinfo_threadsafe="no" - fi - # - if test "$curl_cv_func_getaddrinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is threadsafe" >&5 -$as_echo_n "checking if getaddrinfo is threadsafe... " >&6; } - case $host_os in - aix[1234].* | aix5.[01].*) - tst_tsafe_getaddrinfo="no" - ;; - aix*) - tst_tsafe_getaddrinfo="yes" - ;; - darwin[12345].*) - tst_tsafe_getaddrinfo="no" - ;; - darwin*) - tst_tsafe_getaddrinfo="yes" - ;; - freebsd[1234].* | freebsd5.[1234]*) - tst_tsafe_getaddrinfo="no" - ;; - freebsd*) - tst_tsafe_getaddrinfo="yes" - ;; - hpux[123456789].* | hpux10.* | hpux11.0* | hpux11.10*) - tst_tsafe_getaddrinfo="no" - ;; - hpux*) - tst_tsafe_getaddrinfo="yes" - ;; - netbsd[123].*) - tst_tsafe_getaddrinfo="no" - ;; - netbsd*) - tst_tsafe_getaddrinfo="yes" - ;; - *bsd*) - tst_tsafe_getaddrinfo="no" - ;; - solaris2*) - tst_tsafe_getaddrinfo="yes" - ;; - esac - if test "$tst_tsafe_getaddrinfo" = "unknown" && - test "$curl_cv_native_windows" = "yes"; then - tst_tsafe_getaddrinfo="yes" - fi - if test "$tst_tsafe_getaddrinfo" = "unknown"; then - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ -#ifdef h_errno - return 0; -#else - force compilation error -#endif -} - - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_symbol_defined="yes" - -else - - tst_symbol_defined="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tst_symbol_defined" = "yes"; then - curl_cv_have_def_h_errno=yes - - else - curl_cv_have_def_h_errno=no - - fi - - if test "$curl_cv_have_def_h_errno" = "yes"; then - tst_h_errno_macro="yes" - else - tst_h_errno_macro="no" - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - $curl_includes_netdb - -int main (void) -{ - - h_errno = 2; - if(0 != h_errno) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_h_errno_modifiable_lvalue="yes" - -else - - tst_h_errno_modifiable_lvalue="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) - return 0; -#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700) - return 0; -#else - force compilation error -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_h_errno_sbs_issue_7="yes" - -else - - tst_h_errno_sbs_issue_7="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$tst_h_errno_macro" = "no" && - test "$tst_h_errno_modifiable_lvalue" = "no" && - test "$tst_h_errno_sbs_issue_7" = "no"; then - tst_tsafe_getaddrinfo="no" - else - tst_tsafe_getaddrinfo="yes" - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_tsafe_getaddrinfo" >&5 -$as_echo "$tst_tsafe_getaddrinfo" >&6; } - if test "$tst_tsafe_getaddrinfo" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETADDRINFO_THREADSAFE 1 -_ACEOF - - curl_cv_func_getaddrinfo_threadsafe="yes" - else - curl_cv_func_getaddrinfo_threadsafe="no" - fi - fi - - - # - tst_links_gai_strerror="unknown" - tst_proto_gai_strerror="unknown" - tst_compi_gai_strerror="unknown" - tst_allow_gai_strerror="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gai_strerror can be linked" >&5 -$as_echo_n "checking if gai_strerror can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gai_strerror(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gai_strerror="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gai_strerror="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gai_strerror" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gai_strerror is prototyped" >&5 -$as_echo_n "checking if gai_strerror is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gai_strerror" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gai_strerror="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gai_strerror="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gai_strerror" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gai_strerror is compilable" >&5 -$as_echo_n "checking if gai_strerror is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gai_strerror(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gai_strerror="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gai_strerror="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_gai_strerror" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gai_strerror usage allowed" >&5 -$as_echo_n "checking if gai_strerror usage allowed... " >&6; } - if test "x$curl_disallow_gai_strerror" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gai_strerror="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gai_strerror="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gai_strerror might be used" >&5 -$as_echo_n "checking if gai_strerror might be used... " >&6; } - if test "$tst_links_gai_strerror" = "yes" && - test "$tst_proto_gai_strerror" = "yes" && - test "$tst_compi_gai_strerror" = "yes" && - test "$tst_allow_gai_strerror" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GAI_STRERROR 1 -_ACEOF - - curl_cv_func_gai_strerror="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gai_strerror="no" - fi - - - # - tst_links_gethostbyaddr="unknown" - tst_proto_gethostbyaddr="unknown" - tst_compi_gethostbyaddr="unknown" - tst_allow_gethostbyaddr="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr can be linked" >&5 -$as_echo_n "checking if gethostbyaddr can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyaddr(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gethostbyaddr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gethostbyaddr="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gethostbyaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is prototyped" >&5 -$as_echo_n "checking if gethostbyaddr is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyaddr" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gethostbyaddr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gethostbyaddr="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gethostbyaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is compilable" >&5 -$as_echo_n "checking if gethostbyaddr is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyaddr(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyaddr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyaddr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_gethostbyaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr usage allowed" >&5 -$as_echo_n "checking if gethostbyaddr usage allowed... " >&6; } - if test "x$curl_disallow_gethostbyaddr" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gethostbyaddr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gethostbyaddr="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr might be used" >&5 -$as_echo_n "checking if gethostbyaddr might be used... " >&6; } - if test "$tst_links_gethostbyaddr" = "yes" && - test "$tst_proto_gethostbyaddr" = "yes" && - test "$tst_compi_gethostbyaddr" = "yes" && - test "$tst_allow_gethostbyaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETHOSTBYADDR 1 -_ACEOF - - curl_cv_func_gethostbyaddr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gethostbyaddr="no" - fi - - - # - tst_links_gethostbyaddr_r="unknown" - tst_proto_gethostbyaddr_r="unknown" - tst_compi_gethostbyaddr_r="unknown" - tst_allow_gethostbyaddr_r="unknown" - tst_nargs_gethostbyaddr_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r can be linked" >&5 -$as_echo_n "checking if gethostbyaddr_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gethostbyaddr_r innocuous_gethostbyaddr_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gethostbyaddr_r -#ifdef __cplusplus -extern "C" -#endif -char gethostbyaddr_r (); -#if defined __stub_gethostbyaddr_r || defined __stub___gethostbyaddr_r -choke me -#endif - -int main (void) -{ -return gethostbyaddr_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gethostbyaddr_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gethostbyaddr_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gethostbyaddr_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r is prototyped" >&5 -$as_echo_n "checking if gethostbyaddr_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gethostbyaddr_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gethostbyaddr_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gethostbyaddr_r" = "yes"; then - if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 5 args." >&5 -$as_echo_n "checking if gethostbyaddr_r takes 5 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyaddr_r(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyaddr_r="yes" - tst_nargs_gethostbyaddr_r="5" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyaddr_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 7 args." >&5 -$as_echo_n "checking if gethostbyaddr_r takes 7 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyaddr_r="yes" - tst_nargs_gethostbyaddr_r="7" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyaddr_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 8 args." >&5 -$as_echo_n "checking if gethostbyaddr_r takes 8 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyaddr_r="yes" - tst_nargs_gethostbyaddr_r="8" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyaddr_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r is compilable" >&5 -$as_echo_n "checking if gethostbyaddr_r is compilable... " >&6; } - if test "$tst_compi_gethostbyaddr_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - if test "$tst_compi_gethostbyaddr_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r usage allowed" >&5 -$as_echo_n "checking if gethostbyaddr_r usage allowed... " >&6; } - if test "x$curl_disallow_gethostbyaddr_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gethostbyaddr_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gethostbyaddr_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r might be used" >&5 -$as_echo_n "checking if gethostbyaddr_r might be used... " >&6; } - if test "$tst_links_gethostbyaddr_r" = "yes" && - test "$tst_proto_gethostbyaddr_r" = "yes" && - test "$tst_compi_gethostbyaddr_r" = "yes" && - test "$tst_allow_gethostbyaddr_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETHOSTBYADDR_R 1 -_ACEOF - - # - if test "$tst_nargs_gethostbyaddr_r" -eq "5"; then - -$as_echo "#define HAVE_GETHOSTBYADDR_R_5 1" >>confdefs.h - - elif test "$tst_nargs_gethostbyaddr_r" -eq "7"; then - -$as_echo "#define HAVE_GETHOSTBYADDR_R_7 1" >>confdefs.h - - elif test "$tst_nargs_gethostbyaddr_r" -eq "8"; then - -$as_echo "#define HAVE_GETHOSTBYADDR_R_8 1" >>confdefs.h - - fi - # - curl_cv_func_gethostbyaddr_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gethostbyaddr_r="no" - fi - - - # - tst_links_gethostbyname="unknown" - tst_proto_gethostbyname="unknown" - tst_compi_gethostbyname="unknown" - tst_allow_gethostbyname="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname can be linked" >&5 -$as_echo_n "checking if gethostbyname can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyname(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gethostbyname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gethostbyname="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gethostbyname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is prototyped" >&5 -$as_echo_n "checking if gethostbyname is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyname" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gethostbyname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gethostbyname="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gethostbyname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is compilable" >&5 -$as_echo_n "checking if gethostbyname is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyname(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyname="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_gethostbyname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname usage allowed" >&5 -$as_echo_n "checking if gethostbyname usage allowed... " >&6; } - if test "x$curl_disallow_gethostbyname" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gethostbyname="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gethostbyname="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname might be used" >&5 -$as_echo_n "checking if gethostbyname might be used... " >&6; } - if test "$tst_links_gethostbyname" = "yes" && - test "$tst_proto_gethostbyname" = "yes" && - test "$tst_compi_gethostbyname" = "yes" && - test "$tst_allow_gethostbyname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETHOSTBYNAME 1 -_ACEOF - - curl_cv_func_gethostbyname="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gethostbyname="no" - fi - - - # - tst_links_gethostbyname_r="unknown" - tst_proto_gethostbyname_r="unknown" - tst_compi_gethostbyname_r="unknown" - tst_allow_gethostbyname_r="unknown" - tst_nargs_gethostbyname_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r can be linked" >&5 -$as_echo_n "checking if gethostbyname_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gethostbyname_r innocuous_gethostbyname_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gethostbyname_r -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname_r (); -#if defined __stub_gethostbyname_r || defined __stub___gethostbyname_r -choke me -#endif - -int main (void) -{ -return gethostbyname_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gethostbyname_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gethostbyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gethostbyname_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r is prototyped" >&5 -$as_echo_n "checking if gethostbyname_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostbyname_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gethostbyname_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gethostbyname_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gethostbyname_r" = "yes"; then - if test "$tst_nargs_gethostbyname_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 3 args." >&5 -$as_echo_n "checking if gethostbyname_r takes 3 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyname_r(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyname_r="yes" - tst_nargs_gethostbyname_r="3" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_gethostbyname_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 5 args." >&5 -$as_echo_n "checking if gethostbyname_r takes 5 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyname_r(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyname_r="yes" - tst_nargs_gethostbyname_r="5" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_gethostbyname_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 6 args." >&5 -$as_echo_n "checking if gethostbyname_r takes 6 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostbyname_r="yes" - tst_nargs_gethostbyname_r="6" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostbyname_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r is compilable" >&5 -$as_echo_n "checking if gethostbyname_r is compilable... " >&6; } - if test "$tst_compi_gethostbyname_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - if test "$tst_compi_gethostbyname_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r usage allowed" >&5 -$as_echo_n "checking if gethostbyname_r usage allowed... " >&6; } - if test "x$curl_disallow_gethostbyname_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gethostbyname_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gethostbyname_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r might be used" >&5 -$as_echo_n "checking if gethostbyname_r might be used... " >&6; } - if test "$tst_links_gethostbyname_r" = "yes" && - test "$tst_proto_gethostbyname_r" = "yes" && - test "$tst_compi_gethostbyname_r" = "yes" && - test "$tst_allow_gethostbyname_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETHOSTBYNAME_R 1 -_ACEOF - - # - if test "$tst_nargs_gethostbyname_r" -eq "3"; then - -$as_echo "#define HAVE_GETHOSTBYNAME_R_3 1" >>confdefs.h - - elif test "$tst_nargs_gethostbyname_r" -eq "5"; then - -$as_echo "#define HAVE_GETHOSTBYNAME_R_5 1" >>confdefs.h - - elif test "$tst_nargs_gethostbyname_r" -eq "6"; then - -$as_echo "#define HAVE_GETHOSTBYNAME_R_6 1" >>confdefs.h - - fi - # - curl_cv_func_gethostbyname_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gethostbyname_r="no" - fi - - - # - tst_links_gethostname="unknown" - tst_proto_gethostname="unknown" - tst_compi_gethostname="unknown" - tst_allow_gethostname="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname can be linked" >&5 -$as_echo_n "checking if gethostname can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_unistd - -int main (void) -{ - - if(0 != gethostname(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gethostname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gethostname="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gethostname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is prototyped" >&5 -$as_echo_n "checking if gethostname is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_unistd - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gethostname" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gethostname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gethostname="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gethostname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is compilable" >&5 -$as_echo_n "checking if gethostname is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_unistd - -int main (void) -{ - - if(0 != gethostname(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gethostname="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gethostname="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_gethostname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostname arg 2 data type" >&5 -$as_echo_n "checking for gethostname arg 2 data type... " >&6; } - tst_gethostname_type_arg2="unknown" - for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do - for tst_arg2 in 'int' 'unsigned int' 'size_t'; do - if test "$tst_gethostname_type_arg2" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_unistd - $curl_preprocess_callconv - extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); - -int main (void) -{ - - if(0 != gethostname(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_gethostname_type_arg2="$tst_arg2" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_gethostname_type_arg2" >&5 -$as_echo "$tst_gethostname_type_arg2" >&6; } - if test "$tst_gethostname_type_arg2" != "unknown"; then - -cat >>confdefs.h <<_ACEOF -#define GETHOSTNAME_TYPE_ARG2 $tst_gethostname_type_arg2 -_ACEOF - - fi - fi - # - if test "$tst_compi_gethostname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname usage allowed" >&5 -$as_echo_n "checking if gethostname usage allowed... " >&6; } - if test "x$curl_disallow_gethostname" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gethostname="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gethostname="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname might be used" >&5 -$as_echo_n "checking if gethostname might be used... " >&6; } - if test "$tst_links_gethostname" = "yes" && - test "$tst_proto_gethostname" = "yes" && - test "$tst_compi_gethostname" = "yes" && - test "$tst_allow_gethostname" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETHOSTNAME 1 -_ACEOF - - curl_cv_func_gethostname="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gethostname="no" - fi - - - # - tst_links_getifaddrs="unknown" - tst_proto_getifaddrs="unknown" - tst_compi_getifaddrs="unknown" - tst_works_getifaddrs="unknown" - tst_allow_getifaddrs="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs can be linked" >&5 -$as_echo_n "checking if getifaddrs can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define getifaddrs innocuous_getifaddrs -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getifaddrs -#ifdef __cplusplus -extern "C" -#endif -char getifaddrs (); -#if defined __stub_getifaddrs || defined __stub___getifaddrs -choke me -#endif - -int main (void) -{ -return getifaddrs (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_getifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_getifaddrs="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_getifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs is prototyped" >&5 -$as_echo_n "checking if getifaddrs is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_ifaddrs - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getifaddrs" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_getifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_getifaddrs="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_getifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs is compilable" >&5 -$as_echo_n "checking if getifaddrs is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_ifaddrs - -int main (void) -{ - - if(0 != getifaddrs(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_getifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_getifaddrs="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_getifaddrs" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs seems to work" >&5 -$as_echo_n "checking if getifaddrs seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_ifaddrs - -int main (void) -{ - - struct ifaddrs *ifa = 0; - int error; - - error = getifaddrs(&ifa); - if(error || !ifa) - exit(1); /* fail */ - else - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_getifaddrs="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_getifaddrs="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_getifaddrs" = "yes" && - test "$tst_works_getifaddrs" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs usage allowed" >&5 -$as_echo_n "checking if getifaddrs usage allowed... " >&6; } - if test "x$curl_disallow_getifaddrs" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_getifaddrs="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_getifaddrs="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs might be used" >&5 -$as_echo_n "checking if getifaddrs might be used... " >&6; } - if test "$tst_links_getifaddrs" = "yes" && - test "$tst_proto_getifaddrs" = "yes" && - test "$tst_compi_getifaddrs" = "yes" && - test "$tst_allow_getifaddrs" = "yes" && - test "$tst_works_getifaddrs" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETIFADDRS 1 -_ACEOF - - curl_cv_func_getifaddrs="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_getifaddrs="no" - fi - - - # - tst_links_getservbyport_r="unknown" - tst_proto_getservbyport_r="unknown" - tst_compi_getservbyport_r="unknown" - tst_allow_getservbyport_r="unknown" - tst_nargs_getservbyport_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r can be linked" >&5 -$as_echo_n "checking if getservbyport_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define getservbyport_r innocuous_getservbyport_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getservbyport_r -#ifdef __cplusplus -extern "C" -#endif -char getservbyport_r (); -#if defined __stub_getservbyport_r || defined __stub___getservbyport_r -choke me -#endif - -int main (void) -{ -return getservbyport_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_getservbyport_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_getservbyport_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_getservbyport_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is prototyped" >&5 -$as_echo_n "checking if getservbyport_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_netdb - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getservbyport_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_getservbyport_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_getservbyport_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_getservbyport_r" = "yes"; then - if test "$tst_nargs_getservbyport_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 4 args." >&5 -$as_echo_n "checking if getservbyport_r takes 4 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != getservbyport_r(0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="4" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_getservbyport_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_getservbyport_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 5 args." >&5 -$as_echo_n "checking if getservbyport_r takes 5 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != getservbyport_r(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="5" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_getservbyport_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_getservbyport_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 6 args." >&5 -$as_echo_n "checking if getservbyport_r takes 6 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_netdb - -int main (void) -{ - - if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_getservbyport_r="yes" - tst_nargs_getservbyport_r="6" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_getservbyport_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is compilable" >&5 -$as_echo_n "checking if getservbyport_r is compilable... " >&6; } - if test "$tst_compi_getservbyport_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - if test "$tst_compi_getservbyport_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r usage allowed" >&5 -$as_echo_n "checking if getservbyport_r usage allowed... " >&6; } - if test "x$curl_disallow_getservbyport_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_getservbyport_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_getservbyport_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r might be used" >&5 -$as_echo_n "checking if getservbyport_r might be used... " >&6; } - if test "$tst_links_getservbyport_r" = "yes" && - test "$tst_proto_getservbyport_r" = "yes" && - test "$tst_compi_getservbyport_r" = "yes" && - test "$tst_allow_getservbyport_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETSERVBYPORT_R 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETSERVBYPORT_R_ARGS $tst_nargs_getservbyport_r -_ACEOF - - if test "$tst_nargs_getservbyport_r" -eq "4"; then - -$as_echo "#define GETSERVBYPORT_R_BUFSIZE sizeof(struct servent_data)" >>confdefs.h - - else - -$as_echo "#define GETSERVBYPORT_R_BUFSIZE 4096" >>confdefs.h - - fi - curl_cv_func_getservbyport_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_getservbyport_r="no" - fi - - -curl_includes_time="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_TIME_H -# include -# ifdef TIME_WITH_SYS_TIME -# include -# endif -#else -# ifdef HAVE_TIME_H -# include -# endif -#endif -/* includes end */" - for ac_header in sys/types.h sys/time.h time.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_time -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_gmtime_r="unknown" - tst_proto_gmtime_r="unknown" - tst_compi_gmtime_r="unknown" - tst_works_gmtime_r="unknown" - tst_allow_gmtime_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r can be linked" >&5 -$as_echo_n "checking if gmtime_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define gmtime_r innocuous_gmtime_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef gmtime_r -#ifdef __cplusplus -extern "C" -#endif -char gmtime_r (); -#if defined __stub_gmtime_r || defined __stub___gmtime_r -choke me -#endif - -int main (void) -{ -return gmtime_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_gmtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_gmtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_gmtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r is prototyped" >&5 -$as_echo_n "checking if gmtime_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_time - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gmtime_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_gmtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_gmtime_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_gmtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r is compilable" >&5 -$as_echo_n "checking if gmtime_r is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_time - -int main (void) -{ - - if(0 != gmtime_r(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_gmtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_gmtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_gmtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r seems to work" >&5 -$as_echo_n "checking if gmtime_r seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_time - -int main (void) -{ - - time_t local = 1170352587; - struct tm *gmt = 0; - struct tm result; - gmt = gmtime_r(&local, &result); - if(gmt) - exit(0); - else - exit(1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_gmtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_gmtime_r="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_gmtime_r" = "yes" && - test "$tst_works_gmtime_r" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r usage allowed" >&5 -$as_echo_n "checking if gmtime_r usage allowed... " >&6; } - if test "x$curl_disallow_gmtime_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_gmtime_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_gmtime_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r might be used" >&5 -$as_echo_n "checking if gmtime_r might be used... " >&6; } - if test "$tst_links_gmtime_r" = "yes" && - test "$tst_proto_gmtime_r" = "yes" && - test "$tst_compi_gmtime_r" = "yes" && - test "$tst_allow_gmtime_r" = "yes" && - test "$tst_works_gmtime_r" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_GMTIME_R 1 -_ACEOF - - curl_cv_func_gmtime_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_gmtime_r="no" - fi - - -curl_includes_arpa_inet="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_WINSOCK2_H -#include -#include -#endif -/* includes end */" - for ac_header in sys/types.h sys/socket.h netinet/in.h arpa/inet.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_arpa_inet -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_inet_ntoa_r="unknown" - tst_proto_inet_ntoa_r="unknown" - tst_compi_inet_ntoa_r="unknown" - tst_allow_inet_ntoa_r="unknown" - tst_nargs_inet_ntoa_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r can be linked" >&5 -$as_echo_n "checking if inet_ntoa_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define inet_ntoa_r innocuous_inet_ntoa_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef inet_ntoa_r -#ifdef __cplusplus -extern "C" -#endif -char inet_ntoa_r (); -#if defined __stub_inet_ntoa_r || defined __stub___inet_ntoa_r -choke me -#endif - -int main (void) -{ -return inet_ntoa_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_inet_ntoa_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_inet_ntoa_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_inet_ntoa_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r is prototyped" >&5 -$as_echo_n "checking if inet_ntoa_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_arpa_inet - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_inet_ntoa_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_inet_ntoa_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_inet_ntoa_r" = "yes"; then - if test "$tst_nargs_inet_ntoa_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r takes 2 args." >&5 -$as_echo_n "checking if inet_ntoa_r takes 2 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_arpa_inet - -int main (void) -{ - - struct in_addr addr; - if(0 != inet_ntoa_r(addr, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_inet_ntoa_r="yes" - tst_nargs_inet_ntoa_r="2" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_inet_ntoa_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test "$tst_nargs_inet_ntoa_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r takes 3 args." >&5 -$as_echo_n "checking if inet_ntoa_r takes 3 args.... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_arpa_inet - -int main (void) -{ - - struct in_addr addr; - if(0 != inet_ntoa_r(addr, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_inet_ntoa_r="yes" - tst_nargs_inet_ntoa_r="3" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_inet_ntoa_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r is compilable" >&5 -$as_echo_n "checking if inet_ntoa_r is compilable... " >&6; } - if test "$tst_compi_inet_ntoa_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - # - if test "$tst_compi_inet_ntoa_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r usage allowed" >&5 -$as_echo_n "checking if inet_ntoa_r usage allowed... " >&6; } - if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_inet_ntoa_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_inet_ntoa_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r might be used" >&5 -$as_echo_n "checking if inet_ntoa_r might be used... " >&6; } - if test "$tst_links_inet_ntoa_r" = "yes" && - test "$tst_proto_inet_ntoa_r" = "yes" && - test "$tst_compi_inet_ntoa_r" = "yes" && - test "$tst_allow_inet_ntoa_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_INET_NTOA_R 1 -_ACEOF - - # - if test "$tst_nargs_inet_ntoa_r" -eq "2"; then - -$as_echo "#define HAVE_INET_NTOA_R_2 1" >>confdefs.h - - elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then - -$as_echo "#define HAVE_INET_NTOA_R_3 1" >>confdefs.h - - fi - # - curl_cv_func_inet_ntoa_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_inet_ntoa_r="no" - fi - - - # - tst_links_inet_ntop="unknown" - tst_proto_inet_ntop="unknown" - tst_compi_inet_ntop="unknown" - tst_works_inet_ntop="unknown" - tst_allow_inet_ntop="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop can be linked" >&5 -$as_echo_n "checking if inet_ntop can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define inet_ntop innocuous_inet_ntop -#ifdef __STDC__ -# include -#else -# include -#endif -#undef inet_ntop -#ifdef __cplusplus -extern "C" -#endif -char inet_ntop (); -#if defined __stub_inet_ntop || defined __stub___inet_ntop -choke me -#endif - -int main (void) -{ -return inet_ntop (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_inet_ntop="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_inet_ntop="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_inet_ntop" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is prototyped" >&5 -$as_echo_n "checking if inet_ntop is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_arpa_inet - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "inet_ntop" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_inet_ntop="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_inet_ntop="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_inet_ntop" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is compilable" >&5 -$as_echo_n "checking if inet_ntop is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_arpa_inet - -int main (void) -{ - - if(0 != inet_ntop(0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_inet_ntop="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_inet_ntop="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_inet_ntop" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop seems to work" >&5 -$as_echo_n "checking if inet_ntop seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_arpa_inet - $curl_includes_string - -int main (void) -{ - - char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - char ipv4res[sizeof "255.255.255.255"]; - unsigned char ipv6a[26]; - unsigned char ipv4a[5]; - char *ipv6ptr = 0; - char *ipv4ptr = 0; - /* - */ - ipv4res[0] = '\0'; - ipv4a[0] = 0xc0; - ipv4a[1] = 0xa8; - ipv4a[2] = 0x64; - ipv4a[3] = 0x01; - ipv4a[4] = 0x01; - /* - */ - ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); - if(!ipv4ptr) - exit(1); /* fail */ - if(ipv4ptr != ipv4res) - exit(1); /* fail */ - if(!ipv4ptr[0]) - exit(1); /* fail */ - if(memcmp(ipv4res, "192.168.100.1", 13) != 0) - exit(1); /* fail */ - /* - */ - ipv6res[0] = '\0'; - memset(ipv6a, 0, sizeof(ipv6a)); - ipv6a[0] = 0xfe; - ipv6a[1] = 0x80; - ipv6a[8] = 0x02; - ipv6a[9] = 0x14; - ipv6a[10] = 0x4f; - ipv6a[11] = 0xff; - ipv6a[12] = 0xfe; - ipv6a[13] = 0x0b; - ipv6a[14] = 0x76; - ipv6a[15] = 0xc8; - ipv6a[25] = 0x01; - /* - */ - ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); - if(!ipv6ptr) - exit(1); /* fail */ - if(ipv6ptr != ipv6res) - exit(1); /* fail */ - if(!ipv6ptr[0]) - exit(1); /* fail */ - if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) - exit(1); /* fail */ - /* - */ - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_inet_ntop="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_inet_ntop="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_inet_ntop" = "yes" && - test "$tst_works_inet_ntop" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop usage allowed" >&5 -$as_echo_n "checking if inet_ntop usage allowed... " >&6; } - if test "x$curl_disallow_inet_ntop" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_inet_ntop="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_inet_ntop="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop might be used" >&5 -$as_echo_n "checking if inet_ntop might be used... " >&6; } - if test "$tst_links_inet_ntop" = "yes" && - test "$tst_proto_inet_ntop" = "yes" && - test "$tst_compi_inet_ntop" = "yes" && - test "$tst_allow_inet_ntop" = "yes" && - test "$tst_works_inet_ntop" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_INET_NTOP 1 -_ACEOF - - curl_cv_func_inet_ntop="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_inet_ntop="no" - fi - - - # - tst_links_inet_pton="unknown" - tst_proto_inet_pton="unknown" - tst_compi_inet_pton="unknown" - tst_works_inet_pton="unknown" - tst_allow_inet_pton="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton can be linked" >&5 -$as_echo_n "checking if inet_pton can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define inet_pton innocuous_inet_pton -#ifdef __STDC__ -# include -#else -# include -#endif -#undef inet_pton -#ifdef __cplusplus -extern "C" -#endif -char inet_pton (); -#if defined __stub_inet_pton || defined __stub___inet_pton -choke me -#endif - -int main (void) -{ -return inet_pton (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_inet_pton="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_inet_pton="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_inet_pton" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is prototyped" >&5 -$as_echo_n "checking if inet_pton is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_arpa_inet - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "inet_pton" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_inet_pton="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_inet_pton="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_inet_pton" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is compilable" >&5 -$as_echo_n "checking if inet_pton is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_arpa_inet - -int main (void) -{ - - if(0 != inet_pton(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_inet_pton="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_inet_pton="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_inet_pton" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton seems to work" >&5 -$as_echo_n "checking if inet_pton seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_arpa_inet - $curl_includes_string - -int main (void) -{ - - unsigned char ipv6a[16+1]; - unsigned char ipv4a[4+1]; - const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; - const char *ipv4src = "192.168.100.1"; - /* - */ - memset(ipv4a, 1, sizeof(ipv4a)); - if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) - exit(1); /* fail */ - /* - */ - if( (ipv4a[0] != 0xc0) || - (ipv4a[1] != 0xa8) || - (ipv4a[2] != 0x64) || - (ipv4a[3] != 0x01) || - (ipv4a[4] != 0x01) ) - exit(1); /* fail */ - /* - */ - memset(ipv6a, 1, sizeof(ipv6a)); - if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) - exit(1); /* fail */ - /* - */ - if( (ipv6a[0] != 0xfe) || - (ipv6a[1] != 0x80) || - (ipv6a[8] != 0x02) || - (ipv6a[9] != 0x14) || - (ipv6a[10] != 0x4f) || - (ipv6a[11] != 0xff) || - (ipv6a[12] != 0xfe) || - (ipv6a[13] != 0x0b) || - (ipv6a[14] != 0x76) || - (ipv6a[15] != 0xc8) || - (ipv6a[16] != 0x01) ) - exit(1); /* fail */ - /* - */ - if( (ipv6a[2] != 0x0) || - (ipv6a[3] != 0x0) || - (ipv6a[4] != 0x0) || - (ipv6a[5] != 0x0) || - (ipv6a[6] != 0x0) || - (ipv6a[7] != 0x0) ) - exit(1); /* fail */ - /* - */ - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_inet_pton="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_inet_pton="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_inet_pton" = "yes" && - test "$tst_works_inet_pton" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton usage allowed" >&5 -$as_echo_n "checking if inet_pton usage allowed... " >&6; } - if test "x$curl_disallow_inet_pton" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_inet_pton="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_inet_pton="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton might be used" >&5 -$as_echo_n "checking if inet_pton might be used... " >&6; } - if test "$tst_links_inet_pton" = "yes" && - test "$tst_proto_inet_pton" = "yes" && - test "$tst_compi_inet_pton" = "yes" && - test "$tst_allow_inet_pton" = "yes" && - test "$tst_works_inet_pton" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_INET_PTON 1 -_ACEOF - - curl_cv_func_inet_pton="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_inet_pton="no" - fi - - -curl_includes_stropts="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#ifdef HAVE_STROPTS_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stropts -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_ioctl="unknown" - tst_proto_ioctl="unknown" - tst_compi_ioctl="unknown" - tst_allow_ioctl="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl can be linked" >&5 -$as_echo_n "checking if ioctl can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define ioctl innocuous_ioctl -#ifdef __STDC__ -# include -#else -# include -#endif -#undef ioctl -#ifdef __cplusplus -extern "C" -#endif -char ioctl (); -#if defined __stub_ioctl || defined __stub___ioctl -choke me -#endif - -int main (void) -{ -return ioctl (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_ioctl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_ioctl="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is prototyped" >&5 -$as_echo_n "checking if ioctl is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_stropts - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "ioctl" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_ioctl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_ioctl="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is compilable" >&5 -$as_echo_n "checking if ioctl is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stropts - -int main (void) -{ - - if(0 != ioctl(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctl="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctl="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl usage allowed" >&5 -$as_echo_n "checking if ioctl usage allowed... " >&6; } - if test "x$curl_disallow_ioctl" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctl="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctl="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl might be used" >&5 -$as_echo_n "checking if ioctl might be used... " >&6; } - if test "$tst_links_ioctl" = "yes" && - test "$tst_proto_ioctl" = "yes" && - test "$tst_compi_ioctl" = "yes" && - test "$tst_allow_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTL 1 -_ACEOF - - curl_cv_func_ioctl="yes" - - # - tst_compi_ioctl_fionbio="unknown" - tst_allow_ioctl_fionbio="unknown" - # - if test "$curl_cv_func_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO is compilable" >&5 -$as_echo_n "checking if ioctl FIONBIO is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stropts - -int main (void) -{ - - int flags = 0; - if(0 != ioctl(0, FIONBIO, &flags)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctl_fionbio="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctl_fionbio="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctl_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO usage allowed" >&5 -$as_echo_n "checking if ioctl FIONBIO usage allowed... " >&6; } - if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctl_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctl_fionbio="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO might be used" >&5 -$as_echo_n "checking if ioctl FIONBIO might be used... " >&6; } - if test "$tst_compi_ioctl_fionbio" = "yes" && - test "$tst_allow_ioctl_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTL_FIONBIO 1 -_ACEOF - - curl_cv_func_ioctl_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctl_fionbio="no" - fi - - - # - tst_compi_ioctl_siocgifaddr="unknown" - tst_allow_ioctl_siocgifaddr="unknown" - # - if test "$curl_cv_func_ioctl" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR is compilable" >&5 -$as_echo_n "checking if ioctl SIOCGIFADDR is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stropts - #include - -int main (void) -{ - - struct ifreq ifr; - if(0 != ioctl(0, SIOCGIFADDR, &ifr)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctl_siocgifaddr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctl_siocgifaddr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR usage allowed" >&5 -$as_echo_n "checking if ioctl SIOCGIFADDR usage allowed... " >&6; } - if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctl_siocgifaddr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctl_siocgifaddr="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR might be used" >&5 -$as_echo_n "checking if ioctl SIOCGIFADDR might be used... " >&6; } - if test "$tst_compi_ioctl_siocgifaddr" = "yes" && - test "$tst_allow_ioctl_siocgifaddr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTL_SIOCGIFADDR 1 -_ACEOF - - curl_cv_func_ioctl_siocgifaddr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctl_siocgifaddr="no" - fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctl="no" - fi - - - # - tst_links_ioctlsocket="unknown" - tst_proto_ioctlsocket="unknown" - tst_compi_ioctlsocket="unknown" - tst_allow_ioctlsocket="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket can be linked" >&5 -$as_echo_n "checking if ioctlsocket can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - -int main (void) -{ - - if(0 != ioctlsocket(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_ioctlsocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_ioctlsocket="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_ioctlsocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is prototyped" >&5 -$as_echo_n "checking if ioctlsocket is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "ioctlsocket" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_ioctlsocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_ioctlsocket="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_ioctlsocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is compilable" >&5 -$as_echo_n "checking if ioctlsocket is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - -int main (void) -{ - - if(0 != ioctlsocket(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctlsocket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctlsocket="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctlsocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket usage allowed" >&5 -$as_echo_n "checking if ioctlsocket usage allowed... " >&6; } - if test "x$curl_disallow_ioctlsocket" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctlsocket="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctlsocket="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket might be used" >&5 -$as_echo_n "checking if ioctlsocket might be used... " >&6; } - if test "$tst_links_ioctlsocket" = "yes" && - test "$tst_proto_ioctlsocket" = "yes" && - test "$tst_compi_ioctlsocket" = "yes" && - test "$tst_allow_ioctlsocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTLSOCKET 1 -_ACEOF - - curl_cv_func_ioctlsocket="yes" - - # - tst_compi_ioctlsocket_fionbio="unknown" - tst_allow_ioctlsocket_fionbio="unknown" - # - if test "$curl_cv_func_ioctlsocket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO is compilable" >&5 -$as_echo_n "checking if ioctlsocket FIONBIO is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - -int main (void) -{ - - int flags = 0; - if(0 != ioctlsocket(0, FIONBIO, &flags)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctlsocket_fionbio="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctlsocket_fionbio="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO usage allowed" >&5 -$as_echo_n "checking if ioctlsocket FIONBIO usage allowed... " >&6; } - if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctlsocket_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctlsocket_fionbio="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO might be used" >&5 -$as_echo_n "checking if ioctlsocket FIONBIO might be used... " >&6; } - if test "$tst_compi_ioctlsocket_fionbio" = "yes" && - test "$tst_allow_ioctlsocket_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTLSOCKET_FIONBIO 1 -_ACEOF - - curl_cv_func_ioctlsocket_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctlsocket_fionbio="no" - fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctlsocket="no" - fi - - - # - tst_links_ioctlsocket_camel="unknown" - tst_proto_ioctlsocket_camel="unknown" - tst_compi_ioctlsocket_camel="unknown" - tst_allow_ioctlsocket_camel="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket can be linked" >&5 -$as_echo_n "checking if IoctlSocket can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define IoctlSocket innocuous_IoctlSocket -#ifdef __STDC__ -# include -#else -# include -#endif -#undef IoctlSocket -#ifdef __cplusplus -extern "C" -#endif -char IoctlSocket (); -#if defined __stub_IoctlSocket || defined __stub___IoctlSocket -choke me -#endif - -int main (void) -{ -return IoctlSocket (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_ioctlsocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_ioctlsocket_camel="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_ioctlsocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is prototyped" >&5 -$as_echo_n "checking if IoctlSocket is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_stropts - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "IoctlSocket" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_ioctlsocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_ioctlsocket_camel="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_ioctlsocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is compilable" >&5 -$as_echo_n "checking if IoctlSocket is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stropts - -int main (void) -{ - - if(0 != IoctlSocket(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctlsocket_camel="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctlsocket_camel="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctlsocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket usage allowed" >&5 -$as_echo_n "checking if IoctlSocket usage allowed... " >&6; } - if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctlsocket_camel="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctlsocket_camel="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket might be used" >&5 -$as_echo_n "checking if IoctlSocket might be used... " >&6; } - if test "$tst_links_ioctlsocket_camel" = "yes" && - test "$tst_proto_ioctlsocket_camel" = "yes" && - test "$tst_compi_ioctlsocket_camel" = "yes" && - test "$tst_allow_ioctlsocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTLSOCKET_CAMEL 1 -_ACEOF - - curl_cv_func_ioctlsocket_camel="yes" - - # - tst_compi_ioctlsocket_camel_fionbio="unknown" - tst_allow_ioctlsocket_camel_fionbio="unknown" - # - if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO is compilable" >&5 -$as_echo_n "checking if IoctlSocket FIONBIO is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stropts - -int main (void) -{ - - long flags = 0; - if(0 != ioctlsocket(0, FIONBIO, &flags)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_ioctlsocket_camel_fionbio="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_ioctlsocket_camel_fionbio="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO usage allowed" >&5 -$as_echo_n "checking if IoctlSocket FIONBIO usage allowed... " >&6; } - if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_ioctlsocket_camel_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_ioctlsocket_camel_fionbio="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO might be used" >&5 -$as_echo_n "checking if IoctlSocket FIONBIO might be used... " >&6; } - if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && - test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 -_ACEOF - - curl_cv_func_ioctlsocket_camel_fionbio="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctlsocket_camel_fionbio="no" - fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_ioctlsocket_camel="no" - fi - - - # - tst_links_localtime_r="unknown" - tst_proto_localtime_r="unknown" - tst_compi_localtime_r="unknown" - tst_works_localtime_r="unknown" - tst_allow_localtime_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r can be linked" >&5 -$as_echo_n "checking if localtime_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define localtime_r innocuous_localtime_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef localtime_r -#ifdef __cplusplus -extern "C" -#endif -char localtime_r (); -#if defined __stub_localtime_r || defined __stub___localtime_r -choke me -#endif - -int main (void) -{ -return localtime_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_localtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_localtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_localtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r is prototyped" >&5 -$as_echo_n "checking if localtime_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_time - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "localtime_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_localtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_localtime_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_localtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r is compilable" >&5 -$as_echo_n "checking if localtime_r is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_time - -int main (void) -{ - - if(0 != localtime_r(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_localtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_localtime_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_localtime_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r seems to work" >&5 -$as_echo_n "checking if localtime_r seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_time - -int main (void) -{ - - time_t clock = 1170352587; - struct tm *tmp = 0; - struct tm result; - tmp = localtime_r(&clock, &result); - if(tmp) - exit(0); - else - exit(1); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_localtime_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_localtime_r="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_localtime_r" = "yes" && - test "$tst_works_localtime_r" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r usage allowed" >&5 -$as_echo_n "checking if localtime_r usage allowed... " >&6; } - if test "x$curl_disallow_localtime_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_localtime_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_localtime_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r might be used" >&5 -$as_echo_n "checking if localtime_r might be used... " >&6; } - if test "$tst_links_localtime_r" = "yes" && - test "$tst_proto_localtime_r" = "yes" && - test "$tst_compi_localtime_r" = "yes" && - test "$tst_allow_localtime_r" = "yes" && - test "$tst_works_localtime_r" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_LOCALTIME_R 1 -_ACEOF - - curl_cv_func_localtime_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_localtime_r="no" - fi - - - # - tst_links_memrchr="unknown" - tst_macro_memrchr="unknown" - tst_proto_memrchr="unknown" - tst_compi_memrchr="unknown" - tst_allow_memrchr="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr can be linked" >&5 -$as_echo_n "checking if memrchr can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define memrchr innocuous_memrchr -#ifdef __STDC__ -# include -#else -# include -#endif -#undef memrchr -#ifdef __cplusplus -extern "C" -#endif -char memrchr (); -#if defined __stub_memrchr || defined __stub___memrchr -choke me -#endif - -int main (void) -{ -return memrchr (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_memrchr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_memrchr="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_memrchr" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr seems a macro" >&5 -$as_echo_n "checking if memrchr seems a macro... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != memrchr(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_macro_memrchr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_macro_memrchr="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - # - if test "$tst_links_memrchr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr is prototyped" >&5 -$as_echo_n "checking if memrchr is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memrchr" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_memrchr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_memrchr="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_memrchr" = "yes" || - test "$tst_macro_memrchr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr is compilable" >&5 -$as_echo_n "checking if memrchr is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != memrchr(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_memrchr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_memrchr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_memrchr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr usage allowed" >&5 -$as_echo_n "checking if memrchr usage allowed... " >&6; } - if test "x$curl_disallow_memrchr" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_memrchr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_memrchr="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr might be used" >&5 -$as_echo_n "checking if memrchr might be used... " >&6; } - if (test "$tst_proto_memrchr" = "yes" || - test "$tst_macro_memrchr" = "yes") && - test "$tst_compi_memrchr" = "yes" && - test "$tst_allow_memrchr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_MEMRCHR 1 -_ACEOF - - curl_cv_func_memrchr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_memrchr="no" - fi - - - # - tst_links_poll="unknown" - tst_proto_poll="unknown" - tst_compi_poll="unknown" - tst_works_poll="unknown" - tst_allow_poll="unknown" - # - case $host_os in - darwin*|interix*) - curl_disallow_poll="yes" - tst_compi_poll="no" - ;; - esac - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll can be linked" >&5 -$as_echo_n "checking if poll can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_poll - -int main (void) -{ - - if(0 != poll(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_poll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_poll="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_poll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll is prototyped" >&5 -$as_echo_n "checking if poll is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_poll - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "poll" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_poll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_poll="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_poll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll is compilable" >&5 -$as_echo_n "checking if poll is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_poll - -int main (void) -{ - - if(0 != poll(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_poll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_poll="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_compi_poll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll seems to work" >&5 -$as_echo_n "checking if poll seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_poll - $curl_includes_time - -int main (void) -{ - - /* detect the original poll() breakage */ - if(0 != poll(0, 0, 10)) - exit(1); /* fail */ - else { - /* detect the 10.12 poll() breakage */ - struct timeval before, after; - int rc; - size_t us; - - gettimeofday(&before, NULL); - rc = poll(NULL, 0, 500); - gettimeofday(&after, NULL); - - us = (after.tv_sec - before.tv_sec) * 1000000 + - (after.tv_usec - before.tv_usec); - - if(us < 400000) - exit(1); - } - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_poll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_poll="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_poll" = "yes" && - test "$tst_works_poll" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll usage allowed" >&5 -$as_echo_n "checking if poll usage allowed... " >&6; } - if test "x$curl_disallow_poll" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_poll="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_poll="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll might be used" >&5 -$as_echo_n "checking if poll might be used... " >&6; } - if test "$tst_links_poll" = "yes" && - test "$tst_proto_poll" = "yes" && - test "$tst_compi_poll" = "yes" && - test "$tst_allow_poll" = "yes" && - test "$tst_works_poll" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_POLL 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define HAVE_POLL_FINE 1 -_ACEOF - - curl_cv_func_poll="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_poll="no" - fi - - - # - tst_links_setsockopt="unknown" - tst_proto_setsockopt="unknown" - tst_compi_setsockopt="unknown" - tst_allow_setsockopt="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt can be linked" >&5 -$as_echo_n "checking if setsockopt can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - -int main (void) -{ - - if(0 != setsockopt(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_setsockopt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_setsockopt="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_setsockopt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is prototyped" >&5 -$as_echo_n "checking if setsockopt is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_sys_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "setsockopt" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_setsockopt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_setsockopt="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_setsockopt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is compilable" >&5 -$as_echo_n "checking if setsockopt is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - -int main (void) -{ - - if(0 != setsockopt(0, 0, 0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_setsockopt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_setsockopt="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_setsockopt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt usage allowed" >&5 -$as_echo_n "checking if setsockopt usage allowed... " >&6; } - if test "x$curl_disallow_setsockopt" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_setsockopt="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_setsockopt="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt might be used" >&5 -$as_echo_n "checking if setsockopt might be used... " >&6; } - if test "$tst_links_setsockopt" = "yes" && - test "$tst_proto_setsockopt" = "yes" && - test "$tst_compi_setsockopt" = "yes" && - test "$tst_allow_setsockopt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SETSOCKOPT 1 -_ACEOF - - curl_cv_func_setsockopt="yes" - - # - tst_compi_setsockopt_so_nonblock="unknown" - tst_allow_setsockopt_so_nonblock="unknown" - # - if test "$curl_cv_func_setsockopt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK is compilable" >&5 -$as_echo_n "checking if setsockopt SO_NONBLOCK is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - -int main (void) -{ - - if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_setsockopt_so_nonblock="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_setsockopt_so_nonblock="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK usage allowed" >&5 -$as_echo_n "checking if setsockopt SO_NONBLOCK usage allowed... " >&6; } - if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_setsockopt_so_nonblock="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_setsockopt_so_nonblock="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK might be used" >&5 -$as_echo_n "checking if setsockopt SO_NONBLOCK might be used... " >&6; } - if test "$tst_compi_setsockopt_so_nonblock" = "yes" && - test "$tst_allow_setsockopt_so_nonblock" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SETSOCKOPT_SO_NONBLOCK 1 -_ACEOF - - curl_cv_func_setsockopt_so_nonblock="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_setsockopt_so_nonblock="no" - fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_setsockopt="no" - fi - - -curl_includes_signal="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SIGNAL_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h signal.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_signal -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_sigaction="unknown" - tst_proto_sigaction="unknown" - tst_compi_sigaction="unknown" - tst_allow_sigaction="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction can be linked" >&5 -$as_echo_n "checking if sigaction can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define sigaction innocuous_sigaction -#ifdef __STDC__ -# include -#else -# include -#endif -#undef sigaction -#ifdef __cplusplus -extern "C" -#endif -char sigaction (); -#if defined __stub_sigaction || defined __stub___sigaction -choke me -#endif - -int main (void) -{ -return sigaction (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_sigaction="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_sigaction="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_sigaction" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction is prototyped" >&5 -$as_echo_n "checking if sigaction is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_signal - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sigaction" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_sigaction="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_sigaction="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_sigaction" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction is compilable" >&5 -$as_echo_n "checking if sigaction is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_signal - -int main (void) -{ - - if(0 != sigaction(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_sigaction="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_sigaction="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_sigaction" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction usage allowed" >&5 -$as_echo_n "checking if sigaction usage allowed... " >&6; } - if test "x$curl_disallow_sigaction" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_sigaction="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_sigaction="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction might be used" >&5 -$as_echo_n "checking if sigaction might be used... " >&6; } - if test "$tst_links_sigaction" = "yes" && - test "$tst_proto_sigaction" = "yes" && - test "$tst_compi_sigaction" = "yes" && - test "$tst_allow_sigaction" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGACTION 1 -_ACEOF - - curl_cv_func_sigaction="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_sigaction="no" - fi - - - # - tst_links_siginterrupt="unknown" - tst_proto_siginterrupt="unknown" - tst_compi_siginterrupt="unknown" - tst_allow_siginterrupt="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt can be linked" >&5 -$as_echo_n "checking if siginterrupt can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define siginterrupt innocuous_siginterrupt -#ifdef __STDC__ -# include -#else -# include -#endif -#undef siginterrupt -#ifdef __cplusplus -extern "C" -#endif -char siginterrupt (); -#if defined __stub_siginterrupt || defined __stub___siginterrupt -choke me -#endif - -int main (void) -{ -return siginterrupt (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_siginterrupt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_siginterrupt="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_siginterrupt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt is prototyped" >&5 -$as_echo_n "checking if siginterrupt is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_signal - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "siginterrupt" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_siginterrupt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_siginterrupt="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_siginterrupt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt is compilable" >&5 -$as_echo_n "checking if siginterrupt is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_signal - -int main (void) -{ - - if(0 != siginterrupt(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_siginterrupt="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_siginterrupt="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_siginterrupt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt usage allowed" >&5 -$as_echo_n "checking if siginterrupt usage allowed... " >&6; } - if test "x$curl_disallow_siginterrupt" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_siginterrupt="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_siginterrupt="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt might be used" >&5 -$as_echo_n "checking if siginterrupt might be used... " >&6; } - if test "$tst_links_siginterrupt" = "yes" && - test "$tst_proto_siginterrupt" = "yes" && - test "$tst_compi_siginterrupt" = "yes" && - test "$tst_allow_siginterrupt" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGINTERRUPT 1 -_ACEOF - - curl_cv_func_siginterrupt="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_siginterrupt="no" - fi - - - # - tst_links_signal="unknown" - tst_proto_signal="unknown" - tst_compi_signal="unknown" - tst_allow_signal="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal can be linked" >&5 -$as_echo_n "checking if signal can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define signal innocuous_signal -#ifdef __STDC__ -# include -#else -# include -#endif -#undef signal -#ifdef __cplusplus -extern "C" -#endif -char signal (); -#if defined __stub_signal || defined __stub___signal -choke me -#endif - -int main (void) -{ -return signal (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_signal="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_signal="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_signal" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal is prototyped" >&5 -$as_echo_n "checking if signal is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_signal - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "signal" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_signal="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_signal="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_signal" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal is compilable" >&5 -$as_echo_n "checking if signal is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_signal - -int main (void) -{ - - if(0 != signal(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_signal="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_signal="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_signal" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal usage allowed" >&5 -$as_echo_n "checking if signal usage allowed... " >&6; } - if test "x$curl_disallow_signal" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_signal="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_signal="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal might be used" >&5 -$as_echo_n "checking if signal might be used... " >&6; } - if test "$tst_links_signal" = "yes" && - test "$tst_proto_signal" = "yes" && - test "$tst_compi_signal" = "yes" && - test "$tst_allow_signal" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNAL 1 -_ACEOF - - curl_cv_func_signal="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_signal="no" - fi - - -curl_includes_setjmp="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SETJMP_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h setjmp.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_setjmp -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_sigsetjmp="unknown" - tst_macro_sigsetjmp="unknown" - tst_proto_sigsetjmp="unknown" - tst_compi_sigsetjmp="unknown" - tst_allow_sigsetjmp="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp can be linked" >&5 -$as_echo_n "checking if sigsetjmp can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define sigsetjmp innocuous_sigsetjmp -#ifdef __STDC__ -# include -#else -# include -#endif -#undef sigsetjmp -#ifdef __cplusplus -extern "C" -#endif -char sigsetjmp (); -#if defined __stub_sigsetjmp || defined __stub___sigsetjmp -choke me -#endif - -int main (void) -{ -return sigsetjmp (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_sigsetjmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_sigsetjmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_sigsetjmp" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp seems a macro" >&5 -$as_echo_n "checking if sigsetjmp seems a macro... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_setjmp - -int main (void) -{ - - sigjmp_buf env; - if(0 != sigsetjmp(env, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_macro_sigsetjmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_macro_sigsetjmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - # - if test "$tst_links_sigsetjmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp is prototyped" >&5 -$as_echo_n "checking if sigsetjmp is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_setjmp - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sigsetjmp" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_sigsetjmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_sigsetjmp="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_sigsetjmp" = "yes" || - test "$tst_macro_sigsetjmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp is compilable" >&5 -$as_echo_n "checking if sigsetjmp is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_setjmp - -int main (void) -{ - - sigjmp_buf env; - if(0 != sigsetjmp(env, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_sigsetjmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_sigsetjmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_sigsetjmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp usage allowed" >&5 -$as_echo_n "checking if sigsetjmp usage allowed... " >&6; } - if test "x$curl_disallow_sigsetjmp" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_sigsetjmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_sigsetjmp="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp might be used" >&5 -$as_echo_n "checking if sigsetjmp might be used... " >&6; } - if (test "$tst_proto_sigsetjmp" = "yes" || - test "$tst_macro_sigsetjmp" = "yes") && - test "$tst_compi_sigsetjmp" = "yes" && - test "$tst_allow_sigsetjmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGSETJMP 1 -_ACEOF - - curl_cv_func_sigsetjmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_sigsetjmp="no" - fi - - - # - tst_links_socket="unknown" - tst_proto_socket="unknown" - tst_compi_socket="unknown" - tst_allow_socket="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket can be linked" >&5 -$as_echo_n "checking if socket can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -int main (void) -{ - - if(0 != socket(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_socket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_socket="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_socket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is prototyped" >&5 -$as_echo_n "checking if socket is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "socket" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_socket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_socket="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_socket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is compilable" >&5 -$as_echo_n "checking if socket is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_winsock2 - $curl_includes_sys_socket - $curl_includes_socket - -int main (void) -{ - - if(0 != socket(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_socket="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_socket="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_socket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket usage allowed" >&5 -$as_echo_n "checking if socket usage allowed... " >&6; } - if test "x$curl_disallow_socket" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_socket="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_socket="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket might be used" >&5 -$as_echo_n "checking if socket might be used... " >&6; } - if test "$tst_links_socket" = "yes" && - test "$tst_proto_socket" = "yes" && - test "$tst_compi_socket" = "yes" && - test "$tst_allow_socket" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SOCKET 1 -_ACEOF - - curl_cv_func_socket="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_socket="no" - fi - - - # - tst_links_socketpair="unknown" - tst_proto_socketpair="unknown" - tst_compi_socketpair="unknown" - tst_allow_socketpair="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socketpair can be linked" >&5 -$as_echo_n "checking if socketpair can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define socketpair innocuous_socketpair -#ifdef __STDC__ -# include -#else -# include -#endif -#undef socketpair -#ifdef __cplusplus -extern "C" -#endif -char socketpair (); -#if defined __stub_socketpair || defined __stub___socketpair -choke me -#endif - -int main (void) -{ -return socketpair (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_socketpair="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_socketpair="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_socketpair" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socketpair is prototyped" >&5 -$as_echo_n "checking if socketpair is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_sys_socket - $curl_includes_socket - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "socketpair" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_socketpair="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_socketpair="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_socketpair" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socketpair is compilable" >&5 -$as_echo_n "checking if socketpair is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_socket - $curl_includes_socket - -int main (void) -{ - - int sv[2]; - if(0 != socketpair(0, 0, 0, sv)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_socketpair="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_socketpair="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_socketpair" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socketpair usage allowed" >&5 -$as_echo_n "checking if socketpair usage allowed... " >&6; } - if test "x$curl_disallow_socketpair" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_socketpair="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_socketpair="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socketpair might be used" >&5 -$as_echo_n "checking if socketpair might be used... " >&6; } - if test "$tst_links_socketpair" = "yes" && - test "$tst_proto_socketpair" = "yes" && - test "$tst_compi_socketpair" = "yes" && - test "$tst_allow_socketpair" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_SOCKETPAIR 1 -_ACEOF - - curl_cv_func_socketpair="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_socketpair="no" - fi - - - # - tst_links_strcasecmp="unknown" - tst_proto_strcasecmp="unknown" - tst_compi_strcasecmp="unknown" - tst_allow_strcasecmp="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp can be linked" >&5 -$as_echo_n "checking if strcasecmp can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strcasecmp innocuous_strcasecmp -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strcasecmp -#ifdef __cplusplus -extern "C" -#endif -char strcasecmp (); -#if defined __stub_strcasecmp || defined __stub___strcasecmp -choke me -#endif - -int main (void) -{ -return strcasecmp (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strcasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strcasecmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strcasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is prototyped" >&5 -$as_echo_n "checking if strcasecmp is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strcasecmp" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strcasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strcasecmp="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strcasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is compilable" >&5 -$as_echo_n "checking if strcasecmp is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strcasecmp(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strcasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strcasecmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strcasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp usage allowed" >&5 -$as_echo_n "checking if strcasecmp usage allowed... " >&6; } - if test "x$curl_disallow_strcasecmp" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strcasecmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strcasecmp="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp might be used" >&5 -$as_echo_n "checking if strcasecmp might be used... " >&6; } - if test "$tst_links_strcasecmp" = "yes" && - test "$tst_proto_strcasecmp" = "yes" && - test "$tst_compi_strcasecmp" = "yes" && - test "$tst_allow_strcasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRCASECMP 1 -_ACEOF - - curl_cv_func_strcasecmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strcasecmp="no" - fi - - - # - tst_links_strcmpi="unknown" - tst_proto_strcmpi="unknown" - tst_compi_strcmpi="unknown" - tst_allow_strcmpi="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi can be linked" >&5 -$as_echo_n "checking if strcmpi can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strcmpi innocuous_strcmpi -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strcmpi -#ifdef __cplusplus -extern "C" -#endif -char strcmpi (); -#if defined __stub_strcmpi || defined __stub___strcmpi -choke me -#endif - -int main (void) -{ -return strcmpi (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strcmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strcmpi="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strcmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is prototyped" >&5 -$as_echo_n "checking if strcmpi is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strcmpi" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strcmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strcmpi="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strcmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is compilable" >&5 -$as_echo_n "checking if strcmpi is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strcmpi(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strcmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strcmpi="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strcmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi usage allowed" >&5 -$as_echo_n "checking if strcmpi usage allowed... " >&6; } - if test "x$curl_disallow_strcmpi" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strcmpi="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strcmpi="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi might be used" >&5 -$as_echo_n "checking if strcmpi might be used... " >&6; } - if test "$tst_links_strcmpi" = "yes" && - test "$tst_proto_strcmpi" = "yes" && - test "$tst_compi_strcmpi" = "yes" && - test "$tst_allow_strcmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRCMPI 1 -_ACEOF - - curl_cv_func_strcmpi="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strcmpi="no" - fi - - - # - tst_links_strdup="unknown" - tst_proto_strdup="unknown" - tst_compi_strdup="unknown" - tst_allow_strdup="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup can be linked" >&5 -$as_echo_n "checking if strdup can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strdup innocuous_strdup -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strdup -#ifdef __cplusplus -extern "C" -#endif -char strdup (); -#if defined __stub_strdup || defined __stub___strdup -choke me -#endif - -int main (void) -{ -return strdup (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strdup="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strdup="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strdup" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is prototyped" >&5 -$as_echo_n "checking if strdup is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strdup" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strdup="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strdup="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strdup" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is compilable" >&5 -$as_echo_n "checking if strdup is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strdup(0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strdup="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strdup="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strdup" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup usage allowed" >&5 -$as_echo_n "checking if strdup usage allowed... " >&6; } - if test "x$curl_disallow_strdup" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strdup="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strdup="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup might be used" >&5 -$as_echo_n "checking if strdup might be used... " >&6; } - if test "$tst_links_strdup" = "yes" && - test "$tst_proto_strdup" = "yes" && - test "$tst_compi_strdup" = "yes" && - test "$tst_allow_strdup" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRDUP 1 -_ACEOF - - curl_cv_func_strdup="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strdup="no" - fi - - - # - tst_links_strerror_r="unknown" - tst_proto_strerror_r="unknown" - tst_compi_strerror_r="unknown" - tst_glibc_strerror_r="unknown" - tst_posix_strerror_r="unknown" - tst_allow_strerror_r="unknown" - tst_works_glibc_strerror_r="unknown" - tst_works_posix_strerror_r="unknown" - tst_glibc_strerror_r_type_arg3="unknown" - tst_posix_strerror_r_type_arg3="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r can be linked" >&5 -$as_echo_n "checking if strerror_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strerror_r innocuous_strerror_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strerror_r -#ifdef __cplusplus -extern "C" -#endif -char strerror_r (); -#if defined __stub_strerror_r || defined __stub___strerror_r -choke me -#endif - -int main (void) -{ -return strerror_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strerror_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strerror_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is prototyped" >&5 -$as_echo_n "checking if strerror_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strerror_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strerror_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strerror_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is compilable" >&5 -$as_echo_n "checking if strerror_r is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strerror_r(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strerror_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strerror_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is glibc like" >&5 -$as_echo_n "checking if strerror_r is glibc like... " >&6; } - tst_glibc_strerror_r_type_arg3="unknown" - for arg3 in 'size_t' 'int' 'unsigned int'; do - if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); - -int main (void) -{ - - if(0 != strerror_r(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_glibc_strerror_r_type_arg3="$arg3" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - case "$tst_glibc_strerror_r_type_arg3" in - unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_glibc_strerror_r="no" - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_glibc_strerror_r="yes" - ;; - esac - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_glibc_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r seems to work" >&5 -$as_echo_n "checking if strerror_r seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_string -# include - -int main (void) -{ - - char buffer[1024]; - char *string = 0; - buffer[0] = '\0'; - string = strerror_r(EACCES, buffer, sizeof(buffer)); - if(!string) - exit(1); /* fail */ - if(!string[0]) - exit(1); /* fail */ - else - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_glibc_strerror_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_glibc_strerror_r="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_compi_strerror_r" = "yes" && - test "$tst_works_glibc_strerror_r" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is POSIX like" >&5 -$as_echo_n "checking if strerror_r is POSIX like... " >&6; } - tst_posix_strerror_r_type_arg3="unknown" - for arg3 in 'size_t' 'int' 'unsigned int'; do - if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); - -int main (void) -{ - - if(0 != strerror_r(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - tst_posix_strerror_r_type_arg3="$arg3" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - case "$tst_posix_strerror_r_type_arg3" in - unknown) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_posix_strerror_r="no" - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_posix_strerror_r="yes" - ;; - esac - fi - # - if test "x$cross_compiling" != "xyes" && - test "$tst_posix_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r seems to work" >&5 -$as_echo_n "checking if strerror_r seems to work... " >&6; } - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - $curl_includes_string -# include - -int main (void) -{ - - char buffer[1024]; - int error = 1; - buffer[0] = '\0'; - error = strerror_r(EACCES, buffer, sizeof(buffer)); - if(error) - exit(1); /* fail */ - if(buffer[0] == '\0') - exit(1); /* fail */ - else - exit(0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_works_posix_strerror_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_works_posix_strerror_r="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - # - if test "$tst_works_glibc_strerror_r" = "yes"; then - tst_posix_strerror_r="no" - fi - if test "$tst_works_posix_strerror_r" = "yes"; then - tst_glibc_strerror_r="no" - fi - if test "$tst_glibc_strerror_r" = "yes" && - test "$tst_works_glibc_strerror_r" != "no" && - test "$tst_posix_strerror_r" != "yes"; then - tst_allow_strerror_r="check" - fi - if test "$tst_posix_strerror_r" = "yes" && - test "$tst_works_posix_strerror_r" != "no" && - test "$tst_glibc_strerror_r" != "yes"; then - tst_allow_strerror_r="check" - fi - if test "$tst_allow_strerror_r" = "check"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r usage allowed" >&5 -$as_echo_n "checking if strerror_r usage allowed... " >&6; } - if test "x$curl_disallow_strerror_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strerror_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strerror_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r might be used" >&5 -$as_echo_n "checking if strerror_r might be used... " >&6; } - if test "$tst_links_strerror_r" = "yes" && - test "$tst_proto_strerror_r" = "yes" && - test "$tst_compi_strerror_r" = "yes" && - test "$tst_allow_strerror_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - if test "$tst_glibc_strerror_r" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRERROR_R 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define HAVE_GLIBC_STRERROR_R 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define STRERROR_R_TYPE_ARG3 $tst_glibc_strerror_r_type_arg3 -_ACEOF - - fi - if test "$tst_posix_strerror_r" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRERROR_R 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define HAVE_POSIX_STRERROR_R 1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define STRERROR_R_TYPE_ARG3 $tst_posix_strerror_r_type_arg3 -_ACEOF - - fi - curl_cv_func_strerror_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strerror_r="no" - fi - # - if test "$tst_compi_strerror_r" = "yes" && - test "$tst_allow_strerror_r" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine strerror_r() style: edit lib/curl_config.h manually." >&5 -$as_echo "$as_me: WARNING: cannot determine strerror_r() style: edit lib/curl_config.h manually." >&2;} - fi - # - - - # - tst_links_stricmp="unknown" - tst_proto_stricmp="unknown" - tst_compi_stricmp="unknown" - tst_allow_stricmp="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp can be linked" >&5 -$as_echo_n "checking if stricmp can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define stricmp innocuous_stricmp -#ifdef __STDC__ -# include -#else -# include -#endif -#undef stricmp -#ifdef __cplusplus -extern "C" -#endif -char stricmp (); -#if defined __stub_stricmp || defined __stub___stricmp -choke me -#endif - -int main (void) -{ -return stricmp (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_stricmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_stricmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_stricmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is prototyped" >&5 -$as_echo_n "checking if stricmp is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "stricmp" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_stricmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_stricmp="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_stricmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is compilable" >&5 -$as_echo_n "checking if stricmp is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != stricmp(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_stricmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_stricmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_stricmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp usage allowed" >&5 -$as_echo_n "checking if stricmp usage allowed... " >&6; } - if test "x$curl_disallow_stricmp" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_stricmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_stricmp="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp might be used" >&5 -$as_echo_n "checking if stricmp might be used... " >&6; } - if test "$tst_links_stricmp" = "yes" && - test "$tst_proto_stricmp" = "yes" && - test "$tst_compi_stricmp" = "yes" && - test "$tst_allow_stricmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRICMP 1 -_ACEOF - - curl_cv_func_stricmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_stricmp="no" - fi - - - # - tst_links_strncasecmp="unknown" - tst_proto_strncasecmp="unknown" - tst_compi_strncasecmp="unknown" - tst_allow_strncasecmp="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp can be linked" >&5 -$as_echo_n "checking if strncasecmp can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strncasecmp innocuous_strncasecmp -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strncasecmp -#ifdef __cplusplus -extern "C" -#endif -char strncasecmp (); -#if defined __stub_strncasecmp || defined __stub___strncasecmp -choke me -#endif - -int main (void) -{ -return strncasecmp (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strncasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strncasecmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strncasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is prototyped" >&5 -$as_echo_n "checking if strncasecmp is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strncasecmp" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strncasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strncasecmp="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strncasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is compilable" >&5 -$as_echo_n "checking if strncasecmp is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strncasecmp(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strncasecmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strncasecmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strncasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp usage allowed" >&5 -$as_echo_n "checking if strncasecmp usage allowed... " >&6; } - if test "x$curl_disallow_strncasecmp" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strncasecmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strncasecmp="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp might be used" >&5 -$as_echo_n "checking if strncasecmp might be used... " >&6; } - if test "$tst_links_strncasecmp" = "yes" && - test "$tst_proto_strncasecmp" = "yes" && - test "$tst_compi_strncasecmp" = "yes" && - test "$tst_allow_strncasecmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRNCASECMP 1 -_ACEOF - - curl_cv_func_strncasecmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strncasecmp="no" - fi - - - # - tst_links_strncmpi="unknown" - tst_proto_strncmpi="unknown" - tst_compi_strncmpi="unknown" - tst_allow_strncmpi="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi can be linked" >&5 -$as_echo_n "checking if strncmpi can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strncmpi innocuous_strncmpi -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strncmpi -#ifdef __cplusplus -extern "C" -#endif -char strncmpi (); -#if defined __stub_strncmpi || defined __stub___strncmpi -choke me -#endif - -int main (void) -{ -return strncmpi (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strncmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strncmpi="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strncmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is prototyped" >&5 -$as_echo_n "checking if strncmpi is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strncmpi" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strncmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strncmpi="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strncmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is compilable" >&5 -$as_echo_n "checking if strncmpi is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strncmpi(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strncmpi="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strncmpi="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strncmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi usage allowed" >&5 -$as_echo_n "checking if strncmpi usage allowed... " >&6; } - if test "x$curl_disallow_strncmpi" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strncmpi="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strncmpi="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi might be used" >&5 -$as_echo_n "checking if strncmpi might be used... " >&6; } - if test "$tst_links_strncmpi" = "yes" && - test "$tst_proto_strncmpi" = "yes" && - test "$tst_compi_strncmpi" = "yes" && - test "$tst_allow_strncmpi" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRNCMPI 1 -_ACEOF - - curl_cv_func_strncmpi="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strncmpi="no" - fi - - - # - tst_links_strnicmp="unknown" - tst_proto_strnicmp="unknown" - tst_compi_strnicmp="unknown" - tst_allow_strnicmp="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp can be linked" >&5 -$as_echo_n "checking if strnicmp can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strnicmp innocuous_strnicmp -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strnicmp -#ifdef __cplusplus -extern "C" -#endif -char strnicmp (); -#if defined __stub_strnicmp || defined __stub___strnicmp -choke me -#endif - -int main (void) -{ -return strnicmp (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strnicmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strnicmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strnicmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is prototyped" >&5 -$as_echo_n "checking if strnicmp is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strnicmp" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strnicmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strnicmp="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strnicmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is compilable" >&5 -$as_echo_n "checking if strnicmp is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strnicmp(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strnicmp="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strnicmp="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strnicmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp usage allowed" >&5 -$as_echo_n "checking if strnicmp usage allowed... " >&6; } - if test "x$curl_disallow_strnicmp" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strnicmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strnicmp="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp might be used" >&5 -$as_echo_n "checking if strnicmp might be used... " >&6; } - if test "$tst_links_strnicmp" = "yes" && - test "$tst_proto_strnicmp" = "yes" && - test "$tst_compi_strnicmp" = "yes" && - test "$tst_allow_strnicmp" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRNICMP 1 -_ACEOF - - curl_cv_func_strnicmp="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strnicmp="no" - fi - - - # - tst_links_strstr="unknown" - tst_proto_strstr="unknown" - tst_compi_strstr="unknown" - tst_allow_strstr="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr can be linked" >&5 -$as_echo_n "checking if strstr can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strstr innocuous_strstr -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strstr -#ifdef __cplusplus -extern "C" -#endif -char strstr (); -#if defined __stub_strstr || defined __stub___strstr -choke me -#endif - -int main (void) -{ -return strstr (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strstr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strstr="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strstr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr is prototyped" >&5 -$as_echo_n "checking if strstr is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strstr" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strstr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strstr="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strstr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr is compilable" >&5 -$as_echo_n "checking if strstr is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strstr(0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strstr="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strstr="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strstr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr usage allowed" >&5 -$as_echo_n "checking if strstr usage allowed... " >&6; } - if test "x$curl_disallow_strstr" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strstr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strstr="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr might be used" >&5 -$as_echo_n "checking if strstr might be used... " >&6; } - if test "$tst_links_strstr" = "yes" && - test "$tst_proto_strstr" = "yes" && - test "$tst_compi_strstr" = "yes" && - test "$tst_allow_strstr" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRSTR 1 -_ACEOF - - curl_cv_func_strstr="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strstr="no" - fi - - - # - tst_links_strtok_r="unknown" - tst_proto_strtok_r="unknown" - tst_compi_strtok_r="unknown" - tst_allow_strtok_r="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r can be linked" >&5 -$as_echo_n "checking if strtok_r can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strtok_r innocuous_strtok_r -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strtok_r -#ifdef __cplusplus -extern "C" -#endif -char strtok_r (); -#if defined __stub_strtok_r || defined __stub___strtok_r -choke me -#endif - -int main (void) -{ -return strtok_r (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strtok_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strtok_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strtok_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r is prototyped" >&5 -$as_echo_n "checking if strtok_r is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_string - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtok_r" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strtok_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strtok_r="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strtok_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r is compilable" >&5 -$as_echo_n "checking if strtok_r is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_string - -int main (void) -{ - - if(0 != strtok_r(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strtok_r="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strtok_r="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strtok_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r usage allowed" >&5 -$as_echo_n "checking if strtok_r usage allowed... " >&6; } - if test "x$curl_disallow_strtok_r" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strtok_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strtok_r="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r might be used" >&5 -$as_echo_n "checking if strtok_r might be used... " >&6; } - if test "$tst_links_strtok_r" = "yes" && - test "$tst_proto_strtok_r" = "yes" && - test "$tst_compi_strtok_r" = "yes" && - test "$tst_allow_strtok_r" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRTOK_R 1 -_ACEOF - - curl_cv_func_strtok_r="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strtok_r="no" - fi - - - # - tst_links_strtoll="unknown" - tst_proto_strtoll="unknown" - tst_compi_strtoll="unknown" - tst_allow_strtoll="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll can be linked" >&5 -$as_echo_n "checking if strtoll can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define strtoll innocuous_strtoll -#ifdef __STDC__ -# include -#else -# include -#endif -#undef strtoll -#ifdef __cplusplus -extern "C" -#endif -char strtoll (); -#if defined __stub_strtoll || defined __stub___strtoll -choke me -#endif - -int main (void) -{ -return strtoll (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_strtoll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_strtoll="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_strtoll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll is prototyped" >&5 -$as_echo_n "checking if strtoll is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_stdlib - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtoll" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_strtoll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_strtoll="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_strtoll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll is compilable" >&5 -$as_echo_n "checking if strtoll is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_stdlib - -int main (void) -{ - - if(0 != strtoll(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_strtoll="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_strtoll="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_strtoll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll usage allowed" >&5 -$as_echo_n "checking if strtoll usage allowed... " >&6; } - if test "x$curl_disallow_strtoll" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_strtoll="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_strtoll="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll might be used" >&5 -$as_echo_n "checking if strtoll might be used... " >&6; } - if test "$tst_links_strtoll" = "yes" && - test "$tst_proto_strtoll" = "yes" && - test "$tst_compi_strtoll" = "yes" && - test "$tst_allow_strtoll" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRTOLL 1 -_ACEOF - - curl_cv_func_strtoll="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_strtoll="no" - fi - - -curl_includes_sys_uio="\ -/* includes start */ -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_UIO_H -# include -#endif -/* includes end */" - for ac_header in sys/types.h sys/uio.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_uio -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - # - tst_links_writev="unknown" - tst_proto_writev="unknown" - tst_compi_writev="unknown" - tst_allow_writev="unknown" - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev can be linked" >&5 -$as_echo_n "checking if writev can be linked... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define writev innocuous_writev -#ifdef __STDC__ -# include -#else -# include -#endif -#undef writev -#ifdef __cplusplus -extern "C" -#endif -char writev (); -#if defined __stub_writev || defined __stub___writev -choke me -#endif - -int main (void) -{ -return writev (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_links_writev="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_links_writev="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$tst_links_writev" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is prototyped" >&5 -$as_echo_n "checking if writev is prototyped... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - $curl_includes_sys_uio - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "writev" >/dev/null 2>&1; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_proto_writev="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_proto_writev="no" - -fi -rm -f conftest* - - fi - # - if test "$tst_proto_writev" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is compilable" >&5 -$as_echo_n "checking if writev is compilable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - $curl_includes_sys_uio - -int main (void) -{ - - if(0 != writev(0, 0, 0)) - return 1; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_compi_writev="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_compi_writev="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - # - if test "$tst_compi_writev" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev usage allowed" >&5 -$as_echo_n "checking if writev usage allowed... " >&6; } - if test "x$curl_disallow_writev" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - tst_allow_writev="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - tst_allow_writev="no" - fi - fi - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev might be used" >&5 -$as_echo_n "checking if writev might be used... " >&6; } - if test "$tst_links_writev" = "yes" && - test "$tst_proto_writev" = "yes" && - test "$tst_compi_writev" = "yes" && - test "$tst_allow_writev" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define HAVE_WRITEV 1 -_ACEOF - - curl_cv_func_writev="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_func_writev="no" - fi - - -case $host in - *msdosdjgpp) - ac_cv_func_pipe=no - skipcheck_pipe=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: skip check for pipe on msdosdjgpp" >&5 -$as_echo "$as_me: skip check for pipe on msdosdjgpp" >&6;} - ;; -esac - -for ac_func in geteuid \ - getpass_r \ - getppid \ - getpwuid \ - getpwuid_r \ - getrlimit \ - gettimeofday \ - if_nametoindex \ - pipe \ - setlocale \ - setmode \ - setrlimit \ - utime \ - utimes - -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - - -else - - func="$ac_func" - eval skipcheck=\$skipcheck_$func - if test "x$skipcheck" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for $func" >&5 -$as_echo_n "checking deeper for $func... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - $func (); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - eval "ac_cv_func_$func=yes" - -cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$func" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | sed 's/^A-Z0-9_/_/g'` 1 -_ACEOF - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 -$as_echo "but still no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - -fi -done - - - - for ac_header in sys/types.h sys/socket.h netdb.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo" >&5 -$as_echo_n "checking for getnameinfo... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#define getnameinfo innocuous_getnameinfo -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getnameinfo -#ifdef __cplusplus -extern "C" -#endif -char getnameinfo (); -#if defined __stub_getnameinfo || defined __stub___getnameinfo -choke me -#endif - -int main (void) -{ -return getnameinfo (); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_getnameinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - curl_cv_getnameinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - # - if test "$curl_cv_getnameinfo" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for getnameinfo" >&5 -$as_echo_n "checking deeper for getnameinfo... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - -int main (void) -{ - - getnameinfo(); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_getnameinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 -$as_echo "but still no" >&6; } - curl_cv_getnameinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - # - if test "$curl_cv_getnameinfo" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper and deeper for getnameinfo" >&5 -$as_echo_n "checking deeper and deeper for getnameinfo... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#endif - -int main (void) -{ - - getnameinfo(0, 0, 0, 0, 0, 0, 0); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - curl_cv_getnameinfo="yes" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 -$as_echo "but still no" >&6; } - curl_cv_getnameinfo="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - # - if test "$curl_cv_getnameinfo" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for getnameinfo" >&5 -$as_echo_n "checking types of arguments for getnameinfo... " >&6; } -if ${curl_cv_func_getnameinfo_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - - curl_cv_func_getnameinfo_args="unknown" - for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do - for gni_arg2 in 'socklen_t' 'size_t' 'int'; do - for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do - for gni_arg7 in 'int' 'unsigned int'; do - if test "$curl_cv_func_getnameinfo_args" = "unknown"; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#define GNICALLCONV WSAAPI -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#define GNICALLCONV -#endif - extern int GNICALLCONV -#ifdef __ANDROID__ -__attribute__((overloadable)) -#endif - getnameinfo($gni_arg1, $gni_arg2, - char *, $gni_arg46, - char *, $gni_arg46, - $gni_arg7); - -int main (void) -{ - - $gni_arg2 salen=0; - $gni_arg46 hostlen=0; - $gni_arg46 servlen=0; - $gni_arg7 flags=0; - int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - done - done - done - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_getnameinfo_args" >&5 -$as_echo "$curl_cv_func_getnameinfo_args" >&6; } # AC-CACHE-CHECK - if test "$curl_cv_func_getnameinfo_args" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for getnameinfo args" >&5 -$as_echo "$as_me: WARNING: Cannot find proper types to use for getnameinfo args" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_GETNAMEINFO will not be defined" >&5 -$as_echo "$as_me: WARNING: HAVE_GETNAMEINFO will not be defined" >&2;} - else - gni_prev_IFS=$IFS; IFS=',' - set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` - IFS=$gni_prev_IFS - shift - # - gni_qual_type_arg1=$1 - # - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG2 $2 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG46 $3 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG7 $4 -_ACEOF - - # - prev_sh_opts=$- - # - case $prev_sh_opts in - *f*) - ;; - *) - set -f - ;; - esac - # - case "$gni_qual_type_arg1" in - const*) - gni_qual_arg1=const - gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` - ;; - *) - gni_qual_arg1= - gni_type_arg1=$gni_qual_type_arg1 - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_QUAL_ARG1 $gni_qual_arg1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG1 $gni_type_arg1 -_ACEOF - - # - case $prev_sh_opts in - *f*) - ;; - *) - set +f - ;; - esac - # - -cat >>confdefs.h <<_ACEOF -#define HAVE_GETNAMEINFO 1 -_ACEOF - - curl_cv_func_getnameinfo="yes" - fi - fi - - -if test "$ipv6" = "yes"; then - if test "$curl_cv_func_getaddrinfo" = "yes"; then - -$as_echo "#define ENABLE_IPV6 1" >>confdefs.h - - IPV6_ENABLED=1 - - fi - - for ac_header in stdio.h sys/types.h sys/socket.h \ - netdb.h netinet/in.h arpa/inet.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working NI_WITHSCOPEID" >&5 -$as_echo_n "checking for working NI_WITHSCOPEID... " >&6; } -if ${curl_cv_working_ni_withscopeid+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - # Program is not run when cross-compiling. So we assume - # NI_WITHSCOPEID will work if we are able to compile it. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include -#include -#include - -int main (void) -{ - - unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - curl_cv_working_ni_withscopeid="yes" - -else - - curl_cv_working_ni_withscopeid="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # AC-COMPILE-IFELSE - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDIO_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -int main (void) -{ - -#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE - struct sockaddr_storage sa; -#else - unsigned char sa[256]; -#endif - char hostbuf[NI_MAXHOST]; - int rc; - GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); - GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); - GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; - int fd = socket(AF_INET6, SOCK_STREAM, 0); - if(fd < 0) { - perror("socket()"); - return 1; /* Error creating socket */ - } - rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); - if(rc) { - perror("getsockname()"); - return 2; /* Error retrieving socket name */ - } - rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); - if(rc) { - printf("rc = %s\n", gai_strerror(rc)); - return 3; /* Error translating socket address */ - } - return 0; /* Ok, NI_WITHSCOPEID works */ -#else - return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ -#endif - - ; - return 0; -} # AC-LANG-PROGRAM - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - - # Exit code == 0. Program worked. - curl_cv_working_ni_withscopeid="yes" - -else - - # Exit code != 0. Program failed. - curl_cv_working_ni_withscopeid="no" - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - # AC-RUN-IFELSE - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_working_ni_withscopeid" >&5 -$as_echo "$curl_cv_working_ni_withscopeid" >&6; } # AC-CACHE-CHECK - case "$curl_cv_working_ni_withscopeid" in - yes) - -$as_echo "#define HAVE_NI_WITHSCOPEID 1" >>confdefs.h - - ;; - esac - -fi - - - # - tst_method="unknown" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to set a socket into non-blocking mode" >&5 -$as_echo_n "checking how to set a socket into non-blocking mode... " >&6; } - if test "x$curl_cv_func_fcntl_o_nonblock" = "xyes"; then - tst_method="fcntl O_NONBLOCK" - elif test "x$curl_cv_func_ioctl_fionbio" = "xyes"; then - tst_method="ioctl FIONBIO" - elif test "x$curl_cv_func_ioctlsocket_fionbio" = "xyes"; then - tst_method="ioctlsocket FIONBIO" - elif test "x$curl_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then - tst_method="IoctlSocket FIONBIO" - elif test "x$curl_cv_func_setsockopt_so_nonblock" = "xyes"; then - tst_method="setsockopt SO_NONBLOCK" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_method" >&5 -$as_echo "$tst_method" >&6; } - if test "$tst_method" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine non-blocking socket method." >&5 -$as_echo "$as_me: WARNING: cannot determine non-blocking socket method." >&2;} - fi - - - -# Extract the first word of "perl", so it can be a program name with args. -set dummy perl; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin " -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -for ac_prog in gnroff nroff -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_NROFF+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $NROFF in - [\\/]* | ?:[\\/]*) - ac_cv_path_NROFF="$NROFF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$PATH:/usr/bin/:/usr/local/bin " -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -NROFF=$ac_cv_path_NROFF -if test -n "$NROFF"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 -$as_echo "$NROFF" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$NROFF" && break -done - - - -if test -n "$NROFF"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to use *nroff to get plain text from man pages" >&5 -$as_echo_n "checking how to use *nroff to get plain text from man pages... " >&6; } - MANOPT="-man" - mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` - if test -z "$mancheck"; then - MANOPT="-mandoc" - mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` - if test -z "$mancheck"; then - MANOPT="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: found no *nroff option to get plaintext from man pages" >&5 -$as_echo "$as_me: WARNING: found no *nroff option to get plaintext from man pages" >&2;} - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANOPT" >&5 -$as_echo "$MANOPT" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANOPT" >&5 -$as_echo "$MANOPT" >&6; } - fi - -fi - -if test -z "$MANOPT" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling built-in manual" >&5 -$as_echo "$as_me: WARNING: disabling built-in manual" >&2;} - USE_MANUAL="no"; -fi - - -if test "$USE_MANUAL" = "1"; then - -$as_echo "#define USE_MANUAL 1" >>confdefs.h - - curl_manual_msg="enabled" -fi - - if test x"$USE_MANUAL" = x1; then - USE_MANUAL_TRUE= - USE_MANUAL_FALSE='#' -else - USE_MANUAL_TRUE='#' - USE_MANUAL_FALSE= -fi - - - - - - # - if test "$want_ares" = "yes"; then - clean_CPPFLAGS="$CPPFLAGS" - clean_LDFLAGS="$LDFLAGS" - clean_LIBS="$LIBS" - embedded_ares="unknown" - configure_runpath=`pwd` - embedded_ares_builddir="$configure_runpath/ares" - if test -n "$want_ares_path"; then - ares_CPPFLAGS="-I$want_ares_path/include" - ares_LDFLAGS="-L$want_ares_path/lib" - ares_LIBS="-lcares" - else - if test -d "$srcdir/ares"; then - embedded_ares="yes" - subdirs="$subdirs ares" - - ares_CPPFLAGS="" - ares_LDFLAGS="-L$embedded_ares_builddir" - ares_LIBS="-lcares" - else - ares_CPPFLAGS="" - ares_LDFLAGS="" - ares_LIBS="-lcares" - fi - fi - # - CPPFLAGS="$clean_CPPFLAGS $ares_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS $ares_LDFLAGS" - LIBS="$ares_LIBS $clean_LIBS" - # - if test "$embedded_ares" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking that c-ares is good and recent enough" >&5 -$as_echo_n "checking that c-ares is good and recent enough... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#include - /* set of dummy functions in case c-ares was built with debug */ - void curl_dofree() { } - void curl_sclose() { } - void curl_domalloc() { } - void curl_docalloc() { } - void curl_socket() { } - -int main (void) -{ - - ares_channel channel; - ares_cancel(channel); /* added in 1.2.0 */ - ares_process_fd(channel, 0, 0); /* added in 1.4.0 */ - ares_dup(&channel, channel); /* added in 1.6.0 */ - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "c-ares library defective or too old" "$LINENO" 5 - CPPFLAGS="$clean_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS" - LIBS="$clean_LIBS" - # prevent usage - want_ares="no" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test "$want_ares" = "yes"; then - -$as_echo "#define USE_ARES 1" >>confdefs.h - - USE_ARES=1 - - curl_res_msg="c-ares" - fi - fi - - if test x$embedded_ares = xyes; then - USE_EMBEDDED_ARES_TRUE= - USE_EMBEDDED_ARES_FALSE='#' -else - USE_EMBEDDED_ARES_TRUE='#' - USE_EMBEDDED_ARES_FALSE= -fi - - -if test "x$curl_cv_native_windows" != "xyes" && - test "x$enable_shared" = "xyes"; then - build_libhostname=yes -else - build_libhostname=no -fi - if test x$build_libhostname = xyes; then - BUILD_LIBHOSTNAME_TRUE= - BUILD_LIBHOSTNAME_FALSE='#' -else - BUILD_LIBHOSTNAME_TRUE='#' - BUILD_LIBHOSTNAME_FALSE= -fi - - -if test "x$want_ares" != xyes; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the threaded resolver" >&5 -$as_echo_n "checking whether to enable the threaded resolver... " >&6; } - OPT_THRES="default" - # Check whether --enable-threaded_resolver was given. -if test "${enable_threaded_resolver+set}" = set; then : - enableval=$enable_threaded_resolver; OPT_THRES=$enableval -fi - - case "$OPT_THRES" in - no) - want_thres="no" - ;; - *) - want_thres="yes" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_thres" >&5 -$as_echo "$want_thres" >&6; } - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use POSIX threads for threaded resolver" >&5 -$as_echo_n "checking whether to use POSIX threads for threaded resolver... " >&6; } -# Check whether --enable-pthreads was given. -if test "${enable_pthreads+set}" = set; then : - enableval=$enable_pthreads; case "$enableval" in - no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - want_pthreads=no - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - want_pthreads=yes - ;; - esac -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto" >&5 -$as_echo "auto" >&6; } - want_pthreads=auto - - -fi - - -if test "$want_pthreads" != "no"; then - if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then - as_fn_error $? "options --enable-pthreads and --disable-rt are mutually exclusive" "$LINENO" 5 - fi - if test "$dontwant_rt" != "no"; then - if test "$want_pthreads" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-pthreads Ignored since librt is disabled." >&5 -$as_echo "$as_me: WARNING: --enable-pthreads Ignored since librt is disabled." >&2;} - fi - want_pthreads=no - fi -fi - -if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then - want_pthreads=no -fi - -if test "$want_pthreads" != "no"; then - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - -$as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h - - save_CFLAGS="$CFLAGS" - - ac_fn_c_check_func "$LINENO" "pthread_create" "ac_cv_func_pthread_create" -if test "x$ac_cv_func_pthread_create" = xyes; then : - USE_THREADS_POSIX=1 -fi - - - if test "$USE_THREADS_POSIX" != "1" - then - CFLAGS="$CFLAGS -pthread" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#ifdef __cplusplus -extern "C" -#endif -char pthread_create (); -int main (void) -{ -return pthread_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes -else - ac_cv_lib_pthread_pthread_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : - USE_THREADS_POSIX=1 -else - CFLAGS="$save_CFLAGS" -fi - - fi - - if test "x$USE_THREADS_POSIX" = "x1" - then - -$as_echo "#define USE_THREADS_POSIX 1" >>confdefs.h - - curl_res_msg="POSIX threaded" - fi - -fi - - -fi - -if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then - if test "$want_pthreads" = "yes"; then - as_fn_error $? "--enable-pthreads but pthreads was not found" "$LINENO" 5 - fi - if test "$curl_cv_native_windows" = "yes"; then - USE_THREADS_WIN32=1 - -$as_echo "#define USE_THREADS_WIN32 1" >>confdefs.h - - curl_res_msg="Win32 threaded" - else - as_fn_error $? "Threaded resolver enabled but no thread library found" "$LINENO" 5 - fi -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable verbose strings" >&5 -$as_echo_n "checking whether to enable verbose strings... " >&6; } -# Check whether --enable-verbose was given. -if test "${enable_verbose+set}" = set; then : - enableval=$enable_verbose; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_VERBOSE_STRINGS 1" >>confdefs.h - - curl_verbose_msg="no" - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable SSPI support (Windows native builds only)" >&5 -$as_echo_n "checking whether to enable SSPI support (Windows native builds only)... " >&6; } -# Check whether --enable-sspi was given. -if test "${enable_sspi+set}" = set; then : - enableval=$enable_sspi; case "$enableval" in - yes) - if test "$curl_cv_native_windows" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define USE_WINDOWS_SSPI 1" >>confdefs.h - - USE_WINDOWS_SSPI=1 - - curl_sspi_msg="enabled" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-sspi Ignored. Only supported on native Windows builds." >&5 -$as_echo "$as_me: WARNING: --enable-sspi Ignored. Only supported on native Windows builds." >&2;} - fi - ;; - *) - if test "x$WINSSL_ENABLED" = "x1"; then - # --with-winssl implies --enable-sspi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - esac -else - if test "x$WINSSL_ENABLED" = "x1"; then - # --with-winssl implies --enable-sspi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable cryptographic authentication methods" >&5 -$as_echo_n "checking whether to enable cryptographic authentication methods... " >&6; } -# Check whether --enable-crypto-auth was given. -if test "${enable_crypto_auth+set}" = set; then : - enableval=$enable_crypto_auth; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_CRYPTO_AUTH 1" >>confdefs.h - - CURL_DISABLE_CRYPTO_AUTH=1 - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - - OPT_NTLM_WB="default" - # Check whether --enable-ntlm-wb was given. -if test "${enable_ntlm_wb+set}" = set; then : - enableval=$enable_ntlm_wb; OPT_NTLM_WB=$enableval -fi - - want_ntlm_wb_file="/usr/bin/ntlm_auth" - case "$OPT_NTLM_WB" in - no) - want_ntlm_wb="no" - ;; - default) - want_ntlm_wb="yes" - ;; - *) - want_ntlm_wb="yes" - if test -n "$enableval" && test "$enableval" != "yes"; then - want_ntlm_wb_file="$enableval" - fi - ;; - esac - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable NTLM delegation to winbind's helper" >&5 -$as_echo_n "checking whether to enable NTLM delegation to winbind's helper... " >&6; } - if test "$curl_cv_native_windows" = "yes" || - test "x$SSL_ENABLED" = "x"; then - want_ntlm_wb_file="" - want_ntlm_wb="no" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_ntlm_wb" >&5 -$as_echo "$want_ntlm_wb" >&6; } - if test "$want_ntlm_wb" = "yes"; then - -$as_echo "#define NTLM_WB_ENABLED 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define NTLM_WB_FILE "$want_ntlm_wb_file" -_ACEOF - - NTLM_WB_ENABLED=1 - fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable TLS-SRP authentication" >&5 -$as_echo_n "checking whether to enable TLS-SRP authentication... " >&6; } -# Check whether --enable-tls-srp was given. -if test "${enable_tls_srp+set}" = set; then : - enableval=$enable_tls_srp; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_TLS_SRP 1" >>confdefs.h - - want_tls_srp=no - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - want_tls_srp=yes - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - want_tls_srp=yes - -fi - - -if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then - -$as_echo "#define USE_TLS_SRP 1" >>confdefs.h - - USE_TLS_SRP=1 - curl_tls_srp_msg="enabled" -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Unix domain sockets" >&5 -$as_echo_n "checking whether to enable Unix domain sockets... " >&6; } -# Check whether --enable-unix-sockets was given. -if test "${enable_unix_sockets+set}" = set; then : - enableval=$enable_unix_sockets; case "$enableval" in - no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - want_unix_sockets=no - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - want_unix_sockets=yes - ;; - esac -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto" >&5 -$as_echo "auto" >&6; } - want_unix_sockets=auto - - -fi - -if test "x$want_unix_sockets" != "xno"; then - ac_fn_c_check_member "$LINENO" "struct sockaddr_un" "sun_path" "ac_cv_member_struct_sockaddr_un_sun_path" " - #include - -" -if test "x$ac_cv_member_struct_sockaddr_un_sun_path" = xyes; then : - - -$as_echo "#define USE_UNIX_SOCKETS 1" >>confdefs.h - - USE_UNIX_SOCKETS=1 - - curl_unix_sockets_msg="enabled" - -else - - if test "x$want_unix_sockets" = "xyes"; then - as_fn_error $? "--enable-unix-sockets is not available on this platform!" "$LINENO" 5 - fi - -fi - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable support for cookies" >&5 -$as_echo_n "checking whether to enable support for cookies... " >&6; } -# Check whether --enable-cookies was given. -if test "${enable_cookies+set}" = set; then : - enableval=$enable_cookies; case "$enableval" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define CURL_DISABLE_COOKIES 1" >>confdefs.h - - ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ;; - esac -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether hiding of library internal symbols will actually happen" >&5 -$as_echo_n "checking whether hiding of library internal symbols will actually happen... " >&6; } - CFLAG_CURL_SYMBOL_HIDING="" - doing_symbol_hiding="no" - if test x"$curl_cv_native_windows" != "xyes" && - test "$want_symbol_hiding" = "yes" && - test "$supports_symbol_hiding" = "yes"; then - doing_symbol_hiding="yes" - CFLAG_CURL_SYMBOL_HIDING="$symbol_hiding_CFLAGS" - -cat >>confdefs.h <<_ACEOF -#define CURL_EXTERN_SYMBOL $symbol_hiding_EXTERN -_ACEOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - if test x$doing_symbol_hiding = xyes; then - DOING_CURL_SYMBOL_HIDING_TRUE= - DOING_CURL_SYMBOL_HIDING_FALSE='#' -else - DOING_CURL_SYMBOL_HIDING_TRUE='#' - DOING_CURL_SYMBOL_HIDING_FALSE= -fi - - - - -LIBCURL_LIBS=$LIBS - - - - - -BLANK_AT_MAKETIME= - - - if test x$cross_compiling = xyes; then - CROSSCOMPILING_TRUE= - CROSSCOMPILING_FALSE='#' -else - CROSSCOMPILING_TRUE='#' - CROSSCOMPILING_FALSE= -fi - - -ENABLE_SHARED="$enable_shared" - - -ENABLE_STATIC="$enable_static" - - - - -if test "x$OPENSSL_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" -elif test -n "$SSL_ENABLED"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" -fi -if test "x$IPV6_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6" -fi -if test "x$USE_UNIX_SOCKETS" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets" -fi -if test "x$HAVE_LIBZ" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES libz" -fi -if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \ - -o "x$USE_THREADS_WIN32" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS" -fi -if test "x$IDN_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES IDN" -fi -if test "x$USE_WINDOWS_SSPI" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI" -fi - -if test "x$HAVE_GSSAPI" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API" -fi - -if test "x$curl_psl_msg" = "xyes"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES PSL" -fi - -if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \ - \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then - SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO" -fi - -if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \ - \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then - SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos" -fi - -if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then - if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ - -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM" - - if test "x$CURL_DISABLE_HTTP" != "x1" -a \ - "x$NTLM_WB_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB" - fi - fi -fi - -if test "x$USE_TLS_SRP" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP" -fi - -if test "x$USE_NGHTTP2" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2" -fi - -if test "x$CURL_WITH_MULTI_SSL" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL" -fi - -if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy" -fi - - - -if test "x$CURL_DISABLE_HTTP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS" - fi -fi -if test "x$CURL_DISABLE_FTP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS" - fi -fi -if test "x$CURL_DISABLE_FILE" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE" -fi -if test "x$CURL_DISABLE_TELNET" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET" -fi -if test "x$CURL_DISABLE_LDAP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP" - if test "x$CURL_DISABLE_LDAPS" != "x1"; then - if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") || - (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS" - fi - fi -fi -if test "x$CURL_DISABLE_DICT" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT" -fi -if test "x$CURL_DISABLE_TFTP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP" -fi -if test "x$CURL_DISABLE_GOPHER" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER" -fi -if test "x$CURL_DISABLE_POP3" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S" - fi -fi -if test "x$CURL_DISABLE_IMAP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS" - fi -fi -if test "x$CURL_DISABLE_SMB" != "x1" \ - -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \ - -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ - -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS" - fi -fi -if test "x$CURL_DISABLE_SMTP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP" - if test "x$SSL_ENABLED" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS" - fi -fi -if test "x$USE_LIBSSH2" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP" - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" -fi -if test "x$CURL_DISABLE_RTSP" != "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP" -fi -if test "x$USE_LIBRTMP" = "x1"; then - SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP" -fi - -SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '` - - - - -squeeze CFLAGS -squeeze CPPFLAGS -squeeze DEFS -squeeze LDFLAGS -squeeze LIBS - -squeeze LIBCURL_LIBS -squeeze CURL_NETWORK_LIBS -squeeze CURL_NETWORK_AND_TIME_LIBS - -squeeze SUPPORT_FEATURES -squeeze SUPPORT_PROTOCOLS - - - - xc_bad_var_libs=no - for xc_word in $LIBS; do - case "$xc_word" in - -l* | --library=*) - : - ;; - *) - xc_bad_var_libs=yes - ;; - esac - done - if test $xc_bad_var_libs = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using LIBS: $LIBS" >&5 -$as_echo "$as_me: using LIBS: $LIBS" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: LIBS note: LIBS should only be used to specify libraries (-lname)." >&5 -$as_echo "$as_me: LIBS note: LIBS should only be used to specify libraries (-lname)." >&6;} - fi - - - xc_bad_var_ldflags=no - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_ldflags=yes - ;; - -U*) - xc_bad_var_ldflags=yes - ;; - -I*) - xc_bad_var_ldflags=yes - ;; - -l* | --library=*) - xc_bad_var_ldflags=yes - ;; - esac - done - if test $xc_bad_var_ldflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using LDFLAGS: $LDFLAGS" >&5 -$as_echo "$as_me: using LDFLAGS: $LDFLAGS" >&6;} - xc_bad_var_msg="LDFLAGS note: LDFLAGS should only be used to specify linker flags, not" - for xc_word in $LDFLAGS; do - case "$xc_word" in - -D*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -U*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -I*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - - xc_bad_var_cppflags=no - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - xc_bad_var_cppflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cppflags=yes - ;; - -l* | --library=*) - xc_bad_var_cppflags=yes - ;; - esac - done - if test $xc_bad_var_cppflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using CPPFLAGS: $CPPFLAGS" >&5 -$as_echo "$as_me: using CPPFLAGS: $CPPFLAGS" >&6;} - xc_bad_var_msg="CPPFLAGS note: CPPFLAGS should only be used to specify C preprocessor flags, not" - for xc_word in $CPPFLAGS; do - case "$xc_word" in - -rpath*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -L* | --library-path=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - - xc_bad_var_cflags=no - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - xc_bad_var_cflags=yes - ;; - -U*) - xc_bad_var_cflags=yes - ;; - -I*) - xc_bad_var_cflags=yes - ;; - -rpath*) - xc_bad_var_cflags=yes - ;; - -L* | --library-path=*) - xc_bad_var_cflags=yes - ;; - -l* | --library=*) - xc_bad_var_cflags=yes - ;; - esac - done - if test $xc_bad_var_cflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: using CFLAGS: $CFLAGS" >&5 -$as_echo "$as_me: using CFLAGS: $CFLAGS" >&6;} - xc_bad_var_msg="CFLAGS note: CFLAGS should only be used to specify C compiler flags, not" - for xc_word in $CFLAGS; do - case "$xc_word" in - -D*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -U*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -I*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word" >&6;} - ;; - -rpath*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -L* | --library-path=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word" >&6;} - ;; - -l* | --library=*) - { $as_echo "$as_me:${as_lineno-$LINENO}: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&5 -$as_echo "$as_me: $xc_bad_var_msg libraries. Use LIBS for: $xc_word" >&6;} - ;; - esac - done - fi - - if test $xc_bad_var_libs = yes || - test $xc_bad_var_cflags = yes || - test $xc_bad_var_ldflags = yes || - test $xc_bad_var_cppflags = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Continuing even with errors mentioned immediately above this line." >&5 -$as_echo "$as_me: WARNING: Continuing even with errors mentioned immediately above this line." >&2;} - fi - - -if test "x$want_curldebug_assumed" = "xyes" && - test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then - ac_configure_args="$ac_configure_args --enable-curldebug" -fi - -ac_config_files="$ac_config_files Makefile docs/Makefile docs/examples/Makefile docs/libcurl/Makefile docs/libcurl/opts/Makefile docs/cmdline-opts/Makefile include/Makefile include/curl/Makefile src/Makefile lib/Makefile scripts/Makefile lib/libcurl.vers tests/Makefile tests/certs/Makefile tests/certs/scripts/Makefile tests/data/Makefile tests/server/Makefile tests/libtest/Makefile tests/unit/Makefile packages/Makefile packages/Win32/Makefile packages/Win32/cygwin/Makefile packages/Linux/Makefile packages/Linux/RPM/Makefile packages/Linux/RPM/curl.spec packages/Linux/RPM/curl-ssl.spec packages/Solaris/Makefile packages/EPM/curl.list packages/EPM/Makefile packages/vms/Makefile packages/AIX/Makefile packages/AIX/RPM/Makefile packages/AIX/RPM/curl.spec curl-config libcurl.pc" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CODE_COVERAGE_ENABLED_TRUE}" && test -z "${CODE_COVERAGE_ENABLED_FALSE}"; then - as_fn_error $? "conditional \"CODE_COVERAGE_ENABLED\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${CURL_LT_SHLIB_USE_VERSION_INFO_TRUE}" && test -z "${CURL_LT_SHLIB_USE_VERSION_INFO_FALSE}"; then - as_fn_error $? "conditional \"CURL_LT_SHLIB_USE_VERSION_INFO\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CURL_LT_SHLIB_USE_NO_UNDEFINED_TRUE}" && test -z "${CURL_LT_SHLIB_USE_NO_UNDEFINED_FALSE}"; then - as_fn_error $? "conditional \"CURL_LT_SHLIB_USE_NO_UNDEFINED\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CURL_LT_SHLIB_USE_MIMPURE_TEXT_TRUE}" && test -z "${CURL_LT_SHLIB_USE_MIMPURE_TEXT_FALSE}"; then - as_fn_error $? "conditional \"CURL_LT_SHLIB_USE_MIMPURE_TEXT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_CPPFLAG_CURL_STATICLIB_TRUE}" && test -z "${USE_CPPFLAG_CURL_STATICLIB_FALSE}"; then - as_fn_error $? "conditional \"USE_CPPFLAG_CURL_STATICLIB\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_EXPLICIT_LIB_DEPS_TRUE}" && test -z "${USE_EXPLICIT_LIB_DEPS_FALSE}"; then - as_fn_error $? "conditional \"USE_EXPLICIT_LIB_DEPS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CURLDEBUG_TRUE}" && test -z "${CURLDEBUG_FALSE}"; then - as_fn_error $? "conditional \"CURLDEBUG\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${BUILD_UNITTESTS_TRUE}" && test -z "${BUILD_UNITTESTS_FALSE}"; then - as_fn_error $? "conditional \"BUILD_UNITTESTS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${DOING_NATIVE_WINDOWS_TRUE}" && test -z "${DOING_NATIVE_WINDOWS_FALSE}"; then - as_fn_error $? "conditional \"DOING_NATIVE_WINDOWS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_LIBZ_TRUE}" && test -z "${HAVE_LIBZ_FALSE}"; then - as_fn_error $? "conditional \"HAVE_LIBZ\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${BUILD_STUB_GSS_TRUE}" && test -z "${BUILD_STUB_GSS_FALSE}"; then - as_fn_error $? "conditional \"BUILD_STUB_GSS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_LIBPSL_TRUE}" && test -z "${USE_LIBPSL_FALSE}"; then - as_fn_error $? "conditional \"USE_LIBPSL\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_TRUE}" && test -z "${CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_FALSE}"; then - as_fn_error $? "conditional \"CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_MANUAL_TRUE}" && test -z "${USE_MANUAL_FALSE}"; then - as_fn_error $? "conditional \"USE_MANUAL\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_EMBEDDED_ARES_TRUE}" && test -z "${USE_EMBEDDED_ARES_FALSE}"; then - as_fn_error $? "conditional \"USE_EMBEDDED_ARES\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${BUILD_LIBHOSTNAME_TRUE}" && test -z "${BUILD_LIBHOSTNAME_FALSE}"; then - as_fn_error $? "conditional \"BUILD_LIBHOSTNAME\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${DOING_CURL_SYMBOL_HIDING_TRUE}" && test -z "${DOING_CURL_SYMBOL_HIDING_FALSE}"; then - as_fn_error $? "conditional \"DOING_CURL_SYMBOL_HIDING\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CROSSCOMPILING_TRUE}" && test -z "${CROSSCOMPILING_FALSE}"; then - as_fn_error $? "conditional \"CROSSCOMPILING\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by curl $as_me -, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -curl config.status - -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' -configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in AS \ -DLLTOOL \ -OBJDUMP \ -SHELL \ -ECHO \ -PATH_SEPARATOR \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_import \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -lt_cv_nm_interface \ -nm_file_list_spec \ -lt_cv_truncate_bin \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -configure_time_dlsearch_path \ -configure_time_lt_sys_library_path; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' - -# See if we are running on zsh, and set the options that allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "lib/curl_config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/curl_config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; - "docs/examples/Makefile") CONFIG_FILES="$CONFIG_FILES docs/examples/Makefile" ;; - "docs/libcurl/Makefile") CONFIG_FILES="$CONFIG_FILES docs/libcurl/Makefile" ;; - "docs/libcurl/opts/Makefile") CONFIG_FILES="$CONFIG_FILES docs/libcurl/opts/Makefile" ;; - "docs/cmdline-opts/Makefile") CONFIG_FILES="$CONFIG_FILES docs/cmdline-opts/Makefile" ;; - "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "include/curl/Makefile") CONFIG_FILES="$CONFIG_FILES include/curl/Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; - "lib/libcurl.vers") CONFIG_FILES="$CONFIG_FILES lib/libcurl.vers" ;; - "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "tests/certs/Makefile") CONFIG_FILES="$CONFIG_FILES tests/certs/Makefile" ;; - "tests/certs/scripts/Makefile") CONFIG_FILES="$CONFIG_FILES tests/certs/scripts/Makefile" ;; - "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;; - "tests/server/Makefile") CONFIG_FILES="$CONFIG_FILES tests/server/Makefile" ;; - "tests/libtest/Makefile") CONFIG_FILES="$CONFIG_FILES tests/libtest/Makefile" ;; - "tests/unit/Makefile") CONFIG_FILES="$CONFIG_FILES tests/unit/Makefile" ;; - "packages/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Makefile" ;; - "packages/Win32/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Win32/Makefile" ;; - "packages/Win32/cygwin/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Win32/cygwin/Makefile" ;; - "packages/Linux/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Linux/Makefile" ;; - "packages/Linux/RPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/Makefile" ;; - "packages/Linux/RPM/curl.spec") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/curl.spec" ;; - "packages/Linux/RPM/curl-ssl.spec") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/curl-ssl.spec" ;; - "packages/Solaris/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Solaris/Makefile" ;; - "packages/EPM/curl.list") CONFIG_FILES="$CONFIG_FILES packages/EPM/curl.list" ;; - "packages/EPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/EPM/Makefile" ;; - "packages/vms/Makefile") CONFIG_FILES="$CONFIG_FILES packages/vms/Makefile" ;; - "packages/AIX/Makefile") CONFIG_FILES="$CONFIG_FILES packages/AIX/Makefile" ;; - "packages/AIX/RPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/AIX/RPM/Makefile" ;; - "packages/AIX/RPM/curl.spec") CONFIG_FILES="$CONFIG_FILES packages/AIX/RPM/curl.spec" ;; - "curl-config") CONFIG_FILES="$CONFIG_FILES curl-config" ;; - "libcurl.pc") CONFIG_FILES="$CONFIG_FILES libcurl.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options that allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST - fi - - cfgfile=${ofile}T - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL -# Generated automatically by $as_me ($PACKAGE) $VERSION -# NOTE: Changes made to this file will be lost: look at ltmain.sh. - -# Provide generalized library-building support services. -# Written by Gordon Matzigkeit, 1996 - -# Copyright (C) 2014 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program or library that is built -# using GNU Libtool, you may include this file under the same -# distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -# The names of the tagged configurations supported by this script. -available_tags='' - -# Configured defaults for sys_lib_dlsearch_path munging. -: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Assembler program. -AS=$lt_AS - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Object dumper program. -OBJDUMP=$lt_OBJDUMP - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shared archive member basename,for filename based shared library versioning on AIX. -shared_archive_member_spec=$shared_archive_member_spec - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The PATH separator for the build system. -PATH_SEPARATOR=$lt_PATH_SEPARATOR - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm into a list of symbols to manually relocate. -global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name lister interface. -nm_interface=$lt_lt_cv_nm_interface - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and where our libraries should be installed. -lt_sysroot=$lt_sysroot - -# Command to truncate a binary pipe. -lt_truncate_bin=$lt_lt_cv_truncate_bin - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Detected run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path - -# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. -configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - cat <<'_LT_EOF' >> "$cfgfile" - -# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE - -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - - -# ### END FUNCTIONS SHARED WITH CONFIGURE - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain=$ac_aux_dir/ltmain.sh - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi - -# -# CONFIG_SUBDIRS section. -# -if test "$no_recursion" != yes; then - - # Remove --cache-file, --srcdir, and --disable-option-checking arguments - # so they do not pile up. - ac_sub_configure_args= - ac_prev= - eval "set x $ac_configure_args" - shift - for ac_arg - do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case $ac_arg in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ - | --c=*) - ;; - --config-cache | -C) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - ;; - --disable-option-checking) - ;; - *) - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_sub_configure_args " '$ac_arg'" ;; - esac - done - - # Always prepend --prefix to ensure using the same prefix - # in subdir configurations. - ac_arg="--prefix=$prefix" - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" - - # Pass --silent - if test "$silent" = yes; then - ac_sub_configure_args="--silent $ac_sub_configure_args" - fi - - # Always prepend --disable-option-checking to silence warnings, since - # different subdirs can have different --enable and --with options. - ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" - - ac_popdir=`pwd` - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - test -d "$srcdir/$ac_dir" || continue - - ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 - $as_echo "$ac_msg" >&6 - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - cd "$ac_dir" - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f "$ac_srcdir/configure.gnu"; then - ac_sub_configure=$ac_srcdir/configure.gnu - elif test -f "$ac_srcdir/configure"; then - ac_sub_configure=$ac_srcdir/configure - elif test -f "$ac_srcdir/configure.in"; then - # This should be Cygnus configure. - ac_sub_configure=$ac_aux_dir/configure - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 -$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - # Make the cache file name correct relative to the subdirectory. - case $cache_file in - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative name. - ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} - # The eval makes quoting arguments work. - eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ - --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 - fi - - cd "$ac_popdir" - done -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - - - tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null` - if test -z "$tmp_cpp"; then - tmp_cpp='cpp' - fi - cat >./tests/configurehelp.pm <<_EOF -# This is a generated file. Do not edit. - -package configurehelp; - -use strict; -use warnings; -use Exporter; - -use vars qw( - @ISA - @EXPORT_OK - \$Cpreprocessor - ); - -@ISA = qw(Exporter); - -@EXPORT_OK = qw( - \$Cpreprocessor - ); - -\$Cpreprocessor = '$tmp_cpp'; - -1; -_EOF - - - -## ---------------------------------- ## -## Start of distclean amending code ## -## ---------------------------------- ## - -for xc_subdir in lib src tests/unit tests/server tests/libtest docs/examples -do - -if test ! -f "$xc_subdir/Makefile"; then - echo "$xc_msg_err $xc_subdir/Makefile file not found. $xc_msg_abrt" >&2 - exit 1 -fi - -# Fetch dependency tracking file list from Makefile include lines. - -xc_inc_lines=`grep '^include .*(DEPDIR)' "$xc_subdir/Makefile" 2>/dev/null` -xc_cnt_words=`echo "$xc_inc_lines" | wc -w | tr -d "$xc_space$xc_tab"` - -# --disable-dependency-tracking might have been used, consequently -# there is nothing to amend without a dependency tracking file list. - -if test $xc_cnt_words -gt 0; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: amending $xc_subdir/Makefile" >&5 -$as_echo "$as_me: amending $xc_subdir/Makefile" >&6;} - -# Build Makefile specific patch hunk. - -xc_p="$xc_subdir/xc_patch.tmp" - -xc_rm_depfiles=`echo "$xc_inc_lines" \ - | $SED 's%include% -rm -f%' 2>/dev/null` - -xc_dep_subdirs=`echo "$xc_inc_lines" \ - | $SED 's%include[ ][ ]*%%' 2>/dev/null \ - | $SED 's%(DEPDIR)/.*%(DEPDIR)%' 2>/dev/null \ - | sort | uniq` - -echo "$xc_rm_depfiles" >$xc_p - -for xc_dep_dir in $xc_dep_subdirs; do - echo "${xc_tab}@xm_dep_cnt=\`ls $xc_dep_dir | wc -l 2>/dev/null\`; \\" >>$xc_p - echo "${xc_tab}if test \$\$xm_dep_cnt -eq 0 && test -d $xc_dep_dir; then \\" >>$xc_p - echo "${xc_tab} rm -rf $xc_dep_dir; \\" >>$xc_p - echo "${xc_tab}fi" >>$xc_p -done - -# Build Makefile patching sed scripts. - -xc_s1="$xc_subdir/xc_script_1.tmp" -xc_s2="$xc_subdir/xc_script_2.tmp" -xc_s3="$xc_subdir/xc_script_3.tmp" - -cat >$xc_s1 <<\_EOT -/^distclean[ ]*:/,/^[^ ][^ ]*:/{ - s/^.*(DEPDIR)/___xc_depdir_line___/ -} -/^maintainer-clean[ ]*:/,/^[^ ][^ ]*:/{ - s/^.*(DEPDIR)/___xc_depdir_line___/ -} -_EOT - -cat >$xc_s2 <<\_EOT -/___xc_depdir_line___$/{ - N - /___xc_depdir_line___$/D -} -_EOT - -cat >$xc_s3 <<_EOT -/^___xc_depdir_line___/{ - r $xc_p - d -} -_EOT - -# Apply patch to Makefile and cleanup. - -$SED -f "$xc_s1" "$xc_subdir/Makefile" >"$xc_subdir/Makefile.tmp1" -$SED -f "$xc_s2" "$xc_subdir/Makefile.tmp1" >"$xc_subdir/Makefile.tmp2" -$SED -f "$xc_s3" "$xc_subdir/Makefile.tmp2" >"$xc_subdir/Makefile.tmp3" - -if test -f "$xc_subdir/Makefile.tmp3"; then - mv -f "$xc_subdir/Makefile.tmp3" "$xc_subdir/Makefile" -fi - -test -f "$xc_subdir/Makefile.tmp1" && rm -f "$xc_subdir/Makefile.tmp1" -test -f "$xc_subdir/Makefile.tmp2" && rm -f "$xc_subdir/Makefile.tmp2" -test -f "$xc_subdir/Makefile.tmp3" && rm -f "$xc_subdir/Makefile.tmp3" - -test -f "$xc_p" && rm -f "$xc_p" -test -f "$xc_s1" && rm -f "$xc_s1" -test -f "$xc_s2" && rm -f "$xc_s2" -test -f "$xc_s3" && rm -f "$xc_s3" - -fi - -done - -## -------------------------------- ## -## End of distclean amending code ## -## -------------------------------- ## - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: 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} - GSS-API support: ${curl_gss_msg} - TLS-SRP support: ${curl_tls_srp_msg} - resolver: ${curl_res_msg} - IPv6 support: ${curl_ipv6_msg} - Unix sockets support: ${curl_unix_sockets_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_warning} - ca cert path: ${capath}${capath_warning} - ca fallback: ${with_ca_fallback} - LDAP support: ${curl_ldap_msg} - LDAPS support: ${curl_ldaps_msg} - RTSP support: ${curl_rtsp_msg} - RTMP support: ${curl_rtmp_msg} - metalink support: ${curl_mtlnk_msg} - PSL support: ${curl_psl_msg} - HTTP2 support: ${curl_h2_msg} - Protocols: ${SUPPORT_PROTOCOLS} -" >&5 -$as_echo "$as_me: 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} - GSS-API support: ${curl_gss_msg} - TLS-SRP support: ${curl_tls_srp_msg} - resolver: ${curl_res_msg} - IPv6 support: ${curl_ipv6_msg} - Unix sockets support: ${curl_unix_sockets_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_warning} - ca cert path: ${capath}${capath_warning} - ca fallback: ${with_ca_fallback} - LDAP support: ${curl_ldap_msg} - LDAPS support: ${curl_ldaps_msg} - RTSP support: ${curl_rtsp_msg} - RTMP support: ${curl_rtmp_msg} - metalink support: ${curl_mtlnk_msg} - PSL support: ${curl_psl_msg} - HTTP2 support: ${curl_h2_msg} - Protocols: ${SUPPORT_PROTOCOLS} -" >&6;} diff --git a/curl/configure.ac b/curl/configure.ac index 68b3a071..152b0472 100644 --- a/curl/configure.ac +++ b/curl/configure.ac @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -21,17 +21,17 @@ #*************************************************************************** dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.57) +AC_PREREQ(2.59) dnl We don't know the version number "statically" so we use a dash here -AC_INIT([curl], [-], [a suitable curl mailing list: https://curl.haxx.se/mail/]) +AC_INIT([curl], [-], [a suitable curl mailing list: https://curl.se/mail/]) XC_OVR_ZZ50 XC_OVR_ZZ60 CURL_OVERRIDE_AUTOCONF dnl configure script copyright -AC_COPYRIGHT([Copyright (c) 1998 - 2017 Daniel Stenberg, +AC_COPYRIGHT([Copyright (c) 1998 - 2021 Daniel Stenberg, This configure script may be copied, distributed and modified under the terms of the curl license; see COPYING for more details]) @@ -49,9 +49,9 @@ CURL_CHECK_OPTION_CURLDEBUG CURL_CHECK_OPTION_SYMBOL_HIDING CURL_CHECK_OPTION_ARES CURL_CHECK_OPTION_RT +CURL_CHECK_OPTION_ECH XC_CHECK_PATH_SEPARATOR -AX_CODE_COVERAGE # # save the configure arguments @@ -59,12 +59,6 @@ AX_CODE_COVERAGE CONFIGURE_OPTIONS="\"$ac_configure_args\"" AC_SUBST(CONFIGURE_OPTIONS) -CURL_CFLAG_EXTRAS="" -if test X"$want_werror" = Xyes; then - CURL_CFLAG_EXTRAS="-Werror" -fi -AC_SUBST(CURL_CFLAG_EXTRAS) - dnl SED is mandatory for configure process and libtool. dnl Set it now, allowing it to be changed later. if test -z "$SED"; then @@ -124,6 +118,10 @@ AC_SUBST(libext) dnl figure out the libcurl version CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h` XC_CHECK_PROG_CC + +dnl for --enable-code-coverage +CURL_COVERAGE + XC_AUTOMAKE AC_MSG_CHECKING([curl version]) AC_MSG_RESULT($CURLVERSION) @@ -138,17 +136,20 @@ AC_SUBST(VERSIONNUM) dnl Solaris pkgadd support definitions PKGADD_PKG="HAXXcurl" PKGADD_NAME="curl - a client that groks URLs" -PKGADD_VENDOR="curl.haxx.se" +PKGADD_VENDOR="curl.se" AC_SUBST(PKGADD_PKG) AC_SUBST(PKGADD_NAME) AC_SUBST(PKGADD_VENDOR) dnl dnl initialize all the info variables - curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )" - curl_ssh_msg="no (--with-libssh2)" + curl_ssl_msg="no (--with-{openssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,mesalink,amissl,bearssl,rustls} )" + curl_ssh_msg="no (--with-{libssh,libssh2})" curl_zlib_msg="no (--with-zlib)" + curl_brotli_msg="no (--with-brotli)" + curl_zstd_msg="no (--with-zstd)" curl_gss_msg="no (--with-gssapi)" + curl_gsasl_msg="no (--with-gsasl)" curl_tls_srp_msg="no (--enable-tls-srp)" curl_res_msg="default (--enable-ares / --enable-threaded-resolver)" curl_ipv6_msg="no (--enable-ipv6)" @@ -162,10 +163,16 @@ curl_verbose_msg="enabled (--disable-verbose)" curl_ldaps_msg="no (--enable-ldaps)" curl_rtsp_msg="no (--enable-rtsp)" curl_rtmp_msg="no (--with-librtmp)" - curl_mtlnk_msg="no (--with-libmetalink)" curl_psl_msg="no (--with-libpsl)" - + curl_altsvc_msg="enabled (--disable-alt-svc)" + curl_hsts_msg="enabled (--disable-hsts)" ssl_backends= + curl_h1_msg="enabled (internal)" + curl_h2_msg="no (--with-nghttp2, --with-hyper)" + curl_h3_msg="no (--with-ngtcp2, --with-quiche)" + +enable_altsvc="yes" +hsts="yes" dnl dnl Save some initial values the user might have provided @@ -173,6 +180,112 @@ dnl INITIAL_LDFLAGS=$LDFLAGS INITIAL_LIBS=$LIBS +dnl ********************************************************************** +dnl See which TLS backend(s) that are requested. Just do all the +dnl TLS AC_ARG_WITH() invokes here and do the checks later +dnl ********************************************************************** +OPT_SCHANNEL=no +AC_ARG_WITH(schannel,dnl +AS_HELP_STRING([--with-schannel],[enable Windows native SSL/TLS]), + OPT_SCHANNEL=$withval + TLSCHOICE="schannel") + +OPT_SECURETRANSPORT=no +AC_ARG_WITH(secure-transport,dnl +AS_HELP_STRING([--with-secure-transport],[enable Apple OS native SSL/TLS]), + OPT_SECURETRANSPORT=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }Secure-Transport" +) + +OPT_AMISSL=no +AC_ARG_WITH(amissl,dnl +AS_HELP_STRING([--with-amissl],[enable Amiga native SSL/TLS (AmiSSL)]), + OPT_AMISSL=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }AmiSSL") + +OPT_OPENSSL=no +dnl Default to no CA bundle +ca="no" +AC_ARG_WITH(ssl,dnl +AS_HELP_STRING([--with-ssl=PATH],[old version of --with-openssl]) +AS_HELP_STRING([--without-ssl], [build without any TLS library]), + OPT_SSL=$withval + OPT_OPENSSL=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }OpenSSL") + +AC_ARG_WITH(openssl,dnl +AS_HELP_STRING([--with-openssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]), + OPT_OPENSSL=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }OpenSSL") + +OPT_GNUTLS=no +AC_ARG_WITH(gnutls,dnl +AS_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root]), + OPT_GNUTLS=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }GnuTLS") + +OPT_MBEDTLS=no +AC_ARG_WITH(mbedtls,dnl +AS_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root]), + OPT_MBEDTLS=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }mbedTLS") + +OPT_WOLFSSL=no +AC_ARG_WITH(wolfssl,dnl +AS_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)]), + OPT_WOLFSSL=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }wolfSSL") + +OPT_MESALINK=no +AC_ARG_WITH(mesalink,dnl +AS_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root]), + OPT_MESALINK=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }MesaLink") + +OPT_BEARSSL=no +AC_ARG_WITH(bearssl,dnl +AS_HELP_STRING([--with-bearssl=PATH],[where to look for BearSSL, PATH points to the installation root]), + OPT_BEARSSL=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }BearSSL") + +OPT_RUSTLS=no +AC_ARG_WITH(rustls,dnl +AS_HELP_STRING([--with-rustls=PATH],[where to look for rustls, PATH points to the installation root]), + OPT_RUSTLS=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }rustls") + +OPT_NSS=no +AC_ARG_WITH(nss,dnl +AS_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root]), + OPT_NSS=$withval + test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }NSS") + +dnl If no TLS choice has been made, check if it was explicitly disabled or +dnl error out to force the user to decide. +if test -z "$TLSCHOICE"; then + if test "x$OPT_SSL" != "xno"; then + AC_MSG_ERROR([select TLS backend(s) or disable TLS with --without-ssl. + +Select from these: + + --with-amissl + --with-bearssl + --with-gnutls + --with-mbedtls + --with-mesalink + --with-nss + --with-openssl (also works for BoringSSL and libressl) + --with-rustls + --with-schannel + --with-secure-transport + --with-wolfssl +]) + fi +fi + +AC_ARG_WITH(darwinssl,, + AC_MSG_ERROR([--with-darwin-ssl no longer works!])) + dnl dnl Detect the canonical host and target build environment dnl @@ -181,7 +294,8 @@ AC_CANONICAL_HOST dnl Get system canonical name AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) -dnl Checks for programs. +# Silence warning: ar: 'u' modifier ignored since 'D' is the default +AC_SUBST(AR_FLAGS, [cr]) dnl This defines _ALL_SOURCE for AIX CURL_CHECK_AIX_ALL_SOURCE @@ -273,6 +387,19 @@ if test "$compiler_id" = "INTEL_UNIX_C"; then # fi +CURL_CFLAG_EXTRAS="" +if test X"$want_werror" = Xyes; then + CURL_CFLAG_EXTRAS="-Werror" + if test "$compiler_id" = "GNU_C"; then + dnl enable -pedantic-errors for GCC 5 and later, + dnl as before that it was the same as -Werror=pedantic + if test "$compiler_num" -ge "500"; then + CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors" + fi + fi +fi +AC_SUBST(CURL_CFLAG_EXTRAS) + CURL_CHECK_COMPILER_HALT_ON_ERROR CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH @@ -319,6 +446,32 @@ else fi AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes) +# For original MinGW (ie not MinGW-w64) define the Windows minimum supported OS +# version to Windows XP (0x501) if it hasn't already been defined by the user. +# Without this override original MinGW defaults the version to Windows NT 4.0. +# Note original MinGW sets _WIN32_WINNT if not defined to whatever WINVER is. +case $host in + *-*-mingw32*) + AC_MSG_CHECKING([if MinGW minimum supported OS should be set to XP]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include <_mingw.h> + ]],[[ +#if defined(__MINGW64_VERSION_MAJOR) || \ + defined(WINVER) || \ + defined(_WIN32_WINNT) +#error +#endif + ]]) + ],[ + CPPFLAGS="$CPPFLAGS -DWINVER=0x501" + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) + ;; +esac + dnl ********************************************************************** dnl Compilation based checks should not be done before this point. dnl ********************************************************************** @@ -337,6 +490,7 @@ case X-"$curl_cv_native_windows" in CURL_CHECK_HEADER_WINSOCK CURL_CHECK_HEADER_WINSOCK2 CURL_CHECK_HEADER_WS2TCPIP + CURL_CHECK_HEADER_WINCRYPT CURL_CHECK_HEADER_WINLDAP CURL_CHECK_HEADER_WINBER ;; @@ -344,22 +498,26 @@ case X-"$curl_cv_native_windows" in curl_cv_header_winsock_h="no" curl_cv_header_winsock2_h="no" curl_cv_header_ws2tcpip_h="no" + curl_cv_header_wincrypt_h="no" curl_cv_header_winldap_h="no" curl_cv_header_winber_h="no" ;; esac CURL_CHECK_WIN32_LARGEFILE +CURL_CHECK_WIN32_CRYPTO -CURL_MAC_CFLAGS +CURL_DARWIN_CFLAGS +CURL_DARWIN_SYSTEMCONFIGURATION CURL_SUPPORTS_BUILTIN_AVAILABLE + dnl ************************************************************ dnl switch off particular protocols dnl AC_MSG_CHECKING([whether to support http]) AC_ARG_ENABLE(http, -AC_HELP_STRING([--enable-http],[Enable HTTP support]) -AC_HELP_STRING([--disable-http],[Disable HTTP support]), +AS_HELP_STRING([--enable-http],[Enable HTTP support]) +AS_HELP_STRING([--disable-http],[Disable HTTP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -369,6 +527,14 @@ AC_HELP_STRING([--disable-http],[Disable HTTP support]), AC_SUBST(CURL_DISABLE_HTTP, [1]) AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP]) AC_SUBST(CURL_DISABLE_RTSP, [1]) + dnl toggle off alt-svc too when HTTP is disabled + AC_DEFINE(CURL_DISABLE_ALTSVC, 1, [disable alt-svc]) + AC_DEFINE(CURL_DISABLE_HSTS, 1, [disable HSTS]) + curl_h1_msg="no (--enable-http, --with-hyper)" + curl_altsvc_msg="no"; + curl_hsts_msg="no (--enable-hsts)"; + enable_altsvc="no" + hsts="no" ;; *) AC_MSG_RESULT(yes) ;; @@ -377,8 +543,8 @@ AC_HELP_STRING([--disable-http],[Disable HTTP support]), ) AC_MSG_CHECKING([whether to support ftp]) AC_ARG_ENABLE(ftp, -AC_HELP_STRING([--enable-ftp],[Enable FTP support]) -AC_HELP_STRING([--disable-ftp],[Disable FTP support]), +AS_HELP_STRING([--enable-ftp],[Enable FTP support]) +AS_HELP_STRING([--disable-ftp],[Disable FTP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -392,8 +558,8 @@ AC_HELP_STRING([--disable-ftp],[Disable FTP support]), ) AC_MSG_CHECKING([whether to support file]) AC_ARG_ENABLE(file, -AC_HELP_STRING([--enable-file],[Enable FILE support]) -AC_HELP_STRING([--disable-file],[Disable FILE support]), +AS_HELP_STRING([--enable-file],[Enable FILE support]) +AS_HELP_STRING([--disable-file],[Disable FILE support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -407,14 +573,18 @@ AC_HELP_STRING([--disable-file],[Disable FILE support]), ) AC_MSG_CHECKING([whether to support ldap]) AC_ARG_ENABLE(ldap, -AC_HELP_STRING([--enable-ldap],[Enable LDAP support]) -AC_HELP_STRING([--disable-ldap],[Disable LDAP support]), +AS_HELP_STRING([--enable-ldap],[Enable LDAP support]) +AS_HELP_STRING([--disable-ldap],[Disable LDAP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) AC_SUBST(CURL_DISABLE_LDAP, [1]) ;; + yes) + ldap_askedfor="yes" + AC_MSG_RESULT(yes) + ;; *) AC_MSG_RESULT(yes) ;; @@ -423,8 +593,8 @@ AC_HELP_STRING([--disable-ldap],[Disable LDAP support]), ) AC_MSG_CHECKING([whether to support ldaps]) AC_ARG_ENABLE(ldaps, -AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support]) -AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]), +AS_HELP_STRING([--enable-ldaps],[Enable LDAPS support]) +AS_HELP_STRING([--disable-ldaps],[Disable LDAPS support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -453,41 +623,138 @@ AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]), fi ] ) -AC_MSG_CHECKING([whether to support rtsp]) -AC_ARG_ENABLE(rtsp, -AC_HELP_STRING([--enable-rtsp],[Enable RTSP support]) -AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]), -[ case "$enableval" in +dnl ********************************************************************** +dnl Check for Hyper +dnl ********************************************************************** + +OPT_HYPER="no" + +AC_ARG_WITH(hyper, +AS_HELP_STRING([--with-hyper=PATH],[Enable hyper usage]) +AS_HELP_STRING([--without-hyper],[Disable hyper usage]), + [OPT_HYPER=$withval]) +case "$OPT_HYPER" in no) + dnl --without-hyper option used + want_hyper="no" + ;; + yes) + dnl --with-hyper option used without path + want_hyper="default" + want_hyper_path="" + ;; + *) + dnl --with-hyper option used with path + want_hyper="yes" + want_hyper_path="$withval" + ;; +esac + +if test X"$want_hyper" != Xno; then + if test "x$disable_http" = "xyes"; then + AC_MSG_ERROR([--with-hyper is not compatible with --disable-http]) + fi + + dnl backup the pre-hyper variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(hyper, $want_hyper_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path]) + $PKGCONFIG --libs-only-l hyper` + CPP_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path]) dnl + $PKGCONFIG --cflags-only-I hyper` + LD_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path]) + $PKGCONFIG --libs-only-L hyper` + else + dnl no hyper pkg-config found + LIB_HYPER="-lhyper -ldl -lpthread -lm" + if test X"$want_hyper" != Xdefault; then + CPP_HYPER=-I"$want_hyper_path/capi/include" + LD_HYPER="-L$want_hyper_path/target/debug" + fi + fi + if test -n "$LIB_HYPER"; then + AC_MSG_NOTICE([-l is $LIB_HYPER]) + AC_MSG_NOTICE([-I is $CPP_HYPER]) + AC_MSG_NOTICE([-L is $LD_HYPER]) + + LDFLAGS="$LDFLAGS $LD_HYPER" + CPPFLAGS="$CPPFLAGS $CPP_HYPER" + LIBS="$LIB_HYPER $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_HYPER=`echo $LD_HYPER | $SED -e 's/^-L//'` + fi + + AC_CHECK_LIB(hyper, hyper_io_new, + [ + AC_CHECK_HEADERS(hyper.h, + experimental="$experimental Hyper" + AC_MSG_NOTICE([Hyper support is experimental]) + curl_h1_msg="enabled (Hyper)" + curl_h2_msg=$curl_h1_msg + HYPER_ENABLED=1 + AC_DEFINE(USE_HYPER, 1, [if hyper is in use]) + AC_SUBST(USE_HYPER, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_HYPER" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_HYPER to CURL_LIBRARY_PATH]), + ) + ], + AC_MSG_ERROR([--with-hyper but hyper was not found. See docs/HYPER.md.]) + ) + fi +fi + +if test X"$want_hyper" != Xno; then + AC_MSG_NOTICE([Disable RTSP support with hyper]) + AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP]) + AC_SUBST(CURL_DISABLE_RTSP, [1]) + +else + + AC_MSG_CHECKING([whether to support rtsp]) + AC_ARG_ENABLE(rtsp, + AS_HELP_STRING([--enable-rtsp],[Enable RTSP support]) + AS_HELP_STRING([--disable-rtsp],[Disable RTSP support]), + [ case "$enableval" in + no) AC_MSG_RESULT(no) AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP]) AC_SUBST(CURL_DISABLE_RTSP, [1]) ;; - *) if test x$CURL_DISABLE_HTTP = x1 ; then - AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!) + *) + if test x$CURL_DISABLE_HTTP = x1 ; then + AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!) else - AC_MSG_RESULT(yes) - curl_rtsp_msg="enabled" + AC_MSG_RESULT(yes) + curl_rtsp_msg="enabled" fi ;; - esac ], + esac ], if test "x$CURL_DISABLE_HTTP" != "x1"; then AC_MSG_RESULT(yes) curl_rtsp_msg="enabled" else AC_MSG_RESULT(no) fi -) + ) +fi AC_MSG_CHECKING([whether to support proxies]) AC_ARG_ENABLE(proxy, -AC_HELP_STRING([--enable-proxy],[Enable proxy support]) -AC_HELP_STRING([--disable-proxy],[Disable proxy support]), +AS_HELP_STRING([--enable-proxy],[Enable proxy support]) +AS_HELP_STRING([--disable-proxy],[Disable proxy support]), [ case "$enableval" in no) AC_MSG_RESULT(no) AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies]) AC_SUBST(CURL_DISABLE_PROXY, [1]) + https_proxy="no" ;; *) AC_MSG_RESULT(yes) ;; @@ -497,8 +764,8 @@ AC_HELP_STRING([--disable-proxy],[Disable proxy support]), AC_MSG_CHECKING([whether to support dict]) AC_ARG_ENABLE(dict, -AC_HELP_STRING([--enable-dict],[Enable DICT support]) -AC_HELP_STRING([--disable-dict],[Disable DICT support]), +AS_HELP_STRING([--enable-dict],[Enable DICT support]) +AS_HELP_STRING([--disable-dict],[Disable DICT support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -512,8 +779,8 @@ AC_HELP_STRING([--disable-dict],[Disable DICT support]), ) AC_MSG_CHECKING([whether to support telnet]) AC_ARG_ENABLE(telnet, -AC_HELP_STRING([--enable-telnet],[Enable TELNET support]) -AC_HELP_STRING([--disable-telnet],[Disable TELNET support]), +AS_HELP_STRING([--enable-telnet],[Enable TELNET support]) +AS_HELP_STRING([--disable-telnet],[Disable TELNET support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -527,8 +794,8 @@ AC_HELP_STRING([--disable-telnet],[Disable TELNET support]), ) AC_MSG_CHECKING([whether to support tftp]) AC_ARG_ENABLE(tftp, -AC_HELP_STRING([--enable-tftp],[Enable TFTP support]) -AC_HELP_STRING([--disable-tftp],[Disable TFTP support]), +AS_HELP_STRING([--enable-tftp],[Enable TFTP support]) +AS_HELP_STRING([--disable-tftp],[Disable TFTP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -543,8 +810,8 @@ AC_HELP_STRING([--disable-tftp],[Disable TFTP support]), AC_MSG_CHECKING([whether to support pop3]) AC_ARG_ENABLE(pop3, -AC_HELP_STRING([--enable-pop3],[Enable POP3 support]) -AC_HELP_STRING([--disable-pop3],[Disable POP3 support]), +AS_HELP_STRING([--enable-pop3],[Enable POP3 support]) +AS_HELP_STRING([--disable-pop3],[Disable POP3 support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -560,8 +827,8 @@ AC_HELP_STRING([--disable-pop3],[Disable POP3 support]), AC_MSG_CHECKING([whether to support imap]) AC_ARG_ENABLE(imap, -AC_HELP_STRING([--enable-imap],[Enable IMAP support]) -AC_HELP_STRING([--disable-imap],[Disable IMAP support]), +AS_HELP_STRING([--enable-imap],[Enable IMAP support]) +AS_HELP_STRING([--disable-imap],[Disable IMAP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -577,8 +844,8 @@ AC_HELP_STRING([--disable-imap],[Disable IMAP support]), AC_MSG_CHECKING([whether to support smb]) AC_ARG_ENABLE(smb, -AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support]) -AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]), +AS_HELP_STRING([--enable-smb],[Enable SMB/CIFS support]) +AS_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -593,8 +860,8 @@ AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]), AC_MSG_CHECKING([whether to support smtp]) AC_ARG_ENABLE(smtp, -AC_HELP_STRING([--enable-smtp],[Enable SMTP support]) -AC_HELP_STRING([--disable-smtp],[Disable SMTP support]), +AS_HELP_STRING([--enable-smtp],[Enable SMTP support]) +AS_HELP_STRING([--disable-smtp],[Disable SMTP support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -609,8 +876,8 @@ AC_HELP_STRING([--disable-smtp],[Disable SMTP support]), AC_MSG_CHECKING([whether to support gopher]) AC_ARG_ENABLE(gopher, -AC_HELP_STRING([--enable-gopher],[Enable Gopher support]) -AC_HELP_STRING([--disable-gopher],[Disable Gopher support]), +AS_HELP_STRING([--enable-gopher],[Enable Gopher support]) +AS_HELP_STRING([--disable-gopher],[Disable Gopher support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -623,6 +890,21 @@ AC_HELP_STRING([--disable-gopher],[Disable Gopher support]), AC_MSG_RESULT(yes) ) +AC_MSG_CHECKING([whether to support mqtt]) +AC_ARG_ENABLE(mqtt, +AS_HELP_STRING([--enable-mqtt],[Enable MQTT support]) +AS_HELP_STRING([--disable-mqtt],[Disable MQTT support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_MQTT, 1, [to disable MQTT]) + AC_SUBST(CURL_DISABLE_MQTT, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(no) +) dnl ********************************************************************** dnl Check for built-in manual @@ -630,8 +912,8 @@ dnl ********************************************************************** AC_MSG_CHECKING([whether to provide built-in manual]) AC_ARG_ENABLE(manual, -AC_HELP_STRING([--enable-manual],[Enable built-in manual]) -AC_HELP_STRING([--disable-manual],[Disable built-in manual]), +AS_HELP_STRING([--enable-manual],[Enable built-in manual]) +AS_HELP_STRING([--disable-manual],[Disable built-in manual]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -651,8 +933,8 @@ 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]), +AS_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support]) +AS_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -671,7 +953,7 @@ dnl ********************************************************************** AC_MSG_CHECKING([whether to use libgcc]) AC_ARG_ENABLE(libgcc, -AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]), +AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]), [ case "$enableval" in yes) LIBS="-lgcc $LIBS" @@ -825,6 +1107,28 @@ then ]) fi +if test "$HAVE_GETHOSTBYNAME" != "1" -o "${with_amissl+set}" = set +then + dnl This is for AmigaOS with bsdsocket.library - needs testing before -lnet + AC_MSG_CHECKING([for gethostbyname for AmigaOS bsdsocket.library]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #include + struct Library *SocketBase = NULL; + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + HAVE_PROTO_BSDSOCKET_H="1" + AC_DEFINE(HAVE_PROTO_BSDSOCKET_H, 1, [if Amiga bsdsocket.library is in use]) + AC_SUBST(HAVE_PROTO_BSDSOCKET_H, [1]) + ],[ + AC_MSG_RESULT([no]) + ]) +fi + if test "$HAVE_GETHOSTBYNAME" != "1" then dnl gethostbyname in the network lib - for Haiku OS @@ -877,8 +1181,8 @@ clean_LDFLAGS=$LDFLAGS clean_LIBS=$LIBS ZLIB_LIBS="" AC_ARG_WITH(zlib, -AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH]) -AC_HELP_STRING([--without-zlib],[disable use of zlib]), +AS_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH]) +AS_HELP_STRING([--without-zlib],[disable use of zlib]), [OPT_ZLIB="$withval"]) if test "$OPT_ZLIB" = "no" ; then @@ -975,18 +1279,193 @@ dnl set variable for use in automakefile(s) AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1) AC_SUBST(ZLIB_LIBS) +dnl ********************************************************************** +dnl Check for the presence of BROTLI decoder libraries and headers +dnl ********************************************************************** + +dnl Brotli project home page: https://github.com/google/brotli + +dnl Default to compiler & linker defaults for BROTLI files & libraries. +OPT_BROTLI=off +AC_ARG_WITH(brotli,dnl +AS_HELP_STRING([--with-brotli=PATH],[Where to look for brotli, PATH points to the BROTLI installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--without-brotli], [disable BROTLI]), + OPT_BROTLI=$withval) + +if test X"$OPT_BROTLI" != Xno; then + dnl backup the pre-brotli variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_BROTLI" in + yes) + dnl --with-brotli (without path) used + CURL_CHECK_PKGCONFIG(libbrotlidec) + + if test "$PKGCONFIG" != "no" ; then + LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec` + LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec` + CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec` + version=`$PKGCONFIG --modversion libbrotlidec` + DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/^-L//'` + fi + + ;; + off) + dnl no --with-brotli option given, just check default places + ;; + *) + dnl use the given --with-brotli spot + PREFIX_BROTLI=$OPT_BROTLI + ;; + esac + + dnl if given with a prefix, we set -L and -I based on that + if test -n "$PREFIX_BROTLI"; then + LIB_BROTLI="-lbrotlidec" + LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff + CPP_BROTLI=-I${PREFIX_BROTLI}/include + DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_BROTLI" + CPPFLAGS="$CPPFLAGS $CPP_BROTLI" + LIBS="$LIB_BROTLI $LIBS" + + AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress) + + AC_CHECK_HEADERS(brotli/decode.h, + curl_brotli_msg="enabled (libbrotlidec)" + HAVE_BROTLI=1 + AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use]) + AC_SUBST(HAVE_BROTLI, [1]) + ) + + if test X"$OPT_BROTLI" != Xoff && + test "$HAVE_BROTLI" != "1"; then + AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!]) + fi + + if test "$HAVE_BROTLI" = "1"; then + if test -n "$DIR_BROTLI"; then + dnl when the brotli shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH + dnl to prevent further configure tests to fail due to this + + if test "x$cross_compiling" != "xyes"; then + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH]) + fi + fi + else + dnl no brotli, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + fi +fi + +dnl ********************************************************************** +dnl Check for libzstd +dnl ********************************************************************** + +dnl Default to compiler & linker defaults for libzstd +OPT_ZSTD=off +AC_ARG_WITH(zstd,dnl +AS_HELP_STRING([--with-zstd=PATH],[Where to look for libzstd, PATH points to the libzstd installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--without-zstd], [disable libzstd]), + OPT_ZSTD=$withval) + +if test X"$OPT_ZSTD" != Xno; then + dnl backup the pre-zstd variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_ZSTD" in + yes) + dnl --with-zstd (without path) used + CURL_CHECK_PKGCONFIG(libzstd) + + if test "$PKGCONFIG" != "no" ; then + LIB_ZSTD=`$PKGCONFIG --libs-only-l libzstd` + LD_ZSTD=`$PKGCONFIG --libs-only-L libzstd` + CPP_ZSTD=`$PKGCONFIG --cflags-only-I libzstd` + version=`$PKGCONFIG --modversion libzstd` + DIR_ZSTD=`echo $LD_ZSTD | $SED -e 's/-L//'` + fi + + ;; + off) + dnl no --with-zstd option given, just check default places + ;; + *) + dnl use the given --with-zstd spot + PREFIX_ZSTD=$OPT_ZSTD + ;; + esac + + dnl if given with a prefix, we set -L and -I based on that + if test -n "$PREFIX_ZSTD"; then + LIB_ZSTD="-lzstd" + LD_ZSTD=-L${PREFIX_ZSTD}/lib$libsuff + CPP_ZSTD=-I${PREFIX_ZSTD}/include + DIR_ZSTD=${PREFIX_ZSTD}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_ZSTD" + CPPFLAGS="$CPPFLAGS $CPP_ZSTD" + LIBS="$LIB_ZSTD $LIBS" + + AC_CHECK_LIB(zstd, ZSTD_createDStream) + + AC_CHECK_HEADERS(zstd.h, + curl_zstd_msg="enabled (libzstd)" + HAVE_ZSTD=1 + AC_DEFINE(HAVE_ZSTD, 1, [if libzstd is in use]) + AC_SUBST(HAVE_ZSTD, [1]) + ) + + if test X"$OPT_ZSTD" != Xoff && + test "$HAVE_ZSTD" != "1"; then + AC_MSG_ERROR([libzstd was not found where specified!]) + fi + + if test "$HAVE_ZSTD" = "1"; then + if test -n "$DIR_ZSTD"; then + dnl when the zstd shared lib were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl CURL_LIBRARY_PATH to prevent further configure tests to fail due to + dnl this + + if test "x$cross_compiling" != "xyes"; then + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_ZSTD" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_ZSTD to CURL_LIBRARY_PATH]) + fi + fi + else + dnl no zstd, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + fi +fi + dnl ********************************************************************** dnl Check for LDAP dnl ********************************************************************** LDAPLIBNAME="" AC_ARG_WITH(ldap-lib, -AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]), +AS_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]), [LDAPLIBNAME="$withval"]) LBERLIBNAME="" AC_ARG_WITH(lber-lib, -AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]), +AS_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]), [LBERLIBNAME="$withval"]) if test x$CURL_DISABLE_LDAP != x1 ; then @@ -1006,6 +1485,9 @@ if test x$CURL_DISABLE_LDAP != x1 ; then if test "$LDAPLIBNAME" ; then AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [ + if test -n "$ldap_askedfor"; then + AC_MSG_ERROR([couldn't detect the LDAP libraries]) + fi AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled]) AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) AC_SUBST(CURL_DISABLE_LDAP, [1]) @@ -1016,6 +1498,9 @@ if test x$CURL_DISABLE_LDAP != x1 ; then CURL_CHECK_LIBS_LDAP case X-"$curl_cv_ldap_LIBS" in X-unknown) + if test -n "$ldap_askedfor"; then + AC_MSG_ERROR([couldn't detect the LDAP libraries]) + fi AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled]) AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) AC_SUBST(CURL_DISABLE_LDAP, [1]) @@ -1067,8 +1552,8 @@ dnl ********************************************************************** AC_MSG_CHECKING([whether to enable IPv6]) AC_ARG_ENABLE(ipv6, -AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support]) -AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]), +AS_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support]) +AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -1079,21 +1564,30 @@ AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]), ;; esac ], - AC_TRY_RUN([ /* is AF_INET6 available? */ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +/* are AF_INET6 and sockaddr_in6 available? */ #include #ifdef HAVE_WINSOCK2_H #include +#include #else #include +#include +#if defined (__TANDEM) +# include +#endif #endif #include /* for exit() */ main() { + struct sockaddr_in6 s; + (void)s; if (socket(AF_INET6, SOCK_STREAM, 0) < 0) exit(1); else exit(0); } +]]) ], AC_MSG_RESULT(yes) ipv6=yes, @@ -1103,28 +1597,33 @@ main() ipv6=yes )) -if test "$ipv6" = "yes"; then +if test "$ipv6" = yes; then curl_ipv6_msg="enabled" -fi + AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) + IPV6_ENABLED=1 + AC_SUBST(IPV6_ENABLED) -# Check if struct sockaddr_in6 have sin6_scope_id member -if test "$ipv6" = yes; then AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member]) - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #include #ifdef HAVE_WINSOCK2_H #include #include #else #include -#endif] , - struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes) - if test "$have_sin6_scope_id" = yes; then - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member]) - else +#if defined (__TANDEM) +# include +#endif +#endif +]], [[ + struct sockaddr_in6 s; + s.sin6_scope_id = 0; +]])], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member]) + ], [ AC_MSG_RESULT([no]) - fi + ]) fi dnl ********************************************************************** @@ -1132,14 +1631,14 @@ dnl Check if the operating system allows programs to write to their own argv[] dnl ********************************************************************** AC_MSG_CHECKING([if argv can be written to]) -AC_RUN_IFELSE([ - AC_LANG_SOURCE([[ -int main(int argc, char ** argv) { - argv[0][0] = ' '; - return (argv[0][0] == ' ')?0:1; +CURL_RUN_IFELSE([[ +int main(int argc, char **argv) +{ + (void)argc; + argv[0][0] = ' '; + return (argv[0][0] == ' ')?0:1; } - ]]) -],[ +]],[ curl_cv_writable_argv=yes ],[ curl_cv_writable_argv=no @@ -1168,21 +1667,21 @@ dnl check for GSS-API stuff in the /usr as default GSSAPI_ROOT="/usr" AC_ARG_WITH(gssapi-includes, - AC_HELP_STRING([--with-gssapi-includes=DIR], + AS_HELP_STRING([--with-gssapi-includes=DIR], [Specify location of GSS-API headers]), [ GSSAPI_INCS="-I$withval" want_gss="yes" ] ) AC_ARG_WITH(gssapi-libs, - AC_HELP_STRING([--with-gssapi-libs=DIR], + AS_HELP_STRING([--with-gssapi-libs=DIR], [Specify location of GSS-API libs]), [ GSSAPI_LIB_DIR="-L$withval" want_gss="yes" ] ) AC_ARG_WITH(gssapi, - AC_HELP_STRING([--with-gssapi=DIR], + AS_HELP_STRING([--with-gssapi=DIR], [Where to look for GSS-API]), [ GSSAPI_ROOT="$withval" if test x"$GSSAPI_ROOT" != xno; then @@ -1348,8 +1847,8 @@ dnl ------------------------------------------------------------- DEFAULT_SSL_BACKEND=no VALID_DEFAULT_SSL_BACKEND= AC_ARG_WITH(default-ssl-backend, -AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend]) -AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]), +AS_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend]) +AS_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]), [DEFAULT_SSL_BACKEND=$withval]) case "$DEFAULT_SSL_BACKEND" in no) @@ -1367,1128 +1866,48 @@ case "$DEFAULT_SSL_BACKEND" in ;; esac -dnl ********************************************************************** +CURL_WITH_SCHANNEL +CURL_WITH_SECURETRANSPORT +CURL_WITH_AMISSL +CURL_WITH_OPENSSL +CURL_WITH_GNUTLS +CURL_WITH_MBEDTLS +CURL_WITH_WOLFSSL +CURL_WITH_MESALINK +CURL_WITH_BEARSSL +CURL_WITH_RUSTLS +CURL_WITH_NSS + +dnl link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL +if test "x$USE_WIN32_CRYPTO" = "x1" -o "x$USE_SCHANNEL" = "x1"; then + LIBS="-ladvapi32 -lcrypt32 $LIBS" +fi -dnl ------------------------------------------------- -dnl check winssl option before other SSL libraries -dnl ------------------------------------------------- +case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$MBEDTLS_ENABLED$WOLFSSL_ENABLED$SCHANNEL_ENABLED$SECURETRANSPORT_ENABLED$MESALINK_ENABLED$BEARSSL_ENABLED$AMISSL_ENABLED$RUSTLS_ENABLED" +in +x) + AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.]) + AC_MSG_WARN([Use --with-openssl, --with-gnutls, --with-wolfssl, --with-mbedtls, --with-nss, --with-schannel, --with-secure-transport, --with-mesalink, --with-amissl, --with-bearssl or --with-rustls to address this.]) + ;; +x1) + # one SSL backend is enabled + AC_SUBST(SSL_ENABLED) + SSL_ENABLED="1" + AC_MSG_NOTICE([built with one SSL backend]) + ;; +*) + # more than one SSL backend is enabled + AC_SUBST(SSL_ENABLED) + SSL_ENABLED="1" + AC_SUBST(CURL_WITH_MULTI_SSL) + CURL_WITH_MULTI_SSL="1" + AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends]) + AC_MSG_NOTICE([built with multiple SSL backends]) + ;; +esac -OPT_WINSSL=no -AC_ARG_WITH(winssl,dnl -AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS]) -AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]), - OPT_WINSSL=$withval) - -AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)]) -if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then - ssl_msg= - if test "x$OPT_WINSSL" != "xno" && - test "x$curl_cv_native_windows" = "xyes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support]) - AC_SUBST(USE_SCHANNEL, [1]) - ssl_msg="Windows-native" - test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - WINSSL_ENABLED=1 - # --with-winssl implies --enable-sspi - AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support]) - AC_SUBST(USE_WINDOWS_SSPI, [1]) - curl_sspi_msg="enabled" - LIBS="-lcrypt32 $LIBS" - else - AC_MSG_RESULT(no) - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -else - AC_MSG_RESULT(no) -fi - -OPT_DARWINSSL=no -AC_ARG_WITH(darwinssl,dnl -AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS]) -AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]), - OPT_DARWINSSL=$withval) - -AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS]) -if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then - if test "x$OPT_DARWINSSL" != "xno" && - test -d "/System/Library/Frameworks/Security.framework"; then - AC_MSG_RESULT(yes) - AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support]) - AC_SUBST(USE_DARWINSSL, [1]) - ssl_msg="Apple OS-native" - test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - DARWINSSL_ENABLED=1 - LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security" - else - AC_MSG_RESULT(no) - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -else - AC_MSG_RESULT(no) -fi - -dnl ********************************************************************** -dnl Check for the presence of SSL libraries and headers -dnl ********************************************************************** - -dnl Default to compiler & linker defaults for SSL files & libraries. -OPT_SSL=off -dnl Default to no CA bundle -ca="no" -AC_ARG_WITH(ssl,dnl -AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) -AC_HELP_STRING([--without-ssl], [disable OpenSSL]), - OPT_SSL=$withval) - -if test -z "$ssl_backends" -o "x$OPT_SSL" != xno && - test X"$OPT_SSL" != Xno; then - ssl_msg= - - dnl backup the pre-ssl variables - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - dnl This is for Msys/Mingw - case $host in - *-*-msys* | *-*-mingw*) - AC_MSG_CHECKING([for gdi32]) - my_ac_save_LIBS=$LIBS - LIBS="-lgdi32 $LIBS" - AC_TRY_LINK([#include - #include ], - [GdiFlush();], - [ dnl worked! - AC_MSG_RESULT([yes])], - [ dnl failed, restore LIBS - LIBS=$my_ac_save_LIBS - AC_MSG_RESULT(no)] - ) - ;; - esac - - case "$OPT_SSL" in - yes) - dnl --with-ssl (without path) used - if test x$cross_compiling != xyes; then - dnl only do pkg-config magic when not cross-compiling - PKGTEST="yes" - fi - PREFIX_OPENSSL=/usr/local/ssl - LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" - ;; - off) - dnl no --with-ssl option given, just check default places - if test x$cross_compiling != xyes; then - dnl only do pkg-config magic when not cross-compiling - PKGTEST="yes" - fi - PREFIX_OPENSSL= - ;; - *) - dnl check the given --with-ssl spot - PKGTEST="no" - PREFIX_OPENSSL=$OPT_SSL - - dnl Try pkg-config even when cross-compiling. Since we - dnl specify PKG_CONFIG_LIBDIR we're only looking where - dnl the user told us to look - OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig" - AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"]) - if test -f "$OPENSSL_PCDIR/openssl.pc"; then - PKGTEST="yes" - fi - - dnl in case pkg-config comes up empty, use what we got - dnl via --with-ssl - LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" - if test "$PREFIX_OPENSSL" != "/usr" ; then - SSL_LDFLAGS="-L$LIB_OPENSSL" - SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include" - fi - SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl" - ;; - esac - - if test "$PKGTEST" = "yes"; then - - CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR]) - - if test "$PKGCONFIG" != "no" ; then - SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl - $PKGCONFIG --libs-only-l openssl 2>/dev/null` - - SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl - $PKGCONFIG --libs-only-L openssl 2>/dev/null` - - SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl - $PKGCONFIG --cflags-only-I openssl 2>/dev/null` - - AC_SUBST(SSL_LIBS) - AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"]) - AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"]) - AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"]) - - LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` - - dnl use the values pkg-config reported. This is here - dnl instead of below with CPPFLAGS and LDFLAGS because we only - dnl learn about this via pkg-config. If we only have - dnl the argument to --with-ssl we don't know what - dnl additional libs may be necessary. Hope that we - dnl don't need any. - LIBS="$SSL_LIBS $LIBS" - fi - fi - - dnl finally, set flags to use SSL - CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" - LDFLAGS="$LDFLAGS $SSL_LDFLAGS" - - AC_CHECK_LIB(crypto, HMAC_Update,[ - HAVECRYPTO="yes" - LIBS="-lcrypto $LIBS" - ],[ - LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL" - CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include" - AC_CHECK_LIB(crypto, HMAC_Init_ex,[ - HAVECRYPTO="yes" - LIBS="-lcrypto $LIBS"], [ - - dnl still no, but what about with -ldl? - AC_MSG_CHECKING([OpenSSL linking with -ldl]) - LIBS="-ldl $LIBS" - AC_TRY_LINK( - [ - #include - ], - [ - ERR_clear_error(); - ], - [ - AC_MSG_RESULT(yes) - HAVECRYPTO="yes" - ], - [ - AC_MSG_RESULT(no) - dnl ok, so what about bouth -ldl and -lpthread? - - AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread]) - LIBS="-lpthread $LIBS" - AC_TRY_LINK( - [ - #include - ], - [ - ERR_clear_error(); - ], - [ - AC_MSG_RESULT(yes) - HAVECRYPTO="yes" - ], - [ - AC_MSG_RESULT(no) - LDFLAGS="$CLEANLDFLAGS" - CPPFLAGS="$CLEANCPPFLAGS" - LIBS="$CLEANLIBS" - - ]) - - ]) - - ]) - ]) - - if test X"$HAVECRYPTO" = X"yes"; then - dnl This is only reasonable to do if crypto actually is there: check for - dnl SSL libs NOTE: it is important to do this AFTER the crypto lib - - AC_CHECK_LIB(ssl, SSL_connect) - - if test "$ac_cv_lib_ssl_SSL_connect" != yes; then - dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff - AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use); - OLIBS=$LIBS - LIBS="-lRSAglue -lrsaref $LIBS" - AC_CHECK_LIB(ssl, SSL_connect) - if test "$ac_cv_lib_ssl_SSL_connect" != yes; then - dnl still no SSL_connect - AC_MSG_RESULT(no) - LIBS=$OLIBS - else - AC_MSG_RESULT(yes) - fi - - else - - dnl Have the libraries--check for OpenSSL headers - AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \ - openssl/pem.h openssl/ssl.h openssl/err.h, - ssl_msg="OpenSSL" - test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - OPENSSL_ENABLED=1 - AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use])) - - if test $ac_cv_header_openssl_x509_h = no; then - dnl we don't use the "action" part of the AC_CHECK_HEADERS macro - dnl since 'err.h' might in fact find a krb4 header with the same - dnl name - AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h) - - if test $ac_cv_header_x509_h = yes && - test $ac_cv_header_crypto_h = yes && - test $ac_cv_header_ssl_h = yes; then - dnl three matches - ssl_msg="OpenSSL" - OPENSSL_ENABLED=1 - fi - fi - fi - - if test X"$OPENSSL_ENABLED" != X"1"; then - LIBS="$CLEANLIBS" - fi - - if test X"$OPT_SSL" != Xoff && - test "$OPENSSL_ENABLED" != "1"; then - AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!]) - fi - fi - - if test X"$OPENSSL_ENABLED" = X"1"; then - dnl If the ENGINE library seems to be around, check for the OpenSSL engine - dnl stuff, it is kind of "separated" from the main SSL check - AC_CHECK_FUNC(ENGINE_init, - [ - AC_CHECK_HEADERS(openssl/engine.h) - AC_CHECK_FUNCS( ENGINE_load_builtin_engines ) - ]) - - dnl These can only exist if OpenSSL exists - dnl Older versions of Cyassl (some time before 2.9.4) don't have - dnl SSL_get_shutdown (but this check won't actually detect it there - dnl as it's a macro that needs the header files be included) - - AC_CHECK_FUNCS( RAND_egd \ - ENGINE_cleanup \ - SSL_get_shutdown \ - SSLv2_client_method ) - - AC_MSG_CHECKING([for BoringSSL]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - #include - ]],[[ - #ifndef OPENSSL_IS_BORINGSSL - #error not boringssl - #endif - ]]) - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1, - [Define to 1 if using BoringSSL.]) - ssl_msg="BoringSSL" - ],[ - AC_MSG_RESULT([no]) - ]) - - AC_MSG_CHECKING([for libressl]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - int dummy = LIBRESSL_VERSION_NUMBER; - ]]) - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1, - [Define to 1 if using libressl.]) - ssl_msg="libressl" - ],[ - AC_MSG_RESULT([no]) - ]) - fi - - if test "$OPENSSL_ENABLED" = "1"; then - if test -n "$LIB_OPENSSL"; then - dnl when the ssl shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH - dnl to prevent further configure tests to fail due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH]) - fi - fi - CURL_CHECK_OPENSSL_API - fi - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -dnl ********************************************************************** -dnl Check for the random seed preferences -dnl ********************************************************************** - -if test X"$OPENSSL_ENABLED" = X"1"; then - AC_ARG_WITH(egd-socket, - AC_HELP_STRING([--with-egd-socket=FILE], - [Entropy Gathering Daemon socket pathname]), - [ EGD_SOCKET="$withval" ] - ) - if test -n "$EGD_SOCKET" ; then - AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET", - [your Entropy Gathering Daemon socket pathname] ) - fi - - dnl Check for user-specified random device - AC_ARG_WITH(random, - AC_HELP_STRING([--with-random=FILE], - [read randomness from FILE (default=/dev/urandom)]), - [ RANDOM_FILE="$withval" ], - [ - if test x$cross_compiling != xyes; then - dnl Check for random device - AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] ) - else - AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling]) - fi - ] - ) - if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then - AC_SUBST(RANDOM_FILE) - AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE", - [a suitable file to read random data from]) - fi -fi - -dnl --- -dnl We require OpenSSL with SRP support. -dnl --- -if test "$OPENSSL_ENABLED" = "1"; then - AC_CHECK_LIB(crypto, SRP_Calc_client_key, - [ - AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key]) - AC_SUBST(HAVE_OPENSSL_SRP, [1]) - ]) -fi - -dnl ---------------------------------------------------- -dnl check for GnuTLS -dnl ---------------------------------------------------- - -dnl Default to compiler & linker defaults for GnuTLS files & libraries. -OPT_GNUTLS=no - -AC_ARG_WITH(gnutls,dnl -AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root]) -AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]), - OPT_GNUTLS=$withval) - -if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then - ssl_msg= - - if test X"$OPT_GNUTLS" != Xno; then - - addld="" - addlib="" - gtlslib="" - version="" - addcflags="" - - if test "x$OPT_GNUTLS" = "xyes"; then - dnl this is with no partiular path given - CURL_CHECK_PKGCONFIG(gnutls) - - if test "$PKGCONFIG" != "no" ; then - addlib=`$PKGCONFIG --libs-only-l gnutls` - addld=`$PKGCONFIG --libs-only-L gnutls` - addcflags=`$PKGCONFIG --cflags-only-I gnutls` - version=`$PKGCONFIG --modversion gnutls` - gtlslib=`echo $addld | $SED -e 's/-L//'` - else - dnl without pkg-config, we try libgnutls-config as that was how it - dnl used to be done - check=`libgnutls-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`libgnutls-config --libs` - addcflags=`libgnutls-config --cflags` - version=`libgnutls-config --version` - gtlslib=`libgnutls-config --prefix`/lib$libsuff - fi - fi - else - dnl this is with a given path, first check if there's a libgnutls-config - dnl there and if not, make an educated guess - cfg=$OPT_GNUTLS/bin/libgnutls-config - check=`$cfg --version 2>/dev/null` - if test -n "$check"; then - addlib=`$cfg --libs` - addcflags=`$cfg --cflags` - version=`$cfg --version` - gtlslib=`$cfg --prefix`/lib$libsuff - else - dnl without pkg-config and libgnutls-config, we guess a lot! - addlib=-lgnutls - addld=-L$OPT_GNUTLS/lib$libsuff - addcflags=-I$OPT_GNUTLS/include - version="" # we just don't know - gtlslib=$OPT_GNUTLS/lib$libsuff - fi - fi - - if test -z "$version"; then - dnl lots of efforts, still no go - version="unknown" - fi - - if test -n "$addlib"; then - - CLEANLIBS="$LIBS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLDFLAGS="$LDFLAGS" - - LIBS="$addlib $LIBS" - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - AC_CHECK_LIB(gnutls, gnutls_check_version, - [ - AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled]) - AC_SUBST(USE_GNUTLS, [1]) - GNUTLS_ENABLED=1 - USE_GNUTLS="yes" - ssl_msg="GnuTLS" - test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - LIBS="$CLEANLIBS" - CPPFLAGS="$CLEANCPPFLAGS" - ]) - - if test "x$USE_GNUTLS" = "xyes"; then - AC_MSG_NOTICE([detected GnuTLS version $version]) - - if test -n "$gtlslib"; then - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH]) - fi - fi - AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init]) - fi - - fi - - fi dnl GNUTLS not disabled - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -dnl --- -dnl Check which crypto backend GnuTLS uses -dnl --- - -if test "$GNUTLS_ENABLED" = "1"; then - USE_GNUTLS_NETTLE= - # First check if we can detect either crypto library via transitive linking - AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ]) - if test "$USE_GNUTLS_NETTLE" = ""; then - AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ]) - fi - # If not, try linking directly to both of them to see if they are available - if test "$USE_GNUTLS_NETTLE" = ""; then - AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ]) - fi - if test "$USE_GNUTLS_NETTLE" = ""; then - AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ]) - fi - if test "$USE_GNUTLS_NETTLE" = ""; then - AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found]) - fi - if test "$USE_GNUTLS_NETTLE" = "1"; then - AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend]) - AC_SUBST(USE_GNUTLS_NETTLE, [1]) - LIBS="-lnettle $LIBS" - else - LIBS="-lgcrypt $LIBS" - fi -fi - -dnl --- -dnl We require GnuTLS with SRP support. -dnl --- -if test "$GNUTLS_ENABLED" = "1"; then - AC_CHECK_LIB(gnutls, gnutls_srp_verifier, - [ - AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier]) - AC_SUBST(HAVE_GNUTLS_SRP, [1]) - ]) -fi - -dnl ---------------------------------------------------- -dnl check for PolarSSL -dnl ---------------------------------------------------- - -dnl Default to compiler & linker defaults for PolarSSL files & libraries. -OPT_POLARSSL=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS -AC_ARG_WITH(polarssl,dnl -AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root]) -AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]), - OPT_POLARSSL=$withval) - -if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then - ssl_msg= - - if test X"$OPT_POLARSSL" != Xno; then - - if test "$OPT_POLARSSL" = "yes"; then - OPT_POLARSSL="" - fi - - if test -z "$OPT_POLARSSL" ; then - dnl check for lib first without setting any new path - - AC_CHECK_LIB(polarssl, havege_init, - dnl libpolarssl found, set the variable - [ - AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled]) - AC_SUBST(USE_POLARSSL, [1]) - POLARSSL_ENABLED=1 - USE_POLARSSL="yes" - ssl_msg="PolarSSL" - test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ]) - fi - - addld="" - addlib="" - addcflags="" - polarssllib="" - - if test "x$USE_POLARSSL" != "xyes"; then - dnl add the path and test again - addld=-L$OPT_POLARSSL/lib$libsuff - addcflags=-I$OPT_POLARSSL/include - polarssllib=$OPT_POLARSSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - AC_CHECK_LIB(polarssl, ssl_init, - [ - AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled]) - AC_SUBST(USE_POLARSSL, [1]) - POLARSSL_ENABLED=1 - USE_POLARSSL="yes" - ssl_msg="PolarSSL" - test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - ]) - fi - - if test "x$USE_POLARSSL" = "xyes"; then - AC_MSG_NOTICE([detected PolarSSL]) - - LIBS="-lpolarssl $LIBS" - - if test -n "$polarssllib"; then - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH]) - fi - fi - fi - - fi dnl PolarSSL not disabled - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -dnl ---------------------------------------------------- -dnl check for mbedTLS -dnl ---------------------------------------------------- - -OPT_MBEDTLS=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS -AC_ARG_WITH(mbedtls,dnl -AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root]) -AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]), - OPT_MBEDTLS=$withval) - -if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then - ssl_msg= - - if test X"$OPT_MBEDTLS" != Xno; then - - if test "$OPT_MBEDTLS" = "yes"; then - OPT_MBEDTLS="" - fi - - if test -z "$OPT_MBEDTLS" ; then - dnl check for lib first without setting any new path - - AC_CHECK_LIB(mbedtls, mbedtls_havege_init, - dnl libmbedtls found, set the variable - [ - AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled]) - AC_SUBST(USE_MBEDTLS, [1]) - MBEDTLS_ENABLED=1 - USE_MBEDTLS="yes" - ssl_msg="mbedTLS" - test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], [], -lmbedx509 -lmbedcrypto) - fi - - addld="" - addlib="" - addcflags="" - mbedtlslib="" - - if test "x$USE_MBEDTLS" != "xyes"; then - dnl add the path and test again - addld=-L$OPT_MBEDTLS/lib$libsuff - addcflags=-I$OPT_MBEDTLS/include - mbedtlslib=$OPT_MBEDTLS/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, - [ - AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled]) - AC_SUBST(USE_MBEDTLS, [1]) - MBEDTLS_ENABLED=1 - USE_MBEDTLS="yes" - ssl_msg="mbedTLS" - test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - ], -lmbedx509 -lmbedcrypto) - fi - - if test "x$USE_MBEDTLS" = "xyes"; then - AC_MSG_NOTICE([detected mbedTLS]) - - LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS" - - if test -n "$mbedtlslib"; then - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $mbedtlslib to LD_LIBRARY_PATH]) - fi - fi - fi - - fi dnl mbedTLS not disabled - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -dnl ---------------------------------------------------- -dnl check for CyaSSL -dnl ---------------------------------------------------- - -dnl Default to compiler & linker defaults for CyaSSL files & libraries. -OPT_CYASSL=no - -_cppflags=$CPPFLAGS -_ldflags=$LDFLAGS -AC_ARG_WITH(cyassl,dnl -AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)]) -AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]), - OPT_CYASSL=$withval) - -if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then - ssl_msg= - - if test X"$OPT_CYASSL" != Xno; then - - if test "$OPT_CYASSL" = "yes"; then - OPT_CYASSL="" - fi - - dnl This should be reworked to use pkg-config instead - - cyassllibname=cyassl - - if test -z "$OPT_CYASSL" ; then - dnl check for lib in system default first - - AC_CHECK_LIB(cyassl, CyaSSL_Init, - dnl libcyassl found, set the variable - [ - AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled]) - AC_SUBST(USE_CYASSL, [1]) - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="CyaSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ]) - fi - - addld="" - addlib="" - addcflags="" - cyassllib="" - - if test "x$USE_CYASSL" != "xyes"; then - dnl add the path and test again - addld=-L$OPT_CYASSL/lib$libsuff - addcflags=-I$OPT_CYASSL/include - cyassllib=$OPT_CYASSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - AC_CHECK_LIB(cyassl, CyaSSL_Init, - [ - AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled]) - AC_SUBST(USE_CYASSL, [1]) - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="CyaSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - cyassllib="" - ]) - fi - - addld="" - addlib="" - addcflags="" - - if test "x$USE_CYASSL" != "xyes"; then - dnl libcyassl renamed to libwolfssl as of 3.4.0 - addld=-L$OPT_CYASSL/lib$libsuff - addcflags=-I$OPT_CYASSL/include - cyassllib=$OPT_CYASSL/lib$libsuff - - LDFLAGS="$LDFLAGS $addld" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - cyassllibname=wolfssl - my_ac_save_LIBS="$LIBS" - LIBS="-l$cyassllibname -lm $LIBS" - - AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -/* These aren't needed for detection and confuse WolfSSL. - They are set up properly later if it is detected. */ -#undef SIZEOF_LONG -#undef SIZEOF_LONG_LONG -#include - ]],[[ - return CyaSSL_Init(); - ]]) - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled]) - AC_SUBST(USE_CYASSL, [1]) - CYASSL_ENABLED=1 - USE_CYASSL="yes" - ssl_msg="WolfSSL" - test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - AC_MSG_RESULT(no) - CPPFLAGS=$_cppflags - LDFLAGS=$_ldflags - cyassllib="" - ]) - LIBS="$my_ac_save_LIBS" - fi - - if test "x$USE_CYASSL" = "xyes"; then - AC_MSG_NOTICE([detected $cyassllibname]) - - dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined! - AC_CHECK_SIZEOF(long long) - - dnl Versions since at least 2.6.0 may have options.h - AC_CHECK_HEADERS(cyassl/options.h) - - dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h - AC_CHECK_HEADERS(cyassl/error-ssl.h) - - LIBS="-l$cyassllibname -lm $LIBS" - - if test "x$cyassllibname" = "xwolfssl"; then - dnl Recent WolfSSL versions build without SSLv3 by default - dnl WolfSSL needs configure --enable-opensslextra to have *get_peer* - AC_CHECK_FUNCS(wolfSSLv3_client_method \ - wolfSSL_CTX_UseSupportedCurve \ - wolfSSL_get_peer_certificate \ - wolfSSL_UseALPN) - else - dnl Cyassl needs configure --enable-opensslextra to have *get_peer* - AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \ - CyaSSL_get_peer_certificate) - fi - - if test -n "$cyassllib"; then - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH]) - fi - fi - - fi - - fi dnl CyaSSL not disabled - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -dnl ---------------------------------------------------- -dnl NSS. Only check if GnuTLS and OpenSSL are not enabled -dnl ---------------------------------------------------- - -dnl Default to compiler & linker defaults for NSS files & libraries. -OPT_NSS=no - -AC_ARG_WITH(nss,dnl -AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root]) -AC_HELP_STRING([--without-nss], [disable NSS detection]), - OPT_NSS=$withval) - -if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then - ssl_msg= - - if test X"$OPT_NSS" != Xno; then - - addld="" - addlib="" - addcflags="" - nssprefix="" - version="" - - if test "x$OPT_NSS" = "xyes"; then - - CURL_CHECK_PKGCONFIG(nss) - - if test "$PKGCONFIG" != "no" ; then - addlib=`$PKGCONFIG --libs nss` - addcflags=`$PKGCONFIG --cflags nss` - version=`$PKGCONFIG --modversion nss` - nssprefix=`$PKGCONFIG --variable=prefix nss` - else - dnl Without pkg-config, we check for nss-config - - check=`nss-config --version 2>/dev/null` - if test -n "$check"; then - addlib=`nss-config --libs` - addcflags=`nss-config --cflags` - version=`nss-config --version` - nssprefix=`nss-config --prefix` - else - addlib="-lnss3" - addcflags="" - version="unknown" - fi - fi - else - NSS_PCDIR="$OPT_NSS/lib/pkgconfig" - if test -f "$NSS_PCDIR/nss.pc"; then - CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR]) - if test "$PKGCONFIG" != "no" ; then - addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss` - addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss` - addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss` - version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss` - nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss` - fi - fi - fi - - if test -z "$addlib"; then - # Without pkg-config, we'll kludge in some defaults - AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.]) - addld="-L$OPT_NSS/lib" - addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4" - addcflags="-I$OPT_NSS/include" - version="unknown" - nssprefix=$OPT_NSS - fi - - CLEANLDFLAGS="$LDFLAGS" - CLEANLIBS="$LIBS" - CLEANCPPFLAGS="$CPPFLAGS" - - LDFLAGS="$addld $LDFLAGS" - LIBS="$addlib $LIBS" - if test "$addcflags" != "-I/usr/include"; then - CPPFLAGS="$CPPFLAGS $addcflags" - fi - - dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0 - AC_CHECK_LIB(nss3, SSL_VersionRangeSet, - [ - AC_DEFINE(USE_NSS, 1, [if NSS is enabled]) - AC_SUBST(USE_NSS, [1]) - USE_NSS="yes" - NSS_ENABLED=1 - ssl_msg="NSS" - test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - ], - [ - LDFLAGS="$CLEANLDFLAGS" - LIBS="$CLEANLIBS" - CPPFLAGS="$CLEANCPPFLAGS" - ]) - - if test "x$USE_NSS" = "xyes"; then - AC_MSG_NOTICE([detected NSS version $version]) - - dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS - NSS_LIBS=$addlib - AC_SUBST([NSS_LIBS]) - - dnl when shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to - dnl LD_LIBRARY_PATH to prevent further configure tests to fail - dnl due to this - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH]) - fi - - fi dnl NSS found - - fi dnl NSS not disabled - - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -OPT_AXTLS=off - -AC_ARG_WITH(axtls,dnl -AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local). Ignored if another SSL engine is selected.]) -AC_HELP_STRING([--without-axtls], [disable axTLS]), - OPT_AXTLS=$withval) - -if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then - ssl_msg= - if test X"$OPT_AXTLS" != Xno; then - dnl backup the pre-axtls variables - CLEANLDFLAGS="$LDFLAGS" - CLEANCPPFLAGS="$CPPFLAGS" - CLEANLIBS="$LIBS" - - case "$OPT_AXTLS" in - yes) - dnl --with-axtls (without path) used - PREFIX_AXTLS=/usr/local - LIB_AXTLS="$PREFIX_AXTLS/lib" - LDFLAGS="$LDFLAGS -L$LIB_AXTLS" - CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include" - ;; - off) - dnl no --with-axtls option given, just check default places - PREFIX_AXTLS= - ;; - *) - dnl check the given --with-axtls spot - PREFIX_AXTLS=$OPT_AXTLS - LIB_AXTLS="$PREFIX_AXTLS/lib" - LDFLAGS="$LDFLAGS -L$LIB_AXTLS" - CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include" - ;; - esac - - AC_CHECK_LIB(axtls, ssl_version,[ - LIBS="-laxtls $LIBS" - AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled]) - AC_SUBST(USE_AXTLS, [1]) - AXTLS_ENABLED=1 - USE_AXTLS="yes" - ssl_msg="axTLS" - test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes - - if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH]) - fi - ],[ - LDFLAGS="$CLEANLDFLAGS" - CPPFLAGS="$CLEANCPPFLAGS" - LIBS="$CLEANLIBS" - ]) - fi - test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg" -fi - -case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in -x) - AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.]) - AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.]) - ;; -x1) - # one SSL backend is enabled - AC_SUBST(SSL_ENABLED) - SSL_ENABLED="1" - AC_MSG_NOTICE([built with one SSL backend]) - ;; -*) - # more than one SSL backend is enabled - AC_SUBST(SSL_ENABLED) - SSL_ENABLED="1" - AC_SUBST(CURL_WITH_MULTI_SSL) - CURL_WITH_MULTI_SSL="1" - AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends]) - AC_MSG_NOTICE([built with multiple SSL backends]) - ;; -esac - -if test -n "$ssl_backends"; then - curl_ssl_msg="enabled ($ssl_backends)" +if test -n "$ssl_backends"; then + curl_ssl_msg="enabled ($ssl_backends)" fi if test no = "$VALID_DEFAULT_SSL_BACKEND" @@ -2508,7 +1927,9 @@ dnl ********************************************************************** dnl Check for the CA bundle dnl ********************************************************************** -CURL_CHECK_CA_BUNDLE +if test -n "$check_for_ca_bundle"; then + CURL_CHECK_CA_BUNDLE +fi dnl ********************************************************************** dnl Check for libpsl @@ -2521,103 +1942,40 @@ AC_ARG_WITH(libpsl, with_libpsl=yes) if test $with_libpsl != "no"; then AC_SEARCH_LIBS(psl_builtin, psl, - [curl_psl_msg="yes"; + [curl_psl_msg="enabled"; AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled]) ], [curl_psl_msg="no (libpsl not found)"; - AC_MSG_WARN([libpsl was not found]) - ] - ) -fi -AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"]) - -dnl ********************************************************************** -dnl Check for libmetalink -dnl ********************************************************************** - -OPT_LIBMETALINK=no - -AC_ARG_WITH(libmetalink,dnl -AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root]) -AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]), - OPT_LIBMETALINK=$withval) - -if test X"$OPT_LIBMETALINK" != Xno; then - - addld="" - addlib="" - addcflags="" - version="" - libmetalinklib="" - - PKGTEST="no" - if test "x$OPT_LIBMETALINK" = "xyes"; then - dnl this is with no partiular path given - PKGTEST="yes" - CURL_CHECK_PKGCONFIG(libmetalink) - else - dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path. - LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig" - AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"]) - if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then - PKGTEST="yes" - fi - if test "$PKGTEST" = "yes"; then - CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR]) - fi - fi - if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then - addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl - $PKGCONFIG --libs-only-l libmetalink` - addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl - $PKGCONFIG --libs-only-L libmetalink` - addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl - $PKGCONFIG --cflags-only-I libmetalink` - version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl - $PKGCONFIG --modversion libmetalink` - libmetalinklib=`echo $addld | $SED -e 's/-L//'` - fi - if test -n "$addlib"; then - - clean_CPPFLAGS="$CPPFLAGS" - clean_LDFLAGS="$LDFLAGS" - clean_LIBS="$LIBS" - CPPFLAGS="$clean_CPPFLAGS $addcflags" - LDFLAGS="$clean_LDFLAGS $addld" - LIBS="$addlib $clean_LIBS" - AC_MSG_CHECKING([if libmetalink is recent enough]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -# include - ]],[[ - if(0 != metalink_strerror(0)) /* added in 0.1.0 */ - return 1; - ]]) - ],[ - AC_MSG_RESULT([yes ($version)]) - want_metalink="yes" - ],[ - AC_MSG_RESULT([no ($version)]) - AC_MSG_NOTICE([libmetalink library defective or too old]) - want_metalink="no" - ]) - CPPFLAGS="$clean_CPPFLAGS" - LDFLAGS="$clean_LDFLAGS" - LIBS="$clean_LIBS" - if test "$want_metalink" = "yes"; then - dnl finally libmetalink will be used - AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support]) - LIBMETALINK_LIBS=$addlib - LIBMETALINK_LDFLAGS=$addld - LIBMETALINK_CPPFLAGS=$addcflags - AC_SUBST([LIBMETALINK_LIBS]) - AC_SUBST([LIBMETALINK_LDFLAGS]) - AC_SUBST([LIBMETALINK_CPPFLAGS]) - curl_mtlnk_msg="enabled" - fi + AC_MSG_WARN([libpsl was not found]) + ] + ) +fi +AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"]) - fi + +dnl ********************************************************************** +dnl Check for libgsasl +dnl ********************************************************************** + +AC_ARG_WITH(libgsasl, + AS_HELP_STRING([--without-libgsasl], + [disable libgsasl support for SCRAM]), + with_libgsasl=$withval, + with_libgsasl=yes) +if test $with_libgsasl != "no"; then + AC_SEARCH_LIBS(gsasl_init, gsasl, + [curl_gsasl_msg="enabled"; + AC_DEFINE([USE_GSASL], [1], [GSASL support enabled]) + ], + [curl_gsasl_msg="no (libgsasl not found)"; + AC_MSG_WARN([libgsasl was not found]) + ] + ) fi +AM_CONDITIONAL([USE_GSASL], [test "$curl_gsasl_msg" = "enabled"]) + +AC_ARG_WITH(libmetalink,, + AC_MSG_ERROR([--with-libmetalink no longer works!])) dnl ********************************************************************** dnl Check for the presence of LIBSSH2 libraries and headers @@ -2626,9 +1984,22 @@ dnl ********************************************************************** dnl Default to compiler & linker defaults for LIBSSH2 files & libraries. OPT_LIBSSH2=off AC_ARG_WITH(libssh2,dnl -AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) -AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]), - OPT_LIBSSH2=$withval) +AS_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the libssh2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--with-libssh2], [enable libssh2]), + OPT_LIBSSH2=$withval, OPT_LIBSSH2=no) + + +OPT_LIBSSH=off +AC_ARG_WITH(libssh,dnl +AS_HELP_STRING([--with-libssh=PATH],[Where to look for libssh, PATH points to the libssh installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--with-libssh], [enable libssh]), + OPT_LIBSSH=$withval, OPT_LIBSSH=no) + +OPT_WOLFSSH=off +AC_ARG_WITH(wolfssh,dnl +AS_HELP_STRING([--with-wolfssh=PATH],[Where to look for wolfssh, PATH points to the wolfSSH installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--with-wolfssh], [enable wolfssh]), + OPT_WOLFSSH=$withval, OPT_WOLFSSH=no) if test X"$OPT_LIBSSH2" != Xno; then dnl backup the pre-libssh2 variables @@ -2642,11 +2013,11 @@ if test X"$OPT_LIBSSH2" != Xno; then CURL_CHECK_PKGCONFIG(libssh2) if test "$PKGCONFIG" != "no" ; then - LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2` + LIB_SSH2=`$PKGCONFIG --libs libssh2` LD_SSH2=`$PKGCONFIG --libs-only-L libssh2` CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2` version=`$PKGCONFIG --modversion libssh2` - DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'` + DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/^-L//'` fi ;; @@ -2671,7 +2042,8 @@ if test X"$OPT_LIBSSH2" != Xno; then CPPFLAGS="$CPPFLAGS $CPP_SSH2" LIBS="$LIB_SSH2 $LIBS" - AC_CHECK_LIB(ssh2, libssh2_channel_open_ex) + dnl check for function added in libssh2 version 1.0 + AC_CHECK_LIB(ssh2, libssh2_session_block_directions) AC_CHECK_HEADERS(libssh2.h, curl_ssh_msg="enabled (libSSH2)" @@ -2688,13 +2060,13 @@ if test X"$OPT_LIBSSH2" != Xno; then if test "$LIBSSH2_ENABLED" = "1"; then if test -n "$DIR_SSH2"; then dnl when the libssh2 shared libs were found in a path that the run-time - dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH + dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH dnl to prevent further configure tests to fail due to this if test "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH]) fi fi else @@ -2703,6 +2075,101 @@ if test X"$OPT_LIBSSH2" != Xno; then CPPFLAGS=$CLEANCPPFLAGS LIBS=$CLEANLIBS fi +elif test X"$OPT_LIBSSH" != Xno; then + dnl backup the pre-libssh variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_LIBSSH" in + yes) + dnl --with-libssh (without path) used + CURL_CHECK_PKGCONFIG(libssh) + + if test "$PKGCONFIG" != "no" ; then + LIB_SSH=`$PKGCONFIG --libs-only-l libssh` + LD_SSH=`$PKGCONFIG --libs-only-L libssh` + CPP_SSH=`$PKGCONFIG --cflags-only-I libssh` + version=`$PKGCONFIG --modversion libssh` + DIR_SSH=`echo $LD_SSH | $SED -e 's/^-L//'` + fi + + ;; + off) + dnl no --with-libssh option given, just check default places + ;; + *) + dnl use the given --with-libssh spot + PREFIX_SSH=$OPT_LIBSSH + ;; + esac + + dnl if given with a prefix, we set -L and -I based on that + if test -n "$PREFIX_SSH"; then + LIB_SSH="-lssh" + LD_SSH=-L${PREFIX_SSH}/lib$libsuff + CPP_SSH=-I${PREFIX_SSH}/include + DIR_SSH=${PREFIX_SSH}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_SSH" + CPPFLAGS="$CPPFLAGS $CPP_SSH" + LIBS="$LIB_SSH $LIBS" + + AC_CHECK_LIB(ssh, ssh_new) + + AC_CHECK_HEADERS(libssh/libssh.h, + curl_ssh_msg="enabled (libSSH)" + LIBSSH_ENABLED=1 + AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use]) + AC_SUBST(USE_LIBSSH, [1]) + ) + + if test X"$OPT_LIBSSH" != Xoff && + test "$LIBSSH_ENABLED" != "1"; then + AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!]) + fi + + if test "$LIBSSH_ENABLED" = "1"; then + if test -n "$DIR_SSH"; then + dnl when the libssh shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH + dnl to prevent further configure tests to fail due to this + + if test "x$cross_compiling" != "xyes"; then + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH]) + fi + fi + else + dnl no libssh, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + fi +elif test X"$OPT_WOLFSSH" != Xno; then + dnl backup the pre-wolfssh variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + + if test "$OPT_WOLFSSH" != yes; then + WOLFCONFIG="$OPT_WOLFSSH/bin/wolfssh-config" + LDFLAGS="$LDFLAGS `$WOLFCONFIG --libs`" + CPPFLAGS="$CPPFLAGS `$WOLFCONFIG --cflags`" + fi + + AC_CHECK_LIB(wolfssh, wolfSSH_Init) + + AC_CHECK_HEADERS(wolfssh/ssh.h, + curl_ssh_msg="enabled (wolfSSH)" + WOLFSSH_ENABLED=1 + AC_DEFINE(USE_WOLFSSH, 1, [if wolfSSH is in use]) + AC_SUBST(USE_WOLFSSH, [1]) + ) + fi dnl ********************************************************************** @@ -2712,8 +2179,8 @@ dnl ********************************************************************** dnl Default to compiler & linker defaults for LIBRTMP files & libraries. OPT_LIBRTMP=off AC_ARG_WITH(librtmp,dnl -AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) -AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]), +AS_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AS_HELP_STRING([--without-librtmp], [disable LIBRTMP]), OPT_LIBRTMP=$withval) if test X"$OPT_LIBRTMP" != Xno; then @@ -2732,7 +2199,7 @@ if test X"$OPT_LIBRTMP" != Xno; then LD_RTMP=`$PKGCONFIG --libs-only-L librtmp` CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp` version=`$PKGCONFIG --modversion librtmp` - DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'` + DIR_RTMP=`echo $LD_RTMP | $SED -e 's/^-L//'` else dnl To avoid link errors, we do not allow --librtmp without dnl a pkgconfig file @@ -2791,8 +2258,8 @@ dnl ********************************************************************** versioned_symbols_flavour= AC_MSG_CHECKING([whether versioned symbols are wanted]) AC_ARG_ENABLE(versioned-symbols, -AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library]) -AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]), +AS_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library]) +AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]), [ case "$enableval" in yes) AC_MSG_RESULT(yes) AC_MSG_CHECKING([if libraries can be versioned]) @@ -2810,16 +2277,12 @@ AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shar versioned_symbols_flavour="GNUTLS_" elif test "x$NSS_ENABLED" = "x1"; then versioned_symbols_flavour="NSS_" - elif test "x$POLARSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="POLARSSL_" - elif test "x$CYASSL_ENABLED" = "x1"; then - versioned_symbols_flavour="CYASSL_" - elif test "x$AXTLS_ENABLED" = "x1"; then - versioned_symbols_flavour="AXTLS_" - elif test "x$WINSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="WINSSL_" - elif test "x$DARWINSSL_ENABLED" = "x1"; then - versioned_symbols_flavour="DARWINSSL_" + elif test "x$WOLFSSL_ENABLED" = "x1"; then + versioned_symbols_flavour="WOLFSSL_" + elif test "x$SCHANNEL_ENABLED" = "x1"; then + versioned_symbols_flavour="SCHANNEL_" + elif test "x$SECURETRANSPORT_ENABLED" = "x1"; then + versioned_symbols_flavour="SECURE_TRANSPORT_" else versioned_symbols_flavour="" fi @@ -2847,8 +2310,8 @@ dnl ------------------------------------------------- AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)]) OPT_WINIDN="default" AC_ARG_WITH(winidn, -AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN]) -AC_HELP_STRING([--without-winidn], [disable Windows native IDN]), +AS_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN]) +AS_HELP_STRING([--without-winidn], [disable Windows native IDN]), OPT_WINIDN=$withval) case "$OPT_WINIDN" in no|default) @@ -2872,11 +2335,12 @@ esac if test "$want_winidn" = "yes"; then dnl winidn library support has been requested + clean_CFLAGS="$CFLAGS" clean_CPPFLAGS="$CPPFLAGS" clean_LDFLAGS="$LDFLAGS" clean_LIBS="$LIBS" WINIDN_LIBS="-lnormaliz" - WINIDN_CPPFLAGS="-DWINVER=0x0600" + WINIDN_CPPFLAGS="" # if test "$want_winidn_path" != "default"; then dnl path has been specified @@ -2886,6 +2350,24 @@ if test "$want_winidn" = "yes"; then WINIDN_DIR="$want_winidn_path/lib$libsuff" fi # + dnl WinIDN requires a minimum supported OS version of at least Vista (0x0600) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #include + ]],[[ + #if (WINVER < 0x600) && (_WIN32_WINNT < 0x600) + #error + #endif + ]]) + ],[ + ],[ + CFLAGS=`echo $CFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'` + CFLAGS=`echo $CFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'` + CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'` + CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'` + WINIDN_CPPFLAGS="$WINIDN_CPPFLAGS -DWINVER=0x0600" + ]) + # CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS" LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS" LIBS="$WINIDN_LIBS $LIBS" @@ -2912,6 +2394,7 @@ if test "$want_winidn" = "yes"; then curl_idn_msg="enabled (Windows-native)" else AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled]) + CFLAGS="$clean_CFLAGS" CPPFLAGS="$clean_CPPFLAGS" LDFLAGS="$clean_LDFLAGS" LIBS="$clean_LIBS" @@ -2925,8 +2408,8 @@ dnl ********************************************************************** AC_MSG_CHECKING([whether to build with libidn2]) OPT_IDN="default" AC_ARG_WITH(libidn2, -AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage]) -AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]), +AS_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage]) +AS_HELP_STRING([--without-libidn2],[Disable libidn2 usage]), [OPT_IDN=$withval]) case "$OPT_IDN" in no) @@ -2972,7 +2455,7 @@ if test "$want_idn" = "yes"; then $PKGCONFIG --libs-only-L libidn2 2>/dev/null` IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl $PKGCONFIG --cflags-only-I libidn2 2>/dev/null` - IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'` + IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/^-L//'` else dnl pkg-config not available or provides no info IDN_LIBS="-lidn2" @@ -2987,7 +2470,7 @@ if test "$want_idn" = "yes"; then IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null` IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null` IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null` - IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'` + IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/^-L//'` else dnl pkg-config not available or provides no info IDN_LIBS="-lidn2" @@ -3030,9 +2513,9 @@ if test "$want_idn" = "yes"; then AC_SUBST([IDN_ENABLED], [1]) curl_idn_msg="enabled (libidn2)" if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR" - export LD_LIBRARY_PATH - AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH]) fi else AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled]) @@ -3044,7 +2527,7 @@ fi dnl Let's hope this split URL remains working: -dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \ +dnl https://www15.software.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \ dnl genprogc/thread_quick_ref.htm @@ -3060,8 +2543,8 @@ if test "x$disable_http" = "xyes"; then fi AC_ARG_WITH(nghttp2, -AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage]) -AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]), +AS_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage]) +AS_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]), [OPT_H2=$withval]) case "$OPT_H2" in no) @@ -3080,7 +2563,6 @@ case "$OPT_H2" in ;; esac -curl_h2_msg="disabled (--with-nghttp2)" if test X"$want_h2" != Xno; then dnl backup the pre-nghttp2 variables CLEANLDFLAGS="$LDFLAGS" @@ -3106,32 +2588,420 @@ if test X"$want_h2" != Xno; then CPPFLAGS="$CPPFLAGS $CPP_H2" LIBS="$LIB_H2 $LIBS" - # use nghttp2_option_set_no_recv_client_magic to require nghttp2 - # >= 1.0.0 - AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic, + # use nghttp2_session_set_local_window_size to require nghttp2 + # >= 1.12.0 + AC_CHECK_LIB(nghttp2, nghttp2_session_set_local_window_size, + [ + AC_CHECK_HEADERS(nghttp2/nghttp2.h, + curl_h2_msg="enabled (nghttp2)" + NGHTTP2_ENABLED=1 + AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use]) + AC_SUBST(USE_NGHTTP2, [1]) + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no nghttp2 pkg-config found, deal with it + if test X"$want_h2" != Xdefault; then + dnl To avoid link errors, we do not allow --with-nghttp2 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.]) + fi + fi + +fi + +dnl ********************************************************************** +dnl Check for ngtcp2 (QUIC) +dnl ********************************************************************** + +OPT_TCP2="yes" + +if test "x$disable_http" = "xyes"; then + # without HTTP, ngtcp2 is no use + OPT_TCP2="no" +fi + +AC_ARG_WITH(ngtcp2, +AS_HELP_STRING([--with-ngtcp2=PATH],[Enable ngtcp2 usage]) +AS_HELP_STRING([--without-ngtcp2],[Disable ngtcp2 usage]), + [OPT_TCP2=$withval]) +case "$OPT_TCP2" in + no) + dnl --without-ngtcp2 option used + want_tcp2="no" + ;; + yes) + dnl --with-ngtcp2 option used without path + want_tcp2="default" + want_tcp2_path="" + ;; + *) + dnl --with-ngtcp2 option used with path + want_tcp2="yes" + want_tcp2_path="$withval/lib/pkgconfig" + ;; +esac + +curl_tcp2_msg="no (--with-ngtcp2)" +if test X"$want_tcp2" != Xno; then + dnl backup the pre-ngtcp2 variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(libngtcp2, $want_tcp2_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-l libngtcp2` + AC_MSG_NOTICE([-l is $LIB_TCP2]) + + CPP_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl + $PKGCONFIG --cflags-only-I libngtcp2` + AC_MSG_NOTICE([-I is $CPP_TCP2]) + + LD_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-L libngtcp2` + AC_MSG_NOTICE([-L is $LD_TCP2]) + + LDFLAGS="$LDFLAGS $LD_TCP2" + CPPFLAGS="$CPPFLAGS $CPP_TCP2" + LIBS="$LIB_TCP2 $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_TCP2=`echo $LD_TCP2 | $SED -e 's/^-L//'` + fi + AC_CHECK_LIB(ngtcp2, ngtcp2_conn_client_new_versioned, + [ + AC_CHECK_HEADERS(ngtcp2/ngtcp2.h, + NGTCP2_ENABLED=1 + AC_DEFINE(USE_NGTCP2, 1, [if ngtcp2 is in use]) + AC_SUBST(USE_NGTCP2, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_TCP2" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_TCP2 to CURL_LIBRARY_PATH]) + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no ngtcp2 pkg-config found, deal with it + if test X"$want_tcp2" != Xdefault; then + dnl To avoid link errors, we do not allow --with-ngtcp2 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2 pkg-config file.]) + fi + fi + +fi + +if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1"; then + dnl backup the pre-ngtcp2_crypto_openssl variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(libngtcp2_crypto_openssl, $want_tcp2_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-l libngtcp2_crypto_openssl` + AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_OPENSSL]) + + CPP_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl + $PKGCONFIG --cflags-only-I libngtcp2_crypto_openssl` + AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_OPENSSL]) + + LD_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-L libngtcp2_crypto_openssl` + AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_OPENSSL]) + + LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_OPENSSL" + CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_OPENSSL" + LIBS="$LIB_NGTCP2_CRYPTO_OPENSSL $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_NGTCP2_CRYPTO_OPENSSL=`echo $LD_NGTCP2_CRYPTO_OPENSSL | $SED -e 's/^-L//'` + fi + AC_CHECK_LIB(ngtcp2_crypto_openssl, ngtcp2_crypto_ctx_initial, + [ + AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h, + NGTCP2_ENABLED=1 + AC_DEFINE(USE_NGTCP2_CRYPTO_OPENSSL, 1, [if ngtcp2_crypto_openssl is in use]) + AC_SUBST(USE_NGTCP2_CRYPTO_OPENSSL, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_OPENSSL" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_OPENSSL to CURL_LIBRARY_PATH]) + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no ngtcp2_crypto_openssl pkg-config found, deal with it + if test X"$want_tcp2" != Xdefault; then + dnl To avoid link errors, we do not allow --with-ngtcp2 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_openssl pkg-config file.]) + fi + fi +fi + +if test "x$NGTCP2_ENABLED" = "x1" -a "x$GNUTLS_ENABLED" = "x1"; then + dnl backup the pre-ngtcp2_crypto_gnutls variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(libngtcp2_crypto_gnutls, $want_tcp2_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-l libngtcp2_crypto_gnutls` + AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_GNUTLS]) + + CPP_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl + $PKGCONFIG --cflags-only-I libngtcp2_crypto_gnutls` + AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_GNUTLS]) + + LD_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path]) + $PKGCONFIG --libs-only-L libngtcp2_crypto_gnutls` + AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_GNUTLS]) + + LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_GNUTLS" + CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_GNUTLS" + LIBS="$LIB_NGTCP2_CRYPTO_GNUTLS $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_NGTCP2_CRYPTO_GNUTLS=`echo $LD_NGTCP2_CRYPTO_GNUTLS | $SED -e 's/^-L//'` + fi + AC_CHECK_LIB(ngtcp2_crypto_gnutls, ngtcp2_crypto_ctx_initial, + [ + AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h, + NGTCP2_ENABLED=1 + AC_DEFINE(USE_NGTCP2_CRYPTO_GNUTLS, 1, [if ngtcp2_crypto_gnutls is in use]) + AC_SUBST(USE_NGTCP2_CRYPTO_GNUTLS, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_GNUTLS" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_GNUTLS to CURL_LIBRARY_PATH]) + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no ngtcp2_crypto_gnutls pkg-config found, deal with it + if test X"$want_tcp2" != Xdefault; then + dnl To avoid link errors, we do not allow --with-ngtcp2 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_gnutls pkg-config file.]) + fi + fi +fi + +dnl ********************************************************************** +dnl Check for nghttp3 (HTTP/3 with ngtcp2) +dnl ********************************************************************** + +OPT_NGHTTP3="yes" + +if test "x$NGTCP2_ENABLED" = "x"; then + # without ngtcp2, nghttp3 is of no use for us + OPT_NGHTTP3="no" +fi + +AC_ARG_WITH(nghttp3, +AS_HELP_STRING([--with-nghttp3=PATH],[Enable nghttp3 usage]) +AS_HELP_STRING([--without-nghttp3],[Disable nghttp3 usage]), + [OPT_NGHTTP3=$withval]) +case "$OPT_NGHTTP3" in + no) + dnl --without-nghttp3 option used + want_nghttp3="no" + ;; + yes) + dnl --with-nghttp3 option used without path + want_nghttp3="default" + want_nghttp3_path="" + ;; + *) + dnl --with-nghttp3 option used with path + want_nghttp3="yes" + want_nghttp3_path="$withval/lib/pkgconfig" + ;; +esac + +curl_http3_msg="no (--with-nghttp3)" +if test X"$want_nghttp3" != Xno; then + dnl backup the pre-nghttp3 variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(libnghttp3, $want_nghttp3_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) + $PKGCONFIG --libs-only-l libnghttp3` + AC_MSG_NOTICE([-l is $LIB_NGHTTP3]) + + CPP_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) dnl + $PKGCONFIG --cflags-only-I libnghttp3` + AC_MSG_NOTICE([-I is $CPP_NGHTTP3]) + + LD_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) + $PKGCONFIG --libs-only-L libnghttp3` + AC_MSG_NOTICE([-L is $LD_NGHTTP3]) + + LDFLAGS="$LDFLAGS $LD_NGHTTP3" + CPPFLAGS="$CPPFLAGS $CPP_NGHTTP3" + LIBS="$LIB_NGHTTP3 $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_NGHTTP3=`echo $LD_NGHTTP3 | $SED -e 's/^-L//'` + fi + AC_CHECK_LIB(nghttp3, nghttp3_conn_client_new_versioned, + [ + AC_CHECK_HEADERS(nghttp3/nghttp3.h, + curl_h3_msg="enabled (ngtcp2 + nghttp3)" + NGHTTP3_ENABLED=1 + AC_DEFINE(USE_NGHTTP3, 1, [if nghttp3 is in use]) + AC_SUBST(USE_NGHTTP3, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGHTTP3" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_NGHTTP3 to CURL_LIBRARY_PATH]) + experimental="$experimental HTTP3" + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no nghttp3 pkg-config found, deal with it + if test X"$want_nghttp3" != Xdefault; then + dnl To avoid link errors, we do not allow --with-nghttp3 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-nghttp3 was specified but could not find nghttp3 pkg-config file.]) + fi + fi + +fi + +dnl ********************************************************************** +dnl Check for quiche (QUIC) +dnl ********************************************************************** + +OPT_QUICHE="no" + +if test "x$disable_http" = "xyes" -o "x$USE_NGTCP" = "x1"; then + # without HTTP or with ngtcp2, quiche is no use + OPT_QUICHE="no" +fi + +AC_ARG_WITH(quiche, +AS_HELP_STRING([--with-quiche=PATH],[Enable quiche usage]) +AS_HELP_STRING([--without-quiche],[Disable quiche usage]), + [OPT_QUICHE=$withval]) +case "$OPT_QUICHE" in + no) + dnl --without-quiche option used + want_quiche="no" + ;; + yes) + dnl --with-quiche option used without path + want_quiche="default" + want_quiche_path="" + ;; + *) + dnl --with-quiche option used with path + want_quiche="yes" + want_quiche_path="$withval" + ;; +esac + +if test X"$want_quiche" != Xno; then + + if test "$NGHTTP3_ENABLED" = 1; then + AC_MSG_ERROR([--with-quiche and --with-ngtcp2 are mutually exclusive]) + fi + + dnl backup the pre-quiche variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(quiche, $want_quiche_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) + $PKGCONFIG --libs-only-l quiche` + AC_MSG_NOTICE([-l is $LIB_QUICHE]) + + CPP_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) dnl + $PKGCONFIG --cflags-only-I quiche` + AC_MSG_NOTICE([-I is $CPP_QUICHE]) + + LD_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) + $PKGCONFIG --libs-only-L quiche` + AC_MSG_NOTICE([-L is $LD_QUICHE]) + + LDFLAGS="$LDFLAGS $LD_QUICHE" + CPPFLAGS="$CPPFLAGS $CPP_QUICHE" + LIBS="$LIB_QUICHE $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_QUICHE=`echo $LD_QUICHE | $SED -e 's/^-L//'` + fi + AC_CHECK_LIB(quiche, quiche_connect, [ - AC_CHECK_HEADERS(nghttp2/nghttp2.h, - curl_h2_msg="enabled (nghttp2)" - NGHTTP2_ENABLED=1 - AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use]) - AC_SUBST(USE_NGHTTP2, [1]) + AC_CHECK_HEADERS(quiche.h, + experimental="$experimental HTTP3" + AC_MSG_NOTICE([HTTP3 support is experimental]) + curl_h3_msg="enabled (quiche)" + QUICHE_ENABLED=1 + AC_DEFINE(USE_QUICHE, 1, [if quiche is in use]) + AC_SUBST(USE_QUICHE, [1]) + AC_CHECK_FUNCS([quiche_conn_set_qlog_fd]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_QUICHE" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_QUICHE to CURL_LIBRARY_PATH]), + [], + [ +AC_INCLUDES_DEFAULT +#include + ] ) ], dnl not found, revert back to clean variables - LDFLAGS=$CLEANLDFLAGS - CPPFLAGS=$CLEANCPPFLAGS - LIBS=$CLEANLIBS + AC_MSG_ERROR([couldn't use quiche]) ) - else - dnl no nghttp2 pkg-config found, deal with it - if test X"$want_h2" != Xdefault; then - dnl To avoid link errors, we do not allow --with-nghttp2 without + dnl no quiche pkg-config found, deal with it + if test X"$want_quiche" != Xdefault; then + dnl To avoid link errors, we do not allow --with-quiche without dnl a pkgconfig file - AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.]) + AC_MSG_ERROR([--with-quiche was specified but could not find quiche pkg-config file.]) fi fi - fi dnl ********************************************************************** @@ -3140,8 +3010,8 @@ dnl ********************************************************************** OPT_ZSH_FPATH=default AC_ARG_WITH(zsh-functions-dir, -AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH]) -AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]), +AS_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH]) +AS_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]), [OPT_ZSH_FPATH=$withval]) case "$OPT_ZSH_FPATH" in no) @@ -3160,11 +3030,34 @@ case "$OPT_ZSH_FPATH" in esac dnl ********************************************************************** -dnl Back to "normal" configuring +dnl Check for fish completion path dnl ********************************************************************** -dnl Checks for header files. -AC_HEADER_STDC +OPT_FISH_FPATH=default +AC_ARG_WITH(fish-functions-dir, +AS_HELP_STRING([--with-fish-functions-dir=PATH],[Install fish completions to PATH]) +AS_HELP_STRING([--without-fish-functions-dir],[Do not install fish completions]), + [OPT_FISH_FPATH=$withval]) +case "$OPT_FISH_FPATH" in + no) + dnl --without-fish-functions-dir option used + ;; + default|yes) + dnl --with-fish-functions-dir option used without path + CURL_CHECK_PKGCONFIG(fish) + if test "$PKGCONFIG" != "no" ; then + FISH_FUNCTIONS_DIR="$($PKGCONFIG --variable completionsdir fish)" + else + FISH_FUNCTIONS_DIR="$datarootdir/fish/vendor_completions.d" + fi + AC_SUBST(FISH_FUNCTIONS_DIR) + ;; + *) + dnl --with-fish-functions-dir option used with path + FISH_FUNCTIONS_DIR="$withval" + AC_SUBST(FISH_FUNCTIONS_DIR) + ;; +esac CURL_CHECK_HEADER_MALLOC CURL_CHECK_HEADER_MEMORY @@ -3181,11 +3074,12 @@ AC_CHECK_HEADERS( assert.h \ unistd.h \ stdlib.h \ - limits.h \ arpa/inet.h \ net/if.h \ netinet/in.h \ + netinet/in6.h \ sys/un.h \ + linux/tcp.h \ netinet/tcp.h \ netdb.h \ sys/sockio.h \ @@ -3193,10 +3087,8 @@ AC_CHECK_HEADERS( sys/param.h \ termios.h \ termio.h \ - sgtty.h \ fcntl.h \ alloca.h \ - time.h \ io.h \ pwd.h \ utime.h \ @@ -3227,6 +3119,8 @@ dnl default includes #endif #ifdef HAVE_SYS_SELECT_H #include +#elif defined(HAVE_UNISTD_H) +#include #endif #ifdef HAVE_SYS_SOCKET_H #include @@ -3234,30 +3128,34 @@ dnl default includes #ifdef HAVE_NETINET_IN_H #include #endif +#ifdef HAVE_NETINET_IN6_H +#include +#endif #ifdef HAVE_SYS_UN_H #include #endif ] ) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST CURL_CHECK_VARIADIC_MACROS AC_TYPE_SIZE_T -AC_HEADER_TIME + CURL_CHECK_STRUCT_TIMEVAL CURL_VERIFY_RUNTIMELIBS -AC_CHECK_SIZEOF(size_t) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(time_t) -AC_CHECK_SIZEOF(off_t) +AX_COMPILE_CHECK_SIZEOF(size_t) +AX_COMPILE_CHECK_SIZEOF(long) +AX_COMPILE_CHECK_SIZEOF(int) +AX_COMPILE_CHECK_SIZEOF(short) +AX_COMPILE_CHECK_SIZEOF(time_t) +AX_COMPILE_CHECK_SIZEOF(off_t) o=$CPPFLAGS CPPFLAGS="-I$srcdir/include $CPPFLAGS" -AC_CHECK_SIZEOF(curl_off_t, unused , [ +AX_COMPILE_CHECK_SIZEOF(curl_off_t, [ #include ]) CPPFLAGS=$o @@ -3301,7 +3199,55 @@ AC_CHECK_TYPE([bool],[ #endif ]) -CURL_CONFIGURE_CURL_SOCKLEN_T +# check for sa_family_t +AC_CHECK_TYPE(sa_family_t, + AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]), + [ + # The windows name? + AC_CHECK_TYPE(ADDRESS_FAMILY, + AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]), + AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]), + [ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + ]) + ], +[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]) + +# check for suseconds_t +AC_CHECK_TYPE([suseconds_t],[ + AC_DEFINE(HAVE_SUSECONDS_T, 1, + [Define to 1 if suseconds_t is an available type.]) +], ,[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +]) + +AC_MSG_CHECKING([if time_t is unsigned]) +CURL_RUN_IFELSE( + [ + #include + #include + time_t t = -1; + return (t > 0); + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned]) +],[ + AC_MSG_RESULT([no]) +],[ + dnl cross-compiling, most systems are unsigned + AC_MSG_RESULT([no]) +]) CURL_CONFIGURE_PULL_SYS_POLL @@ -3309,10 +3255,6 @@ TYPE_IN_ADDR_T TYPE_SOCKADDR_STORAGE -TYPE_SIG_ATOMIC_T - -AC_TYPE_SIGNAL - CURL_CHECK_FUNC_SELECT CURL_CHECK_FUNC_RECV @@ -3325,22 +3267,18 @@ CURL_CHECK_FUNC_CLOSESOCKET CURL_CHECK_FUNC_CLOSESOCKET_CAMEL CURL_CHECK_FUNC_CONNECT CURL_CHECK_FUNC_FCNTL -CURL_CHECK_FUNC_FDOPEN CURL_CHECK_FUNC_FREEADDRINFO -CURL_CHECK_FUNC_FREEIFADDRS CURL_CHECK_FUNC_FSETXATTR CURL_CHECK_FUNC_FTRUNCATE CURL_CHECK_FUNC_GETADDRINFO -CURL_CHECK_FUNC_GAI_STRERROR -CURL_CHECK_FUNC_GETHOSTBYADDR -CURL_CHECK_FUNC_GETHOSTBYADDR_R CURL_CHECK_FUNC_GETHOSTBYNAME CURL_CHECK_FUNC_GETHOSTBYNAME_R CURL_CHECK_FUNC_GETHOSTNAME +CURL_CHECK_FUNC_GETPEERNAME +CURL_CHECK_FUNC_GETSOCKNAME +CURL_CHECK_FUNC_IF_NAMETOINDEX CURL_CHECK_FUNC_GETIFADDRS -CURL_CHECK_FUNC_GETSERVBYPORT_R CURL_CHECK_FUNC_GMTIME_R -CURL_CHECK_FUNC_INET_NTOA_R CURL_CHECK_FUNC_INET_NTOP CURL_CHECK_FUNC_INET_PTON CURL_CHECK_FUNC_IOCTL @@ -3361,7 +3299,6 @@ CURL_CHECK_FUNC_STRCMPI CURL_CHECK_FUNC_STRDUP CURL_CHECK_FUNC_STRERROR_R CURL_CHECK_FUNC_STRICMP -CURL_CHECK_FUNC_STRNCASECMP CURL_CHECK_FUNC_STRNCMPI CURL_CHECK_FUNC_STRNICMP CURL_CHECK_FUNC_STRSTR @@ -3377,7 +3314,13 @@ case $host in ;; esac -AC_CHECK_FUNCS([geteuid \ +AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")], + [[#include + #include ]]) + + +AC_CHECK_FUNCS([fnmatch \ + geteuid \ getpass_r \ getppid \ getpwuid \ @@ -3385,10 +3328,12 @@ AC_CHECK_FUNCS([geteuid \ getrlimit \ gettimeofday \ if_nametoindex \ + mach_absolute_time \ pipe \ setlocale \ setmode \ setrlimit \ + usleep \ utime \ utimes ],[ @@ -3413,19 +3358,6 @@ AC_CHECK_FUNCS([geteuid \ fi ]) -dnl Check if the getnameinfo function is available -dnl and get the types of five of its arguments. -CURL_CHECK_FUNC_GETNAMEINFO - -if test "$ipv6" = "yes"; then - if test "$curl_cv_func_getaddrinfo" = "yes"; then - AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) - IPV6_ENABLED=1 - AC_SUBST(IPV6_ENABLED) - fi - CURL_CHECK_NI_WITHSCOPEID -fi - CURL_CHECK_NONBLOCKING_SOCKET dnl ************************************************************ @@ -3502,9 +3434,9 @@ dnl disable POSIX threads dnl AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver]) AC_ARG_ENABLE(pthreads, -AC_HELP_STRING([--enable-pthreads], +AS_HELP_STRING([--enable-pthreads], [Enable POSIX threads (default for threaded resolver)]) -AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]), +AS_HELP_STRING([--disable-pthreads],[Disable POSIX threads]), [ case "$enableval" in no) AC_MSG_RESULT(no) want_pthreads=no @@ -3542,14 +3474,34 @@ if test "$want_pthreads" != "no"; then AC_CHECK_HEADER(pthread.h, [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have ]) save_CFLAGS="$CFLAGS" - - dnl first check for function without lib + dnl When statically linking against boringssl, -lpthread is added to LIBS. + dnl Make sure to that this does not pass the check below, we really want + dnl -pthread in CFLAGS as recommended for GCC. This also ensures that + dnl lib1541 and lib1565 tests are built with these options. Otherwise + dnl they fail the build since tests/libtest/Makefile.am clears LIBS. + save_LIBS="$LIBS" + + LIBS= + dnl Check for libc variants without a separate pthread lib like bionic AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] ) + LIBS="$save_LIBS" + + dnl on HPUX, life is more complicated... + case $host in + *-hp-hpux*) + dnl it doesn't actually work without -lpthread + USE_THREADS_POSIX="" + ;; + *) + ;; + esac dnl if it wasn't found without lib, search for it in pthread lib if test "$USE_THREADS_POSIX" != "1" then CFLAGS="$CFLAGS -pthread" + # assign PTHREAD for pkg-config use + PTHREAD=" -pthread" AC_CHECK_LIB(pthread, pthread_create, [USE_THREADS_POSIX=1], [ CFLAGS="$save_CFLAGS"]) @@ -3578,13 +3530,15 @@ if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then fi fi +CURL_CONVERT_INCLUDE_TO_ISYSTEM + dnl ************************************************************ dnl disable verbose text strings dnl AC_MSG_CHECKING([whether to enable verbose strings]) AC_ARG_ENABLE(verbose, -AC_HELP_STRING([--enable-verbose],[Enable verbose strings]) -AC_HELP_STRING([--disable-verbose],[Disable verbose strings]), +AS_HELP_STRING([--enable-verbose],[Enable verbose strings]) +AS_HELP_STRING([--disable-verbose],[Disable verbose strings]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -3602,8 +3556,8 @@ dnl enable SSPI support dnl AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)]) AC_ARG_ENABLE(sspi, -AC_HELP_STRING([--enable-sspi],[Enable SSPI]) -AC_HELP_STRING([--disable-sspi],[Disable SSPI]), +AS_HELP_STRING([--enable-sspi],[Enable SSPI]) +AS_HELP_STRING([--disable-sspi],[Disable SSPI]), [ case "$enableval" in yes) if test "$curl_cv_native_windows" = "yes"; then @@ -3617,16 +3571,16 @@ AC_HELP_STRING([--disable-sspi],[Disable SSPI]), fi ;; *) - if test "x$WINSSL_ENABLED" = "x1"; then - # --with-winssl implies --enable-sspi + if test "x$SCHANNEL_ENABLED" = "x1"; then + # --with-schannel implies --enable-sspi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ;; esac ], - if test "x$WINSSL_ENABLED" = "x1"; then - # --with-winssl implies --enable-sspi + if test "x$SCHANNEL_ENABLED" = "x1"; then + # --with-schannel implies --enable-sspi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) @@ -3638,8 +3592,8 @@ dnl disable cryptographic authentication dnl AC_MSG_CHECKING([whether to enable cryptographic authentication methods]) AC_ARG_ENABLE(crypto-auth, -AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication]) -AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]), +AS_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication]) +AS_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -3652,6 +3606,25 @@ AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]), AC_MSG_RESULT(yes) ) +dnl ************************************************************ +dnl disable NTLM support +dnl +AC_MSG_CHECKING([whether to support NTLM]) +AC_ARG_ENABLE(ntlm, +AS_HELP_STRING([--enable-ntlm],[Enable NTLM support]) +AS_HELP_STRING([--disable-ntlm],[Disable NTLM support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_NTLM, 1, [to disable NTLM support]) + CURL_DISABLE_NTLM=1 + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + CURL_CHECK_OPTION_NTLM_WB CURL_CHECK_NTLM_WB @@ -3661,12 +3634,11 @@ dnl disable TLS-SRP authentication dnl AC_MSG_CHECKING([whether to enable TLS-SRP authentication]) AC_ARG_ENABLE(tls-srp, -AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication]) -AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]), +AS_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication]) +AS_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]), [ case "$enableval" in no) AC_MSG_RESULT(no) - AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication]) want_tls_srp=no ;; *) AC_MSG_RESULT(yes) @@ -3688,8 +3660,8 @@ dnl disable Unix domain sockets support dnl AC_MSG_CHECKING([whether to enable Unix domain sockets]) AC_ARG_ENABLE(unix-sockets, -AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets]) -AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]), +AS_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets]) +AS_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]), [ case "$enableval" in no) AC_MSG_RESULT(no) want_unix_sockets=no @@ -3719,10 +3691,10 @@ fi dnl ************************************************************ dnl disable cookies support dnl -AC_MSG_CHECKING([whether to enable support for cookies]) +AC_MSG_CHECKING([whether to support cookies]) AC_ARG_ENABLE(cookies, -AC_HELP_STRING([--enable-cookies],[Enable cookies support]) -AC_HELP_STRING([--disable-cookies],[Disable cookies support]), +AS_HELP_STRING([--enable-cookies],[Enable cookies support]) +AS_HELP_STRING([--disable-cookies],[Disable cookies support]), [ case "$enableval" in no) AC_MSG_RESULT(no) @@ -3734,6 +3706,248 @@ AC_HELP_STRING([--disable-cookies],[Disable cookies support]), AC_MSG_RESULT(yes) ) +dnl ************************************************************ +dnl disable socketpair +dnl +AC_MSG_CHECKING([whether to support socketpair]) +AC_ARG_ENABLE(socketpair, +AS_HELP_STRING([--enable-socketpair],[Enable socketpair support]) +AS_HELP_STRING([--disable-socketpair],[Disable socketpair support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_SOCKETPAIR, 1, [to disable socketpair support]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable HTTP authentication support +dnl +AC_MSG_CHECKING([whether to support HTTP authentication]) +AC_ARG_ENABLE(http-auth, +AS_HELP_STRING([--enable-http-auth],[Enable HTTP authentication support]) +AS_HELP_STRING([--disable-http-auth],[Disable HTTP authentication support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_HTTP_AUTH, 1, [disable HTTP authentication]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable DoH support +dnl +AC_MSG_CHECKING([whether to support DoH]) +AC_ARG_ENABLE(doh, +AS_HELP_STRING([--enable-doh],[Enable DoH support]) +AS_HELP_STRING([--disable-doh],[Disable DoH support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_DOH, 1, [disable DoH]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable mime API support +dnl +AC_MSG_CHECKING([whether to support the MIME API]) +AC_ARG_ENABLE(mime, +AS_HELP_STRING([--enable-mime],[Enable mime API support]) +AS_HELP_STRING([--disable-mime],[Disable mime API support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_MIME, 1, [disable mime API]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable date parsing +dnl +AC_MSG_CHECKING([whether to support date parsing]) +AC_ARG_ENABLE(dateparse, +AS_HELP_STRING([--enable-dateparse],[Enable date parsing]) +AS_HELP_STRING([--disable-dateparse],[Disable date parsing]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_PARSEDATE, 1, [disable date parsing]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable netrc +dnl +AC_MSG_CHECKING([whether to support netrc parsing]) +AC_ARG_ENABLE(netrc, +AS_HELP_STRING([--enable-netrc],[Enable netrc parsing]) +AS_HELP_STRING([--disable-netrc],[Disable netrc parsing]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_NETRC, 1, [disable netrc parsing]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable progress-meter +dnl +AC_MSG_CHECKING([whether to support progress-meter]) +AC_ARG_ENABLE(progress-meter, +AS_HELP_STRING([--enable-progress-meter],[Enable progress-meter]) +AS_HELP_STRING([--disable-progress-meter],[Disable progress-meter]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_PROGRESS_METER, 1, [disable progress-meter]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable shuffle DNS support +dnl +AC_MSG_CHECKING([whether to support DNS shuffling]) +AC_ARG_ENABLE(dnsshuffle, +AS_HELP_STRING([--enable-dnsshuffle],[Enable DNS shuffling]) +AS_HELP_STRING([--disable-dnsshuffle],[Disable DNS shuffling]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_SHUFFLE_DNS, 1, [disable DNS shuffling]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable the curl_easy_options API +dnl +AC_MSG_CHECKING([whether to support curl_easy_option*]) +AC_ARG_ENABLE(get-easy-options, +AS_HELP_STRING([--enable-get-easy-options],[Enable curl_easy_options]) +AS_HELP_STRING([--disable-get-easy-options],[Disable curl_easy_options]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_GETOPTIONS, 1, [to disable curl_easy_options]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl switch on/off alt-svc +dnl +AC_MSG_CHECKING([whether to support alt-svc]) +AC_ARG_ENABLE(alt-svc, +AS_HELP_STRING([--enable-alt-svc],[Enable alt-svc support]) +AS_HELP_STRING([--disable-alt-svc],[Disable alt-svc support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_ALTSVC, 1, [disable alt-svc]) + curl_altsvc_msg="no"; + enable_altsvc="no" + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(no) +) + +dnl only check for HSTS if there's SSL present +if test -n "$SSL_ENABLED"; then + + dnl ************************************************************ + dnl switch on/off hsts + dnl + AC_MSG_CHECKING([whether to support HSTS]) + AC_ARG_ENABLE(hsts, + AS_HELP_STRING([--enable-hsts],[Enable HSTS support]) + AS_HELP_STRING([--disable-hsts],[Disable HSTS support]), + [ case "$enableval" in + no) + AC_MSG_RESULT(no) + hsts="no" + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT($hsts) + ) +else + AC_MSG_NOTICE([disables HSTS due to lack of SSL]) + hsts="no" +fi + +if test "x$hsts" != "xyes"; then + curl_hsts_msg="no (--enable-hsts)"; + AC_DEFINE(CURL_DISABLE_HSTS, 1, [disable alt-svc]) +fi + +dnl ************************************************************* +dnl check whether ECH support, if desired, is actually available +dnl +if test "x$want_ech" != "xno"; then + AC_MSG_CHECKING([whether ECH support is available]) + + dnl assume NOT and look for sufficient condition + ECH_ENABLED=0 + ECH_SUPPORT='' + + dnl OpenSSL with a chosen ECH function should be enough + dnl so more exhaustive checking seems unnecessary for now + if test "x$OPENSSL_ENABLED" = "x1"; then + AC_CHECK_FUNCS(SSL_get_ech_status, + ECH_SUPPORT="ECH support available (OpenSSL with SSL_get_ech_status)" + ECH_ENABLED=1) + + dnl add 'elif' chain here for additional implementations + fi + + dnl now deal with whatever we found + if test "x$ECH_ENABLED" = "x1"; then + AC_DEFINE(USE_ECH, 1, [if ECH support is available]) + AC_MSG_RESULT($ECH_SUPPORT) + experimental="$experimental ECH" + else + AC_MSG_ERROR([--enable-ech ignored: No ECH support found]) + fi +fi + dnl ************************************************************ dnl hiding of library internal symbols dnl @@ -3742,7 +3956,7 @@ CURL_CONFIGURE_SYMBOL_HIDING dnl dnl All the library dependencies put into $LIB apply to libcurl only. dnl -LIBCURL_LIBS=$LIBS +LIBCURL_LIBS="$LIBS$PTHREAD" AC_SUBST(LIBCURL_LIBS) AC_SUBST(CURL_NETWORK_LIBS) @@ -3765,6 +3979,13 @@ dnl to let curl-config output the static libraries correctly ENABLE_STATIC="$enable_static" AC_SUBST(ENABLE_STATIC) +dnl merge the pkg-config Libs.private field into Libs when static-only +if test "x$enable_shared" = "xno"; then + LIBCURL_NO_SHARED=$LIBCURL_LIBS +else + LIBCURL_NO_SHARED= +fi +AC_SUBST(LIBCURL_NO_SHARED) dnl dnl For keeping supported features and protocols also in pkg-config file @@ -3785,6 +4006,12 @@ fi if test "x$HAVE_LIBZ" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES libz" fi +if test "x$HAVE_BROTLI" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES brotli" +fi +if test "x$HAVE_ZSTD" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES zstd" +fi if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \ -o "x$USE_THREADS_WIN32" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS" @@ -3800,10 +4027,21 @@ if test "x$HAVE_GSSAPI" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API" fi -if test "x$curl_psl_msg" = "xyes"; then +if test "x$curl_psl_msg" = "xenabled"; then SUPPORT_FEATURES="$SUPPORT_FEATURES PSL" fi +if test "x$curl_gsasl_msg" = "xenabled"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES GSASL" +fi + +if test "x$enable_altsvc" = "xyes"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES alt-svc" +fi +if test "x$hsts" = "xyes"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES HSTS" +fi + if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \ \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO" @@ -3814,10 +4052,20 @@ if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \ SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos" fi -if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then - if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ - -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then +use_curl_ntlm_core=no + +if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \ + "x$CURL_DISABLE_NTLM" != "x1"; then + if test "x$OPENSSL_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \ + -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \ + -o "x$SECURETRANSPORT_ENABLED" = "x1" \ + -o "x$USE_WIN32_CRYPTO" = "x1" \ + -o "x$WOLFSSL_NTLM" = "x1"; then + use_curl_ntlm_core=yes + fi + + if test "x$use_curl_ntlm_core" = "xyes" \ + -o "x$USE_WINDOWS_SSPI" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM" if test "x$CURL_DISABLE_HTTP" != "x1" -a \ @@ -3831,19 +4079,41 @@ if test "x$USE_TLS_SRP" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP" fi -if test "x$USE_NGHTTP2" = "x1"; then +if test "x$USE_NGHTTP2" = "x1" -o "x$USE_HYPER" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2" fi +if test "x$USE_NGTCP2" = "x1" -o "x$USE_QUICHE" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP3" +fi + if test "x$CURL_WITH_MULTI_SSL" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL" fi -if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1"; then - SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy" +dnl if not explictily turned off, HTTPS-proxy comes with some TLS backends +if test "x$https_proxy" != "xno"; then + if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \ + -o "x$NSS_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy" + fi +fi + +if test "x$ECH_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES ECH" +fi + +if test ${ac_cv_sizeof_curl_off_t} -gt 4; then + if test ${ac_cv_sizeof_off_t} -gt 4 -o \ + "$curl_win32_file_api" = "win32_large_files"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES Largefile" + fi fi +dnl replace spaces with newlines +dnl sort the lines +dnl replace the newlines back to spaces +SUPPORT_FEATURES=`echo $SUPPORT_FEATURES | tr ' ' '\012' | sort | tr '\012' ' '` AC_SUBST(SUPPORT_FEATURES) dnl For supported protocols in pkg-config file @@ -3882,6 +4152,12 @@ if test "x$CURL_DISABLE_TFTP" != "x1"; then fi if test "x$CURL_DISABLE_GOPHER" != "x1"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHERS" + fi +fi +if test "x$CURL_DISABLE_MQTT" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS MQTT" fi if test "x$CURL_DISABLE_POP3" != "x1"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3" @@ -3896,10 +4172,7 @@ if test "x$CURL_DISABLE_IMAP" != "x1"; then fi fi if test "x$CURL_DISABLE_SMB" != "x1" \ - -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \ - -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ - -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \ - -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then + -a "x$use_curl_ntlm_core" = "xyes"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB" if test "x$SSL_ENABLED" = "x1"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS" @@ -3915,6 +4188,13 @@ if test "x$USE_LIBSSH2" = "x1"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP" SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" fi +if test "x$USE_LIBSSH" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP" + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" +fi +if test "x$USE_WOLFSSH" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" +fi if test "x$CURL_DISABLE_RTSP" != "x1"; then SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP" fi @@ -3946,6 +4226,9 @@ squeeze SUPPORT_PROTOCOLS XC_CHECK_BUILD_FLAGS +SSL_BACKENDS=${ssl_backends} +AC_SUBST(SSL_BACKENDS) + if test "x$want_curldebug_assumed" = "xyes" && test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then ac_configure_args="$ac_configure_args --enable-curldebug" @@ -3971,19 +4254,7 @@ AC_CONFIG_FILES([Makefile \ tests/libtest/Makefile \ tests/unit/Makefile \ packages/Makefile \ - packages/Win32/Makefile \ - packages/Win32/cygwin/Makefile \ - packages/Linux/Makefile \ - packages/Linux/RPM/Makefile \ - packages/Linux/RPM/curl.spec \ - packages/Linux/RPM/curl-ssl.spec \ - packages/Solaris/Makefile \ - packages/EPM/curl.list \ - packages/EPM/Makefile \ packages/vms/Makefile \ - packages/AIX/Makefile \ - packages/AIX/RPM/Makefile \ - packages/AIX/RPM/curl.spec \ curl-config \ libcurl.pc ]) @@ -3995,33 +4266,52 @@ XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples] 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} - GSS-API support: ${curl_gss_msg} - TLS-SRP support: ${curl_tls_srp_msg} + CFLAGS: ${CFLAGS} + CPPFLAGS: ${CPPFLAGS} + LDFLAGS: ${LDFLAGS} + LIBS: ${LIBS} + + curl version: ${CURLVERSION} + SSL: ${curl_ssl_msg} + SSH: ${curl_ssh_msg} + zlib: ${curl_zlib_msg} + brotli: ${curl_brotli_msg} + zstd: ${curl_zstd_msg} + GSS-API: ${curl_gss_msg} + GSASL: ${curl_gsasl_msg} + TLS-SRP: ${curl_tls_srp_msg} resolver: ${curl_res_msg} - IPv6 support: ${curl_ipv6_msg} - Unix sockets support: ${curl_unix_sockets_msg} - IDN support: ${curl_idn_msg} + IPv6: ${curl_ipv6_msg} + Unix sockets: ${curl_unix_sockets_msg} + IDN: ${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} + Code coverage: ${curl_coverage_msg} + SSPI: ${curl_sspi_msg} ca cert bundle: ${ca}${ca_warning} ca cert path: ${capath}${capath_warning} ca fallback: ${with_ca_fallback} - LDAP support: ${curl_ldap_msg} - LDAPS support: ${curl_ldaps_msg} - RTSP support: ${curl_rtsp_msg} - RTMP support: ${curl_rtmp_msg} - metalink support: ${curl_mtlnk_msg} - PSL support: ${curl_psl_msg} - HTTP2 support: ${curl_h2_msg} + LDAP: ${curl_ldap_msg} + LDAPS: ${curl_ldaps_msg} + RTSP: ${curl_rtsp_msg} + RTMP: ${curl_rtmp_msg} + PSL: ${curl_psl_msg} + Alt-svc: ${curl_altsvc_msg} + HSTS: ${curl_hsts_msg} + HTTP1: ${curl_h1_msg} + HTTP2: ${curl_h2_msg} + HTTP3: ${curl_h3_msg} + ECH: ${curl_ech_msg} Protocols: ${SUPPORT_PROTOCOLS} + Features: ${SUPPORT_FEATURES} ]) +if test -n "$experimental"; then + cat >&2 << _EOF + WARNING: $experimental enabled but marked EXPERIMENTAL. Use with caution! +_EOF +fi diff --git a/curl/curl-config.in b/curl/curl-config.in index af484b44..8b4a29a9 100644 --- a/curl/curl-config.in +++ b/curl/curl-config.in @@ -6,11 +6,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 2001 - 2012, Daniel Stenberg, , et al. +# Copyright (C) 2001 - 2020, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -44,6 +44,7 @@ Available values for OPTION include: --libs library linking information --prefix curl install prefix --protocols newline separated list of enabled protocols + --ssl-backends output the SSL backends libcurl was built to support --static-libs static libcurl library linking information --version output version information --vernum output the version information as a number (hexadecimal) @@ -106,17 +107,29 @@ while test $# -gt 0; do # when extracting the patch part we strip off everything after a # dash as that's used for things like version 1.2.3-CVS cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1` - checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc` - numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'` - nownum=`echo "obase=10; ibase=16; $numuppercase" | bc` - if test "$nownum" -ge "$checknum"; then - # silent success - exit 0 - else - echo "requested version $checkfor is newer than existing @CURLVERSION@" - exit 1 + vmajor=`echo @CURLVERSION@ | cut -d. -f1` + vminor=`echo @CURLVERSION@ | cut -d. -f2` + # when extracting the patch part we strip off everything after a + # dash as that's used for things like version 1.2.3-CVS + vpatch=`echo @CURLVERSION@ | cut -d. -f3 | cut -d- -f1` + + if test "$vmajor" -gt "$cmajor"; then + exit 0; + fi + if test "$vmajor" -eq "$cmajor"; then + if test "$vminor" -gt "$cminor"; then + exit 0 + fi + if test "$vminor" -eq "$cminor"; then + if test "$cpatch" -le "$vpatch"; then + exit 0 + fi + fi fi + + echo "requested version $checkfor is newer than existing @CURLVERSION@" + exit 1 ;; --vernum) @@ -147,12 +160,15 @@ while test $# -gt 0; do else CURLLIBDIR="" fi - if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then + if test "X@ENABLE_SHARED@" = "Xno"; then echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@ else echo ${CURLLIBDIR}-lcurl fi ;; + --ssl-backends) + echo "@SSL_BACKENDS@" + ;; --static-libs) if test "X@ENABLE_STATIC@" != "Xno" ; then diff --git a/curl/depcomp b/curl/depcomp deleted file mode 100644 index b39f98f9..00000000 --- a/curl/depcomp +++ /dev/null @@ -1,791 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2016-01-11.22; # UTC - -# Copyright (C) 1999-2017 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the - # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" - echo >> "$depfile" - # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/curl/docs/.gitignore b/curl/docs/.gitignore new file mode 100644 index 00000000..60f32938 --- /dev/null +++ b/curl/docs/.gitignore @@ -0,0 +1,4 @@ +*.html +*.pdf +curl.1 +*.1.dist diff --git a/curl/docs/ALTSVC.md b/curl/docs/ALTSVC.md new file mode 100644 index 00000000..25437d6f --- /dev/null +++ b/curl/docs/ALTSVC.md @@ -0,0 +1,41 @@ +# Alt-Svc + +curl features support for the Alt-Svc: HTTP header. + +## Enable Alt-Svc in build + +`./configure --enable-alt-svc` + +(enabled by default since 7.73.0) + +## Standard + +[RFC 7838](https://tools.ietf.org/html/rfc7838) + +# Alt-Svc cache file format + +This a text based file with one line per entry and each line consists of nine +space separated fields. + +## Example + + h2 quic.tech 8443 h3-22 quic.tech 8443 "20190808 06:18:37" 0 0 + +## Fields + +1. The ALPN id for the source origin +2. The host name for the source origin +3. The port number for the source origin +4. The ALPN id for the destination host +5. The host name for the destination host +6. The host number for the destination host +7. The expiration date and time of this entry within double quotes. The date format is "YYYYMMDD HH:MM:SS" and the time zone is GMT. +8. Boolean (1 or 0) if "persist" was set for this entry +9. Integer priority value (not currently used) + +# TODO + +- handle multiple response headers, when one of them says `clear` (should + override them all) +- using `Age:` value for caching age as per spec +- `CURLALTSVC_IMMEDIATELY` support diff --git a/curl/docs/BINDINGS.md b/curl/docs/BINDINGS.md index 0c653480..9cdf2942 100644 --- a/curl/docs/BINDINGS.md +++ b/curl/docs/BINDINGS.md @@ -10,11 +10,11 @@ libcurl bindings The bindings listed below are not part of the curl/libcurl distribution archives, but must be downloaded and installed separately. -[Ada95](http://www.almroth.com/adacurl/index.html) Written by Andreas Almroth +[Ada95](https://web.archive.org/web/20070403105909/www.almroth.com/adacurl/index.html) Written by Andreas Almroth -[Basic](http://scriptbasic.com/) ScriptBasic bindings written by Peter Verhas +[Basic](https://scriptbasic.com/) ScriptBasic bindings written by Peter Verhas -C++: [curlpp](http://curlpp.org/) Written by Jean-Philippe Barrette-LaPierre, +C++: [curlpp](https://curlpp.org/) Written by Jean-Philippe Barrette-LaPierre, [curlcpp](https://github.com/JosephP91/curlcpp) by Giuseppe Persico and [C++ Requests](https://github.com/whoshuu/cpr) by Huu Nguyen @@ -23,6 +23,8 @@ Requests](https://github.com/whoshuu/cpr) by Huu Nguyen Cocoa: [BBHTTP](https://github.com/brunodecarvalho/BBHTTP) written by Bruno de Carvalho [curlhandle](https://github.com/karelia/curlhandle) Written by Dan Wood +Clojure: [clj-curl](https://github.com/lsevero/clj-curl) by Lucas Severo + [D](https://dlang.org/library/std/net/curl.html) Written by Kenneth Bogert [Delphi](https://github.com/Mercury13/curl4delphi) Written by Mikhail Merkuryev @@ -31,21 +33,21 @@ Cocoa: [BBHTTP](https://github.com/brunodecarvalho/BBHTTP) written by Bruno de C [Eiffel](https://room.eiffel.com/library/curl) Written by Eiffel Software -[Euphoria](http://rays-web.com/eulibcurl.htm) Written by Ray Smith +[Euphoria](https://web.archive.org/web/20050204080544/rays-web.com/eulibcurl.htm) Written by Ray Smith [Falcon](http://www.falconpl.org/index.ftd?page_id=prjs&prj_id=curl) -[Ferite](http://www.ferite.org/) Written by Paul Querna +[Ferite](https://web.archive.org/web/20150102192018/ferite.org/) Written by Paul Querna [Gambas](https://gambas.sourceforge.io/) -[glib/GTK+](http://atterer.net/glibcurl/) Written by Richard Atterer +[glib/GTK+](https://web.archive.org/web/20100526203452/atterer.net/glibcurl) Written by Richard Atterer Go: [go-curl](https://github.com/andelf/go-curl) by ShuYu Wang -[Guile](http://www.lonelycactus.com/guile-curl.html) Written by Michael L. Gran +[Guile](https://www.lonelycactus.com/guile-curl.html) Written by Michael L. Gran -[Harbour](https://github.com/vszakats/harbour-core/tree/master/contrib/hbcurl) Written by Viktor Szakáts +[Harbour](https://github.com/vszakats/hb/tree/master/contrib/hbcurl) Written by Viktor Szakats [Haskell](https://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl) Written by Galois, Inc @@ -53,29 +55,36 @@ Go: [go-curl](https://github.com/andelf/go-curl) by ShuYu Wang [Julia](https://github.com/forio/Curl.jl) Written by Paul Howe +[Kapito](https://github.com/puzza007/katipo) is an Erlang HTTP library around libcurl. + [Lisp](https://common-lisp.net/project/cl-curl/) Written by Liam Healy -Lua: [luacurl](http://luacurl.luaforge.net/) by Alexander Marinov, [Lua-cURL](https://github.com/Lua-cURL) by Jürgen Hötzel +Lua: [luacurl](https://web.archive.org/web/20201205052437/luacurl.luaforge.net/) by Alexander Marinov, [Lua-cURL](https://github.com/Lua-cURL) by Jürgen Hötzel [Mono](https://forge.novell.com/modules/xfmod/project/?libcurl-mono) Written by Jeffrey Phillips [.NET](https://sourceforge.net/projects/libcurl-net/) libcurl-net by Jeffrey Phillips +[Nim](https://nimble.directory/pkg/libcurl) wrapper for libcurl + [node.js](https://github.com/JCMais/node-libcurl) node-libcurl by Jonathan Cardoso Machado -[Object-Pascal](http://www.tekool.com/opcurl) Free Pascal, Delphi and Kylix binding written by Christophe Espern. +[Object-Pascal](https://web.archive.org/web/20020610214926/www.tekool.com/opcurl) Free Pascal, Delphi and Kylix binding written by Christophe Espern. [OCaml](https://opam.ocaml.org/packages/ocurl/) Written by Lars Nilsson and ygrek -[Pascal](http://houston.quik.com/jkp/curlpas/) Free Pascal, Delphi and Kylix binding written by Jeffrey Pohlmeyer. +[Pascal](https://web.archive.org/web/20030804091414/houston.quik.com/jkp/curlpas/) Free Pascal, Delphi and Kylix binding written by Jeffrey Pohlmeyer. -Perl: [WWW--Curl](https://github.com/szbalint/WWW--Curl) Maintained by Cris +Perl: [WWW::Curl](https://github.com/szbalint/WWW--Curl) Maintained by Cris Bailiff and Bálint Szilakszi, [perl6-net-curl](https://github.com/azawawi/perl6-net-curl) by Ahmad M. Zawawi +[NET::Curl](https://metacpan.org/pod/Net::Curl) by Przemyslaw Iskra [PHP](https://php.net/curl) Originally written by Sterling Hughes -[PostgreSQL](http://gborg.postgresql.org/project/pgcurl/projdisplay.php) Written by Gian Paolo Ciceri +[PostgreSQL](https://github.com/pramsey/pgsql-http) - HTTP client for PostgreSQL + +[PureBasic](https://www.purebasic.com/documentation/http/index.html) uses libcurl in its "native" HTTP subsystem [Python](http://pycurl.io/) PycURL by Kjetil Jacobsen @@ -87,32 +96,32 @@ Bailiff and Bálint Szilakszi, RPG, support for ILE/RPG on OS/400 is included in source distribution -Ruby: [curb](http://curb.rubyforge.org/) written by Ross Bamford, [ruby-curl-multi](http://curl-multi.rubyforge.org/) written by Kristjan Petursson and Keith Rarick +Ruby: [curb](https://github.com/taf2/curb) written by Ross Bamford [Rust](https://github.com/carllerche/curl-rust) curl-rust - by Carl Lerche -[Scheme](https://www.metapaper.net/lisovsky/web/curl/) Bigloo binding by Kirill Lisovsky +[Scheme](http://www.metapaper.net/lisovsky/web/curl/) Bigloo binding by Kirill Lisovsky [Scilab](https://help.scilab.org/docs/current/fr_FR/getURL.html) binding by Sylvestre Ledru -[S-Lang](http://www.jedsoft.org/slang/modules/curl.html) by John E Davis +[S-Lang](https://www.jedsoft.org/slang/modules/curl.html) by John E Davis -[Smalltalk](http://www.squeaksource.com/CurlPlugin/) Written by Danil Osipchuk +[Smalltalk](https://www.squeaksource.com/CurlPlugin/) Written by Danil Osipchuk [SP-Forth](https://sourceforge.net/p/spf/spf/ci/master/tree/devel/~ac/lib/lin/curl/) Written by Andrey Cherezov [SPL](http://www.clifford.at/spl/) Written by Clifford Wolf -[Tcl](http://mirror.yellow5.com/tclcurl/) Tclcurl by Andrés García +[Tcl](https://web.archive.org/web/20160826011806/mirror.yellow5.com/tclcurl/) Tclcurl by Andrés García [Visual Basic](https://sourceforge.net/projects/libcurl-vb/) libcurl-vb by Jeffrey Phillips -[Visual Foxpro](http://www.ctl32.com.ar/libcurl.asp) by Carlos Alloatti +[Visual Foxpro](https://web.archive.org/web/20130730181523/www.ctl32.com.ar/libcurl.asp) by Carlos Alloatti [Q](https://q-lang.sourceforge.io/) The libcurl module is part of the default install [wxWidgets](https://wxcode.sourceforge.io/components/wxcurl/) Written by Casey O'Donnell -[XBLite](http://perso.wanadoo.fr/xblite/libraries.html) Written by David Szafranski +[XBLite](https://web.archive.org/web/20060426150418/perso.wanadoo.fr/xblite/libraries.html) Written by David Szafranski [Xojo](https://github.com/charonn0/RB-libcURL) Written by Andrew Lambert diff --git a/curl/docs/BUFREF.md b/curl/docs/BUFREF.md new file mode 100644 index 00000000..2697919a --- /dev/null +++ b/curl/docs/BUFREF.md @@ -0,0 +1,81 @@ +# bufref + +This is an internal module for handling buffer references. A referenced +buffer is associated with its destructor function that is implicitly called +when the reference is invalidated. Once referenced, a buffer cannot be +reallocated. + +A data length is stored within the reference for binary data handling +purpose; it is not used by the bufref API. + +The `struct bufref` is used to hold data referencing a buffer. The members of +that structure **MUST NOT** be accessed or modified without using the dedicated +bufref API. + +## init + +```c +void Curl_bufref_init(struct bufref *br); +``` + +Initialises a `bufref` structure. This function **MUST** be called before any +other operation is performed on the structure. + +Upon completion, the referenced buffer is `NULL` and length is zero. + +This function may also be called to bypass referenced buffer destruction while +invalidating the current reference. + +## free + +```c +void Curl_bufref_free(struct bufref *br); +``` + +Destroys the previously referenced buffer using its destructor and +reinitialises the structure for a possible subsequent reuse. + +## set + +```c +void Curl_bufref_set(struct bufref *br, const void *buffer, size_t length, + void (*destructor)(void *)); +``` + +Releases the previously referenced buffer, then assigns the new `buffer` to +the structure, associated with its `destructor` function. The later can be +specified as `NULL`: this will be the case when the referenced buffer is +static. + +if `buffer` is NULL, `length`must be zero. + +## memdup + +```c +CURLcode Curl_bufref_memdup(struct bufref *br, const void *data, size_t length); +``` + +Releases the previously referenced buffer, then duplicates the `length`-byte +`data` into a buffer allocated via `malloc()` and references the latter +associated with destructor `curl_free()`. + +An additional trailing byte is allocated and set to zero as a possible +string zero-terminator; it is not counted in the stored length. + +Returns `CURLE_OK` if successful, else `CURLE_OUT_OF_MEMORY`. + +## ptr + +```c +const unsigned char *Curl_bufref_ptr(const struct bufref *br); +``` + +Returns a `const unsigned char *` to the referenced buffer. + +## len + +```c +size_t Curl_bufref_len(const struct bufref *br); +``` + +Returns the stored length of the referenced buffer. diff --git a/curl/docs/BUG-BOUNTY.md b/curl/docs/BUG-BOUNTY.md new file mode 100644 index 00000000..5cbb343b --- /dev/null +++ b/curl/docs/BUG-BOUNTY.md @@ -0,0 +1,83 @@ +# The curl bug bounty + +The curl project runs a bug bounty program in association with +[HackerOne](https://www.hackerone.com) and the [Internet Bug +Bounty](https://internetbugbounty.org). + +# How does it work? + +Start out by posting your suspected security vulnerability directly to [curl's +HackerOne program](https://hackerone.com/curl). + +After you have reported a security issue, it has been deemed credible, and a +patch and advisory has been made public, you may be eligible for a bounty from +this program. + +See all details at [https://hackerone.com/curl](https://hackerone.com/curl) + +This bounty is relying on funds from sponsors. If you use curl professionally, +consider help funding this! See +[https://opencollective.com/curl](https://opencollective.com/curl) for +details. + +# What are the reward amounts? + +The curl project offers monetary compensation for reported and published +security vulnerabilities. The amount of money that is rewarded depends on how +serious the flaw is determined to be. + +We offer reward money *up to* a certain amount per severity. The curl security +team determines the severity of each reported flaw on a case by case basis and +the exact amount rewarded to the reporter is then decided. + +Check out the current award amounts at [https://hackerone.com/curl](https://hackerone.com/curl) + +# Who is eligible for a reward? + +Everyone and anyone who reports a security problem in a released curl version +that hasn't already been reported can ask for a bounty. + +Vulnerabilities in features that are off by default and documented as +experimental are not eligible for a reward. + +The vulnerability has to be fixed and publicly announced (by the curl project) +before a bug bounty will be considered. + +Bounties need to be requested within twelve months from the publication of the +vulnerability. + +# Product vulnerabilities only + +This bug bounty only concerns the curl and libcurl products and thus their +respective source codes - when running on existing hardware. It does not +include documentation, websites, or other infrastructure. + +The curl security team is the sole arbiter if a reported flaw is subject to a +bounty or not. + +# How are vulnerabilities graded? + +The grading of each reported vulnerability that makes a reward claim will be +performed by the curl security team. The grading will be based on the CVSS +(Common Vulnerability Scoring System) 3.0. + +# How are reward amounts determined? + +The curl security team first gives the vulnerability a score, as mentioned +above, and based on that level we set an amount depending on the specifics of +the individual case. Other sponsors of the program might also get involved and +can raise the amounts depending on the particular issue. + +# What happens if the bounty fund is drained? + +The bounty fund depends on sponsors. If we pay out more bounties than we add, +the fund will eventually drain. If that end up happening, we will simply not +be able to pay out as high bounties as we would like and hope that we can +convince new sponsors to help us top up the fund again. + +# Regarding taxes, etc. on the bounties + +In the event that the individual receiving a curl bug bounty needs to pay +taxes on the reward money, the responsibility lies with the receiver. The +curl project or its security team never actually receive any of this money, +hold the money, or pay out the money. diff --git a/curl/docs/BUGS b/curl/docs/BUGS deleted file mode 100644 index 3c8fa9fc..00000000 --- a/curl/docs/BUGS +++ /dev/null @@ -1,297 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - -BUGS - - 1. Bugs - 1.1 There are still bugs - 1.2 Where to report - 1.3 Security bugs - 1.4 What to report - 1.5 libcurl problems - 1.6 Who will fix the problems - 1.7 How to get a stack trace - 1.8 Bugs in libcurl bindings - 1.9 Bugs in old versions - - 2. Bug fixing procedure - 2.1 What happens on first filing - 2.2 First response - 2.3 Not reproducible - 2.4 Unresponsive - 2.5 Lack of time/interest - 2.6 KNOWN_BUGS - 2.7 TODO - 2.8 Closing off stalled bugs - -============================================================================== - -1.1 There are still bugs - - Curl and libcurl keep being developed. Adding features and changing code - means that bugs will sneak in, no matter how hard we try not to. - - Of course there are lots of bugs left. And lots of misfeatures. - - To help us make curl the stable and solid product we want it to be, we need - bug reports and bug fixes. - -1.2 Where to report - - If you can't fix a bug yourself and submit a fix for it, try to report an as - detailed report as possible to a curl mailing list to allow one of us to - have a go at a solution. You can optionally also post your bug/problem at - curl's bug tracking system over at - - https://github.com/curl/curl/issues - - Please read the rest of this document below first before doing that! - - If you feel you need to ask around first, find a suitable mailing list and - post there. The lists are available on https://curl.haxx.se/mail/ - -1.3 Security bugs - - If you find a bug or problem in curl or libcurl that you think has a - security impact, for example a bug that can put users in danger or make them - vulnerable if the bug becomes public knowledge, then please report that bug - using our security development process. - - Security related bugs or bugs that are suspected to have a security impact, - should be reported by email to curl-security@haxx.se so that they first can - be dealt with away from the public to minimize the harm and impact it will - have on existing users out there who might be using the vulernable versions. - - The curl project's process for handling security related issues is - documented here: - - https://curl.haxx.se/dev/security.html - -1.4 What to report - - When reporting a bug, you should include all information that will help us - understand what's wrong, what you expected to happen and how to repeat the - bad behavior. You therefore need to tell us: - - - your operating system's name and version number - - - what version of curl you're using (curl -V is fine) - - - versions of the used libraries that libcurl is built to use - - - what URL you were working with (if possible), at least which protocol - - and anything and everything else you think matters. Tell us what you - expected to happen, tell use what did happen, tell us how you could make it - work another way. Dig around, try out, test. Then include all the tiny bits - and pieces in your report. You will benefit from this yourself, as it will - enable us to help you quicker and more accurately. - - Since curl deals with networks, it often helps us if you include a protocol - debug dump with your bug report. The output you get by using the -v or - --trace options. - - If curl crashed, causing a core dump (in unix), there is hardly any use to - send that huge file to anyone of us. Unless we have an exact same system - setup as you, we can't do much with it. Instead we ask you to get a stack - trace and send that (much smaller) output to us instead! - - The address and how to subscribe to the mailing lists are detailed in the - MANUAL file. - -1.5 libcurl problems - - When you've written your own application with libcurl to perform transfers, - it is even more important to be specific and detailed when reporting bugs. - - Tell us the libcurl version and your operating system. Tell us the name and - version of all relevant sub-components like for example the SSL library - you're using and what name resolving your libcurl uses. If you use SFTP or - SCP, the libssh2 version is relevant etc. - - Showing us a real source code example repeating your problem is the best way - to get our attention and it will greatly increase our chances to understand - your problem and to work on a fix (if we agree it truly is a problem). - - Lots of problems that appear to be libcurl problems are actually just abuses - of the libcurl API or other malfunctions in your applications. It is advised - that you run your problematic program using a memory debug tool like - valgrind or similar before you post memory-related or "crashing" problems to - us. - -1.6 Who will fix the problems - - If the problems or bugs you describe are considered to be bugs, we want to - have the problems fixed. - - There are no developers in the curl project that are paid to work on bugs. - All developers that take on reported bugs do this on a voluntary basis. We - do it out of an ambition to keep curl and libcurl excellent products and out - of pride. - - But please do not assume that you can just lump over something to us and it - will then magically be fixed after some given time. Most often we need - feedback and help to understand what you've experienced and how to repeat a - problem. Then we may only be able to assist YOU to debug the problem and to - track down the proper fix. - - We get reports from many people every month and each report can take a - considerable amount of time to really go to the bottom with. - -1.7 How to get a stack trace - - First, you must make sure that you compile all sources with -g and that you - don't 'strip' the final executable. Try to avoid optimizing the code as - well, remove -O, -O2 etc from the compiler options. - - Run the program until it cores. - - Run your debugger on the core file, like ' curl core'. - should be replaced with the name of your debugger, in most cases that will - be 'gdb', but 'dbx' and others also occur. - - When the debugger has finished loading the core file and presents you a - prompt, enter 'where' (without the quotes) and press return. - - The list that is presented is the stack trace. If everything worked, it is - supposed to contain the chain of functions that were called when curl - crashed. Include the stack trace with your detailed bug report. It'll help a - lot. - -1.8 Bugs in libcurl bindings - - There will of course pop up bugs in libcurl bindings. You should then - primarily approach the team that works on that particular binding and see - what you can do to help them fix the problem. - - If you suspect that the problem exists in the underlying libcurl, then - please convert your program over to plain C and follow the steps outlined - above. - -1.9 Bugs in old versions - - The curl project typically releases new versions every other month, and we - fix several hundred bugs per year. For a huge table of releases, number of - bug fixes and more, see: https://curl.haxx.se/docs/releases.html - - The developers in the curl project do not have bandwidth or energy enough to - maintain several branches or to spend much time on hunting down problems in - old versions when chances are we already fixed them or at least that they've - changed nature and appearance in later versions. - - When you experience a problem and want to report it, you really SHOULD - include the version number of the curl you're using when you experience the - issue. If that version number shows us that you're using an out-of-date - curl, you should also try out a modern curl version to see if the problem - persists or how/if it has changed in apperance. - - Even if you cannot immediately upgrade your application/system to run the - latest curl version, you can most often at least run a test version or - experimental build or similar, to get this confirmed or not. - - At times people insist that they cannot upgrade to a modern curl version, - but instead they "just want the bug fixed". That's fine, just don't count on - us spending many cycles on trying to identify which single commit, if that's - even possible, that at some point in the past fixed the problem you're now - experiencing. - - Security wise, it is almost always a bad idea to lag behind the current curl - versions by a lot. We keeping discovering and reporting security problems - over time see you can see in this table: - https://curl.haxx.se/docs/vulnerabilities.html - -2. Bug fixing procedure - -2.1 What happens on first filing - - When a new issue is posted in the issue tracker or on the mailing list, the - team of developers first need to see the report. Maybe they took the day - off, maybe they're off in the woods hunting. Have patience. Allow at least a - few days before expecting someone to have responded. - - In the issue tracker you can expect that some labels will be set on the - issue to help categorize it. - -2.2 First response - - If your issue/bug report wasn't perfect at once (and few are), chances are - that someone will ask follow-up questions. Which version did you use? Which - options did you use? How often does the problem occur? How can we reproduce - this problem? Which protocols does it involve? Or perhaps much more specific - and deep diving questions. It all depends on your specific issue. - - You should then respond to these follow-up questions and provide more info - about the problem, so that we can help you figure it out. Or maybe you can - help us figure it out. An active back-and-forth communication is important - and the key for finding a cure and landing a fix. - -2.3 Not reproducible - - For problems that we can't reproduce and can't understand even after having - gotten all the info we need and having studied the source code over again, - are really hard to solve so then we may require further work from you who - actually see or experience the problem. - -2.4 Unresponsive - - If the problem haven't been understood or reproduced, and there's nobody - responding to follow-up questions or questions asking for clarifications or - for discussing possible ways to move forward with the task, we take that as - a strong suggestion that the bug is not important. - - Unimportant issues will be closed as inactive sooner or later as they can't - be fixed. The inactivity period (waiting for responses) should not be - shorter than two weeks but may extend months. - -2.5 Lack of time/interest - - Bugs that are filed and are understood can unfortunately end up in the - "nobody cares enough about it to work on it" category. Such bugs are - perfectly valid problems that *should* get fixed but apparently aren't. We - try to mark such bugs as "KNOWN_BUGS material" after a time of inactivity - and if no activity is noticed after yet some time those bugs are added to - KNOWN_BUGS and are closed in the issue tracker. - -2.6 KNOWN_BUGS - - This is a list of known bugs. Bugs we know exist and that have been pointed - out but that haven't yet been fixed. The reasons for why they haven't been - fixed can involve anything really, but the primary reason is that nobody has - considered these problems to be important enough to spend the necessary time - and effort to have them fixed. - - The KNOWN_BUGS are always up for grabs and we will always love the ones who - bring one of them back to live and offers solutions to them. - - The KNOWN_BUGS document has a sibling document known as TODO. - -2.7 TODO - - Issues that are filed or reported that aren't really bugs but more missing - features or ideas for future improvements and so on are marked as - 'enhancement' or 'feature-request' and will be added to the TODO document - instead and the issue is closed. We don't keep TODO items in the issue - tracker. - - The TODO document is full of ideas and suggestions of what we can add or fix - one day. You're always encouraged and free to grab one of those items and - take up a discussion with the curl development team on how that could be - implemented or provided in the project so that you can work on ticking it - odd that document. - - If the issue is rather a bug and not a missing feature or functionality, it - is listed in KNOWN_BUGS instead. - -2.8 Closing off stalled bugs - - The issue and pull request trackers on https://github.com/curl/curl will - only hold "active" entries (using a non-precise definition of what active - actually is, but they're at least not completely dead). Those that are - abandonded or in other ways dormant will be closed and sometimes added to - TODO and KNOWN_BUGS instead. - - This way, we only have "active" issues open on github. Irrelevant issues and - pull requests will not distract developes or casual visitors. diff --git a/curl/docs/BUGS.md b/curl/docs/BUGS.md new file mode 100644 index 00000000..2c0a3017 --- /dev/null +++ b/curl/docs/BUGS.md @@ -0,0 +1,266 @@ +# BUGS + +## There are still bugs + + Curl and libcurl keep being developed. Adding features and changing code + means that bugs will sneak in, no matter how hard we try not to. + + Of course there are lots of bugs left. And lots of misfeatures. + + To help us make curl the stable and solid product we want it to be, we need + bug reports and bug fixes. + +## Where to report + + If you can't fix a bug yourself and submit a fix for it, try to report an as + detailed report as possible to a curl mailing list to allow one of us to have + a go at a solution. You can optionally also submit your problem in [curl's + bug tracking system](https://github.com/curl/curl/issues). + + Please read the rest of this document below first before doing that! + + If you feel you need to ask around first, find a suitable [mailing list]( + https://curl.se/mail/) and post your questions there. + +## Security bugs + + If you find a bug or problem in curl or libcurl that you think has a security + impact, for example a bug that can put users in danger or make them + vulnerable if the bug becomes public knowledge, then please report that bug + using our security development process. + + Security related bugs or bugs that are suspected to have a security impact, + should be reported on the [curl security tracker at + HackerOne](https://hackerone.com/curl). + + This ensures that the report reaches the curl security team so that they + first can deal with the report away from the public to minimize the harm + and impact it will have on existing users out there who might be using the + vulnerable versions. + + The curl project's process for handling security related issues is + [documented separately](https://curl.se/dev/secprocess.html). + +## What to report + + When reporting a bug, you should include all information that will help us + understand what's wrong, what you expected to happen and how to repeat the + bad behavior. You therefore need to tell us: + + - your operating system's name and version number + + - what version of curl you're using (`curl -V` is fine) + + - versions of the used libraries that libcurl is built to use + + - what URL you were working with (if possible), at least which protocol + + and anything and everything else you think matters. Tell us what you expected + to happen, tell use what did happen, tell us how you could make it work + another way. Dig around, try out, test. Then include all the tiny bits and + pieces in your report. You will benefit from this yourself, as it will enable + us to help you quicker and more accurately. + + Since curl deals with networks, it often helps us if you include a protocol + debug dump with your bug report. The output you get by using the `-v` or + `--trace` options. + + If curl crashed, causing a core dump (in unix), there is hardly any use to + send that huge file to anyone of us. Unless we have an exact same system + setup as you, we can't do much with it. Instead, we ask you to get a stack + trace and send that (much smaller) output to us instead! + + The address and how to subscribe to the mailing lists are detailed in the + `MANUAL.md` file. + +## libcurl problems + + When you've written your own application with libcurl to perform transfers, + it is even more important to be specific and detailed when reporting bugs. + + Tell us the libcurl version and your operating system. Tell us the name and + version of all relevant sub-components like for example the SSL library + you're using and what name resolving your libcurl uses. If you use SFTP or + SCP, the libssh2 version is relevant etc. + + Showing us a real source code example repeating your problem is the best way + to get our attention and it will greatly increase our chances to understand + your problem and to work on a fix (if we agree it truly is a problem). + + Lots of problems that appear to be libcurl problems are actually just abuses + of the libcurl API or other malfunctions in your applications. It is advised + that you run your problematic program using a memory debug tool like valgrind + or similar before you post memory-related or "crashing" problems to us. + +## Who will fix the problems + + If the problems or bugs you describe are considered to be bugs, we want to + have the problems fixed. + + There are no developers in the curl project that are paid to work on bugs. + All developers that take on reported bugs do this on a voluntary basis. We do + it out of an ambition to keep curl and libcurl excellent products and out of + pride. + + But please do not assume that you can just lump over something to us and it + will then magically be fixed after some given time. Most often we need + feedback and help to understand what you've experienced and how to repeat a + problem. Then we may only be able to assist YOU to debug the problem and to + track down the proper fix. + + We get reports from many people every month and each report can take a + considerable amount of time to really go to the bottom with. + +## How to get a stack trace + + First, you must make sure that you compile all sources with `-g` and that you + don't 'strip' the final executable. Try to avoid optimizing the code as well, + remove `-O`, `-O2` etc from the compiler options. + + Run the program until it cores. + + Run your debugger on the core file, like ` curl + core`. `` should be replaced with the name of your debugger, in + most cases that will be `gdb`, but `dbx` and others also occur. + + When the debugger has finished loading the core file and presents you a + prompt, enter `where` (without quotes) and press return. + + The list that is presented is the stack trace. If everything worked, it is + supposed to contain the chain of functions that were called when curl + crashed. Include the stack trace with your detailed bug report. It'll help a + lot. + +## Bugs in libcurl bindings + + There will of course pop up bugs in libcurl bindings. You should then + primarily approach the team that works on that particular binding and see + what you can do to help them fix the problem. + + If you suspect that the problem exists in the underlying libcurl, then please + convert your program over to plain C and follow the steps outlined above. + +## Bugs in old versions + + The curl project typically releases new versions every other month, and we + fix several hundred bugs per year. For a huge table of releases, number of + bug fixes and more, see: https://curl.se/docs/releases.html + + The developers in the curl project do not have bandwidth or energy enough to + maintain several branches or to spend much time on hunting down problems in + old versions when chances are we already fixed them or at least that they've + changed nature and appearance in later versions. + + When you experience a problem and want to report it, you really SHOULD + include the version number of the curl you're using when you experience the + issue. If that version number shows us that you're using an out-of-date curl, + you should also try out a modern curl version to see if the problem persists + or how/if it has changed in appearance. + + Even if you cannot immediately upgrade your application/system to run the + latest curl version, you can most often at least run a test version or + experimental build or similar, to get this confirmed or not. + + At times people insist that they cannot upgrade to a modern curl version, but + instead they "just want the bug fixed". That's fine, just don't count on us + spending many cycles on trying to identify which single commit, if that's + even possible, that at some point in the past fixed the problem you're now + experiencing. + + Security wise, it is almost always a bad idea to lag behind the current curl + versions by a lot. We keep discovering and reporting security problems + over time see you can see in [this + table](https://curl.se/docs/vulnerabilities.html) + +# Bug fixing procedure + +## What happens on first filing + + When a new issue is posted in the issue tracker or on the mailing list, the + team of developers first need to see the report. Maybe they took the day off, + maybe they're off in the woods hunting. Have patience. Allow at least a few + days before expecting someone to have responded. + + In the issue tracker you can expect that some labels will be set on the issue + to help categorize it. + +## First response + + If your issue/bug report wasn't perfect at once (and few are), chances are + that someone will ask follow-up questions. Which version did you use? Which + options did you use? How often does the problem occur? How can we reproduce + this problem? Which protocols does it involve? Or perhaps much more specific + and deep diving questions. It all depends on your specific issue. + + You should then respond to these follow-up questions and provide more info + about the problem, so that we can help you figure it out. Or maybe you can + help us figure it out. An active back-and-forth communication is important + and the key for finding a cure and landing a fix. + +## Not reproducible + + For problems that we can't reproduce and can't understand even after having + gotten all the info we need and having studied the source code over again, + are really hard to solve so then we may require further work from you who + actually see or experience the problem. + +## Unresponsive + + If the problem haven't been understood or reproduced, and there's nobody + responding to follow-up questions or questions asking for clarifications or + for discussing possible ways to move forward with the task, we take that as a + strong suggestion that the bug is not important. + + Unimportant issues will be closed as inactive sooner or later as they can't + be fixed. The inactivity period (waiting for responses) should not be shorter + than two weeks but may extend months. + +## Lack of time/interest + + Bugs that are filed and are understood can unfortunately end up in the + "nobody cares enough about it to work on it" category. Such bugs are + perfectly valid problems that *should* get fixed but apparently aren't. We + try to mark such bugs as `KNOWN_BUGS material` after a time of inactivity and + if no activity is noticed after yet some time those bugs are added to the + `KNOWN_BUGS` document and are closed in the issue tracker. + +## `KNOWN_BUGS` + + This is a list of known bugs. Bugs we know exist and that have been pointed + out but that haven't yet been fixed. The reasons for why they haven't been + fixed can involve anything really, but the primary reason is that nobody has + considered these problems to be important enough to spend the necessary time + and effort to have them fixed. + + The `KNOWN_BUGS` items are always up for grabs and we love the ones who bring + one of them back to life and offer solutions to them. + + The `KNOWN_BUGS` document has a sibling document known as `TODO`. + +## `TODO` + + Issues that are filed or reported that aren't really bugs but more missing + features or ideas for future improvements and so on are marked as + 'enhancement' or 'feature-request' and will be added to the `TODO` document + and the issues are closed. We don't keep TODO items open in the issue + tracker. + + The `TODO` document is full of ideas and suggestions of what we can add or + fix one day. You're always encouraged and free to grab one of those items and + take up a discussion with the curl development team on how that could be + implemented or provided in the project so that you can work on ticking it odd + that document. + + If an issue is rather a bug and not a missing feature or functionality, it is + listed in `KNOWN_BUGS` instead. + +## Closing off stalled bugs + + The [issue and pull request trackers](https://github.com/curl/curl) only + holds "active" entries open (using a non-precise definition of what active + actually is, but they're at least not completely dead). Those that are + abandoned or in other ways dormant will be closed and sometimes added to + `TODO` and `KNOWN_BUGS` instead. + + This way, we only have "active" issues open on GitHub. Irrelevant issues and + pull requests will not distract developers or casual visitors. diff --git a/curl/docs/CHECKSRC.md b/curl/docs/CHECKSRC.md index b42de847..2f634c49 100644 --- a/curl/docs/CHECKSRC.md +++ b/curl/docs/CHECKSRC.md @@ -9,7 +9,7 @@ check that it adheres to our [Source Code Style guide](CODE_STYLE.md). ## Command line options -`-W[file]` whitelists that file and excludes it from being checked. Helpful +`-W[file]` skip that file and excludes it from being checked. Helpful when, for example, one of the files is generated. `-D[dir]` directory name to prepend to file names when accessing them. @@ -30,6 +30,17 @@ Lists how to use the script and it lists all existing warnings it has and problems it detects. At the time of this writing, the existing checksrc warnings are: +- `ASSIGNWITHINCONDITION`: Assignment within a conditional expression. The + code style mandates the assignment to be done outside of it. + +- `ASTERISKNOSPACE`: A pointer was declared like `char* name` instead of the + more appropriate `char *name` style. The asterisk should sit next to the + name. + +- `ASTERISKSPACE`: A pointer was declared like `char * name` instead of the + more appropriate `char *name` style. The asterisk should sit right next to + the name without a space in between. + - `BADCOMMAND`: There's a bad !checksrc! instruction in the code. See the **Ignore certain warnings** section below for details. @@ -37,29 +48,60 @@ warnings are: strcat, strncat, gets are **never** allowed in curl source code. - `BRACEELSE`: '} else' on the same line. The else is supposed to be on the - following line. + following line. - `BRACEPOS`: wrong position for an open brace (`{`). +- `BRACEWHILE`: more than once space between end brace and while keyword + - `COMMANOSPACE`: a comma without following space - `COPYRIGHT`: the file is missing a copyright statement! - `CPPCOMMENTS`: `//` comment detected, that's not C89 compliant +- `DOBRACE`: only use one space after do before open brace + +- `EMPTYLINEBRACE`: found empty line before open brace + +- `EQUALSNOSPACE`: no space after `=` sign + +- `EQUALSNULL`: comparison with `== NULL` used in if/while. We use `!var`. + +- `EXCLAMATIONSPACE`: space found after exclamations mark + - `FOPENMODE`: `fopen()` needs a macro for the mode string, use it -- `INDENTATION`: detected a wrong start column for code. Note that this warning - only checks some specific places and will certainly miss many bad +- `INDENTATION`: detected a wrong start column for code. Note that this + warning only checks some specific places and will certainly miss many bad indentations. - `LONGLINE`: A line is longer than 79 columns. +- `MULTISPACE`: Multiple spaces were found where only one should be used. + +- `NOSPACEEQUALS`: An equals sign was found without preceding space. We prefer + `a = 2` and *not* `a=2`. + +- `NOTEQUALSZERO`: check found using `!= 0`. We use plain `if(var)`. + +- `ONELINECONDITION`: do not put the conditional block on the same line as `if()` + +- `OPENCOMMENT`: File ended with a comment (`/*`) still "open". + - `PARENBRACE`: `){` was used without sufficient space in between. - `RETURNNOSPACE`: `return` was used without space between the keyword and the following value. +- `SEMINOSPACE`: There was no space (or newline) following a semicolon. + +- `SIZEOFNOPAREN`: Found use of sizeof without parentheses. We prefer + `sizeof(int)` style. + +- `SNPRINTF` - Found use of `snprintf()`. Since we use an internal replacement + with a different return code etc, we prefer `msnprintf()`. + - `SPACEAFTERPAREN`: there was a space after open parenthesis, `( text`. - `SPACEBEFORECLOSE`: there was a space before a close parenthesis, `text )`. @@ -69,15 +111,30 @@ warnings are: - `SPACEBEFOREPAREN`: there was a space before an open parenthesis, `if (`, where one was not expected -- `SPACESEMILCOLON`: there was a space before semicolon, ` ;`. +- `SPACESEMICOLON`: there was a space before semicolon, ` ;`. - `TABS`: TAB characters are not allowed! -- `TRAILINGSPACE`: Trailing white space on the line +- `TRAILINGSPACE`: Trailing whitespace on the line + +- `TYPEDEFSTRUCT`: we frown upon (most) typedefed structs - `UNUSEDIGNORE`: a checksrc inlined warning ignore was asked for but not used, that's an ignore that should be removed or changed to get used. +### Extended warnings + +Some warnings are quite computationally expensive to perform, so they are +turned off by default. To enable these warnings, place a `.checksrc` file in +the directory where they should be activated with commands to enable the +warnings you are interested in. The format of the file is to enable one +warning per line like so: `enable ` + +Currently there is one extended warning which can be enabled: + +- `COPYRIGHTYEAR`: the current changeset hasn't updated the copyright year in + the source file + ## Ignore certain warnings Due to the nature of the source code and the flaws of the checksrc tool, there @@ -120,5 +177,5 @@ instances are ignored and nothing extra. This is a method we've transitioned away from. Use inline ignores as far as possible. -Make a `checksrc.whitelist` file in the directory of the source code with the +Make a `checksrc.skip` file in the directory of the source code with the false positive, and include the full offending line into this file. diff --git a/curl/docs/CIPHERS.md b/curl/docs/CIPHERS.md index e09533b0..af8f2f4c 100644 --- a/curl/docs/CIPHERS.md +++ b/curl/docs/CIPHERS.md @@ -1,7 +1,17 @@ # Ciphers -With curl's options `CURLOPT_SSL_CIPHER_LIST` and `--ciphers` users can -control which ciphers to consider when negotiating TLS connections. +With curl's options +[`CURLOPT_SSL_CIPHER_LIST`](https://curl.se/libcurl/c/CURLOPT_SSL_CIPHER_LIST.html) +and +[`--ciphers`](https://curl.se/docs/manpage.html#--ciphers) +users can control which ciphers to consider when negotiating TLS connections. + +TLS 1.3 ciphers are supported since curl 7.61 for OpenSSL 1.1.1+ with options +[`CURLOPT_TLS13_CIPHERS`](https://curl.se/libcurl/c/CURLOPT_TLS13_CIPHERS.html) +and +[`--tls13-ciphers`](https://curl.se/docs/manpage.html#--tls13-ciphers) +. If you are using a different SSL backend you can try setting TLS 1.3 cipher +suites by using the respective regular cipher option. The names of the known ciphers differ depending on which TLS backend that libcurl was built to use. This is an attempt to list known cipher names. @@ -10,6 +20,8 @@ libcurl was built to use. This is an attempt to list known cipher names. (based on [OpenSSL docs](https://www.openssl.org/docs/man1.1.0/apps/ciphers.html)) +When specifying multiple cipher names, separate them with colon (`:`). + ### SSL3 cipher suites `NULL-MD5` @@ -142,6 +154,16 @@ libcurl was built to use. This is an attempt to list known cipher names. `ECDHE-RSA-CAMELLIA128-SHA256` `ECDHE-RSA-CAMELLIA256-SHA384` +### TLS 1.3 cipher suites + +(Note these ciphers are set with `CURLOPT_TLS13_CIPHERS` and `--tls13-ciphers`) + +`TLS_AES_256_GCM_SHA384` +`TLS_CHACHA20_POLY1305_SHA256` +`TLS_AES_128_GCM_SHA256` +`TLS_AES_128_CCM_8_SHA256` +`TLS_AES_128_CCM_SHA256` + ## NSS ### Totally insecure @@ -248,9 +270,16 @@ libcurl was built to use. This is an attempt to list known cipher names. `ecdhe_ecdsa_chacha20_poly1305_sha_256` `dhe_rsa_chacha20_poly1305_sha_256` +### TLS 1.3 cipher suites + +`aes_128_gcm_sha_256` +`aes_256_gcm_sha_384` +`chacha20_poly1305_sha_256` + ## GSKit -Ciphers are internally defined as numeric codes (https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/gsk_attribute_set_buffer.htm), +Ciphers are internally defined as +[numeric codes](https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/gsk_attribute_set_buffer.htm), but libcurl maps them to the following case-insensitive names. ### SSL2 cipher suites (insecure: disabled by default) @@ -424,3 +453,70 @@ but libcurl maps them to the following case-insensitive names. `ECDHE-PSK-CHACHA20-POLY1305`, `DHE-PSK-CHACHA20-POLY1305`, `EDH-RSA-DES-CBC3-SHA`, + +## Schannel + +Schannel allows the enabling and disabling of encryption algorithms, but not +specific ciphersuites. They are +[defined](https://docs.microsoft.com/windows/desktop/SecCrypto/alg-id) by +Microsoft. + +There is also the case that the selected algorithm is not supported by the +protocol or does not match the ciphers offered by the server during the SSL +negotiation. In this case curl will return error +`CURLE_SSL_CONNECT_ERROR (35) SEC_E_ALGORITHM_MISMATCH` +and the request will fail. + +`CALG_MD2`, +`CALG_MD4`, +`CALG_MD5`, +`CALG_SHA`, +`CALG_SHA1`, +`CALG_MAC`, +`CALG_RSA_SIGN`, +`CALG_DSS_SIGN`, +`CALG_NO_SIGN`, +`CALG_RSA_KEYX`, +`CALG_DES`, +`CALG_3DES_112`, +`CALG_3DES`, +`CALG_DESX`, +`CALG_RC2`, +`CALG_RC4`, +`CALG_SEAL`, +`CALG_DH_SF`, +`CALG_DH_EPHEM`, +`CALG_AGREEDKEY_ANY`, +`CALG_HUGHES_MD5`, +`CALG_SKIPJACK`, +`CALG_TEK`, +`CALG_CYLINK_MEK`, +`CALG_SSL3_SHAMD5`, +`CALG_SSL3_MASTER`, +`CALG_SCHANNEL_MASTER_HASH`, +`CALG_SCHANNEL_MAC_KEY`, +`CALG_SCHANNEL_ENC_KEY`, +`CALG_PCT1_MASTER`, +`CALG_SSL2_MASTER`, +`CALG_TLS1_MASTER`, +`CALG_RC5`, +`CALG_HMAC`, +`CALG_TLS1PRF`, +`CALG_HASH_REPLACE_OWF`, +`CALG_AES_128`, +`CALG_AES_192`, +`CALG_AES_256`, +`CALG_AES`, +`CALG_SHA_256`, +`CALG_SHA_384`, +`CALG_SHA_512`, +`CALG_ECDH`, +`CALG_ECMQV`, +`CALG_ECDSA`, +`CALG_ECDH_EPHEM`, + +As of curl 7.77.0, you can also pass `SCH_USE_STRONG_CRYPTO` as a cipher name +to [constrain the set of available ciphers as specified in the schannel +documentation](https://docs.microsoft.com/en-us/windows/win32/secauthn/tls-cipher-suites-in-windows-server-2022). +Note that the supported ciphers in this case follows the OS version, so if you +are running an outdated OS you might still be supporting weak ciphers. diff --git a/curl/docs/CMakeLists.txt b/curl/docs/CMakeLists.txt index 69486172..b3230ec5 100644 --- a/curl/docs/CMakeLists.txt +++ b/curl/docs/CMakeLists.txt @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### #add_subdirectory(examples) add_subdirectory(libcurl) add_subdirectory(cmdline-opts) diff --git a/curl/docs/CODE_REVIEW.md b/curl/docs/CODE_REVIEW.md new file mode 100644 index 00000000..e6a28a60 --- /dev/null +++ b/curl/docs/CODE_REVIEW.md @@ -0,0 +1,168 @@ +# How to do code reviews for curl + +Anyone and everyone is encouraged and welcome to review code submissions in +curl. This is a guide on what to check for and how to perform a successful +code review. + +## All submissions should get reviewed + +All pull requests and patches submitted to the project should be reviewed by +at least one experienced curl maintainer before that code is accepted and +merged. + +## Let the tools and tests take the first rounds + +On initial pull requests, let the tools and tests do their job first and then +start out by helping the submitter understand the test failures and tool +alerts. + +## How to provide feedback to author + +Be nice. Ask questions. Provide examples or suggestions of improvements. +Assume the best intentions. Remember language barriers. + +All first-time contributors can become regulars. Let's help them go there. + +## Is this a change we want? + +If this is not a change that seems to be aligned with the project's path +forward and as such cannot be accepted, inform the author about this sooner +rather than later. Do it gently and explain why and possibly what could be +done to make it more acceptable. + +## API/ABI stability or changed behavior + +Changing the API and the ABI may be fine in a change but it needs to be done +deliberately and carefully. If not, a reviewer must help the author to realize +the mistake. + +curl and libcurl are similarly very strict on not modifying existing +behavior. API and ABI stability is not enough, the behavior should also remain +intact as far as possible. + +## Code style + +Most code style nits are detected by checksrc but not all. Only leave remarks +on style deviation once checksrc doesn't find anymore. + +Minor nits from fresh submitters can also be handled by the maintainer when +merging, in case it seems like the submitter isn't clear on what to do. We +want to make the process fun and exciting for new contributors. + +## Encourage consistency + +Make sure new code is written in a similar style as existing code. Naming, +logic, conditions, etc. + +## Are pointers always non-NULL? + +If a function or code rely on pointers being non-NULL, take an extra look if +that seems to be a fair assessment. + +## Asserts + +Conditions that should never be false can be verified with `DEBUGASSERT()` +calls to get caught in tests and debugging easier, while not having an impact +on final or release builds. + +## Memory allocation + +Can the mallocs be avoided? Do not introduce mallocs in any hot paths. If +there are (new) mallocs, can they be combined into fewer calls? + +Are all allocations handled in errorpaths to avoid leaks and crashes? + +## Thread-safety + +We do not like static variables as they break thread-safety and prevent +functions from being reentrant. + +## Should features be `#ifdef`ed? + +Features and functionality may not be present everywhere and should therefore +be `#ifdef`ed. Additionally, some features should be possible to switch on/off +in the build. + +Write `#ifdef`s to be as little of a "maze" as possible. + +## Does it look portable enough? + +curl runs "everywhere". Does the code take a reasonable stance and enough +precautions to be possible to build and run on most platforms? + +Remember that we live by C89 restrictions. + +## Tests and testability + +New features should be added in conjunction with one or more test cases. +Ideally, functions should also be written so that unit tests can be done to +test individual functions. + +## Documentation + +New features or changes to existing functionality **must** be accompanied by +updated documentation. Submitting that in a separate follow-up pull request is +not OK. A code review must also verify that the submitted documentation update +matches the code submission. + +English isn't everyone's first language, be mindful of this and help the +submitter improve the text if it needs a rewrite to read better. + +## Code shouldn't be hard to understand + +Source code should be written to maximize readability and be easy to +understand. + +## Functions shouldn't be large + +A single function should never be large as that makes it hard to follow and +understand all the exit points and state changes. Some existing functions in +curl certainly violate this ground rule but when reviewing new code we should +propose splitting into smaller functions. + +## Duplication is evil + +Anything that looks like duplicated code is a red flag. Anything that seems to +introduce code that we *should* already have or provide needs a closer check. + +## Sensitive data + +When credentials are involved, take an extra look at what happens with this +data. Where it comes from and where it goes. + +## Variable types differ + +`size_t` is not a fixed size. `time_t` can be signed or unsigned and have +different sizes. Relying on variable sizes is a red flag. + +Also remember that endianness and >= 32 bit accesses to unaligned addresses +are problematic areas. + +## Integer overflows + +Be careful about integer overflows. Some variable types can be either 32 bit +or 64 bit. Integer overflows must be detected and acted on *before* they +happen. + +## Dangerous use of functions + +Maybe use of `realloc()` should rather use the dynbuf functions? + +Do not allow new code that grows buffers without using dynbuf. + +Use of C functions that rely on a terminating zero must only be used on data +that really do have a zero terminating zero. + +## Dangerous "data styles" + +Make extra precautions and verify that memory buffers that need a terminating +zero always have exactly that. Buffers *without* a zero terminator must not be +used as input to string functions. + +# Commit messages + +Tightly coupled with a code review is making sure that the commit message is +good. It is the responsibility of the person who merges the code to make sure +that the commit message follows our standard (detailed in the +[CONTRIBUTE.md](CONTRIBUTE.md) document). This includes making sure the PR +identifies related issues and giving credit to reporters and helpers. diff --git a/curl/docs/CODE_STYLE.md b/curl/docs/CODE_STYLE.md index ba5f7102..8ba1e038 100644 --- a/curl/docs/CODE_STYLE.md +++ b/curl/docs/CODE_STYLE.md @@ -28,26 +28,30 @@ other places of the code, just that the names should be logical, understandable and be named according to what they're used for. File-local functions should be made static. We like lower case names. -See the [INTERNALS](INTERNALS.md) document on how we name non-exported -library-global symbols. +See the [INTERNALS](https://curl.se/dev/internals.html#symbols) document on +how we name non-exported library-global symbols. ## Indenting We use only spaces for indentation, never TABs. We use two spaces for each new open brace. - if(something_is_true) { - while(second_statement == fine) { - moo(); - } - } +```c +if(something_is_true) { + while(second_statement == fine) { + moo(); + } +} +``` ## Comments -Since we write C89 code, `//` comments are not allowed. They weren't -introduced in the C standard until C99. We use only `/*` and `*/` comments: +Since we write C89 code, **//** comments are not allowed. They weren't +introduced in the C standard until C99. We use only __/* comments */__. - /* this is a comment */ +```c +/* this is a comment */ +``` ## Long lines @@ -69,42 +73,52 @@ In if/while/do/for expressions, we write the open brace on the same line as the keyword and we then set the closing brace on the same indentation level as the initial keyword. Like this: - if(age < 40) { - /* clearly a youngster */ - } +```c +if(age < 40) { + /* clearly a youngster */ +} +``` You may omit the braces if they would contain only a one-line statement: - if(!x) - continue; +```c +if(!x) + continue; +``` For functions the opening brace should be on a separate line: - int main(int argc, char **argv) - { - return 1; - } +```c +int main(int argc, char **argv) +{ + return 1; +} +``` ## 'else' on the following line -When adding an `else` clause to a conditional expression using braces, we add -it on a new line after the closing brace. Like this: +When adding an **else** clause to a conditional expression using braces, we +add it on a new line after the closing brace. Like this: - if(age < 40) { - /* clearly a youngster */ - } - else { - /* probably grumpy */ - } +```c +if(age < 40) { + /* clearly a youngster */ +} +else { + /* probably grumpy */ +} +``` ## No space before parentheses When writing expressions using if/while/do/for, there shall be no space between the keyword and the open parenthesis. Like this: - while(1) { - /* loop forever */ - } +```c +while(1) { + /* loop forever */ +} +``` ## Use boolean conditions @@ -112,127 +126,184 @@ Rather than test a conditional value such as a bool against TRUE or FALSE, a pointer against NULL or != NULL and an int against zero or not zero in if/while conditions we prefer: - result = do_something(); - if(!result) { - /* something went wrong */ - return result; - } +```c +result = do_something(); +if(!result) { + /* something went wrong */ + return result; +} +``` ## No assignments in conditions To increase readability and reduce complexity of conditionals, we avoid assigning variables within if/while conditions. We frown upon this style: - if((ptr = malloc(100)) == NULL) - return NULL; +```c +if((ptr = malloc(100)) == NULL) + return NULL; +``` and instead we encourage the above version to be spelled out more clearly: - ptr = malloc(100); - if(!ptr) - return NULL; +```c +ptr = malloc(100); +if(!ptr) + return NULL; +``` ## New block on a new line We never write multiple statements on the same source line, even for very short if() conditions. - if(a) - return TRUE; - else if(b) - return FALSE; +```c +if(a) + return TRUE; +else if(b) + return FALSE; +``` and NEVER: - if(a) return TRUE; - else if(b) return FALSE; +```c +if(a) return TRUE; +else if(b) return FALSE; +``` ## Space around operators -Please use spaces on both sides of operators in C expressions. Postfix `(), -[], ->, ., ++, --` and Unary `+, - !, ~, &` operators excluded they should +Please use spaces on both sides of operators in C expressions. Postfix **(), +[], ->, ., ++, --** and Unary **+, -, !, ~, &** operators excluded they should have no space. Examples: - bla = func(); - who = name[0]; - age += 1; - true = !false; - size += -2 + 3 * (a + b); - ptr->member = a++; - struct.field = b--; - ptr = &address; - contents = *pointer; - complement = ~bits; - empty = (!*string) ? TRUE : FALSE; +```c +bla = func(); +who = name[0]; +age += 1; +true = !false; +size += -2 + 3 * (a + b); +ptr->member = a++; +struct.field = b--; +ptr = &address; +contents = *pointer; +complement = ~bits; +empty = (!*string) ? TRUE : FALSE; +``` + +## No parentheses for return values + +We use the 'return' statement without extra parentheses around the value: + +```c +int works(void) +{ + return TRUE; +} +``` + +## Parentheses for sizeof arguments + +When using the sizeof operator in code, we prefer it to be written with +parentheses around its argument: + +```c +int size = sizeof(int); +``` ## Column alignment -Some statements cannot be completed on a single line because the line would -be too long, the statement too hard to read, or due to other style guidelines +Some statements cannot be completed on a single line because the line would be +too long, the statement too hard to read, or due to other style guidelines above. In such a case the statement will span multiple lines. If a continuation line is part of an expression or sub-expression then you should align on the appropriate column so that it's easy to tell what part of the statement it is. Operators should not start continuation lines. In other -cases follow the 2-space indent guideline. Here are some examples from libcurl: - -~~~c - if(Curl_pipeline_wanted(handle->multi, CURLPIPE_HTTP1) && - (handle->set.httpversion != CURL_HTTP_VERSION_1_0) && - (handle->set.httpreq == HTTPREQ_GET || - handle->set.httpreq == HTTPREQ_HEAD)) - /* didn't ask for HTTP/1.0 and a GET or HEAD */ - return TRUE; -~~~ - -~~~c - case CURLOPT_KEEP_SENDING_ON_ERROR: - data->set.http_keep_sending_on_error = (0 != va_arg(param, long)) ? - TRUE : FALSE; - break; -~~~ - -~~~c - data->set.http_disable_hostname_check_before_authentication = - (0 != va_arg(param, long)) ? TRUE : FALSE; -~~~ - -~~~c - if(option) { - result = parse_login_details(option, strlen(option), - (userp ? &user : NULL), - (passwdp ? &passwd : NULL), - NULL); - } -~~~ - -~~~c - DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing " - "server response left\n", - (int)clipamount)); -~~~ +cases follow the 2-space indent guideline. Here are some examples from +libcurl: + +```c +if(Curl_pipeline_wanted(handle->multi, CURLPIPE_HTTP1) && + (handle->set.httpversion != CURL_HTTP_VERSION_1_0) && + (handle->set.httpreq == HTTPREQ_GET || + handle->set.httpreq == HTTPREQ_HEAD)) + /* didn't ask for HTTP/1.0 and a GET or HEAD */ + return TRUE; +``` + +If no parenthesis, use the default indent: + +```c +data->set.http_disable_hostname_check_before_authentication = + (0 != va_arg(param, long)) ? TRUE : FALSE; +``` + +Function invoke with an open parenthesis: + +```c +if(option) { + result = parse_login_details(option, strlen(option), + (userp ? &user : NULL), + (passwdp ? &passwd : NULL), + NULL); +} +``` + +Align with the "current open" parenthesis: + +```c +DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing " + "server response left\n", + (int)clipamount)); +``` ## Platform dependent code -Use `#ifdef HAVE_FEATURE` to do conditional code. We avoid checking for +Use **#ifdef HAVE_FEATURE** to do conditional code. We avoid checking for particular operating systems or hardware in the #ifdef lines. The HAVE_FEATURE shall be generated by the configure script for unix-like systems and they are -hard-coded in the config-[system].h files for the others. +hard-coded in the `config-[system].h` files for the others. We also encourage use of macros/functions that possibly are empty or defined to constants when libcurl is built without that feature, to make the code -seamless. Like this style where the `magic()` function works differently +seamless. Like this example where the **magic()** function works differently depending on a build-time conditional: - #ifdef HAVE_MAGIC - void magic(int a) - { - return a + 2; - } - #else - #define magic(x) 1 - #endif - - int content = magic(3); +```c +#ifdef HAVE_MAGIC +void magic(int a) +{ + return a + 2; +} +#else +#define magic(x) 1 +#endif + +int content = magic(3); +``` + +## No typedefed structs + +Use structs by all means, but do not typedef them. Use the `struct name` way +of identifying them: + +```c +struct something { + void *valid; + size_t way_to_write; +}; +struct something instance; +``` + +**Not okay**: + +```c +typedef struct { + void *wrong; + size_t way_to_write; +} something; +something instance; +``` diff --git a/curl/docs/CONTRIBUTE.md b/curl/docs/CONTRIBUTE.md index 536a9ceb..4d278b21 100644 --- a/curl/docs/CONTRIBUTE.md +++ b/curl/docs/CONTRIBUTE.md @@ -8,20 +8,20 @@ flaws or bugs. ### Join the Community -Skip over to [https://curl.haxx.se/mail/](https://curl.haxx.se/mail/) and join +Skip over to [https://curl.se/mail/](https://curl.se/mail/) and join the appropriate mailing list(s). Read up on details before you post questions. Read this file before you start sending patches! We prefer questions sent to and discussions being held on the mailing list(s), not sent to individuals. Before posting to one of the curl mailing lists, please read up on the -[mailing list etiquette](https://curl.haxx.se/mail/etiquette.html). +[mailing list etiquette](https://curl.se/mail/etiquette.html). -We also hang out on IRC in #curl on irc.freenode.net +We also hang out on IRC in #curl on libera.chat If you're at all interested in the code side of things, consider clicking -'watch' on the [curl repo on github](https://github.com/curl/curl) to get -notified on pull requests and new issues posted there. +'watch' on the [curl repo on GitHub](https://github.com/curl/curl) to be +notified of pull requests and new issues posted there. ### License and copyright @@ -49,12 +49,12 @@ always provide us with your full real name when contributing! ### What To Read Source code, the man pages, the [INTERNALS -document](https://curl.haxx.se/dev/internals.html), -[TODO](https://curl.haxx.se/docs/todo.html), -[KNOWN_BUGS](https://curl.haxx.se/docs/knownbugs.html) and the [most recent -changes](https://curl.haxx.se/dev/sourceactivity.html) in git. Just lurking on +document](https://curl.se/dev/internals.html), +[TODO](https://curl.se/docs/todo.html), +[KNOWN_BUGS](https://curl.se/docs/knownbugs.html) and the [most recent +changes](https://curl.se/dev/sourceactivity.html) in git. Just lurking on the [curl-library mailing -list](https://curl.haxx.se/mail/list.cgi?list=curl-library) will give you a +list](https://curl.se/mail/list.cgi?list=curl-library) will give you a lot of insights on what's going on right now. Asking there is a good idea too. ## Write a good patch @@ -62,7 +62,7 @@ lot of insights on what's going on right now. Asking there is a good idea too. ### Follow code style When writing C code, follow the -[CODE_STYLE](https://curl.haxx.se/dev/code-style.html) already established in +[CODE_STYLE](https://curl.se/dev/code-style.html) already established in the project. Consistent style makes code easier to read and mistakes less likely to happen. Run `make checksrc` before you submit anything, to make sure you follow the basic style. That script doesn't verify everything, but if it @@ -108,7 +108,7 @@ submit a small description of your fix or your new features with every contribution so that it can be swiftly added to the package documentation. The documentation is always made in man pages (nroff formatted) or plain -ASCII files. All HTML files on the web site and in the release archives are +ASCII files. All HTML files on the website and in the release archives are generated from the nroff/ASCII versions. ### Test Cases @@ -129,9 +129,9 @@ verified your changes. ### How to get your changes into the main sources Ideally you file a [pull request on -github](https://github.com/curl/curl/pulls), but you can also send your plain +GitHub](https://github.com/curl/curl/pulls), but you can also send your plain patch to [the curl-library mailing -list](https://curl.haxx.se/mail/list.cgi?list=curl-library). +list](https://curl.se/mail/list.cgi?list=curl-library). Either way, your change will be reviewed and discussed there and you will be expected to correct flaws pointed out and update accordingly, or the change @@ -151,11 +151,11 @@ changes merged. We strongly prefer pull requests to mailed patches, as it makes it a proper git commit that is easy to merge and they are easy to track and not that easy -to loose in the flood of many emails, like they sometimes do on the mailing +to lose in the flood of many emails, like they sometimes do on the mailing lists. Every pull request submitted will automatically be tested in several different -ways. Every pull request is verfied that: +ways. Every pull request is verified for each of the following: - ... it still builds, warning-free, on Linux and macOS, with both clang and gcc @@ -168,10 +168,36 @@ ways. Every pull request is verfied that: - ... code coverage doesn't shrink drastically If the pull-request fails one of these tests, it will show up as a red X and -you are expected to fix the problem. If you don't understand whan the issue is +you are expected to fix the problem. If you don't understand when the issue is or have other problems to fix the complaint, just ask and other project members will likely be able to help out. +Consider the following table while looking at pull request failures: + + | CI platform as shown in PR | State | What to look at next | + | ----------------------------------- | ------ | -------------------------- | + | CI / codeql | stable | quality check results | + | CI / fuzzing | stable | fuzzing results | + | CI / macos ... | stable | all errors and failures | + | Code scanning results / CodeQL | stable | quality check results | + | FreeBSD FreeBSD: ... | stable | all errors and failures | + | LGTM analysis: Python | stable | new findings | + | LGTM analysis: C/C++ | stable | new findings | + | buildbot/curl_winssl_ ... | stable | all errors and failures | + | continuous-integration/appveyor/pr | stable | all errors and failures | + | curl.curl (linux ...) | stable | all errors and failures | + | curl.curl (windows ...) | flaky | repetitive errors/failures | + | deepcode-ci-bot | stable | new findings | + | musedev | stable | new findings | + +Sometimes the tests fail due to a dependency service temporarily being offline +or otherwise unavailable, eg. package downloads. In this case you can just +try to update your pull requests to rerun the tests later as described below. + +You can update your pull requests by pushing new commits or force-pushing +changes to existing commits. Force-pushing an amended commit without any +actual content changed also allows you to retrigger the tests for that commit. + When you adjust your pull requests after review, consider squashing the commits so that we can review the full updated version more easily. @@ -200,6 +226,16 @@ A short guide to how to write commit messages in the curl project. [whatever-else-by: credit all helpers, finders, doers] ---- stop ---- +The first line is a succinct description of the change: + + - use the imperative, present tense: "change" not "changed" nor "changes" + - don't capitalize first letter + - no dot (.) at the end + +The `[area]` in the first line can be `http2`, `cookies`, `openssl` or +similar. There's no fixed list to select from but using the same "area" as +other related changes could make sense. + Don't forget to use commit --author="" if you commit someone else's work, and make sure that you have your own user and email setup correctly in git before you commit @@ -265,3 +301,6 @@ For Windows: - [https://gnuwin32.sourceforge.io/packages/patch.htm](https://gnuwin32.sourceforge.io/packages/patch.htm) - [https://gnuwin32.sourceforge.io/packages/diffutils.htm](https://gnuwin32.sourceforge.io/packages/diffutils.htm) + +### Useful resources + - [Webinar on getting code into cURL](https://www.youtube.com/watch?v=QmZ3W1d6LQI) diff --git a/curl/docs/CURL-DISABLE.md b/curl/docs/CURL-DISABLE.md new file mode 100644 index 00000000..a2e75f19 --- /dev/null +++ b/curl/docs/CURL-DISABLE.md @@ -0,0 +1,136 @@ +# Code defines to disable features and protocols + +## CURL_DISABLE_ALTSVC + +Disable support for Alt-Svc: HTTP headers. + +## CURL_DISABLE_COOKIES + +Disable support for HTTP cookies. + +## CURL_DISABLE_CRYPTO_AUTH + +Disable support for authentication methods using crypto. + +## CURL_DISABLE_DICT + +Disable the DICT protocol + +## CURL_DISABLE_DOH + +Disable DNS-over-HTTPS + +## CURL_DISABLE_FILE + +Disable the FILE protocol + +## CURL_DISABLE_FTP + +Disable the FTP (and FTPS) protocol + +## CURL_DISABLE_GETOPTIONS + +Disable the `curl_easy_options` API calls that lets users get information +about existing options to `curl_easy_setopt`. + +## CURL_DISABLE_GOPHER + +Disable the GOPHER protocol. + +## CURL_DISABLE_HSTS + +Disable the HTTP Strict Transport Security support. + +## CURL_DISABLE_HTTP + +Disable the HTTP(S) protocols. Note that this then also disable HTTP proxy +support. + +## CURL_DISABLE_HTTP_AUTH + +Disable support for all HTTP authentication methods. + +## CURL_DISABLE_IMAP + +Disable the IMAP(S) protocols. + +## CURL_DISABLE_LDAP + +Disable the LDAP(S) protocols. + +## CURL_DISABLE_LDAPS + +Disable the LDAPS protocol. + +## CURL_DISABLE_LIBCURL_OPTION + +Disable the --libcurl option from the curl tool. + +## CURL_DISABLE_MIME + +Disable MIME support. + +## CURL_DISABLE_MQTT + +Disable MQTT support. + +## CURL_DISABLE_NETRC + +Disable the netrc parser. + +## CURL_DISABLE_NTLM + +Disable support for NTLM. + +## CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG + +Disable the auto load config support in the OpenSSL backend. + +## CURL_DISABLE_PARSEDATE + +Disable date parsing + +## CURL_DISABLE_POP3 + +Disable the POP3 protocol + +## CURL_DISABLE_PROGRESS_METER + +Disable the built-in progress meter + +## CURL_DISABLE_PROXY + +Disable support for proxies + +## CURL_DISABLE_RTSP + +Disable the RTSP protocol. + +## CURL_DISABLE_SHUFFLE_DNS + +Disable the shuffle DNS feature + +## CURL_DISABLE_SMB + +Disable the SMB(S) protocols + +## CURL_DISABLE_SMTP + +Disable the SMTP(S) protocols + +## CURL_DISABLE_SOCKETPAIR + +Disable the use of socketpair internally to allow waking up and canceling +curl_multi_poll(). + +## CURL_DISABLE_TELNET + +Disable the TELNET protocol + +## CURL_DISABLE_TFTP + +Disable the TFTP protocol + +## CURL_DISABLE_VERBOSE_STRINGS + +Disable verbose strings and error messages. diff --git a/curl/docs/DEPRECATE.md b/curl/docs/DEPRECATE.md new file mode 100644 index 00000000..464974d1 --- /dev/null +++ b/curl/docs/DEPRECATE.md @@ -0,0 +1,13 @@ +# Items to be removed from future curl releases + +If any of these deprecated features is a cause for concern for you, please +email the +[curl-library mailing list](https://lists.haxx.se/listinfo/curl-library) +as soon as possible and explain to us why this is a problem for you and +how your use case can't be satisfied properly using a workaround. + +## Past removals + + - Pipelining + - axTLS + - PolarSSL diff --git a/curl/docs/DYNBUF.md b/curl/docs/DYNBUF.md new file mode 100644 index 00000000..a30a058b --- /dev/null +++ b/curl/docs/DYNBUF.md @@ -0,0 +1,108 @@ +# dynbuf + +This is the internal module for creating and handling "dynamic buffers". This +means buffers that can be appended to, dynamically and grow in size to adapt. + +There will always be a terminating zero put at the end of the dynamic buffer. + +The `struct dynbuf` is used to hold data for each instance of a dynamic +buffer. The members of that struct **MUST NOT** be accessed or modified +without using the dedicated dynbuf API. + +## init + +```c +void Curl_dyn_init(struct dynbuf *s, size_t toobig); +``` + +This inits a struct to use for dynbuf and it can't fail. The `toobig` value +**must** be set to the maximum size we allow this buffer instance to grow to. +The functions below will return `CURLE_OUT_OF_MEMORY` when hitting this limit. + +## free + +```c +void Curl_dyn_free(struct dynbuf *s); +``` + +Free the associated memory and clean up. After a free, the `dynbuf` struct can +be re-used to start appending new data to. + +## addn + +```c +CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len); +``` + +Append arbitrary data of a given length to the end of the buffer. + +## add + +```c +CURLcode Curl_dyn_add(struct dynbuf *s, const char *str); +``` + +Append a C string to the end of the buffer. + +## addf + +```c +CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...); +``` + +Append a `printf()`-style string to the end of the buffer. + +## vaddf + +```c +CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap); +``` + +Append a `vprintf()`-style string to the end of the buffer. + +## reset + +```c +void Curl_dyn_reset(struct dynbuf *s); +``` + +Reset the buffer length, but leave the allocation. + +## tail + +```c +CURLcode Curl_dyn_tail(struct dynbuf *s, size_t length); +``` + +Keep `length` bytes of the buffer tail (the last `length` bytes of the +buffer). The rest of the buffer is dropped. The specified `length` must not be +larger than the buffer length. + +## ptr + +```c +char *Curl_dyn_ptr(const struct dynbuf *s); +``` + +Returns a `char *` to the buffer if it has a length, otherwise a NULL. Since +the buffer may be reallocated, this pointer should not be trusted or used +anymore after the next buffer manipulation call. + +## uptr + +```c +unsigned char *Curl_dyn_uptr(const struct dynbuf *s); +``` + +Returns an `unsigned char *` to the buffer if it has a length, otherwise a +NULL. Since the buffer may be reallocated, this pointer should not be trusted +or used anymore after the next buffer manipulation call. + +## len + +```c +size_t Curl_dyn_len(const struct dynbuf *s); +``` + +Returns the length of the buffer in bytes. Does not include the terminating +zero byte. diff --git a/curl/docs/ECH.md b/curl/docs/ECH.md new file mode 100644 index 00000000..a09140e6 --- /dev/null +++ b/curl/docs/ECH.md @@ -0,0 +1,135 @@ +# TLS: ECH support in curl and libcurl + +## Summary + +**ECH** means **Encrypted Client Hello**, a TLS 1.3 extension which is +currently the subject of an [IETF Draft][tlsesni]. (ECH was formerly known as +ESNI). + +This file is intended to show the latest current state of ECH support +in **curl** and **libcurl**. + +At end of August 2019, an [experimental fork of curl][niallorcurl], built +using an [experimental fork of OpenSSL][sftcdopenssl], which in turn provided +an implementation of ECH, was demonstrated interoperating with a server +belonging to the [DEfO Project][defoproj]. + +Further sections here describe + +- resources needed for building and demonstrating **curl** support + for ECH, + +- progress to date, + +- TODO items, and + +- additional details of specific stages of the progress. + +## Resources needed + +To build and demonstrate ECH support in **curl** and/or **libcurl**, +you will need + +- a TLS library, supported by **libcurl**, which implements ECH; + +- an edition of **curl** and/or **libcurl** which supports the ECH + implementation of the chosen TLS library; + +- an environment for building and running **curl**, and at least + building **OpenSSL**; + +- a server, supporting ECH, against which to run a demonstration + and perhaps a specific target URL; + +- some instructions. + +The following set of resources is currently known to be available. + +| Set | Component | Location | Remarks | +|:-----|:-------------|:------------------------------|:-------------------------------------------| +| DEfO | TLS library | [sftcd/openssl][sftcdopenssl] | Tag *esni-2019-08-30* avoids bleeding edge | +| | curl fork | [niallor/curl][niallorcurl] | Tag *esni-2019-08-30* likewise | +| | instructions | [ESNI-README][niallorreadme] | | + +## Progress + +### PR 4011 (Jun 2019) expected in curl release 7.67.0 (Oct 2019) + +- Details [below](#pr-4011); + +- New configuration option: `--enable-ech`; + +- Build-time check for availability of resources needed for ECH + support; + +- Pre-processor symbol `USE_ECH` for conditional compilation of + ECH support code, subject to configuration option and + availability of needed resources. + +## TODO + +- (next PR) Add libcurl options to set ECH parameters. + +- (next PR) Add curl tool command line options to set ECH parameters. + +- (WIP) Extend DoH functions so that published ECH parameters can be + retrieved from DNS instead of being required as options. + +- (WIP) Work with OpenSSL community to finalize ECH API. + +- Track OpenSSL ECH API in libcurl + +- Identify and implement any changes needed for CMake. + +- Optimize build-time checking of available resources. + +- Encourage ECH support work on other TLS/SSL backends. + +## Additional detail + +### PR 4011 + +**TLS: Provide ECH support framework for curl and libcurl** + +The proposed change provides a framework to facilitate work to implement ECH +support in curl and libcurl. It is not intended either to provide ECH +functionality or to favour any particular TLS-providing backend. Specifically, +the change reserves a feature bit for ECH support (symbol +`CURL_VERSION_ECH`), implements setting and reporting of this bit, includes +dummy book-keeping for the symbol, adds a build-time configuration option +(`--enable-ech`), provides an extensible check for resources available to +provide ECH support, and defines a compiler pre-processor symbol (`USE_ECH`) +accordingly. + +Proposed-by: @niallor (Niall O'Reilly)\ +Encouraged-by: @sftcd (Stephen Farrell)\ +See-also: [this message](https://curl.se/mail/lib-2019-05/0108.html) + +Limitations: +- Book-keeping (symbols-in-versions) needs real release number, not 'DUMMY'. + +- Framework is incomplete, as it covers autoconf, but not CMake. + +- Check for available resources, although extensible, refers only to + specific work in progress ([described + here](https://github.com/sftcd/openssl/tree/master/esnistuff)) to + implement ECH for OpenSSL, as this is the immediate motivation + for the proposed change. + +## References + +Cloudflare blog: [Encrypting SNI: Fixing One of the Core Internet Bugs][corebug] + +Cloudflare blog: [Encrypt it or lose it: how encrypted SNI works][esniworks] + +IETF Draft: [Encrypted Server Name Indication for TLS 1.3][tlsesni] + +--- + +[tlsesni]: https://datatracker.ietf.org/doc/draft-ietf-tls-esni/ +[esniworks]: https://blog.cloudflare.com/encrypted-sni/ +[corebug]: https://blog.cloudflare.com/esni/ +[defoproj]: https://defo.ie/ +[sftcdopenssl]: https://github.com/sftcd/openssl/ +[niallorcurl]: https://github.com/niallor/curl/ +[niallorreadme]: https://github.com/niallor/curl/blob/master/ESNI-README.md diff --git a/curl/docs/EXPERIMENTAL.md b/curl/docs/EXPERIMENTAL.md new file mode 100644 index 00000000..ce9a1b8e --- /dev/null +++ b/curl/docs/EXPERIMENTAL.md @@ -0,0 +1,23 @@ +# Experimental + +Some features and functionality in curl and libcurl are considered +**EXPERIMENTAL**. + +Experimental support in curl means: + +1. Experimental features are provided to allow users to try them out and + provide feedback on functionality and API etc before they ship and get + "carved in stone". +2. You must enable the feature when invoking configure as otherwise curl will + not be built with the feature present. +3. We strongly advice against using this feature in production. +4. **We reserve the right to change behavior** of the feature without sticking + to our API/ABI rules as we do for regular features, as long as it is marked + experimental. +5. Experimental features are clearly marked so in documentation. Beware. + +## Experimental features right now + + - The Hyper HTTP backend + - HTTP/3 support and options + - CURLSSLOPT_NATIVE_CA (No configure option, feature built in when supported) diff --git a/curl/docs/FAQ b/curl/docs/FAQ index 7ed5fa0c..2a969510 100644 --- a/curl/docs/FAQ +++ b/curl/docs/FAQ @@ -24,11 +24,8 @@ FAQ 1.15 How do I port libcurl to my OS? 2. Install Related Problems - 2.1 configure doesn't find OpenSSL even when it is installed - 2.1.1 native linker doesn't find OpenSSL - 2.1.2 only the libssl lib is missing + 2.1 configure fails when using static libraries 2.2 Does curl work/build with other SSL libraries? - 2.3 Where can I find a copy of LIBEAY32.DLL? 2.4 Does curl support SOCKS (RFC 1928) ? 3. Usage Problems @@ -43,8 +40,8 @@ FAQ 3.9 How do I use curl in my favorite programming language? 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP? 3.11 How do I POST with a different Content-Type? - 3.12 Why do FTP specific features over HTTP proxy fail? - 3.13 Why does my single/double quotes fail? + 3.12 Why do FTP-specific features over HTTP proxy fail? + 3.13 Why do my single/double quotes fail? 3.14 Does curl support Javascript or PAC (automated proxy config)? 3.15 Can I do recursive fetches with curl? 3.16 What certificates do I need when I use SSL? @@ -56,7 +53,6 @@ FAQ 3.22 curl -X gives me HTTP problems 4. Running Problems - 4.1 Problems connecting to SSL servers. 4.2 Why do I get problems when I use & or % in the URL? 4.3 How can I use {, }, [ or ] to specify multiple URLs? 4.4 Why do I get downloaded data even though the web page doesn't exist? @@ -68,11 +64,11 @@ FAQ 4.5.5 "405 Method Not Allowed" 4.5.6 "301 Moved Permanently" 4.6 Can you tell me what error code 142 means? - 4.7 How do I keep user names and passwords secret in Curl command lines? + 4.7 How do I keep user names and passwords secret in curl command lines? 4.8 I found a bug! - 4.9 Curl can't authenticate to the server that requires NTLM? + 4.9 curl can't authenticate to the server that requires NTLM? 4.10 My HTTP request using HEAD, PUT or DELETE doesn't work! - 4.11 Why does my HTTP range requests return the full document? + 4.11 Why do my HTTP range requests return the full document? 4.12 Why do I get "certificate verify failed" ? 4.13 Why is curl -R on Windows one hour off? 4.14 Redirects work in browser but not with curl! @@ -82,13 +78,12 @@ FAQ 4.18 file:// URLs containing drive letters (Windows, NetWare) 4.19 Why doesn't curl return an error when the network cable is unplugged? 4.20 curl doesn't return error for HTTP non-200 responses! - 4.21 Why is there a HTTP/1.1 in my HTTP/2 request? 5. libcurl Issues 5.1 Is libcurl thread-safe? 5.2 How can I receive all data into a large memory chunk? 5.3 How do I fetch multiple files with libcurl? - 5.4 Does libcurl do Winsock initing on win32 systems? + 5.4 Does libcurl do Winsock initialization on win32 systems? 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ? 5.6 What about Keep-Alive or persistent connections? 5.7 Link errors when building libcurl on Windows! @@ -119,6 +114,10 @@ FAQ 7.3 Can I perform multiple requests using the same handle? 7.4 Does PHP/CURL have dependencies? + 8. Development + 8.1 Why does curl use C89? + 8.2 Will curl be rewritten? + ============================================================================== 1. Philosophy @@ -129,15 +128,16 @@ FAQ originally with URL spelled in uppercase to make it obvious it deals with URLs. The fact it can also be pronounced 'see URL' also helped, it works as an abbreviation for "Client URL Request Library" or why not the recursive - version: "Curl URL Request Library". + version: "curl URL Request Library". The cURL project produces two products: libcurl A free and easy-to-use client-side URL transfer library, supporting DICT, - FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, - POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. + FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, + MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, + TELNET and TFTP. libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, Kerberos, SPNEGO, HTTP form based upload, proxies, cookies, user+password @@ -154,7 +154,7 @@ FAQ curl - A command line tool for getting or sending files using URL syntax. + A command line tool for getting or sending data using URL syntax. Since curl uses libcurl, curl supports the same wide range of common Internet protocols that libcurl does. @@ -184,22 +184,22 @@ FAQ 1.3 What is curl not? - Curl is not a wget clone. That is a common misconception. Never, during + curl is not a wget clone. That is a common misconception. Never, during curl's development, have we intended curl to replace wget or compete on its - market. Curl is targeted at single-shot file transfers. + market. curl is targeted at single-shot file transfers. - Curl is not a web site mirroring program. If you want to use curl to mirror - something: fine, go ahead and write a script that wraps around curl to make - it reality (like curlmirror.pl does). + curl is not a website mirroring program. If you want to use curl to mirror + something: fine, go ahead and write a script that wraps around curl or use + libcurl to make it reality. - Curl is not an FTP site mirroring program. Sure, get and send FTP with curl + curl is not an FTP site mirroring program. Sure, get and send FTP with curl but if you want systematic and sequential behavior you should write a script (or write a new program that interfaces libcurl) and do it. - Curl is not a PHP tool, even though it works perfectly well when used from + curl is not a PHP tool, even though it works perfectly well when used from or with PHP (when using the PHP/CURL module). - Curl is not a program for a single operating system. Curl exists, compiles, + curl is not a program for a single operating system. curl exists, compiles, builds and runs under a wide range of operating systems, including all modern Unixes (and a bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc. @@ -210,17 +210,17 @@ FAQ better. We do however believe in a few rules when it comes to the future of curl: - Curl -- the command line tool -- is to remain a non-graphical command line + curl -- the command line tool -- is to remain a non-graphical command line tool. If you want GUIs or fancy scripting capabilities, you should look for another tool that uses libcurl. We do not add things to curl that other small and available tools already do - very well at the side. Curl's output can be piped into another program or + very well at the side. curl's output can be piped into another program or redirected to another file for the next program to interpret. - We focus on protocol related issues and improvements. If you wanna do more + We focus on protocol related issues and improvements. If you want to do more magic with the supported protocols than curl currently does, chances are good - we will agree. If you wanna add more protocols, we may very well agree. + we will agree. If you want to add more protocols, we may very well agree. If you want someone else to do all the work while you wait for us to implement it for you, that is not a very friendly attitude. We spend a @@ -246,22 +246,22 @@ FAQ 1.6 What do you get for making curl? - Project cURL is entirely free and open. No person gets paid for developing - curl full time. We do this voluntarily, mostly in our spare time. - Occasionally companies pay individual developers to work on curl, but that's - up to each company and developer. This is not controlled by nor supervised in - any way by the project. + Project cURL is entirely free and open. We do this voluntarily, mostly in + our spare time. Companies may pay individual developers to work on curl, + but that's up to each company and developer. This is not controlled by nor + supervised in any way by the curl project. - We still get help from companies. Haxx provides web site, bandwidth, mailing - lists etc, sourceforge.net hosts project services we take advantage from, - like the bug tracker, and GitHub hosts the primary git repository at - https://github.com/curl/curl. Also again, some companies have sponsored - certain parts of the development in the past and I hope some will continue to - do so in the future. + We get help from companies. Haxx provides website, bandwidth, mailing lists + etc, GitHub hosts the primary git repository and other services like the bug + tracker at https://github.com/curl/curl. Also again, some companies have + sponsored certain parts of the development in the past and I hope some will + continue to do so in the future. If you want to support our project, consider a donation or a banner-program or even better: by helping us with coding, documenting or testing etc. + See also: https://curl.se/sponsors.html + 1.7 What about CURL from curl.com? During the summer of 2001, curl.com was busy advertising their client-side @@ -282,7 +282,7 @@ FAQ Please do not mail any single individual unless you really need to. Keep curl-related questions on a suitable mailing list. All available mailing lists are listed in the MANUAL document and online at - https://curl.haxx.se/mail/ + https://curl.se/mail/ Keeping curl-related questions and discussions on mailing lists allows others to join in and help, to share their ideas, to contribute their @@ -292,18 +292,22 @@ FAQ from having to repeat ourselves even more. Thanks for respecting this. If you have found or simply suspect a security problem in curl or libcurl, - mail curl-security at haxx.se (closed list of receivers, mails are not - disclosed) and tell. Then we can produce a fix in a timely manner before the - flaw is announced to the world, thus lessen the impact the problem will have - on existing users. + submit all the details at https://hackerone.one/curl. On there we keep the + issue private while we investigate, confirm it, work and validate a fix and + agree on a time schedule for publication etc. That way we produce a fix in a + timely manner before the flaw is announced to the world, reducing the impact + the problem risk having on existing users. + + Security issues can also be taking to the curl security team by emailing + security at curl.se (closed list of receivers, mails are not disclosed). 1.9 Where do I buy commercial support for curl? curl is fully open source. It means you can hire any skilled engineer to fix your curl-related problems. - We list available alternatives on the curl web site: - https://curl.haxx.se/support.html + We list available alternatives on the curl website: + https://curl.se/support.html 1.10 How many are using curl? @@ -317,21 +321,14 @@ FAQ We don't know how many users that downloaded or installed curl and then never use it. - In May 2012 Daniel did a counting game and came up with a number that may - be completely wrong or somewhat accurate. Over 500 million! - - See https://daniel.haxx.se/blog/2012/05/16/300m-users/ + In 2020, we estimate that curl runs in roughly ten billion installations + world wide. 1.11 Why don't you update ca-bundle.crt - The ca cert bundle that used to be shipped with curl was very outdated and - must be replaced with an up-to-date version by anyone who wants to verify - peers. It is no longer provided by curl. The last curl release that ever - shipped a ca cert bundle was curl 7.18.0. - In the cURL project we've decided not to attempt to keep this file updated - (or even present anymore) since deciding what to add to a ca cert bundle is - an undertaking we've not been ready to accept, and the one we can get from + (or even present) since deciding what to add to a ca cert bundle is an + undertaking we've not been ready to accept, and the one we can get from Mozilla is perfectly fine so there's no need to duplicate that work. Today, with many services performed over HTTPS, every operating system @@ -342,13 +339,13 @@ FAQ If you want the most recent collection of ca certs that Mozilla Firefox uses, we recommend that you extract the collection yourself from Mozilla Firefox (by running 'make ca-bundle), or by using our online service setup - for this purpose: https://curl.haxx.se/docs/caextract.html + for this purpose: https://curl.se/docs/caextract.html 1.12 I have a problem who can I chat with? There's a bunch of friendly people hanging out in the #curl channel on the - IRC network irc.freenode.net. If you're polite and nice, chances are good - that you can get -- or provide -- help instantly. + IRC network libera.chat. If you're polite and nice, chances are good that + you can get -- or provide -- help instantly. 1.13 curl's ECCN number? @@ -370,22 +367,20 @@ FAQ https://www.bis.doc.gov/licensing/do_i_needaneccn.html An incomprehensible description of the two numbers above is here - http://www.access.gpo.gov/bis/ear/pdf/ccl5-pt2.pdf + https://www.bis.doc.gov/index.php/documents/new-encryption/1653-ccl5-pt2-3 1.14 How do I submit my patch? - When you have made a patch or a change of whatever sort, and want to submit - that to the project, there are a few different ways we prefer: + We strongly encourage you to submit changes and improvements directly as + "pull requests" on github: https://github.com/curl/curl/pulls - o send a patch to the curl-library mailing list. We're many subscribers - there and there are lots of people who can review patches, comment on them - and "receive" them properly. + If you for any reason can't or won't deal with github, send your patch to + the curl-library mailing list. We're many subscribers there and there are + lots of people who can review patches, comment on them and "receive" them + properly. - o if your patch changes or fixes a bug, you can also opt to submit a bug - report in the bug tracker and attach your patch there. There are less - people involved there. - - Lots of more details are found in the CONTRIBUTE and INTERNALS docs. + Lots of more details are found in the CONTRIBUTE.md and INTERNALS.md + documents. 1.15 How do I port libcurl to my OS? @@ -403,69 +398,40 @@ FAQ 2. Install Related Problems - 2.1 configure doesn't find OpenSSL even when it is installed - - This may be because of several reasons. - - 2.1.1 native linker doesn't find openssl - - Affected platforms: - Solaris (native cc compiler) - HPUX (native cc compiler) - SGI IRIX (native cc compiler) - SCO UNIX (native cc compiler) - - When configuring curl, I specify --with-ssl. OpenSSL is installed in - /usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find - CRYPTO_lock in -lcrypto + 2.1 configure fails when using static libraries - Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER - -lcrypto, so ld can't find the library. This is due to a bug in the GNU - autoconf tool. + You may find that configure fails to properly detect the entire dependency + chain of libraries when you provide static versions of the libraries that + configure checks for. - Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of - ./configure places the -L/usr/local/ssl/lib early enough in the command - line to make things work + The reason why static libraries is much harder to deal with is that for them + we don't get any help but the script itself must know or check what more + libraries that are needed (with shared libraries, that dependency "chain" is + handled automatically). This is a very error-prone process and one that also + tends to vary over time depending on the release versions of the involved + components and may also differ between operating systems. - 2.1.2 only the libssl lib is missing + For that reason, configure does very little attempts to actually figure this + out and you are instead encouraged to set LIBS and LDFLAGS accordingly when + you invoke configure, and point out the needed libraries and set the + necessary flags yourself. - If all include files and the libcrypto lib is present, with only the - libssl being missing according to configure, this is most likely because - a few functions are left out from the libssl. + 2.2 Does curl work with other SSL libraries? - If the function names missing include RSA or RSAREF you can be certain - that this is because libssl requires the RSA and RSAREF libs to build. - - See the INSTALL file section that explains how to add those libs to - configure. Make sure that you remove the config.cache file before you - rerun configure with the new flags. - - 2.2 Does curl work/build with other SSL libraries? - - Curl has been written to use a generic SSL function layer internally, and + curl has been written to use a generic SSL function layer internally, and that SSL functionality can then be provided by one out of many different SSL backends. curl can be built to use one of the following SSL alternatives: OpenSSL, - GnuTLS, yassl, NSS, PolarSSL, axTLS, Secure Transport (native iOS/OS X), - WinSSL (native Windows) or GSKit (native IBM i). They all have their pros - and cons, and we try to maintain a comparison of them here: - https://curl.haxx.se/docs/ssl-compared.html - - 2.3 Where can I find a copy of LIBEAY32.DLL? - - That is an OpenSSL binary built for Windows. - - Curl can be built with OpenSSL to do the SSL stuff. The LIBEAY32.DLL is then - what curl needs on a windows machine to do https:// etc. Check out the curl - web site to find accurate and up-to-date pointers to recent OpenSSL DLLs and - other binary packages. + libressl, BoringSSL, GnuTLS, wolfSSL, NSS, mbedTLS, MesaLink, Secure + Transport (native iOS/OS X), Schannel (native Windows), GSKit (native IBM + i), BearSSL, or Rustls. They all have their pros and cons, and we try to + maintain a comparison of them here: https://curl.se/docs/ssl-compared.html 2.4 Does curl support SOCKS (RFC 1928) ? Yes, SOCKS 4 and 5 are supported. - 3. Usage problems 3.1 curl: (1) SSL is disabled, https: not supported @@ -484,23 +450,23 @@ FAQ and logs and check out why the configure script doesn't find the SSL libs and/or include files. - Also, check out the other paragraph in this FAQ labelled "configure doesn't + Also, check out the other paragraph in this FAQ labeled "configure doesn't find OpenSSL even when it is installed". 3.2 How do I tell curl to resume a transfer? - Curl supports resumed transfers both ways on both FTP and HTTP. + curl supports resumed transfers both ways on both FTP and HTTP. Try the -C option. 3.3 Why doesn't my posting using -F work? - You can't arbitrarily use -F or -d, the choice between -F or -d depends on the - HTTP operation you need curl to do and what the web server that will receive - your post expects. + You can't arbitrarily use -F or -d, the choice between -F or -d depends on + the HTTP operation you need curl to do and what the web server that will + receive your post expects. - If the form you're trying to submit uses the type 'multipart/form-data', then - and only then you must use the -F type. In all the most common cases, you - should use -d which then causes a posting with the type + If the form you're trying to submit uses the type 'multipart/form-data', + then and only then you must use the -F type. In all the most common cases, + you should use -d which then causes a posting with the type 'application/x-www-form-urlencoded'. This is described in some detail in the MANUAL and TheArtOfHttpScripting @@ -548,7 +514,7 @@ FAQ 3.8 How do I tell curl to follow HTTP redirects? - Curl does not follow so-called redirects by default. The Location: header + curl does not follow so-called redirects by default. The Location: header that informs the client about this is only interpreted if you're using the -L/--location option. As in: @@ -558,14 +524,13 @@ FAQ 3.9 How do I use curl in my favorite programming language? - There exist many language interfaces/bindings for curl that integrates it - better with various languages. If you are fluid in a script language, you - may very well opt to use such an interface instead of using the command line - tool. + Many programming languages have interfaces/bindings that allow you to use + curl without having to use the command line tool. If you are fluent in such + a language, you may prefer to use one of these interfaces instead. Find out more about which languages that support curl directly, and how to - install and use them, in the libcurl section of the curl web site: - https://curl.haxx.se/libcurl/ + install and use them, in the libcurl section of the curl website: + https://curl.se/libcurl/ All the various bindings to libcurl are made by other projects and people, outside of the cURL project. The cURL project itself only produces libcurl @@ -573,17 +538,18 @@ FAQ about bindings on the curl-library list too, but be prepared that people on that list may not know anything about bindings. - In October 2009, there were interfaces available for the following - languages: Ada95, Basic, C, C++, Ch, Cocoa, D, Dylan, Eiffel, Euphoria, - Ferite, Gambas, glib/GTK+, Haskell, ILE/RPG, Java, Lisp, Lua, Mono, .NET, - Object-Pascal, OCaml, Pascal, Perl, PHP, PostgreSQL, Python, R, Rexx, Ruby, - Scheme, S-Lang, Smalltalk, SP-Forth, SPL, Tcl, Visual Basic, Visual FoxPro, - Q, wxwidgets and XBLite. By the time you read this, additional ones may have - appeared! + In February 2019, there were interfaces available for the following + languages: Ada95, Basic, C, C++, Ch, Cocoa, D, Delphi, Dylan, Eiffel, + Euphoria, Falcon, Ferite, Gambas, glib/GTK+, Go, Guile, Harbour, Haskell, + Java, Julia, Lisp, Lua, Mono, .NET, node.js, Object-Pascal, OCaml, Pascal, + Perl, PHP, PostgreSQL, Python, R, Rexx, Ring, RPG, Ruby, Rust, Scheme, + Scilab, S-Lang, Smalltalk, SP-Forth, SPL, Tcl, Visual Basic, Visual FoxPro, + Q, wxwidgets, XBLite and Xoho. By the time you read this, additional ones + may have appeared! 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP? - Curl adheres to the HTTP spec, which basically means you can play with *any* + curl adheres to the HTTP spec, which basically means you can play with *any* protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and XML-RPC are all such ones. You can use -X to set custom requests and -H to set custom headers (or replace internally generated ones). @@ -598,11 +564,11 @@ FAQ curl -d "datatopost" -H "Content-Type: text/xml" [URL] - 3.12 Why do FTP specific features over HTTP proxy fail? + 3.12 Why do FTP-specific features over HTTP proxy fail? Because when you use a HTTP proxy, the protocol spoken on the network will be HTTP, even if you specify a FTP URL. This effectively means that you - normally can't use FTP specific features such as FTP upload and FTP quote + normally can't use FTP-specific features such as FTP upload and FTP quote etc. There is one exception to this rule, and that is if you can "tunnel through" @@ -610,7 +576,7 @@ FAQ and is generally not available as proxy admins usually disable tunneling to ports other than 443 (which is used for HTTPS access through proxies). - 3.13 Why does my single/double quotes fail? + 3.13 Why do my single/double quotes fail? To specify a command line option that includes spaces, you might need to put the entire option within quotes. Like in: @@ -635,7 +601,7 @@ FAQ 3.14 Does curl support Javascript or PAC (automated proxy config)? - Many web pages do magic stuff using embedded Javascript. Curl and libcurl + Many web pages do magic stuff using embedded Javascript. curl and libcurl have no built-in support for that, so it will be treated just like any other contents. @@ -698,7 +664,7 @@ FAQ certificate. Server certificate verification is enabled by default in curl and libcurl and is often the reason for problems as explained in FAQ entry 4.12 and the SSLCERTS document - (https://curl.haxx.se/docs/sslcerts.html). Server certificates that are + (https://curl.se/docs/sslcerts.html). Server certificates that are "self-signed" or otherwise signed by a CA that you do not have a CA cert for, cannot be verified. If the verification during a connect fails, you are refused access. You then need to explicitly disable the verification to @@ -724,7 +690,7 @@ FAQ 3.19 How do I get HTTP from a host using a specific IP address? - For example, you may be trying out a web site installation that isn't yet in + For example, you may be trying out a website installation that isn't yet in the DNS. Or you have a site using multiple IP addresses for a given host name and you want to address a specific one out of the set. @@ -746,7 +712,7 @@ FAQ directory, you get the actual root directory. To specify a file in your user's home directory, you need to use the correct - URL syntax which for sftp might look similar to: + URL syntax which for SFTP might look similar to: curl -O -u user:password sftp://example.com/~/file.txt @@ -799,21 +765,6 @@ FAQ 4. Running Problems - 4.1 Problems connecting to SSL servers. - - It took a very long time before we could sort out why curl had problems to - connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The - error sometimes showed up similar to: - - 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233: - - It turned out to be because many older SSL servers don't deal with SSLv3 - requests properly. To correct this problem, tell curl to select SSLv2 from - the command line (-2/--sslv2). - - There have also been examples where the remote server didn't like the SSLv2 - request and instead you had to force curl to use SSLv3 with -3/--sslv3. - 4.2 Why do I get problems when I use & or % in the URL? In general unix shells, the & symbol is treated specially and when used, it @@ -850,7 +801,7 @@ FAQ 4.4 Why do I get downloaded data even though the web page doesn't exist? - Curl asks remote servers for the page you specify. If the page doesn't exist + curl asks remote servers for the page you specify. If the page doesn't exist at the server, the HTTP protocol defines how the server should respond and that means that headers and a "page" will be returned. That's simply how HTTP works. @@ -874,7 +825,7 @@ FAQ 4.5.3 "403 Forbidden" - The server understood the request, but is refusing to fulfil it. + The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. 4.5.4 "404 Not Found" @@ -895,7 +846,7 @@ FAQ

Moved Permanently

The document has moved
here. - it might be because you request a directory URL but without the trailing + it might be because you requested a directory URL but without the trailing slash. Try the same operation again _with_ the trailing URL, or use the -L/--location option to follow the redirection. @@ -909,7 +860,7 @@ FAQ appreciate a detailed bug report from you that describes how we could go ahead and repeat this! - 4.7 How do I keep user names and passwords secret in Curl command lines? + 4.7 How do I keep user names and passwords secret in curl command lines? This problem has two sides: @@ -926,8 +877,8 @@ FAQ anyone would call security. Also note that regular HTTP (using Basic authentication) and FTP passwords - are sent in clear across the network. All it takes for anyone to fetch them - is to listen on the network. Eavesdropping is very easy. Use more secure + are sent as cleartext across the network. All it takes for anyone to fetch + them is to listen on the network. Eavesdropping is very easy. Use more secure authentication methods (like Digest, Negotiate or even NTLM) or consider the SSL-based alternatives HTTPS and FTPS. @@ -943,7 +894,7 @@ FAQ If there is a bug, read the BUGS document first. Then report it as described in there. - 4.9 Curl can't authenticate to the server that requires NTLM? + 4.9 curl can't authenticate to the server that requires NTLM? NTLM support requires OpenSSL, GnuTLS, mbedTLS, NSS, Secure Transport, or Microsoft Windows libraries at build-time to provide this functionality. @@ -962,34 +913,39 @@ FAQ software you're trying to interact with. This is not anything curl can do anything about. - 4.11 Why does my HTTP range requests return the full document? + 4.11 Why do my HTTP range requests return the full document? Because the range may not be supported by the server, or the server may choose to ignore it and return the full document anyway. 4.12 Why do I get "certificate verify failed" ? - You invoke curl 7.10 or later to communicate on a https:// URL and get an - error back looking something similar to this: - - curl: (35) SSL: error:14090086:SSL routines: - SSL3_GET_SERVER_CERTIFICATE:certificate verify failed - - Then it means that curl couldn't verify that the server's certificate was - good. Curl verifies the certificate using the CA cert bundle that comes with - the curl installation. - - To disable the verification (which makes it act like curl did before 7.10), - use -k. This does however enable man-in-the-middle attacks. - - If you get this failure but are having a CA cert bundle installed and used, - the server's certificate is not signed by one of the CA's in the bundle. It - might for example be self-signed. You then correct this problem by obtaining - a valid CA cert for the server. Or again, decrease the security by disabling - this check. - - Details are also in the SSLCERTS file in the release archives, found online - here: https://curl.haxx.se/docs/sslcerts.html + When you invoke curl and get an error 60 error back it means that curl + couldn't verify that the server's certificate was good. curl verifies the + certificate using the CA cert bundle and verifying for which names the + certificate has been granted. + + To completely disable the certificate verification, use -k. This does + however enable man-in-the-middle attacks and makes the transfer INSECURE. + We strongly advice against doing this for more than experiments. + + If you get this failure with a CA cert bundle installed and used, the + server's certificate might not be signed by one of the CA's in yout CA + store. It might for example be self-signed. You then correct this problem by + obtaining a valid CA cert for the server. Or again, decrease the security by + disabling this check. + + At times, you find that the verification works in your favorite browser but + fails in curl. When this happens, the reason is usually that the server + sends an incomplete cert chain. The server is mandated to send all + "intermediate certificates" but doesn't. This typically works with browsers + anyway since they A) cache such certs and B) supports AIA which downloads + such missing certificates on demand. This is a server misconfiguration. A + good way to figure out if this is the case it to use the SSL Labs server + test and check the certificate chain: https://www.ssllabs.com/ssltest/ + + Details are also in the SSLCERTS.md document, found online here: + https://curl.se/docs/sslcerts.html 4.13 Why is curl -R on Windows one hour off? @@ -998,7 +954,7 @@ FAQ compilers or prior curl versions it may set a time that appears one hour off. This happens due to a flaw in how Windows stores and uses file modification times and it is not easily worked around. For more details read this: - http://www.codeproject.com/datetime/dstbugs.asp + https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting 4.14 Redirects work in browser but not with curl! @@ -1012,8 +968,8 @@ FAQ redirects the browser to another given URL. There is no way to make curl follow these redirects. You must either - manually figure out what the page is set to do, or you write a script that - parses the results and fetches the new URL. + manually figure out what the page is set to do, or write a script that parses + the results and fetches the new URL. 4.15 FTPS doesn't work @@ -1025,7 +981,7 @@ FAQ speak SSL. FTPS:// connections default to port 990. To use explicit FTPS, you use a FTP:// URL and the --ftp-ssl option (or one - of its related flavours). This is the most common method, and the one + of its related flavors). This is the most common method, and the one mandated by RFC4217. This kind of connection will then of course use the standard FTP port 21 by default. @@ -1116,7 +1072,7 @@ FAQ an embedded device with only a single network connection) may want to act immediately if its lone network connection goes down. That can be achieved by having the application monitor the network connection on its own using an - OS-specific mechanism, then signalling libcurl to abort (see also item 5.13). + OS-specific mechanism, then signaling libcurl to abort (see also item 5.13). 4.20 curl doesn't return error for HTTP non-200 responses! @@ -1142,17 +1098,6 @@ FAQ You can also use the -w option and the variable %{response_code} to extract the exact response code that was returned in the response. - 4.21 Why is there a HTTP/1.1 in my HTTP/2 request? - - If you use verbose to see the HTTP request when you send off a HTTP/2 - request, it will still say 1.1. - - The reason for this is that we first generate the request to send using the - old 1.1 style and show that request in the verbose output, and then we - convert it over to the binary header-compressed HTTP/2 style. The actual - "1.1" part from that request is then not actually used in the transfer. - The binary HTTP/2 headers are not human readable. - 5. libcurl Issues 5.1 Is libcurl thread-safe? @@ -1166,7 +1111,7 @@ FAQ There may be some exceptions to thread safety depending on how libcurl was built. Please review the guidelines for thread safety to learn more: - https://curl.haxx.se/libcurl/c/threadsafe.html + https://curl.se/libcurl/c/threadsafe.html 5.2 How can I receive all data into a large memory chunk? @@ -1228,7 +1173,7 @@ FAQ 5.6 What about Keep-Alive or persistent connections? curl and libcurl have excellent support for persistent connections when - transferring several files from the same server. Curl will attempt to reuse + transferring several files from the same server. curl will attempt to reuse connections for all URLs specified on the same command line/config file, and libcurl will reuse connections for all transfers that are made using the same libcurl handle. @@ -1447,7 +1392,7 @@ FAQ 6. License Issues - Curl and libcurl are released under a MIT/X derivate license. The license is + curl and libcurl are released under a MIT/X derivative license. The license is very liberal and should not impose a problem for your project. This section is just a brief summary for the cases we get the most questions. (Parts of this section was much enhanced by Bjorn Reese.) @@ -1462,7 +1407,7 @@ FAQ Yes! - Since libcurl may be distributed under the MIT/X derivate license, it can be + Since libcurl may be distributed under the MIT/X derivative license, it can be used together with GPL in any software. 6.2 I have a closed-source program, can I use the libcurl library? @@ -1487,7 +1432,7 @@ FAQ Yes! - The MIT/X derivate license practically allows you to do almost anything with + The MIT/X derivative license practically allows you to do almost anything with the sources, on the condition that the copyright texts in the sources are left intact. @@ -1521,7 +1466,7 @@ FAQ notice" somewhere. Most probably like in the documentation or in the section where other third party dependencies already are mentioned and acknowledged. - As can be seen here: https://curl.haxx.se/docs/companies.html and elsewhere, + As can be seen here: https://curl.se/docs/companies.html and elsewhere, more and more companies are discovering the power of libcurl and take advantage of it even in commercial environments. @@ -1557,3 +1502,40 @@ FAQ PHP/CURL is a module that comes with the regular PHP package. It depends on and uses libcurl, so you need to have libcurl installed properly before PHP/CURL can be used. + +8. Development + + 8.1 Why does curl use C89? + + As with everything in curl, there's a history and we keep using what we've + used before until someone brings up the subject and argues for and works on + changing it. + + We started out using C89 in the 1990s because that was the only way to write + a truly portable C program and have it run as widely as possible. C89 was for + a long time even necessary to make things work on otherwise considered modern + platforms such as Windows. Today, we don't really know how many users that + still require the use of a C89 compiler. + + We will continue to use C89 for as long as nobody brings up a strong enough + reason for us to change our minds. The core developers of the project don't + feel restricted by this and we are not convinced that going C99 will offer us + enough of a benefit to warrant the risk of cutting off a share of users. + + 8.2 Will curl be rewritten? + + In one go: no. Little by little over time? Maybe. + + Over the years, new languages and clever operating environments come and go. + Every now and then the urge apparently arises to request that we rewrite curl + in another language. + + Some the most important properties in curl are maintaining the API and ABI + for libcurl and keeping the behavior for the command line tool. As long as we + can do that, everything else is up for discussion. To maintain the ABI, we + probably have to maintain a certain amount of code in C, and to remain rock + stable, we will never risk anything by rewriting a lot of things in one go. + That said, we can certainly offer more and more optional backends written in + other languages, as long as those backends can be plugged in at build-time. + Back-ends can be written in any language, but should probably provide APIs + usable from C to ease integration and transition. diff --git a/curl/docs/FEATURES b/curl/docs/FEATURES.md similarity index 53% rename from curl/docs/FEATURES rename to curl/docs/FEATURES.md index 39ac3904..38e2ac3e 100644 --- a/curl/docs/FEATURES +++ b/curl/docs/FEATURES.md @@ -1,21 +1,17 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| +# Features -- what curl can do -FEATURES +## curl tool -curl tool - config file support - multiple URLs in a single command line - range "globbing" support: [0-13], {one,two,three} - multiple file upload on a single command line - custom maximum transfer rate - redirectable stderr - - metalink support (*13) + - parallel transfers + +## libcurl -libcurl - full URL syntax with no length limit - custom maximum download time - custom least download speed acceptable @@ -24,28 +20,31 @@ libcurl - uses .netrc - progress bar with time statistics while downloading - "standard" proxy environment variables support - - compiles on win32 (reported builds on 40+ operating systems) + - compiles on win32 (reported builds on 70+ operating systems) - selectable network interface for outgoing traffic - IPv6 support on unix and Windows + - happy eyeballs dual-stack connects - persistent connections - - socks 4 + 5 support, with or without local name resolving + - SOCKS 4 + 5 support, with or without local name resolving - supports user name and password in proxy environment variables - - operations through proxy "tunnel" (using CONNECT) - - support for large files (>2GB and >4GB) during upload and download + - operations through HTTP proxy "tunnel" (using CONNECT) - replaceable memory functions (malloc, free, realloc, etc) - - asynchronous name resolving (*6) + - asynchronous name resolving (6) - both a push and a pull style interface - - international domain names (*11) + - international domain names (11) + +## HTTP -HTTP - - HTTP/1.1 compliant (optionally uses 1.0) + - HTTP/0.9 responses are optionally accepted + - HTTP/1.0 + - HTTP/1.1 + - HTTP/2, including multiplexing and server push (5) - GET - PUT - HEAD - POST - - Pipelining - multipart formpost (RFC1867-style) - - authentication: Basic, Digest, NTLM (*9) and Negotiate (SPNEGO) (*3) + - authentication: Basic, Digest, NTLM (9) and Negotiate (SPNEGO) (3) to server and proxy - resume (both GET and PUT) - follow redirects @@ -59,25 +58,27 @@ HTTP - range - proxy authentication - time conditions - - via http-proxy + - via HTTP proxy, HTTPS proxy or SOCKS proxy - retrieve file modification date - Content-Encoding support for deflate and gzip - "Transfer-Encoding: chunked" support in uploads - - data compression (*12) - - HTTP/2 (*5) + - automatic data compression (12) + +## HTTPS (1) -HTTPS (*1) - (all the HTTP features) + - HTTP/3 experimental support - using client certificates - verify server certificate - - via http-proxy + - via HTTP proxy, HTTPS proxy or SOCKS proxy - select desired encryption - - force usage of a specific SSL version (SSLv2 (*7), SSLv3 (*10) or TLSv1) + - select usage of a specific SSL version + +## FTP -FTP - download - authentication - - Kerberos 5 (*14) + - Kerberos 5 (13) - active/passive using PORT, EPRT, PASV or EPSV - single file size information (compare to HTTP HEAD) - 'type=' URL support @@ -90,52 +91,62 @@ FTP - upload resume - custom ftp commands (before and/or after the transfer) - simple "range" support - - via http-proxy - - all operations can be tunneled through a http-proxy + - via HTTP proxy, HTTPS proxy or SOCKS proxy + - all operations can be tunneled through proxy - customizable to retrieve file modification date - no dir depth limit -FTPS (*1) - - implicit ftps:// support that use SSL on both connections - - explicit "AUTH TLS" and "AUTH SSL" usage to "upgrade" plain ftp:// +## FTPS (1) + + - implicit `ftps://` support that use SSL on both connections + - explicit "AUTH TLS" and "AUTH SSL" usage to "upgrade" plain `ftp://` connection to use SSL for both or one of the connections -SCP (*8) +## SCP (8) + - both password and public key auth -SFTP (*8) +## SFTP (7) + - both password and public key auth - with custom commands sent before/after the transfer -TFTP +## TFTP + - download - upload -TELNET +## TELNET + - connection negotiation - custom telnet options - stdin/stdout I/O -LDAP (*2) +## LDAP (2) + - full LDAP URL support -DICT +## DICT + - extended DICT URL support -FILE +## FILE + - URL support - upload - resume -SMB +## SMB + - SMBv1 over TCP and SSL - download - upload - authentication with NTLMv1 -SMTP - - authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (*9), Kerberos 5 - (*4) and External. +## SMTP + + - authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (9), Kerberos 5 + (4) and External. - send e-mails - mail from support - mail size support @@ -143,30 +154,34 @@ SMTP - multiple recipients - via http-proxy -SMTPS (*1) - - implicit smtps:// support - - explicit "STARTTLS" usage to "upgrade" plain smtp:// connections to use SSL +## SMTPS (1) + + - implicit `smtps://` support + - explicit "STARTTLS" usage to "upgrade" plain `smtp://` connections to use SSL - via http-proxy -POP3 +## POP3 + - authentication: Clear Text, APOP and SASL - - SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (*9), - Kerberos 5 (*4) and External. + - SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (9), + Kerberos 5 (4) and External. - list e-mails - retrieve e-mails - enhanced command support for: CAPA, DELE, TOP, STAT, UIDL and NOOP via custom requests - via http-proxy -POP3S (*1) - - implicit pop3s:// support - - explicit "STLS" usage to "upgrade" plain pop3:// connections to use SSL +## POP3S (1) + + - implicit `pop3s://` support + - explicit "STLS" usage to "upgrade" plain `pop3://` connections to use SSL - via http-proxy -IMAP +## IMAP + - authentication: Clear Text and SASL - - SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (*9), - Kerberos 5 (*4) and External. + - SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (9), + Kerberos 5 (4) and External. - list the folders of a mailbox - select a mailbox with support for verifying the UIDVALIDITY - fetch e-mails with support for specifying the UID and SECTION @@ -175,32 +190,31 @@ IMAP STORE, COPY and UID via custom requests - via http-proxy -IMAPS (*1) - - implicit imaps:// support - - explicit "STARTTLS" usage to "upgrade" plain imap:// connections to use SSL +## IMAPS (1) + + - implicit `imaps://` support + - explicit "STARTTLS" usage to "upgrade" plain `imap://` connections to use SSL - via http-proxy -FOOTNOTES -========= - - *1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL, WinSSL (native - Windows), Secure Transport (native iOS/OS X) or GSKit (native IBM i) - *2 = requires OpenLDAP or WinLDAP - *3 = requires a GSS-API implementation (such as Heimdal or MIT Kerberos) or - SSPI (native Windows) - *4 = requires a GSS-API implementation, however, only Windows SSPI is - currently supported - *5 = requires nghttp2 and possibly a recent TLS library - *6 = requires c-ares - *7 = requires OpenSSL, NSS, GSKit, WinSSL or Secure Transport; GnuTLS, for - example, only supports SSLv3 and TLSv1 - *8 = requires libssh2 - *9 = requires OpenSSL, GnuTLS, mbedTLS, NSS, yassl, Secure Transport or SSPI - (native Windows) - *10 = requires any of the SSL libraries in (*1) above other than axTLS, which - does not support SSLv3 - *11 = requires libidn or Windows - *12 = requires libz - *13 = requires libmetalink, and either an Apple or Microsoft operating - system, or OpenSSL, or GnuTLS, or NSS - *14 = requires a GSS-API implementation (such as Heimdal or MIT Kerberos) +## MQTT + + - Subscribe to and publish topics using url scheme `mqtt://broker/topic` + +## Footnotes + + 1. requires a TLS library + 2. requires OpenLDAP or WinLDAP + 3. requires a GSS-API implementation (such as Heimdal or MIT Kerberos) or + SSPI (native Windows) + 4. requires a GSS-API implementation, however, only Windows SSPI is + currently supported + 5. requires nghttp2 + 6. requires c-ares + 7. requires libssh2, libssh or wolfSSH + 8. requires libssh2 or libssh + 9. requires OpenSSL, GnuTLS, mbedTLS, NSS, yassl, Secure Transport or SSPI + (native Windows) + 10. - + 11. requires libidn2 or Windows + 12. requires libz, brotli and/or zstd + 13. requires a GSS-API implementation (such as Heimdal or MIT Kerberos) diff --git a/curl/docs/GOVERNANCE.md b/curl/docs/GOVERNANCE.md new file mode 100644 index 00000000..dfc2071d --- /dev/null +++ b/curl/docs/GOVERNANCE.md @@ -0,0 +1,182 @@ +# Decision making in the curl project + +A rough guide to how we make decisions and who does what. + +## BDFL + +This project was started by and has to some extent been pushed forward over +the years with Daniel Stenberg as the driving force. It matches a standard +BDFL (Benevolent Dictator For Life) style project. + +This setup has been used due to convenience and the fact that is has worked +fine this far. It is not because someone thinks of it as a superior project +leadership model. It will also only continue working as long as Daniel manages +to listen in to what the project and the general user population wants and +expects from us. + +## Legal entity + +There is no legal entity. The curl project is just a bunch of people scattered +around the globe with the common goal to produce source code that creates +great products. We are not part of any umbrella organization and we are not +located in any specific country. We are totally independent. + +The copyrights in the project are owned by the individuals and organizations +that wrote those parts of the code. + +## Decisions + +The curl project is not a democracy, but everyone is entitled to state their +opinion and may argue for their sake within the community. + +All and any changes that have been done or will be done are eligible to bring +up for discussion, to object to or to praise. Ideally, we find consensus for +the appropriate way forward in any given situation or challenge. + +If there is no obvious consensus, a maintainer who's knowledgeable in the +specific area will take an "executive" decision that they think is the right +for the project. + +## Donations + +Donating plain money to curl is best done to curl's [Open Collective +fund](https://opencollective.com/curl). Open Collective is a US based +non-profit organization that holds on to funds for us. This fund is then used +for paying the curl security bug bounties, to reimburse project related +expenses etc. + +Donations to the project can also come in form of server hosting, providing +services and paying for people to work on curl related code etc. Usually, such +donations are services paid for directly by the sponsors. + +We grade sponsors in a few different levels and if they meet the criteria, +they can be mentioned on the Sponsors page on the curl website. + +## Commercial Support + +The curl project does not do or offer commercial support. It only hosts +mailing lists, runs bug trackers etc to facilitate communication and work. + +However, Daniel works for wolfSSL and we offer commercial curl support there. + +# Key roles + +## User + +Someone who uses or has used curl or libcurl. + +## Contributor + +Someone who has helped the curl project, who has contributed to bring it +forward. Contributing could be to provide advice, debug a problem, file a bug +report, run test infrastructure or writing code etc. + +## Commit author + +Sometimes also called 'committer'. Someone who has authored a commit in the +curl source code repository. Committers are recorded as `Author` in git. + +## Maintainers + +A maintainer in the curl project is an individual who has been given +permissions to push commits to one of the git repositories. + +Maintainers are free to push commits to the repositories at their own will. +Maintainers are however expected to listen to feedback from users and any +change that is non-trivial in size or nature *should* be brought to the +project as a Pull-Request (PR) to allow others to comment/object before merge. + +## Former maintainers + +A maintainer who stops being active in the project will at some point get +their push permissions removed. We do this for security reasons but also to +make sure that we always have the list of maintainers as "the team that push +stuff to curl". + +Getting push permissions removed is not a punishment. Everyone who ever worked +on maintaining curl is considered a hero, for all time hereafter. + +## Security team members + +We have a security team. That's the team of people who are subscribed to the +curl-security mailing list; the receivers of security reports from users and +developers. This list of people will vary over time but should be skilled +developers familiar with the curl project. + +The security team works best when it consists of a small set of active +persons. We invite new members when the team seems to need it, and we also +expect to retire security team members as they "drift off" from the project or +just find themselves unable to perform their duties there. + +## Server admins + +We run a web server, a mailing list and more on the curl project's primary +server. That physical machine is owned and run by Haxx. Daniel is the primary +admin of all things curl related server stuff, but Björn Stenberg and Linus +Feltzing serve as backup admins for when Daniel is gone or unable. + +The primary server is paid for by Haxx. The machine is physically located in a +server bunker in Stockholm Sweden, operated by the company Portlane. + +The website contents are served to the web via Fastly and Daniel is the +primary curl contact with Fastly. + +## BDFL + +That's Daniel. + +# Maintainers + +A curl maintainer is a project volunteer who has the authority and rights to +merge changes into a git repository in the curl project. + +Anyone can aspire to become a curl maintainer. + +### Duties + +There are no mandatory duties. We hope and wish that maintainers consider +reviewing patches and help merging them, especially when the changes are +within the area of personal expertise and experience. + +### Requirements + +- only merge code that meets our quality and style guide requirements. +- *never* merge code without doing a PR first, unless the change is "trivial" +- if in doubt, ask for input/feedback from others + +### Recommendations + +- we require two-factor authentication enabled on your GitHub account to + reduce risk of malicious source code tampering +- consider enabling signed git commits for additional verification of changes + +### Merge advice + +When you're merging patches/PRs... + +- make sure the commit messages follow our template +- squash patch sets into a few logical commits even if the PR didn't, if + necessary +- avoid the "merge" button on GitHub, do it "manually" instead to get full + control and full audit trail (github leaves out you as "Committer:") +- remember to credit the reporter and the helpers! + +## Who are maintainers? + +The [list of maintainers](https://github.com/orgs/curl/people). Be aware that +the level of presence and activity in the project vary greatly between +different individuals and over time. + +### Become a maintainer? + +If you think you can help making the project better by shouldering some +maintaining responsibilities, then please get in touch. + +You will be expected to be familiar with the curl project and its ways of +working. You need to have gotten a few quality patches merged as a proof of +this. + +### Stop being a maintainer + +If you (appear to) not be active in the project anymore, you may be removed as +a maintainer. Thank you for your service! diff --git a/curl/docs/HELP-US.md b/curl/docs/HELP-US.md index d37ad948..25784519 100644 --- a/curl/docs/HELP-US.md +++ b/curl/docs/HELP-US.md @@ -5,7 +5,7 @@ looking for ways to contribute and help out, this document aims to give a few good starting points. A good idea is to start by subscribing to the [curl-library mailing -list](https://cool.haxx.se/mailman/listinfo/curl-library) to keep track of the +list](https://lists.haxx.se/listinfo/curl-library) to keep track of the current discussion topics. ## Scratch your own itch @@ -15,7 +15,24 @@ found yourself or perhaps got annoyed at in the past. It can be a spelling error in an error text or a weirdly phrased section in a man page. Hunt it down and report the bug. Or make your first pull request with a fix for that. -## PR-welcome +## Smaller tasks + +Some projects mark small issues as "beginner friendly", "bite-sized" or +similar. We don't do that in curl since such issues never linger around long +enough. Simple issues get handled very fast. + +If you're looking for a smaller or simpler task in the project to help out +with as an entry-point into the project, perhaps because you are a newcomer or +even maybe not a terribly experienced developer, here's our advice: + + - Read through this document to get a grasp on a general approach to use + - Consider adding a test case for something not currently tested (correctly) + - Consider updating or adding documentation + - One way to get your feet wet gently in the project, is to participate in an + existing issue/PR and help out by reproducing the issue, review the code in + the PR etc. + +## Help wanted In the issue tracker we occasionally mark bugs with [help wanted](https://github.com/curl/curl/labels/help%20wanted), as a sign that the @@ -28,14 +45,14 @@ one that piques your interest. Some bugs are known and haven't yet received attention and work enough to get fixed. We collect such known existing flaws in the -[KNOWN_BUGS](https://curl.haxx.se/docs/knownbugs.html) page. Many of them link +[KNOWN_BUGS](https://curl.se/docs/knownbugs.html) page. Many of them link to the original bug report with some additional details, but some may also have aged a bit and may require some verification that the bug still exists in the same way and that what was said about it in the past is still valid. ## Fix autobuild problems -On the [autobuilds page](https://curl.haxx.se/dev/builds.html) we show a +On the [autobuilds page](https://curl.se/dev/builds.html) we show a collection of test results from the automatic curl build and tests that are performed by volunteers. Fixing compiler warnings and errors shown there is something we value greatly. Also, if you own or run systems or architectures @@ -46,7 +63,7 @@ volunteers running builds automatically to help us keep curl portable. Ideas for features and functions that we have considered worthwhile to implement and provide are kept in the -[TODO](https://curl.haxx.se/docs/todo.html) file. Some of the ideas are +[TODO](https://curl.se/docs/todo.html) file. Some of the ideas are rough. Some are well thought out. Some probably aren't really suitable anymore. @@ -64,7 +81,7 @@ the specific implementation. Either way is fine. ## CONTRIBUTE -We offer [guidelines](https://curl.haxx.se/dev/contribute.html) that are +We offer [guidelines](https://curl.se/dev/contribute.html) that are suitable to be familiar with before you decide to contribute to curl. If you're used to open source development, you'll probably not find many surprises in there. diff --git a/curl/docs/HISTORY.md b/curl/docs/HISTORY.md index a84ad8f1..373741c5 100644 --- a/curl/docs/HISTORY.md +++ b/curl/docs/HISTORY.md @@ -7,26 +7,48 @@ currency-exchange calculations available to Internet Relay Chat (IRC) users. All the necessary data were published on the Web; he just needed to automate their retrieval. -Daniel simply adopted an existing command-line open-source tool, httpget, that -Brazilian Rafael Sagula had written and recently released version 0.1 of. After -a few minor adjustments, it did just what he needed. +1996 +---- + +On November 11, 1996 the Brazilian developer Rafael Sagula wrote and released +HttpGet version 0.1. + +Daniel extended this existing command-line open-source tool. After a few minor +adjustments, it did just what he needed. The first release with Daniel's +additions was 0.2, released on December 17, 1996. Daniel quickly became the +new maintainer of the project. 1997 ---- +HttpGet 0.3 was released in January 1997 and now it accepted HTTP URLs on the +command line. + HttpGet 1.0 was released on April 8th 1997 with brand new HTTP proxy support. We soon found and fixed support for getting currencies over GOPHER. Once FTP download support was added, the name of the project was changed and urlget 2.0 was released in August 1997. The http-only days were already passed. +Version 2.2 was released on August 14 1997 and introduced support to build for +and run on Windows and Solaris. + +November 24 1997: Version 3.1 added FTP upload support. + +Version 3.5 added support for HTTP POST. + 1998 ---- -The project slowly grew bigger. When upload capabilities were added and the -name once again was misleading, a second name change was made and on March 20, -1998 curl 4 was released. (The version numbering from the previous names was -kept.) +February 4: urlget 3.10 + +February 9: urlget 3.11 + +March 14: urlget 3.12 added proxy authentication. + +The project slowly grew bigger. With upload capabilities, the name was once +again misleading and a second name change was made. On March 20, 1998 curl 4 +was released. (The version numbering from the previous names was kept.) (Unrelated to this project a company called Curl Corporation registered a US trademark on the name "CURL" on May 18 1998. That company had then already @@ -58,7 +80,7 @@ OpenSSL took over and SSLeay was abandoned. May: first Debian package. -August: LDAP:// and FILE:// support added. The curl web site gets 1300 visits +August: LDAP:// and FILE:// support added. The curl website gets 1300 visits weekly. Moved site to curl.haxx.nu. September: Released curl 6.0. 15000 lines of code. @@ -77,7 +99,7 @@ other software and programs to be based on and powered by libcurl. Almost June: the curl site moves to "curl.haxx.se" -August, the curl web site gets 4000 visits weekly. +August, the curl website gets 4000 visits weekly. The PHP guys adopted libcurl already the same month, when the first ever third party libcurl binding showed up. CURL has been a supported module in PHP since @@ -104,20 +126,22 @@ also introduced libcurl's ability to do persistent connections. 24000 lines of code. The libcurl major SONAME number was bumped to 2 due to this overhaul. The first experimental ftps:// support was added. -August: curl is bundled in Mac OS X, 10.1. It was already becoming more and -more of a standard utility of Linux distributions and a regular in the BSD -ports collections. The curl web site gets 8000 visits weekly. Curl Corporation -contacted Daniel to discuss "the name issue". After Daniel's reply, they have -never since got back in touch again. +August: The curl website gets 8000 visits weekly. Curl Corporation contacted +Daniel to discuss "the name issue". After Daniel's reply, they have never +since got back in touch again. September: libcurl 7.9 introduces cookie jar and curl_formadd(). During the forthcoming 7.9.x releases, we introduced the multi interface slowly and without many whistles. +September 25: curl (7.7.2) is bundled in Mac OS X (10.1) for the first time. It was +already becoming more and more of a standard utility of Linux distributions +and a regular in the BSD ports collections. + 2002 ---- -June: the curl web site gets 13000 visits weekly. curl and libcurl is +June: the curl website gets 13000 visits weekly. curl and libcurl is 35000 lines of code. Reported successful compiles on more than 40 combinations of CPUs and operating systems. @@ -126,22 +150,24 @@ impossible. Around 5000 downloaded packages each week from the main site gives a hint, but the packages are mirrored extensively, bundled with numerous OS distributions and otherwise retrieved as part of other software. -September: with the release of curl 7.10 it is released under the MIT license +October 1: with the release of curl 7.10 it is released under the MIT license only. +Starting with 7.10, curl verifies SSL server certificates by default. + 2003 ---- January: Started working on the distributed curl tests. The autobuilds. February: the curl site averages at 20000 visits weekly. At any given moment, -there's an average of 3 people browsing the curl.haxx.se site. +there's an average of 3 people browsing the website. Multiple new authentication schemes are supported: Digest (May), NTLM (June) and Negotiate (June). November: curl 7.10.8 is released. 45000 lines of code. ~55000 unique visitors -to the curl.haxx.se site. Five official web mirrors. +to the website. Five official web mirrors. December: full-fledged SSL for FTP is supported. @@ -162,7 +188,7 @@ August: Curl and libcurl 7.12.1 Available command line options: 96 Available curl_easy_setopt() options: 120 Number of public functions in libcurl: 36 - Amount of public web site mirrors: 12 + Amount of public website mirrors: 12 Number of known libcurl bindings: 26 2005 @@ -175,7 +201,7 @@ April: Added the multi_socket() API September: TFTP support was added. -More than 100,000 unique visitors of the curl web site. 25 mirrors. +More than 100,000 unique visitors of the curl website. 25 mirrors. December: security vulnerability: libcurl URL Buffer Overflow @@ -218,6 +244,8 @@ November: March: security vulnerability: libcurl Arbitrary File Access +April: added CMake support + August: security vulnerability: libcurl embedded zero in cert name December: Added support for IMAP, POP3 and SMTP @@ -229,7 +257,7 @@ January: Added support for RTSP February: security vulnerability: libcurl data callback excessive length -March: The project switched over to use git (hosted by github) instead of CVS +March: The project switched over to use git (hosted by GitHub) instead of CVS for source code control May: Added support for RTMP @@ -247,6 +275,13 @@ August: Gopher support added (re-added actually, see January 2006) +2011 +---- + +February: added support for the axTLS backend + +April: added the cyassl backend (later renamed to WolfSSL) + 2012 ---- @@ -274,22 +309,106 @@ August: March: first real release supporting HTTP/2 - September: Web site had 245,000 unique visitors and served 236GB data + September: Website had 245,000 unique visitors and served 236GB data + + SMB and SMBS support + +2015 +---- + + June: support for multiplexing with HTTP/2 + + August: support for HTTP/2 server push + + December: Public Suffix List 2016 ---- + January: the curl tool defaults to HTTP/2 for HTTPS URLs + December: curl 7.52.0 introduced support for HTTPS-proxy! + First TLS 1.3 support + 2017 ---- + July: OSS-Fuzz started fuzzing libcurl + September: Added Multi-SSL support - The web site serves 3100 GB/month + The website serves 3100 GB/month Public curl releases: 169 Command line options: 211 curl_easy_setopt() options: 249 Public functions in libcurl: 74 Contributors: 1609 + + October: SSLKEYLOGFILE support, new MIME API + + October: Daniel received the Polhem Prize for his work on curl + + November: brotli + +2018 +---- + + January: new SSH backend powered by libssh + + March: starting with the 1803 release of Windows 10, curl is shipped bundled + with Microsoft's operating system. + + July: curl shows headers using bold type face + + October: added DNS-over-HTTPS (DoH) and the URL API + + MesaLink is a new supported TLS backend + + libcurl now does HTTP/2 (and multiplexing) by default on HTTPS URLs + + curl and libcurl are installed in an estimated 5 *billion* instances + world-wide. + + October 31: Curl and libcurl 7.62.0 + + Public curl releases: 177 + Command line options: 219 + curl_easy_setopt() options: 261 + Public functions in libcurl: 80 + Contributors: 1808 + + December: removed axTLS support + +2019 +---- + + March: added experimental alt-svc support + + August: the first HTTP/3 requests with curl. + + September: 7.66.0 is released and the tool offers parallel downloads + +2020 +---- + + curl and libcurl are installed in an estimated 10 *billion* instances + world-wide. + + January: added BearSSL support + + March: removed support for PolarSSL, added wolfSSH support + + April: experimental MQTT support + + August: zstd support + + November: the website moves to curl.se. The website serves 10TB data monthly. + +2021 +---- + + February 3: curl 7.75.0 ships with support for Hyper is a HTTP backend + + March 31: curl 7.76.0 ships with support for rustls diff --git a/curl/docs/HSTS.md b/curl/docs/HSTS.md new file mode 100644 index 00000000..f63cfe32 --- /dev/null +++ b/curl/docs/HSTS.md @@ -0,0 +1,44 @@ +# HSTS support + +HTTP Strict-Transport-Security. Added as experimental in curl +7.74.0. Supported "for real" since 7.77.0. + +## Standard + +[HTTP Strict Transport Security](https://tools.ietf.org/html/rfc6797) + +## Behavior + +libcurl features an in-memory cache for HSTS hosts, so that subsequent +HTTP-only requests to a host name present in the cache will get internally +"redirected" to the HTTPS version. + +## `curl_easy_setopt()` options: + + - `CURLOPT_HSTS_CTRL` - enable HSTS for this easy handle + - `CURLOPT_HSTS` - specify file name where to store the HSTS cache on close + (and possibly read from at startup) + +## curl cmdline options + + - `--hsts [filename]` - enable HSTS, use the file as HSTS cache. If filename + is `""` (no length) then no file will be used, only in-memory cache. + +## HSTS cache file format + +Lines starting with `#` are ignored. + +For each hsts entry: + + [host name] "YYYYMMDD HH:MM:SS" + +The `[host name]` is dot-prefixed if it is a includeSubDomain. + +The time stamp is when the entry expires. + +I considered using wget's file format for the HSTS cache. However, they store the time stamp as the epoch (number of seconds since 1970) and I strongly disagree with using that format. Instead I opted to use a format similar to the curl alt-svc cache file format. + +## Possible future additions + + - `CURLOPT_HSTS_PRELOAD` - provide a set of preloaded HSTS host names + - ability to save to something else than a file diff --git a/curl/docs/HTTP-COOKIES.md b/curl/docs/HTTP-COOKIES.md index a1b28345..9d1e099d 100644 --- a/curl/docs/HTTP-COOKIES.md +++ b/curl/docs/HTTP-COOKIES.md @@ -15,10 +15,19 @@ servers with the Cookie: header. For a very long time, the only spec explaining how to use cookies was the - original [Netscape spec from 1994](https://curl.haxx.se/rfc/cookie_spec.html). + original [Netscape spec from 1994](https://curl.se/rfc/cookie_spec.html). In 2011, [RFC6265](https://www.ietf.org/rfc/rfc6265.txt) was finally - published and details how cookies work within HTTP. + published and details how cookies work within HTTP. In 2016, an update which + added support for prefixes was + [proposed](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00), + and in 2017, another update was + [drafted](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone-01) + to deprecate modification of 'secure' cookies from non-secure origins. Both + of these drafts have been incorporated into a proposal to + [replace](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02) + RFC6265. Cookie prefixes and secure cookie modification protection has been + implemented by curl. ## Cookies saved to disk @@ -34,6 +43,27 @@ When libcurl saves a cookiejar, it creates a file header of its own in which there is a URL mention that will link to the web version of this document. +## Cookie file format + + The cookie file format is text based and stores one cookie per line. Lines + that start with `#` are treated as comments. + + Each line that each specifies a single cookie consists of seven text fields + separated with TAB characters. A valid line must end with a newline + character. + +### Fields in the file + + Field number, what type and example data and the meaning of it: + + 0. string `example.com` - the domain name + 1. boolean `FALSE` - include subdomains + 2. string `/foobar/` - path + 3. boolean `TRUE` - send/receive over HTTPS only + 4. number `1462299217` - expires at - seconds since Jan 1st 1970, or 0 + 5. string `person` - name of the cookie + 6. string `daniel` - value of the cookie + ## Cookies with curl the command line tool curl has a full cookie "engine" built in. If you just activate it, you can @@ -99,6 +129,6 @@ Since curl and libcurl are plain HTTP clients without any knowledge of or capability to handle javascript, such cookies will not be detected or used. - Often, if you want to mimic what a browser does on such web sites, you can + Often, if you want to mimic what a browser does on such websites, you can record web browser HTTP traffic when using such a site and then repeat the cookie operations using curl or libcurl. diff --git a/curl/docs/HTTP2.md b/curl/docs/HTTP2.md index efbe6999..d4430676 100644 --- a/curl/docs/HTTP2.md +++ b/curl/docs/HTTP2.md @@ -7,7 +7,7 @@ HTTP/2 with curl Build prerequisites ------------------- - nghttp2 - - OpenSSL, libressl, BoringSSL, NSS, GnutTLS, mbedTLS, wolfSSL or SChannel + - OpenSSL, libressl, BoringSSL, NSS, GnuTLS, mbedTLS, wolfSSL or Schannel with a new enough version. [nghttp2](https://nghttp2.org/) @@ -18,7 +18,7 @@ parts. The reason for this is that HTTP/2 is much more complex at that layer than HTTP/1.1 (which we implement on our own) and that nghttp2 is an already existing and well functional library. -We require at least version 1.0.0. +We require at least version 1.12.0. Over an http:// URL ------------------- @@ -55,14 +55,15 @@ The challenge is the ALPN and NPN support and all our different SSL backends. You may need a fairly updated SSL library version for it to provide the necessary TLS features. Right now we support: - - OpenSSL: ALPN and NPN - - libressl: ALPN and NPN - - BoringSSL: ALPN and NPN - - NSS: ALPN and NPN - - GnuTLS: ALPN - - mbedTLS: ALPN - - SChannel: ALPN - - wolfSSL: ALPN + - OpenSSL: ALPN and NPN + - libressl: ALPN and NPN + - BoringSSL: ALPN and NPN + - NSS: ALPN and NPN + - GnuTLS: ALPN + - mbedTLS: ALPN + - Schannel: ALPN + - wolfSSL: ALPN + - Secure Transport: ALPN Multiplexing ------------ @@ -104,14 +105,8 @@ Since 7.47.0, the curl tool enables HTTP/2 by default for HTTPS connections. curl tool limitations --------------------- -The command line tool won't do any HTTP/2 multiplexing even though libcurl -supports it, simply because the curl tool is not written to take advantage of -the libcurl API that's necessary for this (the multi interface). We have an -outstanding TODO item for this and **you** can help us make it happen. - -The command line tool also doesn't support HTTP/2 server push for the same -reason it doesn't do multiplexing: it needs to use the multi interface for -that so that multiplexing is supported. +The command line tool doesn't support HTTP/2 server push. It supports +multiplexing when the parallel transfer option is used. HTTP Alternative Services ------------------------- diff --git a/curl/docs/HTTP3.md b/curl/docs/HTTP3.md new file mode 100644 index 00000000..2f377fd3 --- /dev/null +++ b/curl/docs/HTTP3.md @@ -0,0 +1,142 @@ +# HTTP3 (and QUIC) + +## Resources + +[HTTP/3 Explained](https://daniel.haxx.se/http3-explained/) - the online free +book describing the protocols involved. + +[QUIC implementation](https://github.com/curl/curl/wiki/QUIC-implementation) - +the wiki page describing the plan for how to support QUIC and HTTP/3 in curl +and libcurl. + +[quicwg.org](https://quicwg.org/) - home of the official protocol drafts + +## QUIC libraries + +QUIC libraries we're experimenting with: + +[ngtcp2](https://github.com/ngtcp2/ngtcp2) + +[quiche](https://github.com/cloudflare/quiche) + +## Experimental! + +HTTP/3 and QUIC support in curl is considered **EXPERIMENTAL** until further +notice. It needs to be enabled at build-time. + +Further development and tweaking of the HTTP/3 support in curl will happen in +in the master branch using pull-requests, just like ordinary changes. + +# ngtcp2 version + +## Build with OpenSSL + +Build (patched) OpenSSL + + % git clone --depth 1 -b OpenSSL_1_1_1k+quic https://github.com/quictls/openssl + % cd openssl + % ./config enable-tls1_3 --prefix= + % make + % make install_sw + +Build nghttp3 + + % cd .. + % git clone https://github.com/ngtcp2/nghttp3 + % cd nghttp3 + % autoreconf -i + % ./configure --prefix= --enable-lib-only + % make + % make install + +Build ngtcp2 + + % cd .. + % git clone https://github.com/ngtcp2/ngtcp2 + % cd ngtcp2 + % autoreconf -i + % ./configure PKG_CONFIG_PATH=/lib/pkgconfig:/lib/pkgconfig LDFLAGS="-Wl,-rpath,/lib" --prefix= --enable-lib-only + % make + % make install + +Build curl + + % cd .. + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % LDFLAGS="-Wl,-rpath,/lib" ./configure --with-openssl= --with-nghttp3= --with-ngtcp2= + % make + +## Build with GnuTLS + +Build GnuTLS + + % git clone --depth 1 https://gitlab.com/gnutls/gnutls.git + % cd gnutls + % ./bootstrap + % ./configure --disable-doc --prefix= + % make + % make install + +Build nghttp3 + + % cd .. + % git clone https://github.com/ngtcp2/nghttp3 + % cd nghttp3 + % autoreconf -i + % ./configure --prefix= --enable-lib-only + % make + % make install + +Build ngtcp2 + + % cd .. + % git clone https://github.com/ngtcp2/ngtcp2 + % cd ngtcp2 + % autoreconf -i + % ./configure PKG_CONFIG_PATH=/lib/pkgconfig:/lib/pkgconfig LDFLAGS="-Wl,-rpath,/lib" --prefix= --enable-lib-only --with-gnutls + % make + % make install + +Build curl + + % cd .. + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % ./configure --without-openssl --with-gnutls= --with-nghttp3= --with-ngtcp2= + % make + +# quiche version + +## build + +Build quiche and BoringSSL: + + % git clone --recursive https://github.com/cloudflare/quiche + % cd quiche + % cargo build --release --features ffi,pkg-config-meta,qlog + % mkdir deps/boringssl/src/lib + % ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/ + +Build curl: + + % cd .. + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-openssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release + % make + +## Run + +Use HTTP/3 directly: + + curl --http3 https://nghttp2.org:4433/ + +Upgrade via Alt-Svc: + + curl --alt-svc altsvc.cache https://quic.aiortc.org/ + +See this [list of public HTTP/3 servers](https://bagder.github.io/HTTP3-test/) diff --git a/curl/docs/HYPER.md b/curl/docs/HYPER.md new file mode 100644 index 00000000..da6c6633 --- /dev/null +++ b/curl/docs/HYPER.md @@ -0,0 +1,69 @@ +# Hyper + +Hyper is a separate HTTP library written in Rust. curl can be told to use this +library as a backend to deal with HTTP. + +## Experimental! + +Hyper support in curl is considered **EXPERIMENTAL** until further notice. It +needs to be explicitly enabled at build-time. + +Further development and tweaking of the Hyper backend support in curl will +happen in in the master branch using pull-requests, just like ordinary +changes. + +## Hyper version + +The C API for Hyper is brand new and is still under development. + +## build curl with hyper + +Build hyper and enable the C API: + + % git clone https://github.com/hyperium/hyper + % cd hyper + % RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi + +Build curl to use hyper's C API: + + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % ./configure --with-hyper= + % make + +# using Hyper internally + +Hyper is a low level HTTP transport library. curl itself provides all HTTP +headers and Hyper provides all received headers back to curl. + +Therefore, most of the "header logic" in curl as in responding to and acting +on specific input and output headers are done the same way in curl code. + +The API in Hyper delivers received HTTP headers as (cleaned up) name=value +pairs, making it impossible for curl to know the exact byte representation +over the wire with Hyper. + +## Limitations + +The hyper backend doesn't support + +- `CURLOPT_IGNORE_CONTENT_LENGTH` +- RTSP + +## Remaining issues + +This backend is still not feature complete with the native backend. Areas that +still need attention and verification include: + +- multiplexed HTTP/2 +- h2 Upgrade: +- pausing transfers +- co-exist with a HTTP/3 build +- receiving HTTP/1 trailers +- sending HTTP/1 trailers +- accept-encoding +- transfer encoding +- alt-svc +- hsts +- DoH ([#6389](https://github.com/curl/curl/issues/6389)) diff --git a/curl/docs/INSTALL.cmake b/curl/docs/INSTALL.cmake index abdfb46b..828d9b9c 100644 --- a/curl/docs/INSTALL.cmake +++ b/curl/docs/INSTALL.cmake @@ -24,9 +24,8 @@ Current flaws in the curl CMake build Missing features in the cmake build: - Builds libcurl without large file support - - Does not support all SSL libraries (only OpenSSL, WinSSL, DarwinSSL, and - mbed TLS) - - Doesn't build with SCP and SFTP support (libssh2) (see issue #1155) + - Does not support all SSL libraries (only OpenSSL, Schannel, + Secure Transport, and mbed TLS, NSS, WolfSSL) - Doesn't allow different resolver backends (no c-ares build support) - No RTMP support built - Doesn't allow build curl and libcurl debug enabled @@ -34,7 +33,7 @@ Current flaws in the curl CMake build - Doesn't allow you to disable specific protocols from the build - Doesn't find or use krb4 or GSS - Rebuilds test files too eagerly, but still can't run the tests - - Does't detect the correct strerror_r flavor when cross-compiling (issue #1123) + - Doesn't detect the correct strerror_r flavor when cross-compiling (issue #1123) Command Line CMake @@ -88,4 +87,3 @@ cmake-gui GUI. Once you have selected all the options you want, click the "Generate" button. 6. Run the native build tool that you used CMake to generate. - diff --git a/curl/docs/INSTALL.md b/curl/docs/INSTALL.md index 67a9378f..84fe8291 100644 --- a/curl/docs/INSTALL.md +++ b/curl/docs/INSTALL.md @@ -7,6 +7,18 @@ document does not describe how to install curl or libcurl using such a binary package. This document describes how to compile, build and install curl and libcurl from source code. +## Building using vcpkg + +You can download and install curl and libcurl using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + vcpkg install curl[tool] + +The curl port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + ## Building from git If you get your code off a git repository instead of a release tarball, see @@ -18,11 +30,13 @@ proceed. A normal Unix installation is made in three or four steps (after you've unpacked the source archive): - ./configure + ./configure --with-openssl [--with-gnutls --with-wolfssl] make make test (optional) make install +(Adjust the configure line accordingly to use the TLS library you want.) + You probably need to be root when doing the last command. Get a full listing of all available configure options by invoking it like: @@ -45,26 +59,26 @@ your own home directory: The configure script always tries to find a working SSL library unless explicitly told not to. If you have OpenSSL installed in the default search path for your compiler/linker, you don't need to do anything special. If you -have OpenSSL installed in /usr/local/ssl, you can run configure like: +have OpenSSL installed in `/usr/local/ssl`, you can run configure like: - ./configure --with-ssl + ./configure --with-openssl -If you have OpenSSL installed somewhere else (for example, /opt/OpenSSL) and +If you have OpenSSL installed somewhere else (for example, `/opt/OpenSSL`) and you have pkg-config installed, set the pkg-config path first, like this: - env PKG_CONFIG_PATH=/opt/OpenSSL/lib/pkgconfig ./configure --with-ssl + env PKG_CONFIG_PATH=/opt/OpenSSL/lib/pkgconfig ./configure --with-openssl Without pkg-config installed, use this: - ./configure --with-ssl=/opt/OpenSSL + ./configure --with-openssl=/opt/OpenSSL If you insist on forcing a build without SSL support, even though you may have OpenSSL installed in your system, you can run configure like this: - ./configure --without-ssl + ./configure --without-ssl If you have OpenSSL installed, but with the libraries in one place and the -header files somewhere else, you have to set the LDFLAGS and CPPFLAGS +header files somewhere else, you have to set the `LDFLAGS` and `CPPFLAGS` environment variables prior to running configure. Something like this should work: @@ -72,10 +86,9 @@ work: If you have shared SSL libs installed in a directory where your run-time linker doesn't find them (which usually causes configure failures), you can -provide the -R option to ld on some operating systems to set a hard-coded -path to the run-time linker: +provide this option to gcc to set a hard-coded path to the run-time linker: - LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl + LDFLAGS=-Wl,-R/usr/local/ssl/lib ./configure --with-openssl ## More Options @@ -98,17 +111,19 @@ want to alter it, you can select how to deal with each individual library. ## Select TLS backend -The default OpenSSL configure check will also detect and use BoringSSL or -libressl. +These options are provided to select TLS backend to use. - - GnuTLS: `--without-ssl --with-gnutls`. - - Cyassl: `--without-ssl --with-cyassl` - - NSS: `--without-ssl --with-nss` - - PolarSSL: `--without-ssl --with-polarssl` - - mbedTLS: `--without-ssl --with-mbedtls` - - axTLS: `--without-ssl --with-axtls` - - schannel: `--without-ssl --with-winssl` - - secure transport: `--without-ssl --with-darwinssl` + - AmiSSL: `--with-amissl` + - BearSSL: `--with-bearssl` + - GnuTLS: `--with-gnutls`. + - mbedTLS: `--with-mbedtls` + - MesaLink: `--with-mesalink` + - NSS: `--with-nss` + - OpenSSL: `--with-openssl` (also for BoringSSL and libressl) + - rustls: `--with-rustls` + - schannel: `--with-schannel` + - secure transport: `--with-secure-transport` + - wolfSSL: `--with-wolfssl` # Windows @@ -122,9 +137,9 @@ libressl. KB140584 is a must for any Windows developer. Especially important is full understanding if you are not going to follow the advice given above. - - [How To Use the C Run-Time](https://support.microsoft.com/kb/94248/en-us) - - [How to link with the correct C Run-Time CRT library](https://support.microsoft.com/kb/140584/en-us) - - [Potential Errors Passing CRT Objects Across DLL Boundaries](https://msdn.microsoft.com/en-us/library/ms235460) + - [How To Use the C Run-Time](https://support.microsoft.com/help/94248/how-to-use-the-c-run-time) + - [Run-Time Library Compiler Options](https://docs.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library) + - [Potential Errors Passing CRT Objects Across DLL Boundaries](https://docs.microsoft.com/cpp/c-runtime-library/potential-errors-passing-crt-objects-across-dll-boundaries) If your app is misbehaving in some strange way, or it is suffering from memory corruption, before asking for further help, please try first to @@ -137,7 +152,9 @@ debug multithreaded dynamic C runtime. Make sure that MinGW32's bin dir is in the search path, for example: - set PATH=c:\mingw32\bin;%PATH% +```cmd +set PATH=c:\mingw32\bin;%PATH% +``` then run `mingw32-make mingw32` in the root dir. There are other make targets available to build libcurl with more features, use: @@ -149,108 +166,55 @@ make targets available to build libcurl with more features, use: and SSPI support. If you have any problems linking libraries or finding header files, be sure -to verify that the provided "Makefile.m32" files use the proper paths, and +to verify that the provided `Makefile.m32` files use the proper paths, and adjust as necessary. It is also possible to override these paths with environment variables, for example: - set ZLIB_PATH=c:\zlib-1.2.8 - set OPENSSL_PATH=c:\openssl-1.0.2c - set LIBSSH2_PATH=c:\libssh2-1.6.0 +```cmd +set ZLIB_PATH=c:\zlib-1.2.8 +set OPENSSL_PATH=c:\openssl-1.0.2c +set LIBSSH2_PATH=c:\libssh2-1.6.0 +``` It is also possible to build with other LDAP SDKs than MS LDAP; currently it is possible to build with native Win32 OpenLDAP, or with the Novell CLDAP SDK. If you want to use these you need to set these vars: - set LDAP_SDK=c:\openldap - set USE_LDAP_OPENLDAP=1 +```cmd +set LDAP_SDK=c:\openldap +set USE_LDAP_OPENLDAP=1 +``` or for using the Novell SDK: - set USE_LDAP_NOVELL=1 +```cmd +set USE_LDAP_NOVELL=1 +``` If you want to enable LDAPS support then set LDAPS=1. ## Cygwin Almost identical to the unix installation. Run the configure script in the -curl source tree root with `sh configure`. Make sure you have the sh -executable in /bin/ or you'll see the configure fail toward the end. +curl source tree root with `sh configure`. Make sure you have the `sh` +executable in `/bin/` or you'll see the configure fail toward the end. Run `make` -## Borland C++ compiler - -Ensure that your build environment is properly set up to use the compiler and -associated tools. PATH environment variable must include the path to bin -subdirectory of your compiler installation, eg: `c:\Borland\BCC55\bin` - -It is advisable to set environment variable BCCDIR to the base path of the -compiler installation. - - set BCCDIR=c:\Borland\BCC55 - -In order to build a plain vanilla version of curl and libcurl run the -following command from curl's root directory: - - make borland - -To build curl and libcurl with zlib and OpenSSL support set environment -variables `ZLIB_PATH` and `OPENSSL_PATH` to the base subdirectories of the -already built zlib and OpenSSL libraries and from curl's root directory run -command: - - make borland-ssl-zlib - -libcurl library will be built in 'lib' subdirectory while curl tool is built -in 'src' subdirectory. In order to use libcurl library it is advisable to -modify compiler's configuration file bcc32.cfg located in -`c:\Borland\BCC55\bin` to reflect the location of libraries include paths for -example the '-I' line could result in something like: - - -I"c:\Borland\BCC55\include;c:\curl\include;c:\openssl\inc32" - -bcc3.cfg `-L` line could also be modified to reflect the location of of -libcurl library resulting for example: - - -L"c:\Borland\BCC55\lib;c:\curl\lib;c:\openssl\out32" - -In order to build sample program `simple.c` from the docs\examples -subdirectory run following command from mentioned subdirectory: - - bcc32 simple.c libcurl.lib cw32mt.lib - -In order to build sample program simplessl.c an SSL enabled libcurl is -required, as well as the OpenSSL libeay32.lib and ssleay32.lib libraries. - -In order to build sample program `sslbackend.c`, an SSL enabled libcurl -is required. - ## Disabling Specific Protocols in Windows builds The configure utility, unfortunately, is not available for the Windows environment, therefore, you cannot use the various disable-protocol options of the configure utility on this platform. -However, you can use the following defines to disable specific -protocols: - - - `HTTP_ONLY` disables all protocols except HTTP - - `CURL_DISABLE_FTP` disables FTP - - `CURL_DISABLE_LDAP` disables LDAP - - `CURL_DISABLE_TELNET` disables TELNET - - `CURL_DISABLE_DICT` disables DICT - - `CURL_DISABLE_FILE` disables FILE - - `CURL_DISABLE_TFTP` disables TFTP - - `CURL_DISABLE_HTTP` disables HTTP - - `CURL_DISABLE_IMAP` disables IMAP - - `CURL_DISABLE_POP3` disables POP3 - - `CURL_DISABLE_SMTP` disables SMTP +You can use specific defines to disable specific protocols and features. See +[CURL-DISABLE.md](CURL-DISABLE.md) for the full list. If you want to set any of these defines you have the following options: - - Modify lib/config-win32.h - - Modify lib/curl_setup.h - - Modify winbuild/Makefile.vc + - Modify `lib/config-win32.h` + - Modify `lib/curl_setup.h` + - Modify `winbuild/Makefile.vc` - Modify the "Preprocessor Definitions" in the libcurl project Note: The pre-processor settings can be found using the Visual Studio IDE @@ -261,12 +225,12 @@ versions. ## Using BSD-style lwIP instead of Winsock TCP/IP stack in Win32 builds In order to compile libcurl and curl using BSD-style lwIP TCP/IP stack it is -necessary to make definition of preprocessor symbol USE_LWIPSOCK visible to +necessary to make definition of preprocessor symbol `USE_LWIPSOCK` visible to libcurl and curl compilation processes. To set this definition you have the following alternatives: - - Modify lib/config-win32.h and src/config-win32.h - - Modify winbuild/Makefile.vc + - Modify `lib/config-win32.h` and `src/config-win32.h` + - Modify `winbuild/Makefile.vc` - Modify the "Preprocessor Definitions" in the libcurl project Note: The pre-processor settings can be found using the Visual Studio IDE @@ -296,19 +260,18 @@ look for dynamic import symbols. ## Legacy Windows and SSL -WinSSL (specifically SChannel from Windows SSPI), is the native SSL library in -Windows. However, WinSSL in Windows <= XP is unable to connect to servers that +Schannel (from Windows SSPI), is the native SSL library in Windows. However, +Schannel in Windows <= XP is unable to connect to servers that no longer support the legacy handshakes and algorithms used by those versions. If you will be using curl in one of those earlier versions of Windows you should choose another SSL backend such as OpenSSL. -# Apple iOS and Mac OS X +# Apple Platforms (macOS, iOS, tvOS, watchOS, and their simulator counterparts) On modern Apple operating systems, curl can be built to use Apple's SSL/TLS implementation, Secure Transport, instead of OpenSSL. To build with Secure -Transport for SSL/TLS, use the configure option `--with-darwinssl`. (It is not -necessary to use the option `--without-ssl`.) This feature requires iOS 5.0 or -later, or OS X 10.5 ("Leopard") or later. +Transport for SSL/TLS, use the configure option `--with-secure-transport`. (It +is not necessary to use the option `--without-openssl`.) When Secure Transport is in use, the curl options `--cacert` and `--capath` and their libcurl equivalents, will be ignored, because Secure Transport uses @@ -317,26 +280,133 @@ the server. This, of course, includes the root certificates that ship with the OS. The `--cert` and `--engine` options, and their libcurl equivalents, are currently unimplemented in curl with Secure Transport. -For OS X users: In OS X 10.8 ("Mountain Lion"), Apple made a major overhaul to -the Secure Transport API that, among other things, added support for the newer -TLS 1.1 and 1.2 protocols. To get curl to support TLS 1.1 and 1.2, you must -build curl on Mountain Lion or later, or by using the equivalent SDK. If you -set the `MACOSX_DEPLOYMENT_TARGET` environmental variable to an earlier -version of OS X prior to building curl, then curl will use the new Secure -Transport API on Mountain Lion and later, and fall back on the older API when -the same curl binary is executed on older cats. For example, running these -commands in curl's directory in the shell will build the code such that it -will run on cats as old as OS X 10.6 ("Snow Leopard") (using bash): - - export MACOSX_DEPLOYMENT_TARGET="10.6" - ./configure --with-darwinssl - make +In general, a curl build for an Apple `ARCH/SDK/DEPLOYMENT_TARGET` combination +can be taken by providing appropriate values for `ARCH`, `SDK`, `DEPLOYMENT_TARGET` +below and running the commands: + +```bash +# Set these three according to your needs +export ARCH=x86_64 +export SDK=macosx +export DEPLOYMENT_TARGET=10.8 + +export CFLAGS="-arch $ARCH -isysroot $(xcrun -sdk $SDK --show-sdk-path) -m$SDK-version-min=$DEPLOYMENT_TARGET" +./configure --host=$ARCH-apple-darwin --prefix $(pwd)/artifacts --with-secure-transport +make -j8 +make install +``` + +Above will build curl for macOS platform with `x86_64` architecture and `10.8` as deployment target. + +Here is an example for iOS device: + +```bash +export ARCH=arm64 +export SDK=iphoneos +export DEPLOYMENT_TARGET=11.0 + +export CFLAGS="-arch $ARCH -isysroot $(xcrun -sdk $SDK --show-sdk-path) -m$SDK-version-min=$DEPLOYMENT_TARGET" +./configure --host=$ARCH-apple-darwin --prefix $(pwd)/artifacts --with-secure-transport +make -j8 +make install +``` + +Another example for watchOS simulator for macs with Apple Silicon: + +```bash +export ARCH=arm64 +export SDK=watchsimulator +export DEPLOYMENT_TARGET=5.0 + +export CFLAGS="-arch $ARCH -isysroot $(xcrun -sdk $SDK --show-sdk-path) -m$SDK-version-min=$DEPLOYMENT_TARGET" +./configure --host=$ARCH-apple-darwin --prefix $(pwd)/artifacts --with-secure-transport +make -j8 +make install +``` + +In all above, the built libraries and executables can be found in `artifacts` folder. + +# Android + +When building curl for Android it's recommended to use a Linux environment +since using curl's `configure` script is the easiest way to build curl +for Android. Before you can build curl for Android, you need to install the +Android NDK first. This can be done using the SDK Manager that is part of +Android Studio. Once you have installed the Android NDK, you need to figure out +where it has been installed and then set up some environment variables before +launching `configure`. On macOS, those variables could look like this to compile +for `aarch64` and API level 29: + +```bash +export NDK=~/Library/Android/sdk/ndk/20.1.5948944 +export HOST_TAG=darwin-x86_64 +export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG +export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar +export AS=$TOOLCHAIN/bin/aarch64-linux-android-as +export CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang +export CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++ +export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld +export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib +export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip +``` + +When building on Linux or targeting other API levels or architectures, you need +to adjust those variables accordingly. After that you can build curl like this: + + ./configure --host aarch64-linux-android --with-pic --disable-shared + +Note that this won't give you SSL/TLS support. If you need SSL/TLS, you have +to build curl against a SSL/TLS layer, e.g. OpenSSL, because it's impossible for +curl to access Android's native SSL/TLS layer. To build curl for Android using +OpenSSL, follow the OpenSSL build instructions and then install `libssl.a` and +`libcrypto.a` to `$TOOLCHAIN/sysroot/usr/lib` and copy `include/openssl` to +`$TOOLCHAIN/sysroot/usr/include`. Now you can build curl for Android using +OpenSSL like this: + + ./configure --host aarch64-linux-android --with-pic --disable-shared --with-openssl="$TOOLCHAIN/sysroot/usr" + +Note, however, that you must target at least Android M (API level 23) or `configure` +won't be able to detect OpenSSL since `stderr` (and the like) weren't defined +before Android M. + +# IBM i + +For IBM i (formerly OS/400), you can use curl in two different ways: + +- Natively, running in the **ILE**. The obvious use is being able to call curl + from ILE C or RPG applications. + - You will need to build this from source. See `packages/OS400/README` for + the ILE specific build instructions. +- In the **PASE** environment, which runs AIX programs. curl will be built as + it would be on AIX. + - IBM provides builds of curl in their Yum repository for PASE software. + - To build from source, follow the Unix instructions. + +There are some additional limitations and quirks with curl on this platform; +they affect both environments. + +## Multithreading notes + +By default, jobs in IBM i won't start with threading enabled. (Exceptions +include interactive PASE sessions started by `QP2TERM` or SSH.) If you use +curl in an environment without threading when options like async DNS were +enabled, you'll messages like: + +``` +getaddrinfo() thread failed to start +``` + +Don't panic! curl and your program aren't broken. You can fix this by: + +- Set the environment variable `QIBM_MULTI_THREADED` to `Y` before starting + your program. This can be done at whatever scope you feel is appropriate. +- Alternatively, start the job with the `ALWMLTTHD` parameter set to `*YES`. # Cross compile Download and unpack the curl package. -'cd' to the new directory. (e.g. `cd curl-7.12.3`) +`cd` to the new directory. (e.g. `cd curl-7.12.3`) Set environment variables to point to the cross-compile toolchain and call configure with any options you need. Be sure and specify the `--host` and @@ -344,22 +414,24 @@ configure with any options you need. Be sure and specify the `--host` and example of cross-compiling for the IBM 405GP PowerPC processor using the toolchain from MonteVista for Hardhat Linux. - #! /bin/sh - - export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin - export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include" - export AR=ppc_405-ar - export AS=ppc_405-as - export LD=ppc_405-ld - export RANLIB=ppc_405-ranlib - export CC=ppc_405-gcc - export NM=ppc_405-nm - - ./configure --target=powerpc-hardhat-linux - --host=powerpc-hardhat-linux - --build=i586-pc-linux-gnu - --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local - --exec-prefix=/usr/local +```bash +#! /bin/sh + +export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin +export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include" +export AR=ppc_405-ar +export AS=ppc_405-as +export LD=ppc_405-ld +export RANLIB=ppc_405-ranlib +export CC=ppc_405-gcc +export NM=ppc_405-nm + +./configure --target=powerpc-hardhat-linux + --host=powerpc-hardhat-linux + --build=i586-pc-linux-gnu + --prefix=/opt/hardhat/devkit/ppc/405/target/usr/local + --exec-prefix=/usr/local +``` You may also need to provide a parameter like `--with-random=/dev/urandom` to configure as it cannot detect the presence of a random number generating @@ -375,7 +447,7 @@ In some cases, you may be able to simplify the above commands to as little as: There are a number of configure options that can be used to reduce the size of libcurl for embedded applications where binary size is an important factor. -First, be sure to set the CFLAGS variable when configuring with any relevant +First, be sure to set the `CFLAGS` variable when configuring with any relevant compiler optimization flags to reduce the size of the binary. For gcc, this would mean at minimum the -Os option, and potentially the `-march=X`, `-mdynamic-no-pic` and `-flto` options as well, e.g. @@ -403,13 +475,13 @@ use, here are some other flags that can reduce the size of the library: - `--enable-hidden-symbols` (eliminates unneeded symbols in the shared library) - `--without-libidn` (disables support for the libidn DNS library) - `--without-librtmp` (disables support for RTMP) - - `--without-ssl` (disables support for SSL/TLS) + - `--without-openssl` (disables support for SSL/TLS) - `--without-zlib` (disables support for on-the-fly decompression) The GNU compiler and linker have a number of options that can reduce the size of the libcurl dynamic libraries on some platforms even further. -Specify them by providing appropriate CFLAGS and LDFLAGS variables on the -configure command-line, e.g. +Specify them by providing appropriate `CFLAGS` and `LDFLAGS` variables on +the configure command-line, e.g. CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto" @@ -431,7 +503,7 @@ in a lower total size than dynamically linking. Note that the curl test harness can detect the use of some, but not all, of the `--disable` statements suggested above. Use will cause tests relying on those features to fail. The test harness can be manually forced to skip the -relevant tests by specifying certain key words on the runtests.pl command +relevant tests by specifying certain key words on the `runtests.pl` command line. Following is a list of appropriate key words: - `--disable-cookies` !cookies @@ -440,77 +512,25 @@ line. Following is a list of appropriate key words: # PORTS -This is a probably incomplete list of known hardware and operating systems -that curl has been compiled for. If you know a system curl compiles and -runs on, that isn't listed, please let us know! - - - Alpha DEC OSF 4 - - Alpha Digital UNIX v3.2 - - Alpha FreeBSD 4.1, 4.5 - - Alpha Linux 2.2, 2.4 - - Alpha NetBSD 1.5.2 - - Alpha OpenBSD 3.0 - - Alpha OpenVMS V7.1-1H2 - - Alpha Tru64 v5.0 5.1 - - AVR32 Linux - - ARM Android 1.5, 2.1, 2.3, 3.2, 4.x - - ARM INTEGRITY - - ARM iOS - - Cell Linux - - Cell Cell OS - - HP-PA HP-UX 9.X 10.X 11.X - - HP-PA Linux - - HP3000 MPE/iX - - MicroBlaze uClinux - - MIPS IRIX 6.2, 6.5 - - MIPS Linux - - OS/400 - - Pocket PC/Win CE 3.0 - - Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2 - - PowerPC Darwin 1.0 - - PowerPC INTEGRITY - - PowerPC Linux - - PowerPC Mac OS 9 - - PowerPC Mac OS X - - SH4 Linux 2.6.X - - SH4 OS21 - - SINIX-Z v5 - - Sparc Linux - - Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8, 9, 10 - - Sparc SunOS 4.1.X - - StrongARM (and other ARM) RISC OS 3.1, 4.02 - - StrongARM/ARM7/ARM9 Linux 2.4, 2.6 - - StrongARM NetBSD 1.4.1 - - Symbian OS (P.I.P.S.) 9.x - - TPF - - Ultrix 4.3a - - UNICOS 9.0 - - i386 BeOS - - i386 DOS - - i386 eCos 1.3.1 - - i386 Esix 4.1 - - i386 FreeBSD - - i386 HURD - - i386 Haiku OS - - i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6 - - i386 Mac OS X - - i386 MINIX 3.1 - - i386 NetBSD - - i386 Novell NetWare - - i386 OS/2 - - i386 OpenBSD - - i386 QNX 6 - - i386 SCO unix - - i386 Solaris 2.7 - - i386 Windows 95, 98, ME, NT, 2000, XP, 2003 - - i486 ncr-sysv4.3.03 (NCR MP-RAS) - - ia64 Linux 2.3.99 - - m68k AmigaOS 3 - - m68k Linux - - m68k uClinux - - m68k OpenBSD - - m88k dg-dgux5.4R3.00 - - s390 Linux - - x86_64 Linux - - XScale/PXA250 Linux 2.4 - - Nios II uClinux +This is a probably incomplete list of known CPU architectures and operating +systems that curl has been compiled for. If you know a system curl compiles +and runs on, that isn't listed, please let us know! + +## 85 Operating Systems + +AIX, AmigaOS, Android, Aros, BeOS, Blackberry 10, Blackberry Tablet OS, Cell +OS, ChromeOS, Cisco IOS, Cygwin, Dragonfly BSD, eCOS, FreeBSD, FreeDOS, +FreeRTOS, Fuchsia, Garmin OS, Genode, Haiku, HardenedBSD, HP-UX, Hurd, +Illumos, Integrity, iOS, ipadOS, IRIX, LineageOS, Linux, Lua RTOS, Mac OS 9, +macOS, Mbed, Micrium, MINIX, MorphOS, MPE/iX, MS-DOS, NCR MP-RAS, NetBSD, +Netware, Nintendo Switch, NonStop OS, NuttX, OpenBSD, OpenStep, Orbis OS, +OS/2, OS/400, OS21, Plan 9, PlayStation Portable, QNX, Qubes OS, ReactOS, +Redox, RICS OS, Sailfish OS, SCO Unix, Serenity, SINIX-Z, Solaris, SunOS, +Syllable OS, Symbian, Tizen, TPF, Tru64, tvOS, ucLinux, Ultrix, UNICOS, +UnixWare, VMS, vxWorks, WebOS, Wii system software, Windows, Windows CE, Xbox +System, z/OS, z/TPF, z/VM, z/VSE + +## 22 CPU Architectures + +Alpha, ARC, ARM, AVR32, Cell, HP-PA, Itanium, m68k, MicroBlaze, MIPS, Nios, +OpenRISC, POWER, PowerPC, RISC-V, s390, SH4, SPARC, VAX, x86, x86-64, Xtensa diff --git a/curl/docs/INTERNALS.md b/curl/docs/INTERNALS.md index 2e273a9d..176ca525 100644 --- a/curl/docs/INTERNALS.md +++ b/curl/docs/INTERNALS.md @@ -7,13 +7,13 @@ curl internals - [Windows vs Unix](#winvsunix) - [Library](#Library) - [`Curl_connect`](#Curl_connect) - - [`Curl_do`](#Curl_do) + - [`multi_do`](#multi_do) - [`Curl_readwrite`](#Curl_readwrite) - - [`Curl_done`](#Curl_done) + - [`multi_done`](#multi_done) - [`Curl_disconnect`](#Curl_disconnect) - [HTTP(S)](#http) - [FTP](#ftp) - - [Kerberos](#kerberos) + - [Kerberos](#kerberos) - [TELNET](#telnet) - [FILE](#file) - [SMB](#smb) @@ -34,10 +34,17 @@ curl internals - [`curl_off_t`](#curl_off_t) - [curlx](#curlx) - [Content Encoding](#contentencoding) - - [hostip.c explained](#hostip) + - [`hostip.c` explained](#hostip) - [Track Down Memory Leaks](#memoryleak) - [`multi_socket`](#multi_socket) - [Structs in libcurl](#structs) + - [Curl_easy](#Curl_easy) + - [connectdata](#connectdata) + - [Curl_multi](#Curl_multi) + - [Curl_handler](#Curl_handler) + - [conncache](#conncache) + - [Curl_share](#Curl_share) + - [CookieInfo](#CookieInfo) Intro @@ -66,7 +73,7 @@ git Portability =========== - We write curl and libcurl to compile with C89 compilers. On 32bit and up + We write curl and libcurl to compile with C89 compilers. On 32-bit and up machines. Most of libcurl assumes more or less POSIX compliance but that's not a requirement. @@ -78,20 +85,19 @@ Dependencies ------------ - OpenSSL 0.9.7 - - GnuTLS 1.2 + - GnuTLS 3.1.10 - zlib 1.1.4 - - libssh2 0.16 - - c-ares 1.6.0 - - libidn 0.4.1 - - cyassl 2.0.0 + - libssh2 1.0 + - c-ares 1.16.0 + - libidn2 2.0.0 + - wolfSSL 2.0.0 - openldap 2.0 - MIT Kerberos 1.2.4 - GSKit V5R3M0 - NSS 3.14.x - - axTLS 2.1.0 - - PolarSSL 1.3.0 - Heimdal ? - - nghttp2 1.0.0 + - nghttp2 1.12.0 + - WinSock 2.2 (on Windows 95+ and Windows CE .NET 4.1+) Operating Systems ----------------- @@ -119,7 +125,7 @@ Build tools - GNU M4 1.4 - perl 5.004 - roffit 0.5 - - groff ? (any version that supports "groff -Tps -man [in] [out]") + - groff ? (any version that supports `groff -Tps -man [in] [out]`) - ps2pdf (gs) ? @@ -133,13 +139,15 @@ Windows vs Unix In curl, this is solved with defines and macros, so that the source looks the same in all places except for the header file that defines them. The - macros in use are sclose(), sread() and swrite(). + macros in use are `sclose()`, `sread()` and `swrite()`. 2. Windows requires a couple of init calls for the socket stuff. That's taken care of by the `curl_global_init()` call, but if other libs also do it etc there might be reasons for applications to alter that - behaviour. + behavior. + + We require WinSock version 2.2 and load this version during global init. 3. The file descriptors for network communication and file operations are not as easily interchangeable as in Unix. @@ -172,14 +180,15 @@ Library There are plenty of entry points to the library, namely each publicly defined function that libcurl offers to applications. All of those functions are rather small and easy-to-follow. All the ones prefixed with `curl_easy` are - put in the lib/easy.c file. + put in the `lib/easy.c` file. `curl_global_init()` and `curl_global_cleanup()` should be called by the application to initialize and clean up global stuff in the library. As of - today, it can handle the global SSL initing if SSL is enabled and it can init - the socket layer on windows machines. libcurl itself has no "global" scope. + today, it can handle the global SSL initialization if SSL is enabled and it + can initialize the socket layer on Windows machines. libcurl itself has no + "global" scope. - All printf()-style functions use the supplied clones in lib/mprintf.c. This + All printf()-style functions use the supplied clones in `lib/mprintf.c`. This makes sure we stay absolutely platform independent. [ `curl_easy_init()`][2] allocates an internal struct and makes some @@ -198,8 +207,8 @@ Library `curl_multi_wait()`, and `curl_multi_perform()` until the transfer is done and then returns. - Some of the most important key functions in url.c are called from multi.c - when certain key steps are to be made in the transfer operation. + Some of the most important key functions in `url.c` are called from + `multi.c` when certain key steps are to be made in the transfer operation. Curl_connect() @@ -207,32 +216,30 @@ Curl_connect() Analyzes the URL, it separates the different components and connects to the remote host. This may involve using a proxy and/or using SSL. The - `Curl_resolv()` function in lib/hostip.c is used for looking up host names - (it does then use the proper underlying method, which may vary between - platforms and builds). + `Curl_resolv()` function in `lib/hostip.c` is used for looking up host + names (it does then use the proper underlying method, which may vary + between platforms and builds). When `Curl_connect` is done, we are connected to the remote site. Then it is time to tell the server to get a document/file. `Curl_do()` arranges this. - This function makes sure there's an allocated and initiated 'connectdata' + This function makes sure there's an allocated and initiated `connectdata` struct that is used for this particular connection only (although there may be several requests performed on the same connect). A bunch of things are - inited/inherited from the `Curl_easy` struct. + initialized/inherited from the `Curl_easy` struct. - -Curl_do() + +multi_do() --------- - `Curl_do()` makes sure the proper protocol-specific function is called. The - functions are named after the protocols they handle. + `multi_do()` makes sure the proper protocol-specific function is called. + The functions are named after the protocols they handle. The protocol-specific functions of course deal with protocol-specific - negotiations and setup. They have access to the `Curl_sendf()` (from - lib/sendf.c) function to send printf-style formatted data to the remote - host and when they're ready to make the actual file transfer they call the - `Curl_Transfer()` function (in lib/transfer.c) to setup the transfer and - returns. + negotiations and setup. When they're ready to start the actual file + transfer they call the `Curl_setup_transfer()` function (in + `lib/transfer.c`) to setup the transfer and returns. If this DO function fails and the connection is being re-used, libcurl will then close this connection, setup a new connection and re-issue the DO @@ -240,28 +247,24 @@ Curl_do() we have discovered a dead connection before the DO function and thus we might wrongly be re-using a connection that was closed by the remote peer. - Some time during the DO function, the `Curl_setup_transfer()` function must - be called with some basic info about the upcoming transfer: what socket(s) - to read/write and the expected file transfer sizes (if known). - Curl_readwrite() ---------------- Called during the transfer of the actual protocol payload. - During transfer, the progress functions in lib/progress.c are called at + During transfer, the progress functions in `lib/progress.c` are called at frequent intervals (or at the user's choice, a specified callback might get - called). The speedcheck functions in lib/speedcheck.c are also used to + called). The speedcheck functions in `lib/speedcheck.c` are also used to verify that the transfer is as fast as required. - -Curl_done() + +multi_done() ----------- Called after a transfer is done. This function takes care of everything that has to be done after a transfer. This function attempts to leave - matters in a state so that `Curl_do()` should be possible to call again on + matters in a state so that `multi_do()` should be possible to call again on the same connection (in a persistent connection case). It might also soon be closed with `Curl_disconnect()`. @@ -284,11 +287,12 @@ HTTP(S) ======= HTTP offers a lot and is the protocol in curl that uses the most lines of - code. There is a special file (lib/formdata.c) that offers all the multipart - post functions. + code. There is a special file `lib/formdata.c` that offers all the + multipart post functions. - base64-functions for user+password stuff (and more) is in (lib/base64.c) and - all functions for parsing and sending cookies are found in (lib/cookie.c). + base64-functions for user+password stuff (and more) is in `lib/base64.c` + and all functions for parsing and sending cookies are found in + `lib/cookie.c`. HTTPS uses in almost every case the same procedure as HTTP, with only two exceptions: the connect procedure is different and the function used to read @@ -301,81 +305,85 @@ HTTP(S) An interesting detail with the HTTP(S) request, is the `Curl_add_buffer()` series of functions we use. They append data to one single buffer, and when - the building is finished the entire request is sent off in one single write. This is done this way to overcome problems with flawed firewalls and lame servers. + the building is finished the entire request is sent off in one single write. + This is done this way to overcome problems with flawed firewalls and lame + servers. FTP === The `Curl_if2ip()` function can be used for getting the IP number of a - specified network interface, and it resides in lib/if2ip.c. + specified network interface, and it resides in `lib/if2ip.c`. `Curl_ftpsendf()` is used for sending FTP commands to the remote server. It was made a separate function to prevent us programmers from forgetting that - they must be CRLF terminated. They must also be sent in one single write() to - make firewalls and similar happy. + they must be CRLF terminated. They must also be sent in one single `write()` + to make firewalls and similar happy. Kerberos --------- +======== - Kerberos support is mainly in lib/krb5.c and lib/security.c but also - `curl_sasl_sspi.c` and `curl_sasl_gssapi.c` for the email protocols and - `socks_gssapi.c` and `socks_sspi.c` for SOCKS5 proxy specifics. + Kerberos support is mainly in `lib/krb5.c` but also `curl_sasl_sspi.c` and + `curl_sasl_gssapi.c` for the email protocols and `socks_gssapi.c` and + `socks_sspi.c` for SOCKS5 proxy specifics. TELNET ====== - Telnet is implemented in lib/telnet.c. + Telnet is implemented in `lib/telnet.c`. FILE ==== - The file:// protocol is dealt with in lib/file.c. + The `file://` protocol is dealt with in `lib/file.c`. SMB === - The smb:// protocol is dealt with in lib/smb.c. + The `smb://` protocol is dealt with in `lib/smb.c`. LDAP ==== - Everything LDAP is in lib/ldap.c and lib/openldap.c + Everything LDAP is in `lib/ldap.c` and `lib/openldap.c`. E-mail ====== - The e-mail related source code is in lib/imap.c, lib/pop3.c and lib/smtp.c. + The e-mail related source code is in `lib/imap.c`, `lib/pop3.c` and + `lib/smtp.c`. General ======= URL encoding and decoding, called escaping and unescaping in the source code, - is found in lib/escape.c. + is found in `lib/escape.c`. - While transferring data in Transfer() a few functions might get used. - `curl_getdate()` in lib/parsedate.c is for HTTP date comparisons (and more). + While transferring data in `Transfer()` a few functions might get used. + `curl_getdate()` in `lib/parsedate.c` is for HTTP date comparisons (and + more). - lib/getenv.c offers `curl_getenv()` which is for reading environment + `lib/getenv.c` offers `curl_getenv()` which is for reading environment variables in a neat platform independent way. That's used in the client, but - also in lib/url.c when checking the proxy environment variables. Note that - contrary to the normal unix getenv(), this returns an allocated buffer that - must be free()ed after use. + also in `lib/url.c` when checking the proxy environment variables. Note that + contrary to the normal unix `getenv()`, this returns an allocated buffer that + must be `free()`ed after use. - lib/netrc.c holds the .netrc parser + `lib/netrc.c` holds the `.netrc` parser. - lib/timeval.c features replacement functions for systems that don't have - gettimeofday() and a few support functions for timeval conversions. + `lib/timeval.c` features replacement functions for systems that don't have + `gettimeofday()` and a few support functions for timeval conversions. A function named `curl_version()` that returns the full curl version string - is found in lib/version.c. + is found in `lib/version.c`. Persistent Connections @@ -389,7 +397,7 @@ Persistent Connections as well as all the options etc that the library-user may choose. - The `Curl_easy` struct holds the "connection cache" (an array of - pointers to 'connectdata' structs). + pointers to `connectdata` structs). - This enables the 'curl handle' to be reused on subsequent transfers. @@ -437,10 +445,10 @@ SSL libraries in future libcurl versions. To deal with this internally in the best way possible, we have a generic SSL - function API as provided by the vtls/vtls.[ch] system, and they are the only + function API as provided by the `vtls/vtls.[ch]` system, and they are the only SSL functions we must use from within libcurl. vtls is then crafted to use the appropriate lower-level function calls to whatever SSL library that is in - use. For example vtls/openssl.[ch] for the OpenSSL library. + use. For example `vtls/openssl.[ch]` for the OpenSSL library. Library Symbols @@ -459,7 +467,7 @@ Return Codes and Informationals I've made things simple. Almost every function in libcurl returns a CURLcode, that must be `CURLE_OK` if everything is OK or otherwise a suitable error - code as the curl/curl.h include file defines. The very spot that detects an + code as the `curl/curl.h` include file defines. The very spot that detects an error must use the `Curl_failf()` function to set the human-readable error description. @@ -481,20 +489,20 @@ API/ABI Client ====== - main() resides in `src/tool_main.c`. + `main()` resides in `src/tool_main.c`. - `src/tool_hugehelp.c` is automatically generated by the mkhelp.pl perl script - to display the complete "manual" and the `src/tool_urlglob.c` file holds the - functions used for the URL-"globbing" support. Globbing in the sense that the - {} and [] expansion stuff is there. + `src/tool_hugehelp.c` is automatically generated by the `mkhelp.pl` perl + script to display the complete "manual" and the `src/tool_urlglob.c` file + holds the functions used for the URL-"globbing" support. Globbing in the + sense that the `{}` and `[]` expansion stuff is there. - The client mostly sets up its 'config' struct properly, then + The client mostly sets up its `config` struct properly, then it calls the `curl_easy_*()` functions of the library and when it gets back control after the `curl_easy_perform()` it cleans up the library, checks status and exits. - When the operation is done, the ourWriteOut() function in src/writeout.c may - be called to report about the operation. That function is using the + When the operation is done, the `ourWriteOut()` function in `src/writeout.c` + may be called to report about the operation. That function is mostly using the `curl_easy_getinfo()` function to extract useful information from the curl session. @@ -505,30 +513,32 @@ Client Memory Debugging ================ - The file lib/memdebug.c contains debug-versions of a few functions. Functions - such as malloc, free, fopen, fclose, etc that somehow deal with resources - that might give us problems if we "leak" them. The functions in the memdebug - system do nothing fancy, they do their normal function and then log - information about what they just did. The logged data can then be analyzed - after a complete session, + The file `lib/memdebug.c` contains debug-versions of a few functions. + Functions such as `malloc()`, `free()`, `fopen()`, `fclose()`, etc that + somehow deal with resources that might give us problems if we "leak" them. + The functions in the memdebug system do nothing fancy, they do their normal + function and then log information about what they just did. The logged data + can then be analyzed after a complete session, - memanalyze.pl is the perl script present in tests/ that analyzes a log file - generated by the memory tracking system. It detects if resources are + `memanalyze.pl` is the perl script present in `tests/` that analyzes a log + file generated by the memory tracking system. It detects if resources are allocated but never freed and other kinds of errors related to resource management. - Internally, definition of preprocessor symbol DEBUGBUILD restricts code which - is only compiled for debug enabled builds. And symbol CURLDEBUG is used to - differentiate code which is _only_ used for memory tracking/debugging. + Internally, definition of preprocessor symbol `DEBUGBUILD` restricts code + which is only compiled for debug enabled builds. And symbol `CURLDEBUG` is + used to differentiate code which is _only_ used for memory + tracking/debugging. - Use -DCURLDEBUG when compiling to enable memory debugging, this is also - switched on by running configure with --enable-curldebug. Use -DDEBUGBUILD - when compiling to enable a debug build or run configure with --enable-debug. + Use `-DCURLDEBUG` when compiling to enable memory debugging, this is also + switched on by running configure with `--enable-curldebug`. Use + `-DDEBUGBUILD` when compiling to enable a debug build or run configure with + `--enable-debug`. - curl --version will list 'Debug' feature for debug enabled builds, and + `curl --version` will list 'Debug' feature for debug enabled builds, and will list 'TrackMemory' feature for curl debug memory tracking capable builds. These features are independent and can be controlled when running - the configure script. When --enable-debug is given both features will be + the configure script. When `--enable-debug` is given both features will be enabled, unless some restriction prevents memory tracking from being used. @@ -539,12 +549,12 @@ Test Suite curl archive tree, and it contains a bunch of scripts and a lot of test case data. - The main test script is runtests.pl that will invoke test servers like - httpserver.pl and ftpserver.pl before all the test cases are performed. The - test suite currently only runs on Unix-like platforms. + The main test script is `runtests.pl` that will invoke test servers like + `httpserver.pl` and `ftpserver.pl` before all the test cases are performed. + The test suite currently only runs on Unix-like platforms. - You'll find a description of the test suite in the tests/README file, and the - test case data files in the tests/FILEFORMAT file. + You'll find a description of the test suite in the `tests/README` file, and + the test case data files in the `tests/FILEFORMAT` file. The test suite automatically detects if curl was built with the memory debugging enabled, and if it was, it will detect memory leaks, too. @@ -572,7 +582,7 @@ Asynchronous name resolves prevent linking errors later on). Then I simply build the areslib project (the other projects adig/ahost seem to fail under MSVC). - Next was libcurl. I opened lib/config-win32.h and I added a: + Next was libcurl. I opened `lib/config-win32.h` and I added a: `#define USE_ARES 1` Next thing I did was I added the path for the ares includes to the include @@ -581,8 +591,8 @@ Asynchronous name resolves Lastly, I also changed libcurl to be single-threaded rather than multi-threaded, again this was to prevent some duplicate symbol errors. I'm not sure why I needed to change everything to single-threaded, but when I - didn't I got redefinition errors for several CRT functions (malloc, stricmp, - etc.) + didn't I got redefinition errors for several CRT functions (`malloc()`, + `stricmp()`, etc.) `curl_off_t` @@ -590,9 +600,10 @@ Asynchronous name resolves `curl_off_t` is a data type provided by the external libcurl include headers. It is the type meant to be used for the [`curl_easy_setopt()`][1] - options that end with LARGE. The type is 64bit large on most modern + options that end with LARGE. The type is 64-bit large on most modern platforms. + curlx ===== @@ -602,29 +613,15 @@ curlx additional functions. We provide them through a single header file for easy access for apps: - "curlx.h" + `curlx.h` `curlx_strtoofft()` ------------------- A macro that converts a string containing a number to a `curl_off_t` number. This might use the `curlx_strtoll()` function which is provided as source code in strtoofft.c. Note that the function is only provided if no - strtoll() (or equivalent) function exist on your platform. If `curl_off_t` - is only a 32 bit number on your platform, this macro uses strtol(). - -`curlx_tvnow()` ---------------- - returns a struct timeval for the current time. - -`curlx_tvdiff()` --------------- - returns the difference between two timeval structs, in number of - milliseconds. - -`curlx_tvdiff_secs()` ---------------------- - returns the same as `curlx_tvdiff` but with full usec resolution (as a - double) + `strtoll()` (or equivalent) function exist on your platform. If `curl_off_t` + is only a 32-bit number on your platform, this macro uses `strtol()`. Future ------ @@ -656,29 +653,30 @@ Content Encoding ## About content encodings [HTTP/1.1][4] specifies that a client may request that a server encode its - response. This is usually used to compress a response using one of a set of - commonly available compression techniques. These schemes are 'deflate' (the - zlib algorithm), 'gzip' and 'compress'. A client requests that the server - perform an encoding by including an Accept-Encoding header in the request - document. The value of the header should be one of the recognized tokens - 'deflate', ... (there's a way to register new schemes/tokens, see sec 3.5 of - the spec). A server MAY honor the client's encoding request. When a response - is encoded, the server includes a Content-Encoding header in the - response. The value of the Content-Encoding header indicates which scheme was - used to encode the data. - - A client may tell a server that it can understand several different encoding - schemes. In this case the server may choose any one of those and use it to - encode the response (indicating which one using the Content-Encoding header). + response. This is usually used to compress a response using one (or more) + encodings from a set of commonly available compression techniques. These + schemes include `deflate` (the zlib algorithm), `gzip`, `br` (brotli) and + `compress`. A client requests that the server perform an encoding by including + an `Accept-Encoding` header in the request document. The value of the header + should be one of the recognized tokens `deflate`, ... (there's a way to + register new schemes/tokens, see sec 3.5 of the spec). A server MAY honor + the client's encoding request. When a response is encoded, the server + includes a `Content-Encoding` header in the response. The value of the + `Content-Encoding` header indicates which encodings were used to encode the + data, in the order in which they were applied. + It's also possible for a client to attach priorities to different schemes so that the server knows which it prefers. See sec 14.3 of RFC 2616 for more - information on the Accept-Encoding header. + information on the `Accept-Encoding` header. See sec + [3.1.2.2 of RFC 7231][15] for more information on the `Content-Encoding` + header. ## Supported content encodings - The 'deflate' and 'gzip' content encoding are supported by libcurl. Both - regular and chunked transfers work fine. The zlib library is required for - this feature. + The `deflate`, `gzip` and `br` content encodings are supported by libcurl. + Both regular and chunked transfers work fine. The zlib library is required + for the `deflate` and `gzip` encodings, while the brotli decoding library is + for the `br` encoding. ## The libcurl interface @@ -686,44 +684,45 @@ Content Encoding [`curl_easy_setopt`][1](curl, [`CURLOPT_ACCEPT_ENCODING`][5], string) - where string is the intended value of the Accept-Encoding header. + where string is the intended value of the `Accept-Encoding` header. - Currently, libcurl only understands how to process responses that use the - "deflate" or "gzip" Content-Encoding, so the only values for - [`CURLOPT_ACCEPT_ENCODING`][5] that will work (besides "identity," which does - nothing) are "deflate" and "gzip" If a response is encoded using the - "compress" or methods, libcurl will return an error indicating that the - response could not be decoded. If is NULL no Accept-Encoding header - is generated. If is a zero-length string, then an Accept-Encoding + Currently, libcurl does support multiple encodings but only + understands how to process responses that use the `deflate`, `gzip` and/or + `br` content encodings, so the only values for [`CURLOPT_ACCEPT_ENCODING`][5] + that will work (besides `identity`, which does nothing) are `deflate`, + `gzip` and `br`. If a response is encoded using the `compress` or methods, + libcurl will return an error indicating that the response could + not be decoded. If `` is NULL no `Accept-Encoding` header is + generated. If `` is a zero-length string, then an `Accept-Encoding` header containing all supported encodings will be generated. The [`CURLOPT_ACCEPT_ENCODING`][5] must be set to any non-NULL value for content to be automatically decoded. If it is not set and the server still sends encoded content (despite not having been asked), the data is returned - in its raw form and the Content-Encoding type is not checked. + in its raw form and the `Content-Encoding` type is not checked. ## The curl interface - Use the [--compressed][6] option with curl to cause it to ask servers to + Use the [`--compressed`][6] option with curl to cause it to ask servers to compress responses using any format supported by curl. -hostip.c explained -================== +`hostip.c` explained +==================== - The main compile-time defines to keep in mind when reading the host*.c source - file are these: + The main compile-time defines to keep in mind when reading the `host*.c` + source file are these: ## `CURLRES_IPV6` - this host has getaddrinfo() and family, and thus we use that. The host may + this host has `getaddrinfo()` and family, and thus we use that. The host may not be able to resolve IPv6, but we don't really have to take that into account. Hosts that aren't IPv6-enabled have `CURLRES_IPV4` defined. ## `CURLRES_ARES` is defined if libcurl is built to use c-ares for asynchronous name - resolves. This can be Windows or *nix. + resolves. This can be Windows or \*nix. ## `CURLRES_THREADED` @@ -736,20 +735,20 @@ hostip.c explained libcurl is not built to use an asynchronous resolver, `CURLRES_SYNCH` is defined. -## host*.c sources +## `host*.c` sources - The host*.c sources files are split up like this: + The `host*.c` sources files are split up like this: - - hostip.c - method-independent resolver functions and utility functions - - hostasyn.c - functions for asynchronous name resolves - - hostsyn.c - functions for synchronous name resolves - - asyn-ares.c - functions for asynchronous name resolves using c-ares - - asyn-thread.c - functions for asynchronous name resolves using threads - - hostip4.c - IPv4 specific functions - - hostip6.c - IPv6 specific functions + - `hostip.c` - method-independent resolver functions and utility functions + - `hostasyn.c` - functions for asynchronous name resolves + - `hostsyn.c` - functions for synchronous name resolves + - `asyn-ares.c` - functions for asynchronous name resolves using c-ares + - `asyn-thread.c` - functions for asynchronous name resolves using threads + - `hostip4.c` - IPv4 specific functions + - `hostip6.c` - IPv6 specific functions - The hostip.h is the single united header file for all this. It defines the - `CURLRES_*` defines based on the config*.h and `curl_setup.h` defines. + The `hostip.h` is the single united header file for all this. It defines the + `CURLRES_*` defines based on the `config*.h` and `curl_setup.h` defines. Track Down Memory Leaks @@ -761,14 +760,13 @@ Track Down Memory Leaks than one thread. If you want/need to use it in a multi-threaded app. Please adjust accordingly. - ## Build - Rebuild libcurl with -DCURLDEBUG (usually, rerunning configure with - --enable-debug fixes this). 'make clean' first, then 'make' so that all + Rebuild libcurl with `-DCURLDEBUG` (usually, rerunning configure with + `--enable-debug` fixes this). `make clean` first, then `make` so that all files are actually rebuilt properly. It will also make sense to build - libcurl with the debug option (usually -g to the compiler) so that debugging - it will be easier if you actually do find a leak in the library. + libcurl with the debug option (usually `-g` to the compiler) so that + debugging it will be easier if you actually do find a leak in the library. This will create a library that has memory debugging enabled. @@ -776,7 +774,9 @@ Track Down Memory Leaks Add a line in your application code: - `curl_memdebug("dump");` +```c + curl_dbg_memdebug("dump"); +``` This will make the malloc debug system output a full trace of all resource using functions to the given file name. Make sure you rebuild your program @@ -792,7 +792,7 @@ Track Down Memory Leaks ## Analyze the Flow - Use the tests/memanalyze.pl perl script to analyze the dump file: + Use the `tests/memanalyze.pl` perl script to analyze the dump file: tests/memanalyze.pl dump @@ -808,45 +808,46 @@ Track Down Memory Leaks Implementation of the `curl_multi_socket` API - The main ideas of this API are simply: - - 1 - The application can use whatever event system it likes as it gets info - from libcurl about what file descriptors libcurl waits for what action - on. (The previous API returns `fd_sets` which is very select()-centric). - - 2 - When the application discovers action on a single socket, it calls - libcurl and informs that there was action on this particular socket and - libcurl can then act on that socket/transfer only and not care about - any other transfers. (The previous API always had to scan through all - the existing transfers.) - - The idea is that [`curl_multi_socket_action()`][7] calls a given callback - with information about what socket to wait for what action on, and the - callback only gets called if the status of that socket has changed. - - We also added a timer callback that makes libcurl call the application when - the timeout value changes, and you set that with [`curl_multi_setopt()`][9] - and the [`CURLMOPT_TIMERFUNCTION`][10] option. To get this to work, - Internally, there's an added struct to each easy handle in which we store - an "expire time" (if any). The structs are then "splay sorted" so that we - can add and remove times from the linked list and yet somewhat swiftly - figure out both how long there is until the next nearest timer expires - and which timer (handle) we should take care of now. Of course, the upside - of all this is that we get a [`curl_multi_timeout()`][8] that should also - work with old-style applications that use [`curl_multi_perform()`][11]. - - We created an internal "socket to easy handles" hash table that given - a socket (file descriptor) returns the easy handle that waits for action on - that socket. This hash is made using the already existing hash code - (previously only used for the DNS cache). - - To make libcurl able to report plain sockets in the socket callback, we had - to re-organize the internals of the [`curl_multi_fdset()`][12] etc so that - the conversion from sockets to `fd_sets` for that function is only done in - the last step before the data is returned. I also had to extend c-ares to - get a function that can return plain sockets, as that library too returned - only `fd_sets` and that is no longer good enough. The changes done to c-ares - are available in c-ares 1.3.1 and later. + The main ideas of this API are simply: + + 1. The application can use whatever event system it likes as it gets info + from libcurl about what file descriptors libcurl waits for what action + on. (The previous API returns `fd_sets` which is very + `select()`-centric). + + 2. When the application discovers action on a single socket, it calls + libcurl and informs that there was action on this particular socket and + libcurl can then act on that socket/transfer only and not care about + any other transfers. (The previous API always had to scan through all + the existing transfers.) + + The idea is that [`curl_multi_socket_action()`][7] calls a given callback + with information about what socket to wait for what action on, and the + callback only gets called if the status of that socket has changed. + + We also added a timer callback that makes libcurl call the application when + the timeout value changes, and you set that with [`curl_multi_setopt()`][9] + and the [`CURLMOPT_TIMERFUNCTION`][10] option. To get this to work, + Internally, there's an added struct to each easy handle in which we store + an "expire time" (if any). The structs are then "splay sorted" so that we + can add and remove times from the linked list and yet somewhat swiftly + figure out both how long there is until the next nearest timer expires + and which timer (handle) we should take care of now. Of course, the upside + of all this is that we get a [`curl_multi_timeout()`][8] that should also + work with old-style applications that use [`curl_multi_perform()`][11]. + + We created an internal "socket to easy handles" hash table that given + a socket (file descriptor) returns the easy handle that waits for action on + that socket. This hash is made using the already existing hash code + (previously only used for the DNS cache). + + To make libcurl able to report plain sockets in the socket callback, we had + to re-organize the internals of the [`curl_multi_fdset()`][12] etc so that + the conversion from sockets to `fd_sets` for that function is only done in + the last step before the data is returned. I also had to extend c-ares to + get a function that can return plain sockets, as that library too returned + only `fd_sets` and that is no longer good enough. The changes done to c-ares + are available in c-ares 1.3.1 and later. Structs in libcurl @@ -855,40 +856,42 @@ Structs in libcurl This section should cover 7.32.0 pretty accurately, but will make sense even for older and later versions as things don't change drastically that often. + ## Curl_easy The `Curl_easy` struct is the one returned to the outside in the external API - as a "CURL *". This is usually known as an easy handle in API documentations + as a `CURL *`. This is usually known as an easy handle in API documentations and examples. Information and state that is related to the actual connection is in the - 'connectdata' struct. When a transfer is about to be made, libcurl will + `connectdata` struct. When a transfer is about to be made, libcurl will either create a new connection or re-use an existing one. The particular connectdata that is used by this handle is pointed out by `Curl_easy->easy_conn`. Data and information that regard this particular single transfer is put in - the SingleRequest sub-struct. + the `SingleRequest` sub-struct. When the `Curl_easy` struct is added to a multi handle, as it must be in - order to do any transfer, the ->multi member will point to the `Curl_multi` - struct it belongs to. The ->prev and ->next members will then be used by the - multi code to keep a linked list of `Curl_easy` structs that are added to - that same multi handle. libcurl always uses multi so ->multi *will* point to - a `Curl_multi` when a transfer is in progress. + order to do any transfer, the `->multi` member will point to the `Curl_multi` + struct it belongs to. The `->prev` and `->next` members will then be used by + the multi code to keep a linked list of `Curl_easy` structs that are added to + that same multi handle. libcurl always uses multi so `->multi` *will* point + to a `Curl_multi` when a transfer is in progress. - ->mstate is the multi state of this particular `Curl_easy`. When + `->mstate` is the multi state of this particular `Curl_easy`. When `multi_runsingle()` is called, it will act on this handle according to which state it is in. The mstate is also what tells which sockets to return for a specific `Curl_easy` when [`curl_multi_fdset()`][12] is called etc. - The libcurl source code generally use the name 'data' for the variable that + The libcurl source code generally use the name `data` for the variable that points to the `Curl_easy`. When doing multiplexed HTTP/2 transfers, each `Curl_easy` is associated with an individual stream, sharing the same connectdata struct. Multiplexing makes it even more important to keep things associated with the right thing! + ## connectdata A general idea in libcurl is to keep connections around in a connection @@ -896,16 +899,16 @@ for older and later versions as things don't change drastically that often. re-use an existing one instead of creating a new as it creates a significant performance boost. - Each 'connectdata' identifies a single physical connection to a server. If + Each `connectdata` identifies a single physical connection to a server. If the connection can't be kept alive, the connection will be closed after use and then this struct can be removed from the cache and freed. Thus, the same `Curl_easy` can be used multiple times and each time select - another connectdata struct to use for the connection. Keep this in mind, as - it is then important to consider if options or choices are based on the + another `connectdata` struct to use for the connection. Keep this in mind, + as it is then important to consider if options or choices are based on the connection or the `Curl_easy`. - Functions in libcurl will assume that connectdata->data points to the + Functions in libcurl will assume that `connectdata->data` points to the `Curl_easy` that uses this connection (for the moment). As a special complexity, some protocols supported by libcurl require a @@ -920,15 +923,16 @@ for older and later versions as things don't change drastically that often. this single struct and thus can be considered a single connection for most internal concerns. - The libcurl source code generally use the name 'conn' for the variable that + The libcurl source code generally use the name `conn` for the variable that points to the connectdata. + ## Curl_multi Internally, the easy interface is implemented as a wrapper around multi interface functions. This makes everything multi interface. - `Curl_multi` is the multi handle struct exposed as "CURLM *" in external + `Curl_multi` is the multi handle struct exposed as `CURLM *` in external APIs. This struct holds a list of `Curl_easy` structs that have been added to this @@ -955,31 +959,35 @@ for older and later versions as things don't change drastically that often. `->conn_cache` points to the connection cache. It keeps track of all connections that are kept after use. The cache has a maximum size. - `->closure_handle` is described in the 'connectdata' section. + `->closure_handle` is described in the `connectdata` section. - The libcurl source code generally use the name 'multi' for the variable that + The libcurl source code generally use the name `multi` for the variable that points to the `Curl_multi` struct. + ## Curl_handler Each unique protocol that is supported by libcurl needs to provide at least one `Curl_handler` struct. It defines what the protocol is called and what functions the main code should call to deal with protocol specific issues. - In general, there's a source file named [protocol].c in which there's a - "struct `Curl_handler` `Curl_handler_[protocol]`" declared. In url.c there's + In general, there's a source file named `[protocol].c` in which there's a + `struct Curl_handler Curl_handler_[protocol]` declared. In `url.c` there's then the main array with all individual `Curl_handler` structs pointed to from a single array which is scanned through when a URL is given to libcurl to work with. + The concrete function pointer prototypes can be found in `lib/urldata.h`. + `->scheme` is the URL scheme name, usually spelled out in uppercase. That's - "HTTP" or "FTP" etc. SSL versions of the protocol need their own `Curl_handler` setup so HTTPS separate from HTTP. + "HTTP" or "FTP" etc. SSL versions of the protocol need their own + `Curl_handler` setup so HTTPS separate from HTTP. `->setup_connection` is called to allow the protocol code to allocate protocol specific data that then gets associated with that `Curl_easy` for the rest of this transfer. It gets freed again at the end of the transfer. - It will be called before the 'connectdata' for the transfer has been - selected/created. Most protocols will allocate its private - 'struct [PROTOCOL]' here and assign `Curl_easy->req.protop` to point to it. + It will be called before the `connectdata` for the transfer has been + selected/created. Most protocols will allocate its private `struct + [PROTOCOL]` here and assign `Curl_easy->req.p.[protocol]` to it. `->connect_it` allows a protocol to do some specific actions after the TCP connect is done, that can still be considered part of the connection phase. @@ -1006,25 +1014,27 @@ for older and later versions as things don't change drastically that often. `->do_more` gets called during the `DO_MORE` state. The FTP protocol uses this state when setting up the second connection. - ->`proto_getsock` - ->`doing_getsock` - ->`domore_getsock` - ->`perform_getsock` + `->proto_getsock` + `->doing_getsock` + `->domore_getsock` + `->perform_getsock` Functions that return socket information. Which socket(s) to wait for which - action(s) during the particular multi state. + I/O action(s) during the particular multi state. - ->disconnect is called immediately before the TCP connection is shutdown. + `->disconnect` is called immediately before the TCP connection is shutdown. - ->readwrite gets called during transfer to allow the protocol to do extra + `->readwrite` gets called during transfer to allow the protocol to do extra reads/writes - ->defport is the default report TCP or UDP port this protocol uses + `->attach` attaches a transfer to the connection. + + `->defport` is the default report TCP or UDP port this protocol uses - ->protocol is one or more bits in the `CURLPROTO_*` set. The SSL versions + `->protocol` is one or more bits in the `CURLPROTO_*` set. The SSL versions have their "base" protocol set and then the SSL variation. Like "HTTP|HTTPS". - ->flags is a bitmask with additional information about the protocol that will + `->flags` is a bitmask with additional information about the protocol that will make it get treated differently by the generic engine: - `PROTOPT_SSL` - will make it connect and negotiate SSL @@ -1039,7 +1049,7 @@ for older and later versions as things don't change drastically that often. limit which "direction" of socket actions that the main engine will concern itself with. - - `PROTOPT_NONETWORK` - a protocol that doesn't use network (read file:) + - `PROTOPT_NONETWORK` - a protocol that doesn't use network (read `file:`) - `PROTOPT_NEEDSPWD` - this protocol needs a password and will use a default one unless one is provided @@ -1047,16 +1057,18 @@ for older and later versions as things don't change drastically that often. - `PROTOPT_NOURLQUERY` - this protocol can't handle a query part on the URL (?foo=bar) + ## conncache Is a hash table with connections for later re-use. Each `Curl_easy` has a pointer to its connection cache. Each multi handle sets up a connection cache that all added `Curl_easy`s share by default. + ## Curl_share The libcurl share API allocates a `Curl_share` struct, exposed to the - external API as "CURLSH *". + external API as `CURLSH *`. The idea is that the struct can have a set of its own versions of caches and pools and then by providing this struct in the `CURLOPT_SHARE` option, those @@ -1069,25 +1081,27 @@ for older and later versions as things don't change drastically that often. The `Curl_share` struct can currently hold cookies, DNS cache and the SSL session cache. + ## CookieInfo This is the main cookie struct. It holds all known cookies and related - information. Each `Curl_easy` has its own private CookieInfo even when + information. Each `Curl_easy` has its own private `CookieInfo` even when they are added to a multi handle. They can be made to share cookies by using the share API. -[1]: https://curl.haxx.se/libcurl/c/curl_easy_setopt.html -[2]: https://curl.haxx.se/libcurl/c/curl_easy_init.html -[3]: https://c-ares.haxx.se/ +[1]: https://curl.se/libcurl/c/curl_easy_setopt.html +[2]: https://curl.se/libcurl/c/curl_easy_init.html +[3]: https://c-ares.org/ [4]: https://tools.ietf.org/html/rfc7230 "RFC 7230" -[5]: https://curl.haxx.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html -[6]: https://curl.haxx.se/docs/manpage.html#--compressed -[7]: https://curl.haxx.se/libcurl/c/curl_multi_socket_action.html -[8]: https://curl.haxx.se/libcurl/c/curl_multi_timeout.html -[9]: https://curl.haxx.se/libcurl/c/curl_multi_setopt.html -[10]: https://curl.haxx.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html -[11]: https://curl.haxx.se/libcurl/c/curl_multi_perform.html -[12]: https://curl.haxx.se/libcurl/c/curl_multi_fdset.html -[13]: https://curl.haxx.se/libcurl/c/curl_multi_add_handle.html -[14]: https://curl.haxx.se/libcurl/c/curl_multi_info_read.html +[5]: https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html +[6]: https://curl.se/docs/manpage.html#--compressed +[7]: https://curl.se/libcurl/c/curl_multi_socket_action.html +[8]: https://curl.se/libcurl/c/curl_multi_timeout.html +[9]: https://curl.se/libcurl/c/curl_multi_setopt.html +[10]: https://curl.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html +[11]: https://curl.se/libcurl/c/curl_multi_perform.html +[12]: https://curl.se/libcurl/c/curl_multi_fdset.html +[13]: https://curl.se/libcurl/c/curl_multi_add_handle.html +[14]: https://curl.se/libcurl/c/curl_multi_info_read.html +[15]: https://tools.ietf.org/html/rfc7231#section-3.1.2.2 diff --git a/curl/docs/KNOWN_BUGS b/curl/docs/KNOWN_BUGS index 961a6281..ed944fb3 100644 --- a/curl/docs/KNOWN_BUGS +++ b/curl/docs/KNOWN_BUGS @@ -12,48 +12,68 @@ check the changelog of the current development status, as one or more of these problems may have been fixed or changed somewhat since this was written! 1. HTTP - 1.1 CURLFORM_CONTENTLEN in an array - 1.2 Disabling HTTP Pipelining + 1.2 Multiple methods in a single WWW-Authenticate: header 1.3 STARTTRANSFER time is wrong for HTTP POSTs 1.4 multipart formposts file name encoding 1.5 Expect-100 meets 417 1.6 Unnecessary close when 401 received waiting for 100 - 1.9 HTTP/2 frames while in the connection pool kill reuse - 1.10 Strips trailing dot from host name + 1.7 Deflate error after all content was received + 1.8 DoH isn't used for all name resolves when enabled 1.11 CURLOPT_SEEKFUNCTION not called with CURLFORM_STREAM 2. TLS 2.1 CURLINFO_SSL_VERIFYRESULT has limited support 2.2 DER in keychain - 2.3 GnuTLS backend skips really long certificate fields - 2.4 DarwinSSL won't import PKCS#12 client certificates without a password + 2.3 Unable to use PKCS12 certificate with Secure Transport + 2.4 Secure Transport won't import PKCS#12 client certificates without a password + 2.5 Client cert handling with Issuer DN differs between backends + 2.6 CURL_GLOBAL_SSL + 2.7 Client cert (MTLS) issues with Schannel + 2.8 Schannel disable CURLOPT_SSL_VERIFYPEER and verify hostname + 2.9 TLS session cache doesn't work with TFO + 2.10 Store TLS context per transfer instead of per connection + 2.11 Schannel TLS 1.2 handshake bug in old Windows versions + 2.12 FTPS with Schannel times out file list operation + 2.14 Secure Transport disabling hostname validation also disables SNI + 2.15 Renegotiate from server may cause hang for OpenSSL backend 3. Email protocols 3.1 IMAP SEARCH ALL truncated response 3.2 No disconnect command - 3.3 SMTP to multiple recipients - 3.4 POP3 expects "CRLF.CRLF" eob for some single-line responses + 3.3 POP3 expects "CRLF.CRLF" eob for some single-line responses + 3.4 AUTH PLAIN for SMTP is not working on all servers 4. Command line - 4.1 -J with %-encoded file nameas + 4.1 -J and -O with %-encoded file names 4.2 -J with -C - fails 4.3 --retry and transfer timeouts 5. Build and portability issues - 5.1 Windows Borland compiler + 5.1 OS400 port requires deprecated IBM library 5.2 curl-config --libs contains private details - 5.4 AIX shared build with c-ares fails - 5.5 can't handle Unicode arguments in Windows - 5.6 cmake support gaps + 5.3 curl compiled on OSX 10.13 failed to run on OSX 10.10 + 5.4 Build with statically built dependency + 5.5 can't handle Unicode arguments in non-Unicode builds on Windows 5.7 Visual Studio project gaps 5.8 configure finding libs in wrong directory 5.9 Utilize Requires.private directives in libcurl.pc + 5.10 SMB tests fail with Python 2 + 5.11 configure --with-gssapi with Heimdal is ignored on macOS + 5.12 flaky Windows CI builds 6. Authentication 6.1 NTLM authentication and unicode 6.2 MIT Kerberos for Windows build 6.3 NTLM in system context uses wrong name 6.4 Negotiate and Kerberos V5 need a fake user name + 6.5 NTLM doesn't support password with § character + 6.6 libcurl can fail to try alternatives with --proxy-any + 6.7 Don't clear digest for single realm + 6.8 RTSP authentication breaks without redirect support + 6.9 SHA-256 digest not supported in Windows SSPI builds + 6.10 curl never completes Negotiate over HTTP + 6.11 Negotiate on Windows fails + 6.12 Can't use Secure Transport with Crypto Token Kit 7. FTP 7.1 FTP without or slow 220 response @@ -64,50 +84,98 @@ problems may have been fixed or changed somewhat since this was written! 7.6 FTP with NULs in URL parts 7.7 FTP and empty path parts in the URL 7.8 Premature transfer end but healthy control channel + 7.9 Passive transfer tries only one IP address + 7.10 FTPS needs session reuse + 7.11 FTPS upload data loss with TLS 1.3 8. TELNET - 8.1 TELNET and time limtiations don't work + 8.1 TELNET and time limitations don't work 8.2 Microsoft telnet server 9. SFTP and SCP 9.1 SFTP doesn't do CURLOPT_POSTQUOTE correct + 9.2 wolfssh: publickey auth doesn't work + 9.3 Remote recursive folder creation with SFTP 10. SOCKS - 10.1 SOCKS proxy connections are done blocking - 10.2 SOCKS don't support timeouts 10.3 FTPS over SOCKS 10.4 active FTP over a SOCKS 11. Internals 11.1 Curl leaks .onion hostnames in DNS 11.2 error buffer not set if connection to multiple addresses fails - 11.3 c-ares deviates from stock resolver on http://1346569778 + 11.3 Disconnects don't do verbose 11.4 HTTP test server 'connection-monitor' problems - - 12. LDAP and OpenLDAP + 11.5 Connection information when using TCP Fast Open + 11.6 slow connect to localhost on Windows + 11.7 signal-based resolver timeouts + 11.8 DoH leaks memory after followlocation + 11.9 DoH doesn't inherit all transfer options + 11.10 Blocking socket operations in non-blocking API + 11.11 A shared connection cache is not thread-safe + 11.12 'no_proxy' string-matches IPv6 numerical addresses + 11.13 wakeup socket disconnect causes havoc + 11.14 Multi perform hangs waiting for threaded resolver + 11.15 CURLOPT_OPENSOCKETPAIRFUNCTION is missing + 11.16 libcurl uses renames instead of locking for atomic operations + + 12. LDAP 12.1 OpenLDAP hangs after returning results + 12.2 LDAP on Windows does authentication wrong? + 12.3 LDAP on Windows doesn't work + 12.4 LDAPS with NSS is slow 13. TCP/IP 13.1 --interface for ipv6 binds to unusable IP address + 14. DICT + 14.1 DICT responses show the underlying protocol + + 15. CMake + 15.1 use correct SONAME + 15.2 support build with GnuTLS + 15.3 unusable tool_hugehelp.c with MinGW + 15.4 build docs/curl.1 + 15.5 build on Linux links libcurl to libdl + 15.6 uses -lpthread instead of Threads::Threads + 15.7 generated .pc file contains strange entries + 15.8 libcurl.pc uses absolute library paths + 15.9 cert paths autodetected when cross-compiling + 15.10 libspsl is not supported + 15.11 ExternalProject_Add does not set CURL_CA_PATH + 15.12 cannot enable LDAPS on Windows + 15.13 CMake build with MIT Kerberos does not work + + 16. Applications + 16.1 pulseUI VPN client + + 17. HTTP/2 + 17.1 Excessive HTTP/2 packets with TCP_NODELAY + 17.2 HTTP/2 frames while in the connection pool kill reuse + 17.3 ENHANCE_YOUR_CALM causes infinite retries + 17.4 Connection failures with parallel HTTP/2 + + 18. HTTP/3 + 18.1 If the HTTP/3 server closes connection during upload curl hangs + 18.2 Uploading HTTP/3 files gets interrupted at certain file sizes + 18.3 HTTP/3 download is 5x times slower than HTTP/2 + 18.4 Downloading with HTTP/3 produces broken files + 18.5 HTTP/3 download with quiche halts after a while + 18.6 HTTP/3 multipart POST with quiche fails + 18.7 HTTP/3 quiche upload large file fails + 18.8 HTTP/3 doesn't support client certs + 18.9 connection migration doesn't work ============================================================================== 1. HTTP -1.1 CURLFORM_CONTENTLEN in an array - - It is not possible to pass a 64-bit value using CURLFORM_CONTENTLEN with - CURLFORM_ARRAY, when compiled on 32-bit platforms that support 64-bit - integers. This is because the underlying structure 'curl_forms' uses a dual - purpose char* for storing these values in via casting. For more information - see the now closed related issue: - https://github.com/curl/curl/issues/608 +1.2 Multiple methods in a single WWW-Authenticate: header -1.2 Disabling HTTP Pipelining - - Disabling HTTP Pipelining when there are ongoing transfers can lead to - heap corruption and crash. https://curl.haxx.se/bug/view.cgi?id=1411 + The HTTP responses headers WWW-Authenticate: can provide information about + multiple authentication methods as multiple headers or as several methods + within a single header. The latter way, several methods in the same physical + line, is not supported by libcurl's parser. (For no good reason.) 1.3 STARTTRANSFER time is wrong for HTTP POSTs @@ -117,7 +185,7 @@ problems may have been fixed or changed somewhat since this was written! CURLINFO_PRETRANSFER_TIME is near to zero every time. https://github.com/curl/curl/issues/218 - https://curl.haxx.se/bug/view.cgi?id=1213 + https://curl.se/bug/view.cgi?id=1213 1.4 multipart formposts file name encoding @@ -132,58 +200,32 @@ problems may have been fixed or changed somewhat since this was written! If an upload using Expect: 100-continue receives an HTTP 417 response, it ought to be automatically resent without the Expect:. A workaround is for the client application to redo the transfer after disabling Expect:. - https://curl.haxx.se/mail/archive-2008-02/0043.html + https://curl.se/mail/archive-2008-02/0043.html 1.6 Unnecessary close when 401 received waiting for 100 libcurl closes the connection if an HTTP 401 reply is received while it is - waiting for the the 100-continue response. - https://curl.haxx.se/mail/lib-2008-08/0462.html - -1.9 HTTP/2 frames while in the connection pool kill reuse - - If the server sends HTTP/2 frames (like for example an HTTP/2 PING frame) to - curl while the connection is held in curl's connection pool, the socket will - be found readable when considered for reuse and that makes curl think it is - dead and then it will be closed and a new connection gets created instead. - - This is *best* fixed by adding monitoring to connections while they are kept - in the pool so that pings can be responded to appropriately. - -1.10 Strips trailing dot from host name - - When given a URL with a trailing dot for the host name part: - "https://example.com./", libcurl will strip off the dot and use the name - without a dot internally and send it dot-less in HTTP Host: headers and in - the TLS SNI field. - - The HTTP part violates RFC 7230 section 5.4 but the SNI part is accordance - with RFC 6066 section 3. + waiting for the 100-continue response. + https://curl.se/mail/lib-2008-08/0462.html - URLs using these trailing dots are very rare in the wild and we have not seen - or gotten any real-world problems with such URLs reported. The popular - browsers seem to have stayed with not stripping the dot for both uses (thus - they violate RFC 6066 instead of RFC 7230). +1.7 Deflate error after all content was received - Daniel took the discussion to the HTTPbis mailing list in March 2016: - https://lists.w3.org/Archives/Public/ietf-http-wg/2016JanMar/0430.html but - there was not major rush or interest to fix this. The impression I get is - that most HTTP people rather not rock the boat now and instead prioritize web - compatibility rather than to strictly adhere to these RFCs. + There's a situation where we can get an error in a HTTP response that is + compressed, when that error is detected after all the actual body contents + have been received and delivered to the application. This is tricky, but is + ultimately a broken server. - Our current approach allows a knowing client to send a custom HTTP header - with the dot added. + See https://github.com/curl/curl/issues/2719 - It can also be noted that while adding a trailing dot to the host name in - most (all?) cases will make the name resolve to the same set of IP addresses, - many HTTP servers will not happily accept the trailing dot there unless that - has been specifically configured to be a fine virtual host. +1.8 DoH isn't used for all name resolves when enabled - If URLs with trailing dots for host names become more popular or even just - used more than for just plain fun experiments, I'm sure we will have reason - to go back and reconsider. + Even if DoH is specified to be used, there are some name resolves that are + done without it. This should be fixed. When the internal function + `Curl_resolver_wait_resolv()` is called, it doesn't use DoH to complete the + resolve as it otherwise should. - See https://github.com/curl/curl/issues/716 for the discussion. + See https://github.com/curl/curl/pull/3857 and + https://github.com/curl/curl/pull/3850 1.11 CURLOPT_SEEKFUNCTION not called with CURLFORM_STREAM @@ -201,26 +243,122 @@ problems may have been fixed or changed somewhat since this was written! 2.1 CURLINFO_SSL_VERIFYRESULT has limited support - CURLINFO_SSL_VERIFYRESULT is only implemented for the OpenSSL and NSS - backends, so relying on this information in a generic app is flaky. + CURLINFO_SSL_VERIFYRESULT is only implemented for the OpenSSL, NSS and + GnuTLS backends, so relying on this information in a generic app is flaky. 2.2 DER in keychain Curl doesn't recognize certificates in DER format in keychain, but it works - with PEM. https://curl.haxx.se/bug/view.cgi?id=1065 + with PEM. https://curl.se/bug/view.cgi?id=1065 -2.3 GnuTLS backend skips really long certificate fields +2.3 Unable to use PKCS12 certificate with Secure Transport - libcurl calls gnutls_x509_crt_get_dn() with a fixed buffer size and if the - field is too long in the cert, it'll just return an error and the field will - be displayed blank. + See https://github.com/curl/curl/issues/5403 -2.4 DarwinSSL won't import PKCS#12 client certificates without a password +2.4 Secure Transport won't import PKCS#12 client certificates without a password libcurl calls SecPKCS12Import with the PKCS#12 client certificate, but that function rejects certificates that do not have a password. https://github.com/curl/curl/issues/1308 +2.5 Client cert handling with Issuer DN differs between backends + + When the specified client certificate doesn't match any of the + server-specified DNs, the OpenSSL and GnuTLS backends behave differently. + The github discussion may contain a solution. + + See https://github.com/curl/curl/issues/1411 + +2.6 CURL_GLOBAL_SSL + + Since libcurl 7.57.0, the flag CURL_GLOBAL_SSL is a no-op. The change was + merged in https://github.com/curl/curl/commit/d661b0afb571a + + It was removed since it was + + A) never clear for applications on how to deal with init in the light of + different SSL backends (the option was added back in the days when life + was simpler) + + B) multissl introduced dynamic switching between SSL backends which + emphasized (A) even more + + C) libcurl uses some TLS backend functionality even for non-TLS functions (to + get "good" random) so applications trying to avoid the init for + performance reasons would do wrong anyway + + D) never very carefully documented so all this mostly just happened to work + for some users + + However, in spite of the problems with the feature, there were some users who + apparently depended on this feature and who now claim libcurl is broken for + them. The fix for this situation is not obvious as a downright revert of the + patch is totally ruled out due to those reasons above. + + https://github.com/curl/curl/issues/2276 + +2.7 Client cert (MTLS) issues with Schannel + + See https://github.com/curl/curl/issues/3145 + +2.8 Schannel disable CURLOPT_SSL_VERIFYPEER and verify hostname + + This seems to be a limitation in the underlying Schannel API. + + https://github.com/curl/curl/issues/3284 + +2.9 TLS session cache doesn't work with TFO + + See https://github.com/curl/curl/issues/4301 + +2.10 Store TLS context per transfer instead of per connection + + The GnuTLS `backend->cred` and the OpenSSL `backend->ctx` data and their + proxy versions (and possibly other TLS backends), could be better moved to be + stored in the Curl_easy handle instead of in per connection so that a single + transfer that makes multiple connections can reuse the context and reduce + memory consumption. + + https://github.com/curl/curl/issues/5102 + +2.11 Schannel TLS 1.2 handshake bug in old Windows versions + + In old versions of Windows such as 7 and 8.1 the Schannel TLS 1.2 handshake + implementation likely has a bug that can rarely cause the key exchange to + fail, resulting in error SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED. + + https://github.com/curl/curl/issues/5488 + +2.12 FTPS with Schannel times out file list operation + + "Instead of the command completing, it just sits there until the timeout + expires." - the same command line seems to work with other TLS backends and + other operating systems. See https://github.com/curl/curl/issues/5284. + +2.14 Secure Transport disabling hostname validation also disables SNI + + SNI is the hostname that is sent by the TLS library to the server as part of + the TLS handshake. Secure Transport does not send SNI when hostname validation + is disabled. Servers that host multiple websites may not know which + certificate to serve without SNI or which backend server to connect to. The + server may serve the certificate of a default server or abort. + + If a server aborts a handshake then curl shows error "SSL peer handshake + failed, the server most likely requires a client certificate to connect". + In this case the error may also have been caused by lack of SNI. + + https://github.com/curl/curl/issues/6347 + +2.15 Renegotiate from server may cause hang for OpenSSL backend + + A race condition has been observed when, immediately after the initial + handshake, curl has sent an HTTP request to the server and at the same time + the server has sent a TLS hello request (renegotiate) to curl. Both are + waiting for the other to respond. OpenSSL is supposed to send a handshake + response but doesn't. + + https://github.com/curl/curl/issues/6785 + https://github.com/openssl/openssl/issues/14722 3. Email protocols @@ -229,31 +367,29 @@ problems may have been fixed or changed somewhat since this was written! IMAP "SEARCH ALL" truncates output on large boxes. "A quick search of the code reveals that pingpong.c contains some truncation code, at line 408, when it deems the server response to be too large truncating it to 40 characters" - https://curl.haxx.se/bug/view.cgi?id=1366 + https://curl.se/bug/view.cgi?id=1366 3.2 No disconnect command The disconnect commands (LOGOUT and QUIT) may not be sent by IMAP, POP3 and SMTP if a failure occurs during the authentication phase of a connection. -3.3 SMTP to multiple recipients - - When sending data to multiple recipients, curl will abort and return failure - if one of the recipients indicate failure (on the "RCPT TO" - command). Ordinary mail programs would proceed and still send to the ones - that can receive data. This is subject for change in the future. - https://curl.haxx.se/bug/view.cgi?id=1116 - -3.4 POP3 expects "CRLF.CRLF" eob for some single-line responses +3.3 POP3 expects "CRLF.CRLF" eob for some single-line responses You have to tell libcurl not to expect a body, when dealing with one line response commands. Please see the POP3 examples and test cases which show - this for the NOOP and DELE commands. https://curl.haxx.se/bug/?i=740 + this for the NOOP and DELE commands. https://curl.se/bug/?i=740 + +3.4 AUTH PLAIN for SMTP is not working on all servers + Specifying "--login-options AUTH=PLAIN" on the command line doesn't seem to + work correctly. + + See https://github.com/curl/curl/issues/4080 4. Command line -4.1 -J with %-encoded file nameas +4.1 -J and -O with %-encoded file names -J/--remote-header-name doesn't decode %-encoded file names. RFC6266 details how it should be done. The can of worm is basically that we have no charset @@ -261,7 +397,14 @@ problems may have been fixed or changed somewhat since this was written! decoding also means that we need to check for nastiness that is attempted, like "../" sequences and the like. Probably everything to the left of any embedded slashes should be cut off. - https://curl.haxx.se/bug/view.cgi?id=1294 + https://curl.se/bug/view.cgi?id=1294 + + -O also doesn't decode %-encoded names, and while it has even less + information about the charset involved the process is similar to the -J case. + + Note that we won't add decoding to -O without the user asking for it with + some other means as well, since -O has always been documented to use the name + exactly as specified in the URL. 4.2 -J with -C - fails @@ -269,7 +412,7 @@ problems may have been fixed or changed somewhat since this was written! -" fails. Without -J the same command line works! This happens because the resume logic is worked out before the target file name (and thus its pre-transfer size) has been figured out! - https://curl.haxx.se/bug/view.cgi?id=1169 + https://curl.se/bug/view.cgi?id=1169 4.3 --retry and transfer timeouts @@ -277,17 +420,18 @@ problems may have been fixed or changed somewhat since this was written! -y/-Y) the next attempt doesn't resume the transfer properly from what was downloaded in the previous attempt but will truncate and restart at the original position where it was at before the previous failed attempt. See - https://curl.haxx.se/mail/lib-2008-01/0080.html and Mandriva bug report + https://curl.se/mail/lib-2008-01/0080.html and Mandriva bug report https://qa.mandriva.com/show_bug.cgi?id=22565 - 5. Build and portability issues -5.1 Windows Borland compiler +5.1 OS400 port requires deprecated IBM library - When building with the Windows Borland compiler, it fails because the "tlib" - tool doesn't support hyphens (minus signs) in file names and we have such in - the build. https://curl.haxx.se/bug/view.cgi?id=1222 + curl for OS400 requires QADRT to build, which provides ASCII wrappers for + libc/POSIX functions in the ILE, but IBM no longer supports or even offers + this library to download. + + See https://github.com/curl/curl/issues/5176 5.2 curl-config --libs contains private details @@ -295,31 +439,44 @@ problems may have been fixed or changed somewhat since this was written! run that might be needed only for building libcurl. Further, curl-config --cflags suffers from the same effects with CFLAGS/CPPFLAGS. -5.4 AIX shared build with c-ares fails +5.3 curl compiled on OSX 10.13 failed to run on OSX 10.10 - curl version 7.12.2 fails on AIX if compiled with --enable-ares. The - workaround is to combine --enable-ares with --disable-shared + See https://github.com/curl/curl/issues/2905 -5.5 can't handle Unicode arguments in Windows +5.4 Build with statically built dependency - If a URL or filename can't be encoded using the user's current codepage then - it can only be encoded properly in the Unicode character set. Windows uses - UTF-16 encoding for Unicode and stores it in wide characters, however curl - and libcurl are not equipped for that at the moment. And, except for Cygwin, - Windows can't use UTF-8 as a locale. + The build scripts in curl (autotools, cmake and others) are primarily done to + work with shared/dynamic third party dependencies. When linking with shared + libraries, the dependency "chain" is handled automatically by the library + loader - on all modern systems. + + If you instead link with a static library, we need to provide all the + dependency libraries already at the link command line. + + Figuring out all the dependency libraries for a given library is hard, as it + might also involve figuring out the dependencies of the dependencies and they + may vary between platforms and even change between versions. + + When using static dependencies, the build scripts will mostly assume that + you, the user, will provide all the necessary additional dependency libraries + as additional arguments in the build. With configure, by setting LIBS/LDFLAGS + on the command line. - https://curl.haxx.se/bug/?i=345 - https://curl.haxx.se/bug/?i=731 + We welcome help to improve curl's ability to link with static libraries, but + it is likely a task that we can never fully support. -5.6 cmake support gaps +5.5 can't handle Unicode arguments in non-Unicode builds on Windows - The cmake build setup lacks several features that the autoconf build - offers. This includes: + If a URL or filename can't be encoded using the user's current codepage then + it can only be encoded properly in the Unicode character set. Windows uses + UTF-16 encoding for Unicode and stores it in wide characters, however curl + and libcurl are not equipped for that at the moment except when built with + _UNICODE and UNICODE defined. And, except for Cygwin, Windows can't use UTF-8 + as a locale. - - use of correct soname for the shared library build - - support for several TLS backends are missing - - the unit tests cause link failures in regular non-static builds - - no nghttp2 check + https://curl.se/bug/?i=345 + https://curl.se/bug/?i=731 + https://curl.se/bug/?i=3747 5.7 Visual Studio project gaps @@ -356,18 +513,40 @@ problems may have been fixed or changed somewhat since this was written! https://github.com/curl/curl/issues/864 +5.10 SMB tests fail with Python 2 + + The error message says "TreeConnectAndX not found". + + See https://github.com/curl/curl/issues/5983 + +5.11 configure --with-gssapi with Heimdal is ignored on macOS + + ... unless you also pass --with-gssapi-libs + + https://github.com/curl/curl/issues/3841 + +5.12 flaky Windows CI builds + + We run many CI builds for each commit and PR on github, and especially a + number of the Windows builds are very flaky. This means that we rarely get + all CI builds go green and complete without errors. This is very unfortunate + as it makes us sometimes miss actual build problems and it is surprising to + newcomers to the project who (rightfully) don't expect this. + + See https://github.com/curl/curl/issues/6972 + 6. Authentication 6.1 NTLM authentication and unicode NTLM authentication involving unicode user name or password only works - properly if built with UNICODE defined together with the WinSSL/schannel + properly if built with UNICODE defined together with the Schannel backend. The original problem was mentioned in: - https://curl.haxx.se/mail/lib-2009-10/0024.html - https://curl.haxx.se/bug/view.cgi?id=896 + https://curl.se/mail/lib-2009-10/0024.html + https://curl.se/bug/view.cgi?id=896 - The WinSSL/schannel version verified to work as mentioned in - https://curl.haxx.se/mail/lib-2012-07/0073.html + The Schannel version verified to work as mentioned in + https://curl.se/mail/lib-2012-07/0073.html 6.2 MIT Kerberos for Windows build @@ -379,7 +558,7 @@ problems may have been fixed or changed somewhat since this was written! NTLM authentication using SSPI (on Windows) when (lib)curl is running in "system context" will make it use wrong(?) user name - at least when compared - to what winhttp does. See https://curl.haxx.se/bug/view.cgi?id=535 + to what winhttp does. See https://curl.se/bug/view.cgi?id=535 6.4 Negotiate and Kerberos V5 need a fake user name @@ -387,12 +566,68 @@ problems may have been fixed or changed somewhat since this was written! V5 in the e-mail protocols, you need to provide a (fake) user name (this concerns both curl and the lib) because the code wrongly only considers authentication if there's a user name provided by setting - conn->bits.user_passwd in url.c https://curl.haxx.se/bug/view.cgi?id=440 How? - https://curl.haxx.se/mail/lib-2004-08/0182.html A possible solution is to + conn->bits.user_passwd in url.c https://curl.se/bug/view.cgi?id=440 How? + https://curl.se/mail/lib-2004-08/0182.html A possible solution is to either modify this variable to be set or introduce a variable such as new conn->bits.want_authentication which is set when any of the authentication options are set. +6.5 NTLM doesn't support password with § character + + https://github.com/curl/curl/issues/2120 + +6.6 libcurl can fail to try alternatives with --proxy-any + + When connecting via a proxy using --proxy-any, a failure to establish an + authentication will cause libcurl to abort trying other options if the + failed method has a higher preference than the alternatives. As an example, + --proxy-any against a proxy which advertise Negotiate and NTLM, but which + fails to set up Kerberos authentication won't proceed to try authentication + using NTLM. + + https://github.com/curl/curl/issues/876 + +6.7 Don't clear digest for single realm + + https://github.com/curl/curl/issues/3267 + +6.8 RTSP authentication breaks without redirect support + + RTSP authentication broke in 7.66.0. A work-around is to enable RTSP in + CURLOPT_REDIR_PROTOCOLS. Authentication should however not be considered an + actual redirect so a "proper" fix needs to be different and not require users + to allow redirects to RTSP to work. + + See https://github.com/curl/curl/pull/4750 + +6.9 SHA-256 digest not supported in Windows SSPI builds + + Windows builds of curl that have SSPI enabled use the native Windows API calls + to create authentication strings. The call to InitializeSecurityContext fails + with SEC_E_QOP_NOT_SUPPORTED which causes curl to fail with CURLE_AUTH_ERROR. + + Microsoft does not document supported digest algorithms and that SEC_E error + code is not a documented error for InitializeSecurityContext (digest). + + https://github.com/curl/curl/issues/6302 + +6.10 curl never completes Negotiate over HTTP + + Apparently it isn't working correctly...? + + See https://github.com/curl/curl/issues/5235 + +6.11 Negotiate on Windows fails + + When using --negotiate (or NTLM) with curl on Windows, SSL/TSL handshake + fails despite having a valid kerberos ticket cached. Works without any issue + in Unix/Linux. + + https://github.com/curl/curl/issues/5881 + +6.12 Can't use Secure Transport with Crypto Token Kit + + https://github.com/curl/curl/issues/7048 7. FTP @@ -403,7 +638,7 @@ problems may have been fixed or changed somewhat since this was written! connection timeout during that phase but only the "real" timeout - which may surprise users as it is probably considered to be the connect phase to most people. Brought up (and is being misunderstood) in: - https://curl.haxx.se/bug/view.cgi?id=856 + https://curl.se/bug/view.cgi?id=856 7.2 FTP with CONNECT and slow server @@ -417,14 +652,14 @@ problems may have been fixed or changed somewhat since this was written! It seems sensible to be able to use CURLOPT_NOBODY and CURLOPT_FAILONERROR with FTP to detect if a file exists or not, but it is not working: - https://curl.haxx.se/mail/lib-2008-07/0295.html + https://curl.se/mail/lib-2008-07/0295.html 7.4 FTP with ACCT When doing an operation over FTP that requires the ACCT command (but not when logging in), the operation will fail since libcurl doesn't detect this and thus fails to issue the correct command: - https://curl.haxx.se/bug/view.cgi?id=635 + https://curl.se/bug/view.cgi?id=635 7.5 ASCII FTP @@ -472,17 +707,53 @@ problems may have been fixed or changed somewhat since this was written! alive even in this situation - but the current code doesn't. Fixing this would allow libcurl to reuse FTP connections better. +7.9 Passive transfer tries only one IP address + + When doing FTP operations through a proxy at localhost, the reported spotted + that curl only tried to connect once to the proxy, while it had multiple + addresses and a failed connect on one address should make it try the next. + + After switching to passive mode (EPSV), curl should try all IP addresses for + "localhost". Currently it tries ::1, but it should also try 127.0.0.1. + + See https://github.com/curl/curl/issues/1508 + +7.10 FTPS needs session reuse + + When the control connection is reused for a subsequent transfer, some FTPS + servers complain about "missing session reuse" for the data channel for the + second transfer. + + https://github.com/curl/curl/issues/4654 + +7.11 FTPS upload data loss with TLS 1.3 + + During FTPS upload curl does not attempt to read TLS handshake messages sent + after the initial handshake. OpenSSL servers running TLS 1.3 may send such a + message. When curl closes the upload connection if unread data has been + received (such as a TLS handshake message) then the TCP protocol sends an + RST to the server, which may cause the server to discard or truncate the + upload if it hasn't read all sent data yet, and then return an error to curl + on the control channel connection. + + Since 7.78.0 this is mostly fixed. curl will do a single read before closing + TLS connections (which causes the TLS library to read handshake messages), + however there is still possibility of an RST if more messages need to be read + or a message arrives after the read but before close (network race condition). + + https://github.com/curl/curl/issues/6149 + 8. TELNET -8.1 TELNET and time limtiations don't work +8.1 TELNET and time limitations don't work When using telnet, the time limitation options don't work. - https://curl.haxx.se/bug/view.cgi?id=846 + https://curl.se/bug/view.cgi?id=846 8.2 Microsoft telnet server There seems to be a problem when connecting to the Microsoft telnet server. - https://curl.haxx.se/bug/view.cgi?id=649 + https://curl.se/bug/view.cgi?id=649 9. SFTP and SCP @@ -494,25 +765,25 @@ problems may have been fixed or changed somewhat since this was written! instead the connection is "cancelled" (the operation is considered done) prematurely. There is a half-baked (busy-looping) patch provided in the bug report but it cannot be accepted as-is. See - https://curl.haxx.se/bug/view.cgi?id=748 + https://curl.se/bug/view.cgi?id=748 +9.2 wolfssh: publickey auth doesn't work -10. SOCKS + When building curl to use the wolfSSH backend for SFTP, the publickey + authentication doesn't work. This is simply functionality not written for curl + yet, the necessary API for make this work is provided by wolfSSH. + + See https://github.com/curl/curl/issues/4820 -10.1 SOCKS proxy connections are done blocking +9.3 Remote recursive folder creation with SFTP - Both SOCKS5 and SOCKS4 proxy connections are done blocking, which is very bad - when used with the multi interface. + On this servers, the curl fails to create directories on the remote server + even when CURLOPT_FTP_CREATE_MISSING_DIRS option is set. -10.2 SOCKS don't support timeouts + See https://github.com/curl/curl/issues/5204 - The SOCKS4 connection codes don't properly acknowledge (connect) timeouts. - According to bug #1556528, even the SOCKS5 connect code does not do it right: - https://curl.haxx.se/bug/view.cgi?id=604 - When connecting to a SOCK proxy, the (connect) timeout is not properly - acknowledged after the actual TCP connect (during the SOCKS "negotiate" - phase). +10. SOCKS 10.3 FTPS over SOCKS @@ -540,17 +811,23 @@ problems may have been fixed or changed somewhat since this was written! CURLE_COULDNT_CONNECT. But the error buffer set by CURLOPT_ERRORBUFFER remains empty. Issue: https://github.com/curl/curl/issues/544 -11.3 c-ares deviates from stock resolver on http://1346569778 +11.3 Disconnects don't do verbose - When using the socket resolvers, that URL becomes: + Due to how libcurl keeps connections alive in the "connection pool" after use + to potentially transcend the life-time of the initial easy handle that was + used to drive the transfer over that connection, it uses a *separate* and + internal easy handle when it shuts down the connection. That separate + connection might not have the exact same settings as the original easy + handle, and in particular it is often note-worthy that it doesn't have the + same VERBOSE and debug callbacks setup so that an application will not get + the protocol data for the disconnect phase of a transfer the same way it got + all the other data. - * Rebuilt URL to: http://1346569778/ - * Trying 80.67.6.50... + This is because the original easy handle might have already been freed at that + point and the application might not at all be prepared that the callback + would get called again long after the handle was freed. - but with c-ares it instead says "Could not resolve: 1346569778 (Domain name - not found)" - - See https://github.com/curl/curl/issues/893 + See for example https://github.com/curl/curl/issues/6995 11.4 HTTP test server 'connection-monitor' problems @@ -559,8 +836,117 @@ problems may have been fixed or changed somewhat since this was written! See https://github.com/curl/curl/issues/868 +11.5 Connection information when using TCP Fast Open + + CURLINFO_LOCAL_PORT (and possibly a few other) fails when TCP Fast Open is + enabled. + + See https://github.com/curl/curl/issues/1332 and + https://github.com/curl/curl/issues/4296 + +11.6 slow connect to localhost on Windows + + When connecting to "localhost" on Windows, curl will resolve the name for + both ipv4 and ipv6 and try to connect to both happy eyeballs-style. Something + in there does however make it take 200 milliseconds to succeed - which is the + HAPPY_EYEBALLS_TIMEOUT define exactly. Lowering that define speeds up the + connection, suggesting a problem in the HE handling. + + If we can *know* that we're talking to a local host, we should lower the + happy eyeballs delay timeout for IPv6 (related: hardcode the "localhost" + addresses, mentioned in TODO). Possibly we should reduce that delay for all. + + https://github.com/curl/curl/issues/2281 -12. LDAP and OpenLDAP +11.7 signal-based resolver timeouts + + libcurl built without an asynchronous resolver library uses alarm() to time + out DNS lookups. When a timeout occurs, this causes libcurl to jump from the + signal handler back into the library with a sigsetjmp, which effectively + causes libcurl to continue running within the signal handler. This is + non-portable and could cause problems on some platforms. A discussion on the + problem is available at https://curl.se/mail/lib-2008-09/0197.html + + Also, alarm() provides timeout resolution only to the nearest second. alarm + ought to be replaced by setitimer on systems that support it. + +11.8 DoH leaks memory after followlocation + + https://github.com/curl/curl/issues/4592 + +11.9 DoH doesn't inherit all transfer options + + Some options are not inherited because they are not relevant for the DoH SSL + connections, or inheriting the option may result in unexpected behavior. For + example the user's debug function callback is not inherited because it would + be unexpected for internal handles (ie DoH handles) to be passed to that + callback. + + If an option is not inherited then it is not possible to set it separately for + DoH without a DoH-specific option. For example: CURLOPT_DOH_SSL_VERIFYHOST, + CURLOPT_DOH_SSL_VERIFYPEER and CURLOPT_DOH_SSL_VERIFYSTATUS. + + See https://github.com/curl/curl/issues/6605 + +11.10 Blocking socket operations in non-blocking API + + The list of blocking socket operations is in TODO section "More non-blocking". + +11.11 A shared connection cache is not thread-safe + + The share interface offers CURL_LOCK_DATA_CONNECT to have multiple easy + handle share a connection cache, but due to how connections are used they are + still not thread-safe when used shared. + + See https://github.com/curl/curl/issues/4915 and lib1541.c + +11.12 'no_proxy' string-matches IPv6 numerical addresses + + This has the downside that "::1" for example doesn't match "::0:1" even + though they are in fact the same address. + + See https://github.com/curl/curl/issues/5745 + +11.13 wakeup socket disconnect causes havoc + + waking an iPad breaks the wakeup socket pair, triggering a POLLIN event and + resulting in SOCKERRNO being set to ENOTCONN. + + This condition, and other possible error conditions on the wakeup socket, are + not handled, so the condition remains on the FD and curl_multi_poll will + never block again. + + See https://github.com/curl/curl/issues/6132 and + https://github.com/curl/curl/pull/6133 + +11.14 Multi perform hangs waiting for threaded resolver + + If a threaded resolver takes a long time to complete, libcurl can be blocked + waiting for it for a longer time than expected - and longer than the set + timeouts. + + See https://github.com/curl/curl/issues/2975 and + https://github.com/curl/curl/issues/4852 + +11.15 CURLOPT_OPENSOCKETPAIRFUNCTION is missing + + When libcurl creates sockets with socketpair(), those are not "exposed" in + CURLOPT_OPENSOCKETFUNCTION and therefore might surprise and be unknown to + applications that expects and wants all sockets known beforehand. One way to + address this issue is to introduce a CURLOPT_OPENSOCKETPAIRFUNCTION callback. + + https://github.com/curl/curl/issues/5747 + +11.16 libcurl uses renames instead of locking for atomic operations + + For saving cookies, alt-svc and hsts files. This is bad when for example the + file is stored in a directory where the application has no write permission + but it has permission for the file. + + https://github.com/curl/curl/issues/6882 + https://github.com/curl/curl/pull/6884 + +12. LDAP 12.1 OpenLDAP hangs after returning results @@ -579,8 +965,22 @@ problems may have been fixed or changed somewhat since this was written! Generic LDAP is synchronous: OK. See https://github.com/curl/curl/issues/622 and - https://curl.haxx.se/mail/lib-2016-01/0101.html + https://curl.se/mail/lib-2016-01/0101.html + +12.2 LDAP on Windows does authentication wrong? + + https://github.com/curl/curl/issues/3116 + +12.3 LDAP on Windows doesn't work + A simple curl command line getting "ldap://ldap.forumsys.com" returns an + error that says "no memory" ! + + https://github.com/curl/curl/issues/4261 + +12.4 LDAPS with NSS is slow + + See https://github.com/curl/curl/issues/5874 13. TCP/IP @@ -591,3 +991,180 @@ problems may have been fixed or changed somewhat since this was written! locally scoped address as that is bound to fail. https://github.com/curl/curl/issues/686 + +14. DICT + +14.1 DICT responses show the underlying protocol + + When getting a DICT response, the protocol parts of DICT aren't stripped off + from the output. + + https://github.com/curl/curl/issues/1809 + +15. CMake + +15.1 use correct SONAME + + The autotools build sets the SONAME properly according to VERSIONINFO in + lib/Makefile.am and so should cmake to make comparable build. + + See https://github.com/curl/curl/pull/5935 + +15.2 support build with GnuTLS + +15.3 unusable tool_hugehelp.c with MinGW + + see https://github.com/curl/curl/issues/3125 + +15.4 build docs/curl.1 + + The cmake build doesn't create the docs/curl.1 file and therefor must rely on + it being there already. This makes the --manual option not work and test + cases like 1139 can't function. + +15.5 build on Linux links libcurl to libdl + + ... which it shouldn't need to! + + See https://github.com/curl/curl/issues/6165 + +15.6 uses -lpthread instead of Threads::Threads + + See https://github.com/curl/curl/issues/6166 + +15.7 generated .pc file contains strange entries + + The Libs.private field of the generated .pc file contains -lgcc -lgcc_s -lc + -lgcc -lgcc_s + + See https://github.com/curl/curl/issues/6167 + +15.8 libcurl.pc uses absolute library paths + + The libcurl.pc file generated by cmake contains things like Libs.private: + /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so. The + autotools equivalent would say Libs.private: -lssl -lcrypto -lz + + See https://github.com/curl/curl/issues/6169 + +15.9 cert paths autodetected when cross-compiling + + The autotools build disables the ca_path/ca_bundle detection when + cross-compiling. The cmake build keeps doing the detection. + + See https://github.com/curl/curl/issues/6178 + +15.10 libspsl is not supported + + See https://github.com/curl/curl/issues/6214 + +15.11 ExternalProject_Add does not set CURL_CA_PATH + + CURL_CA_BUNDLE and CURL_CA_PATH are not set properly when cmake's + ExternalProject_Add is used to build curl as a dependency. + + See https://github.com/curl/curl/issues/6313 + +15.12 cannot enable LDAPS on Windows + + See https://github.com/curl/curl/issues/6284 + +15.13 CMake build with MIT Kerberos does not work + + Minimum CMake version was bumped in curl 7.71.0 (#5358) Since CMake 3.2 + try_compile started respecting the CMAKE_EXE_FLAGS. The code dealing with + MIT Kerberos detection sets few variables to potentially weird mix of space, + and ;-separated flags. It had to blow up at some point. All the CMake checks + that involve compilation are doomed from that point, the configured tree + cannot be built. + + https://github.com/curl/curl/issues/6904 + +16. Applications + +16.1 pulseUI VPN client + + This application crashes at startup with libcurl 7.74.0 (and presumably later + versions too) after we cleaned up OpenSSL initialization. Since this is the + only known application to do this, we suspect it is related to something they + are doing in their setup that isn't kosher. We have not been able to get in + contact with them nor got any technical details to help us debug this + further. + + See + https://community.pulsesecure.net/t5/Pulse-Desktop-Clients/Linux-Pulse-Client-does-not-work-with-curl-7-74/m-p/44378 + and https://github.com/curl/curl/issues/6306 + +17. HTTP/2 + +17.1 Excessive HTTP/2 packets with TCP_NODELAY + + Because of how curl sets TCP_NODELAY by default, HTTP/2 requests are issued + using more separate TCP packets than it would otherwise need to use. This + means spending more bytes than it has to. Just disabling TCP_NODELAY for + HTTP/2 is also not the correct fix because that then makes the outgoing + packets to get delayed. + + See https://github.com/curl/curl/issues/6363 + +17.2 HTTP/2 frames while in the connection pool kill reuse + + If the server sends HTTP/2 frames (like for example an HTTP/2 PING frame) to + curl while the connection is held in curl's connection pool, the socket will + be found readable when considered for reuse and that makes curl think it is + dead and then it will be closed and a new connection gets created instead. + + This is *best* fixed by adding monitoring to connections while they are kept + in the pool so that pings can be responded to appropriately. + +17.3 ENHANCE_YOUR_CALM causes infinite retries + + Infinite retries with 2 parallel requests on one connection receiving GOAWAY + with ENHANCE_YOUR_CALM error code. + + See https://github.com/curl/curl/issues/5119 + +17.4 Connection failures with parallel HTTP/2 + + See https://github.com/curl/curl/issues/5611 + + +18. HTTP/3 + +18.1 If the HTTP/3 server closes connection during upload curl hangs + + See https://github.com/curl/curl/issues/6606 + +18.2 Uploading HTTP/3 files gets interrupted at certain file sizes + + See https://github.com/curl/curl/issues/6510 + +18.3 HTTP/3 download is 5x times slower than HTTP/2 + + See https://github.com/curl/curl/issues/6494 + +18.4 Downloading with HTTP/3 produces broken files + + See https://github.com/curl/curl/issues/7351 + +18.5 HTTP/3 download with quiche halts after a while + + See https://github.com/curl/curl/issues/7339 + +18.6 HTTP/3 multipart POST with quiche fails + + https://github.com/curl/curl/issues/7125 + +18.7 HTTP/3 quiche upload large file fails + + https://github.com/curl/curl/issues/7532 + +18.8 HTTP/3 doesn't support client certs + + aka "mutual authentication". + + https://github.com/curl/curl/issues/7625 + +18.9 connection migration doesn't work + + https://github.com/curl/curl/issues/7695 diff --git a/curl/docs/LICENSE-MIXING.md b/curl/docs/LICENSE-MIXING.md deleted file mode 100644 index 5376bdb7..00000000 --- a/curl/docs/LICENSE-MIXING.md +++ /dev/null @@ -1,127 +0,0 @@ -License Mixing -============== - -libcurl can be built to use a fair amount of various third party libraries, -libraries that are written and provided by other parties that are distributed -using their own licenses. Even libcurl itself contains code that may cause -problems to some. This document attempts to describe what licenses libcurl and -the other libraries use and what possible dilemmas linking and mixing them all -can lead to for end users. - -I am not a lawyer and this is not legal advice! - -One common dilemma is that [GPL](https://www.gnu.org/licenses/gpl.html) -licensed code is not allowed to be linked with code licensed under the -[Original BSD license](https://spdx.org/licenses/BSD-4-Clause.html) (with the -announcement clause). You may still build your own copies that use them all, -but distributing them as binaries would be to violate the GPL license - unless -you accompany your license with an -[exception](https://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs). This -particular problem was addressed when the [Modified BSD -license](https://opensource.org/licenses/BSD-3-Clause) was created, which does -not have the announcement clause that collides with GPL. - -## libcurl - - Uses an [MIT style license](https://curl.haxx.se/docs/copyright.html) that is - very liberal. - -## OpenSSL - - (May be used for SSL/TLS support) Uses an Original BSD-style license with an - announcement clause that makes it "incompatible" with GPL. You are not - allowed to ship binaries that link with OpenSSL that includes GPL code - (unless that specific GPL code includes an exception for OpenSSL - a habit - that is growing more and more common). If OpenSSL's licensing is a problem - for you, consider using another TLS library. - -## GnuTLS - - (May be used for SSL/TLS support) Uses the - [LGPL](https://www.gnu.org/licenses/lgpl.html) license. If this is a problem - for you, consider using another TLS library. Also note that GnuTLS itself - depends on and uses other libs (libgcrypt and libgpg-error) and they too are - LGPL- or GPL-licensed. - -## WolfSSL - - (May be used for SSL/TLS support) Uses the GPL license or a proprietary - license. If this is a problem for you, consider using another TLS library. - -## NSS - - (May be used for SSL/TLS support) Is covered by the - [MPL](https://www.mozilla.org/MPL/) license, the GPL license and the LGPL - license. You may choose to license the code under MPL terms, GPL terms, or - LGPL terms. These licenses grant you different permissions and impose - different obligations. You should select the license that best meets your - needs. - -## axTLS - - (May be used for SSL/TLS support) Uses a Modified BSD-style license. - -## mbedTLS - - (May be used for SSL/TLS support) Uses the [Apache 2.0 - license](https://opensource.org/licenses/Apache-2.0) or the GPL license. - You may choose to license the code under Apache 2.0 terms or GPL terms. - These licenses grant you different permissions and impose different - obligations. You should select the license that best meets your needs. - -## BoringSSL - - (May be used for SSL/TLS support) As an OpenSSL fork, it has the same - license as that. - -## libressl - - (May be used for SSL/TLS support) As an OpenSSL fork, it has the same - license as that. - -## c-ares - - (Used for asynchronous name resolves) Uses an MIT license that is very - liberal and imposes no restrictions on any other library or part you may link - with. - -## zlib - - (Used for compressed Transfer-Encoding support) Uses an MIT-style license - that shouldn't collide with any other library. - -## MIT Kerberos - - (May be used for GSS support) MIT licensed, that shouldn't collide with any - other parts. - -## Heimdal - - (May be used for GSS support) Heimdal is Original BSD licensed with the - announcement clause. - -## GNU GSS - - (May be used for GSS support) GNU GSS is GPL licensed. Note that you may not - distribute binary curl packages that uses this if you build curl to also link - and use any Original BSD licensed libraries! - -## libidn - - (Used for IDNA support) Uses the GNU Lesser General Public License [3]. LGPL - is a variation of GPL with slightly less aggressive "copyleft". This license - requires more requirements to be met when distributing binaries, see the - license for details. Also note that if you distribute a binary that includes - this library, you must also include the full LGPL license text. Please - properly point out what parts of the distributed package that the license - addresses. - -## OpenLDAP - - (Used for LDAP support) Uses a Modified BSD-style license. Since libcurl uses - OpenLDAP as a shared library only, I have not heard of anyone that ships - OpenLDAP linked with libcurl in an app. - -## libssh2 - - (Used for scp and sftp support) libssh2 uses a Modified BSD-style license. diff --git a/curl/docs/MAIL-ETIQUETTE b/curl/docs/MAIL-ETIQUETTE index 54f1090b..80d06b64 100644 --- a/curl/docs/MAIL-ETIQUETTE +++ b/curl/docs/MAIL-ETIQUETTE @@ -34,7 +34,7 @@ MAIL ETIQUETTE 1.1 Mailing Lists The mailing lists we have are all listed and described at - https://curl.haxx.se/mail/ + https://curl.se/mail/ Each mailing list is targeted to a specific set of users and subjects, please use the one or the ones that suit you the most. @@ -170,7 +170,7 @@ MAIL ETIQUETTE send your email to. Your email as sent to a curl mailing list will end up in mail archives, on - the curl web site and elsewhere, for others to see and read. Today and in + the curl website and elsewhere, for others to see and read. Today and in the future. In addition to the archives, the mail is sent out to thousands of individuals. There is no way to undo a sent email. @@ -179,8 +179,8 @@ MAIL ETIQUETTE or just remove them completely from the mail. Note that this includes base64 encoded HTTP Basic auth headers. - This public nature of the curl mailing lists makes automaticly inserted mail - footers about mails being "private" or "only meant for the receipient" or + This public nature of the curl mailing lists makes automatically inserted mail + footers about mails being "private" or "only meant for the recipient" or similar even more silly than usual. Because they are absolutely not private when sent to a public mailing list. diff --git a/curl/docs/MANUAL b/curl/docs/MANUAL deleted file mode 100644 index 0e3db0ff..00000000 --- a/curl/docs/MANUAL +++ /dev/null @@ -1,1059 +0,0 @@ -LATEST VERSION - - You always find news about what's going on as well as the latest versions - from the curl web pages, located at: - - https://curl.haxx.se - -SIMPLE USAGE - - Get the main page from Netscape's web-server: - - curl http://www.netscape.com/ - - Get the README file the user's home directory at funet's ftp-server: - - curl ftp://ftp.funet.fi/README - - Get a web page from a server using port 8000: - - curl http://www.weirdserver.com:8000/ - - Get a directory listing of an FTP site: - - curl ftp://cool.haxx.se/ - - Get the definition of curl from a dictionary: - - curl dict://dict.org/m:curl - - Fetch two documents at once: - - curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/ - - Get a file off an FTPS server: - - curl ftps://files.are.secure.com/secrets.txt - - or use the more appropriate FTPS way to get the same file: - - curl --ftp-ssl ftp://files.are.secure.com/secrets.txt - - Get a file from an SSH server using SFTP: - - curl -u username sftp://example.com/etc/issue - - Get a file from an SSH server using SCP using a private key - (not password-protected) to authenticate: - - curl -u username: --key ~/.ssh/id_rsa \ - scp://example.com/~/file.txt - - Get a file from an SSH server using SCP using a private key - (password-protected) to authenticate: - - curl -u username: --key ~/.ssh/id_rsa --pass private_key_password \ - scp://example.com/~/file.txt - - Get the main page from an IPv6 web server: - - curl "http://[2001:1890:1112:1::20]/" - - Get a file from an SMB server: - - curl -u "domain\username:passwd" smb://server.example.com/share/file.txt - -DOWNLOAD TO A FILE - - Get a web page and store in a local file with a specific name: - - curl -o thatpage.html http://www.netscape.com/ - - Get a web page and store in a local file, make the local file get the name - of the remote document (if no file name part is specified in the URL, this - will fail): - - curl -O http://www.netscape.com/index.html - - Fetch two files and store them with their remote names: - - curl -O www.haxx.se/index.html -O curl.haxx.se/download.html - -USING PASSWORDS - - FTP - - To ftp files using name+passwd, include them in the URL like: - - curl ftp://name:passwd@machine.domain:port/full/path/to/file - - or specify them with the -u flag like - - curl -u name:passwd ftp://machine.domain:port/full/path/to/file - - FTPS - - It is just like for FTP, but you may also want to specify and use - SSL-specific options for certificates etc. - - Note that using FTPS:// as prefix is the "implicit" way as described in the - standards while the recommended "explicit" way is done by using FTP:// and - the --ftp-ssl option. - - SFTP / SCP - - This is similar to FTP, but you can use the --key option to specify a - private key to use instead of a password. Note that the private key may - itself be protected by a password that is unrelated to the login password - of the remote system; this password is specified using the --pass option. - Typically, curl will automatically extract the public key from the private - key file, but in cases where curl does not have the proper library support, - a matching public key file must be specified using the --pubkey option. - - HTTP - - Curl also supports user and password in HTTP URLs, thus you can pick a file - like: - - curl http://name:passwd@machine.domain/full/path/to/file - - or specify user and password separately like in - - curl -u name:passwd http://machine.domain/full/path/to/file - - HTTP offers many different methods of authentication and curl supports - several: Basic, Digest, NTLM and Negotiate (SPNEGO). Without telling which - method to use, curl defaults to Basic. You can also ask curl to pick the - most secure ones out of the ones that the server accepts for the given URL, - by using --anyauth. - - NOTE! According to the URL specification, HTTP URLs can not contain a user - and password, so that style will not work when using curl via a proxy, even - though curl allows it at other times. When using a proxy, you _must_ use - the -u style for user and password. - - HTTPS - - Probably most commonly used with private certificates, as explained below. - -PROXY - - curl supports both HTTP and SOCKS proxy servers, with optional authentication. - It does not have special support for FTP proxy servers since there are no - standards for those, but it can still be made to work with many of them. You - can also use both HTTP and SOCKS proxies to transfer files to and from FTP - servers. - - Get an ftp file using an HTTP proxy named my-proxy that uses port 888: - - curl -x my-proxy:888 ftp://ftp.leachsite.com/README - - Get a file from an HTTP server that requires user and password, using the - same proxy as above: - - curl -u user:passwd -x my-proxy:888 http://www.get.this/ - - Some proxies require special authentication. Specify by using -U as above: - - curl -U user:passwd -x my-proxy:888 http://www.get.this/ - - A comma-separated list of hosts and domains which do not use the proxy can - be specified as: - - curl --noproxy localhost,get.this -x my-proxy:888 http://www.get.this/ - - If the proxy is specified with --proxy1.0 instead of --proxy or -x, then - curl will use HTTP/1.0 instead of HTTP/1.1 for any CONNECT attempts. - - curl also supports SOCKS4 and SOCKS5 proxies with --socks4 and --socks5. - - See also the environment variables Curl supports that offer further proxy - control. - - Most FTP proxy servers are set up to appear as a normal FTP server from the - client's perspective, with special commands to select the remote FTP server. - curl supports the -u, -Q and --ftp-account options that can be used to - set up transfers through many FTP proxies. For example, a file can be - uploaded to a remote FTP server using a Blue Coat FTP proxy with the - options: - - curl -u "Remote-FTP-Username@remote.ftp.server Proxy-Username:Remote-Pass" \ - --ftp-account Proxy-Password --upload-file local-file \ - ftp://my-ftp.proxy.server:21/remote/upload/path/ - - See the manual for your FTP proxy to determine the form it expects to set up - transfers, and curl's -v option to see exactly what curl is sending. - -RANGES - - HTTP 1.1 introduced byte-ranges. Using this, a client can request - to get only one or more subparts of a specified document. Curl supports - this with the -r flag. - - Get the first 100 bytes of a document: - - curl -r 0-99 http://www.get.this/ - - Get the last 500 bytes of a document: - - curl -r -500 http://www.get.this/ - - Curl also supports simple ranges for FTP files as well. Then you can only - specify start and stop position. - - Get the first 100 bytes of a document using FTP: - - curl -r 0-99 ftp://www.get.this/README - -UPLOADING - - FTP / FTPS / SFTP / SCP - - Upload all data on stdin to a specified server: - - curl -T - ftp://ftp.upload.com/myfile - - Upload data from a specified file, login with user and password: - - curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile - - Upload a local file to the remote site, and use the local file name at the remote - site too: - - curl -T uploadfile -u user:passwd ftp://ftp.upload.com/ - - Upload a local file to get appended to the remote file: - - curl -T localfile -a ftp://ftp.upload.com/remotefile - - Curl also supports ftp upload through a proxy, but only if the proxy is - configured to allow that kind of tunneling. If it does, you can run curl in - a fashion similar to: - - curl --proxytunnel -x proxy:port -T localfile ftp.upload.com - -SMB / SMBS - - curl -T file.txt -u "domain\username:passwd" - smb://server.example.com/share/ - - HTTP - - Upload all data on stdin to a specified HTTP site: - - curl -T - http://www.upload.com/myfile - - Note that the HTTP server must have been configured to accept PUT before - this can be done successfully. - - For other ways to do HTTP data upload, see the POST section below. - -VERBOSE / DEBUG - - If curl fails where it isn't supposed to, if the servers don't let you in, - if you can't understand the responses: use the -v flag to get verbose - fetching. Curl will output lots of info and what it sends and receives in - order to let the user see all client-server interaction (but it won't show - you the actual data). - - curl -v ftp://ftp.upload.com/ - - To get even more details and information on what curl does, try using the - --trace or --trace-ascii options with a given file name to log to, like - this: - - curl --trace trace.txt www.haxx.se - - -DETAILED INFORMATION - - Different protocols provide different ways of getting detailed information - about specific files/documents. To get curl to show detailed information - about a single file, you should use -I/--head option. It displays all - available info on a single file for HTTP and FTP. The HTTP information is a - lot more extensive. - - For HTTP, you can get the header information (the same as -I would show) - shown before the data by using -i/--include. Curl understands the - -D/--dump-header option when getting files from both FTP and HTTP, and it - will then store the headers in the specified file. - - Store the HTTP headers in a separate file (headers.txt in the example): - - curl --dump-header headers.txt curl.haxx.se - - Note that headers stored in a separate file can be very useful at a later - time if you want curl to use cookies sent by the server. More about that in - the cookies section. - -POST (HTTP) - - It's easy to post data using curl. This is done using the -d - option. The post data must be urlencoded. - - Post a simple "name" and "phone" guestbook. - - curl -d "name=Rafael%20Sagula&phone=3320780" \ - http://www.where.com/guest.cgi - - How to post a form with curl, lesson #1: - - Dig out all the tags in the form that you want to fill in. (There's - a perl program called formfind.pl on the curl site that helps with this). - - If there's a "normal" post, you use -d to post. -d takes a full "post - string", which is in the format - - =&=&... - - The 'variable' names are the names set with "name=" in the tags, and - the data is the contents you want to fill in for the inputs. The data *must* - be properly URL encoded. That means you replace space with + and that you - replace weird letters with %XX where XX is the hexadecimal representation of - the letter's ASCII code. - - Example: - - (page located at http://www.formpost.com/getthis/ - -
- - - - -
- - We want to enter user 'foobar' with password '12345'. - - To post to this, you enter a curl command line like: - - curl -d "user=foobar&pass=12345&id=blablabla&ding=submit" (continues) - http://www.formpost.com/getthis/post.cgi - - - While -d uses the application/x-www-form-urlencoded mime-type, generally - understood by CGI's and similar, curl also supports the more capable - multipart/form-data type. This latter type supports things like file upload. - - -F accepts parameters like -F "name=contents". If you want the contents to - be read from a file, use <@filename> as contents. When specifying a file, - you can also specify the file content type by appending ';type=' - to the file name. You can also post the contents of several files in one - field. For example, the field name 'coolfiles' is used to send three files, - with different content types using the following syntax: - - curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \ - http://www.post.com/postit.cgi - - If the content-type is not specified, curl will try to guess from the file - extension (it only knows a few), or use the previously specified type (from - an earlier file if several files are specified in a list) or else it will - use the default type 'application/octet-stream'. - - Emulate a fill-in form with -F. Let's say you fill in three fields in a - form. One field is a file name which to post, one field is your name and one - field is a file description. We want to post the file we have written named - "cooltext.txt". To let curl do the posting of this data instead of your - favourite browser, you have to read the HTML source of the form page and - find the names of the input fields. In our example, the input field names - are 'file', 'yourname' and 'filedescription'. - - curl -F "file=@cooltext.txt" -F "yourname=Daniel" \ - -F "filedescription=Cool text file with cool text inside" \ - http://www.post.com/postit.cgi - - To send two files in one post you can do it in two ways: - - 1. Send multiple files in a single "field" with a single field name: - - curl -F "pictures=@dog.gif,cat.gif" - - 2. Send two fields with two field names: - - curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" - - To send a field value literally without interpreting a leading '@' - or '<', or an embedded ';type=', use --form-string instead of - -F. This is recommended when the value is obtained from a user or - some other unpredictable source. Under these circumstances, using - -F instead of --form-string would allow a user to trick curl into - uploading a file. - -REFERRER - - An HTTP request has the option to include information about which address - referred it to the actual page. Curl allows you to specify the - referrer to be used on the command line. It is especially useful to - fool or trick stupid servers or CGI scripts that rely on that information - being available or contain certain data. - - curl -e www.coolsite.com http://www.showme.com/ - - NOTE: The Referer: [sic] field is defined in the HTTP spec to be a full URL. - -USER AGENT - - An HTTP request has the option to include information about the browser - that generated the request. Curl allows it to be specified on the command - line. It is especially useful to fool or trick stupid servers or CGI - scripts that only accept certain browsers. - - Example: - - curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/ - - Other common strings: - 'Mozilla/3.0 (Win95; I)' Netscape Version 3 for Windows 95 - 'Mozilla/3.04 (Win95; U)' Netscape Version 3 for Windows 95 - 'Mozilla/2.02 (OS/2; U)' Netscape Version 2 for OS/2 - 'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)' NS for AIX - 'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' NS for Linux - - Note that Internet Explorer tries hard to be compatible in every way: - 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)' MSIE for W95 - - Mozilla is not the only possible User-Agent name: - 'Konqueror/1.0' KDE File Manager desktop client - 'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser - -COOKIES - - Cookies are generally used by web servers to keep state information at the - client's side. The server sets cookies by sending a response line in the - headers that looks like 'Set-Cookie: ' where the data part then - typically contains a set of NAME=VALUE pairs (separated by semicolons ';' - like "NAME1=VALUE1; NAME2=VALUE2;"). The server can also specify for what - path the "cookie" should be used for (by specifying "path=value"), when the - cookie should expire ("expire=DATE"), for what domain to use it - ("domain=NAME") and if it should be used on secure connections only - ("secure"). - - If you've received a page from a server that contains a header like: - Set-Cookie: sessionid=boo123; path="/foo"; - - it means the server wants that first pair passed on when we get anything in - a path beginning with "/foo". - - Example, get a page that wants my name passed in a cookie: - - curl -b "name=Daniel" www.sillypage.com - - Curl also has the ability to use previously received cookies in following - sessions. If you get cookies from a server and store them in a file in a - manner similar to: - - curl --dump-header headers www.example.com - - ... you can then in a second connect to that (or another) site, use the - cookies from the 'headers' file like: - - curl -b headers www.example.com - - While saving headers to a file is a working way to store cookies, it is - however error-prone and not the preferred way to do this. Instead, make curl - save the incoming cookies using the well-known netscape cookie format like - this: - - curl -c cookies.txt www.example.com - - Note that by specifying -b you enable the "cookie awareness" and with -L - you can make curl follow a location: (which often is used in combination - with cookies). So that if a site sends cookies and a location, you can - use a non-existing file to trigger the cookie awareness like: - - curl -L -b empty.txt www.example.com - - The file to read cookies from must be formatted using plain HTTP headers OR - as netscape's cookie file. Curl will determine what kind it is based on the - file contents. In the above command, curl will parse the header and store - the cookies received from www.example.com. curl will send to the server the - stored cookies which match the request as it follows the location. The - file "empty.txt" may be a nonexistent file. - - To read and write cookies from a netscape cookie file, you can set both -b - and -c to use the same file: - - curl -b cookies.txt -c cookies.txt www.example.com - -PROGRESS METER - - The progress meter exists to show a user that something actually is - happening. The different fields in the output have the following meaning: - - % Total % Received % Xferd Average Speed Time Curr. - Dload Upload Total Current Left Speed - 0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287 - - From left-to-right: - % - percentage completed of the whole transfer - Total - total size of the whole expected transfer - % - percentage completed of the download - Received - currently downloaded amount of bytes - % - percentage completed of the upload - Xferd - currently uploaded amount of bytes - Average Speed - Dload - the average transfer speed of the download - Average Speed - Upload - the average transfer speed of the upload - Time Total - expected time to complete the operation - Time Current - time passed since the invoke - Time Left - expected time left to completion - Curr.Speed - the average transfer speed the last 5 seconds (the first - 5 seconds of a transfer is based on less time of course.) - - The -# option will display a totally different progress bar that doesn't - need much explanation! - -SPEED LIMIT - - Curl allows the user to set the transfer speed conditions that must be met - to let the transfer keep going. By using the switch -y and -Y you - can make curl abort transfers if the transfer speed is below the specified - lowest limit for a specified time. - - To have curl abort the download if the speed is slower than 3000 bytes per - second for 1 minute, run: - - curl -Y 3000 -y 60 www.far-away-site.com - - This can very well be used in combination with the overall time limit, so - that the above operation must be completed in whole within 30 minutes: - - curl -m 1800 -Y 3000 -y 60 www.far-away-site.com - - Forcing curl not to transfer data faster than a given rate is also possible, - which might be useful if you're using a limited bandwidth connection and you - don't want your transfer to use all of it (sometimes referred to as - "bandwidth throttle"). - - Make curl transfer data no faster than 10 kilobytes per second: - - curl --limit-rate 10K www.far-away-site.com - - or - - curl --limit-rate 10240 www.far-away-site.com - - Or prevent curl from uploading data faster than 1 megabyte per second: - - curl -T upload --limit-rate 1M ftp://uploadshereplease.com - - When using the --limit-rate option, the transfer rate is regulated on a - per-second basis, which will cause the total transfer speed to become lower - than the given number. Sometimes of course substantially lower, if your - transfer stalls during periods. - -CONFIG FILE - - Curl automatically tries to read the .curlrc file (or _curlrc file on win32 - systems) from the user's home dir on startup. - - The config file could be made up with normal command line switches, but you - can also specify the long options without the dashes to make it more - readable. You can separate the options and the parameter with spaces, or - with = or :. Comments can be used within the file. If the first letter on a - line is a '#'-symbol the rest of the line is treated as a comment. - - If you want the parameter to contain spaces, you must enclose the entire - parameter within double quotes ("). Within those quotes, you specify a - quote as \". - - NOTE: You must specify options and their arguments on the same line. - - Example, set default time out and proxy in a config file: - - # We want a 30 minute timeout: - -m 1800 - # ... and we use a proxy for all accesses: - proxy = proxy.our.domain.com:8080 - - White spaces ARE significant at the end of lines, but all white spaces - leading up to the first characters of each line are ignored. - - Prevent curl from reading the default file by using -q as the first command - line parameter, like: - - curl -q www.thatsite.com - - Force curl to get and display a local help page in case it is invoked - without URL by making a config file similar to: - - # default url to get - url = "http://help.with.curl.com/curlhelp.html" - - You can specify another config file to be read by using the -K/--config - flag. If you set config file name to "-" it'll read the config from stdin, - which can be handy if you want to hide options from being visible in process - tables etc: - - echo "user = user:passwd" | curl -K - http://that.secret.site.com - -EXTRA HEADERS - - When using curl in your own very special programs, you may end up needing - to pass on your own custom headers when getting a web page. You can do - this by using the -H flag. - - Example, send the header "X-you-and-me: yes" to the server when getting a - page: - - curl -H "X-you-and-me: yes" www.love.com - - This can also be useful in case you want curl to send a different text in a - header than it normally does. The -H header you specify then replaces the - header curl would normally send. If you replace an internal header with an - empty one, you prevent that header from being sent. To prevent the Host: - header from being used: - - curl -H "Host:" www.server.com - -FTP and PATH NAMES - - Do note that when getting files with the ftp:// URL, the given path is - relative the directory you enter. To get the file 'README' from your home - directory at your ftp site, do: - - curl ftp://user:passwd@my.site.com/README - - But if you want the README file from the root directory of that very same - site, you need to specify the absolute file name: - - curl ftp://user:passwd@my.site.com//README - - (I.e with an extra slash in front of the file name.) - -SFTP and SCP and PATH NAMES - - With sftp: and scp: URLs, the path name given is the absolute name on the - server. To access a file relative to the remote user's home directory, - prefix the file with /~/ , such as: - - curl -u $USER sftp://home.example.com/~/.bashrc - -FTP and firewalls - - The FTP protocol requires one of the involved parties to open a second - connection as soon as data is about to get transferred. There are two ways to - do this. - - The default way for curl is to issue the PASV command which causes the - server to open another port and await another connection performed by the - client. This is good if the client is behind a firewall that doesn't allow - incoming connections. - - curl ftp.download.com - - If the server, for example, is behind a firewall that doesn't allow connections - on ports other than 21 (or if it just doesn't support the PASV command), the - other way to do it is to use the PORT command and instruct the server to - connect to the client on the given IP number and port (as parameters to the - PORT command). - - The -P flag to curl supports a few different options. Your machine may have - several IP-addresses and/or network interfaces and curl allows you to select - which of them to use. Default address can also be used: - - curl -P - ftp.download.com - - Download with PORT but use the IP address of our 'le0' interface (this does - not work on windows): - - curl -P le0 ftp.download.com - - Download with PORT but use 192.168.0.10 as our IP address to use: - - curl -P 192.168.0.10 ftp.download.com - -NETWORK INTERFACE - - Get a web page from a server using a specified port for the interface: - - curl --interface eth0:1 http://www.netscape.com/ - - or - - curl --interface 192.168.1.10 http://www.netscape.com/ - -HTTPS - - Secure HTTP requires SSL libraries to be installed and used when curl is - built. If that is done, curl is capable of retrieving and posting documents - using the HTTPS protocol. - - Example: - - curl https://www.secure-site.com - - Curl is also capable of using your personal certificates to get/post files - from sites that require valid certificates. The only drawback is that the - certificate needs to be in PEM-format. PEM is a standard and open format to - store certificates with, but it is not used by the most commonly used - browsers (Netscape and MSIE both use the so called PKCS#12 format). If you - want curl to use the certificates you use with your (favourite) browser, you - may need to download/compile a converter that can convert your browser's - formatted certificates to PEM formatted ones. This kind of converter is - included in recent versions of OpenSSL, and for older versions Dr Stephen - N. Henson has written a patch for SSLeay that adds this functionality. You - can get his patch (that requires an SSLeay installation) from his site at: - http://www.drh-consultancy.demon.co.uk/ - - Example on how to automatically retrieve a document using a certificate with - a personal password: - - curl -E /path/to/cert.pem:password https://secure.site.com/ - - If you neglect to specify the password on the command line, you will be - prompted for the correct password before any data can be received. - - Many older SSL-servers have problems with SSLv3 or TLS, which newer versions - of OpenSSL etc use, therefore it is sometimes useful to specify what - SSL-version curl should use. Use -3, -2 or -1 to specify that exact SSL - version to use (for SSLv3, SSLv2 or TLSv1 respectively): - - curl -2 https://secure.site.com/ - - Otherwise, curl will first attempt to use v3 and then v2. - - To use OpenSSL to convert your favourite browser's certificate into a PEM - formatted one that curl can use, do something like this: - - In Netscape, you start with hitting the 'Security' menu button. - - Select 'certificates->yours' and then pick a certificate in the list - - Press the 'Export' button - - enter your PIN code for the certs - - select a proper place to save it - - Run the 'openssl' application to convert the certificate. If you cd to the - openssl installation, you can do it like: - - # ./apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile] - - In Firefox, select Options, then Advanced, then the Encryption tab, - View Certificates. This opens the Certificate Manager, where you can - Export. Be sure to select PEM for the Save as type. - - In Internet Explorer, select Internet Options, then the Content tab, then - Certificates. Then you can Export, and depending on the format you may - need to convert to PEM. - - In Chrome, select Settings, then Show Advanced Settings. Under HTTPS/SSL - select Manage Certificates. - -RESUMING FILE TRANSFERS - - To continue a file transfer where it was previously aborted, curl supports - resume on HTTP(S) downloads as well as FTP uploads and downloads. - - Continue downloading a document: - - curl -C - -o file ftp://ftp.server.com/path/file - - Continue uploading a document(*1): - - curl -C - -T file ftp://ftp.server.com/path/file - - Continue downloading a document from a web server(*2): - - curl -C - -o file http://www.server.com/ - - (*1) = This requires that the FTP server supports the non-standard command - SIZE. If it doesn't, curl will say so. - - (*2) = This requires that the web server supports at least HTTP/1.1. If it - doesn't, curl will say so. - -TIME CONDITIONS - - HTTP allows a client to specify a time condition for the document it - requests. It is If-Modified-Since or If-Unmodified-Since. Curl allows you to - specify them with the -z/--time-cond flag. - - For example, you can easily make a download that only gets performed if the - remote file is newer than a local copy. It would be made like: - - curl -z local.html http://remote.server.com/remote.html - - Or you can download a file only if the local file is newer than the remote - one. Do this by prepending the date string with a '-', as in: - - curl -z -local.html http://remote.server.com/remote.html - - You can specify a "free text" date as condition. Tell curl to only download - the file if it was updated since January 12, 2012: - - curl -z "Jan 12 2012" http://remote.server.com/remote.html - - Curl will then accept a wide range of date formats. You always make the date - check the other way around by prepending it with a dash '-'. - -DICT - - For fun try - - curl dict://dict.org/m:curl - curl dict://dict.org/d:heisenbug:jargon - curl dict://dict.org/d:daniel:web1913 - - Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define' - and 'lookup'. For example, - - curl dict://dict.org/find:curl - - Commands that break the URL description of the RFC (but not the DICT - protocol) are - - curl dict://dict.org/show:db - curl dict://dict.org/show:strat - - Authentication is still missing (but this is not required by the RFC) - -LDAP - - If you have installed the OpenLDAP library, curl can take advantage of it - and offer ldap:// support. - On Windows, curl will use WinLDAP from Platform SDK by default. - - Default protocol version used by curl is LDAPv3. LDAPv2 will be used as - fallback mechanism in case if LDAPv3 will fail to connect. - - LDAP is a complex thing and writing an LDAP query is not an easy task. I do - advise you to dig up the syntax description for that elsewhere. One such - place might be: - - RFC 2255, "The LDAP URL Format" https://curl.haxx.se/rfc/rfc2255.txt - - To show you an example, this is how I can get all people from my local LDAP - server that has a certain sub-domain in their email address: - - curl -B "ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se" - - If I want the same info in HTML format, I can get it by not using the -B - (enforce ASCII) flag. - - You also can use authentication when accessing LDAP catalog: - - curl -u user:passwd "ldap://ldap.frontec.se/o=frontec??sub?mail=*" - curl "ldap://user:passwd@ldap.frontec.se/o=frontec??sub?mail=*" - - By default, if user and password provided, OpenLDAP/WinLDAP will use basic - authentication. On Windows you can control this behavior by providing - one of --basic, --ntlm or --digest option in curl command line - - curl --ntlm "ldap://user:passwd@ldap.frontec.se/o=frontec??sub?mail=*" - - On Windows, if no user/password specified, auto-negotiation mechanism will - be used with current logon credentials (SSPI/SPNEGO). - -ENVIRONMENT VARIABLES - - Curl reads and understands the following environment variables: - - http_proxy, HTTPS_PROXY, FTP_PROXY - - They should be set for protocol-specific proxies. General proxy should be - set with - - ALL_PROXY - - A comma-separated list of host names that shouldn't go through any proxy is - set in (only an asterisk, '*' matches all hosts) - - NO_PROXY - - If the host name matches one of these strings, or the host is within the - domain of one of these strings, transactions with that node will not be - proxied. When a domain is used, it needs to start with a period. A user can - specify that both www.example.com and foo.example.com should not uses a - proxy by setting NO_PROXY to ".example.com". By including the full name you - can exclude specific host names, so to make www.example.com not use a proxy - but still have foo.example.com do it, set NO_PROXY to "www.example.com" - - The usage of the -x/--proxy flag overrides the environment variables. - -NETRC - - Unix introduced the .netrc concept a long time ago. It is a way for a user - to specify name and password for commonly visited FTP sites in a file so - that you don't have to type them in each time you visit those sites. You - realize this is a big security risk if someone else gets hold of your - passwords, so therefore most unix programs won't read this file unless it is - only readable by yourself (curl doesn't care though). - - Curl supports .netrc files if told to (using the -n/--netrc and - --netrc-optional options). This is not restricted to just FTP, - so curl can use it for all protocols where authentication is used. - - A very simple .netrc file could look something like: - - machine curl.haxx.se login iamdaniel password mysecret - -CUSTOM OUTPUT - - To better allow script programmers to get to know about the progress of - curl, the -w/--write-out option was introduced. Using this, you can specify - what information from the previous transfer you want to extract. - - To display the amount of bytes downloaded together with some text and an - ending newline: - - curl -w 'We downloaded %{size_download} bytes\n' www.download.com - -KERBEROS FTP TRANSFER - - Curl supports kerberos4 and kerberos5/GSSAPI for FTP transfers. You need - the kerberos package installed and used at curl build time for it to be - available. - - First, get the krb-ticket the normal way, like with the kinit/kauth tool. - Then use curl in way similar to: - - curl --krb private ftp://krb4site.com -u username:fakepwd - - There's no use for a password on the -u switch, but a blank one will make - curl ask for one and you already entered the real password to kinit/kauth. - -TELNET - - The curl telnet support is basic and very easy to use. Curl passes all data - passed to it on stdin to the remote server. Connect to a remote telnet - server using a command line similar to: - - curl telnet://remote.server.com - - And enter the data to pass to the server on stdin. The result will be sent - to stdout or to the file you specify with -o. - - You might want the -N/--no-buffer option to switch off the buffered output - for slow connections or similar. - - Pass options to the telnet protocol negotiation, by using the -t option. To - tell the server we use a vt100 terminal, try something like: - - curl -tTTYPE=vt100 telnet://remote.server.com - - Other interesting options for it -t include: - - - XDISPLOC= Sets the X display location. - - - NEW_ENV= Sets an environment variable. - - NOTE: The telnet protocol does not specify any way to login with a specified - user and password so curl can't do that automatically. To do that, you need - to track when the login prompt is received and send the username and - password accordingly. - -PERSISTENT CONNECTIONS - - Specifying multiple files on a single command line will make curl transfer - all of them, one after the other in the specified order. - - libcurl will attempt to use persistent connections for the transfers so that - the second transfer to the same host can use the same connection that was - already initiated and was left open in the previous transfer. This greatly - decreases connection time for all but the first transfer and it makes a far - better use of the network. - - Note that curl cannot use persistent connections for transfers that are used - in subsequence curl invokes. Try to stuff as many URLs as possible on the - same command line if they are using the same host, as that'll make the - transfers faster. If you use an HTTP proxy for file transfers, practically - all transfers will be persistent. - -MULTIPLE TRANSFERS WITH A SINGLE COMMAND LINE - - As is mentioned above, you can download multiple files with one command line - by simply adding more URLs. If you want those to get saved to a local file - instead of just printed to stdout, you need to add one save option for each - URL you specify. Note that this also goes for the -O option (but not - --remote-name-all). - - For example: get two files and use -O for the first and a custom file - name for the second: - - curl -O http://url.com/file.txt ftp://ftp.com/moo.exe -o moo.jpg - - You can also upload multiple files in a similar fashion: - - curl -T local1 ftp://ftp.com/moo.exe -T local2 ftp://ftp.com/moo2.txt - -IPv6 - - curl will connect to a server with IPv6 when a host lookup returns an IPv6 - address and fall back to IPv4 if the connection fails. The --ipv4 and --ipv6 - options can specify which address to use when both are available. IPv6 - addresses can also be specified directly in URLs using the syntax: - - http://[2001:1890:1112:1::20]/overview.html - - When this style is used, the -g option must be given to stop curl from - interpreting the square brackets as special globbing characters. Link local - and site local addresses including a scope identifier, such as fe80::1234%1, - may also be used, but the scope portion must be numeric or match an existing - network interface on Linux and the percent character must be URL escaped. The - previous example in an SFTP URL might look like: - - sftp://[fe80::1234%251]/ - - IPv6 addresses provided other than in URLs (e.g. to the --proxy, --interface - or --ftp-port options) should not be URL encoded. - -METALINK - - Curl supports Metalink (both version 3 and 4 (RFC 5854) are supported), a way - to list multiple URIs and hashes for a file. Curl will make use of the mirrors - listed within for failover if there are errors (such as the file or server not - being available). It will also verify the hash of the file after the download - completes. The Metalink file itself is downloaded and processed in memory and - not stored in the local file system. - - Example to use a remote Metalink file: - - curl --metalink http://www.example.com/example.metalink - - To use a Metalink file in the local file system, use FILE protocol (file://): - - curl --metalink file://example.metalink - - Please note that if FILE protocol is disabled, there is no way to use a local - Metalink file at the time of this writing. Also note that if --metalink and - --include are used together, --include will be ignored. This is because including - headers in the response will break Metalink parser and if the headers are included - in the file described in Metalink file, hash check will fail. - -MAILING LISTS - - For your convenience, we have several open mailing lists to discuss curl, - its development and things relevant to this. Get all info at - https://curl.haxx.se/mail/. Some of the lists available are: - - curl-users - - Users of the command line tool. How to use it, what doesn't work, new - features, related tools, questions, news, installations, compilations, - running, porting etc. - - curl-library - - Developers using or developing libcurl. Bugs, extensions, improvements. - - curl-announce - - Low-traffic. Only receives announcements of new public versions. At worst, - that makes something like one or two mails per month, but usually only one - mail every second month. - - curl-and-php - - Using the curl functions in PHP. Everything curl with a PHP angle. Or PHP - with a curl angle. - - curl-and-python - - Python hackers using curl with or without the python binding pycurl. - - Please direct curl questions, feature requests and trouble reports to one of - these mailing lists instead of mailing any individual. diff --git a/curl/docs/MANUAL.md b/curl/docs/MANUAL.md new file mode 100644 index 00000000..a637c66c --- /dev/null +++ b/curl/docs/MANUAL.md @@ -0,0 +1,990 @@ +# curl tutorial + +## Simple Usage + +Get the main page from a web-server: + + curl https://www.example.com/ + +Get the README file the user's home directory at funet's ftp-server: + + curl ftp://ftp.funet.fi/README + +Get a web page from a server using port 8000: + + curl http://www.weirdserver.com:8000/ + +Get a directory listing of an FTP site: + + curl ftp://ftp.funet.fi + +Get the definition of curl from a dictionary: + + curl dict://dict.org/m:curl + +Fetch two documents at once: + + curl ftp://ftp.funet.fi/ http://www.weirdserver.com:8000/ + +Get a file off an FTPS server: + + curl ftps://files.are.secure.com/secrets.txt + +or use the more appropriate FTPS way to get the same file: + + curl --ftp-ssl ftp://files.are.secure.com/secrets.txt + +Get a file from an SSH server using SFTP: + + curl -u username sftp://example.com/etc/issue + +Get a file from an SSH server using SCP using a private key (not +password-protected) to authenticate: + + curl -u username: --key ~/.ssh/id_rsa scp://example.com/~/file.txt + +Get a file from an SSH server using SCP using a private key +(password-protected) to authenticate: + + curl -u username: --key ~/.ssh/id_rsa --pass private_key_password + scp://example.com/~/file.txt + +Get the main page from an IPv6 web server: + + curl "http://[2001:1890:1112:1::20]/" + +Get a file from an SMB server: + + curl -u "domain\username:passwd" smb://server.example.com/share/file.txt + +## Download to a File + +Get a web page and store in a local file with a specific name: + + curl -o thatpage.html http://www.example.com/ + +Get a web page and store in a local file, make the local file get the name of +the remote document (if no file name part is specified in the URL, this will +fail): + + curl -O http://www.example.com/index.html + +Fetch two files and store them with their remote names: + + curl -O www.haxx.se/index.html -O curl.se/download.html + +## Using Passwords + +### FTP + +To ftp files using name+passwd, include them in the URL like: + + curl ftp://name:passwd@machine.domain:port/full/path/to/file + +or specify them with the -u flag like + + curl -u name:passwd ftp://machine.domain:port/full/path/to/file + +### FTPS + +It is just like for FTP, but you may also want to specify and use SSL-specific +options for certificates etc. + +Note that using `FTPS://` as prefix is the "implicit" way as described in the +standards while the recommended "explicit" way is done by using FTP:// and the +`--ftp-ssl` option. + +### SFTP / SCP + +This is similar to FTP, but you can use the `--key` option to specify a +private key to use instead of a password. Note that the private key may itself +be protected by a password that is unrelated to the login password of the +remote system; this password is specified using the `--pass` option. +Typically, curl will automatically extract the public key from the private key +file, but in cases where curl does not have the proper library support, a +matching public key file must be specified using the `--pubkey` option. + +### HTTP + +Curl also supports user and password in HTTP URLs, thus you can pick a file +like: + + curl http://name:passwd@machine.domain/full/path/to/file + +or specify user and password separately like in + + curl -u name:passwd http://machine.domain/full/path/to/file + +HTTP offers many different methods of authentication and curl supports +several: Basic, Digest, NTLM and Negotiate (SPNEGO). Without telling which +method to use, curl defaults to Basic. You can also ask curl to pick the most +secure ones out of the ones that the server accepts for the given URL, by +using `--anyauth`. + +**Note**! According to the URL specification, HTTP URLs can not contain a user +and password, so that style will not work when using curl via a proxy, even +though curl allows it at other times. When using a proxy, you _must_ use the +`-u` style for user and password. + +### HTTPS + +Probably most commonly used with private certificates, as explained below. + +## Proxy + +curl supports both HTTP and SOCKS proxy servers, with optional authentication. +It does not have special support for FTP proxy servers since there are no +standards for those, but it can still be made to work with many of them. You +can also use both HTTP and SOCKS proxies to transfer files to and from FTP +servers. + +Get an ftp file using an HTTP proxy named my-proxy that uses port 888: + + curl -x my-proxy:888 ftp://ftp.leachsite.com/README + +Get a file from an HTTP server that requires user and password, using the +same proxy as above: + + curl -u user:passwd -x my-proxy:888 http://www.get.this/ + +Some proxies require special authentication. Specify by using -U as above: + + curl -U user:passwd -x my-proxy:888 http://www.get.this/ + +A comma-separated list of hosts and domains which do not use the proxy can be +specified as: + + curl --noproxy localhost,get.this -x my-proxy:888 http://www.get.this/ + +If the proxy is specified with `--proxy1.0` instead of `--proxy` or `-x`, then +curl will use HTTP/1.0 instead of HTTP/1.1 for any `CONNECT` attempts. + +curl also supports SOCKS4 and SOCKS5 proxies with `--socks4` and `--socks5`. + +See also the environment variables Curl supports that offer further proxy +control. + +Most FTP proxy servers are set up to appear as a normal FTP server from the +client's perspective, with special commands to select the remote FTP server. +curl supports the `-u`, `-Q` and `--ftp-account` options that can be used to +set up transfers through many FTP proxies. For example, a file can be uploaded +to a remote FTP server using a Blue Coat FTP proxy with the options: + + curl -u "username@ftp.server Proxy-Username:Remote-Pass" + --ftp-account Proxy-Password --upload-file local-file + ftp://my-ftp.proxy.server:21/remote/upload/path/ + +See the manual for your FTP proxy to determine the form it expects to set up +transfers, and curl's `-v` option to see exactly what curl is sending. + +## Ranges + +HTTP 1.1 introduced byte-ranges. Using this, a client can request to get only +one or more subparts of a specified document. Curl supports this with the `-r` +flag. + +Get the first 100 bytes of a document: + + curl -r 0-99 http://www.get.this/ + +Get the last 500 bytes of a document: + + curl -r -500 http://www.get.this/ + +Curl also supports simple ranges for FTP files as well. Then you can only +specify start and stop position. + +Get the first 100 bytes of a document using FTP: + + curl -r 0-99 ftp://www.get.this/README + +## Uploading + +### FTP / FTPS / SFTP / SCP + +Upload all data on stdin to a specified server: + + curl -T - ftp://ftp.upload.com/myfile + +Upload data from a specified file, login with user and password: + + curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile + +Upload a local file to the remote site, and use the local file name at the +remote site too: + + curl -T uploadfile -u user:passwd ftp://ftp.upload.com/ + +Upload a local file to get appended to the remote file: + + curl -T localfile -a ftp://ftp.upload.com/remotefile + +Curl also supports ftp upload through a proxy, but only if the proxy is +configured to allow that kind of tunneling. If it does, you can run curl in a +fashion similar to: + + curl --proxytunnel -x proxy:port -T localfile ftp.upload.com + +### SMB / SMBS + + curl -T file.txt -u "domain\username:passwd" + smb://server.example.com/share/ + +### HTTP + +Upload all data on stdin to a specified HTTP site: + + curl -T - http://www.upload.com/myfile + +Note that the HTTP server must have been configured to accept PUT before this +can be done successfully. + +For other ways to do HTTP data upload, see the POST section below. + +## Verbose / Debug + +If curl fails where it isn't supposed to, if the servers don't let you in, if +you can't understand the responses: use the `-v` flag to get verbose +fetching. Curl will output lots of info and what it sends and receives in +order to let the user see all client-server interaction (but it won't show you +the actual data). + + curl -v ftp://ftp.upload.com/ + +To get even more details and information on what curl does, try using the +`--trace` or `--trace-ascii` options with a given file name to log to, like +this: + + curl --trace trace.txt www.haxx.se + + +## Detailed Information + +Different protocols provide different ways of getting detailed information +about specific files/documents. To get curl to show detailed information about +a single file, you should use `-I`/`--head` option. It displays all available +info on a single file for HTTP and FTP. The HTTP information is a lot more +extensive. + +For HTTP, you can get the header information (the same as `-I` would show) +shown before the data by using `-i`/`--include`. Curl understands the +`-D`/`--dump-header` option when getting files from both FTP and HTTP, and it +will then store the headers in the specified file. + +Store the HTTP headers in a separate file (headers.txt in the example): + + curl --dump-header headers.txt curl.se + +Note that headers stored in a separate file can be very useful at a later time +if you want curl to use cookies sent by the server. More about that in the +cookies section. + +## POST (HTTP) + +It's easy to post data using curl. This is done using the `-d ` option. +The post data must be urlencoded. + +Post a simple "name" and "phone" guestbook. + + curl -d "name=Rafael%20Sagula&phone=3320780" http://www.where.com/guest.cgi + +How to post a form with curl, lesson #1: + +Dig out all the `` tags in the form that you want to fill in. + +If there's a "normal" post, you use `-d` to post. `-d` takes a full "post +string", which is in the format + + =&=&... + +The 'variable' names are the names set with `"name="` in the `` tags, +and the data is the contents you want to fill in for the inputs. The data +*must* be properly URL encoded. That means you replace space with + and that +you replace weird letters with %XX where XX is the hexadecimal representation +of the letter's ASCII code. + +Example: + +(page located at `http://www.formpost.com/getthis/`) + +```html +
+ + + + +
+``` + +We want to enter user 'foobar' with password '12345'. + +To post to this, you enter a curl command line like: + + curl -d "user=foobar&pass=12345&id=blablabla&ding=submit" + http://www.formpost.com/getthis/post.cgi + +While `-d` uses the application/x-www-form-urlencoded mime-type, generally +understood by CGI's and similar, curl also supports the more capable +multipart/form-data type. This latter type supports things like file upload. + +`-F` accepts parameters like `-F "name=contents"`. If you want the contents to +be read from a file, use `@filename` as contents. When specifying a file, you +can also specify the file content type by appending `;type=` to the +file name. You can also post the contents of several files in one field. For +example, the field name 'coolfiles' is used to send three files, with +different content types using the following syntax: + + curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" + http://www.post.com/postit.cgi + +If the content-type is not specified, curl will try to guess from the file +extension (it only knows a few), or use the previously specified type (from an +earlier file if several files are specified in a list) or else it will use the +default type 'application/octet-stream'. + +Emulate a fill-in form with `-F`. Let's say you fill in three fields in a +form. One field is a file name which to post, one field is your name and one +field is a file description. We want to post the file we have written named +"cooltext.txt". To let curl do the posting of this data instead of your +favourite browser, you have to read the HTML source of the form page and find +the names of the input fields. In our example, the input field names are +'file', 'yourname' and 'filedescription'. + + curl -F "file=@cooltext.txt" -F "yourname=Daniel" + -F "filedescription=Cool text file with cool text inside" + http://www.post.com/postit.cgi + +To send two files in one post you can do it in two ways: + +Send multiple files in a single "field" with a single field name: + + curl -F "pictures=@dog.gif,cat.gif" $URL + +Send two fields with two field names + + curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" $URL + +To send a field value literally without interpreting a leading `@` or `<`, or +an embedded `;type=`, use `--form-string` instead of `-F`. This is recommended +when the value is obtained from a user or some other unpredictable +source. Under these circumstances, using `-F` instead of `--form-string` could +allow a user to trick curl into uploading a file. + +## Referrer + +An HTTP request has the option to include information about which address +referred it to the actual page. Curl allows you to specify the referrer to be +used on the command line. It is especially useful to fool or trick stupid +servers or CGI scripts that rely on that information being available or +contain certain data. + + curl -e www.coolsite.com http://www.showme.com/ + +## User Agent + +An HTTP request has the option to include information about the browser that +generated the request. Curl allows it to be specified on the command line. It +is especially useful to fool or trick stupid servers or CGI scripts that only +accept certain browsers. + +Example: + + curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/ + +Other common strings: + +- `Mozilla/3.0 (Win95; I)` - Netscape Version 3 for Windows 95 +- `Mozilla/3.04 (Win95; U)` - Netscape Version 3 for Windows 95 +- `Mozilla/2.02 (OS/2; U)` - Netscape Version 2 for OS/2 +- `Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)` - Netscape for AIX +- `Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)` - Netscape for Linux + +Note that Internet Explorer tries hard to be compatible in every way: + +- `Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)` - MSIE for W95 + +Mozilla is not the only possible User-Agent name: + +- `Konqueror/1.0` - KDE File Manager desktop client +- `Lynx/2.7.1 libwww-FM/2.14` - Lynx command line browser + +## Cookies + +Cookies are generally used by web servers to keep state information at the +client's side. The server sets cookies by sending a response line in the +headers that looks like `Set-Cookie: ` where the data part then +typically contains a set of `NAME=VALUE` pairs (separated by semicolons `;` +like `NAME1=VALUE1; NAME2=VALUE2;`). The server can also specify for what path +the "cookie" should be used for (by specifying `path=value`), when the cookie +should expire (`expire=DATE`), for what domain to use it (`domain=NAME`) and +if it should be used on secure connections only (`secure`). + +If you've received a page from a server that contains a header like: + +```http +Set-Cookie: sessionid=boo123; path="/foo"; +``` + +it means the server wants that first pair passed on when we get anything in a +path beginning with "/foo". + +Example, get a page that wants my name passed in a cookie: + + curl -b "name=Daniel" www.sillypage.com + +Curl also has the ability to use previously received cookies in following +sessions. If you get cookies from a server and store them in a file in a +manner similar to: + + curl --dump-header headers www.example.com + +... you can then in a second connect to that (or another) site, use the +cookies from the 'headers' file like: + + curl -b headers www.example.com + +While saving headers to a file is a working way to store cookies, it is +however error-prone and not the preferred way to do this. Instead, make curl +save the incoming cookies using the well-known netscape cookie format like +this: + + curl -c cookies.txt www.example.com + +Note that by specifying `-b` you enable the "cookie awareness" and with `-L` +you can make curl follow a location: (which often is used in combination with +cookies). So that if a site sends cookies and a location, you can use a +non-existing file to trigger the cookie awareness like: + + curl -L -b empty.txt www.example.com + +The file to read cookies from must be formatted using plain HTTP headers OR as +netscape's cookie file. Curl will determine what kind it is based on the file +contents. In the above command, curl will parse the header and store the +cookies received from www.example.com. curl will send to the server the +stored cookies which match the request as it follows the location. The file +"empty.txt" may be a nonexistent file. + +To read and write cookies from a netscape cookie file, you can set both `-b` +and `-c` to use the same file: + + curl -b cookies.txt -c cookies.txt www.example.com + +## Progress Meter + +The progress meter exists to show a user that something actually is +happening. The different fields in the output have the following meaning: + + % Total % Received % Xferd Average Speed Time Curr. + Dload Upload Total Current Left Speed + 0 151M 0 38608 0 0 9406 0 4:41:43 0:00:04 4:41:39 9287 + +From left-to-right: + + - % - percentage completed of the whole transfer + - Total - total size of the whole expected transfer + - % - percentage completed of the download + - Received - currently downloaded amount of bytes + - % - percentage completed of the upload + - Xferd - currently uploaded amount of bytes + - Average Speed Dload - the average transfer speed of the download + - Average Speed Upload - the average transfer speed of the upload + - Time Total - expected time to complete the operation + - Time Current - time passed since the invoke + - Time Left - expected time left to completion + - Curr.Speed - the average transfer speed the last 5 seconds (the first + 5 seconds of a transfer is based on less time of course.) + +The `-#` option will display a totally different progress bar that doesn't +need much explanation! + +## Speed Limit + +Curl allows the user to set the transfer speed conditions that must be met to +let the transfer keep going. By using the switch `-y` and `-Y` you can make +curl abort transfers if the transfer speed is below the specified lowest limit +for a specified time. + +To have curl abort the download if the speed is slower than 3000 bytes per +second for 1 minute, run: + + curl -Y 3000 -y 60 www.far-away-site.com + +This can very well be used in combination with the overall time limit, so +that the above operation must be completed in whole within 30 minutes: + + curl -m 1800 -Y 3000 -y 60 www.far-away-site.com + +Forcing curl not to transfer data faster than a given rate is also possible, +which might be useful if you're using a limited bandwidth connection and you +don't want your transfer to use all of it (sometimes referred to as +"bandwidth throttle"). + +Make curl transfer data no faster than 10 kilobytes per second: + + curl --limit-rate 10K www.far-away-site.com + +or + + curl --limit-rate 10240 www.far-away-site.com + +Or prevent curl from uploading data faster than 1 megabyte per second: + + curl -T upload --limit-rate 1M ftp://uploadshereplease.com + +When using the `--limit-rate` option, the transfer rate is regulated on a +per-second basis, which will cause the total transfer speed to become lower +than the given number. Sometimes of course substantially lower, if your +transfer stalls during periods. + +## Config File + +Curl automatically tries to read the `.curlrc` file (or `_curlrc` file on +Microsoft Windows systems) from the user's home dir on startup. + +The config file could be made up with normal command line switches, but you +can also specify the long options without the dashes to make it more +readable. You can separate the options and the parameter with spaces, or with +`=` or `:`. Comments can be used within the file. If the first letter on a +line is a `#`-symbol the rest of the line is treated as a comment. + +If you want the parameter to contain spaces, you must enclose the entire +parameter within double quotes (`"`). Within those quotes, you specify a quote +as `\"`. + +NOTE: You must specify options and their arguments on the same line. + +Example, set default time out and proxy in a config file: + + # We want a 30 minute timeout: + -m 1800 + # ... and we use a proxy for all accesses: + proxy = proxy.our.domain.com:8080 + +Whitespaces ARE significant at the end of lines, but all whitespace leading +up to the first characters of each line are ignored. + +Prevent curl from reading the default file by using -q as the first command +line parameter, like: + + curl -q www.thatsite.com + +Force curl to get and display a local help page in case it is invoked without +URL by making a config file similar to: + + # default url to get + url = "http://help.with.curl.com/curlhelp.html" + +You can specify another config file to be read by using the `-K`/`--config` +flag. If you set config file name to `-` it'll read the config from stdin, +which can be handy if you want to hide options from being visible in process +tables etc: + + echo "user = user:passwd" | curl -K - http://that.secret.site.com + +## Extra Headers + +When using curl in your own very special programs, you may end up needing +to pass on your own custom headers when getting a web page. You can do +this by using the `-H` flag. + +Example, send the header `X-you-and-me: yes` to the server when getting a +page: + + curl -H "X-you-and-me: yes" www.love.com + +This can also be useful in case you want curl to send a different text in a +header than it normally does. The `-H` header you specify then replaces the +header curl would normally send. If you replace an internal header with an +empty one, you prevent that header from being sent. To prevent the `Host:` +header from being used: + + curl -H "Host:" www.server.com + +## FTP and Path Names + +Do note that when getting files with a `ftp://` URL, the given path is +relative the directory you enter. To get the file `README` from your home +directory at your ftp site, do: + + curl ftp://user:passwd@my.site.com/README + +But if you want the README file from the root directory of that very same +site, you need to specify the absolute file name: + + curl ftp://user:passwd@my.site.com//README + +(I.e with an extra slash in front of the file name.) + +## SFTP and SCP and Path Names + +With sftp: and scp: URLs, the path name given is the absolute name on the +server. To access a file relative to the remote user's home directory, prefix +the file with `/~/` , such as: + + curl -u $USER sftp://home.example.com/~/.bashrc + +## FTP and Firewalls + +The FTP protocol requires one of the involved parties to open a second +connection as soon as data is about to get transferred. There are two ways to +do this. + +The default way for curl is to issue the PASV command which causes the server +to open another port and await another connection performed by the +client. This is good if the client is behind a firewall that doesn't allow +incoming connections. + + curl ftp.download.com + +If the server, for example, is behind a firewall that doesn't allow +connections on ports other than 21 (or if it just doesn't support the `PASV` +command), the other way to do it is to use the `PORT` command and instruct the +server to connect to the client on the given IP number and port (as parameters +to the PORT command). + +The `-P` flag to curl supports a few different options. Your machine may have +several IP-addresses and/or network interfaces and curl allows you to select +which of them to use. Default address can also be used: + + curl -P - ftp.download.com + +Download with `PORT` but use the IP address of our `le0` interface (this does +not work on windows): + + curl -P le0 ftp.download.com + +Download with `PORT` but use 192.168.0.10 as our IP address to use: + + curl -P 192.168.0.10 ftp.download.com + +## Network Interface + +Get a web page from a server using a specified port for the interface: + + curl --interface eth0:1 http://www.example.com/ + +or + + curl --interface 192.168.1.10 http://www.example.com/ + +## HTTPS + +Secure HTTP requires a TLS library to be installed and used when curl is +built. If that is done, curl is capable of retrieving and posting documents +using the HTTPS protocol. + +Example: + + curl https://www.secure-site.com + +curl is also capable of using client certificates to get/post files from sites +that require valid certificates. The only drawback is that the certificate +needs to be in PEM-format. PEM is a standard and open format to store +certificates with, but it is not used by the most commonly used browsers. If +you want curl to use the certificates you use with your (favourite) browser, +you may need to download/compile a converter that can convert your browser's +formatted certificates to PEM formatted ones. + +Example on how to automatically retrieve a document using a certificate with a +personal password: + + curl -E /path/to/cert.pem:password https://secure.site.com/ + +If you neglect to specify the password on the command line, you will be +prompted for the correct password before any data can be received. + +Many older HTTPS servers have problems with specific SSL or TLS versions, +which newer versions of OpenSSL etc use, therefore it is sometimes useful to +specify what SSL-version curl should use. Use -3, -2 or -1 to specify that +exact SSL version to use (for SSLv3, SSLv2 or TLSv1 respectively): + + curl -2 https://secure.site.com/ + +Otherwise, curl will attempt to use a sensible TLS default version. + +## Resuming File Transfers + +To continue a file transfer where it was previously aborted, curl supports +resume on HTTP(S) downloads as well as FTP uploads and downloads. + +Continue downloading a document: + + curl -C - -o file ftp://ftp.server.com/path/file + +Continue uploading a document: + + curl -C - -T file ftp://ftp.server.com/path/file + +Continue downloading a document from a web server + + curl -C - -o file http://www.server.com/ + +## Time Conditions + +HTTP allows a client to specify a time condition for the document it requests. +It is `If-Modified-Since` or `If-Unmodified-Since`. curl allows you to specify +them with the `-z`/`--time-cond` flag. + +For example, you can easily make a download that only gets performed if the +remote file is newer than a local copy. It would be made like: + + curl -z local.html http://remote.server.com/remote.html + +Or you can download a file only if the local file is newer than the remote +one. Do this by prepending the date string with a `-`, as in: + + curl -z -local.html http://remote.server.com/remote.html + +You can specify a "free text" date as condition. Tell curl to only download +the file if it was updated since January 12, 2012: + + curl -z "Jan 12 2012" http://remote.server.com/remote.html + +Curl will then accept a wide range of date formats. You always make the date +check the other way around by prepending it with a dash (`-`). + +## DICT + +For fun try + + curl dict://dict.org/m:curl + curl dict://dict.org/d:heisenbug:jargon + curl dict://dict.org/d:daniel:gcide + +Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define' and +'lookup'. For example, + + curl dict://dict.org/find:curl + +Commands that break the URL description of the RFC (but not the DICT +protocol) are + + curl dict://dict.org/show:db + curl dict://dict.org/show:strat + +Authentication support is still missing + +## LDAP + +If you have installed the OpenLDAP library, curl can take advantage of it and +offer `ldap://` support. On Windows, curl will use WinLDAP from Platform SDK +by default. + +Default protocol version used by curl is LDAPv3. LDAPv2 will be used as +fallback mechanism in case if LDAPv3 will fail to connect. + +LDAP is a complex thing and writing an LDAP query is not an easy task. I do +advise you to dig up the syntax description for that elsewhere. One such place +might be: [RFC 2255, The LDAP URL +Format](https://curl.se/rfc/rfc2255.txt) + +To show you an example, this is how I can get all people from my local LDAP +server that has a certain sub-domain in their email address: + + curl -B "ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se" + +If I want the same info in HTML format, I can get it by not using the `-B` +(enforce ASCII) flag. + +You also can use authentication when accessing LDAP catalog: + + curl -u user:passwd "ldap://ldap.frontec.se/o=frontec??sub?mail=*" + curl "ldap://user:passwd@ldap.frontec.se/o=frontec??sub?mail=*" + +By default, if user and password provided, OpenLDAP/WinLDAP will use basic +authentication. On Windows you can control this behavior by providing one of +`--basic`, `--ntlm` or `--digest` option in curl command line + + curl --ntlm "ldap://user:passwd@ldap.frontec.se/o=frontec??sub?mail=*" + +On Windows, if no user/password specified, auto-negotiation mechanism will be +used with current logon credentials (SSPI/SPNEGO). + +## Environment Variables + +Curl reads and understands the following environment variables: + + http_proxy, HTTPS_PROXY, FTP_PROXY + +They should be set for protocol-specific proxies. General proxy should be set +with + + ALL_PROXY + +A comma-separated list of host names that shouldn't go through any proxy is +set in (only an asterisk, `*` matches all hosts) + + NO_PROXY + +If the host name matches one of these strings, or the host is within the +domain of one of these strings, transactions with that node will not be +proxied. When a domain is used, it needs to start with a period. A user can +specify that both www.example.com and foo.example.com should not use a proxy +by setting `NO_PROXY` to `.example.com`. By including the full name you can +exclude specific host names, so to make `www.example.com` not use a proxy but +still have `foo.example.com` do it, set `NO_PROXY` to `www.example.com`. + +The usage of the `-x`/`--proxy` flag overrides the environment variables. + +## Netrc + +Unix introduced the `.netrc` concept a long time ago. It is a way for a user +to specify name and password for commonly visited FTP sites in a file so that +you don't have to type them in each time you visit those sites. You realize +this is a big security risk if someone else gets hold of your passwords, so +therefore most unix programs won't read this file unless it is only readable +by yourself (curl doesn't care though). + +Curl supports `.netrc` files if told to (using the `-n`/`--netrc` and +`--netrc-optional` options). This is not restricted to just FTP, so curl can +use it for all protocols where authentication is used. + +A very simple `.netrc` file could look something like: + + machine curl.se login iamdaniel password mysecret + +## Custom Output + +To better allow script programmers to get to know about the progress of curl, +the `-w`/`--write-out` option was introduced. Using this, you can specify what +information from the previous transfer you want to extract. + +To display the amount of bytes downloaded together with some text and an +ending newline: + + curl -w 'We downloaded %{size_download} bytes\n' www.download.com + +## Kerberos FTP Transfer + +Curl supports kerberos4 and kerberos5/GSSAPI for FTP transfers. You need the +kerberos package installed and used at curl build time for it to be available. + +First, get the krb-ticket the normal way, like with the kinit/kauth tool. +Then use curl in way similar to: + + curl --krb private ftp://krb4site.com -u username:fakepwd + +There's no use for a password on the `-u` switch, but a blank one will make +curl ask for one and you already entered the real password to kinit/kauth. + +## TELNET + +The curl telnet support is basic and very easy to use. Curl passes all data +passed to it on stdin to the remote server. Connect to a remote telnet server +using a command line similar to: + + curl telnet://remote.server.com + +And enter the data to pass to the server on stdin. The result will be sent to +stdout or to the file you specify with `-o`. + +You might want the `-N`/`--no-buffer` option to switch off the buffered output +for slow connections or similar. + +Pass options to the telnet protocol negotiation, by using the `-t` option. To +tell the server we use a vt100 terminal, try something like: + + curl -tTTYPE=vt100 telnet://remote.server.com + +Other interesting options for it `-t` include: + + - `XDISPLOC=` Sets the X display location. + - `NEW_ENV=` Sets an environment variable. + +NOTE: The telnet protocol does not specify any way to login with a specified +user and password so curl can't do that automatically. To do that, you need to +track when the login prompt is received and send the username and password +accordingly. + +## Persistent Connections + +Specifying multiple files on a single command line will make curl transfer all +of them, one after the other in the specified order. + +libcurl will attempt to use persistent connections for the transfers so that +the second transfer to the same host can use the same connection that was +already initiated and was left open in the previous transfer. This greatly +decreases connection time for all but the first transfer and it makes a far +better use of the network. + +Note that curl cannot use persistent connections for transfers that are used +in subsequence curl invokes. Try to stuff as many URLs as possible on the same +command line if they are using the same host, as that'll make the transfers +faster. If you use an HTTP proxy for file transfers, practically all transfers +will be persistent. + +## Multiple Transfers With A Single Command Line + +As is mentioned above, you can download multiple files with one command line +by simply adding more URLs. If you want those to get saved to a local file +instead of just printed to stdout, you need to add one save option for each +URL you specify. Note that this also goes for the `-O` option (but not +`--remote-name-all`). + +For example: get two files and use `-O` for the first and a custom file +name for the second: + + curl -O http://url.com/file.txt ftp://ftp.com/moo.exe -o moo.jpg + +You can also upload multiple files in a similar fashion: + + curl -T local1 ftp://ftp.com/moo.exe -T local2 ftp://ftp.com/moo2.txt + +## IPv6 + +curl will connect to a server with IPv6 when a host lookup returns an IPv6 +address and fall back to IPv4 if the connection fails. The `--ipv4` and +`--ipv6` options can specify which address to use when both are +available. IPv6 addresses can also be specified directly in URLs using the +syntax: + + http://[2001:1890:1112:1::20]/overview.html + +When this style is used, the `-g` option must be given to stop curl from +interpreting the square brackets as special globbing characters. Link local +and site local addresses including a scope identifier, such as `fe80::1234%1`, +may also be used, but the scope portion must be numeric or match an existing +network interface on Linux and the percent character must be URL escaped. The +previous example in an SFTP URL might look like: + + sftp://[fe80::1234%251]/ + +IPv6 addresses provided other than in URLs (e.g. to the `--proxy`, +`--interface` or `--ftp-port` options) should not be URL encoded. + +## Mailing Lists + +For your convenience, we have several open mailing lists to discuss curl, its +development and things relevant to this. Get all info at +https://curl.se/mail/. + +Please direct curl questions, feature requests and trouble reports to one of +these mailing lists instead of mailing any individual. + +Available lists include: + +### curl-users + +Users of the command line tool. How to use it, what doesn't work, new +features, related tools, questions, news, installations, compilations, +running, porting etc. + +### curl-library + +Developers using or developing libcurl. Bugs, extensions, improvements. + +### curl-announce + +Low-traffic. Only receives announcements of new public versions. At worst, +that makes something like one or two mails per month, but usually only one +mail every second month. + +### curl-and-php + +Using the curl functions in PHP. Everything curl with a PHP angle. Or PHP with +a curl angle. + +### curl-and-python + +Python hackers using curl with or without the python binding pycurl. + diff --git a/curl/docs/MQTT.md b/curl/docs/MQTT.md new file mode 100644 index 00000000..aad2f522 --- /dev/null +++ b/curl/docs/MQTT.md @@ -0,0 +1,27 @@ +# MQTT in curl + +## Usage + +A plain "GET" subscribes to the topic and prints all published messages. +Doing a "POST" publishes the post data to the topic and exits. + +Example subscribe: + + curl mqtt://host/home/bedroom/temp + +Example publish: + + curl -d 75 mqtt://host/home/bedroom/dimmer + +## What does curl deliver as a response to a subscribe + +It outputs two bytes topic length (MSB | LSB), the topic followed by the +payload. + +## Caveats + +Remaining limitations: + - Only QoS level 0 is implemented for publish + - No way to set retain flag for publish + - No TLS (mqtts) support + - Naive EAGAIN handling won't handle split messages diff --git a/curl/docs/Makefile.am b/curl/docs/Makefile.am index 17b3909c..656d1ace 100644 --- a/curl/docs/Makefile.am +++ b/curl/docs/Makefile.am @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -40,13 +40,57 @@ DIST_SUBDIRS = $(SUBDIRS) examples libcurl CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES) $(MANDISTPAGES) curl.1 -EXTRA_DIST = MANUAL BUGS CONTRIBUTE.md FAQ FEATURES INTERNALS.md SSLCERTS.md \ - README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS KNOWN_BUGS \ - BINDINGS.md HISTORY.md INSTALL INSTALL.md LICENSE-MIXING.md \ - README.netware MAIL-ETIQUETTE HTTP-COOKIES.md SECURITY.md RELEASE-PROCEDURE \ - SSL-PROBLEMS.md HTTP2.md ROADMAP.md CODE_OF_CONDUCT.md CODE_STYLE.md \ - CHECKSRC.md CMakeLists.txt README.md CIPHERS.md INSTALL.cmake README.cmake \ - $(noinst_man_MANS) HELP-US.md +EXTRA_DIST = \ + $(noinst_man_MANS) \ + ALTSVC.md \ + BINDINGS.md \ + BUFREF.md \ + BUG-BOUNTY.md \ + BUGS.md \ + CHECKSRC.md \ + CIPHERS.md \ + CMakeLists.txt \ + CODE_OF_CONDUCT.md \ + CODE_REVIEW.md \ + CODE_STYLE.md \ + CONTRIBUTE.md \ + CURL-DISABLE.md \ + DEPRECATE.md \ + DYNBUF.md \ + ECH.md \ + EXPERIMENTAL.md \ + FAQ \ + FEATURES.md \ + GOVERNANCE.md \ + HELP-US.md \ + HISTORY.md \ + HSTS.md \ + HTTP-COOKIES.md \ + HTTP2.md \ + HTTP3.md \ + HYPER.md \ + INSTALL \ + INSTALL.cmake \ + INSTALL.md \ + INTERNALS.md \ + KNOWN_BUGS \ + MAIL-ETIQUETTE \ + MQTT.md \ + NEW-PROTOCOL.md \ + options-in-versions \ + PARALLEL-TRANSFERS.md \ + README.md \ + RELEASE-PROCEDURE.md \ + RUSTLS.md \ + ROADMAP.md \ + SECURITY-PROCESS.md \ + SSL-PROBLEMS.md \ + SSLCERTS.md \ + THANKS \ + TODO \ + TheArtOfHttpScripting.md \ + URL-SYNTAX.md \ + VERSIONS.md MAN2HTML= roffit $< >$@ @@ -62,7 +106,7 @@ SUFFIXES = .1 .html .pdf # have changed. $(abs_builddir)/curl.1: if test "$(top_builddir)x" != "$(top_srcdir)x" -a -e "$(srcdir)/curl.1"; then \ - cp -fp "$(srcdir)/curl.1" $@; fi + $(INSTALL_DATA) "$(srcdir)/curl.1" $@; fi cd cmdline-opts && $(MAKE) html: $(HTMLPAGES) @@ -81,3 +125,5 @@ pdf: $(PDFPAGES) rm $$foo.ps; \ echo "converted $< to $@") +distclean: + rm -f $(CLEANFILES) diff --git a/curl/docs/Makefile.in b/curl/docs/Makefile.in deleted file mode 100644 index 50d25968..00000000 --- a/curl/docs/Makefile.in +++ /dev/null @@ -1,871 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = docs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ - $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/xc-am-iface.m4 \ - $(top_srcdir)/m4/xc-cc-check.m4 \ - $(top_srcdir)/m4/xc-lt-iface.m4 \ - $(top_srcdir)/m4/xc-translit.m4 \ - $(top_srcdir)/m4/xc-val-flgs.m4 \ - $(top_srcdir)/m4/zz40-xc-ovr.m4 \ - $(top_srcdir)/m4/zz50-xc-ovr.m4 \ - $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -man1dir = $(mandir)/man1 -am__installdirs = "$(DESTDIR)$(man1dir)" -MANS = $(dist_man_MANS) $(man_MANS) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in INSTALL \ - THANKS TODO -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMB = @CURL_DISABLE_SMB@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ -CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@ -CYGPATH_W = @CYGPATH_W@ -DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -ENABLE_STATIC = @ENABLE_STATIC@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ -LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ -LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NROFF = @NROFF@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SSL_ENABLED = @SSL_ENABLED@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_DARWINSSL = @USE_DARWINSSL@ -USE_GNUTLS = @USE_GNUTLS@ -USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_MBEDTLS = @USE_MBEDTLS@ -USE_NGHTTP2 = @USE_NGHTTP2@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SCHANNEL = @USE_SCHANNEL@ -USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONNUM = @VERSIONNUM@ -ZLIB_LIBS = @ZLIB_LIBS@ -ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign no-dependencies - -# EXTRA_DIST breaks with $(abs_builddir) so build it using this variable -# but distribute it (using the relative file name) in the next variable -man_MANS = $(abs_builddir)/curl.1 -noinst_man_MANS = curl.1 mk-ca-bundle.1 -dist_man_MANS = curl-config.1 -GENHTMLPAGES = curl.html curl-config.html mk-ca-bundle.html -PDFPAGES = curl.pdf curl-config.pdf mk-ca-bundle.pdf -MANDISTPAGES = curl.1.dist curl-config.1.dist -HTMLPAGES = $(GENHTMLPAGES) index.html - -# Build targets in this file (.) before cmdline-opts to ensure that -# the curl.1 rule below runs first -SUBDIRS = . cmdline-opts -DIST_SUBDIRS = $(SUBDIRS) examples libcurl -CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES) $(MANDISTPAGES) curl.1 -EXTRA_DIST = MANUAL BUGS CONTRIBUTE.md FAQ FEATURES INTERNALS.md SSLCERTS.md \ - README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS KNOWN_BUGS \ - BINDINGS.md HISTORY.md INSTALL INSTALL.md LICENSE-MIXING.md \ - README.netware MAIL-ETIQUETTE HTTP-COOKIES.md SECURITY.md RELEASE-PROCEDURE \ - SSL-PROBLEMS.md HTTP2.md ROADMAP.md CODE_OF_CONDUCT.md CODE_STYLE.md \ - CHECKSRC.md CMakeLists.txt README.md CIPHERS.md INSTALL.cmake README.cmake \ - $(noinst_man_MANS) HELP-US.md - -MAN2HTML = roffit $< >$@ -SUFFIXES = .1 .html .pdf -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .1 .html .pdf -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign docs/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man1: $(dist_man_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - @list1=''; \ - list2='$(dist_man_MANS) $(man_MANS)'; \ - test -n "$(man1dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.1[a-z]*$$/p'; \ - fi; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(dist_man_MANS) $(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(MANS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(man1dir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-man - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: install-man1 - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-man - -uninstall-man: uninstall-man1 - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-man uninstall-man1 - -.PRECIOUS: Makefile - - -# $(abs_builddir) is to disable VPATH when searching for this file, which -# would otherwise find the copy in $(srcdir) which breaks the $(HUGE) -# rule in src/Makefile.am in out-of-tree builds that references the file in the -# build directory. -# -# First, seed the used copy of curl.1 with the prebuilt copy (in an out-of-tree -# build), then run make recursively to rebuild it only if its dependencies -# have changed. -$(abs_builddir)/curl.1: - if test "$(top_builddir)x" != "$(top_srcdir)x" -a -e "$(srcdir)/curl.1"; then \ - cp -fp "$(srcdir)/curl.1" $@; fi - cd cmdline-opts && $(MAKE) - -html: $(HTMLPAGES) - cd libcurl && $(MAKE) html - -pdf: $(PDFPAGES) - cd libcurl && $(MAKE) pdf - -.1.html: - $(MAN2HTML) - -.1.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/curl/docs/NEW-PROTOCOL.md b/curl/docs/NEW-PROTOCOL.md new file mode 100644 index 00000000..9984eea2 --- /dev/null +++ b/curl/docs/NEW-PROTOCOL.md @@ -0,0 +1,110 @@ +# Adding a new protocol? + +Every once in a while someone comes up with the idea of adding support for yet +another protocol to curl. After all, curl already supports 25 something +protocols and it is the Internet transfer machine for the world. + +In the curl project we love protocols and we love supporting many protocols +and do it well. + +So how do you proceed to add a new protocol and what are the requirements? + +## No fixed set of requirements + +This document is an attempt to describe things to consider. There is no +checklist of the twenty-seven things you need to cross off. We view the entire +effort as a whole and then judge if it seems to be the right thing - for +now. The more things that look right, fit our patterns and are done in ways +that align with our thinking, the better are the chances that we will agree +that supporting this protocol is a grand idea. + +## Mutual benefit is preferred + +curl is not here for your protocol. Your protocol is not here for curl. The +best cooperation and end result occur when all involved parties mutually see +and agree that supporting this protocol in curl would be good for everyone. +Heck, for the world! + +Consider "selling us" the idea that we need an implementation merged in curl, +to be fairly important. *Why* do we want curl to support this new protocol? + +## Protocol requirements + +### Client-side + +The protocol implementation is for a client's side of a "communication +session". + +### Transfer oriented + +The protocol itself should be focused on *transfers*. Be it uploads or +downloads or both. It should at least be possible to view the transfers as +such, like we can view reading emails over POP3 as a download and sending +emails over SMTP as an upload. + +If you cannot even shoehorn the protocol into a transfer focused view, then +you are up for a tough argument. + +### URL + +There should be a documented URL format. If there is an RFC for it there is no +question about it but the syntax doesn't have to be a published RFC. It could +be enough if it is already in use by other implementations. + +If you make up the syntax just in order to be able to propose it to curl, then +you are in a bad place. URLs are designed and defined for interoperability. +There should at least be a good chance that other clients and servers can be +implemented supporting the same URL syntax and work the same or similar way. + +URLs work on registered 'schemes'. There is a register of [all officially +recognized +schemes](https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml). If +your protocol is not in there, is it really a protocol we want? + +### Wide and public use + +The protocol shall already be used or have an expectation of getting used +widely. Experimental protocols are better off worked on in experiments first, +to prove themselves before they are adopted by curl. + +## Code + +Of course the code needs to be written, provided, licensed agreeably and it +should follow our code guidelines and review comments have to be dealt with. +If the implementation needs third party code, that third party code should not +have noticeably lesser standards than the curl project itself. + +## Tests + +As much of the protocol implementation as possible needs to be verified by +curl test cases. We must have the implementation get tested by CI jobs, +torture tests and more. + +We've experienced many times in the past how new implementations were brought +to curl and immediately once the code had been merged, the originator vanished +from the face of the earth. That is fine, but we need to take the necessary +precautions so when it happens we are still fine. + +Our test infrastructure is powerful enough to test just about every possible +protocol - but it might require a bit of an effort to make it happen. + +## Documentation + +We cannot assume that users are particularly familiar with specific details +and peculiarities of the protocol. It needs documentation. + +Maybe it even needs some internal documentation so that the developers who +will try to debug something five years from now can figure out functionality a +little easier! + +The protocol specification itself should be freely available without requiring +any NDA or similar. + +## Don't compare + +We are constantly raising the bar and we are constantly improving the +project. A lot of things we did in the past would not be acceptable if done +today. Therefore, you might be tempted to use shortcuts or "hacks" you can +spot other - existing - protocol implementations have used, but there is +nothing to gain from that. The bar has been raised. Former "cheats" won't be +tolerated anymore. diff --git a/curl/docs/PARALLEL-TRANSFERS.md b/curl/docs/PARALLEL-TRANSFERS.md new file mode 100644 index 00000000..da688ea0 --- /dev/null +++ b/curl/docs/PARALLEL-TRANSFERS.md @@ -0,0 +1,58 @@ +# Parallel transfers + +curl 7.66.0 introduces support for doing multiple transfers simultaneously; in +parallel. + +## -Z, --parallel + +When this command line option is used, curl will perform the transfers given +to it at the same time. It will do up to `--parallel-max` concurrent +transfers, with a default value of 50. + +## Progress meter + +The progress meter that is displayed when doing parallel transfers is +completely different than the regular one used for each single transfer. + + It shows: + + o percent download (if known, which means *all* transfers need to have a + known size) + o percent upload (if known, with the same caveat as for download) + o total amount of downloaded data + o total amount of uploaded data + o number of transfers to perform + o number of concurrent transfers being transferred right now + o number of transfers queued up waiting to start + o total time all transfers are expected to take (if sizes are known) + o current time the transfers have spent so far + o estimated time left (if sizes are known) + o current transfer speed (the faster of UL/DL speeds measured over the last + few seconds) + +Example: + + DL% UL% Dled Uled Xfers Live Qd Total Current Left Speed + 72 -- 37.9G 0 101 30 23 0:00:55 0:00:34 0:00:22 2752M + +## Behavior differences + +Connections are shared fine between different easy handles, but the +"authentication contexts" are not. So for example doing HTTP Digest auth with +one handle for a particular transfer and then continue on with another handle +that reuses the same connection, the second handle can't send the necessary +Authorization header at once since the context is only kept in the original +easy handle. + +To fix this, the authorization state could be made possible to share with the +share API as well, as a context per origin + path (realm?) basically. + +Visible in test 153, 1412 and more. + +## Feedback! + +This is early days for parallel transfer support. Keep your eyes open for +unintended side effects or downright bugs. + +Tell us what you think and how you think we could improve this feature! + diff --git a/curl/docs/README.cmake b/curl/docs/README.cmake deleted file mode 100644 index 084c1de6..00000000 --- a/curl/docs/README.cmake +++ /dev/null @@ -1,16 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - -README.cmake - Read the README file first. - - Curl contains CMake build files that provide a way to build Curl with the - CMake build tool (www.cmake.org). CMake is a cross platform meta build tool - that generates native makefiles and IDE project files. The CMake build - system can be used to build Curl on any of its supported platforms. - - Read the INSTALL.cmake file for instructions on how to compile curl with - CMake. diff --git a/curl/docs/README.md b/curl/docs/README.md index 56691fc4..07838504 100644 --- a/curl/docs/README.md +++ b/curl/docs/README.md @@ -1,4 +1,4 @@ -![curl logo](https://cdn.rawgit.com/curl/curl-www/master/logo/curl-logo.svg) +![curl logo](https://curl.se/logo/curl-logo.svg) # Documentation @@ -7,6 +7,6 @@ subdirectories, using several different formats. Some of them are not ideal for reading directly in your browser. If you'd rather see the rendered version of the documentation, check out the -curl web site's [documentation section](https://curl.haxx.se/docs/) for -general curl stuff or the [libcurl section](https://curl.haxx.se/libcurl/) for +curl website's [documentation section](https://curl.se/docs/) for +general curl stuff or the [libcurl section](https://curl.se/libcurl/) for libcurl related documentation. diff --git a/curl/docs/README.netware b/curl/docs/README.netware deleted file mode 100644 index 9028963f..00000000 --- a/curl/docs/README.netware +++ /dev/null @@ -1,26 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - -README.netware - - Read the README file first. - - Curl has been successfully compiled with gcc / nlmconv on different flavours - of Linux as well as with the official Metrowerks CodeWarrior compiler. - While not being the main development target, a continuously growing share of - curl users are NetWare-based, especially also consuming the lib from PHP. - - The unix-style man pages are tricky to read on windows, so therefore all - those pages are also provided as web pages on the curl web site. - - The main curl.1 man page is also "built-in" in the command line tool. Use a - command line similar to this in order to extract a separate text file: - - curl -M >manual.txt - - Read the INSTALL file for instructions on how to compile curl self. - - diff --git a/curl/docs/README.win32 b/curl/docs/README.win32 deleted file mode 100644 index 00ca197f..00000000 --- a/curl/docs/README.win32 +++ /dev/null @@ -1,25 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - -README.win32 - - Read the README file first. - - Curl has been compiled, built and run on all sorts of Windows and win32 - systems. While not being the main develop target, a fair share of curl users - are win32-based. - - The unix-style man pages are tricky to read on windows, so therefore all - those pages are also provided as web pages on the curl web site. - - The main curl.1 man page is also "built-in" in the command line tool. Use a - command line similar to this in order to extract a separate text file: - - curl -M >manual.txt - - Read the INSTALL file for instructions on how to compile curl self. - - diff --git a/curl/docs/RELEASE-PROCEDURE b/curl/docs/RELEASE-PROCEDURE.md similarity index 65% rename from curl/docs/RELEASE-PROCEDURE rename to curl/docs/RELEASE-PROCEDURE.md index b7f8fcda..26d5dedb 100644 --- a/curl/docs/RELEASE-PROCEDURE +++ b/curl/docs/RELEASE-PROCEDURE.md @@ -4,6 +4,8 @@ curl release procedure - how to do a release in the source code repo ----------------------- +- run `./scripts/copyright.pl` and correct possible omissions + - edit `RELEASE-NOTES` to be accurate - update `docs/THANKS` @@ -11,11 +13,12 @@ in the source code repo - make sure all relevant changes are committed on the master branch - tag the git repo in this style: `git tag -a curl-7_34_0`. -a annotates the - tag and we use underscores instead of dots in the version number. + tag and we use underscores instead of dots in the version number. Make sure + the tag is GPG signed (using -s). - run "./maketgz 7.34.0" to build the release tarballs. It is important that you run this on a machine with the correct set of autotools etc installed - as this is what then will be shipped and used by most users on *nix like + as this is what then will be shipped and used by most users on \*nix like systems. - push the git commits and the new tag @@ -35,13 +38,13 @@ in the curl-www repo - commit all local changes -- tag the repo with the same tag as used for the source repo +- tag the repo with the same name as used for the source repo. - make sure all relevant changes are committed and pushed on the master branch - (the web site then updates its contents automatically) + (the website then updates its contents automatically) -on github +on GitHub --------- - edit the newly made release tag so that it is listed as the latest release @@ -60,12 +63,12 @@ celebrate curl release scheduling ======================= -Basics ------- +Release Cycle +------------- We do releases every 8 weeks on Wednesdays. If critical problems arise, we can insert releases outside of the schedule or we can move the release date - but -this is very rare. +this is rare. Each 8 week release cycle is split in two 4-week periods. @@ -77,19 +80,33 @@ Each 8 week release cycle is split in two 4-week periods. then only focus on fixing bugs and polishing things to make a solid coming release. +- After a regular procedure-following release (made on Wednesdays), the + feature window remains closed until the following Monday in case of special + actions or patch releases etc. + +If a future release date happens to end up on a "bad date", like in the middle +of common public holidays or when the lead release manager is away traveling, +the release date can be moved forwards or backwards a full week. This is then +advertised well in advance. + Coming dates ------------ Based on the description above, here are some planned release dates (at the time of this writing): -- November 29, 2017 -- January 24, 2018 -- March 21, 2018 -- May 16, 2018 -- July 11, 2018 -- September 5, 2018 -- October 31, 2018 -- December 26, 2018 -- February 20, 2019 -- April 17, 2019 +- September 15, 2021 (7.79.0) +- November 10, 2021 +- January 5, 2022 +- March 2, 2022 +- April 27, 2022 +- June 22, 2022 +- August 17, 2022 +- October 12, 2022 +- December 7, 2022 +- February 1, 2023 +- March 20, 2023 (8.0.0) + +The above (and more) curl-related dates are published in +[iCalendar format](https://calendar.google.com/calendar/ical/c9u5d64odop9js55oltfarjk6g%40group.calendar.google.com/public/basic.ics) +as well. diff --git a/curl/docs/RESOURCES b/curl/docs/RESOURCES deleted file mode 100644 index 1ad8aac3..00000000 --- a/curl/docs/RESOURCES +++ /dev/null @@ -1,83 +0,0 @@ - _ _ ____ _ - Project ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - - -This document lists documents and standards used by curl. - - RFC 959 - The FTP protocol - - RFC 1635 - How to Use Anonymous FTP - - RFC 1738 - Uniform Resource Locators - - RFC 1777 - defines the LDAP protocol - - RFC 1808 - Relative Uniform Resource Locators - - RFC 1867 - Form-based File Upload in HTML - - RFC 1950 - ZLIB Compressed Data Format Specification - - RFC 1951 - DEFLATE Compressed Data Format Specification - - RFC 1952 - gzip compression format - - RFC 1959 - LDAP URL syntax - - RFC 2045-2049 - Everything you need to know about MIME! (needed for form - based upload) - - RFC 2068 - HTTP 1.1 (obsoleted by RFC 2616) - - RFC 2104 - Keyed-Hashing for Message Authentication - - RFC 2109 - HTTP State Management Mechanism (cookie stuff) - - Also, read Netscape's specification at - https://curl.haxx.se/rfc/cookie_spec.html - - RFC 2183 - The Content-Disposition Header Field - - RFC 2195 - CRAM-MD5 authentication - - RFC 2229 - A Dictionary Server Protocol - - RFC 2255 - Newer LDAP URL syntax document. - - RFC 2231 - MIME Parameter Value and Encoded Word Extensions: - Character Sets, Languages, and Continuations - - RFC 2388 - "Returning Values from Forms: multipart/form-data" - Use this as an addition to the RFC1867 - - RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics" This - one obsoletes RFC 1738, but since RFC 1738 is often mentioned - I've left it in this list. - - RFC 2428 - FTP Extensions for IPv6 and NATs - - RFC 2577 - FTP Security Considerations - - RFC 2616 - HTTP 1.1, the latest - - RFC 2617 - HTTP Authentication - - RFC 2718 - Guidelines for new URL Schemes - - RFC 2732 - Format for Literal IPv6 Addresses in URL's - - RFC 2818 - HTTP Over TLS (TLS is the successor to SSL) - - RFC 2821 - SMTP protocol - - RFC 2964 - Use of HTTP State Management - - RFC 2965 - HTTP State Management Mechanism. Cookies. Obsoletes RFC2109 - - RFC 3207 - SMTP over TLS - - RFC 4616 - PLAIN authentication - - RFC 4954 - SMTP Authentication diff --git a/curl/docs/ROADMAP.md b/curl/docs/ROADMAP.md index 1007ccb0..79e8b03a 100644 --- a/curl/docs/ROADMAP.md +++ b/curl/docs/ROADMAP.md @@ -1,118 +1,24 @@ -curl the next few years - perhaps -================================= +# curl the next few years - perhaps -Roadmap of things Daniel Stenberg and Steve Holme want to work on next. It is -intended to serve as a guideline for others for information, feedback and -possible participation. +Roadmap of things Daniel Stenberg wants to work on next. It is intended to +serve as a guideline for others for information, feedback and possible +participation. -QUIC ----- +## "Complete" the HTTP/3 support -The standardization process of QUIC has been taken to the IETF and can be -followed on the [IETF QUIC Mailing -list](https://www.ietf.org/mailman/listinfo/quic). I'd like us to get on the -bandwagon. Ideally, this would be done with a separate library/project to -handle the binary/framing layer in a similar fashion to how HTTP/2 is -implemented. This, to allow other projects to benefit from the work and to -thus broaden the interest and chance of others to participate. +curl has experimental support for HTTP/3 since a good while back. There are +some functionality missing and once the final specs are published we want to +eventually remove the "experimental" label from this functionality. -HTTP cookies ------------- +## HTTPS DNS records -Two cookie drafts have been adopted by the httpwg in IETF and we should -support them as the popular browsers will as well: +As a DNS version of alt-svc and also a pre-requisite for ECH (see below). -[Deprecate modification of 'secure' cookies from non-secure -origins](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone-00) +See: https://tools.ietf.org/html/draft-ietf-dnsop-svcb-https-02 -[Cookie Prefixes](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00) +## ECH (Encrypted Client Hello - formerly known as ESNI) -[Firefox bug report about secure cookies](https://bugzilla.mozilla.org/show_bug.cgi?id=976073) + See Daniel's post on [Support of Encrypted + SNI](https://curl.se/mail/lib-2019-03/0000.html) on the mailing list. -SRV records ------------ - -How to find services for specific domains/hosts. - -curl_formadd() --------------- - -make sure there's an easy handle passed in to `curl_formadd()`, -`curl_formget()` and `curl_formfree()` by adding replacement functions and -deprecating the old ones to allow custom mallocs and more. - -Or perhaps even better: revamp the formpost API completely while we're at it -and making something that is easier to use and understand: - - https://github.com/curl/curl/wiki/formpost-API-redesigned - -Third-party SASL ----------------- - -Add support for third-party SASL libraries such as Cyrus SASL. - -SASL authentication in LDAP ---------------------------- - -... - -Simplify the SMTP email ------------------------ - -Simplify the SMTP email interface so that programmers don't have to -construct the body of an email that contains all the headers, alternative -content, images and attachments - maintain raw interface so that -programmers that want to do this can - -email capabilities ------------------- - -Allow the email protocols to return the capabilities before -authenticating. This will allow an application to decide on the best -authentication mechanism - -Win32 pthreads --------------- - -Allow Windows threading model to be replaced by Win32 pthreads port - -dynamic buffer size -------------------- - -Implement a dynamic buffer size to allow SFTP to use much larger buffers and -possibly allow the size to be customizable by applications. Use less memory -when handles are not in use? - -New stuff - curl ----------------- - -1. Embed a language interpreter (lua?). For that middle ground where curl - isn’t enough and a libcurl binding feels “too much”. Build-time conditional - of course. - -2. Simplify the SMTP command line so that the headers and multi-part content - don't have to be constructed before calling curl - -Improve -------- - -1. build for windows (considered hard by many users) - -2. curl -h output (considered overwhelming to users) - -3. we have > 200 command line options, is there a way to redo things to - simplify or improve the situation as we are likely to keep adding - features/options in the future too - -4. authentication framework (consider merging HTTP and SASL authentication to - give one API for protocols to call) - -5. Perform some of the clean up from the TODO document, removing old - definitions and such like that are currently earmarked to be removed years - ago - -Remove ------- - -1. makefile.vc files as there is no point in maintaining two sets of Windows - makefiles. Note: These are currently being used by the Windows autobuilds + Initial work exists in https://github.com/curl/curl/pull/4011 diff --git a/curl/docs/RUSTLS.md b/curl/docs/RUSTLS.md new file mode 100644 index 00000000..ecce4300 --- /dev/null +++ b/curl/docs/RUSTLS.md @@ -0,0 +1,26 @@ +# Rustls + +[Rustls is a TLS backend written in Rust.](https://docs.rs/rustls/). Curl can +be built to use it as an alternative to OpenSSL or other TLS backends. We use +the [rustls-ffi C bindings](https://github.com/rustls/rustls-ffi/). This +version of curl depends on version v0.7.0 of rustls-ffi. + +# Building with rustls + +First, [install Rust](https://rustup.rs/). + +Next, check out, build, and install the appropriate version of rustls-ffi: + + % cargo install cbindgen + % git clone https://github.com/rustls/rustls-ffi -b v0.7.0 + % cd rustls-ffi + % make + % make DESTDIR=${HOME}/rustls-ffi-built/ install + +Now configure and build curl with rustls: + + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % ./configure --with-rustls=${HOME}/rustls-ffi-built + % make diff --git a/curl/docs/SECURITY.md b/curl/docs/SECURITY-PROCESS.md similarity index 51% rename from curl/docs/SECURITY.md rename to curl/docs/SECURITY-PROCESS.md index c88cc9c8..383d0c07 100644 --- a/curl/docs/SECURITY.md +++ b/curl/docs/SECURITY-PROCESS.md @@ -1,18 +1,17 @@ -curl security for developers -============================ +curl security process +===================== -This document is intended to provide guidance to curl developers on how -security vulnerabilities should be handled. +This document describes how security vulnerabilities should be handled in the +curl project. Publishing Information ---------------------- All known and public curl or libcurl related vulnerabilities are listed on -[the curl web site security page](https://curl.haxx.se/docs/security.html). +[the curl website security page](https://curl.se/docs/security.html). -Security vulnerabilities should not be entered in the project's public bug -tracker unless the necessary configuration is in place to limit access to the -issue to only the reporter and the project's security team. +Security vulnerabilities **should not** be entered in the project's public bug +tracker. Vulnerability Handling ---------------------- @@ -23,20 +22,20 @@ No information should be made public about a vulnerability until it is formally announced at the end of this process. That means, for example that a bug tracker entry must NOT be created to track the issue since that will make the issue public and it should not be discussed on any of the project's public -mailing lists. Also messages associated with any commits should not make -any reference to the security nature of the commit if done prior to the public +mailing lists. Also messages associated with any commits should not make any +reference to the security nature of the commit if done prior to the public announcement. -- The person discovering the issue, the reporter, reports the vulnerability - privately to `curl-security@haxx.se`. That's an email alias that reaches a - handful of selected and trusted people. +- The person discovering the issue, the reporter, reports the vulnerability on + [https://hackerone.com/curl](https://hackerone.com/curl). Issues filed there + reach a handful of selected and trusted people. - Messages that do not relate to the reporting or managing of an undisclosed security vulnerability in curl or libcurl are ignored and no further action is required. -- A person in the security team sends an e-mail to the original reporter to - acknowledge the report. +- A person in the security team responds to the original report to acknowledge + that a human has seen the report. - The security team investigates the report and either rejects it or accepts it. @@ -51,29 +50,32 @@ announcement. should involve the reporter as much as possible. - The release of the information should be "as soon as possible" and is most - often synced with an upcoming release that contains the fix. If the - reporter, or anyone else, thinks the next planned release is too far away - then a separate earlier release for security reasons should be considered. + often synchronized with an upcoming release that contains the fix. If the + reporter, or anyone else involved, thinks the next planned release is too + far away, then a separate earlier release should be considered. - Write a security advisory draft about the problem that explains what the - problem is, its impact, which versions it affects, solutions or - workarounds, when the release is out and make sure to credit all - contributors properly. + problem is, its impact, which versions it affects, solutions or workarounds, + when the release is out and make sure to credit all contributors properly. + Figure out the CWE (Common Weakness Enumeration) number for the flaw. - Request a CVE number from - [distros@openwall](http://oss-security.openwall.org/wiki/mailing-lists/distros) - when also informing and preparing them for the upcoming public security - vulnerability announcement - attach the advisory draft for information. Note - that 'distros' won't accept an embargo longer than 19 days and they do not - care for Windows-specific flaws. For windows-specific flaws, request CVE - directly from MITRE. + [HackerOne](https://docs.hackerone.com/programs/cve-requests.html) - Update the "security advisory" with the CVE number. - The security team commits the fix in a private branch. The commit message - should ideally contain the CVE number. This fix is usually also distributed - to the 'distros' mailing list to allow them to use the fix prior to the - public announcement. + should ideally contain the CVE number. + +- The security team also decides on and delivers a monetary reward to the + reporter as per the bug-bounty polices. + +- No more than 10 days before release, inform + [distros@openwall](https://oss-security.openwall.org/wiki/mailing-lists/distros) + to prepare them about the upcoming public security vulnerability + announcement - attach the advisory draft for information with CVE and + current patch. 'distros' does not accept an embargo longer than 14 days and + they do not care for Windows-specific flaws. - No more than 48 hours before the release, the private branch is merged into the master branch and pushed. Once pushed, the information is accessible to @@ -87,24 +89,15 @@ announcement. the same manner we always announce releases. It gets sent to the curl-announce, curl-library and curl-users mailing lists. -- The security web page on the web site should get the new vulnerability +- The security web page on the website should get the new vulnerability mentioned. -Pre-notification ----------------- - -If you think you are or should be eligible for a pre-notification about -upcoming security announcements for curl, we urge OS distros and similar -vendors to primarily join the distros@openwall list as that is one of the -purposes of that list - and not just for curl of course. - -If you are not a distro or otherwise not suitable for distros@openwall and yet -want pre-notifications from us, contact the curl security team with a detailed -and clear explanation why this is the case. - -curl-security (at haxx dot se) +security (at curl dot se) ------------------------------ +This is a private mailing list for discussions on and about curl security +issues. + Who is on this list? There are a couple of criteria you must meet, and then we might ask you to join the list or you can ask to join it. It really isn't very formal. We basically only require that you have a long-term presence in the @@ -114,3 +107,35 @@ plans in vanishing in the near future. We do not make the list of participants public mostly because it tends to vary somewhat over time and a list somewhere will only risk getting outdated. + +Publishing Security Advisories +------------------------------ + +1. Write up the security advisory, using markdown syntax. Use the same + subtitles as last time to maintain consistency. + +2. Name the advisory file after the allocated CVE id. + +3. Add a line on the top of the array in `curl-www/docs/vuln.pm'. + +4. Put the new advisory markdown file in the curl-www/docs/ directory. Add it + to the git repo. + +5. Run `make` in your local web checkout and verify that things look fine. + +6. On security advisory release day, push the changes on the curl-www + repository's remote master branch. + +Hackerone +--------- + +Request the issue to be disclosed. If there are sensitive details present in +the report and discussion, those should be redacted from the disclosure. The +default policy is to disclose as much as possible as soon as the vulnerability +has been published. + +Bug Bounty +---------- + +See [BUG-BOUNTY](https://curl.se/docs/bugbounty.html) for details on the +bug bounty program. diff --git a/curl/docs/SSL-PROBLEMS.md b/curl/docs/SSL-PROBLEMS.md index 91803e22..54f98534 100644 --- a/curl/docs/SSL-PROBLEMS.md +++ b/curl/docs/SSL-PROBLEMS.md @@ -23,8 +23,18 @@ ## CA bundle missing intermediate certificates When using said CA bundle to verify a server cert, you will experience - problems if your CA cert does not have the certificates for the - intermediates in the whole trust chain. + problems if your CA store does not contain the certificates for the + intermediates if the server doesn't provide them. + + The TLS protocol mandates that the intermediate certificates are sent in the + handshake, but as browsers have ways to survive or work around such + omissions, missing intermediates in TLS handshakes still happen that + browser-users won't notice. + + Browsers work around this problem in two ways: they cache intermediate + certificates from previous transfers and some implement the TLS "AIA" + extension that lets the client explicitly download such certificates on + demand. ## Protocol version @@ -36,7 +46,8 @@ An additional complication can be that modern SSL libraries sometimes are built with support for older SSL and TLS versions disabled! - All versions of SSL are considered insecure and should be avoided. Use TLS. + All versions of SSL and the TLS versions before 1.2 are considered insecure + and should be avoided. Use TLS 1.2 or later. ## Ciphers @@ -53,9 +64,9 @@ Note that these weak ciphers are identified as flawed. For example, this includes symmetric ciphers with less than 128 bit keys and RC4. - WinSSL in Windows XP is not able to connect to servers that no longer + Schannel in Windows XP is not able to connect to servers that no longer support the legacy handshakes and algorithms used by those versions, so we - advice against building curl to use WinSSL on really old Windows versions. + advice against building curl to use Schannel on really old Windows versions. References: @@ -77,11 +88,11 @@ Some SSL backends may do certificate revocation checks (CRL, OCSP, etc) depending on the OS or build configuration. The --ssl-no-revoke option was introduced in 7.44.0 to disable revocation checking but currently is only - supported for WinSSL (the native Windows SSL library), with an exception in - the case of Windows' Untrusted Publishers blacklist which it seems can't be - bypassed. This option may have broader support to accommodate other SSL + supported for Schannel (the native Windows SSL library), with an exception + in the case of Windows' Untrusted Publishers block list which it seems can't + be bypassed. This option may have broader support to accommodate other SSL backends in the future. References: - https://curl.haxx.se/docs/ssl-compared.html + https://curl.se/docs/ssl-compared.html diff --git a/curl/docs/SSLCERTS.md b/curl/docs/SSLCERTS.md index 3fcd345b..415b540a 100644 --- a/curl/docs/SSLCERTS.md +++ b/curl/docs/SSLCERTS.md @@ -14,7 +14,7 @@ If libcurl was built with Schannel or Secure Transport support (the native SSL libraries included in Windows and Mac OS X), then this does not apply to you. Scroll down for details on how the OS-native engines handle SSL certificates. If you're not sure, then run "curl -V" and read the results. If -the version string says "WinSSL" in it, then it was built with Schannel +the version string says `Schannel` in it, then it was built with Schannel support. It is about trust @@ -55,13 +55,13 @@ server, do one of the following: 2. Get a CA certificate that can verify the remote server and use the proper option to point out this CA cert for verification when connecting. For - libcurl hackers: `curl_easy_setopt(curl, CURLOPT_CAPATH, capath);` + libcurl hackers: `curl_easy_setopt(curl, CURLOPT_CAINFO, cacert);` With the curl command line tool: --cacert [file] 3. Add the CA cert for your server to the existing default CA certificate - store. The default CA certificate store can changed at compile time with the - following configure options: + store. The default CA certificate store can be changed at compile time with + the following configure options: --with-ca-bundle=FILE: use the specified file as CA certificate store. CA certificates need to be concatenated in PEM format into this file. @@ -92,8 +92,8 @@ server, do one of the following: If you use the 'openssl' tool, this is one way to get extract the CA cert for a particular server: - - `openssl s_client -connect xxxxx.com:443 |tee logfile` - - type "QUIT", followed by the "ENTER" key + - `openssl s_client -showcerts -servername server -connect server:443 > cacert.pem` + - type "quit", followed by the "ENTER" key - The certificate will have "BEGIN CERTIFICATE" and "END CERTIFICATE" markers. - If you want to see the data in the certificate, you can do: "openssl @@ -104,7 +104,7 @@ server, do one of the following: the security is no better than the way you obtained the certificate. 4. If you're using the curl command line tool, you can specify your own CA - cert path by setting the environment variable `CURL_CA_BUNDLE` to the path + cert file by setting the environment variable `CURL_CA_BUNDLE` to the path of your choice. If you're using the curl command line tool on Windows, curl will search @@ -119,7 +119,7 @@ server, do one of the following: 5. Get a better/different/newer CA cert bundle! One option is to extract the one a recent Firefox browser uses by running 'make ca-bundle' in the curl build tree root, or possibly download a version that was generated this - way for you: [CA Extract](https://curl.haxx.se/docs/caextract.html) + way for you: [CA Extract](https://curl.se/docs/caextract.html) Neglecting to use one of the above methods when dealing with a server using a certificate that isn't signed by one of the certificates in the installed CA diff --git a/curl/docs/THANKS b/curl/docs/THANKS index 14a13193..25aa996e 100644 --- a/curl/docs/THANKS +++ b/curl/docs/THANKS @@ -4,49 +4,83 @@ If you have contributed but are missing here, please let us know! -"Captain Basil" -"Spoon Man" +0xee on github +0xflotus on github +1ocalhost on github +3dyd on github +3eka on github +a1346054 on github Aaro Koskinen Aaron Oneal Aaron Orenstein +Aaron Scarisbrick +aasivov on github Abram Pousada +accountantM on github +AceCrow on Github +Adam Barclay +Adam Brown +Adam Coyne Adam D. Moss Adam Langley Adam Light +Adam Marcionek Adam Piggott Adam Sampson Adam Tkac +Adnan Khan +adnn on github +Adrian Burcea +Adrian Peniak Adrian Schuur Adriano Meirelles +afrind on github +ahodesuka on github Ajit Dhumale Akhil Kedia Aki Koskinen Akos Pasztory Akshay Vernekar Alain Danteny +Alain Miniussi Alan Jenkins Alan Pinstein Albert Chin-A-Young Albert Choy -Ale Vesely +Albin Vass Alejandro Alvarez Ayllon +Alejandro Colomar +Alejandro R. Sedeño Aleksandar Milivojevic +Aleksander Mazur +Aleksandr Krotov Aleksey Tulinov Ales Mlakar Ales Novak Alessandro Ghedini Alessandro Vesely +Alex aka WindEagle +Alex Baines Alex Bligh Alex Chan +Alex Crichton Alex Fishman +Alex Gaynor +Alex Grebenschikov Alex Gruz +Alex Kiernan +Alex Konev +Alex Malinovich +Alex Mayorga Alex McLellan Alex Neblett +Alex Nichols Alex Potapenko Alex Rousskov +Alex Samorukov Alex Suykov Alex Vinnik -Alex aka WindEagle +Alex Xu Alexander Beedie Alexander Dyagilev Alexander Elgert @@ -58,133 +92,213 @@ Alexander Pepper Alexander Peslyak Alexander Sinditskiy Alexander Traud +Alexander V. Tikhonov Alexander Zhuravlev +Alexandre Pion Alexey Borzov +Alexey Eremikhin Alexey Melnichuk Alexey Pesternikov Alexey Simak Alexey Zakhlestin Alexis Carvalho Alexis La Goutte +Alexis Vachette +Alfonso Martone Alfred Gebert Allen Pulsifer Alona Rossen +Amaury Denoyelle +amishmm on github +Amit Katyal Amol Pattekar Amr Shahin Anatol Belski Anatoli Tubman Anders Bakken +Anders Berg Anders Gustafsson Anders Havn Anders Roxell +Anderson Sasaki +Anderson Toshiyuki Sasaki Andi Jahja Andre Guibert de Bruet Andre Heinecke +Andrea Pappacoda Andreas Damm -Andreas Faerber +Andreas Falkenhahn Andreas Farber +Andreas Fischer +Andreas Kostyrka Andreas Malzahn Andreas Ntaflos Andreas Olsson Andreas Rieke Andreas Roth +Andreas Schneider Andreas Schuldei Andreas Streichardt Andreas Wurf Andrei Benea +Andrei Bica Andrei Cipu Andrei Karas Andrei Kurushin +Andrei Neculau +Andrei Rybak Andrei Sedoi +Andrei Valeriu BICA +Andrei Virtosu Andrej E Baranov +Andrew Barnert +Andrew Barnes Andrew Benham Andrew Biggs Andrew Bushnell +Andrew de los Reyes Andrew Francis Andrew Fuller +Andrew Ishchuk Andrew Krieger Andrew Kurushin +Andrew Lambert Andrew Moise +Andrew Potter Andrew Robbins Andrew Wansink -Andrew de los Reyes +Andrey Gursky Andrey Labunets Andrii Moiseiev +Andrius Merkys Andrés García Andy Cedilnik +Andy Fiddaman Andy Serpa Andy Tsouladze Angus Mackay +anio on github +anshnd on github +Antarpreet Singh Anthon Pang Anthony Avina Anthony Bryan Anthony G. Basile +Anthony Ramine +Anthony Shaw Antoine Aubert Antoine Calando Anton Bychkov +Anton Gerasimov Anton Kalmykov Anton Malov Anton Yabchinskiy +Antoni Villalonga Antonio Larrosa Antony74 on github Antti Hätälä +April King +arainchik on github +Archangel_SDY on github Arkadiusz Miskiewicz Armel Asselin Arnaud Compan Arnaud Ebalard +Arnaud Rebillout +Aron Bergman +Aron Rotteveel Artak Galoyan Arthur Murray +Artur Sinila Arve Knudsen Arvid Norberg +arvids-kokins-bidstack on github +asavah on github Ashish Shukla +Ashwin Metpalli Ask Bjørn Hansen Askar Safin Ates Goral Augustus Saunders +Austin Green Avery Fay +awesomenode on github Axel Tillequin +Ayoub Boudhar +Ayushman Singh Chauhan +b9a1 on github +Bachue Zhou Balaji Parasuram +Balaji S Rao Balaji Salunke +Balazs Kovacsics Balint Szilakszi Barry Abrahamson +Barry Pollard Bart Whiteley +Baruch Siach Bas Mevissen +Bas van Schaik +Bastian Krause +Bastien Bouclet +Basuke Suzuki +baumanj on github +bdry on github +beckenc on github Ben Boeckel Ben Darnell Ben Greear +Ben Kohler Ben Madsen Ben Noordhuis Ben Van Hof +Ben Voris Ben Winslow +Benau on github Benbuck Nason Benjamin Gerard Benjamin Gilbert Benjamin Johnson Benjamin Kircher +Benjamin Riefenstahl +Benjamin Ritcey Benjamin Sergeant Benoit Neil Benoit Sigoure Bernard Leak Bernard Spil +Bernd Mueller +Bernhard Iselborn Bernhard M. Wiedemann Bernhard Reutner-Fischer +Bernhard Walle Bert Huijben Bertrand Demiddelaer Bertrand Simonnet +Bevan Weiss Bill Doyle Bill Egert Bill Hoffman Bill Middlecamp Bill Nagel Bill Pyne +Billyzou0741326 on github +Bin Lan +Bin Meng +Bjarni Ingi Gislason +Bjoern Franke Bjoern Sikora Bjorn Augustsson Bjorn Reese Björn Stenberg Blaise Potard +Blake Burkhart +bnfp on github Bob Relyea Bob Richmond Bob Schader +bobmitchell1956 on github +Bodo Bergmann Bogdan Nicula Brad Burdick Brad Fitzpatrick @@ -193,15 +307,21 @@ Brad Hards Brad King Brad Spencer Bradford Bruce +bramus on github Brandon Casey +Brandon Dong Brandon Wang Brendan Jurd Brent Beardsley Brian Akins +Brian Bergeron Brian Carpenter +Brian Chaplin Brian Childs Brian Chrisman Brian Dessent +Brian E. Gallew +Brian Inglis Brian J. Murrell Brian Prodoehl Brian R Duffy @@ -210,27 +330,50 @@ Brock Noland Bru Rom Bruce Mitchener Bruce Stephens -Bruno Thomsen +BrumBrum on hackerone Bruno de Carvalho +Bruno Grasselli +Bruno Thomsen Bryan Henderson Bryan Kemp +bsammon on github +Bubu on github +buzo-ffm on github +bxac on github +Bylon2 on github Byrial Jensen +Caleb Raitto +Calvin Buckley +Cameron Cawley Cameron Kaiser Cameron MacMinn Camille Moncelier +Cao ZhenXiang Caolan McNamara +Captain Basil +Carie Pointer +Carl Zogheib Carlo Cannas +Carlo Marcelo Arenas Belón Carlo Teubner Carlo Wood +Carlos ORyan Carsten Lange Casey O'Donnell Catalin Patulea +causal-agent on github +cbartl on github +cclauss on github +Cesar Eduardo Barros Chad Monroe Chandrakant Bagul Charles Kerr Charles Romestant Chen Prog +Cherish98 on github +Chester Liu Chih-Chung Chang +Chih-Hsuan Yen Chris "Bob Bob" Chris Araman Chris Carlmar @@ -242,6 +385,8 @@ Chris Flerackers Chris Gaukroger Chris Maltby Chris Mumford +Chris Paulson-Ellis +Chris Roberts Chris Smowton Chris Young Christian Fillion @@ -255,81 +400,121 @@ Christian Schmitz Christian Stewart Christian Vogt Christian Weisgerber +Christoph Krey +Christoph M. Becker Christophe Demory +Christophe Dervieux Christophe Legry Christopher Conroy +Christopher Head Christopher Palow Christopher R. Palmer +Christopher Reid Christopher Stone Chungtsun Li Ciprian Badescu +civodul on github Claes Jakobsson Clarence Gardner +Claudio Neves +clbr on github Clemens Gruber +Cliff Crosland Clifford Wolf Clint Clayton +Clément Notin +cmfrolick on github +codesniffer13 on github Cody Jones Cody Mack +COFFEETALES on github +coinhubs on github Colby Ranger Colin Blair Colin Hogben +Colin O'Dell Colin Watson Colm Buckley Constantine Sapuntzakis Cory Benfield Cory Nelson +Costya Shulyupin Craig A West +Craig Andrews Craig Davison +Craig de Stigter Craig Markwardt +crazydef on github Cris Bailiff +Cristian Greco +Cristian Morales Vega Cristian Rodríguez Curt Bogmine +Cynthia Coan +Cyril B Cyrill Osterwalder Cédric Connes Cédric Deltheil D. Flinkmann +d4d on hackerone +d912e3 on github Da-Yoon Chung +daboul on github Dag Ekengren Dagobert Michelsen +Daiki Ueno +Dair Grant Dambaev Alexander Damian Dixon Damien Adant Damien Vielpeau Dan Becker -Dan C Dan Cristian Dan Donahue Dan Fandrich Dan Jacobson +Dan Johnson +Dan Kenigsberg Dan Locks Dan McNulty Dan Nelson Dan Petitt Dan Torop Dan Zitter +Daniel at touchtunes +Daniel Bankhead Daniel Black +Daniel Carpenter Daniel Cater Daniel Egger Daniel Gustafsson Daniel Hwang +Daniel Jeliński Daniel Johnson Daniel Kahn Gillmor Daniel Krügler +Daniel Kurečka Daniel Lee Hwang +Daniel Lublin +Daniel Marjamäki Daniel Melani Daniel Mentz Daniel Romero Daniel Schauenberg Daniel Seither Daniel Shahaf +Daniel Silverstone Daniel Steinberg Daniel Stenberg Daniel Theron -Daniel at touchtunes +Daniel Woelfel Daphne Luong +Dario Nieuwenhuis +Dario Weißer Darryl House Darshan Mody Darío Hereñú +dasimx on github Dave Dribin Dave Halbakken Dave Hamilton @@ -344,24 +529,32 @@ David Binderman David Blaikie David Byron David Cohen +David Cook +David Demelier David E. Narváez +David Earl David Eriksson +David Garske +David Goerger David Houlder +David Hu David Hull David J Meyer David James David Kalnischkies David Kierznowski David Kimdon +David L. David Lang David LeBlanc +David Lopes David Lord David McCreedy -David Meyer David Odin David Phillips David Rosenstrauch David Ryskalczyk +David Sanderson David Schweikert David Shaw David Strauss @@ -371,62 +564,103 @@ David Walser David Woodhouse David Wright David Yan +davidedec on github +dbrowndan on github +dEajL3kA on github Dengminwen +Denis Baručić +Denis Chaplygin Denis Feklushkin +Denis Goleshchikhin +Denis Laxalde +Denis Ollier Dennis Clarke +Dennis Felsing Derek Higgins Desmond O. Chang +destman on github Detlef Schmier +Dheeraj Sangamkar Didier Brisebourg Diego Bes Diego Casorran +Dietmar Hauser Dilyan Palauzov Dima Barsky +Dima Pasechnik Dima Tisnek Dimitar Boevski Dimitre Dimitrov +Dimitrios Apostolou Dimitrios Siganos Dimitris Sarris Dinar Dirk Eddelbuettel Dirk Feytons Dirk Manske +Dirk Wetter +Dirkjan Bussink +Diven Qi +divinity76 on github +dkjjr89 on github +dkwolfe4 on github Dmitri Shubin +Dmitri Tikhonov Dmitriy Sergeyev +dmitrmax on github Dmitry Bartsevich Dmitry Eremin-Solenikov Dmitry Falko +Dmitry Karpov Dmitry Kostjuchenko Dmitry Kurochkin +Dmitry Mikhirev Dmitry Popov Dmitry Rechkin Dmitry S. Baikov +Dmitry Wagin +dnivras on github Dolbneff A.V Domenico Andreoli Dominick Meglio Dominik Hölzl Dominique Leuenberger +Don J Olmstead +Dongliang Mu +Doron Behar Doug Kaufman Doug Porter Douglas Creager Douglas E. Wegscheid Douglas Kilpatrick +Douglas Mencken Douglas R. Horner +Douglas R. Reno Douglas Steinwand Dov Murik +dpull on github Drake Arconis +dtmsecurity on github Duane Cathey Duncan Mac-Vicar Prett +Duncan Wilcox Dustin Boswell Dusty Mabe +Duy Phan Thanh Dwarakanath Yadavalli Dylan Ellicott Dylan Salisbury Dániel Bakai Early Ehlinger +Earnestly on github +Eason-Yu on github +Ebe Janchivdorj +ebejan on github Ebenezer Ikonne Ed Morley +Edgaras Janušauskas Edin Kadribasic +Edmond Yu Eduard Bloch Edward Kimmel Edward Rudd @@ -435,10 +669,19 @@ Edward Thomson Eelco Dolstra Eetu Ojanen Egon Eckert +Ehren Bendler Eldar Zaitov +elelel on github +elephoenix on github +Eli Schwartz +Elia Tufarolo +Elliot Saba Ellis Pritchard Elmira A Semenova +elsamuko on github +emanruse on github Emanuele Bovisio +Emil Engler Emil Lerner Emil Romanus Emiliano Ida @@ -447,6 +690,8 @@ Enrico Scholz Enrik Berkhan Eramoto Masaya Eric Cooper +Eric Curtin +Eric Gallager Eric Hu Eric Landes Eric Lavigne @@ -456,44 +701,72 @@ Eric Mertens Eric Rautman Eric Rescorla Eric Ridge +Eric Rosenquist Eric S. Raymond +Eric Sauvageau Eric Thelin Eric Vergnaud Eric Wong +Eric Wu Eric Young Erick Nuwendam +Erik Jacobsen Erik Janssen Erik Johansson +Erik Minekus +Erik Olsson Ernest Beinrohr +Ernst Sjöstrand Erwan Legrand Erwin Authried +Estanislau Augé-Pujadas Ethan Glasser Camp +Etienne Simard Eugene Kotlyarov Evan Jordan +Evangelos Foutras Even Rouault Evert Pot Evgeny Grin Evgeny Turnaev +eXeC64 on github Eygene Ryabinkin +Eylem Ugurel Fabian Frank Fabian Hiernaux Fabian Keil Fabian Ruff +Fabrice Fontaine Fabrizio Ammollo Fahim Chandurwala +Faizur Rahman +Fawad Mirza +fds242 on github +Federico Bianchi Fedor Karpelevitch +Fedor Korotkov Feist Josselin +Felipe Gasper +Felix Hädicke Felix Kaiser -Felix Yan Felix von Leitner +Felix Yan Feng Tu Fernando Muñoz +Filip Salomonsson +Firefox OS +Flameborn on github Flavio Medeiros +Florian Pritz Florian Schoppmann Florian Weimer +Florin Petriuc Forrest Cahoon Francisco Moraes +Francisco Munoz +Francisco Sedano Francois Petitjean +Francois Rivard Frank Denis Frank Gevaerts Frank Hempel @@ -504,32 +777,45 @@ Frank Ticheler Frank Van Uffelen František Kučera François Charlier +François Rigault Fred Machado Fred New Fred Noz Fred Stluka Frederic Lepied Frederik B +Frederik Wedel-Heinen Fredrik Thulin +FuccDucc on github +fullincome on github Gabriel Kuri +Gabriel Simmer Gabriel Sjoberg +Gambit Communications +Ganesh Kamath Garrett Holmstrom Gary Maxwell Gaurav Malhotra Gautam Kachroo Gautam Mani +Gavin Wong Gavrie Philipson Gaz Iqbal Gaël Portay +Gealber Morales +Geeknik Labs Geoff Beier +Georeth Zhou Georg Horn Georg Huettenegger Georg Lippitsch Georg Wicherski +George Liu Gerd v. Egidy Gergely Nagy Gerhard Herre Gerrit Bruchhäuser +Gerrit Renker Ghennadi Procopciuc Giancarlo Formicuccia Giaslas Georgios @@ -537,13 +823,19 @@ Gil Weber Gilad Gilbert Ramirez Jr. Gilles Blanc +Gilles Vollant +Giorgos Oikonomou Gisle Vanem +git-bruh on github +GitYuanQu on github Giuseppe Attardi Giuseppe D'Ambrosio Giuseppe Persico +Gleb Ivanovsky Glen A Johnson Jr. Glen Nakamura Glen Scott +Glenn de boer Glenn Sheridan Google Inc. Gordon Marler @@ -557,20 +849,31 @@ Greg Onufer Greg Pratt Greg Rowe Greg Zavertnik +Gregor Jasny +Gregory Jefferis +Gregory Muchka +Gregory Nicholls Gregory Szorc +Griffin Downs Grigory Entin Guenole Bescon -Guenter Knauf Guido Berhoerster Guillaume Arluison +guitared on github Gunter Knauf Gustaf Hui Gustavo Grieco +Guy Poizat GwanYeong Kim Gwenole Beauchesne Gökhan Şengün Götz Babin-Ebell +H3RSKO on github +Hagai Auro +Haibo Huang Hamish Mackenzie +hamstergene on github +Han Han Han Qiao Hang Kin Lau Hang Su @@ -578,99 +881,154 @@ Hannes Magnusson Hanno Böck Hanno Kranzhoff Hans Steegers +Hans-Christian Noren Egtvedt Hans-Jurgen May +Hao Wu Hardeep Singh Haris Okanovic Harold Stuart +Harry Sintonen Harshal Pradhan Hauke Duden He Qin Heikki Korpela Heinrich Ko Heinrich Schaefer +Helge Klein Helmut K. C. Tessarek Helwing Lutz Hendrik Visage +Henri Gomez Henrik Gaßmann Henrik Storner Henry Ludemann +Henry Roeland Herve Amblard Hidemoto Nakada +Himanshu Gupta Ho-chi Chen Hoi-Ho Chan Hongli Lai +Hongyi Zhao +Howard Blaise Howard Chu +hsiao yi +htasta on github Hubert Kario +Hugh Macdonald +Hugo van Kemenade +Huzaifa Sidhpurwala +huzunhao on github +hydra3333 on github Hzhijun +iammrtau on github Ian D Allen Ian Fette Ian Ford Ian Gulliver Ian Lynagh +Ian Spence Ian Turner Ian Wilkes Ignacio Vazquez-Abrams Igor Franchuk +Igor Khristophorov +Igor Makarov Igor Novoseltsev Igor Polyakov +Ihor Karpenko +ihsinme on github Iida Yosiaki +Ikko Ashimine Ilguiz Latypov Ilja van Sprundel +Illarion Taev +Ilya Kosarev +imilli on github Immanuel Gregoire Inca R +infinnovation-dev on github Ingmar Runge Ingo Ralf Blum Ingo Wilken +Inho Oh +Ionuț-Francisc Oancea Irfan Adilovic +Ironbars13 on github +Irving Wolfe Isaac Boukris +Isaiah Norton Ishan SinghLevett +Ithubg on github Ivan Avdeev +IvanoG on github Ivo Bellin Salarin +iz8mbw on github +J. Bromley +Jack Boos Yu Jack Zhang Jackarain on github Jacky Lam +Jacob Barthelmeh +Jacob Hoffman-Andrews Jacob Meuser Jacob Moshenko Jactry Zeng Jad Chamcham Jaime Fullaondo +jakirkham on github Jakub Wilk Jakub Zakrzewski James Atwill +James Brown James Bursa James Cheng James Clancy James Cone James Dury +James Fuller James Gallagher James Griffiths James Housley +James Knight +James Le Cuirot James MacMillan James Slaughter Jamie Lokier Jamie Newton Jamie Wilkinson Jan Alexander Steffens +Jan Chren Jan Ehrhardt Jan Koen Annot Jan Kunder Jan Schaumann Jan Schmidt Jan Van Boghout +Jan Verbeek +JanB on github +Janne Johansson Jared Jennings Jared Lundell Jari Aalto Jari Sundell +jasal82 on github +Jason Baietto Jason Glasgow +Jason Juang +Jason Lee Jason Liu Jason McDonald Jason S. Priebe Javier Barroso +Javier Blazquez Javier G. Sogo +Javier Navarro Javier Sixto Jay Austin Jayesh A Shah Jaz Fresh +Jean Fabrice Jean Gressmann Jean Jacques Drouin Jean-Claude Chauve @@ -680,21 +1038,30 @@ Jean-Louis Lemaire Jean-Marc Ranger Jean-Noël Rouvignac Jean-Philippe Barrette-LaPierre +Jean-Philippe Menil Jeff Connelly Jeff Hodges Jeff Johnson Jeff King Jeff Lawson +Jeff Mears Jeff Phillips Jeff Pohlmeyer Jeff Weber Jeffrey Walton +Jens Finkhaeuser Jens Rantil +Jens Schleusener +Jeremie Rapin +Jeremy Falcon Jeremy Friesner Jeremy Huddleston +Jeremy Lainé Jeremy Lin +Jeremy Maitin-Shepard Jeremy Pearson Jeremy Tan +Jeremy Thibault Jeroen Koekkoek Jeroen Ooms Jerome Muffat-Meridol @@ -707,37 +1074,54 @@ Jesper Jensen Jesse Chisholm Jesse Noller Jesse Tan +jethrogb on github Jie He Jim Drash Jim Freeman +Jim Fuller Jim Hollinger Jim Meyering +Jimmy Gaussen Jiri Dvorak Jiri Hruska Jiri Jaburek +Jishan Shaikh Jiří Malák +jmdavitt on github +jnbr on github Jocelyn Jaubert +Jochem Broekhoff Joe Halpin Joe Malicki Joe Mason Joel Chen Joel Depooter +Joel Jakobsson +Joel Teichroeb +joey-l-us on github Jofell Gallardo Johan Anderson Johan Lantz Johan Nilsson Johan van Selst +Johann150 on github Johannes Bauer Johannes Ernst +Johannes G. Kristinsson +Johannes Lesr Johannes Schindelin +John A. Bristor John Bradshaw +John Butterfield John Coffey John Crow John David Anglin +John DeHelian John Dennis John Dunn John E. Malmberg John Gardiner Myers +John Hascall John Janssen John Joseph Bachir John Kelly @@ -749,111 +1133,182 @@ John Marino John Marshall John McGowan John P. McCaskey +John Schroeder +John Simpson +John Starks John Suprock +John V. Chow John Wanghui +John Weismiller John Wilkinson John-Mark Bell Johnny Luong +Jojojov on github Jon DeVree Jon Grubbs +Jon Johnson Jr Jon Nelson +Jon Rumsey Jon Sargeant Jon Seymour Jon Spencer Jon Torrey Jon Travis Jon Turner +Jon Wilkes Jonas Forsman Jonas Minnberg Jonas Schnelli +Jonas Vautherin Jonatan Lander Jonatan Vela Jonathan Cardoso Machado -Jonathan Cardoso Machado Machado Jonathan Hseu +Jonathan Moerman Jonathan Nieder +Jonathan Watt +Jonathan Wernberg Jongki Suwandi +Joombalaya on github Joonas Kuorilehto +Jordan Brown Jose Alf Jose Kahan Josef Wolf +Joseph Chen +Josh Bialkowski Josh Kapell +Josh Soref +joshhe on github Joshua Kwan +Joshua Swink +Josie Huddleston Josue Andrade Gomes +José Joaquín Atria Jozef Kralik +JP Mens Juan Barreto Juan F. Codagnone Juan Ignacio Hervás Juan RP Judson Bishop +Juergen Hoetzel Juergen Wilke Jukka Pihl +Julian Montes Julian Noble Julian Ospald +Julian Romero Nieto Julian Taylor +Julian Z Julien Chaffraix Julien Nabet Julien Royer Jun-ichiro itojun Hagino +Jun-ya Kato +jungle-boogie on github +Junho Choi Jurij Smakov +Juro Bystricky Justin Clift Justin Ehlert Justin Fletcher Justin Karneges Justin Maggard +jveazey on github +jzinn on github János Fekete +Jérémy Rocher Jörg Mueller-Tolk Jörn Hartroth +Jürgen Gmach K. R. Walker +ka7 on github +Kael1117 on github Kai Engert Kai Noda Kai Sommerfeld Kai-Uwe Rommel Kalle Vahlman Kamil Dudka +Kane York Kang Lin Kang-Jin Lee +Kari Pahula +Karl Chen Karl Moerder Karol Pietrzak +Kartik Mahajan Kaspar Brand Katie Wang +Katsuhiko YOSHIDA Kazuho Oku Kees Cook +Kees Dekker Keith MacDonald Keith McGuigan Keith Mok +Ken Brown Ken Hirsch Ken Rastatter +Kenneth Davidson Kenny To Kent Boortz Keshav Krity Kevin Baughman +Kevin Burke Kevin Fisk Kevin Ji Kevin Lussier +Kevin R. Bulgrien Kevin Reed Kevin Roth Kevin Smith +Kevin Ushey Kim Minjoong Kim Rinnewitz Kim Vandry Kimmo Kinnunen +Kirill Marchuk Kjell Ericson Kjetil Jacobsen +Klaus Crusius +Klaus Stein Klevtsov Vadim +Kobi Gurkan +Koen Dergent +Koichi Shiraishi +kokke on github Konstantin Isakov +Konstantin Kushnir +kotoriのねこ +kouzhudong on github +Kovalkov Dmitrii +kreshano on github Kris Kennaway Krishnendu Majumdar Krister Johansen Kristian Gunstone Kristian Köhntopp +Kristian Mide Kristiyan Tsaklev +Kristoffer Gleditsch +Kunal Chandarana +Kunal Ekawde Kurt Fankhauser +Kwon-Young Choi +Kyle Abramowitz +Kyle Edwards Kyle J. McKay Kyle L. Huff Kyle Sallee +Kyohei Kadota Kyselgov E.N +l00p3r on Hackerone Lachlan O'Dea +Ladar Levison +Lance Ware +Laramie Leavitt Larry Campbell Larry Fahnoe Larry Lin @@ -865,24 +1320,38 @@ Lars J. Aas Lars Johannesen Lars Nilsson Lars Torben Wilson -Lau Hang Kin +Laurent Bonnans +Laurent Dufresne Laurent Rabret Lauri Kasanen +Laurie Clark-Michalek +Lawrence Gripper +Lawrence Matthews Lawrence Wagerfield Legoff Vincent Lehel Bernadt Leif W +Leigh Purdie Leith Bade Len Krause +Len Marinaccio Lenaic Lefever Lenny Rachitsky +Leo Neat +Leon Breedt Leon Winter Leonardo Rosati +Leonardo Taccari +Li Xinwei Liam Healy +lijian996 on github Lijo Antony +lilongyan-huawei on github Linas Vepstas Lindley French Ling Thio +Linos Giannopoulos +Linus Lewandowski Linus Nielsen Feltzing Linus Nordberg Lior Kaplan @@ -891,35 +1360,50 @@ Liviu Chircu Liza Alenchery Lloyd Fournier Lluís Batlle i Rossell +locpyl-tidnyd on github +Loganaden Velvindron Loic Dachary Loren Kirkby Luan Cestari Luca Altea +Luca Boccassi Lucas Adamski +Lucas Clemente Vella Lucas Pardue +Lucas Servén Marín +Lucas Severo +Lucien Zürcher Ludek Finstrle Ludovico Cavedon Ludwig Nussel Lukas Ruzicka Lukasz Czekierda +lukaszgn on github Luke Amery Luke Call Luke Dashjr +Luke Granger-Brown Luo Jinghua Luong Dinh Dung +Luz Paz Luật Nguyễn +Lyman Epp Lyndon Hill +M.R.T on github Maciej Karpiuk Maciej Puzio Maciej W. Rozycki +madblobfish on github Mahmoud Samir Fayed Maks Naumov Maksim Kuzevanov Maksim Stsepanenka Mamoru Tasaka +Mamta Upadhyay Mandy Wu Manfred Schwarb Manuel Massing +Manuj Bhatia Marc Aldorasi Marc Boucher Marc Deslauriers @@ -928,7 +1412,10 @@ Marc Hesse Marc Hörsken Marc Kleine-Budde Marc Renault +Marc Schlatter Marc-Antoine Perennou +marc-groundctl on github +Marcel Hernandez Marcel Raad Marcel Roelofs Marcelo Echeverria @@ -939,14 +1426,16 @@ Marcin Konicki Marco Deckel Marco G. Salvagno Marco Maggi +Marcos Diazr Marcus Hoffmann +Marcus Klein Marcus Sundberg Marcus Webster +Marian Klymov Mario Schroeder Mark Brand Mark Butler Mark Davies -Mark Eichin Mark Hamilton Mark Incley Mark Karpeles @@ -954,128 +1443,225 @@ Mark Lentczner Mark Nottingham Mark Salisbury Mark Snelling +Mark Swaanenburg Mark Tully +Mark W. Eichin +Mark Wotton Markus Duft Markus Elfring Markus Koetter Markus Moeller Markus Oberhumer +Markus Olsson Markus Westerlind +Maros Priputen Marquis de Muesli Martijn Koster +Martin Ankerl +Martin Bašti Martin C. Martin +Martin Dorey Martin Drasar +Martin Dreher Martin Frodl +Martin Galvan +Martin Gartner Martin Hager +Martin Halle Martin Hedenfalk +Martin Howarth Martin Jansen +Martin Kammerhofer Martin Kepplinger Martin Lemke Martin Skinner +Martin Staael Martin Storsjö +Martin V Martin Vejnár Marty Kuhrt Maruko +Masaya Suzuki +masbug on github +Massimiliano Fantuzzi Massimiliano Ziccardi Massimo Callegari Mateusz Loskot Mathias Axelsson +Mathias Gumz +Mathieu Legare +Matias N. Goldberg Mats Lidell Matt Arsenault Matt Ford +Matt Holt Matt Kraai +Matt McClure Matt Veenstra Matt Witherspoon Matt Wixson -Matteo B. +Matteo Bignotti +Matteo Bignottignotti Matteo Rocco Matthew Blain Matthew Clarke Matthew Hall +Matthew Kerwin +Matthew Whitehead Matthias Bolte +Matthias Gatto +Matthias Naegler +Mattias Fornander +Matus Uzak Maurice Barnum Mauro Iorio Mauro Rappa Max Dymond Max Katsev +Max Kellermann Max Khon +Max Peal +Max Savenkov +Max Zettlmeißl Maxim Ivanov Maxim Perenesenko Maxim Prohorov Maxime Larocque +Maxime Legros +mbeifuss on github +mccormickt12 on github Mehmet Bozkurt Mekonikum Melissa Mears +Mert Yazıcıoğlu Mettgut Jamalla +Michael Anti +Michael Baentsch Michael Benedict +Michael Brehm +Michael Brown Michael Calmer Michael Cronenworth Michael Curtis Michael Day +Michael Felt +Michael Forney +Michael Gmelin Michael Goffioul +Michael Hordijk Michael Jahn Michael Jerris Michael Kalinin Michael Kaufmann +Michael Kilburn +Michael Kolechkin +Michael Kujawa Michael König +Michael Lee Michael Maltese Michael Mealling Michael Mueller +Michael Musset +Michael O'Farrell +Michael Olbrich Michael Osipov +Michael Schmid Michael Smith Michael Stapelberg +Michael Steuer Michael Stillwell +Michael Vittiglio Michael Wallner Michal Bonino Michal Marek +Michal Rus +Michal Trybus +Michal Čaplygin +Michał Antoniak Michał Fita Michał Górny +Michał Janiszewski Michał Kowalczyk Michał Piechowski Michel Promonet Michele Bini Miguel Angel Miguel Diaz +migueljcrum on github Mihai Ionescu Mikael Johansson Mikael Sennerholm +Mikalai Ananenka Mike Bytnar Mike Crowe Mike Dobbs +Mike Dowell +Mike Frysinger +Mike Gelfand Mike Giancola Mike Hasselberg Mike Henshaw Mike Hommey Mike Mio +Mike Norton Mike Power Mike Protts Mike Revi +Mike Tzou Miklos Nemeth Miloš Ljumović Mingliang Zhu +Mingtao Yang Miroslav Franc Miroslav Spousta +Mischa Salle Mitz Wark +mkzero on github +modbw on github Mohamed Lrhazi +Mohamed Osama Mohammad AlSaleh +Mohammad Hasbini +Mohammed Naser Mohun Biswas +momala454 on github +moohoorama on github +Morten Minde Neergaard Mostyn Bramley-Moore Moti Avrahami +MrdUkk on github +MrSorcus on github +Muhammad Herdiansyah +Muhammed Yavuz Nuzumlalı +Murugan Balraj +Muz Dima Myk Taylor Nach M. S. Nagai H +naost3rn on github +Nate Prewitt Nathan Coulter Nathan O'Sullivan Nathanael Nerode +Nathaniel J. Smith +Nathaniel R. Lewis Nathaniel Waisbrot Naveen Chandran Naveen Noel Neal Poole +nedres on github +neex on github Nehal J Wani +neheb on github Neil Bowers Neil Dunbar Neil Kolban Neil Spring +nevv on HackerOne/curl +Niall O'Reilly +niallor on github +nian6324 on github +nianxuejie on github Nic Roets Nicholas Maniscalco Nick Draffen @@ -1083,70 +1669,106 @@ Nick Gimbrone Nick Humfrey Nick Miyake Nick Zitzmann +Nicklas Avén Nico Baggus +nico-abram on github Nicolas Berloquin Nicolas Croiset Nicolas François +Nicolas Grekas +Nicolas Guillier Nicolas Morey-Chaisemartin +Nicolas Sterchele Niels van Tongeren Nikita Schmidt Nikitinskit Dmitriy Niklas Angebrand +Niklas Hambüchen Nikolai Kondrashov Nikos Mavrogiannopoulos +Nikos Tsipinakis +niner on github Ning Dong Nir Soffer +Niranjan Hasabnis Nis Jorgensen +nk +NobodyXu on github Nobuhiro Ban Nodak Sodak +nopjmp on github Norbert Frese Norbert Kett Norbert Novotny +nosajsnikta on github +NTMan on Github Octavio Schroeder Ofer Okhin Vasilij Ola Mork Olaf Flebbe +Olaf Hering Olaf Stüben Oleg Pudeyev +Oleguer Llopart +Olen Andoni +olesteban on github Oli Kingshott Oliver Gondža Oliver Graute Oliver Kuckertz Oliver Schindler +Oliver Urbann Olivier Berger Olivier Brunel +Omar Ramadan +omau on github Orange Tsai Oren Souroujon Oren Tirosh Orgad Shaneh Ori Avtalion +osabc on github Oscar Koeroo Oscar Norlander +Oskar Liljeblad +Oumph on github +ovidiu-benea on github P R Schaffner Palo Markovic +Paolo Mossino Paolo Piacentini Paras Sethia +parazyd on github Pascal Gaudette Pascal Terjan Pasha Kuznetsov Pasi Karkkainen Pat Ray +patelvivekv1993 on github +patnyb on github Patrice Guerin Patricia Muscalu Patrick Bihan-Faou +Patrick Dawson Patrick McManus Patrick Monnerat Patrick Rapin +Patrick Schlangen Patrick Scott Patrick Smith Patrick Watson Patrik Thunstrom Pau Garcia i Quiles +Paul B. Omta Paul Donohue +Paul Dreik +Paul Groke Paul Harrington Paul Harris +Paul Hoffman Paul Howarth +Paul Johnson Paul Joyce Paul Marks Paul Marquis @@ -1155,16 +1777,31 @@ Paul Nolan Paul Oliver Paul Querna Paul Saab +Paul Vixie +Paulo Roberto Tomasi Pavel Cenek +Pavel Gushchin +Pavel Löbl Pavel Orehov -Pavel P +Pavel Pavlov Pavel Raiskup Pavel Rochnyak +Pavel Volgarev +Pavol Markovic Pawel A. Gajda Pawel Kierski +Paweł Wegner Pedro Larroy +Pedro Monreal Pedro Neves +pendrek at hackerone +Peng Li +Peng-Yu Chen +Per Jensen +Per Lundberg Per Malmberg +Per Nilsson +Pete Lomax Peter Bray Peter Forret Peter Frühberger @@ -1172,15 +1809,20 @@ Peter Gal Peter Heuchert Peter Hjalmarsson Peter Korsgaard +Peter Körner Peter Lamare Peter Lamberg Peter Laser Peter O'Gorman Peter Pentchev +Peter Piekarski Peter Silva +Peter Simonyi Peter Su +Peter Sumatra Peter Sylvester Peter Todd +Peter Varga Peter Verhas Peter Wang Peter Wu @@ -1189,33 +1831,52 @@ Peteris Krumins Petr Bahula Petr Novak Petr Pisar +Petr Voytsik Phil Blundell Phil Crump +Phil E. Taylor Phil Karn Phil Lisiecki Phil Pellouchoud Philip Craig Philip Gladstone Philip Langdale +Philip Prindeville +Philipp Klaus Krause +Philipp Waehnert Philippe Hameau +Philippe Marguinaud Philippe Raoult Philippe Vaucher Pierre Pierre Brico Pierre Chapuis Pierre Joye +Pierre Yager Pierre Ynard +Pierre-Yves Bigourdan Piotr Dobrogost +Piotr Komborski +Po-Chuan Hsieh +Pontus Lundkvist Pooyan McSporran +Poul T Lomholt Pramod Sharma Prash Dush Praveen Pvs Priyanka Shah +Przemysław Tomaszewski +pszemus on github +puckipedia on github Puneet Pawaia +qiandu2006 on github Quagmire Quanah Gibson-Mount +Quentin Balland Quinn Slack R. Dennis Steed +Radek Zajic +Radoslav Georgiev Radu Simionescu Rafa Muyo Rafael Antonio @@ -1230,20 +1891,32 @@ Rajesh Naganathan Rajkumar Mandal Ralf S. Engelschall Ralph Beckmann +Ralph Langendam Ralph Mitchell -Ramana Mokkapati +Ram Krushna Mishra +ramsay-jones on github +Ran Mozes +Randall S. Becker +Randolf J Randy Armstrong Randy McMurchy +Raphael Gozzo +Rasmus Melchior Jacobsen Ravi Pratap Ray Dassen Ray Pekowski Ray Satiro Razvan Cojocaru +rcombs on github +Red Hat Product Security +Reed Loden Reinhard Max Reinout van Schouwen +Remco van Hooff Remi Gacogne Remo E Renato Botelho +Renaud Allard Renaud Chaillat Renaud Duhaut Renaud Guillard @@ -1253,11 +1926,19 @@ Rene Rebe Reuven Wachtfogel Reza Arbab Ricardo Cadime +Ricardo Gomes Rich Burridge +Rich FitzJohn Rich Gray +Rich Mirch Rich Rauenzahn +Rich Salz +Rich Turner +Richard Adams +Richard Alcock Richard Archer Richard Atterer +Richard Bowker Richard Bramante Richard Clayton Richard Cooper @@ -1265,16 +1946,28 @@ Richard Gorton Richard Gray Richard Hosking Richard Hsu +Richard Marion Richard Michael Richard Moore Richard Prescott Richard Silverman Richard van den Berg +Richard Whitehouse Richy Kim +Rici Lake +Rick Deist Rick Jones Rick Richardson +Rick Welykochy +Rickard Hallerbäck Ricki Hirner +Ricky Leverence +Ricky-Tigg on github Rider Linden +RiderALT on github +Rikard Falkeborn +rl1987 on github +Rob Cotrone Rob Crittenden Rob Davies Rob Jones @@ -1284,26 +1977,39 @@ Rob Ward Robert A. Monat Robert B. Harris Robert D. Young +Robert Dunaj Robert Foreman Robert Iakobashvili +Robert Kolcun +Robert Linden Robert Olson +Robert Prag +Robert Ronto Robert Schumann Robert Weaver Robert Wruck Robin Cornelius +Robin Douine Robin Johnson Robin Kay Robson Braga Araujo Rod Widdowson +Rodger Combs Rodney Simmons Rodric Glaser Rodrigo Silva Roger Leigh +Roger Orr Roland Blom +Roland Hieber Roland Krikava Roland Zimmermann +Rolf Eike Beer Rolland Dudemaine Romain Coltel +Romain Fliedel +Romain Geissler +romamik om github Roman Koifman Roman Mamedov Romulo A. Ceccon @@ -1312,10 +2018,18 @@ Ron Parker Ron Zapp Ronnie Mose Rosimildo da Silva +Ross Burton +Roy Bellingan Roy Shan +Rui LIU +Rui Pinheiro Rune Kleveland +Ruslan Baratov Ruslan Gazizov Rutger Hofman +Ruurd Beerstra +RuurdBeerstra on github +Ryan Beck-Buysse Ryan Braud Ryan Chan Ryan Nelson @@ -1325,27 +2039,35 @@ Ryan Winograd Ryuichi KAWAMATA Rémy Léone S. Moonesamy -SBKarr on github +Sai Ram Kunala Salah-Eddin Shaban +Saleem Abdulrasool Salvador Dávila Salvatore Sorrentino Sam Deane Sam Hurst Sam Roth Sam Schanken +Samanta Navarro Sampo Kellomaki Samuel Díaz García Samuel Listopad +Samuel Marks +Samuel Surtees Samuel Thibault +Samuel Tranchet Sander Gates Sandor Feldi Santhana Todatry +Santino Keupp Saqib Ali Sara Golemon Saran Neti Sascha Swiercy Saul good Saurav Babu +sayrer on github +SBKarr on github Scott Bailey Scott Barrett Scott Cantor @@ -1353,61 +2075,106 @@ Scott Davis Scott McCreary Sean Boudreau Sean Burford +Sean MacLennan +Sean McArthur +Sean Miller +Sebastiaan van Erk +Sebastian Haglund Sebastian Mundry Sebastian Pohlschmidt Sebastian Rasmussen Senthil Raja Velu Sergei Kuzmin Sergei Nikulov +Sergey Markelov +Sergey Ogryzkov Sergey Tatarincev +Sergii Kavunenko Sergii Pylypenko Sergio Ballestrero +Sergio Barresi +Sergio Borghese +sergio-nsk on github Serj Kalichev Seshubabu Pasam Seth Mos +Sevan Janiyan Sh Diao Shachaf Ben-Kiki +Shailesh Kapse +Shankar Jadhavar Shao Shuchao Sharad Gupta Shard +Shaun Jackman Shawn Landden Shawn Poulson +Shikha Sharma Shine Fan +Shiraz Kanga +shithappens2016 on github +Shlomi Fish Shmulik Regev Siddhartha Prakash Jain Sidney San Martín Siegfried Gyuricsko +silveja1 on github +Simon Chalifoux Simon Dick Simon H. Simon Josefsson +Simon Legner Simon Liu Simon Warta +Siva Sivaraman +SLDiggie on github +smuellerDD on github +sn on hackerone +sofaboss on github +Somnath Kundu Song Ma Sonia Subramanian Spacen Jasset +Spezifant on github Spiridonoff A.V +Spoon Man Spork Schivago +sspiri on github +sstruchtrup on github Stadler Stephan Stan van de Burgt Stanislav Ivochkin +Stanislav Zidek +steelman on github +Stefan Agner Stefan Bühler Stefan Eissing Stefan Esser +Stefan Grether Stefan Kanthak +Stefan Karpinski Stefan Krause Stefan Neis +Stefan Strogin Stefan Teleman Stefan Tomanek Stefan Ulrich +Stefan Yohansson +Stefano Simonelli Steinar H. Gunderson +steini2000 on github +Stepan Broz +Stepan Efremov Stephan Bergmann +Stephan Lagerholm +Stephan Mühlstrasser +Stephan Szabo Stephen Brokenshire Stephen Collyer Stephen Kick Stephen More Stephen Toub Sterling Hughes -Steve Brokenshire Steve Green Steve H Truong Steve Havelka @@ -1417,42 +2184,70 @@ Steve Little Steve Marx Steve Oliphant Steve Roskowski +Steve Walch Steven Bazyl Steven G. Johnson Steven Gu Steven M. Schweda Steven Parkes +Steven Penny +Stian Soiland-Reyes Stoned Elipot +stootill on github Stuart Henderson +SumatraPeter on github Sune Ahlgren +Sunny Bean +Sunny Purushe Sven Anders +Sven Blumenstein Sven Neuhaus Sven Wegener Svyatoslav Mishyn +swalkaus at yahoo.com +sylgal on github Sylvestre Ledru Symeon Paraschoudis Sébastien Willemijns T. Bharath T. Yamada -TJ Saunders +T200proX7 on github +Tadej Vengust Tae Hyoung Ahn +Tae Wong +Taiyu Len Taneli Vähäkangas Tanguy Fautre +tarek112 on github Tatsuhiro Tsujikawa +tawmoto on github +tbugfinder on github +Teemu Yli-Elsila Temprimus Terri Oda -TheAssassin at github +Terry Wu +thanhchungbtc on github +The Infinnovation team +TheAssassin on github Theodore Dubois +therealhirudo on github +tholin on github +Thomas Bouzerar Thomas Braun +Thomas Danielsson +Thomas Gamper Thomas Glanzmann Thomas J. Moore Thomas Klausner Thomas L. Shinnick Thomas Lopatic +Thomas M. DuBuisson Thomas Petazzoni Thomas Ruecker Thomas Schwinge Thomas Tonino +Thomas van Hesteren +Thomas Vegas Thorsten Schöning Tiit Pikma Till Maas @@ -1463,59 +2258,92 @@ Tim Chen Tim Costello Tim Harder Tim Heckman +Tim Mcdonough Tim Newsome Tim Rühsen +Tim Sedlmeyer Tim Sneddon Tim Stack Tim Starling +Tim Tassonis +Tim Verhoeven +Timo Lange Timo Sirainen Timotej Lazar Timothe Litt +Timothy Gu Timothy Polich +Timur Artikov Tinus van den Berg +TJ Saunders +Tk Xiong +tmkk on github +Tobias Blomberg +Tobias Gabriel +Tobias Hieta +Tobias Hintze +Tobias Lindgren Tobias Markus +Tobias Nyholm Tobias Rundström Tobias Stoeckmann Toby Peterson Todd A Ouska +Todd Kaufmann Todd Kulesza Todd Short Todd Vierling Tom Benoist Tom Donovan +Tom G. Christensen Tom Grace +Tom Greenslade Tom Lee Tom Mattison Tom Moers Tom Mueller Tom Regner +Tom Seddon Tom Sparrow +Tom van der Woerdt Tom Wright Tom Zerucha +Tomas Berger Tomas Hoger Tomas Jakobsson Tomas Mlcoch +Tomas Mraz Tomas Pospisek Tomas Szepe Tomas Tomecek Tomasz Kojm Tomasz Lacki Tommie Gannert +tommink[at]post.pl +Tommy Chiang +Tommy Odom +Tommy Petty Tommy Tam Ton Voon Toni Moreno Tony Kelman +tonystz on Github Toon Verwaest Tor Arntsen Torben Dannhauer Torsten Foertsch Toshio Kuratomi Toshiyuki Maezawa +tpaukrt on github Traian Nicolescu Travis Burtrum Travis Obenhaus +Trivikram Kamat Troels Walsted Hansen Troy Engel +Tseng Jun +Tuomas Siipola +Tuomo Rinne Tupone Alfredo Tyler Hall Török Edwin @@ -1524,109 +2352,144 @@ Ulf Samuelsson Ulrich Doehner Ulrich Telle Ulrich Zadow +UrsusArctos on github +User Sg +ustcqidi on github +Vadim Grinshpun Valentin David +Valentyn Korniienko +Valentín Gutiérrez +Valerii Zapodovnikov +vanillajonathan on github +Varnavas Papaioannou +Vasiliy Faronov +Vasily Lobaskin Vasy Okhin Venkat Akella Venkataramana Mokkapati +Vicente Garcia +Victor Magierski Victor Snezhko +Victor Vieux Vijay Panghal Vikram Saxena -Viktor Szakáts +Viktor Szakats +Vilhelm Prytz Ville Skyttä Vilmos Nebehaj Vincas Razma Vincent Bronner +Vincent Grande Vincent Le Normand Vincent Penquerc'h Vincent Sanders Vincent Torri +vitaha85 on github Vlad Grachov Vlad Ureche Vladimir Grishchenko +Vladimir Kotal Vladimir Lazarenko +Vladimir Varlamov +Vlastimil Ovčáčík Vojtech Janota Vojtech Minarik Vojtěch Král +Volker Schmid Vsevolod Novikov +vshmuk on hackerone +Vyron Tsingaras W. Mark Kubacki Waldek Kozba Walter J. Mack Ward Willats -Warp Kawada Warren Menzer Wayne Haigh +Wenchao Li +Wenxiang Qian Werner Koch +Werner Stolz +Wes Hinsley +wesinator on github Wesley Laxton Wesley Miaw Wez Furlong Wham Bang Wilfredo Sanchez Will Dietz +Will Roberts Willem Sparreboom +William A. Rowe Jr William Ahern +William Desportes +wmsch on github +wncboy on github Wojciech Zwiefka Wouter Van Rooy Wu Yongzheng Wyatt O'Day +Wyatt OʼDay Xavier Bouchoux +XhmikosR on github +XhstormR on github +Xiang Xiao Xiangbin Li +Xiaoyin Liu +XmiliaH on github +xnynx on github +xwxbug on github Yaakov Selkowitz -Yamada Yasuharu Yang Tse +Yaobin Wen Yarram Sunil Yasuharu Yamada +Yasuhiro Matsumoto +Yechiel Kalmenson Yehezkel Horowitz Yehoshua Hershberg +ygthien on github Yi Huang +Yiming Jing Yingwei Liu +Ymir1711 on github Yonggang Luo +Yongkang Huang +Younes El-karama +youngchopin on github Yousuke Kimoto +Yu Xin Yukihiro Kawada Yun SangHo +Yuri Slobodyanyuk Yuriy Sosov +Yusuke Nakamura Yves Arrouye Yves Lejeune +z2-2z on github +z2_ on hackerone +Zachary Seguin Zdenek Pavlas Zekun Ni +zelinchen on github Zenju on github +Zero King +Zhang Xiuhua +Zhao Yisha +Zhaoyang Wu +Zhibiao Wu +Zhouyihai Ding +ZimCodes on github +zloi-user on github Zmey Petroff Zvi Har'El -afrind on github -asavah on github -baumanj on github -bsammon on github -canavan on github -destman on github -dkjjr89 on github -eXeC64 on github -imilli on github -jonrumsey on github -joshhe on github -jveazey on github -ka7 on github -kreshano on github -lijian996 on github -lukaszgn on github -madblobfish on github -marc-groundctl on github -mccormickt12 on github -mkzero on github -neex on github -neheb on github -nk -nopjmp on github -olesteban on github -ovidiu-benea on github -paulharris on github -silveja1 on github -stootill on github -swalkaus at yahoo.com -tarek112 on github -tommink[at]post.pl -vanillajonathan on github -wmsch on github -wyattoday on github -zelinchen on github +zzq1015 on github +Ádler Jonas Gross İsmail Dönmez +Łukasz Domeradzki Štefan Kremeň +Борис Верховский +Коваленко Анатолий Викторович Никита Дорохин +ウさん +不确定 +加藤郁之 diff --git a/curl/docs/THANKS-filter b/curl/docs/THANKS-filter new file mode 100644 index 00000000..ff2de777 --- /dev/null +++ b/curl/docs/THANKS-filter @@ -0,0 +1,129 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# This is a list of names we have recorded that already are thanked +# appropriately in THANKS. This list contains variations of their names and +# their "canonical" name. This file is used for scripting purposes to avoid +# duplicate entries and will not be included in release tarballs. +# When removing dupes that aren't identical names from THANKS, add a line +# here! +# +# Used-by: contributor.sh +s/Andres Garcia/Andrés García/ +s/Chris Conroy/Christopher Conroy/ +s/Francois Charlier/François Charlier/ +s/Gokhan Sengun/Gökhan Şengün/ +s/John Malmberg/John E. Malmberg/ +s/Luca Alteas/Luca Altea/ +s/Michal Gorny/Michał Górny/ +s/Michal Górny/Michał Górny/ +s/^Moonesamy$/S. Moonesamy/ +s/Pete Su$/Peter Su/ +s/Sam Listopad/Samuel Listopad/ +s/Sebastien Willemijns/Sébastien Willemijns/ +s/YAMADA Yasuharu/Yasuharu Yamada/ +s/Karl M$/Karl Moerder/ +s/Bjorn Stenberg/Björn Stenberg/ +s/upstream tests 305 and 404// +s/Gaël PORTAY/Gaël Portay/ +s/Romulo Ceccon/Romulo A. Ceccon/ +s/Nach M. S$/Nach M. S./ +s/Ja[yt] Satiro/Ray Satiro/ +s/Richard J. Moore/Richard Moore/ +s/Sergey Nikulov/Sergei Nikulov/ +s/Petr Písař/Petr Pisar/ +s/Nick Zitzmann (originally)/Nick Zitzmann/ +s/product-security at Apple// +s/IT DOES NOT WORK// +s/Albert Chin$/Albert Chin-A-Young/ +s/Paras S\z/Paras Sethia/ +s/Paras Sethiaethia/Paras Sethia/ +s/Дмитрий Фалько/Dmitry Falko/ +s/byte_bucket in the #curl IRC channel// +s/Michal Górny and Anthony G. Basile// +s/Alejandro Alvarez$/Alejandro Alvarez Ayllon/ +s/Ant Bryan/Anthony Bryan/ +s/Cédric Deltheil/Cédric Deltheil/ +s/Christian Hagele/Christian Hägele/ +s/douglas steinwand/Douglas Steinwand/ +s/Frank Van Uffelen and Fabian Hiernaux// +s/Rodrigo Silva (MestreLion)/Rodrigo Silva/ +s/tetetest tetetest// +s/Jiří Hruška/Jiri Hruska/ +s/Viktor Szakáts/Viktor Szakats/ +s/Jonathan Cardoso$/Jonathan Cardoso Machado/ +s/Linus Nielsen$/Linus Nielsen Feltzing/ +s/Todd Ouska$/Todd A Ouska/ +s/Tim Ruehsen/Tim Rühsen/ +s/Michael Koenig/Michael König/ +s/moparisthebest/Travis Burtrum/ +s/Jan-E/Jan Ehrhardt/ +s/Paras S$/Paras Sethia/ +s/Cristian Rodr\xEDguez$/Cristian Rodríguez/ +s/Sidney San Mart\xEDn$/Sidney San Martín/ +s/Sidney San Martin$/Sidney San Martín/ +s/Taneli V\xE4h\xE4kangas$/Taneli Vähäkangas/ +s/Taneli Vahakangas$/Taneli Vähäkangas/ +s/Никита Дорохин./Никита Дорохин/ +s/upstream tests 305// +s/ (edited)// +s/Jean-Philippe Barette-LaPierre$/Jean-Philippe Barrette-LaPierre/ +s/Joern Hartroth$/Jörn Hartroth/ +s/Hongli Lai (Phusion)$/Hongli Lai/ +s/github user 'kreshano'$/kreshano on github/ +s/Marc Hoersken$/Marc Hörsken/ +s/Martin Storsjo$/Martin Storsjö/ +s/Jiri Malak$/Jiří Malák/ +s/JDepooter$/Joel Depooter/ +s/ERAMOTO Masaya$/Eramoto Masaya/ +s/shachaf on github$/Shachaf Ben-Kiki/ +s/CarloCannas on github$/Carlo Cannas/ +s/Henrik S. Gaßmann$/Henrik Gaßmann/ +s/moteus on github/Alexey Melnichuk/ +s/Rich Moore/Richard Moore/ +s/kdekker/Kees Dekker/ +s/Daniel Jelinski/Daniel Jeliński/ +s/Dario Weisser/Dario Weißer/ +s/Github user @jakirkham/jakirkham on github/ +s/Guenter Knauf/Gunter Knauf/ +s/Matteo B.$/Matteo Bignotti/ +s/Dan C$/Dan Cristian/ +s/Mark Eichin/Mark W. Eichin/ +s/Andreas Faerber/Andreas Farber/ +s/paulharris on github/Paul Harris/ +s/Warp Kawada/Yukihiro Kawada/ +s/Lau Hang Kin/Hang Kin Lau/ +s/Jonathan Cardoso Machado Machado/Jonathan Cardoso Machado/ +s/David Meyer/David J Meyer/ +s/Ramana Mokkapati/Venkataramana Mokkapati/ +s/wyattoday on github/Wyatt O'Day/ +s/Jason Priebe/Jason S. Priebe/ +s/Ale Vesely/Alessandro Vesely/ +s/Yamada Yasuharu/Yasuharu Yamada/ +s/Jim Gallagher/James Gallagher/ +s/Steve Brokenshire/Stephen Brokenshire/ +s/wangp on github/Peter Wang/ +s# *autobuild https://.*## +s/William A Rowe Jr/William A. Rowe Jr/ +s/jonrumsey on github/Jon Rumsey/ +s/Travis Burtrum on github// +s/i-ky on github/Gleb Ivanovsky/ diff --git a/curl/docs/TODO b/curl/docs/TODO index 264d559a..2fca6479 100644 --- a/curl/docs/TODO +++ b/curl/docs/TODO @@ -17,26 +17,37 @@ All bugs documented in the KNOWN_BUGS document are subject for fixing! 1. libcurl - 1.2 More data sharing + 1.1 TFO support on Windows + 1.2 Consult %APPDATA% also for .netrc 1.3 struct lifreq - 1.4 signal-based resolver timeouts + 1.4 alt-svc sharing 1.5 get rid of PATH_MAX - 1.6 Modified buffer size approach - 1.7 Detect when called from within callbacks + 1.6 native IDN support on macOS + 1.7 Support HTTP/2 for HTTP(S) proxies 1.8 CURLOPT_RESOLVE for any port number 1.9 Cache negative name resolves 1.10 auto-detect proxy 1.11 minimize dependencies with dynamically loaded modules + 1.12 updated DNS server while running + 1.13 c-ares and CURLOPT_OPENSOCKETFUNCTION 1.14 Typesafe curl_easy_setopt() 1.15 Monitor connections in the connection pool 1.16 Try to URL encode given URL 1.17 Add support for IRIs 1.18 try next proxy if one doesn't work - 1.19 Timeout idle connections from the pool + 1.19 provide timing info for each redirect 1.20 SRV and URI DNS records - 1.21 API for URL parsing/splitting + 1.21 netrc caching and sharing + 1.22 CURLINFO_PAUSE_STATE 1.23 Offer API to flush the connection pool 1.24 TCP Fast Open for windows + 1.25 Expose tried IP addresses that failed + 1.27 hardcode the "localhost" addresses + 1.28 FD_CLOEXEC + 1.29 Upgrade to websockets + 1.30 config file parsing + 1.31 erase secrets from heap/stack after use + 1.32 add asynch getaddrinfo support 2. libcurl - multi interface 2.1 More non-blocking @@ -44,29 +55,30 @@ 2.3 Non-blocking curl_multi_remove_handle() 2.4 Split connect and authentication process 2.5 Edge-triggered sockets should work + 2.6 multi upkeep + 2.7 Virtual external sockets + 2.8 dynamically decide to use socketpair 3. Documentation + 3.1 Improve documentation about fork safety 3.2 Provide cmake config-file 4. FTP 4.1 HOST 4.2 Alter passive/active on failure and retry 4.3 Earlier bad letter detection - 4.4 REST for large files 4.5 ASCII support 4.6 GSSAPI via Windows SSPI 4.7 STAT for LIST without data connection + 4.8 Option to ignore private IP addresses in PASV response 5. HTTP 5.1 Better persistency for HTTP 1.0 - 5.2 support FF3 sqlite cookie files + 5.2 Set custom client ip when using haproxy protocol 5.3 Rearrange request header order - 5.4 HTTP Digest using SHA-256 + 5.4 Allow SAN names in HTTP/2 server push 5.5 auth= in URLs - 5.6 Refuse "downgrade" redirects - 5.7 Brotli compression - 5.8 QUIC - 5.10 Leave secure cookies alone + 5.6 alt-svc should fallback if alt-svc doesn't work 6. TELNET 6.1 ditch stdin @@ -74,12 +86,10 @@ 6.3 feature negotiation debug data 7. SMTP - 7.1 Pipelining 7.2 Enhanced capability support 7.3 Add CURLOPT_MAIL_CLIENT option 8. POP3 - 8.1 Pipelining 8.2 Enhanced capability support 9. IMAP @@ -87,6 +97,8 @@ 10. LDAP 10.1 SASL based authentication mechanisms + 10.2 CURLOPT_SSL_CTX_FUNCTION for LDAPS + 10.3 Paged searches on LDAP server 11. SMB 11.1 File listing support @@ -94,31 +106,29 @@ 11.3 Use NTLMv2 11.4 Create remote directories - 12. New protocols - 12.1 RSYNC + 12. FILE + 12.1 Directory listing for FILE: 13. SSL - 13.1 Disable specific versions + 13.1 TLS-PSK with OpenSSL 13.2 Provide mutex locking API - 13.3 Evaluate SSL patches 13.4 Cache/share OpenSSL contexts 13.5 Export session ids 13.6 Provide callback for cert verification - 13.7 improve configure --with-ssl 13.8 Support DANE - 13.10 Support SSLKEYLOGFILE + 13.9 TLS record padding + 13.10 Support Authority Information Access certificate extension (AIA) 13.11 Support intermediate & root pinning for PINNEDPUBLICKEY - 13.12 Support HSTS - 13.13 Support HPKP + 13.13 Make sure we forbid TLS 1.3 post-handshake authentication + 13.14 Support the clienthello extension 14. GnuTLS - 14.1 SSL engine stuff 14.2 check connection - 15. WinSSL/SChannel - 15.1 Add support for client certificate authentication - 15.2 Add support for custom server certificate validation - 15.3 Add support for the --ciphers option + 15. Schannel + 15.1 Extend support for client certificate authentication + 15.2 Extend support for the --ciphers option + 15.4 Add option to allow abrupt server closure 16. SASL 16.1 Other authentication mechanisms @@ -127,30 +137,43 @@ 17. SSH protocols 17.1 Multiplexing - 17.2 SFTP performance + 17.2 Handle growing SFTP files 17.3 Support better than MD5 hostkey hash 17.4 Support CURLOPT_PREQUOTE + 17.5 SSH over HTTPS proxy with more backends 18. Command line tool 18.1 sync 18.2 glob posts 18.3 prevent file overwriting - 18.4 simultaneous parallel transfers - 18.6 warning when setting an option - 18.8 offer color-coded HTTP header output + 18.4 --proxycommand + 18.5 UTF-8 filenames in Content-Disposition + 18.6 Option to make -Z merge lined based outputs on stdout + 18.7 at least N milliseconds between requests + 18.8 Consider convenience options for JSON and XML? 18.9 Choose the name of file in braces for complex URLs 18.10 improve how curl works in a windows console window - 18.11 -w output to stderr + 18.11 Windows: set attribute 'archive' for completed downloads 18.12 keep running, read instructions from pipe/socket - 18.13 support metalink in http headers - 18.14 --fail without --location should treat 3xx as a failure + 18.13 Ratelimit or wait between serial requests + 18.14 --dry-run 18.15 --retry should resume 18.16 send only part of --data 18.17 consider file name from the redirected URL with -O ? + 18.18 retry on network is unreachable + 18.19 expand ~/ in config files + 18.20 host name sections in config files + 18.21 retry on the redirected-to URL + 18.23 Set the modification date on an uploaded file + 18.24 Use multiple parallel transfers for a single download + 18.25 Prevent terminal injection when writing to terminal + 18.26 Custom progress meter update interval 19. Build 19.1 roffit 19.2 Enable PIE and RELRO by default + 19.3 Don't use GNU libtool on OpenBSD + 19.4 Package curl for Windows in a signed installer 20. Test suite 20.1 SSL tunnel @@ -159,31 +182,29 @@ 20.4 more platforms supported 20.5 Add support for concurrent connections 20.6 Use the RFC6265 test suite + 20.7 Support LD_PRELOAD on macOS + 20.8 Run web-platform-tests url tests + 20.9 Bring back libssh tests on Travis - 21. Next SONAME bump - 21.1 http-style HEAD output for FTP - 21.2 combine error codes - 21.3 extend CURLOPT_SOCKOPTFUNCTION prototype - - 22. Next major release - 22.1 cleanup return codes - 22.2 remove obsolete defines - 22.3 size_t - 22.4 remove several functions - 22.5 remove CURLOPT_FAILONERROR - 22.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE - 22.7 remove progress meter from libcurl - 22.8 remove 'curl_httppost' from public + 21. MQTT + 21.1 Support rate-limiting ============================================================================== 1. libcurl -1.2 More data sharing +1.1 TFO support on Windows - curl_share_* functions already exist and work, and they can be extended to - share more. For example, enable sharing of the ares channel and the - connection cache. + TCP Fast Open is supported on several platforms but not on Windows. Work on + this was once started but never finished. + + See https://github.com/curl/curl/pull/3378 + +1.2 Consult %APPDATA% also for .netrc + + %APPDATA%\.netrc is not considered when running on Windows. Shouldn't it? + + See https://github.com/curl/curl/issues/4016 1.3 struct lifreq @@ -191,53 +212,37 @@ SIOCGIFADDR on newer Solaris versions as they claim the latter is obsolete. To support IPv6 interface addresses for network interfaces properly. -1.4 signal-based resolver timeouts +1.4 alt-svc sharing - libcurl built without an asynchronous resolver library uses alarm() to time - out DNS lookups. When a timeout occurs, this causes libcurl to jump from the - signal handler back into the library with a sigsetjmp, which effectively - causes libcurl to continue running within the signal handler. This is - non-portable and could cause problems on some platforms. A discussion on the - problem is available at https://curl.haxx.se/mail/lib-2008-09/0197.html + The share interface could benefit from allowing the alt-svc cache to be + possible to share between easy handles. - Also, alarm() provides timeout resolution only to the nearest second. alarm - ought to be replaced by setitimer on systems that support it. + See https://github.com/curl/curl/issues/4476 1.5 get rid of PATH_MAX Having code use and rely on PATH_MAX is not nice: https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html - Currently the SSH based code uses it a bit, but to remove PATH_MAX from there - we need libssh2 to properly tell us when we pass in a too small buffer and - its current API (as of libssh2 1.2.7) doesn't. - -1.6 Modified buffer size approach + Currently the libssh2 SSH based code uses it, but to remove PATH_MAX from + there we need libssh2 to properly tell us when we pass in a too small buffer + and its current API (as of libssh2 1.2.7) doesn't. - Current libcurl allocates a fixed 16K size buffer for download and an - additional 16K for upload. They are always unconditionally part of the easy - handle. If CRLF translations are requested, an additional 32K "scratch - buffer" is allocated. A total of 64K transfer buffers in the worst case. +1.6 native IDN support on macOS - First, while the handles are not actually in use these buffers could be freed - so that lingering handles just kept in queues or whatever waste less memory. + On recent macOS versions, the getaddrinfo() function itself has built-in IDN + support. By setting the AI_CANONNAME flag, the function will return the + encoded name in the ai_canonname struct field in the returned information. + This could be used by curl on macOS when built without a separate IDN library + and an IDN host name is used in a URL. - Secondly, SFTP is a protocol that needs to handle many ~30K blocks at once - since each need to be individually acked and therefore libssh2 must be - allowed to send (or receive) many separate ones in parallel to achieve high - transfer speeds. A current libcurl build with a 16K buffer makes that - impossible, but one with a 512K buffer will reach MUCH faster transfers. But - allocating 512K unconditionally for all buffers just in case they would like - to do fast SFTP transfers at some point is not a good solution either. + See initial work in https://github.com/curl/curl/pull/5371 - Dynamically allocate buffer size depending on protocol in use in combination - with freeing it after each individual transfer? Other suggestions? +1.7 Support HTTP/2 for HTTP(S) proxies -1.7 Detect when called from within callbacks + Support for doing HTTP/2 to HTTP and HTTPS proxies is still missing. - We should set a state variable before calling callbacks, so that we - subsequently can add code within libcurl that returns error if called within - callbacks for when that's not supported. + See https://github.com/curl/curl/issues/3570 1.8 CURLOPT_RESOLVE for any port number @@ -272,6 +277,26 @@ app/invoke/used protocols would be necessary to load. See https://github.com/curl/curl/issues/349 +1.12 updated DNS server while running + + If /etc/resolv.conf gets updated while a program using libcurl is running, it + is may cause name resolves to fail unless res_init() is called. We should + consider calling res_init() + retry once unconditionally on all name resolve + failures to mitigate against this. Firefox works like that. Note that Windows + doesn't have res_init() or an alternative. + + https://github.com/curl/curl/issues/2251 + +1.13 c-ares and CURLOPT_OPENSOCKETFUNCTION + + curl will create most sockets via the CURLOPT_OPENSOCKETFUNCTION callback and + close them with the CURLOPT_CLOSESOCKETFUNCTION callback. However, c-ares + does not use those functions and instead opens and closes the sockets + itself. This means that when curl passes the c-ares socket to the + CURLMOPT_SOCKETFUNCTION it isn't owned by the application like other sockets. + + See https://github.com/curl/curl/issues/2734 + 1.14 Typesafe curl_easy_setopt() One of the most common problems in libcurl using applications is the lack of @@ -330,27 +355,31 @@ https://github.com/curl/curl/issues/896 -1.19 Timeout idle connections from the pool +1.19 provide timing info for each redirect - libcurl currently keeps connections in its connection pool for an indefinite - period of time, until it either gets reused, gets noticed that it has been - closed by the server or gets pruned to make room for a new connection. + curl and libcurl provide timing information via a set of different + time-stamps (CURLINFO_*_TIME). When curl is following redirects, those + returned time value are the accumulated sums. An improvement could be to + offer separate timings for each redirect. - To reduce overhead (especially for when we add monitoring of the connections - in the pool), we should introduce a timeout so that connections that have - been idle for N seconds get closed. + https://github.com/curl/curl/issues/6743 1.20 SRV and URI DNS records Offer support for resolving SRV and URI DNS records for libcurl to know which server to connect to for various protocols (including HTTP!). -1.21 API for URL parsing/splitting +1.21 netrc caching and sharing + + The netrc file is read and parsed each time a connection is setup, which + means that if a transfer needs multiple connections for authentication or + redirects, the file might be reread (and parsed) multiple times. This makes + it impossible to provide the file as a pipe. - libcurl has always parsed URLs internally and never exposed any API or - features to allow applications to do it. Still most or many applications - using libcurl need that ability. In polls to users, we've learned that many - libcurl users would like to see and use such an API. +1.22 CURLINFO_PAUSE_STATE + + Return information about the transfer's current pause state, in both + directions. https://github.com/curl/curl/issues/2588 1.23 Offer API to flush the connection pool @@ -364,6 +393,67 @@ Mac OS. Windows supports TCP Fast Open starting with Windows 10, version 1607 and we should add support for it. +1.25 Expose tried IP addresses that failed + + When libcurl fails to connect to a host, it should be able to offer the + application the list of IP addresses that were used in the attempt. + + https://github.com/curl/curl/issues/2126 + +1.27 hardcode the "localhost" addresses + + There's this new spec getting adopted that says "localhost" should always and + unconditionally be a local address and not get resolved by a DNS server. A + fine way for curl to fix this would be to simply hard-code the response to + 127.0.0.1 and/or ::1 (depending on what IP versions that are requested). This + is what the browsers probably will do with this hostname. + + https://bugzilla.mozilla.org/show_bug.cgi?id=1220810 + + https://tools.ietf.org/html/draft-ietf-dnsop-let-localhost-be-localhost-02 + +1.28 FD_CLOEXEC + + It sets the close-on-exec flag for the file descriptor, which causes the file + descriptor to be automatically (and atomically) closed when any of the + exec-family functions succeed. Should probably be set by default? + + https://github.com/curl/curl/issues/2252 + +1.29 Upgrade to websockets + + libcurl could offer a smoother path to get to a websocket connection. + See https://github.com/curl/curl/issues/3523 + + Michael Kaufmann suggestion here: + https://curl.se/video/curlup-2017/2017-03-19_05_Michael_Kaufmann_Websocket_support_for_curl.mp4 + +1.30 config file parsing + + Consider providing an API, possibly in a separate companion library, for + parsing a config file like curl's -K/--config option to allow applications to + get the same ability to read curl options from files. + + See https://github.com/curl/curl/issues/3698 + +1.31 erase secrets from heap/stack after use + + Introducing a concept and system to erase secrets from memory after use, it + could help mitigate and lessen the impact of (future) security problems etc. + However: most secrets are passed to libcurl as clear text from the + application and then clearing them within the library adds nothing... + + https://github.com/curl/curl/issues/7268 + +1.32 add asynch getaddrinfo support + + Use getaddrinfo_a() to provide an asynch name resolver backend to libcurl + that doesn't use threads and doesn't depend on c-ares. The getaddrinfo_a + function is (probably?) glibc specific but that's a widely used libc among + our users. + + https://github.com/curl/curl/pull/6746 + 2. libcurl - multi interface 2.1 More non-blocking @@ -371,12 +461,21 @@ Make sure we don't ever loop because of non-blocking sockets returning EWOULDBLOCK or similar. Blocking cases include: - - Name resolves on non-windows unless c-ares or the threaded resolver is used - - SOCKS proxy handshakes + - Name resolves on non-windows unless c-ares or the threaded resolver is used. + + - The threaded resolver may block on cleanup: + https://github.com/curl/curl/issues/4852 + - file:// transfers + - TELNET transfers + + - GSSAPI authentication for FTP transfers + - The "DONE" operation (post transfer protocol-specific actions) for the - protocols SFTP, SMTP, FTP. Fixing Curl_done() for this is a worthy task. + protocols SFTP, SMTP, FTP. Fixing multi_done() for this is a worthy task. + + - curl_multi_remove_handle for any of the above. See section 2.3. 2.2 Better support for same name resolves @@ -407,8 +506,38 @@ the internal actions that need to be improved for this to work perfectly is the 'maxloops' handling in transfer.c:readwrite_data(). +2.6 multi upkeep + + In libcurl 7.62.0 we introduced curl_easy_upkeep. It unfortunately only works + on easy handles. We should introduces a version of that for the multi handle, + and also consider doing "upkeep" automatically on connections in the + connection pool when the multi handle is in used. + + See https://github.com/curl/curl/issues/3199 + +2.7 Virtual external sockets + + libcurl performs operations on the given file descriptor that presumes it is + a socket and an application cannot replace them at the moment. Allowing an + application to fully replace those would allow a larger degree of freedom and + flexibility. + + See https://github.com/curl/curl/issues/5835 + +2.8 dynamically decide to use socketpair + + For users who don't use curl_multi_wait() or don't care for + curl_multi_wakeup(), we could introduce a way to make libcurl NOT + create a socketpair in the multi handle. + + See https://github.com/curl/curl/issues/4829 + 3. Documentation +3.1 Improve documentation about fork safety + + See https://github.com/curl/curl/issues/6968 + 3.2 Provide cmake config-file A config-file package is a set of files provided by us to allow applications @@ -429,19 +558,13 @@ When trying to connect passively to a server which only supports active connections, libcurl returns CURLE_FTP_WEIRD_PASV_REPLY and closes the connection. There could be a way to fallback to an active connection (and - vice versa). https://curl.haxx.se/bug/feature.cgi?id=1754793 + vice versa). https://curl.se/bug/feature.cgi?id=1754793 4.3 Earlier bad letter detection Make the detection of (bad) %0d and %0a codes in FTP URL parts earlier in the process to avoid doing a resolve and connect in vain. -4.4 REST for large files - - REST fix for servers not behaving well on >2GB requests. This should fail if - the server doesn't set the pointer to the requested index. The tricky - (impossible?) part is to figure out if the server did the right thing or not. - 4.5 ASCII support FTP ASCII transfers do not follow RFC959. They don't convert the data @@ -449,30 +572,37 @@ 4.6 GSSAPI via Windows SSPI -In addition to currently supporting the SASL GSSAPI mechanism (Kerberos V5) -via third-party GSS-API libraries, such as Heimdal or MIT Kerberos, also add -support for GSSAPI authentication via Windows SSPI. + In addition to currently supporting the SASL GSSAPI mechanism (Kerberos V5) + via third-party GSS-API libraries, such as Heimdal or MIT Kerberos, also add + support for GSSAPI authentication via Windows SSPI. 4.7 STAT for LIST without data connection -Some FTP servers allow STAT for listing directories instead of using LIST, and -the response is then sent over the control connection instead of as the -otherwise usedw data connection: http://www.nsftools.com/tips/RawFTP.htm#STAT + Some FTP servers allow STAT for listing directories instead of using LIST, + and the response is then sent over the control connection instead of as the + otherwise usedw data connection: https://www.nsftools.com/tips/RawFTP.htm#STAT + + This is not detailed in any FTP specification. + +4.8 Option to ignore private IP addresses in PASV response -This is not detailed in any FTP specification. + Some servers respond with and some other FTP client implementations can + ignore private (RFC 1918 style) IP addresses when received in PASV responses. + To consider for libcurl as well. See https://github.com/curl/curl/issues/1455 5. HTTP 5.1 Better persistency for HTTP 1.0 "Better" support for persistent connections over HTTP 1.0 - https://curl.haxx.se/bug/feature.cgi?id=1089001 + https://curl.se/bug/feature.cgi?id=1089001 -5.2 support FF3 sqlite cookie files +5.2 Set custom client ip when using haproxy protocol - Firefox 3 is changing from its former format to a a sqlite database instead. - We should consider how (lib)curl can/should support this. - https://curl.haxx.se/bug/feature.cgi?id=1871388 + This would allow testing servers with different client ip addresses (without + using x-forward-for header). + + https://github.com/curl/curl/issues/5125 5.3 Rearrange request header order @@ -486,14 +616,14 @@ This is not detailed in any FTP specification. headers use a default value so only headers that need to be moved have to be specified. -5.4 HTTP Digest using SHA-256 +5.4 Allow SAN names in HTTP/2 server push - RFC 7616 introduces an update to the HTTP Digest authentication - specification, which amongst other thing defines how new digest algorithms - can be used instead of MD5 which is considered old and not recommended. + curl only allows HTTP/2 push promise if the provided :authority header value + exactly matches the host name given in the URL. It could be extended to allow + any name that would match the Subject Alternative Names in the server's TLS + certificate. - See https://tools.ietf.org/html/rfc7616 and - https://github.com/curl/curl/issues/1018 + See https://github.com/curl/curl/pull/3581 5.5 auth= in URLs @@ -502,49 +632,26 @@ This is not detailed in any FTP specification. For example: - http://test:pass;auth=NTLM@example.com would be equivalent to specifying --user - test:pass;auth=NTLM or --user test:pass --ntlm from the command line. + http://test:pass;auth=NTLM@example.com would be equivalent to specifying + --user test:pass;auth=NTLM or --user test:pass --ntlm from the command line. Additionally this should be implemented for proxy base URLs as well. -5.6 Refuse "downgrade" redirects - - See https://github.com/curl/curl/issues/226 - - Consider a way to tell curl to refuse to "downgrade" protocol with a redirect - and/or possibly a bit that refuses redirect to change protocol completely. - -5.7 Brotli compression - - Brotli compression performs better than gzip and is being implemented by - browsers and servers widely. The algorithm: https://github.com/google/brotli - The Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=366559 - -5.8 QUIC +5.6 alt-svc should fallback if alt-svc doesn't work - The standardization process of QUIC has been taken to the IETF and can be - followed on the [IETF QUIC Mailing - list](https://www.ietf.org/mailman/listinfo/quic). I'd like us to get on the - bandwagon. Ideally, this would be done with a separate library/project to - handle the binary/framing layer in a similar fashion to how HTTP/2 is - implemented. This, to allow other projects to benefit from the work and to - thus broaden the interest and chance of others to participate. - -5.10 Leave secure cookies alone - - Non-secure origins (HTTP sites) should not be allowed to set or modify - cookies with the 'secure' property: - - https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone-01 + The alt-svc: header provides a set of alternative services for curl to use + instead of the original. If the first attempted one fails, it should try the + next etc and if all alternatives fail go back to the original. + See https://github.com/curl/curl/issues/4908 6. TELNET 6.1 ditch stdin -Reading input (to send to the remote server) on stdin is a crappy solution for -library purposes. We need to invent a good way for the application to be able -to provide the data to send. + Reading input (to send to the remote server) on stdin is a crappy solution + for library purposes. We need to invent a good way for the application to be + able to provide the data to send. 6.2 ditch telnet-specific select @@ -554,15 +661,11 @@ to provide the data to send. 6.3 feature negotiation debug data - Add telnet feature negotiation data to the debug callback as header data. + Add telnet feature negotiation data to the debug callback as header data. 7. SMTP -7.1 Pipelining - - Add support for pipelining emails. - 7.2 Enhanced capability support Add the ability, for an application that uses libcurl, to obtain the list of @@ -576,15 +679,11 @@ to provide the data to send. hack ;-) Please see the following thread for more information: - https://curl.haxx.se/mail/lib-2012-05/0178.html + https://curl.se/mail/lib-2012-05/0178.html 8. POP3 -8.1 Pipelining - - Add support for pipelining commands. - 8.2 Enhanced capability support Add the ability, for an application that uses libcurl, to obtain the list of @@ -607,39 +706,57 @@ to provide the data to send. be possible to use ldap_bind_s() instead specifying the security context information ourselves. +10.2 CURLOPT_SSL_CTX_FUNCTION for LDAPS + + CURLOPT_SSL_CTX_FUNCTION works perfectly for HTTPS and email protocols, but + it has no effect for LDAPS connections. + + https://github.com/curl/curl/issues/4108 + +10.3 Paged searches on LDAP server + + https://github.com/curl/curl/issues/4452 + 11. SMB 11.1 File listing support -Add support for listing the contents of a SMB share. The output should probably -be the same as/similar to FTP. + Add support for listing the contents of a SMB share. The output should + probably be the same as/similar to FTP. 11.2 Honor file timestamps -The timestamp of the transferred file should reflect that of the original file. + The timestamp of the transferred file should reflect that of the original + file. 11.3 Use NTLMv2 -Currently the SMB authentication uses NTLMv1. + Currently the SMB authentication uses NTLMv1. 11.4 Create remote directories -Support for creating remote directories when uploading a file to a directory -that doesn't exist on the server, just like --ftp-create-dirs. + Support for creating remote directories when uploading a file to a directory + that doesn't exist on the server, just like --ftp-create-dirs. + + +12. FILE -12. New protocols +12.1 Directory listing for FILE: -12.1 RSYNC + Add support for listing the contents of a directory accessed with FILE. The + output should probably be the same as/similar to FTP. - There's no RFC for the protocol or an URI/URL format. An implementation - should most probably use an existing rsync library, such as librsync. 13. SSL -13.1 Disable specific versions +13.1 TLS-PSK with OpenSSL - Provide an option that allows for disabling specific SSL versions, such as - SSLv2 https://curl.haxx.se/bug/feature.cgi?id=1767276 + Transport Layer Security pre-shared key ciphersuites (TLS-PSK) is a set of + cryptographic protocols that provide secure communication based on pre-shared + keys (PSKs). These pre-shared keys are symmetric keys shared in advance among + the communicating parties. + + https://github.com/curl/curl/issues/5081 13.2 Provide mutex locking API @@ -647,11 +764,6 @@ that doesn't exist on the server, just like --ftp-create-dirs. library, so that the same application code can use mutex-locking independently of OpenSSL or GnutTLS being used. -13.3 Evaluate SSL patches - - Evaluate/apply Gertjan van Wingerde's SSL patches: - https://curl.haxx.se/mail/lib-2004-03/0087.html - 13.4 Cache/share OpenSSL contexts "Look at SSL cafile - quick traces look to me like these are done on every @@ -682,11 +794,6 @@ that doesn't exist on the server, just like --ftp-create-dirs. certificate, but this doesn't seem to be exposed in the libcurl APIs. Could it be? There's so much that could be done if it were! -13.7 improve configure --with-ssl - - make the configure --with-ssl option first check for OpenSSL, then GnuTLS, - then NSS... - 13.8 Support DANE DNS-Based Authentication of Named Entities (DANE) is a way to provide SSL @@ -694,105 +801,92 @@ that doesn't exist on the server, just like --ftp-create-dirs. https://www.rfc-editor.org/rfc/rfc6698.txt An initial patch was posted by Suresh Krishnaswamy on March 7th 2013 - (https://curl.haxx.se/mail/lib-2013-03/0075.html) but it was a too simple + (https://curl.se/mail/lib-2013-03/0075.html) but it was a too simple approach. See Daniel's comments: - https://curl.haxx.se/mail/lib-2013-03/0103.html . libunbound may be the + https://curl.se/mail/lib-2013-03/0103.html . libunbound may be the correct library to base this development on. Björn Stenberg wrote a separate initial take on DANE that was never completed. -13.10 Support SSLKEYLOGFILE +13.9 TLS record padding + + TLS (1.3) offers optional record padding and OpenSSL provides an API for it. + I could make sense for libcurl to offer this ability to applications to make + traffic patterns harder to figure out by network traffic observers. + + See https://github.com/curl/curl/issues/5398 + +13.10 Support Authority Information Access certificate extension (AIA) - When used, Firefox and Chrome dumps their master TLS keys to the file name - this environment variable specifies. This allows tools like for example - Wireshark to capture and decipher TLS traffic to/from those clients. libcurl - could be made to support this more widely (presumably this already works when - built with NSS). Peter Wu made a OpenSSL preload to make possible that can be - used as inspiration and guidance - https://git.lekensteyn.nl/peter/wireshark-notes/tree/src/sslkeylog.c + AIA can provide various things like CRLs but more importantly information + about intermediate CA certificates that can allow validation path to be + fulfilled when the HTTPS server doesn't itself provide them. + + Since AIA is about downloading certs on demand to complete a TLS handshake, + it is probably a bit tricky to get done right. + + See https://github.com/curl/curl/issues/2793 13.11 Support intermediate & root pinning for PINNEDPUBLICKEY CURLOPT_PINNEDPUBLICKEY does not consider the hashes of intermediate & root certificates when comparing the pinned keys. Therefore it is not compatible - with "HTTP Public Key Pinning" as there also intermediate and root certificates - can be pinned. This is very useful as it prevents webadmins from "locking - themself out of their servers". - - Adding this feature would make curls pinning 100% compatible to HPKP and allow - more flexible pinning. + with "HTTP Public Key Pinning" as there also intermediate and root + certificates can be pinned. This is very useful as it prevents webadmins from + "locking themselves out of their servers". -13.12 Support HSTS + Adding this feature would make curls pinning 100% compatible to HPKP and + allow more flexible pinning. - "HTTP Strict Transport Security" is TOFU (trust on first use), time-based - features indicated by a HTTP header send by the webserver. It is widely used - in browsers and it's purpose is to prevent insecure HTTP connections after - a previous HTTPS connection. It protects against SSLStripping attacks. +13.13 Make sure we forbid TLS 1.3 post-handshake authentication - Doc: https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security - RFC 6797: https://tools.ietf.org/html/rfc6797 + RFC 8740 explains how using HTTP/2 must forbid the use of TLS 1.3 + post-handshake authentication. We should make sure to live up to that. -13.13 Support HPKP + See https://github.com/curl/curl/issues/5396 - "HTTP Public Key Pinning" is TOFU (trust on first use), time-based - features indicated by a HTTP header send by the webserver. It's purpose is - to prevent Man-in-the-middle attacks by trusted CAs by allowing webadmins - to specify which CAs/certificates/public keys to trust when connection to - their websites. +13.14 Support the clienthello extension - It can be build based on PINNEDPUBLICKEY. + Certain stupid networks and middle boxes have a problem with SSL handshake + packets that are within a certain size range because how that sets some bits + that previously (in older TLS version) were not set. The clienthello + extension adds padding to avoid that size range. - Wikipedia: https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning - OWASP: https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning - Doc: https://developer.mozilla.org/de/docs/Web/Security/Public_Key_Pinning - RFC: https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21 + https://tools.ietf.org/html/rfc7685 + https://github.com/curl/curl/issues/2299 14. GnuTLS -14.1 SSL engine stuff - - Is this even possible? - 14.2 check connection Add a way to check if the connection seems to be alive, to correspond to the SSL_peak() way we use with OpenSSL. -15. WinSSL/SChannel +15. Schannel -15.1 Add support for client certificate authentication +15.1 Extend support for client certificate authentication - WinSSL/SChannel currently makes use of the OS-level system and user - certificate and private key stores. This does not allow the application - or the user to supply a custom client certificate using curl or libcurl. - - Therefore support for the existing -E/--cert and --key options should be - implemented by supplying a custom certificate to the SChannel APIs, see: + The existing support for the -E/--cert and --key options could be + extended by supplying a custom certificate and key in PEM format, see: - Getting a Certificate for Schannel https://msdn.microsoft.com/en-us/library/windows/desktop/aa375447.aspx -15.2 Add support for custom server certificate validation +15.2 Extend support for the --ciphers option - WinSSL/SChannel currently makes use of the OS-level system and user - certificate trust store. This does not allow the application or user to - customize the server certificate validation process using curl or libcurl. + The existing support for the --ciphers option could be extended + by mapping the OpenSSL/GnuTLS cipher suites to the Schannel APIs, see + - Specifying Schannel Ciphers and Cipher Strengths + https://msdn.microsoft.com/en-us/library/windows/desktop/aa380161.aspx - Therefore support for the existing --cacert or --capath options should be - implemented by supplying a custom certificate to the SChannel APIs, see: - - Getting a Certificate for Schannel - https://msdn.microsoft.com/en-us/library/windows/desktop/aa375447.aspx +15.4 Add option to allow abrupt server closure -15.3 Add support for the --ciphers option + libcurl w/schannel will error without a known termination point from the + server (such as length of transfer, or SSL "close notify" alert) to prevent + against a truncation attack. Really old servers may neglect to send any + termination point. An option could be added to ignore such abrupt closures. - The cipher suites used by WinSSL/SChannel are configured on an OS-level - instead of an application-level. This does not allow the application or - the user to customize the configured cipher suites using curl or libcurl. - - Therefore support for the existing --ciphers option should be implemented - by mapping the OpenSSL/GnuTLS cipher suites to the SChannel APIs, see - - Specifying Schannel Ciphers and Cipher Strengths - https://msdn.microsoft.com/en-us/library/windows/desktop/aa380161.aspx + https://github.com/curl/curl/issues/4427 16. SASL @@ -826,10 +920,15 @@ that doesn't exist on the server, just like --ftp-create-dirs. To fix this, libcurl would have to detect an existing connection and "attach" the new transfer to the existing one. -17.2 SFTP performance +17.2 Handle growing SFTP files + + The SFTP code in libcurl checks the file size *before* a transfer starts and + then proceeds to transfer exactly that amount of data. If the remote file + grows while the transfer is in progress libcurl won't notice and will not + adapt. The OpenSSH SFTP command line tool does and libcurl could also just + attempt to download more to see if there is more to get... - libcurl's SFTP transfer performance is sub par and can be improved, mostly by - the approach mentioned in "1.6 Modified buffer size approach". + https://github.com/curl/curl/issues/4344 17.3 Support better than MD5 hostkey hash @@ -837,7 +936,7 @@ that doesn't exist on the server, just like --ftp-create-dirs. server's key. MD5 is generally being deprecated so we should implement support for stronger hashing algorithms. libssh2 itself is what provides this underlying functionality and it supports at least SHA-1 as an alternative. - SHA-1 is also being deprecated these days so we should consider workign with + SHA-1 is also being deprecated these days so we should consider working with libssh2 to instead offer support for SHA-256 or similar. 17.4 Support CURLOPT_PREQUOTE @@ -845,6 +944,13 @@ that doesn't exist on the server, just like --ftp-create-dirs. The two other QUOTE options are supported for SFTP, but this was left out for unknown reasons! +17.5 SSH over HTTPS proxy with more backends + + The SSH based protocols SFTP and SCP didn't work over HTTPS proxy at + all until PR https://github.com/curl/curl/pull/6021 brought the + functionality with the libssh2 backend. Presumably, this support + can/could be added for the other backends as well. + 18. Command line tool 18.1 sync @@ -869,27 +975,55 @@ that doesn't exist on the server, just like --ftp-create-dirs. existing). So that index.html becomes first index.html.1 and then index.html.2 etc. -18.4 simultaneous parallel transfers +18.4 --proxycommand + + Allow the user to make curl run a command and use its stdio to make requests + and not do any network connection by itself. Example: + + curl --proxycommand 'ssh pi@raspberrypi.local -W 10.1.1.75 80' \ + http://some/otherwise/unavailable/service.php + + See https://github.com/curl/curl/issues/4941 + +18.5 UTF-8 filenames in Content-Disposition + + RFC 6266 documents how UTF-8 names can be passed to a client in the + Content-Disposition header, and curl does not support this. + + https://github.com/curl/curl/issues/1888 + +18.6 Option to make -Z merge lined based outputs on stdout + + When a user requests multiple lined based files using -Z and sends them to + stdout, curl will not "merge" and send complete lines fine but may very well + send partial lines from several sources. + + https://github.com/curl/curl/issues/5175 + +18.7 at least N milliseconds between requests + + Allow curl command lines issue a lot of request against services that limit + users to no more than N requests/second or similar. Could be implemented with + an option asking that at least a certain time has elapsed since the previous + request before the next one will be performed. Example: - The client could be told to use maximum N simultaneous parallel transfers and - then just make sure that happens. It should of course not make more than one - connection to the same remote host. This would require the client to use the - multi interface. https://curl.haxx.se/bug/feature.cgi?id=1558595 + $ curl "https://example.com/api?input=[1-1000]" -d yadayada --after 500 - Using the multi interface would also allow properly using parallel transfers - with HTTP/2 and supporting HTTP/2 server push from the command line. + See https://github.com/curl/curl/issues/3920 -18.6 warning when setting an option +18.8 Consider convenience options for JSON and XML? - Display a warning when libcurl returns an error when setting an option. - This can be useful to tell when support for a particular feature hasn't been - compiled into the library. + Could we add `--xml` or `--json` to add headers needed to call rest API: -18.8 offer color-coded HTTP header output + `--xml` adds -H 'Content-Type: application/xml' -H "Accept: application/xml" and + `--json` adds -H 'Content-Type: application/json' -H "Accept: application/json" - By offering different color output on the header name and the header - contents, they could be made more readable and thus help users working on - HTTP services. + Setting Content-Type when doing a GET or any other method without a body + would be a bit strange I think - so maybe only add CT for requests with body? + Maybe plain `--xml` and ` --json` are a bit too brief and generic. Maybe + `--http-json` etc? + + See https://github.com/curl/curl/issues/5203 18.9 Choose the name of file in braces for complex URLs @@ -909,13 +1043,16 @@ that doesn't exist on the server, just like --ftp-create-dirs. window, the transfer is interrupted and can get disconnected. This can probably be improved. See https://github.com/curl/curl/issues/322 -18.11 -w output to stderr +18.11 Windows: set attribute 'archive' for completed downloads + + The archive bit (FILE_ATTRIBUTE_ARCHIVE, 0x20) separates files that shall be + backed up from those that are either not ready or have not changed. + + Downloads in progress are neither ready to be backed up, nor should they be + opened by a different process. Only after a download has been completed it's + sensible to include it in any integer snapshot or backup of the system. - -w is quite useful, but not to those of us who use curl without -o or -O - (such as for scripting through a higher level language). It would be nice to - have an option that is exactly like -w but sends it to stderr - instead. Proposed name: --write-stderr. See - https://github.com/curl/curl/issues/613 + See https://github.com/curl/curl/issues/3354 18.12 keep running, read instructions from pipe/socket @@ -925,29 +1062,22 @@ that doesn't exist on the server, just like --ftp-create-dirs. invoke can talk to the still running instance and ask for transfers to get done, and thus maintain its connection pool, DNS cache and more. -18.13 support metalink in http headers +18.13 Ratelimit or wait between serial requests - Curl has support for downloading a metalink xml file, processing it, and then - downloading the target of the metalink. This is done via the --metalink option. - It would be nice if metalink also supported downloading via metalink - information that is stored in HTTP headers (RFC 6249). Theoretically this could - also be supported with the --metalink option. + Consider a command line option that can make curl do multiple serial requests + slow, potentially with a (random) wait between transfers. There's also a + proposed set of standard HTTP headers to let servers let the client adapt to + its rate limits: + https://www.ietf.org/id/draft-polli-ratelimit-headers-02.html - See https://tools.ietf.org/html/rfc6249 + See https://github.com/curl/curl/issues/5406 - See also https://lists.gnu.org/archive/html/bug-wget/2015-06/msg00034.html for - an implematation of this in wget. +18.14 --dry-run -18.14 --fail without --location should treat 3xx as a failure + A command line option that makes curl show exactly what it would do and send + if it would run for real. - To allow a command line like this to detect a redirect and consider it a - failure: - - curl -v --fail -O https://example.com/curl-7.48.0.tar.gz - - ... --fail must treat 3xx responses as failures too. The least problematic - way to implement this is probably to add that new logic in the command line - tool only and not in the underlying CURLOPT_FAILONERROR logic. + See https://github.com/curl/curl/issues/5426 18.15 --retry should resume @@ -986,6 +1116,86 @@ that doesn't exist on the server, just like --ftp-create-dirs. See https://github.com/curl/curl/issues/1241 +18.18 retry on network is unreachable + + The --retry option retries transfers on "transient failures". We later added + --retry-connrefused to also retry for "connection refused" errors. + + Suggestions have been brought to also allow retry on "network is unreachable" + errors and while totally reasonable, maybe we should consider a way to make + this more configurable than to add a new option for every new error people + want to retry for? + + https://github.com/curl/curl/issues/1603 + +18.19 expand ~/ in config files + + For example .curlrc could benefit from being able to do this. + + See https://github.com/curl/curl/issues/2317 + +18.20 host name sections in config files + + config files would be more powerful if they could set different + configurations depending on used URLs, host name or possibly origin. Then a + default .curlrc could a specific user-agent only when doing requests against + a certain site. + +18.21 retry on the redirected-to URL + + When curl is told to --retry a failed transfer and follows redirects, it + might get a HTTP 429 response from the redirected-to URL and not the original + one, which then could make curl decide to rather retry the transfer on that + URL only instead of the original operation to the original URL. + + Perhaps extra emphasized if the original transfer is a large POST that + redirects to a separate GET, and that GET is what gets the 529 + + See https://github.com/curl/curl/issues/5462 + +18.23 Set the modification date on an uploaded file + + For SFTP and possibly FTP, curl could offer an option to set the + modification time for the uploaded file. + + See https://github.com/curl/curl/issues/5768 + +18.24 Use multiple parallel transfers for a single download + + To enhance transfer speed, downloading a single URL can be split up into + multiple separate range downloads that get combined into a single final + result. + + An ideal implementation would not use a specified number of parallel + transfers, but curl could: + - First start getting the full file as transfer A + - If after N seconds have passed and the transfer is expected to continue for + M seconds or more, add a new transfer (B) that asks for the second half of + A's content (and stop A at the middle). + - If splitting up the work improves the transfer rate, it could then be done + again. Then again, etc up to a limit. + + This way, if transfer B fails (because Range: isn't supported) it will let + transfer A remain the single one. N and M could be set to some sensible + defaults. + + See https://github.com/curl/curl/issues/5774 + +18.25 Prevent terminal injection when writing to terminal + + curl could offer an option to make escape sequence either non-functional or + avoid cursor moves or similar to reduce the risk of a user getting tricked by + clever tricks. + + See https://github.com/curl/curl/issues/6150 + +18.26 Custom progress meter update interval + + Users who are for example doing large downloads in CI or remote setups might + want the occasional progress meter update to see that the transfer is + progressing and hasn't stuck, but they may not appreciate the + many-times-a-second frequency curl can end up doing it with now. + 19. Build 19.1 roffit @@ -1005,6 +1215,19 @@ that doesn't exist on the server, just like --ftp-create-dirs. to no impact, neither on the performance nor on the general functionality of curl. +19.3 Don't use GNU libtool on OpenBSD + When compiling curl on OpenBSD with "--enable-debug" it will give linking + errors when you use GNU libtool. This can be fixed by using the libtool + provided by OpenBSD itself. However for this the user always needs to invoke + make with "LIBTOOL=/usr/bin/libtool". It would be nice if the script could + have some magic to detect if this system is an OpenBSD host and then use the + OpenBSD libtool instead. + + See https://github.com/curl/curl/issues/5862 + +19.4 Package curl for Windows in a signed installer + + See https://github.com/curl/curl/issues/5424 20. Test suite @@ -1031,17 +1254,17 @@ that doesn't exist on the server, just like --ftp-create-dirs. 20.5 Add support for concurrent connections - Tests 836, 882 and 938 were designed to verify that separate connections aren't - used when using different login credentials in protocols that shouldn't re-use - a connection under such circumstances. + Tests 836, 882 and 938 were designed to verify that separate connections + aren't used when using different login credentials in protocols that + shouldn't re-use a connection under such circumstances. Unfortunately, ftpserver.pl doesn't appear to support multiple concurrent - connections. The read while() loop seems to loop until it receives a disconnect - from the client, where it then enters the waiting for connections loop. When - the client opens a second connection to the server, the first connection hasn't - been dropped (unless it has been forced - which we shouldn't do in these tests) - and thus the wait for connections loop is never entered to receive the second - connection. + connections. The read while() loop seems to loop until it receives a + disconnect from the client, where it then enters the waiting for connections + loop. When the client opens a second connection to the server, the first + connection hasn't been dropped (unless it has been forced - which we + shouldn't do in these tests) and thus the wait for connections loop is never + entered to receive the second connection. 20.6 Use the RFC6265 test suite @@ -1052,108 +1275,31 @@ that doesn't exist on the server, just like --ftp-create-dirs. curl with that test suite and detect deviances. Ideally, that would even be incorporated into our regular test suite. +20.7 Support LD_PRELOAD on macOS -21. Next SONAME bump - -21.1 http-style HEAD output for FTP - - #undef CURL_FTP_HTTPSTYLE_HEAD in lib/ftp.c to remove the HTTP-style headers - from being output in NOBODY requests over FTP - -21.2 combine error codes - - Combine some of the error codes to remove duplicates. The original - numbering should not be changed, and the old identifiers would be - macroed to the new ones in an CURL_NO_OLDIES section to help with - backward compatibility. - - Candidates for removal and their replacements: - - CURLE_FILE_COULDNT_READ_FILE => CURLE_REMOTE_FILE_NOT_FOUND - - CURLE_FTP_COULDNT_RETR_FILE => CURLE_REMOTE_FILE_NOT_FOUND - - CURLE_FTP_COULDNT_USE_REST => CURLE_RANGE_ERROR - - CURLE_FUNCTION_NOT_FOUND => CURLE_FAILED_INIT - - CURLE_LDAP_INVALID_URL => CURLE_URL_MALFORMAT - - CURLE_TFTP_NOSUCHUSER => CURLE_TFTP_ILLEGAL - - CURLE_TFTP_NOTFOUND => CURLE_REMOTE_FILE_NOT_FOUND - - CURLE_TFTP_PERM => CURLE_REMOTE_ACCESS_DENIED - -21.3 extend CURLOPT_SOCKOPTFUNCTION prototype - - The current prototype only provides 'purpose' that tells what the - connection/socket is for, but not any protocol or similar. It makes it hard - for applications to differentiate on TCP vs UDP and even HTTP vs FTP and - similar. - -22. Next major release - -22.1 cleanup return codes - - curl_easy_cleanup() returns void, but curl_multi_cleanup() returns a - CURLMcode. These should be changed to be the same. - -22.2 remove obsolete defines - - remove obsolete defines from curl/curl.h - -22.3 size_t - - make several functions use size_t instead of int in their APIs - -22.4 remove several functions - - remove the following functions from the public API: - - curl_getenv - - curl_mprintf (and variations) - - curl_strequal - - curl_strnequal - - They will instead become curlx_ - alternatives. That makes the curl app - still capable of using them, by building with them from source. - - These functions have no purpose anymore: - - curl_multi_socket - - curl_multi_socket_all + LD_RELOAD doesn't work on macOS, but there are tests which require it to run + properly. Look into making the preload support in runtests.pl portable such + that it uses DYLD_INSERT_LIBRARIES on macOS. -22.5 remove CURLOPT_FAILONERROR +20.8 Run web-platform-tests url tests - Remove support for CURLOPT_FAILONERROR, it has gotten too kludgy and weird - internally. Let the app judge success or not for itself. + Run web-platform-tests url tests and compare results with browsers on wpt.fyi -22.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE + It would help us find issues to fix and help us document where our parser + differs from the WHATWG URL spec parsers. - Remove support for a global DNS cache. Anything global is silly, and we - already offer the share interface for the same functionality but done - "right". + See https://github.com/curl/curl/issues/4477 -22.7 remove progress meter from libcurl +20.9 Bring back libssh tests on Travis - The internally provided progress meter output doesn't belong in the library. - Basically no application wants it (apart from curl) but instead applications - can and should do their own progress meters using the progress callback. + In https://github.com/curl/curl/pull/7012 we remove the libssh builds and + tests from Travis CI due to them not working. This should be remedied and + libssh builds be brought back. - The progress callback should then be bumped as well to get proper 64bit - variable types passed to it instead of doubles so that big files work - correctly. -22.8 remove 'curl_httppost' from public +21. MQTT - curl_formadd() was made to fill in a public struct, but the fact that the - struct is public is never really used by application for their own advantage - but instead often restricts how the form functions can or can't be modified. +21.1 Support rate-limiting - Changing them to return a private handle will benefit the implementation and - allow us much greater freedoms while still maintaining a solid API and ABI. + The rate-limiting logic is done in the PERFORMING state in multi.c but MQTT + is not (yet) implemented to use that! diff --git a/curl/docs/TheArtOfHttpScripting b/curl/docs/TheArtOfHttpScripting deleted file mode 100644 index b2bd9db7..00000000 --- a/curl/docs/TheArtOfHttpScripting +++ /dev/null @@ -1,758 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - - -The Art Of Scripting HTTP Requests Using Curl - - 1. HTTP Scripting - 1.1 Background - 1.2 The HTTP Protocol - 1.3 See the Protocol - 1.4 See the Timing - 1.5 See the Response - 2. URL - 2.1 Spec - 2.2 Host - 2.3 Port number - 2.4 User name and password - 2.5 Path part - 3. Fetch a page - 3.1 GET - 3.2 HEAD - 3.3 Multiple URLs in a single command line - 3.4 Multiple HTTP methods in a single command line - 4. HTML forms - 4.1 Forms explained - 4.2 GET - 4.3 POST - 4.4 File Upload POST - 4.5 Hidden Fields - 4.6 Figure Out What A POST Looks Like - 5. HTTP upload - 5.1 PUT - 6. HTTP Authentication - 6.1 Basic Authentication - 6.2 Other Authentication - 6.3 Proxy Authentication - 6.4 Hiding credentials - 7. More HTTP Headers - 7.1 Referer - 7.2 User Agent - 8. Redirects - 8.1 Location header - 8.2 Other redirects - 9. Cookies - 9.1 Cookie Basics - 9.2 Cookie options - 10. HTTPS - 10.1 HTTPS is HTTP secure - 10.2 Certificates - 11. Custom Request Elements - 11.1 Modify method and headers - 11.2 More on changed methods - 12. Web Login - 12.1 Some login tricks - 13. Debug - 13.1 Some debug tricks - 14. References - 14.1 Standards - 14.2 Sites - -============================================================================== - -1. HTTP Scripting - - 1.1 Background - - This document assumes that you're familiar with HTML and general networking. - - The increasing amount of applications moving to the web has made "HTTP - Scripting" more frequently requested and wanted. To be able to automatically - extract information from the web, to fake users, to post or upload data to - web servers are all important tasks today. - - Curl is a command line tool for doing all sorts of URL manipulations and - transfers, but this particular document will focus on how to use it when - doing HTTP requests for fun and profit. I'll assume that you know how to - invoke 'curl --help' or 'curl --manual' to get basic information about it. - - Curl is not written to do everything for you. It makes the requests, it gets - the data, it sends data and it retrieves the information. You probably need - to glue everything together using some kind of script language or repeated - manual invokes. - - 1.2 The HTTP Protocol - - HTTP is the protocol used to fetch data from web servers. It is a very simple - protocol that is built upon TCP/IP. The protocol also allows information to - get sent to the server from the client using a few different methods, as will - be shown here. - - HTTP is plain ASCII text lines being sent by the client to a server to - request a particular action, and then the server replies a few text lines - before the actual requested content is sent to the client. - - The client, curl, sends a HTTP request. The request contains a method (like - GET, POST, HEAD etc), a number of request headers and sometimes a request - body. The HTTP server responds with a status line (indicating if things went - well), response headers and most often also a response body. The "body" part - is the plain data you requested, like the actual HTML or the image etc. - - 1.3 See the Protocol - - Using curl's option --verbose (-v as a short option) will display what kind - of commands curl sends to the server, as well as a few other informational - texts. - - --verbose is the single most useful option when it comes to debug or even - understand the curl<->server interaction. - - Sometimes even --verbose is not enough. Then --trace and --trace-ascii offer - even more details as they show EVERYTHING curl sends and receives. Use it - like this: - - curl --trace-ascii debugdump.txt http://www.example.com/ - - 1.4 See the Timing - - Many times you may wonder what exactly is taking all the time, or you just - want to know the amount of milliseconds between two points in a - transfer. For those, and other similar situations, the --trace-time option - is what you need. It'll prepend the time to each trace output line: - - curl --trace-ascii d.txt --trace-time http://example.com/ - - 1.5 See the Response - - By default curl sends the response to stdout. You need to redirect it - somewhere to avoid that, most often that is done with -o or -O. - -2. URL - - 2.1 Spec - - The Uniform Resource Locator format is how you specify the address of a - particular resource on the Internet. You know these, you've seen URLs like - https://curl.haxx.se or https://yourbank.com a million times. RFC 3986 is the - canonical spec. And yeah, the formal name is not URL, it is URI. - - 2.2 Host - - The host name is usually resolved using DNS or your /etc/hosts file to an IP - address and that's what curl will communicate with. Alternatively you specify - the IP address directly in the URL instead of a name. - - For development and other trying out situations, you can point to a different - IP address for a host name than what would otherwise be used, by using curl's - --resolve option: - - curl --resolve www.example.org:80:127.0.0.1 http://www.example.org/ - - 2.3 Port number - - Each protocol curl supports operates on a default port number, be it over TCP - or in some cases UDP. Normally you don't have to take that into - consideration, but at times you run test servers on other ports or - similar. Then you can specify the port number in the URL with a colon and a - number immediately following the host name. Like when doing HTTP to port - 1234: - - curl http://www.example.org:1234/ - - The port number you specify in the URL is the number that the server uses to - offer its services. Sometimes you may use a local proxy, and then you may - need to specify that proxy's port number separately for what curl needs to - connect to locally. Like when using a HTTP proxy on port 4321: - - curl --proxy http://proxy.example.org:4321 http://remote.example.org/ - - 2.4 User name and password - - Some services are setup to require HTTP authentication and then you need to - provide name and password which is then transferred to the remote site in - various ways depending on the exact authentication protocol used. - - You can opt to either insert the user and password in the URL or you can - provide them separately: - - curl http://user:password@example.org/ - - or - - curl -u user:password http://example.org/ - - You need to pay attention that this kind of HTTP authentication is not what - is usually done and requested by user-oriented web sites these days. They - tend to use forms and cookies instead. - - 2.5 Path part - - The path part is just sent off to the server to request that it sends back - the associated response. The path is what is to the right side of the slash - that follows the host name and possibly port number. - -3. Fetch a page - - 3.1 GET - - The simplest and most common request/operation made using HTTP is to GET a - URL. The URL could itself refer to a web page, an image or a file. The client - issues a GET request to the server and receives the document it asked for. - If you issue the command line - - curl https://curl.haxx.se - - you get a web page returned in your terminal window. The entire HTML document - that that URL holds. - - All HTTP replies contain a set of response headers that are normally hidden, - use curl's --include (-i) option to display them as well as the rest of the - document. - - 3.2 HEAD - - You can ask the remote server for ONLY the headers by using the --head (-I) - option which will make curl issue a HEAD request. In some special cases - servers deny the HEAD method while others still work, which is a particular - kind of annoyance. - - The HEAD method is defined and made so that the server returns the headers - exactly the way it would do for a GET, but without a body. It means that you - may see a Content-Length: in the response headers, but there must not be an - actual body in the HEAD response. - - 3.3 Multiple URLs in a single command line - - A single curl command line may involve one or many URLs. The most common case - is probably to just use one, but you can specify any amount of URLs. Yes - any. No limits. You'll then get requests repeated over and over for all the - given URLs. - - Example, send two GETs: - - curl http://url1.example.com http://url2.example.com - - If you use --data to POST to the URL, using multiple URLs means that you send - that same POST to all the given URLs. - - Example, send two POSTs: - - curl --data name=curl http://url1.example.com http://url2.example.com - - - 3.4 Multiple HTTP methods in a single command line - - Sometimes you need to operate on several URLs in a single command line and do - different HTTP methods on each. For this, you'll enjoy the --next option. It - is basically a separator that separates a bunch of options from the next. All - the URLs before --next will get the same method and will get all the POST - data merged into one. - - When curl reaches the --next on the command line, it'll sort of reset the - method and the POST data and allow a new set. - - Perhaps this is best shown with a few examples. To send first a HEAD and then - a GET: - - curl -I http://example.com --next http://example.com - - To first send a POST and then a GET: - - curl -d score=10 http://example.com/post.cgi --next http://example.com/results.html - - -4. HTML forms - - 4.1 Forms explained - - Forms are the general way a web site can present a HTML page with fields for - the user to enter data in, and then press some kind of 'OK' or 'Submit' - button to get that data sent to the server. The server then typically uses - the posted data to decide how to act. Like using the entered words to search - in a database, or to add the info in a bug tracking system, display the entered - address on a map or using the info as a login-prompt verifying that the user - is allowed to see what it is about to see. - - Of course there has to be some kind of program on the server end to receive - the data you send. You cannot just invent something out of the air. - - 4.2 GET - - A GET-form uses the method GET, as specified in HTML like: - -
- - -
- - In your favorite browser, this form will appear with a text box to fill in - and a press-button labeled "OK". If you fill in '1905' and press the OK - button, your browser will then create a new URL to get for you. The URL will - get "junk.cgi?birthyear=1905&press=OK" appended to the path part of the - previous URL. - - If the original form was seen on the page "www.hotmail.com/when/birth.html", - the second page you'll get will become - "www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK". - - Most search engines work this way. - - To make curl do the GET form post for you, just enter the expected created - URL: - - curl "http://www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK" - - 4.3 POST - - The GET method makes all input field names get displayed in the URL field of - your browser. That's generally a good thing when you want to be able to - bookmark that page with your given data, but it is an obvious disadvantage - if you entered secret information in one of the fields or if there are a - large amount of fields creating a very long and unreadable URL. - - The HTTP protocol then offers the POST method. This way the client sends the - data separated from the URL and thus you won't see any of it in the URL - address field. - - The form would look very similar to the previous one: - -
- - -
- - And to use curl to post this form with the same data filled in as before, we - could do it like: - - curl --data "birthyear=1905&press=%20OK%20" \ - http://www.example.com/when.cgi - - This kind of POST will use the Content-Type - application/x-www-form-urlencoded and is the most widely used POST kind. - - The data you send to the server MUST already be properly encoded, curl will - not do that for you. For example, if you want the data to contain a space, - you need to replace that space with %20 etc. Failing to comply with this - will most likely cause your data to be received wrongly and messed up. - - Recent curl versions can in fact url-encode POST data for you, like this: - - curl --data-urlencode "name=I am Daniel" http://www.example.com - - If you repeat --data several times on the command line, curl will - concatenate all the given data pieces - and put a '&' symbol between each - data segment. - - 4.4 File Upload POST - - Back in late 1995 they defined an additional way to post data over HTTP. It - is documented in the RFC 1867, why this method sometimes is referred to as - RFC1867-posting. - - This method is mainly designed to better support file uploads. A form that - allows a user to upload a file could be written like this in HTML: - -
- - -
- - This clearly shows that the Content-Type about to be sent is - multipart/form-data. - - To post to a form like this with curl, you enter a command line like: - - curl --form upload=@localfilename --form press=OK [URL] - - 4.5 Hidden Fields - - A very common way for HTML based applications to pass state information - between pages is to add hidden fields to the forms. Hidden fields are - already filled in, they aren't displayed to the user and they get passed - along just as all the other fields. - - A similar example form with one visible field, one hidden field and one - submit button could look like: - -
- - - -
- - To POST this with curl, you won't have to think about if the fields are - hidden or not. To curl they're all the same: - - curl --data "birthyear=1905&press=OK&person=daniel" [URL] - - 4.6 Figure Out What A POST Looks Like - - When you're about fill in a form and send to a server by using curl instead - of a browser, you're of course very interested in sending a POST exactly the - way your browser does. - - An easy way to get to see this, is to save the HTML page with the form on - your local disk, modify the 'method' to a GET, and press the submit button - (you could also change the action URL if you want to). - - You will then clearly see the data get appended to the URL, separated with a - '?'-letter as GET forms are supposed to. - -5. HTTP upload - - 5.1 PUT - - Perhaps the best way to upload data to a HTTP server is to use PUT. Then - again, this of course requires that someone put a program or script on the - server end that knows how to receive a HTTP PUT stream. - - Put a file to a HTTP server with curl: - - curl --upload-file uploadfile http://www.example.com/receive.cgi - -6. HTTP Authentication - - 6.1 Basic Authentication - - HTTP Authentication is the ability to tell the server your username and - password so that it can verify that you're allowed to do the request you're - doing. The Basic authentication used in HTTP (which is the type curl uses by - default) is *plain* *text* based, which means it sends username and password - only slightly obfuscated, but still fully readable by anyone that sniffs on - the network between you and the remote server. - - To tell curl to use a user and password for authentication: - - curl --user name:password http://www.example.com - - 6.2 Other Authentication - - The site might require a different authentication method (check the headers - returned by the server), and then --ntlm, --digest, --negotiate or even - --anyauth might be options that suit you. - - 6.3 Proxy Authentication - - Sometimes your HTTP access is only available through the use of a HTTP - proxy. This seems to be especially common at various companies. A HTTP proxy - may require its own user and password to allow the client to get through to - the Internet. To specify those with curl, run something like: - - curl --proxy-user proxyuser:proxypassword curl.haxx.se - - If your proxy requires the authentication to be done using the NTLM method, - use --proxy-ntlm, if it requires Digest use --proxy-digest. - - If you use any one of these user+password options but leave out the password - part, curl will prompt for the password interactively. - - 6.4 Hiding credentials - - Do note that when a program is run, its parameters might be possible to see - when listing the running processes of the system. Thus, other users may be - able to watch your passwords if you pass them as plain command line - options. There are ways to circumvent this. - - It is worth noting that while this is how HTTP Authentication works, very - many web sites will not use this concept when they provide logins etc. See - the Web Login chapter further below for more details on that. - -7. More HTTP Headers - - 7.1 Referer - - A HTTP request may include a 'referer' field (yes it is misspelled), which - can be used to tell from which URL the client got to this particular - resource. Some programs/scripts check the referer field of requests to verify - that this wasn't arriving from an external site or an unknown page. While - this is a stupid way to check something so easily forged, many scripts still - do it. Using curl, you can put anything you want in the referer-field and - thus more easily be able to fool the server into serving your request. - - Use curl to set the referer field with: - - curl --referer http://www.example.come http://www.example.com - - 7.2 User Agent - - Very similar to the referer field, all HTTP requests may set the User-Agent - field. It names what user agent (client) that is being used. Many - applications use this information to decide how to display pages. Silly web - programmers try to make different pages for users of different browsers to - make them look the best possible for their particular browsers. They usually - also do different kinds of javascript, vbscript etc. - - At times, you will see that getting a page with curl will not return the same - page that you see when getting the page with your browser. Then you know it - is time to set the User Agent field to fool the server into thinking you're - one of those browsers. - - To make curl look like Internet Explorer 5 on a Windows 2000 box: - - curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL] - - Or why not look like you're using Netscape 4.73 on an old Linux box: - - curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL] - -8. Redirects - - 8.1 Location header - - When a resource is requested from a server, the reply from the server may - include a hint about where the browser should go next to find this page, or a - new page keeping newly generated output. The header that tells the browser - to redirect is Location:. - - Curl does not follow Location: headers by default, but will simply display - such pages in the same manner it displays all HTTP replies. It does however - feature an option that will make it attempt to follow the Location: pointers. - - To tell curl to follow a Location: - - curl --location http://www.example.com - - If you use curl to POST to a site that immediately redirects you to another - page, you can safely use --location (-L) and --data/--form together. Curl will - only use POST in the first request, and then revert to GET in the following - operations. - - 8.2 Other redirects - - Browser typically support at least two other ways of redirects that curl - doesn't: first the html may contain a meta refresh tag that asks the browser - to load a specific URL after a set number of seconds, or it may use - javascript to do it. - -9. Cookies - - 9.1 Cookie Basics - - The way the web browsers do "client side state control" is by using - cookies. Cookies are just names with associated contents. The cookies are - sent to the client by the server. The server tells the client for what path - and host name it wants the cookie sent back, and it also sends an expiration - date and a few more properties. - - When a client communicates with a server with a name and path as previously - specified in a received cookie, the client sends back the cookies and their - contents to the server, unless of course they are expired. - - Many applications and servers use this method to connect a series of requests - into a single logical session. To be able to use curl in such occasions, we - must be able to record and send back cookies the way the web application - expects them. The same way browsers deal with them. - - 9.2 Cookie options - - The simplest way to send a few cookies to the server when getting a page with - curl is to add them on the command line like: - - curl --cookie "name=Daniel" http://www.example.com - - Cookies are sent as common HTTP headers. This is practical as it allows curl - to record cookies simply by recording headers. Record cookies with curl by - using the --dump-header (-D) option like: - - curl --dump-header headers_and_cookies http://www.example.com - - (Take note that the --cookie-jar option described below is a better way to - store cookies.) - - Curl has a full blown cookie parsing engine built-in that comes in use if you - want to reconnect to a server and use cookies that were stored from a - previous connection (or hand-crafted manually to fool the server into - believing you had a previous connection). To use previously stored cookies, - you run curl like: - - curl --cookie stored_cookies_in_file http://www.example.com - - Curl's "cookie engine" gets enabled when you use the --cookie option. If you - only want curl to understand received cookies, use --cookie with a file that - doesn't exist. Example, if you want to let curl understand cookies from a - page and follow a location (and thus possibly send back cookies it received), - you can invoke it like: - - curl --cookie nada --location http://www.example.com - - Curl has the ability to read and write cookie files that use the same file - format that Netscape and Mozilla once used. It is a convenient way to share - cookies between scripts or invokes. The --cookie (-b) switch automatically - detects if a given file is such a cookie file and parses it, and by using the - --cookie-jar (-c) option you'll make curl write a new cookie file at the end - of an operation: - - curl --cookie cookies.txt --cookie-jar newcookies.txt \ - http://www.example.com - -10. HTTPS - - 10.1 HTTPS is HTTP secure - - There are a few ways to do secure HTTP transfers. By far the most common - protocol for doing this is what is generally known as HTTPS, HTTP over - SSL. SSL encrypts all the data that is sent and received over the network and - thus makes it harder for attackers to spy on sensitive information. - - SSL (or TLS as the latest version of the standard is called) offers a - truckload of advanced features to allow all those encryptions and key - infrastructure mechanisms encrypted HTTP requires. - - Curl supports encrypted fetches when built to use a TLS library and it can be - built to use one out of a fairly large set of libraries - "curl -V" will show - which one your curl was built to use (if any!). To get a page from a HTTPS - server, simply run curl like: - - curl https://secure.example.com - - 10.2 Certificates - - In the HTTPS world, you use certificates to validate that you are the one - you claim to be, as an addition to normal passwords. Curl supports client- - side certificates. All certificates are locked with a pass phrase, which you - need to enter before the certificate can be used by curl. The pass phrase - can be specified on the command line or if not, entered interactively when - curl queries for it. Use a certificate with curl on a HTTPS server like: - - curl --cert mycert.pem https://secure.example.com - - curl also tries to verify that the server is who it claims to be, by - verifying the server's certificate against a locally stored CA cert - bundle. Failing the verification will cause curl to deny the connection. You - must then use --insecure (-k) in case you want to tell curl to ignore that - the server can't be verified. - - More about server certificate verification and ca cert bundles can be read - in the SSLCERTS document, available online here: - - https://curl.haxx.se/docs/sslcerts.html - - At times you may end up with your own CA cert store and then you can tell - curl to use that to verify the server's certificate: - - curl --cacert ca-bundle.pem https://example.com/ - - -11. Custom Request Elements - -11.1 Modify method and headers - - Doing fancy stuff, you may need to add or change elements of a single curl - request. - - For example, you can change the POST request to a PROPFIND and send the data - as "Content-Type: text/xml" (instead of the default Content-Type) like this: - - curl --data "" --header "Content-Type: text/xml" \ - --request PROPFIND url.com - - You can delete a default header by providing one without content. Like you - can ruin the request by chopping off the Host: header: - - curl --header "Host:" http://www.example.com - - You can add headers the same way. Your server may want a "Destination:" - header, and you can add it: - - curl --header "Destination: http://nowhere" http://example.com - - 11.2 More on changed methods - - It should be noted that curl selects which methods to use on its own - depending on what action to ask for. -d will do POST, -I will do HEAD and so - on. If you use the --request / -X option you can change the method keyword - curl selects, but you will not modify curl's behavior. This means that if you - for example use -d "data" to do a POST, you can modify the method to a - PROPFIND with -X and curl will still think it sends a POST. You can change - the normal GET to a POST method by simply adding -X POST in a command line - like: - - curl -X POST http://example.org/ - - ... but curl will still think and act as if it sent a GET so it won't send any - request body etc. - - -12. Web Login - - 12.1 Some login tricks - - While not strictly just HTTP related, it still causes a lot of people problems - so here's the executive run-down of how the vast majority of all login forms - work and how to login to them using curl. - - It can also be noted that to do this properly in an automated fashion, you - will most certainly need to script things and do multiple curl invokes etc. - - First, servers mostly use cookies to track the logged-in status of the - client, so you will need to capture the cookies you receive in the - responses. Then, many sites also set a special cookie on the login page (to - make sure you got there through their login page) so you should make a habit - of first getting the login-form page to capture the cookies set there. - - Some web-based login systems feature various amounts of javascript, and - sometimes they use such code to set or modify cookie contents. Possibly they - do that to prevent programmed logins, like this manual describes how to... - Anyway, if reading the code isn't enough to let you repeat the behavior - manually, capturing the HTTP requests done by your browsers and analyzing the - sent cookies is usually a working method to work out how to shortcut the - javascript need. - - In the actual
tag for the login, lots of sites fill-in random/session - or otherwise secretly generated hidden tags and you may need to first capture - the HTML code for the login form and extract all the hidden fields to be able - to do a proper login POST. Remember that the contents need to be URL encoded - when sent in a normal POST. - -13. Debug - - 13.1 Some debug tricks - - Many times when you run curl on a site, you'll notice that the site doesn't - seem to respond the same way to your curl requests as it does to your - browser's. - - Then you need to start making your curl requests more similar to your - browser's requests: - - * Use the --trace-ascii option to store fully detailed logs of the requests - for easier analyzing and better understanding - - * Make sure you check for and use cookies when needed (both reading with - --cookie and writing with --cookie-jar) - - * Set user-agent to one like a recent popular browser does - - * Set referer like it is set by the browser - - * If you use POST, make sure you send all the fields and in the same order as - the browser does it. - - A very good helper to make sure you do this right, is the LiveHTTPHeader tool - that lets you view all headers you send and receive with Mozilla/Firefox - (even when using HTTPS). Chrome features similar functionality out of the box - among the developer's tools. - - A more raw approach is to capture the HTTP traffic on the network with tools - such as ethereal or tcpdump and check what headers that were sent and - received by the browser. (HTTPS makes this technique inefficient.) - -14. References - - 14.1 Standards - - RFC 7230 is a must to read if you want in-depth understanding of the HTTP - protocol - - RFC 3986 explains the URL syntax - - RFC 1867 defines the HTTP post upload format - - RFC 6525 defines how HTTP cookies work - - 14.2 Sites - - https://curl.haxx.se is the home of the curl project diff --git a/curl/docs/TheArtOfHttpScripting.md b/curl/docs/TheArtOfHttpScripting.md new file mode 100644 index 00000000..a6eb8b35 --- /dev/null +++ b/curl/docs/TheArtOfHttpScripting.md @@ -0,0 +1,700 @@ +# The Art Of Scripting HTTP Requests Using Curl + +## Background + + This document assumes that you're familiar with HTML and general networking. + + The increasing amount of applications moving to the web has made "HTTP + Scripting" more frequently requested and wanted. To be able to automatically + extract information from the web, to fake users, to post or upload data to + web servers are all important tasks today. + + Curl is a command line tool for doing all sorts of URL manipulations and + transfers, but this particular document will focus on how to use it when + doing HTTP requests for fun and profit. I will assume that you know how to + invoke `curl --help` or `curl --manual` to get basic information about it. + + Curl is not written to do everything for you. It makes the requests, it gets + the data, it sends data and it retrieves the information. You probably need + to glue everything together using some kind of script language or repeated + manual invokes. + +## The HTTP Protocol + + HTTP is the protocol used to fetch data from web servers. It is a very simple + protocol that is built upon TCP/IP. The protocol also allows information to + get sent to the server from the client using a few different methods, as will + be shown here. + + HTTP is plain ASCII text lines being sent by the client to a server to + request a particular action, and then the server replies a few text lines + before the actual requested content is sent to the client. + + The client, curl, sends a HTTP request. The request contains a method (like + GET, POST, HEAD etc), a number of request headers and sometimes a request + body. The HTTP server responds with a status line (indicating if things went + well), response headers and most often also a response body. The "body" part + is the plain data you requested, like the actual HTML or the image etc. + +## See the Protocol + + Using curl's option [`--verbose`](https://curl.se/docs/manpage.html#-v) + (`-v` as a short option) will display what kind of commands curl sends to the + server, as well as a few other informational texts. + + `--verbose` is the single most useful option when it comes to debug or even + understand the curl<->server interaction. + + Sometimes even `--verbose` is not enough. Then + [`--trace`](https://curl.se/docs/manpage.html#-trace) and + [`--trace-ascii`](https://curl.se/docs/manpage.html#--trace-ascii) + offer even more details as they show **everything** curl sends and + receives. Use it like this: + + curl --trace-ascii debugdump.txt http://www.example.com/ + +## See the Timing + + Many times you may wonder what exactly is taking all the time, or you just + want to know the amount of milliseconds between two points in a transfer. For + those, and other similar situations, the + [`--trace-time`](https://curl.se/docs/manpage.html#--trace-time) option + is what you need. It'll prepend the time to each trace output line: + + curl --trace-ascii d.txt --trace-time http://example.com/ + +## See the Response + + By default curl sends the response to stdout. You need to redirect it + somewhere to avoid that, most often that is done with ` -o` or `-O`. + +# URL + +## Spec + + The Uniform Resource Locator format is how you specify the address of a + particular resource on the Internet. You know these, you've seen URLs like + https://curl.se or https://yourbank.com a million times. RFC 3986 is the + canonical spec. And yeah, the formal name is not URL, it is URI. + +## Host + + The host name is usually resolved using DNS or your /etc/hosts file to an IP + address and that's what curl will communicate with. Alternatively you specify + the IP address directly in the URL instead of a name. + + For development and other trying out situations, you can point to a different + IP address for a host name than what would otherwise be used, by using curl's + [`--resolve`](https://curl.se/docs/manpage.html#--resolve) option: + + curl --resolve www.example.org:80:127.0.0.1 http://www.example.org/ + +## Port number + + Each protocol curl supports operates on a default port number, be it over TCP + or in some cases UDP. Normally you don't have to take that into + consideration, but at times you run test servers on other ports or + similar. Then you can specify the port number in the URL with a colon and a + number immediately following the host name. Like when doing HTTP to port + 1234: + + curl http://www.example.org:1234/ + + The port number you specify in the URL is the number that the server uses to + offer its services. Sometimes you may use a proxy, and then you may + need to specify that proxy's port number separately from what curl needs to + connect to the server. Like when using a HTTP proxy on port 4321: + + curl --proxy http://proxy.example.org:4321 http://remote.example.org/ + +## User name and password + + Some services are setup to require HTTP authentication and then you need to + provide name and password which is then transferred to the remote site in + various ways depending on the exact authentication protocol used. + + You can opt to either insert the user and password in the URL or you can + provide them separately: + + curl http://user:password@example.org/ + + or + + curl -u user:password http://example.org/ + + You need to pay attention that this kind of HTTP authentication is not what + is usually done and requested by user-oriented websites these days. They tend + to use forms and cookies instead. + +## Path part + + The path part is just sent off to the server to request that it sends back + the associated response. The path is what is to the right side of the slash + that follows the host name and possibly port number. + +# Fetch a page + +## GET + + The simplest and most common request/operation made using HTTP is to GET a + URL. The URL could itself refer to a web page, an image or a file. The client + issues a GET request to the server and receives the document it asked for. + If you issue the command line + + curl https://curl.se + + you get a web page returned in your terminal window. The entire HTML document + that that URL holds. + + All HTTP replies contain a set of response headers that are normally hidden, + use curl's [`--include`](https://curl.se/docs/manpage.html#-i) (`-i`) + option to display them as well as the rest of the document. + +## HEAD + + You can ask the remote server for ONLY the headers by using the + [`--head`](https://curl.se/docs/manpage.html#-I) (`-I`) option which + will make curl issue a HEAD request. In some special cases servers deny the + HEAD method while others still work, which is a particular kind of annoyance. + + The HEAD method is defined and made so that the server returns the headers + exactly the way it would do for a GET, but without a body. It means that you + may see a `Content-Length:` in the response headers, but there must not be an + actual body in the HEAD response. + +## Multiple URLs in a single command line + + A single curl command line may involve one or many URLs. The most common case + is probably to just use one, but you can specify any amount of URLs. Yes + any. No limits. You'll then get requests repeated over and over for all the + given URLs. + + Example, send two GETs: + + curl http://url1.example.com http://url2.example.com + + If you use [`--data`](https://curl.se/docs/manpage.html#-d) to POST to + the URL, using multiple URLs means that you send that same POST to all the + given URLs. + + Example, send two POSTs: + + curl --data name=curl http://url1.example.com http://url2.example.com + + +## Multiple HTTP methods in a single command line + + Sometimes you need to operate on several URLs in a single command line and do + different HTTP methods on each. For this, you'll enjoy the + [`--next`](https://curl.se/docs/manpage.html#-:) option. It is basically + a separator that separates a bunch of options from the next. All the URLs + before `--next` will get the same method and will get all the POST data + merged into one. + + When curl reaches the `--next` on the command line, it'll sort of reset the + method and the POST data and allow a new set. + + Perhaps this is best shown with a few examples. To send first a HEAD and then + a GET: + + curl -I http://example.com --next http://example.com + + To first send a POST and then a GET: + + curl -d score=10 http://example.com/post.cgi --next http://example.com/results.html + +# HTML forms + +## Forms explained + + Forms are the general way a website can present a HTML page with fields for + the user to enter data in, and then press some kind of 'OK' or 'Submit' + button to get that data sent to the server. The server then typically uses + the posted data to decide how to act. Like using the entered words to search + in a database, or to add the info in a bug tracking system, display the + entered address on a map or using the info as a login-prompt verifying that + the user is allowed to see what it is about to see. + + Of course there has to be some kind of program on the server end to receive + the data you send. You cannot just invent something out of the air. + +## GET + + A GET-form uses the method GET, as specified in HTML like: + +```html + + + +
+``` + + In your favorite browser, this form will appear with a text box to fill in + and a press-button labeled "OK". If you fill in '1905' and press the OK + button, your browser will then create a new URL to get for you. The URL will + get `junk.cgi?birthyear=1905&press=OK` appended to the path part of the + previous URL. + + If the original form was seen on the page `www.example.com/when/birth.html`, + the second page you'll get will become + `www.example.com/when/junk.cgi?birthyear=1905&press=OK`. + + Most search engines work this way. + + To make curl do the GET form post for you, just enter the expected created + URL: + + curl "http://www.example.com/when/junk.cgi?birthyear=1905&press=OK" + +## POST + + The GET method makes all input field names get displayed in the URL field of + your browser. That's generally a good thing when you want to be able to + bookmark that page with your given data, but it is an obvious disadvantage if + you entered secret information in one of the fields or if there are a large + amount of fields creating a very long and unreadable URL. + + The HTTP protocol then offers the POST method. This way the client sends the + data separated from the URL and thus you won't see any of it in the URL + address field. + + The form would look very similar to the previous one: + +```html +
+ + +
+``` + + And to use curl to post this form with the same data filled in as before, we + could do it like: + + curl --data "birthyear=1905&press=%20OK%20" http://www.example.com/when.cgi + + This kind of POST will use the Content-Type + `application/x-www-form-urlencoded` and is the most widely used POST kind. + + The data you send to the server MUST already be properly encoded, curl will + not do that for you. For example, if you want the data to contain a space, + you need to replace that space with `%20`, etc. Failing to comply with this will + most likely cause your data to be received wrongly and messed up. + + Recent curl versions can in fact url-encode POST data for you, like this: + + curl --data-urlencode "name=I am Daniel" http://www.example.com + + If you repeat `--data` several times on the command line, curl will + concatenate all the given data pieces - and put a `&` symbol between each + data segment. + +## File Upload POST + + Back in late 1995 they defined an additional way to post data over HTTP. It + is documented in the RFC 1867, why this method sometimes is referred to as + RFC1867-posting. + + This method is mainly designed to better support file uploads. A form that + allows a user to upload a file could be written like this in HTML: + +```html +
+ + +
+``` + + This clearly shows that the Content-Type about to be sent is + `multipart/form-data`. + + To post to a form like this with curl, you enter a command line like: + + curl --form upload=@localfilename --form press=OK [URL] + +## Hidden Fields + + A very common way for HTML based applications to pass state information + between pages is to add hidden fields to the forms. Hidden fields are already + filled in, they aren't displayed to the user and they get passed along just + as all the other fields. + + A similar example form with one visible field, one hidden field and one + submit button could look like: + +```html +
+ + + +
+``` + + To POST this with curl, you won't have to think about if the fields are + hidden or not. To curl they're all the same: + + curl --data "birthyear=1905&press=OK&person=daniel" [URL] + +## Figure Out What A POST Looks Like + + When you're about fill in a form and send to a server by using curl instead + of a browser, you're of course very interested in sending a POST exactly the + way your browser does. + + An easy way to get to see this, is to save the HTML page with the form on + your local disk, modify the 'method' to a GET, and press the submit button + (you could also change the action URL if you want to). + + You will then clearly see the data get appended to the URL, separated with a + `?`-letter as GET forms are supposed to. + +# HTTP upload + +## PUT + + Perhaps the best way to upload data to a HTTP server is to use PUT. Then + again, this of course requires that someone put a program or script on the + server end that knows how to receive a HTTP PUT stream. + + Put a file to a HTTP server with curl: + + curl --upload-file uploadfile http://www.example.com/receive.cgi + +# HTTP Authentication + +## Basic Authentication + + HTTP Authentication is the ability to tell the server your username and + password so that it can verify that you're allowed to do the request you're + doing. The Basic authentication used in HTTP (which is the type curl uses by + default) is **plain text** based, which means it sends username and password + only slightly obfuscated, but still fully readable by anyone that sniffs on + the network between you and the remote server. + + To tell curl to use a user and password for authentication: + + curl --user name:password http://www.example.com + +## Other Authentication + + The site might require a different authentication method (check the headers + returned by the server), and then + [`--ntlm`](https://curl.se/docs/manpage.html#--ntlm), + [`--digest`](https://curl.se/docs/manpage.html#--digest), + [`--negotiate`](https://curl.se/docs/manpage.html#--negotiate) or even + [`--anyauth`](https://curl.se/docs/manpage.html#--anyauth) might be + options that suit you. + +## Proxy Authentication + + Sometimes your HTTP access is only available through the use of a HTTP + proxy. This seems to be especially common at various companies. A HTTP proxy + may require its own user and password to allow the client to get through to + the Internet. To specify those with curl, run something like: + + curl --proxy-user proxyuser:proxypassword curl.se + + If your proxy requires the authentication to be done using the NTLM method, + use [`--proxy-ntlm`](https://curl.se/docs/manpage.html#--proxy-ntlm), if + it requires Digest use + [`--proxy-digest`](https://curl.se/docs/manpage.html#--proxy-digest). + + If you use any one of these user+password options but leave out the password + part, curl will prompt for the password interactively. + +## Hiding credentials + + Do note that when a program is run, its parameters might be possible to see + when listing the running processes of the system. Thus, other users may be + able to watch your passwords if you pass them as plain command line + options. There are ways to circumvent this. + + It is worth noting that while this is how HTTP Authentication works, very + many websites will not use this concept when they provide logins etc. See the + Web Login chapter further below for more details on that. + +# More HTTP Headers + +## Referer + + A HTTP request may include a 'referer' field (yes it is misspelled), which + can be used to tell from which URL the client got to this particular + resource. Some programs/scripts check the referer field of requests to verify + that this wasn't arriving from an external site or an unknown page. While + this is a stupid way to check something so easily forged, many scripts still + do it. Using curl, you can put anything you want in the referer-field and + thus more easily be able to fool the server into serving your request. + + Use curl to set the referer field with: + + curl --referer http://www.example.come http://www.example.com + +## User Agent + + Very similar to the referer field, all HTTP requests may set the User-Agent + field. It names what user agent (client) that is being used. Many + applications use this information to decide how to display pages. Silly web + programmers try to make different pages for users of different browsers to + make them look the best possible for their particular browsers. They usually + also do different kinds of javascript, vbscript etc. + + At times, you will see that getting a page with curl will not return the same + page that you see when getting the page with your browser. Then you know it + is time to set the User Agent field to fool the server into thinking you're + one of those browsers. + + To make curl look like Internet Explorer 5 on a Windows 2000 box: + + curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL] + + Or why not look like you're using Netscape 4.73 on an old Linux box: + + curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL] + +## Redirects + +## Location header + + When a resource is requested from a server, the reply from the server may + include a hint about where the browser should go next to find this page, or a + new page keeping newly generated output. The header that tells the browser to + redirect is `Location:`. + + Curl does not follow `Location:` headers by default, but will simply display + such pages in the same manner it displays all HTTP replies. It does however + feature an option that will make it attempt to follow the `Location:` + pointers. + + To tell curl to follow a Location: + + curl --location http://www.example.com + + If you use curl to POST to a site that immediately redirects you to another + page, you can safely use + [`--location`](https://curl.se/docs/manpage.html#-L) (`-L`) and + `--data`/`--form` together. curl will only use POST in the first request, and + then revert to GET in the following operations. + +## Other redirects + + Browser typically support at least two other ways of redirects that curl + doesn't: first the html may contain a meta refresh tag that asks the browser + to load a specific URL after a set number of seconds, or it may use + javascript to do it. + +# Cookies + +## Cookie Basics + + The way the web browsers do "client side state control" is by using + cookies. Cookies are just names with associated contents. The cookies are + sent to the client by the server. The server tells the client for what path + and host name it wants the cookie sent back, and it also sends an expiration + date and a few more properties. + + When a client communicates with a server with a name and path as previously + specified in a received cookie, the client sends back the cookies and their + contents to the server, unless of course they are expired. + + Many applications and servers use this method to connect a series of requests + into a single logical session. To be able to use curl in such occasions, we + must be able to record and send back cookies the way the web application + expects them. The same way browsers deal with them. + +## Cookie options + + The simplest way to send a few cookies to the server when getting a page with + curl is to add them on the command line like: + + curl --cookie "name=Daniel" http://www.example.com + + Cookies are sent as common HTTP headers. This is practical as it allows curl + to record cookies simply by recording headers. Record cookies with curl by + using the [`--dump-header`](https://curl.se/docs/manpage.html#-D) (`-D`) + option like: + + curl --dump-header headers_and_cookies http://www.example.com + + (Take note that the + [`--cookie-jar`](https://curl.se/docs/manpage.html#-c) option described + below is a better way to store cookies.) + + Curl has a full blown cookie parsing engine built-in that comes in use if you + want to reconnect to a server and use cookies that were stored from a + previous connection (or hand-crafted manually to fool the server into + believing you had a previous connection). To use previously stored cookies, + you run curl like: + + curl --cookie stored_cookies_in_file http://www.example.com + + Curl's "cookie engine" gets enabled when you use the + [`--cookie`](https://curl.se/docs/manpage.html#-b) option. If you only + want curl to understand received cookies, use `--cookie` with a file that + doesn't exist. Example, if you want to let curl understand cookies from a + page and follow a location (and thus possibly send back cookies it received), + you can invoke it like: + + curl --cookie nada --location http://www.example.com + + Curl has the ability to read and write cookie files that use the same file + format that Netscape and Mozilla once used. It is a convenient way to share + cookies between scripts or invokes. The `--cookie` (`-b`) switch + automatically detects if a given file is such a cookie file and parses it, + and by using the `--cookie-jar` (`-c`) option you'll make curl write a new + cookie file at the end of an operation: + + curl --cookie cookies.txt --cookie-jar newcookies.txt \ + http://www.example.com + +# HTTPS + +## HTTPS is HTTP secure + + There are a few ways to do secure HTTP transfers. By far the most common + protocol for doing this is what is generally known as HTTPS, HTTP over + SSL. SSL encrypts all the data that is sent and received over the network and + thus makes it harder for attackers to spy on sensitive information. + + SSL (or TLS as the latest version of the standard is called) offers a + truckload of advanced features to allow all those encryptions and key + infrastructure mechanisms encrypted HTTP requires. + + Curl supports encrypted fetches when built to use a TLS library and it can be + built to use one out of a fairly large set of libraries - `curl -V` will show + which one your curl was built to use (if any!). To get a page from a HTTPS + server, simply run curl like: + + curl https://secure.example.com + +## Certificates + + In the HTTPS world, you use certificates to validate that you are the one + you claim to be, as an addition to normal passwords. Curl supports client- + side certificates. All certificates are locked with a pass phrase, which you + need to enter before the certificate can be used by curl. The pass phrase + can be specified on the command line or if not, entered interactively when + curl queries for it. Use a certificate with curl on a HTTPS server like: + + curl --cert mycert.pem https://secure.example.com + + curl also tries to verify that the server is who it claims to be, by + verifying the server's certificate against a locally stored CA cert + bundle. Failing the verification will cause curl to deny the connection. You + must then use [`--insecure`](https://curl.se/docs/manpage.html#-k) + (`-k`) in case you want to tell curl to ignore that the server can't be + verified. + + More about server certificate verification and ca cert bundles can be read in + the [SSLCERTS document](https://curl.se/docs/sslcerts.html). + + At times you may end up with your own CA cert store and then you can tell + curl to use that to verify the server's certificate: + + curl --cacert ca-bundle.pem https://example.com/ + +# Custom Request Elements + +## Modify method and headers + + Doing fancy stuff, you may need to add or change elements of a single curl + request. + + For example, you can change the POST request to a PROPFIND and send the data + as `Content-Type: text/xml` (instead of the default Content-Type) like this: + + curl --data "" --header "Content-Type: text/xml" \ + --request PROPFIND example.com + + You can delete a default header by providing one without content. Like you + can ruin the request by chopping off the Host: header: + + curl --header "Host:" http://www.example.com + + You can add headers the same way. Your server may want a `Destination:` + header, and you can add it: + + curl --header "Destination: http://nowhere" http://example.com + +## More on changed methods + + It should be noted that curl selects which methods to use on its own + depending on what action to ask for. `-d` will do POST, `-I` will do HEAD and + so on. If you use the + [`--request`](https://curl.se/docs/manpage.html#-X) / `-X` option you + can change the method keyword curl selects, but you will not modify curl's + behavior. This means that if you for example use -d "data" to do a POST, you + can modify the method to a `PROPFIND` with `-X` and curl will still think it + sends a POST . You can change the normal GET to a POST method by simply + adding `-X POST` in a command line like: + + curl -X POST http://example.org/ + + ... but curl will still think and act as if it sent a GET so it won't send + any request body etc. + +# Web Login + +## Some login tricks + + While not strictly just HTTP related, it still causes a lot of people + problems so here's the executive run-down of how the vast majority of all + login forms work and how to login to them using curl. + + It can also be noted that to do this properly in an automated fashion, you + will most certainly need to script things and do multiple curl invokes etc. + + First, servers mostly use cookies to track the logged-in status of the + client, so you will need to capture the cookies you receive in the + responses. Then, many sites also set a special cookie on the login page (to + make sure you got there through their login page) so you should make a habit + of first getting the login-form page to capture the cookies set there. + + Some web-based login systems feature various amounts of javascript, and + sometimes they use such code to set or modify cookie contents. Possibly they + do that to prevent programmed logins, like this manual describes how to... + Anyway, if reading the code isn't enough to let you repeat the behavior + manually, capturing the HTTP requests done by your browsers and analyzing the + sent cookies is usually a working method to work out how to shortcut the + javascript need. + + In the actual `
` tag for the login, lots of sites fill-in + random/session or otherwise secretly generated hidden tags and you may need + to first capture the HTML code for the login form and extract all the hidden + fields to be able to do a proper login POST. Remember that the contents need + to be URL encoded when sent in a normal POST. + +# Debug + +## Some debug tricks + + Many times when you run curl on a site, you'll notice that the site doesn't + seem to respond the same way to your curl requests as it does to your + browser's. + + Then you need to start making your curl requests more similar to your + browser's requests: + + - Use the `--trace-ascii` option to store fully detailed logs of the requests + for easier analyzing and better understanding + + - Make sure you check for and use cookies when needed (both reading with + `--cookie` and writing with `--cookie-jar`) + + - Set user-agent (with [`-A`](https://curl.se/docs/manpage.html#-A)) to + one like a recent popular browser does + + - Set referer (with [`-E`](https://curl.se/docs/manpage.html#-E)) like + it is set by the browser + + - If you use POST, make sure you send all the fields and in the same order as + the browser does it. + +## Check what the browsers do + + A very good helper to make sure you do this right, is the web browsers' + developers tools that let you view all headers you send and receive (even + when using HTTPS). + + A more raw approach is to capture the HTTP traffic on the network with tools + such as Wireshark or tcpdump and check what headers that were sent and + received by the browser. (HTTPS forces you to use `SSLKEYLOGFILE` to do + that.) diff --git a/curl/docs/URL-SYNTAX.md b/curl/docs/URL-SYNTAX.md new file mode 100644 index 00000000..a97eb0d9 --- /dev/null +++ b/curl/docs/URL-SYNTAX.md @@ -0,0 +1,366 @@ +# URL syntax and their use in curl + +## Specifications + +The official "URL syntax" is primarily defined in these two different +specifications: + + - [RFC 3986](https://tools.ietf.org/html/rfc3986) (although URL is called "URI" in there) + - [The WHATWG URL Specification](https://url.spec.whatwg.org/) + +RFC 3986 is the earlier one, and curl has always tried to adhere to that one +(since it shipped in January 2005). + +The WHATWG URL spec was written later, is incompatible with the RFC 3986 and +changes over time. + +## Variations + +URL parsers as implemented in browsers, libraries and tools usually opt to +support one of the mentioned specifications. Bugs, differences in +interpretations and the moving nature of the WHATWG spec does however make it +very unlikely that multiple parsers treat URLs the exact same way! + +## Security + +Due to the inherent differences between URL parser implementations, it is +considered a security risk to mix different implementations and assume the +same behavior! + +For example, if you use one parser to check if a URL uses a good host name or +the correct auth field, and then pass on that same URL to a *second* parser, +there will always be a risk it treats the same URL differently. There is no +right and wrong in URL land, only differences of opinions. + +libcurl offers a separate API to its URL parser for this reason, among others. + +Applications may at times find it convenient to allow users to specify URLs +for various purposes and that string would then end up fed to curl. Getting a +URL from an external untrusted party and using it with curl brings several +security concerns: + +1. If you have an application that runs as or in a server application, getting + an unfiltered URL can trick your application to access a local resource + instead of a remote resource. Protecting yourself against localhost accesses is very + hard when accepting user provided URLs. + +2. Such custom URLs can access other ports than you planned as port numbers + are part of the regular URL format. The combination of a local host and a + custom port number can allow external users to play tricks with your local + services. + +3. Such a URL might use other schemes than you thought of or planned for. + +## "RFC3986 plus" + +curl recognizes a URL syntax that we call "RFC 3986 plus". It is grounded on +the well established RFC 3986 to make sure previously written command lines and +curl using scripts will remain working. + +curl's URL parser allows a few deviations from the spec in order to +inter-operate better with URLs that appear in the wild. + +### spaces + +In particular `Location:` headers that indicate to the client where a resource +has been redirected to, sometimes contain spaces. This is a violation of RFC +3986 but is fine in the WHATWG spec. curl handles these by re-encoding them to +`%20`. + +### non-ASCII + +Byte values in a provided URL that are outside of the printable ASCII range +are percent-encoded by curl. + +### multiple slashes + +An absolute URL always starts with a "scheme" followed by a colon. For all the +schemes curl supports, the colon must be followed by two slashes according to +RFC 3986 but not according to the WHATWG spec - which allows one to infinity +amount. + +curl allows one, two or three slashes after the colon to still be considered a +valid URL. + +### "scheme-less" + +curl supports "URLs" that do not start with a scheme. This is not supported by +any of the specifications. This is a shortcut to entering URLs that was +supported by browsers early on and has been mimicked by curl. + +Based on what the host name starts with, curl will "guess" what protocol to +use: + + - `ftp.` means FTP + - `dict.` means DICT + - `ldap.` means LDAP + - `imap.` means IMAP + - `smtp.` means SMTP + - `pop3.` means POP3 + - all other means HTTP + +### globbing letters + +The curl command line tool supports "globbing" of URLs. It means that you can +create ranges and lists using `[N-M]` and `{one,two,three}` sequences. The +letters used for this (`[]{}`) are reserved in RFC 3986 and can therefore not +legitimately be part of such a URL. + +They are however not reserved or special in the WHATWG specification, so +globbing can mess up such URLs. Globbing can be turned off for such occasions +(using `--globoff`). + +# URL syntax details + +A URL may consist of the following components - many of them are optional: + + [scheme][divider][userinfo][hostname][port number][path][query][fragment] + +Each component is separated from the following component with a divider +character or string. + +For example, this could look like: + + http://user:password@www.example.com:80/index.hmtl?foo=bar#top + +## Scheme + +The scheme specifies the protocol to use. A curl build can support a few or +many different schemes. You can limit what schemes curl should accept. + +curl supports the following schemes on URLs specified to transfer. They are +matched case insensitively: + +`dict`, `file`, `ftp`, `ftps`, `gopher`, `gophers`, `http`, `https`, `imap`, +`imaps`, `ldap`, `ldaps`, `mqtt`, `pop3`, `pop3s`, `rtmp`, `rtmpe`, `rtmps`, +`rtmpt`, `rtmpte`, `rtmpts`, `rtsp`, `smb`, `smbs`, `smtp`, `smtps`, `telnet`, +`tftp` + +When the URL is specified to identify a proxy, curl recognizes the following +schemes: + +`http`, `https`, `socks4`, `socks4a`, `socks5`, `socks5h`, `socks` + +## Userinfo + +The userinfo field can be used to set user name and password for +authentication purposes in this transfer. The use of this field is discouraged +since it often means passing around the password in plain text and is thus a +security risk. + +URLs for IMAP, POP3 and SMTP also support *login options* as part of the +userinfo field. They're provided as a semicolon after the password and then +the options. + +## Hostname + +The hostname part of the URL contains the address of the server that you want +to connect to. This can be the fully qualified domain name of the server, the +local network name of the machine on your network or the IP address of the +server or machine represented by either an IPv4 or IPv6 address (within +brackets). For example: + + http://www.example.com/ + + http://hostname/ + + http://192.168.0.1/ + + http://[2001:1890:1112:1::20]/ + +### "localhost" + +Starting in curl 7.77.0, curl will use loopback IP addresses for the name +`localhost`: `127.0.0.1` and `::1`. It will not try to resolve the name using +the resolver functions. + +This is done to make sure the host accessed is truly the localhost - the local +machine. + +### IDNA + +If curl was built with International Domain Name (IDN) support, it can also +handle host names using non-ASCII characters. + +When built with libidn2, curl uses the IDNA 2008 standard. This is equivalent +to the WHATWG URL spec, but differs from certain browsers that use IDNA 2003 +Transitional Processing. The two standards have a huge overlap but differ +slightly, perhaps most famously in how they deal with the German "double s" +(`ß`). + +When winidn is used, curl uses IDNA 2003 Transitional Processing, like the rest +of Windows. + +## Port number + +If there's a colon after the hostname, that should be followed by the port +number to use. 1 - 65535. curl also supports a blank port number field - but +only if the URL starts with a scheme. + +If the port number is not specified in the URL, curl will used a default port +based on the provide scheme: + +DICT 2628, FTP 21, FTPS 990, GOPHER 70, GOPHERS 70, HTTP 80, HTTPS 443, +IMAP 132, IMAPS 993, LDAP 369, LDAPS 636, MQTT 1883, POP3 110, POP3S 995, +RTMP 1935, RTMPS 443, RTMPT 80, RTSP 554, SCP 22, SFTP 22, SMB 445, SMBS 445, +SMTP 25, SMTPS 465, TELNET 23, TFTP 69 + +# Scheme specific behaviors + +## FTP + +The path part of an FTP request specifies the file to retrieve and from which +directory. If the file part is omitted then libcurl downloads the directory +listing for the directory specified. If the directory is omitted then the +directory listing for the root / home directory will be returned. + +FTP servers typically put the user in its "home directory" after login, which +then differs between users. To explicitly specify the root directory of an FTP +server start the path with double slash `//` or `/%2f` (2F is the hexadecimal +value of the ascii code for the slash). + +## FILE + +When a `FILE://` URL is accessed on Windows systems, it can be crafted in a +way so that Windows attempts to connect to a (remote) machine when curl wants +to read or write such a path. + +curl only allows the hostname part of a FILE URL to be one out of these three +alternatives: `localhost`, `127.0.0.1` or blank ("", zero characters). +Anything else will make curl fail to parse the URL. + +### Windows-specific FILE details + +curl accepts that the FILE URL's path starts with a "drive letter". That's a +single letter `a` to `z` followed by a colon or a pipe character (`|`). + +The Windows operating system itself will convert some file accesses to perform +network accesses over SMB/CIFS, through several different file path patterns. +This way, a `file://` URL passed to curl *might* be converted into a network +access inadvertently and unknowingly to curl. This is a Windows feature curl +cannot control or disable. + +## IMAP + +The path part of an IMAP request not only specifies the mailbox to list or +select, but can also be used to check the `UIDVALIDITY` of the mailbox, to +specify the `UID`, `SECTION` and `PARTIAL` octets of the message to fetch and +to specify what messages to search for. + +A top level folder list: + + imap://user:password@mail.example.com + +A folder list on the user's inbox: + + imap://user:password@mail.example.com/INBOX + +Select the user's inbox and fetch message with uid = 1: + + imap://user:password@mail.example.com/INBOX/;UID=1 + +Select the user's inbox and fetch the first message in the mail box: + + imap://user:password@mail.example.com/INBOX/;MAILINDEX=1 + +Select the user's inbox, check the `UIDVALIDITY` of the mailbox is 50 and +fetch message 2 if it is: + + imap://user:password@mail.example.com/INBOX;UIDVALIDITY=50/;UID=2 + +Select the user's inbox and fetch the text portion of message 3: + + imap://user:password@mail.example.com/INBOX/;UID=3/;SECTION=TEXT + +Select the user's inbox and fetch the first 1024 octets of message 4: + + imap://user:password@mail.example.com/INBOX/;UID=4/;PARTIAL=0.1024 + +Select the user's inbox and check for NEW messages: + + imap://user:password@mail.example.com/INBOX?NEW + +Select the user's inbox and search for messages containing "shadows" in the +subject line: + + imap://user:password@mail.example.com/INBOX?SUBJECT%20shadows + +For more information about the individual components of an IMAP URL please see +RFC 5092. + +## LDAP + +The path part of a LDAP request can be used to specify the: Distinguished +Name, Attributes, Scope, Filter and Extension for a LDAP search. Each field is +separated by a question mark and when that field is not required an empty +string with the question mark separator should be included. + +Search for the DN as `My Organisation`: + + ldap://ldap.example.com/o=My%20Organisation + +the same search but will only return postalAddress attributes: + + ldap://ldap.example.com/o=My%20Organisation?postalAddress + +Search for an empty DN and request information about the +`rootDomainNamingContext` attribute for an Active Directory server: + + ldap://ldap.example.com/?rootDomainNamingContext + +For more information about the individual components of a LDAP URL please +see [RFC 4516](https://tools.ietf.org/html/rfc4516). + +## POP3 + +The path part of a POP3 request specifies the message ID to retrieve. If the +ID is not specified then a list of waiting messages is returned instead. + +## SCP + +The path part of an SCP URL specifies the path and file to retrieve or +upload. The file is taken as an absolute path from the root directory on the +server. + +To specify a path relative to the user's home directory on the server, prepend +`~/` to the path portion. + +## SFTP + +The path part of an SFTP URL specifies the file to retrieve or upload. If the +path ends with a slash (`/`) then a directory listing is returned instead of a +file. If the path is omitted entirely then the directory listing for the root +/ home directory will be returned. + +## SMB +The path part of a SMB request specifies the file to retrieve and from what +share and directory or the share to upload to and as such, may not be omitted. +If the user name is embedded in the URL then it must contain the domain name +and as such, the backslash must be URL encoded as %2f. + +curl supports SMB version 1 (only) + +## SMTP + +The path part of a SMTP request specifies the host name to present during +communication with the mail server. If the path is omitted, then libcurl will +attempt to resolve the local computer's host name. However, this may not +return the fully qualified domain name that is required by some mail servers +and specifying this path allows you to set an alternative name, such as your +machine's fully qualified domain name, which you might have obtained from an +external function such as gethostname or getaddrinfo. + +The default smtp port is 25. Some servers use port 587 as an alternative. + +## RTMP + +There's no official URL spec for RTMP so libcurl uses the URL syntax supported +by the underlying librtmp library. It has a syntax where it wants a +traditional URL, followed by a space and a series of space-separated +`name=value` pairs. + +While space is not typically a "legal" letter, libcurl accepts them. When a +user wants to pass in a `#` (hash) character it will be treated as a fragment +and get cut off by libcurl if provided literally. You will instead have to +escape it by providing it as backslash and its ASCII value in hexadecimal: +`\23`. diff --git a/curl/docs/VERSIONS b/curl/docs/VERSIONS.md similarity index 80% rename from curl/docs/VERSIONS rename to curl/docs/VERSIONS.md index 72a45474..bcc7474d 100644 --- a/curl/docs/VERSIONS +++ b/curl/docs/VERSIONS.md @@ -2,7 +2,7 @@ Version Numbers and Releases ============================ Curl is not only curl. Curl is also libcurl. They're actually individually - versioned, but they mostly follow each other rather closely. + versioned, but they usually follow each other closely. The version numbering is always built up using the same system: @@ -15,22 +15,21 @@ Version Numbers and Releases ## Bumping numbers One of these numbers will get bumped in each new release. The numbers to the - right of a bumped number will be reset to zero. If Z is zero, it may not be - included in the version number. + right of a bumped number will be reset to zero. The main version number will get bumped when *really* big, world colliding changes are made. The release number is bumped when changes are performed or things/features are added. The patch number is bumped when the changes are mere bugfixes. - It means that after release 1.2.3, we can release 2.0 if something really big - has been made, 1.3 if not that big changes were made or 1.2.4 if mostly bugs - were fixed. + It means that after release 1.2.3, we can release 2.0.0 if something really + big has been made, 1.3.0 if not that big changes were made or 1.2.4 if only + bugs were fixed. Bumping, as in increasing the number with 1, is unconditionally only affecting one of the numbers (except the ones to the right of it, that may be set to zero). 1 becomes 2, 3 becomes 4, 9 becomes 10, 88 becomes 89 and 99 - becomes 100. So, after 1.2.9 comes 1.2.10. After 3.99.3, 3.100 might come. + becomes 100. So, after 1.2.9 comes 1.2.10. After 3.99.3, 3.100.0 might come. All original curl source release archives are named according to the libcurl version (not according to the curl client version that, as said before, might @@ -42,7 +41,9 @@ Version Numbers and Releases numbering scheme that can be used for comparison. The version number is defined as: - #define LIBCURL_VERSION_NUM 0xXXYYZZ +```c +#define LIBCURL_VERSION_NUM 0xXXYYZZ +``` Where XX, YY and ZZ are the main version, release and patch numbers in hexadecimal. All three number fields are always represented using two digits diff --git a/curl/docs/cmdline-opts/CMakeLists.txt b/curl/docs/cmdline-opts/CMakeLists.txt index 5aa20dfd..ae25c5c4 100644 --- a/curl/docs/cmdline-opts/CMakeLists.txt +++ b/curl/docs/cmdline-opts/CMakeLists.txt @@ -1,4 +1,25 @@ -set(MANPAGE "${CMAKE_BINARY_DIR}/docs/curl.1") +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +set(MANPAGE "${CURL_BINARY_DIR}/docs/curl.1") # Load DPAGES and OTHERPAGES from shared file transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") diff --git a/curl/docs/cmdline-opts/MANPAGE.md b/curl/docs/cmdline-opts/MANPAGE.md index 3a8270b0..f7f09eb1 100644 --- a/curl/docs/cmdline-opts/MANPAGE.md +++ b/curl/docs/cmdline-opts/MANPAGE.md @@ -3,7 +3,8 @@ This is the curl man page generator. It generates a single nroff man page output from the set of sources files in this directory. -There is one source file for each supported command line option. The format is +There is one source file for each supported command line option. The output +gets `page-header` prepended and `page-footer` appended. The format is described below. ## Option files @@ -27,18 +28,24 @@ Each file has a set of meta-data and a body of text. Requires: (space separated list of features this requires, no dashes) See-also: (space separated list of related options, no dashes) Help: (short text for the --help output for this option) + Example: (example command line, without "curl" and can use `$URL`) --- (end of meta-data) ### Body The body of the description. Only refer to options with their long form option -version, like --verbose. The output generator will replace such with the +version, like `--verbose`. The output generator will replace such with the correct markup that shows both short and long version. -## Header +Text written within `*asterisks*` will get shown using italics. Text within +two `**asterisks**` will get shown using bold. -`page-header` is the nroff formatted file that will be output before the -generated options output for the master man page. +## Header and footer + +`page-header` is the file that will be output before the generated options +output for the master man page. + +`page-footer` is appended after all the individual options. ## Generate diff --git a/curl/docs/cmdline-opts/Makefile.am b/curl/docs/cmdline-opts/Makefile.am index e6ecf7a6..f416d553 100644 --- a/curl/docs/cmdline-opts/Makefile.am +++ b/curl/docs/cmdline-opts/Makefile.am @@ -5,11 +5,11 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. +# are also available at https://curl.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is @@ -31,4 +31,5 @@ EXTRA_DIST = $(DPAGES) MANPAGE.md gen.pl $(OTHERPAGES) CMakeLists.txt all: $(MANPAGE) $(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc - @PERL@ $(srcdir)/gen.pl mainpage $(srcdir) > $(MANPAGE) + @echo "generate $(MANPAGE)" + @(cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES)) > $(MANPAGE) diff --git a/curl/docs/cmdline-opts/Makefile.in b/curl/docs/cmdline-opts/Makefile.in deleted file mode 100644 index 75c897b7..00000000 --- a/curl/docs/cmdline-opts/Makefile.in +++ /dev/null @@ -1,616 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# Shared between Makefile.am and CMakeLists.txt -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = docs/cmdline-opts -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ - $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/xc-am-iface.m4 \ - $(top_srcdir)/m4/xc-cc-check.m4 \ - $(top_srcdir)/m4/xc-lt-iface.m4 \ - $(top_srcdir)/m4/xc-translit.m4 \ - $(top_srcdir)/m4/xc-val-flgs.m4 \ - $(top_srcdir)/m4/zz40-xc-ovr.m4 \ - $(top_srcdir)/m4/zz50-xc-ovr.m4 \ - $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMB = @CURL_DISABLE_SMB@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ -CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@ -CYGPATH_W = @CYGPATH_W@ -DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -ENABLE_STATIC = @ENABLE_STATIC@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ -LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ -LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NROFF = @NROFF@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SSL_ENABLED = @SSL_ENABLED@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_DARWINSSL = @USE_DARWINSSL@ -USE_GNUTLS = @USE_GNUTLS@ -USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_MBEDTLS = @USE_MBEDTLS@ -USE_NGHTTP2 = @USE_NGHTTP2@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SCHANNEL = @USE_SCHANNEL@ -USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONNUM = @VERSIONNUM@ -ZLIB_LIBS = @ZLIB_LIBS@ -ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign no-dependencies -MANPAGE = $(top_builddir)/docs/curl.1 -DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d cacert.d capath.d cert.d \ - cert-status.d cert-type.d ciphers.d compressed.d compressed-ssh.d \ - config.d \ - connect-timeout.d connect-to.d continue-at.d cookie.d cookie-jar.d \ - create-dirs.d crlf.d crlfile.d data-ascii.d data-binary.d data.d \ - data-raw.d data-urlencode.d delegation.d digest.d disable.d \ - disable-eprt.d disable-epsv.d dns-interface.d dns-ipv4-addr.d \ - dns-ipv6-addr.d dns-servers.d dump-header.d egd-file.d engine.d \ - expect100-timeout.d fail.d fail-early.d false-start.d \ - form.d form-string.d ftp-account.d ftp-alternative-to-user.d \ - ftp-create-dirs.d ftp-method.d ftp-pasv.d ftp-port.d ftp-pret.d \ - ftp-skip-pasv-ip.d ftp-ssl-ccc.d ftp-ssl-ccc-mode.d ftp-ssl-control.d \ - get.d globoff.d head.d header.d help.d hostpubmd5.d http1.0.d \ - http1.1.d http2.d http2-prior-knowledge.d ignore-content-length.d \ - include.d insecure.d interface.d ipv4.d ipv6.d junk-session-cookies.d \ - keepalive-time.d key.d key-type.d krb.d libcurl.d limit-rate.d \ - list-only.d local-port.d location.d location-trusted.d \ - login-options.d mail-auth.d mail-from.d mail-rcpt.d manual.d \ - max-filesize.d max-redirs.d max-time.d metalink.d negotiate.d netrc.d \ - netrc-file.d netrc-optional.d next.d no-alpn.d no-buffer.d \ - no-keepalive.d no-npn.d noproxy.d no-sessionid.d ntlm.d ntlm-wb.d \ - oauth2-bearer.d output.d pass.d path-as-is.d pinnedpubkey.d post301.d \ - post302.d post303.d preproxy.d progress-bar.d proto.d proto-default.d \ - proto-redir.d proxy1.0.d proxy-anyauth.d proxy-basic.d proxy-cacert.d \ - proxy-capath.d proxy-cert.d proxy-cert-type.d proxy-ciphers.d \ - proxy-crlfile.d proxy.d proxy-digest.d proxy-header.d \ - proxy-insecure.d proxy-key.d proxy-key-type.d proxy-negotiate.d \ - proxy-ntlm.d proxy-pass.d proxy-service-name.d \ - proxy-ssl-allow-beast.d proxy-tlsauthtype.d proxy-tlspassword.d \ - proxy-tlsuser.d proxy-tlsv1.d proxytunnel.d proxy-user.d pubkey.d \ - quote.d random-file.d range.d raw.d referer.d remote-header-name.d \ - remote-name-all.d remote-name.d remote-time.d request.d resolve.d \ - retry-connrefused.d retry.d retry-delay.d retry-max-time.d sasl-ir.d \ - service-name.d show-error.d silent.d socks4a.d socks4.d socks5.d \ - socks5-basic.d socks5-gssapi.d \ - socks5-gssapi-nec.d socks5-gssapi-service.d socks5-hostname.d \ - speed-limit.d speed-time.d ssl-allow-beast.d ssl.d ssl-no-revoke.d \ - ssl-reqd.d sslv2.d sslv3.d stderr.d suppress-connect-headers.d \ - tcp-fastopen.d tcp-nodelay.d \ - telnet-option.d tftp-blksize.d tftp-no-options.d time-cond.d \ - tls-max.d \ - tlsauthtype.d tlspassword.d tlsuser.d tlsv1.0.d tlsv1.1.d tlsv1.2.d \ - tlsv1.3.d tlsv1.d trace-ascii.d trace.d trace-time.d tr-encoding.d \ - unix-socket.d upload-file.d url.d use-ascii.d user-agent.d user.d \ - verbose.d version.d write-out.d xattr.d request-target.d - -OTHERPAGES = page-footer page-header -EXTRA_DIST = $(DPAGES) MANPAGE.md gen.pl $(OTHERPAGES) CMakeLists.txt -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/cmdline-opts/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign docs/cmdline-opts/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(srcdir)/Makefile.inc $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -all: $(MANPAGE) - -$(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc - @PERL@ $(srcdir)/gen.pl mainpage $(srcdir) > $(MANPAGE) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/curl/docs/cmdline-opts/Makefile.inc b/curl/docs/cmdline-opts/Makefile.inc index e8f46410..6e04552e 100644 --- a/curl/docs/cmdline-opts/Makefile.inc +++ b/curl/docs/cmdline-opts/Makefile.inc @@ -1,49 +1,268 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # Shared between Makefile.am and CMakeLists.txt -DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d cacert.d capath.d cert.d \ - cert-status.d cert-type.d ciphers.d compressed.d compressed-ssh.d \ - config.d \ - connect-timeout.d connect-to.d continue-at.d cookie.d cookie-jar.d \ - create-dirs.d crlf.d crlfile.d data-ascii.d data-binary.d data.d \ - data-raw.d data-urlencode.d delegation.d digest.d disable.d \ - disable-eprt.d disable-epsv.d dns-interface.d dns-ipv4-addr.d \ - dns-ipv6-addr.d dns-servers.d dump-header.d egd-file.d engine.d \ - expect100-timeout.d fail.d fail-early.d false-start.d \ - form.d form-string.d ftp-account.d ftp-alternative-to-user.d \ - ftp-create-dirs.d ftp-method.d ftp-pasv.d ftp-port.d ftp-pret.d \ - ftp-skip-pasv-ip.d ftp-ssl-ccc.d ftp-ssl-ccc-mode.d ftp-ssl-control.d \ - get.d globoff.d head.d header.d help.d hostpubmd5.d http1.0.d \ - http1.1.d http2.d http2-prior-knowledge.d ignore-content-length.d \ - include.d insecure.d interface.d ipv4.d ipv6.d junk-session-cookies.d \ - keepalive-time.d key.d key-type.d krb.d libcurl.d limit-rate.d \ - list-only.d local-port.d location.d location-trusted.d \ - login-options.d mail-auth.d mail-from.d mail-rcpt.d manual.d \ - max-filesize.d max-redirs.d max-time.d metalink.d negotiate.d netrc.d \ - netrc-file.d netrc-optional.d next.d no-alpn.d no-buffer.d \ - no-keepalive.d no-npn.d noproxy.d no-sessionid.d ntlm.d ntlm-wb.d \ - oauth2-bearer.d output.d pass.d path-as-is.d pinnedpubkey.d post301.d \ - post302.d post303.d preproxy.d progress-bar.d proto.d proto-default.d \ - proto-redir.d proxy1.0.d proxy-anyauth.d proxy-basic.d proxy-cacert.d \ - proxy-capath.d proxy-cert.d proxy-cert-type.d proxy-ciphers.d \ - proxy-crlfile.d proxy.d proxy-digest.d proxy-header.d \ - proxy-insecure.d proxy-key.d proxy-key-type.d proxy-negotiate.d \ - proxy-ntlm.d proxy-pass.d proxy-service-name.d \ - proxy-ssl-allow-beast.d proxy-tlsauthtype.d proxy-tlspassword.d \ - proxy-tlsuser.d proxy-tlsv1.d proxytunnel.d proxy-user.d pubkey.d \ - quote.d random-file.d range.d raw.d referer.d remote-header-name.d \ - remote-name-all.d remote-name.d remote-time.d request.d resolve.d \ - retry-connrefused.d retry.d retry-delay.d retry-max-time.d sasl-ir.d \ - service-name.d show-error.d silent.d socks4a.d socks4.d socks5.d \ - socks5-basic.d socks5-gssapi.d \ - socks5-gssapi-nec.d socks5-gssapi-service.d socks5-hostname.d \ - speed-limit.d speed-time.d ssl-allow-beast.d ssl.d ssl-no-revoke.d \ - ssl-reqd.d sslv2.d sslv3.d stderr.d suppress-connect-headers.d \ - tcp-fastopen.d tcp-nodelay.d \ - telnet-option.d tftp-blksize.d tftp-no-options.d time-cond.d \ - tls-max.d \ - tlsauthtype.d tlspassword.d tlsuser.d tlsv1.0.d tlsv1.1.d tlsv1.2.d \ - tlsv1.3.d tlsv1.d trace-ascii.d trace.d trace-time.d tr-encoding.d \ - unix-socket.d upload-file.d url.d use-ascii.d user-agent.d user.d \ - verbose.d version.d write-out.d xattr.d request-target.d +DPAGES = \ + abstract-unix-socket.d \ + alt-svc.d \ + anyauth.d \ + append.d \ + aws-sigv4.d \ + basic.d \ + cacert.d \ + capath.d \ + cert-status.d \ + cert-type.d \ + cert.d \ + ciphers.d \ + compressed-ssh.d \ + compressed.d \ + config.d \ + connect-timeout.d \ + connect-to.d \ + continue-at.d \ + cookie-jar.d \ + cookie.d \ + create-dirs.d \ + create-file-mode.d \ + crlf.d \ + crlfile.d \ + curves.d \ + data-ascii.d \ + data-binary.d \ + data-raw.d \ + data-urlencode.d \ + data.d \ + delegation.d \ + digest.d \ + disable-eprt.d \ + disable-epsv.d \ + disable.d \ + disallow-username-in-url.d \ + dns-interface.d \ + dns-ipv4-addr.d \ + dns-ipv6-addr.d \ + dns-servers.d \ + doh-cert-status.d \ + doh-insecure.d \ + doh-url.d \ + dump-header.d \ + egd-file.d \ + engine.d \ + etag-compare.d \ + etag-save.d \ + expect100-timeout.d \ + fail-early.d \ + fail-with-body.d \ + fail.d \ + false-start.d \ + form-string.d \ + form.d \ + ftp-account.d \ + ftp-alternative-to-user.d \ + ftp-create-dirs.d \ + ftp-method.d \ + ftp-pasv.d \ + ftp-port.d \ + ftp-pret.d \ + ftp-skip-pasv-ip.d \ + ftp-ssl-ccc-mode.d \ + ftp-ssl-ccc.d \ + ftp-ssl-control.d \ + get.d \ + globoff.d \ + happy-eyeballs-timeout-ms.d \ + haproxy-protocol.d \ + head.d \ + header.d \ + help.d \ + hostpubmd5.d \ + hsts.d \ + http0.9.d \ + http1.0.d \ + http1.1.d \ + http2-prior-knowledge.d \ + http2.d \ + http3.d \ + ignore-content-length.d \ + include.d \ + insecure.d \ + interface.d \ + ipv4.d \ + ipv6.d \ + junk-session-cookies.d \ + keepalive-time.d \ + key-type.d \ + key.d \ + krb.d \ + libcurl.d \ + limit-rate.d \ + list-only.d \ + local-port.d \ + location-trusted.d \ + location.d \ + login-options.d \ + mail-auth.d \ + mail-from.d \ + mail-rcpt-allowfails.d \ + mail-rcpt.d \ + manual.d \ + max-filesize.d \ + max-redirs.d \ + max-time.d \ + metalink.d \ + negotiate.d \ + netrc-file.d \ + netrc-optional.d \ + netrc.d \ + next.d \ + no-alpn.d \ + no-buffer.d \ + no-keepalive.d \ + no-npn.d \ + no-progress-meter.d \ + no-sessionid.d \ + noproxy.d \ + ntlm-wb.d \ + ntlm.d \ + oauth2-bearer.d \ + output-dir.d \ + output.d \ + parallel-immediate.d \ + parallel-max.d \ + parallel.d \ + pass.d \ + path-as-is.d \ + pinnedpubkey.d \ + post301.d \ + post302.d \ + post303.d \ + preproxy.d \ + progress-bar.d \ + proto-default.d \ + proto-redir.d \ + proto.d \ + proxy-anyauth.d \ + proxy-basic.d \ + proxy-cacert.d \ + proxy-capath.d \ + proxy-cert-type.d \ + proxy-cert.d \ + proxy-ciphers.d \ + proxy-crlfile.d \ + proxy-digest.d \ + proxy-header.d \ + proxy-insecure.d \ + proxy-key-type.d \ + proxy-key.d \ + proxy-negotiate.d \ + proxy-ntlm.d \ + proxy-pass.d \ + proxy-pinnedpubkey.d \ + proxy-service-name.d \ + proxy-ssl-allow-beast.d \ + proxy-ssl-auto-client-cert.d \ + proxy-tls13-ciphers.d \ + proxy-tlsauthtype.d \ + proxy-tlspassword.d \ + proxy-tlsuser.d \ + proxy-tlsv1.d \ + proxy-user.d \ + proxy.d \ + proxy1.0.d \ + proxytunnel.d \ + pubkey.d \ + quote.d \ + random-file.d \ + range.d \ + raw.d \ + referer.d \ + remote-header-name.d \ + remote-name-all.d \ + remote-name.d \ + remote-time.d \ + request-target.d \ + request.d \ + resolve.d \ + retry-all-errors.d \ + retry-connrefused.d \ + retry-delay.d \ + retry-max-time.d \ + retry.d \ + sasl-authzid.d \ + sasl-ir.d \ + service-name.d \ + show-error.d \ + silent.d \ + socks4.d \ + socks4a.d \ + socks5-basic.d \ + socks5-gssapi-nec.d \ + socks5-gssapi-service.d \ + socks5-gssapi.d \ + socks5-hostname.d \ + socks5.d \ + speed-limit.d \ + speed-time.d \ + ssl-allow-beast.d \ + ssl-auto-client-cert.d \ + ssl-no-revoke.d \ + ssl-reqd.d \ + ssl-revoke-best-effort.d \ + ssl.d \ + sslv2.d \ + sslv3.d \ + stderr.d \ + styled-output.d \ + suppress-connect-headers.d \ + tcp-fastopen.d \ + tcp-nodelay.d \ + telnet-option.d \ + tftp-blksize.d \ + tftp-no-options.d \ + time-cond.d \ + tls-max.d \ + tls13-ciphers.d \ + tlsauthtype.d \ + tlspassword.d \ + tlsuser.d \ + tlsv1.0.d \ + tlsv1.1.d \ + tlsv1.2.d \ + tlsv1.3.d \ + tlsv1.d \ + tr-encoding.d \ + trace-ascii.d \ + trace-time.d \ + trace.d \ + unix-socket.d \ + upload-file.d \ + url.d \ + use-ascii.d \ + user-agent.d \ + user.d \ + verbose.d \ + version.d \ + write-out.d \ + xattr.d OTHERPAGES = page-footer page-header diff --git a/curl/docs/cmdline-opts/gen.pl b/curl/docs/cmdline-opts/gen.pl index 73ea6d47..c058987d 100644 --- a/curl/docs/cmdline-opts/gen.pl +++ b/curl/docs/cmdline-opts/gen.pl @@ -1,10 +1,31 @@ -#!/usr/bin/perl +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### =begin comment This script generates the manpage. -Example: gen.pl mainpage > curl.1 +Example: gen.pl [files] > curl.1 Dev notes: @@ -16,18 +37,13 @@ =end comment =cut -my $some_dir=$ARGV[1] || "."; - -opendir(my $dh, $some_dir) || die "Can't opendir $some_dir: $!"; -my @s = grep { /\.d$/ && -f "$some_dir/$_" } readdir($dh); -closedir $dh; - my %optshort; my %optlong; my %helplong; my %arglong; my %redirlong; my %protolong; +my %catlong; # get the long name version, return the man page string sub manpageify { @@ -47,6 +63,12 @@ sub manpageify { sub printdesc { my @desc = @_; for my $d (@desc) { + if($d !~ /^.\\"/) { + # **bold** + $d =~ s/\*\*([^ ]*)\*\*/\\fB$1\\fP/g; + # *italics* + $d =~ s/\*([^ ]*)\*/\\fI$1\\fP/g; + } # skip lines starting with space (examples) if($d =~ /^[^ ]/) { for my $k (keys %optlong) { @@ -54,6 +76,9 @@ sub printdesc { $d =~ s/--$k([^a-z0-9_-])/$l$1/; } } + # quote "bare" minuses in the output + $d =~ s/( |\\fI|^)--/$1\\-\\-/g; + $d =~ s/([ -]|\\fI|^)-/$1\\-/g; print $d; } } @@ -101,7 +126,7 @@ sub added { sub single { my ($f, $standalone)=@_; - open(F, "<:crlf", "$some_dir/$f") || + open(F, "<:crlf", "$f") || return 1; my $short; my $long; @@ -111,9 +136,13 @@ sub single { my $arg; my $mutexed; my $requires; + my $category; my $seealso; + my @examples; # there can be more than one my $magic; # cmdline special option + my $line; while() { + $line++; if(/^Short: *(.)/i) { $short=$1; } @@ -144,12 +173,27 @@ sub single { elsif(/^Requires: *(.*)/i) { $requires=$1; } + elsif(/^Category: *(.*)/i) { + $category=$1; + } + elsif(/^Example: *(.*)/i) { + push @examples, $1; + } elsif(/^Help: *(.*)/i) { ; } elsif(/^---/) { if(!$long) { - print STDERR "WARN: no 'Long:' in $f\n"; + print STDERR "ERROR: no 'Long:' in $f\n"; + exit 1; + } + if(!$category) { + print STDERR "ERROR: no 'Category:' in $f\n"; + exit 2; + } + if(!$examples[0]) { + print STDERR "$f:$line:1:ERROR: no 'Example:' present\n"; + exit 2; } last; } @@ -158,7 +202,7 @@ sub single { print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';" } } - my @dest; + my @desc; while() { push @desc, $_; } @@ -178,6 +222,9 @@ sub single { $opt .= " $arg"; } + # quote "bare" minuses in opt + $opt =~ s/( |^)--/$1\\-\\-/g; + $opt =~ s/( |^)-/$1\\-/g; if($standalone) { print ".TH curl 1 \"30 Nov 2016\" \"curl 7.52.0\" \"curl manual\"\n"; print ".SH OPTION\n"; @@ -201,9 +248,24 @@ sub single { if($seealso) { my @m=split(/ /, $seealso); my $mstr; + my $and = 0; + my $num = scalar(@m); + if($num > 2) { + # use commas up to this point + $and = $num - 1; + } + my $i = 0; for my $k (@m) { + if(!$helplong{$k}) { + print STDERR "WARN: $f see-alsos a non-existing option: $k\n"; + } my $l = manpageify($k); - $mstr .= sprintf "%s$l", $mstr?" and ":""; + my $sep = " and"; + if($and && ($i < $and)) { + $sep = ","; + } + $mstr .= sprintf "%s$l", $mstr?"$sep ":""; + $i++; } push @foot, seealso($standalone, $mstr); } @@ -216,11 +278,24 @@ sub single { my @m=split(/ /, $mutexed); my $mstr; for my $k (@m) { + if(!$helplong{$k}) { + print STDERR "WARN: $f mutexes a non-existing option: $k\n"; + } my $l = manpageify($k); $mstr .= sprintf "%s$l", $mstr?" and ":""; } push @foot, overrides($standalone, "This option overrides $mstr. "); } + if($examples[0]) { + my $s =""; + $s="s" if($examples[1]); + print "\nExample$s:\n.nf\n"; + foreach my $e (@examples) { + $e =~ s!\$URL!https://example.com!g; + print " curl $e\n"; + } + print ".fi\n"; + } if($added) { push @foot, added($standalone, $added); } @@ -235,12 +310,13 @@ sub single { sub getshortlong { my ($f)=@_; - open(F, "<:crlf", "$some_dir/$f"); + open(F, "<:crlf", "$f"); my $short; my $long; my $help; my $arg; my $protocols; + my $category; while() { if(/^Short: (.)/i) { $short=$1; @@ -257,6 +333,9 @@ sub getshortlong { elsif(/^Protocols: (.*)/i) { $protocols=$1; } + elsif(/^Category: (.*)/i) { + $category=$1; + } elsif(/^---/) { last; } @@ -270,18 +349,20 @@ sub getshortlong { $helplong{$long}=$help; $arglong{$long}=$arg; $protolong{$long}=$protocols; + $catlong{$long}=$category; } } sub indexoptions { - foreach my $f (@s) { - getshortlong($f); - } + my (@files) = @_; + foreach my $f (@files) { + getshortlong($f); + } } sub header { my ($f)=@_; - open(F, "<:crlf", "$some_dir/$f"); + open(F, "<:crlf", "$f"); my @d; while() { push @d, $_; @@ -294,6 +375,8 @@ sub listhelp { foreach my $f (sort keys %helplong) { my $long = $f; my $short = $optlong{$long}; + my @categories = split ' ', $catlong{$long}; + my $bitmask; my $opt; if(defined($short) && $long) { @@ -302,7 +385,13 @@ sub listhelp { elsif($long && !$short) { $opt = " --$long"; } - + for my $i (0 .. $#categories) { + $bitmask .= 'CURLHELP_' . uc $categories[$i]; + # If not last element, append | + if($i < $#categories) { + $bitmask .= ' | '; + } + } my $arg = $arglong{$long}; if($arg) { $opt .= " $arg"; @@ -310,22 +399,47 @@ sub listhelp { my $desc = $helplong{$f}; $desc =~ s/\"/\\\"/g; # escape double quotes - my $line = sprintf " {\"%s\",\n \"%s\"},\n", $opt, $desc; + my $line = sprintf " {\"%s\",\n \"%s\",\n %s},\n", $opt, $desc, $bitmask; - if(length($opt) + length($desc) > 78) { - print STDERR "WARN: the --$long line is too long\n"; + if(length($opt) > 78) { + print STDERR "WARN: the --$long name is too long\n"; + } + elsif(length($desc) > 78) { + print STDERR "WARN: the --$long description is too long\n"; } print $line; } } +sub listcats { + my %allcats; + foreach my $f (sort keys %helplong) { + my @categories = split ' ', $catlong{$f}; + foreach (@categories) { + $allcats{$_} = undef; + } + } + my @categories; + foreach my $key (keys %allcats) { + push @categories, $key; + } + @categories = sort @categories; + unshift @categories, 'hidden'; + for my $i (0..$#categories) { + print '#define ' . 'CURLHELP_' . uc($categories[$i]) . ' ' . "1u << " . $i . "u\n"; + } +} + sub mainpage { + my (@files) = @_; # show the page header header("page-header"); # output docs for all options - foreach my $f (sort @s) { - single($f, 0); + foreach my $f (sort @files) { + if(single($f, 0)) { + print STDERR "Can't read $f?\n"; + } } header("page-footer"); @@ -352,34 +466,37 @@ sub showprotocols { } sub getargs { - my $f; - do { - $f = shift @ARGV; - if($f eq "mainpage") { - mainpage(); - return; - } - elsif($f eq "listhelp") { - listhelp(); - return; - } - elsif($f eq "single") { - showonly(shift @ARGV); - return; - } - elsif($f eq "protos") { - showprotocols(); - return; - } - } while($f); + my ($f, @s) = @_; + if($f eq "mainpage") { + mainpage(@s); + return; + } + elsif($f eq "listhelp") { + listhelp(); + return; + } + elsif($f eq "single") { + showonly($s[0]); + return; + } + elsif($f eq "protos") { + showprotocols(); + return; + } + elsif($f eq "listcats") { + listcats(); + return; + } - print "Usage: gen.pl [srcdir]\n"; + print "Usage: gen.pl [files]\n"; } #------------------------------------------------------------------------ -# learn all existing options -indexoptions(); +my $cmd = shift @ARGV; +my @files = @ARGV; # the rest are the files -getargs(); +# learn all existing options +indexoptions(@files); +getargs($cmd, @files); diff --git a/curl/docs/cmdline-opts/page-footer b/curl/docs/cmdline-opts/page-footer index 55aefb23..c88cd5fa 100644 --- a/curl/docs/cmdline-opts/page-footer +++ b/curl/docs/cmdline-opts/page-footer @@ -17,22 +17,49 @@ Sets the proxy server to use for HTTPS. .IP "[url-protocol]_PROXY [protocol://][:port]" Sets the proxy server to use for [url-protocol], where the protocol is a protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP, -SMTP, LDAP etc. +SMTP, LDAP, etc. .IP "ALL_PROXY [protocol://][:port]" Sets the proxy server to use if no protocol-specific proxy is set. -.IP "NO_PROXY " -list of host names that shouldn't go through any proxy. If set to a asterisk -\&'*' only, it matches all hosts. +.IP "NO_PROXY " +list of host names that shouldn't go through any proxy. If set to an asterisk +\&'*' only, it matches all hosts. Each name in this list is matched as either +a domain name which contains the hostname, or the hostname itself. -Since 7.53.0, this environment variable disable the proxy even if specify ---proxy option. That is +This environment variable disables use of the proxy even when specified with +the --proxy option. That is .B NO_PROXY=direct.example.com curl -x http://proxy.example.com .B http://direct.example.com accesses the target URL directly, and .B NO_PROXY=direct.example.com curl -x http://proxy.example.com .B http://somewhere.example.com -accesses the target URL through proxy. +accesses the target URL through the proxy. +The list of host names can also be include numerical IP addresses, and IPv6 +versions should then be given without enclosing brackets. + +IPv6 numerical addresses are compared as strings, so they will only match if +the representations are the same: "::1" is the same as "::0:1" but they don't +match. +.IP "CURL_SSL_BACKEND " +If curl was built with support for "MultiSSL", meaning that it has built-in +support for more than one TLS backend, this environment variable can be set to +the case insensitive name of the particular backend to use when curl is +invoked. Setting a name that isn't a built-in alternative will make curl +stay with the default. + +SSL backend names (case-insensitive): bearssl, gnutls, gskit, mbedtls, +mesalink, nss, openssl, rustls, schannel, secure-transport, wolfssl +.IP "QLOGDIR " +If curl was built with HTTP/3 support, setting this environment variable to a +local directory will make curl produce qlogs in that directory, using file +names named after the destination connection id (in hex). Do note that these +files can become rather large. Works with both QUIC backends. +.IP "SSLKEYLOGFILE " +If you set this environment variable to a file name, curl will store TLS +secrets from its connections in that file when invoked to enable you to +analyze the TLS traffic in real time using network analyzing tools such as +Wireshark. This works with the following TLS backends: OpenSSL, libressl, +BoringSSL, GnuTLS, NSS and wolfSSL. .SH "PROXY PROTOCOL PREFIXES" Since curl version 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols. @@ -41,6 +68,10 @@ If no protocol is specified in the proxy string or if the string doesn't match a supported one, the proxy will be treated as an HTTP proxy. The supported proxy protocol prefixes are as follows: +.IP "http://" +Makes it use it as an HTTP proxy. The default if no scheme prefix is used. +.IP "https://" +Makes it treated as an **HTTPS** proxy. .IP "socks4://" Makes it the equivalent of --socks4 .IP "socks4a://" @@ -51,7 +82,7 @@ Makes it the equivalent of --socks5 Makes it the equivalent of --socks5-hostname .SH EXIT CODES There are a bunch of different error codes and their corresponding error -messages that may appear during bad conditions. At the time of this writing, +messages that may appear under error conditions. At the time of this writing, the exit codes are: .IP 1 Unsupported protocol. This build of curl has no support for this protocol. @@ -66,7 +97,7 @@ this, you probably need another build of libcurl! .IP 5 Couldn't resolve proxy. The given proxy host could not be resolved. .IP 6 -Couldn't resolve host. The given remote host was not resolved. +Couldn't resolve host. The given remote host could not be resolved. .IP 7 Failed to connect to host. .IP 8 @@ -206,7 +237,7 @@ Character conversion failed. .IP 76 Character conversion functions required. .IP 77 -Problem with reading the SSL CA cert (path? access rights?). +Problem reading the SSL CA cert (path? access rights?). .IP 78 The resource referenced in the URL does not exist. .IP 79 @@ -218,19 +249,33 @@ Could not load CRL file, missing or wrong format (added in 7.19.0). .IP 83 Issuer check failed (added in 7.19.0). .IP 84 -The FTP PRET command failed +The FTP PRET command failed. .IP 85 -RTSP: mismatch of CSeq numbers +Mismatch of RTSP CSeq numbers. .IP 86 -RTSP: mismatch of Session Identifiers +Mismatch of RTSP Session Identifiers. .IP 87 -unable to parse FTP file list +Unable to parse FTP file list. .IP 88 -FTP chunk callback reported error +FTP chunk callback reported error. .IP 89 -No connection available, the session will be queued +No connection available, the session will be queued. .IP 90 -SSL public key does not matched pinned public key +SSL public key does not matched pinned public key. +.IP 91 +Invalid SSL certificate status. +.IP 92 +Stream error in HTTP/2 framing layer. +.IP 93 +An API function was called from inside a callback. +.IP 94 +An authentication function returned an error. +.IP 95 +A problem was detected in the HTTP/3 layer. This is somewhat generic and can +be one out of several problems, see the error message for details. +.IP 96 +QUIC connection error. This error may be caused by an SSL library error. QUIC +is the protocol used for HTTP/3 transfers. .IP XX More error codes will appear here in future releases. The existing ones are meant to never change. @@ -238,7 +283,7 @@ are meant to never change. Daniel Stenberg is the main author, but the whole list of contributors is found in the separate THANKS file. .SH WWW -https://curl.haxx.se +https://curl.se .SH "SEE ALSO" .BR ftp (1), .BR wget (1) diff --git a/curl/docs/cmdline-opts/page-header b/curl/docs/cmdline-opts/page-header index ee5af147..65b503fb 100644 --- a/curl/docs/cmdline-opts/page-header +++ b/curl/docs/cmdline-opts/page-header @@ -5,11 +5,11 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * are also available at https://curl.se/docs/copyright.html. .\" * .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell .\" * copies of the Software, and permit persons to whom the Software is @@ -26,53 +26,53 @@ .SH NAME curl \- transfer a URL .SH SYNOPSIS -.B curl [options] -.I [URL...] +.B curl [options / URLs] .SH DESCRIPTION -.B curl -is a tool to transfer data from or to a server, using one of the supported -protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, -LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET -and TFTP). The command is designed to work without user interaction. +**curl** is a tool for transfering data from or to a server. It supports these +protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, +LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, +SMTPS, TELNET or TFTP. The command is designed to work without user +interaction. curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer -resume, Metalink, and more. As you will see below, the number of features will -make your head spin! +resume and more. As you will see below, the number of features will make your +head spin! curl is powered by libcurl for all transfer-related features. See -\fIlibcurl(3)\fP for details. +*libcurl(3)* for details. .SH URL The URL syntax is protocol-dependent. You'll find a detailed description in RFC 3986. You can specify multiple URLs or parts of URLs by writing part sets within -braces as in: +braces and quoting the URL as in: - http://site.{one,two,three}.com + "http://site.{one,two,three}.com" or you can get sequences of alphanumeric series by using [] as in: - ftp://ftp.example.com/file[1-100].txt + "ftp://ftp.example.com/file[1-100].txt" - ftp://ftp.example.com/file[001-100].txt (with leading zeros) + "ftp://ftp.example.com/file[001-100].txt" (with leading zeros) - ftp://ftp.example.com/file[a-z].txt + "ftp://ftp.example.com/file[a-z].txt" Nested sequences are not supported, but you can use several ones next to each other: - http://example.com/archive[1996-1999]/vol[1-4]/part{a,b,c}.html + "http://example.com/archive[1996-1999]/vol[1-4]/part{a,b,c}.html" You can specify any amount of URLs on the command line. They will be fetched -in a sequential manner in the specified order. +in a sequential manner in the specified order. You can specify command line +options and URLs mixed and in any order on the command line. You can specify a step counter for the ranges to get every Nth number or letter: - http://example.com/file[1-100:10].txt + "http://example.com/file[1-100:10].txt" - http://example.com/file[a-z:2].txt + "http://example.com/file[a-z:2].txt" When using [] or {} sequences when invoked from a command line prompt, you probably have to put the full URL within double quotes to avoid the shell from @@ -82,7 +82,7 @@ for example '&', '?' and '*'. Provide the IPv6 zone index in the URL with an escaped percentage sign and the interface name. Like in - http://[fe80::3%25eth0]/ + "http://[fe80::3%25eth0]/" If you specify URL without protocol:// prefix, curl will attempt to guess what protocol you might want. It will then default to HTTP but try other protocols @@ -91,13 +91,71 @@ with "ftp." curl will assume you want to speak FTP. curl will do its best to use what you pass to it as a URL. It is not trying to validate it as a syntactically correct URL by any means but is instead -\fBvery\fP liberal with what it accepts. +**very** liberal with what it accepts. curl will attempt to re-use connections for multiple file transfers, so that getting many files from the same server will not do multiple connects / handshakes. This improves speed. Of course this is only done on files specified on a single command line and cannot be used between separate curl -invokes. +invocations. +.SH OUTPUT +If not told otherwise, curl writes the received data to stdout. It can be +instructed to instead save that data into a local file, using the --output or +--remote-name options. If curl is given multiple URLs to transfer on the +command line, it similarly needs multiple options for where to save them. + +curl does not parse or otherwise "understand" the content it gets or writes as +output. It does no encoding or decoding, unless explicitly asked to with +dedicated command line options. +.SH PROTOCOLS +curl supports numerous protocols, or put in URL terms: schemes. Your +particular build may not support them all. +.IP DICT +Lets you lookup words using online dictionaries. +.IP FILE +Read or write local files. curl does not support accessing file:// URL +remotely, but when running on Microsoft Windows using the native UNC approach +will work. +.IP FTP(S) +curl supports the File Transfer Protocol with a lot of tweaks and levers. With +or without using TLS. +.IP GOPHER(S) +Retrieve files. +.IP HTTP(S) +curl supports HTTP with numerous options and variations. It can speak HTTP +version 0.9, 1.0, 1.1, 2 and 3 depending on build options and the correct +command line options. +.IP IMAP(S) +Using the mail reading protocol, curl can "download" emails for you. With or +without using TLS. +.IP LDAP(S) +curl can do directory lookups for you, with or without TLS. +.IP MQTT +curl supports MQTT version 3. Downloading over MQTT equals "subscribe" to a +topic while uploading/posting equals "publish" on a topic. MQTT over TLS is +not supported (yet). +.IP POP3(S) +Downloading from a pop3 server means getting a mail. With or without using +TLS. +.IP RTMP(S) +The Realtime Messaging Protocol is primarily used to server streaming media +and curl can download it. +.IP RTSP +curl supports RTSP 1.0 downloads. +.IP SCP +curl supports SSH version 2 scp transfers. +.IP SFTP +curl supports SFTP (draft 5) done over SSH version 2. +.IP SMB(S) +curl supports SMB version 1 for upload and download. +.IP SMTP(S) +Uploading contents to an SMTP server means sending an email. With or without +TLS. +.IP TELNET +Telling curl to fetch a telnet URL starts an interactive session where it +sends what it reads on stdin and outputs what the server sends it. +.IP TFTP +curl can do TFTP downloads and uploads. .SH "PROGRESS METER" curl normally displays a progress meter during operations, indicating the amount of transferred data, transfer speeds and estimated time left, etc. The @@ -107,15 +165,15 @@ bytes. 1M is 1048576 bytes. curl displays this data to the terminal by default, so if you invoke curl to do an operation and it is about to write data to the terminal, it -\fIdisables\fP the progress meter as otherwise it would mess up the output +*disables* the progress meter as otherwise it would mess up the output mixing progress meter and response data. If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (>), --output or similar. -It is not the same case for FTP upload as that operation does not spit out -any response data to the terminal. +This does not apply to FTP upload as that operation does not spit out any +response data to the terminal. If you prefer a progress "bar" instead of the regular meter, --progress-bar is your friend. You can also disable the progress meter completely with the @@ -133,9 +191,9 @@ Short version options that don't need any additional values can be used immediately next to each other, like for example you can specify all the options -O, -L and -v at once as -OLv. -In general, all boolean options are enabled with --\fBoption\fP and yet again -disabled with --\fBno-\fPoption. That is, you use the exact same option name +In general, all boolean options are enabled with --**option** and yet again +disabled with --**no-**option. That is, you use the exact same option name but prefix it with "no-". However, in this list we mostly only list and show the --option version of them. (This concept with --no options was added in -7.19.0. Previously most options were toggled on/off on repeated use of the -same command line option.) +7.19.0. Previously most options were toggled on/off through repeated use of +the same command line option.) diff --git a/curl/docs/curl-config.1 b/curl/docs/curl-config.1 index 389c6076..e7e1b6c1 100644 --- a/curl/docs/curl-config.1 +++ b/curl/docs/curl-config.1 @@ -5,11 +5,11 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * are also available at https://curl.se/docs/copyright.html. .\" * .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell .\" * copies of the Software, and permit persons to whom the Software is @@ -20,8 +20,7 @@ .\" * .\" ************************************************************************** .\" -.TH curl-config 1 "February 03, 2016" "Curl 7.56.1" "curl-config manual" - +.TH curl-config 1 "25 Oct 2007" "Curl 7.17.1" "curl-config manual" .SH NAME curl-config \- Get information about a libcurl installation .SH SYNOPSIS @@ -64,6 +63,10 @@ the time of writing, this list may include HTTP, HTTPS, FTP, FTPS, FILE, TELNET, LDAP, DICT. Do not assume any particular order. The protocols will be listed using uppercase and are separated by newlines. There may be none, one, or several protocols in the list. (Added in 7.13.0) +.IP "--ssl-backends" +Lists the SSL backends that were enabled when libcurl was built. It might be +no, one or several names. If more than one name, they will appear +comma-separated. (Added in 7.58.0) .IP "--static-libs" Shows the complete set of libs and other linker options you will need in order to link your application with libcurl statically. (Added in 7.17.1) @@ -71,8 +74,8 @@ to link your application with libcurl statically. (Added in 7.17.1) Outputs version information about the installed libcurl. .IP "--vernum" Outputs version information about the installed libcurl, in numerical mode. -This outputs the version number, in hexadecimal, with 8 bits for each part; -major, minor, patch. So that libcurl 7.7.4 would appear as 070704 and libcurl +This outputs the version number, in hexadecimal, with 8 bits for each part: +major, minor, and patch. So that libcurl 7.7.4 would appear as 070704 and libcurl 12.13.14 would appear as 0c0d0e... Note that the initial zero might be omitted. (This option was broken in the 7.15.0 release.) .SH "EXAMPLES" diff --git a/curl/docs/curl.1 b/curl/docs/curl.1 deleted file mode 100644 index ce4a41a2..00000000 --- a/curl/docs/curl.1 +++ /dev/null @@ -1,2862 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at https://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.\" DO NOT EDIT. Generated by the curl project gen.pl man page generator. -.\" -.TH curl 1 "November 16, 2016" "Curl 7.56.1" "Curl Manual" - -.SH NAME -curl \- transfer a URL -.SH SYNOPSIS -.B curl [options] -.I [URL...] -.SH DESCRIPTION -.B curl -is a tool to transfer data from or to a server, using one of the supported -protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, -LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET -and TFTP). The command is designed to work without user interaction. - -curl offers a busload of useful tricks like proxy support, user -authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer -resume, Metalink, and more. As you will see below, the number of features will -make your head spin! - -curl is powered by libcurl for all transfer-related features. See -\fIlibcurl(3)\fP for details. -.SH URL -The URL syntax is protocol-dependent. You'll find a detailed description in -RFC 3986. - -You can specify multiple URLs or parts of URLs by writing part sets within -braces as in: - - http://site.{one,two,three}.com - -or you can get sequences of alphanumeric series by using [] as in: - - ftp://ftp.example.com/file[1-100].txt - - ftp://ftp.example.com/file[001-100].txt (with leading zeros) - - ftp://ftp.example.com/file[a-z].txt - -Nested sequences are not supported, but you can use several ones next to each -other: - - http://example.com/archive[1996-1999]/vol[1-4]/part{a,b,c}.html - -You can specify any amount of URLs on the command line. They will be fetched -in a sequential manner in the specified order. - -You can specify a step counter for the ranges to get every Nth number or -letter: - - http://example.com/file[1-100:10].txt - - http://example.com/file[a-z:2].txt - -When using [] or {} sequences when invoked from a command line prompt, you -probably have to put the full URL within double quotes to avoid the shell from -interfering with it. This also goes for other characters treated special, like -for example '&', '?' and '*'. - -Provide the IPv6 zone index in the URL with an escaped percentage sign and the -interface name. Like in - - http://[fe80::3%25eth0]/ - -If you specify URL without protocol:// prefix, curl will attempt to guess what -protocol you might want. It will then default to HTTP but try other protocols -based on often-used host name prefixes. For example, for host names starting -with "ftp." curl will assume you want to speak FTP. - -curl will do its best to use what you pass to it as a URL. It is not trying to -validate it as a syntactically correct URL by any means but is instead -\fBvery\fP liberal with what it accepts. - -curl will attempt to re-use connections for multiple file transfers, so that -getting many files from the same server will not do multiple connects / -handshakes. This improves speed. Of course this is only done on files -specified on a single command line and cannot be used between separate curl -invokes. -.SH "PROGRESS METER" -curl normally displays a progress meter during operations, indicating the -amount of transferred data, transfer speeds and estimated time left, etc. The -progress meter displays number of bytes and the speeds are in bytes per -second. The suffixes (k, M, G, T, P) are 1024 based. For example 1k is 1024 -bytes. 1M is 1048576 bytes. - -curl displays this data to the terminal by default, so if you invoke curl to -do an operation and it is about to write data to the terminal, it -\fIdisables\fP the progress meter as otherwise it would mess up the output -mixing progress meter and response data. - -If you want a progress meter for HTTP POST or PUT requests, you need to -redirect the response output to a file, using shell redirect (>), \fI-o, --output\fP or -similar. - -It is not the same case for FTP upload as that operation does not spit out -any response data to the terminal. - -If you prefer a progress "bar" instead of the regular meter, \fI-#, --progress-bar\fP is -your friend. You can also disable the progress meter completely with the -\fI-s, --silent\fP option. -.SH OPTIONS -Options start with one or two dashes. Many of the options require an -additional value next to them. - -The short "single-dash" form of the options, -d for example, may be used with -or without a space between it and its value, although a space is a recommended -separator. The long "double-dash" form, \fI-d, --data\fP for example, requires a space -between it and its value. - -Short version options that don't need any additional values can be used -immediately next to each other, like for example you can specify all the -options -O, -L and -v at once as -OLv. - -In general, all boolean options are enabled with --\fBoption\fP and yet again -disabled with --\fBno-\fPoption. That is, you use the exact same option name -but prefix it with "no-". However, in this list we mostly only list and show -the --option version of them. (This concept with --no options was added in -7.19.0. Previously most options were toggled on/off on repeated use of the -same command line option.) -.IP "--abstract-unix-socket " -(HTTP) Connect through an abstract Unix domain socket, instead of using the network. -Note: netstat shows the path of an abstract socket prefixed with '@', however -the argument should not have this leading character. - -Added in 7.53.0. -.IP "--anyauth" -(HTTP) Tells curl to figure out authentication method by itself, and use the most -secure one the remote site claims to support. This is done by first doing a -request and checking the response-headers, thus possibly inducing an extra -network round-trip. This is used instead of setting a specific authentication -method, which you can do with \fI--basic\fP, \fI--digest\fP, \fI--ntlm\fP, and \fI--negotiate\fP. - -Using \fI--anyauth\fP is not recommended if you do uploads from stdin, since it may -require data to be sent twice and then the client must be able to rewind. If -the need should arise when uploading from stdin, the upload operation will -fail. - -Used together with \fI-u, --user\fP. - -See also \fI--proxy-anyauth\fP and \fI--basic\fP and \fI--digest\fP. -.IP "-a, --append" -(FTP SFTP) When used in an upload, this makes curl append to the target file instead of -overwriting it. If the remote file doesn't exist, it will be created. Note -that this flag is ignored by some SFTP servers (including OpenSSH). -.IP "--basic" -(HTTP) Tells curl to use HTTP Basic authentication with the remote host. This is the -default and this option is usually pointless, unless you use it to override a -previously set option that sets a different authentication method (such as -\fI--ntlm\fP, \fI--digest\fP, or \fI--negotiate\fP). - -Used together with \fI-u, --user\fP. - -See also \fI--proxy-basic\fP. -.IP "--cacert " -(TLS) Tells curl to use the specified certificate file to verify the peer. The file -may contain multiple CA certificates. The certificate(s) must be in PEM -format. Normally curl is built to use a default file for this, so this option -is typically used to alter that default file. - -curl recognizes the environment variable named 'CURL_CA_BUNDLE' if it is -set, and uses the given path as a path to a CA cert bundle. This option -overrides that variable. - -The windows version of curl will automatically look for a CA certs file named -\'curl-ca-bundle.crt\', either in the same directory as curl.exe, or in the -Current Working Directory, or in any folder along your PATH. - -If curl is built against the NSS SSL library, the NSS PEM PKCS#11 module -(libnsspem.so) needs to be available for this option to work properly. - -(iOS and macOS only) If curl is built against Secure Transport, then this -option is supported for backward compatibility with other SSL engines, but it -should not be set. If the option is not set, then curl will use the -certificates in the system and user Keychain to verify the peer, which is the -preferred method of verifying the peer's certificate chain. - -If this option is used several times, the last one will be used. -.IP "--capath " -(TLS) Tells curl to use the specified certificate directory to verify the -peer. Multiple paths can be provided by separating them with ":" (e.g. -\&"path1:path2:path3"). The certificates must be in PEM format, and if curl is -built against OpenSSL, the directory must have been processed using the -c_rehash utility supplied with OpenSSL. Using \fI--capath\fP can allow -OpenSSL-powered curl to make SSL-connections much more efficiently than using -\fI--cacert\fP if the --cacert file contains many CA certificates. - -If this option is set, the default capath value will be ignored, and if it is -used several times, the last one will be used. -.IP "--cert-status" -(TLS) Tells curl to verify the status of the server certificate by using the -Certificate Status Request (aka. OCSP stapling) TLS extension. - -If this option is enabled and the server sends an invalid (e.g. expired) -response, if the response suggests that the server certificate has been revoked, -or no response at all is received, the verification fails. - -This is currently only implemented in the OpenSSL, GnuTLS and NSS backends. - -Added in 7.41.0. -.IP "--cert-type " -(TLS) Tells curl what certificate type the provided certificate is in. PEM, DER and -ENG are recognized types. If not specified, PEM is assumed. - -If this option is used several times, the last one will be used. - -See also \fI-E, --cert\fP and \fI--key\fP and \fI--key-type\fP. -.IP "-E, --cert " -(TLS) Tells curl to use the specified client certificate file when getting a file -with HTTPS, FTPS or another SSL-based protocol. The certificate must be in -PKCS#12 format if using Secure Transport, or PEM format if using any other -engine. If the optional password isn't specified, it will be queried for on -the terminal. Note that this option assumes a \&"certificate" file that is the -private key and the client certificate concatenated! See \fI-E, --cert\fP and \fI--key\fP to -specify them independently. - -If curl is built against the NSS SSL library then this option can tell -curl the nickname of the certificate to use within the NSS database defined -by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the -NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be -loaded. If you want to use a file from the current directory, please precede -it with "./" prefix, in order to avoid confusion with a nickname. If the -nickname contains ":", it needs to be preceded by "\\" so that it is not -recognized as password delimiter. If the nickname contains "\\", it needs to -be escaped as "\\\\" so that it is not recognized as an escape character. - -(iOS and macOS only) If curl is built against Secure Transport, then the -certificate string can either be the name of a certificate/private key in the -system or user keychain, or the path to a PKCS#12-encoded certificate and -private key. If you want to use a file from the current directory, please -precede it with "./" prefix, in order to avoid confusion with a nickname. - -If this option is used several times, the last one will be used. - -See also \fI--cert-type\fP and \fI--key\fP and \fI--key-type\fP. -.IP "--ciphers " -(TLS) Specifies which ciphers to use in the connection. The list of ciphers must -specify valid ciphers. Read up on SSL cipher list details on this URL: - - https://curl.haxx.se/docs/ssl-ciphers.html - -If this option is used several times, the last one will be used. -.IP "--compressed-ssh" -(SCP SFTP) Enables built-in SSH compression. -This is a request, not an order; the server may or may not do it. - -Added in 7.56.0. -.IP "--compressed" -(HTTP) Request a compressed response using one of the algorithms curl supports, and -save the uncompressed document. If this option is used and the server sends -an unsupported encoding, curl will report an error. -.IP "-K, --config " - -Specify a text file to read curl arguments from. The command line arguments -found in the text file will be used as if they were provided on the command -line. - -Options and their parameters must be specified on the same line in the file, -separated by whitespace, colon, or the equals sign. Long option names can -optionally be given in the config file without the initial double dashes and -if so, the colon or equals characters can be used as separators. If the option -is specified with one or two dashes, there can be no colon or equals character -between the option and its parameter. - -If the parameter is to contain whitespace, the parameter must be enclosed -within quotes. Within double quotes, the following escape sequences are -available: \\\\, \\", \\t, \\n, \\r and \\v. A backslash preceding any other -letter is ignored. If the first column of a config line is a '#' character, -the rest of the line will be treated as a comment. Only write one option per -physical line in the config file. - -Specify the filename to \fI-K, --config\fP as '-' to make curl read the file from stdin. - -Note that to be able to specify a URL in the config file, you need to specify -it using the \fI--url\fP option, and not by simply writing the URL on its own -line. So, it could look similar to this: - -url = "https://curl.haxx.se/docs/" - -When curl is invoked, it (unless \fI-q, --disable\fP is used) checks for a default -config file and uses it if found. The default config file is checked for in -the following places in this order: - -1) curl tries to find the "home dir": It first checks for the CURL_HOME and -then the HOME environment variables. Failing that, it uses getpwuid() on -Unix-like systems (which returns the home dir given the current user in your -system). On Windows, it then checks for the APPDATA variable, or as a last -resort the '%USERPROFILE%\\Application Data'. - -2) On windows, if there is no _curlrc file in the home dir, it checks for one -in the same dir the curl executable is placed. On Unix-like systems, it will -simply try to load .curlrc from the determined home dir. - -.nf -# --- Example file --- -# this is a comment -url = "example.com" -output = "curlhere.html" -user-agent = "superagent/1.0" - -# and fetch another URL too -url = "example.com/docs/manpage.html" --O -referer = "http://nowhereatall.example.com/" -# --- End of example file --- -.fi - -This option can be used multiple times to load multiple config files. -.IP "--connect-timeout " -Maximum time in seconds that you allow curl's connection to take. This only -limits the connection phase, so if curl connects within the given period it -will continue - if not it will exit. Since version 7.32.0, this option -accepts decimal values. - -If this option is used several times, the last one will be used. - -See also \fI-m, --max-time\fP. -.IP "--connect-to " - -For a request to the given HOST1:PORT1 pair, connect to HOST2:PORT2 instead. -This option is suitable to direct requests at a specific server, e.g. at a -specific cluster node in a cluster of servers. This option is only used to -establish the network connection. It does NOT affect the hostname/port that is -used for TLS/SSL (e.g. SNI, certificate verification) or for the application -protocols. "HOST1" and "PORT1" may be the empty string, meaning "any -host/port". "HOST2" and "PORT2" may also be the empty string, meaning "use the -request's original host/port". - -A "host" specified to this option is compared as a string, so it needs to -match the name used in request URL. It can be either numerical such as -"127.0.0.1" or the full host name such as "example.org". - -This option can be used many times to add many connect rules. - -See also \fI--resolve\fP and \fI-H, --header\fP. Added in 7.49.0. -.IP "-C, --continue-at " -Continue/Resume a previous file transfer at the given offset. The given offset -is the exact number of bytes that will be skipped, counting from the beginning -of the source file before it is transferred to the destination. If used with -uploads, the FTP server command SIZE will not be used by curl. - -Use "-C -" to tell curl to automatically find out where/how to resume the -transfer. It then uses the given output/input files to figure that out. - -If this option is used several times, the last one will be used. - -See also \fI-r, --range\fP. -.IP "-c, --cookie-jar " -(HTTP) Specify to which file you want curl to write all cookies after a completed -operation. Curl writes all cookies from its in-memory cookie storage to the -given file at the end of operations. If no cookies are known, no data will be -written. The file will be written using the Netscape cookie file format. If -you set the file name to a single dash, "-", the cookies will be written to -stdout. - -This command line option will activate the cookie engine that makes curl -record and use cookies. Another way to activate it is to use the \fI-b, --cookie\fP -option. - -If the cookie jar can't be created or written to, the whole curl operation -won't fail or even report an error clearly. Using \fI-v, --verbose\fP will get a warning -displayed, but that is the only visible feedback you get about this possibly -lethal situation. - -If this option is used several times, the last specified file name will be -used. -.IP "-b, --cookie " -(HTTP) Pass the data to the HTTP server in the Cookie header. It is supposedly -the data previously received from the server in a "Set-Cookie:" line. The -data should be in the format "NAME1=VALUE1; NAME2=VALUE2". - -If no '=' symbol is used in the argument, it is instead treated as a filename -to read previously stored cookie from. This option also activates the cookie -engine which will make curl record incoming cookies, which may be handy if -you're using this in combination with the \fI-L, --location\fP option or do multiple URL -transfers on the same invoke. - -The file format of the file to read cookies from should be plain HTTP headers -(Set-Cookie style) or the Netscape/Mozilla cookie file format. - -The file specified with \fI-b, --cookie\fP is only used as input. No cookies will be -written to the file. To store cookies, use the \fI-c, --cookie-jar\fP option. - -Exercise caution if you are using this option and multiple transfers may -occur. If you use the NAME1=VALUE1; format, or in a file use the Set-Cookie -format and don't specify a domain, then the cookie is sent for any domain -(even after redirects are followed) and cannot be modified by a server-set -cookie. If the cookie engine is enabled and a server sets a cookie of the same -name then both will be sent on a future transfer to that server, likely not -what you intended. To address these issues set a domain in Set-Cookie (doing -that will include sub domains) or use the Netscape format. - -If this option is used several times, the last one will be used. - -Users very often want to both read cookies from a file and write updated -cookies back to a file, so using both \fI-b, --cookie\fP and \fI-c, --cookie-jar\fP in the same -command line is common. -.IP "--create-dirs" -When used in conjunction with the \fI-o, --output\fP option, curl will create the -necessary local directory hierarchy as needed. This option creates the dirs -mentioned with the \fI-o, --output\fP option, nothing else. If the --output file name -uses no dir or if the dirs it mentions already exist, no dir will be created. - -To create remote directories when using FTP or SFTP, try \fI--ftp-create-dirs\fP. -.IP "--crlf" -(FTP SMTP) Convert LF to CRLF in upload. Useful for MVS (OS/390). - -(SMTP added in 7.40.0) -.IP "--crlfile " -(TLS) Provide a file using PEM format with a Certificate Revocation List that may -specify peer certificates that are to be considered revoked. - -If this option is used several times, the last one will be used. - -Added in 7.19.7. -.IP "--data-ascii " -(HTTP) This is just an alias for \fI-d, --data\fP. -.IP "--data-binary " -(HTTP) This posts data exactly as specified with no extra processing whatsoever. - -If you start the data with the letter @, the rest should be a filename. Data -is posted in a similar manner as \fI-d, --data\fP does, except that newlines and -carriage returns are preserved and conversions are never done. - -If this option is used several times, the ones following the first will append -data as described in \fI-d, --data\fP. -.IP "--data-raw " -(HTTP) This posts data similarly to \fI-d, --data\fP but without the special -interpretation of the @ character. - -See also \fI-d, --data\fP. Added in 7.43.0. -.IP "--data-urlencode " -(HTTP) This posts data, similar to the other \fI-d, --data\fP options with the exception -that this performs URL-encoding. - -To be CGI-compliant, the part should begin with a \fIname\fP followed -by a separator and a content specification. The part can be passed to -curl using one of the following syntaxes: -.RS -.IP "content" -This will make curl URL-encode the content and pass that on. Just be careful -so that the content doesn't contain any = or @ symbols, as that will then make -the syntax match one of the other cases below! -.IP "=content" -This will make curl URL-encode the content and pass that on. The preceding = -symbol is not included in the data. -.IP "name=content" -This will make curl URL-encode the content part and pass that on. Note that -the name part is expected to be URL-encoded already. -.IP "@filename" -This will make curl load data from the given file (including any newlines), -URL-encode that data and pass it on in the POST. -.IP "name@filename" -This will make curl load data from the given file (including any newlines), -URL-encode that data and pass it on in the POST. The name part gets an equal -sign appended, resulting in \fIname=urlencoded-file-content\fP. Note that the -name is expected to be URL-encoded already. -.RE - -See also \fI-d, --data\fP and \fI--data-raw\fP. Added in 7.18.0. -.IP "-d, --data " -(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way -that a browser does when a user has filled in an HTML form and presses the -submit button. This will cause curl to pass the data to the server using the -content-type application/x-www-form-urlencoded. Compare to \fI-F, --form\fP. - -\fI--data-raw\fP is almost the same but does not have a special interpretation of -the @ character. To post data purely binary, you should instead use the -\fI--data-binary\fP option. To URL-encode the value of a form field you may use -\fI--data-urlencode\fP. - -If any of these options is used more than once on the same command line, the -data pieces specified will be merged together with a separating -&-symbol. Thus, using '-d name=daniel -d skill=lousy' would generate a post -chunk that looks like \&'name=daniel&skill=lousy'. - -If you start the data with the letter @, the rest should be a file name to -read the data from, or - if you want curl to read the data from -stdin. Multiple files can also be specified. Posting data from a file named -'foobar' would thus be done with \fI-d, --data\fP @foobar. When --data is told to read -from a file like that, carriage returns and newlines will be stripped out. If -you don't want the @ character to have a special interpretation use \fI--data-raw\fP -instead. - -See also \fI--data-binary\fP and \fI--data-urlencode\fP and \fI--data-raw\fP. This option overrides \fI-F, --form\fP and \fI-I, --head\fP and \fI--upload\fP. -.IP "--delegation " -(GSS/kerberos) Set LEVEL to tell the server what it is allowed to delegate when it -comes to user credentials. -.RS -.IP "none" -Don't allow any delegation. -.IP "policy" -Delegates if and only if the OK-AS-DELEGATE flag is set in the Kerberos -service ticket, which is a matter of realm policy. -.IP "always" -Unconditionally allow the server to delegate. -.RE -.IP "--digest" -(HTTP) Enables HTTP Digest authentication. This is an authentication scheme that -prevents the password from being sent over the wire in clear text. Use this in -combination with the normal \fI-u, --user\fP option to set user name and password. - -If this option is used several times, only the first one is used. - -See also \fI-u, --user\fP and \fI--proxy-digest\fP and \fI--anyauth\fP. This option overrides \fI--basic\fP and \fI--ntlm\fP and \fI--negotiate\fP. -.IP "--disable-eprt" -(FTP) Tell curl to disable the use of the EPRT and LPRT commands when doing active -FTP transfers. Curl will normally always first attempt to use EPRT, then LPRT -before using PORT, but with this option, it will use PORT right away. EPRT and -LPRT are extensions to the original FTP protocol, and may not work on all -servers, but they enable more functionality in a better way than the -traditional PORT command. - ---eprt can be used to explicitly enable EPRT again and --no-eprt is an alias -for \fI--disable-eprt\fP. - -If the server is accessed using IPv6, this option will have no effect as EPRT -is necessary then. - -Disabling EPRT only changes the active behavior. If you want to switch to -passive mode you need to not use \fI-P, --ftp-port\fP or force it with \fI--ftp-pasv\fP. -.IP "--disable-epsv" -(FTP) (FTP) Tell curl to disable the use of the EPSV command when doing passive FTP -transfers. Curl will normally always first attempt to use EPSV before PASV, -but with this option, it will not try using EPSV. - ---epsv can be used to explicitly enable EPSV again and --no-epsv is an alias -for \fI--disable-epsv\fP. - -If the server is an IPv6 host, this option will have no effect as EPSV is -necessary then. - -Disabling EPSV only changes the passive behavior. If you want to switch to -active mode you need to use \fI-P, --ftp-port\fP. -.IP "-q, --disable" -If used as the first parameter on the command line, the \fIcurlrc\fP config -file will not be read and used. See the \fI-K, --config\fP for details on the default -config file search path. -.IP "--dns-interface " -(DNS) Tell curl to send outgoing DNS requests through . This option is a -counterpart to \fI--interface\fP (which does not affect DNS). The supplied string -must be an interface name (not an address). - -See also \fI--dns-ipv4-addr\fP and \fI--dns-ipv6-addr\fP. \fI--dns-interface\fP requires that the underlying libcurl was built to support c-ares. Added in 7.33.0. -.IP "--dns-ipv4-addr
" -(DNS) Tell curl to bind to when making IPv4 DNS requests, so that -the DNS requests originate from this address. The argument should be a -single IPv4 address. - -See also \fI--dns-interface\fP and \fI--dns-ipv6-addr\fP. \fI--dns-ipv4-addr\fP requires that the underlying libcurl was built to support c-ares. Added in 7.33.0. -.IP "--dns-ipv6-addr
" -(DNS) Tell curl to bind to when making IPv6 DNS requests, so that -the DNS requests originate from this address. The argument should be a -single IPv6 address. - -See also \fI--dns-interface\fP and \fI--dns-ipv4-addr\fP. \fI--dns-ipv6-addr\fP requires that the underlying libcurl was built to support c-ares. Added in 7.33.0. -.IP "--dns-servers " -Set the list of DNS servers to be used instead of the system default. -The list of IP addresses should be separated with commas. Port numbers -may also optionally be given as \fI:\fP after each IP -address. - -\fI--dns-servers\fP requires that the underlying libcurl was built to support c-ares. Added in 7.33.0. -.IP "-D, --dump-header " -(HTTP FTP) Write the received protocol headers to the specified file. - -This option is handy to use when you want to store the headers that an HTTP -site sends to you. Cookies from the headers could then be read in a second -curl invocation by using the \fI-b, --cookie\fP option! The \fI-c, --cookie-jar\fP option is a -better way to store cookies. - -When used in FTP, the FTP server response lines are considered being "headers" -and thus are saved there. - -If this option is used several times, the last one will be used. - -See also \fI-o, --output\fP. -.IP "--egd-file " -(TLS) Specify the path name to the Entropy Gathering Daemon socket. The socket is -used to seed the random engine for SSL connections. - -See also \fI--random-file\fP. -.IP "--engine " -(TLS) Select the OpenSSL crypto engine to use for cipher operations. Use \fI--engine\fP -list to print a list of build-time supported engines. Note that not all (or -none) of the engines may be available at run-time. -.IP "--expect100-timeout " -(HTTP) Maximum time in seconds that you allow curl to wait for a 100-continue -response when curl emits an Expects: 100-continue header in its request. By -default curl will wait one second. This option accepts decimal values! When -curl stops waiting, it will continue as if the response has been received. - -See also \fI--connect-timeout\fP. Added in 7.47.0. -.IP "--fail-early" -Fail and exit on the first detected transfer error. - -When curl is used to do multiple transfers on the command line, it will -attempt to operate on each given URL, one by one. By default, it will ignore -errors if there are more URLs given and the last URL's success will determine -the error code curl returns. So early failures will be "hidden" by subsequent -successful transfers. - -Using this option, curl will instead return an error on the first transfer -that fails, independent of the amount of URLs that are given on the command -line. This way, no transfer failures go undetected by scripts and similar. - -This option is global and does not need to be specified for each use of \fI-:, --next\fP. - -This option does not imply \fI-f, --fail\fP, which causes transfers to fail due to the -server's HTTP status code. You can combine the two options, however note \fI-f, --fail\fP -is not global and is therefore contained by \fI-:, --next\fP. - -Added in 7.52.0. -.IP "-f, --fail" -(HTTP) Fail silently (no output at all) on server errors. This is mostly done to -better enable scripts etc to better deal with failed attempts. In normal cases -when an HTTP server fails to deliver a document, it returns an HTML document -stating so (which often also describes why and more). This flag will prevent -curl from outputting that and return error 22. - -This method is not fail-safe and there are occasions where non-successful -response codes will slip through, especially when authentication is involved -(response codes 401 and 407). -.IP "--false-start" -(TLS) Tells curl to use false start during the TLS handshake. False start is a mode -where a TLS client will start sending application data before verifying the -server's Finished message, thus saving a round trip when performing a full -handshake. - -This is currently only implemented in the NSS and Secure Transport (on iOS 7.0 -or later, or OS X 10.9 or later) backends. - -Added in 7.42.0. -.IP "--form-string " -(HTTP SMTP IMAP) Similar to \fI-F, --form\fP except that the value string for the named parameter is used -literally. Leading \&'@' and \&'<' characters, and the \&';type=' string in -the value have no special meaning. Use this in preference to \fI-F, --form\fP if -there's any possibility that the string value may accidentally trigger the -\&'@' or \&'<' features of \fI-F, --form\fP. - -See also \fI-F, --form\fP. -.IP "-F, --form " -(HTTP SMTP IMAP) For HTTP protocol family, this lets curl emulate a filled-in form in which a -user has pressed the submit button. This causes curl to POST data using the -Content-Type multipart/form-data according to RFC 2388. - -For SMTP and IMAP protocols, this is the mean to compose a multipart mail -message to transmit. - -This enables uploading of binary -files etc. To force the 'content' part to be a file, prefix the file name with -an @ sign. To just get the content part from a file, prefix the file name with -the symbol <. The difference between @ and < is then that @ makes a file get -attached in the post as a file upload, while the < makes a text field and just -get the contents for that text field from a file. - -Example: to send an image to an HTTP server, where \&'profile' is the name of -the form-field to which portrait.jpg will be the input: - - curl -F profile=@portrait.jpg https://example.com/upload.cgi - -To read content from stdin instead of a file, use - as the filename. This goes -for both @ and < constructs. If stdin is not attached to a regular file, it is -buffered first to determine its size and allow a possible resend. Defining a -part's data from a named non-regular file (such as a named pipe or similar) is -unfortunately not subject to buffering and will be effectively read at -transmission time; since the full size is unknown before the transfer starts, -data is sent as chunks by HTTP and rejected by IMAP. - -You can also tell curl what Content-Type to use by using 'type=', in a manner -similar to: - - curl -F "web=@index.html;type=text/html" example.com - -or - - curl -F "name=daniel;type=text/foo" example.com - -You can also explicitly change the name field of a file upload part by setting -filename=, like this: - - curl -F "file=@localfile;filename=nameinpost" example.com - -If filename/path contains ',' or ';', it must be quoted by double-quotes like: - - curl -F "file=@\\"localfile\\";filename=\\"nameinpost\\"" example.com - -or - - curl -F 'file=@"localfile";filename="nameinpost"' example.com - -Note that if a filename/path is quoted by double-quotes, any double-quote -or backslash within the filename must be escaped by backslash. - -You can add custom headers to the field by setting headers=, like - - curl -F "submit=OK;headers=\\"X-submit-type: OK\\"" example.com - -or - - curl -F "submit=OK;headers=@headerfile" example.com - -The headers= keyword may appear more that once and above notes about quoting -apply. When headers are read from a file, Empty lines and lines starting -with '#' are comments and ignored; each header can be folded by splitting -between two words and starting the continuation line with a space; embedded -carriage-returns and trailing spaces are stripped. -Here is an example of a header file contents: - - # This file contain two headers. -.br - X-header-1: this is a header - - # The following header is folded. -.br - X-header-2: this is -.br - another header - - -To support sending multipart mail messages, the syntax is extended as follows: -.br -- name can be omitted: the equal sign is the first character of the argument, -.br -- if data starts with '(', this signals to start a new multipart: it can be -followed by a content type specification. -.br -- a multipart can be terminated with a '=)' argument. - -Example: the following command sends an SMTP mime e-mail consisting in an -inline part in two alternative formats: plain text and HTML. It attaches a -text file: - - curl -F '=(;type=multipart/alternative' \\ -.br - -F '=plain text message' \\ -.br - -F '= HTML message;type=text/html' \\ -.br - -F '=)' -F '=@textfile.txt' ... smtp://example.com - -Data can be encoded for transfer using encoder=. Available encodings are -\fIbinary\fP and \fI8bit\fP that do nothing else than adding the corresponding -Content-Transfer-Encoding header, \fI7bit\fP that only rejects 8-bit characters -with a transfer error, \fIquoted-printable\fP and \fIbase64\fP that encodes -data according to the corresponding schemes, limiting lines length to -76 characters. - -Example: send multipart mail with a quoted-printable text message and a -base64 attached file: - - curl -F '=text message;encoder=quoted-printable' \\ -.br - -F '=@localfile;encoder=base64' ... smtp://example.com - -See further examples and details in the MANUAL. - -This option can be used multiple times. - -This option overrides \fI-d, --data\fP and \fI-I, --head\fP and \fI--upload\fP. -.IP "--ftp-account " -(FTP) When an FTP server asks for "account data" after user name and password has -been provided, this data is sent off using the ACCT command. - -If this option is used several times, the last one will be used. - -Added in 7.13.0. -.IP "--ftp-alternative-to-user " -(FTP) If authenticating with the USER and PASS commands fails, send this command. -When connecting to Tumbleweed's Secure Transport server over FTPS using a -client certificate, using "SITE AUTH" will tell the server to retrieve the -username from the certificate. - -Added in 7.15.5. -.IP "--ftp-create-dirs" -(FTP SFTP) When an FTP or SFTP URL/operation uses a path that doesn't currently exist on -the server, the standard behavior of curl is to fail. Using this option, curl -will instead attempt to create missing directories. - -See also \fI--create-dirs\fP. -.IP "--ftp-method " -(FTP) Control what method curl should use to reach a file on an FTP(S) -server. The method argument should be one of the following alternatives: -.RS -.IP multicwd -curl does a single CWD operation for each path part in the given URL. For deep -hierarchies this means very many commands. This is how RFC 1738 says it should -be done. This is the default but the slowest behavior. -.IP nocwd -curl does no CWD at all. curl will do SIZE, RETR, STOR etc and give a full -path to the server for all these commands. This is the fastest behavior. -.IP singlecwd -curl does one CWD with the full target directory and then operates on the file -\&"normally" (like in the multicwd case). This is somewhat more standards -compliant than 'nocwd' but without the full penalty of 'multicwd'. -.RE - -Added in 7.15.1. -.IP "--ftp-pasv" -(FTP) Use passive mode for the data connection. Passive is the internal default -behavior, but using this option can be used to override a previous \fI-P, --ftp-port\fP -option. - -If this option is used several times, only the first one is used. Undoing an -enforced passive really isn't doable but you must then instead enforce the -correct \fI-P, --ftp-port\fP again. - -Passive mode means that curl will try the EPSV command first and then PASV, -unless \fI--disable-epsv\fP is used. - -See also \fI--disable-epsv\fP. Added in 7.11.0. -.IP "-P, --ftp-port
" -(FTP) Reverses the default initiator/listener roles when connecting with FTP. This -option makes curl use active mode. curl then tells the server to connect back -to the client's specified address and port, while passive mode asks the server -to setup an IP address and port for it to connect to.
should be one -of: -.RS -.IP interface -i.e "eth0" to specify which interface's IP address you want to use (Unix only) -.IP "IP address" -i.e "192.168.10.1" to specify the exact IP address -.IP "host name" -i.e "my.host.domain" to specify the machine -.IP "-" -make curl pick the same IP address that is already used for the control -connection -.RE - -If this option is used several times, the last one will be used. Disable the -use of PORT with \fI--ftp-pasv\fP. Disable the attempt to use the EPRT command -instead of PORT by using \fI--disable-eprt\fP. EPRT is really PORT++. - -Since 7.19.5, you can append \&":[start]-[end]\&" to the right of the address, -to tell curl what TCP port range to use. That means you specify a port range, -from a lower to a higher number. A single number works as well, but do note -that it increases the risk of failure since the port may not be available. - -See also \fI--ftp-pasv\fP and \fI--disable-eprt\fP. -.IP "--ftp-pret" -(FTP) Tell curl to send a PRET command before PASV (and EPSV). Certain FTP servers, -mainly drftpd, require this non-standard command for directory listings as -well as up and downloads in PASV mode. - -Added in 7.20.0. -.IP "--ftp-skip-pasv-ip" -(FTP) Tell curl to not use the IP address the server suggests in its response -to curl's PASV command when curl connects the data connection. Instead curl -will re-use the same IP address it already uses for the control -connection. - -This option has no effect if PORT, EPRT or EPSV is used instead of PASV. - -See also \fI--ftp-pasv\fP. Added in 7.14.2. -.IP "--ftp-ssl-ccc-mode " -(FTP) Sets the CCC mode. The passive mode will not initiate the shutdown, but -instead wait for the server to do it, and will not reply to the shutdown from -the server. The active mode initiates the shutdown and waits for a reply from -the server. - -See also \fI--ftp-ssl-ccc\fP. Added in 7.16.2. -.IP "--ftp-ssl-ccc" -(FTP) Use CCC (Clear Command Channel) Shuts down the SSL/TLS layer after -authenticating. The rest of the control channel communication will be -unencrypted. This allows NAT routers to follow the FTP transaction. The -default mode is passive. - -See also \fI--ssl\fP and \fI--ftp-ssl-ccc-mode\fP. Added in 7.16.1. -.IP "--ftp-ssl-control" -(FTP) Require SSL/TLS for the FTP login, clear for transfer. Allows secure -authentication, but non-encrypted data transfers for efficiency. Fails the -transfer if the server doesn't support SSL/TLS. - -Added in 7.16.0. -.IP "-G, --get" -When used, this option will make all data specified with \fI-d, --data\fP, \fI--data-binary\fP -or \fI--data-urlencode\fP to be used in an HTTP GET request instead of the POST -request that otherwise would be used. The data will be appended to the URL -with a '?' separator. - -If used in combination with \fI-I, --head\fP, the POST data will instead be appended to -the URL with a HEAD request. - -If this option is used several times, only the first one is used. This is -because undoing a GET doesn't make sense, but you should then instead enforce -the alternative method you prefer. -.IP "-g, --globoff" -This option switches off the "URL globbing parser". When you set this option, -you can specify URLs that contain the letters {}[] without having them being -interpreted by curl itself. Note that these letters are not normal legal URL -contents but they should be encoded according to the URI standard. -.IP "-I, --head" -(HTTP FTP FILE) Fetch the headers only! HTTP-servers feature the command HEAD which this uses -to get nothing but the header of a document. When used on an FTP or FILE file, -curl displays the file size and last modification time only. -.IP "-H, --header
" -(HTTP) Extra header to include in the request when sending HTTP to a server. You may -specify any number of extra headers. Note that if you should add a custom -header that has the same name as one of the internal ones curl would use, your -externally set header will be used instead of the internal one. This allows -you to make even trickier stuff than curl would normally do. You should not -replace internally set headers without knowing perfectly well what you're -doing. Remove an internal header by giving a replacement without content on -the right side of the colon, as in: -H \&"Host:". If you send the custom -header with no-value then its header must be terminated with a semicolon, such -as \-H \&"X-Custom-Header;" to send "X-Custom-Header:". - -curl will make sure that each header you add/replace is sent with the proper -end-of-line marker, you should thus \fBnot\fP add that as a part of the header -content: do not add newlines or carriage returns, they will only mess things up -for you. - -Starting in 7.55.0, this option can take an argument in @filename style, which -then adds a header for each line in the input file. Using @- will make curl -read the header file from stdin. - -See also the \fI-A, --user-agent\fP and \fI-e, --referer\fP options. - -Starting in 7.37.0, you need \fI--proxy-header\fP to send custom headers intended -for a proxy. - -Example: - - curl -H "X-First-Name: Joe" http://example.com/ - -\fBWARNING\fP: headers set with this option will be set in all requests - even -after redirects are followed, like when told with \fI-L, --location\fP. This can lead to -the header being sent to other hosts than the original host, so sensitive -headers should be used with caution combined with following redirects. - -This option can be used multiple times to add/replace/remove multiple headers. -.IP "-h, --help" -Usage help. This lists all current command line options with a short -description. -.IP "--hostpubmd5 " -(SFTP SCP) Pass a string containing 32 hexadecimal digits. The string should -be the 128 bit MD5 checksum of the remote host's public key, curl will refuse -the connection with the host unless the md5sums match. - -Added in 7.17.1. -.IP "-0, --http1.0" -(HTTP) Tells curl to use HTTP version 1.0 instead of using its internally preferred -HTTP version. - -This option overrides \fI--http1.1\fP and \fI--http2\fP. -.IP "--http1.1" -(HTTP) Tells curl to use HTTP version 1.1. - -This option overrides \fI-0, --http1.0\fP and \fI--http2\fP. Added in 7.33.0. -.IP "--http2-prior-knowledge" -(HTTP) Tells curl to issue its non-TLS HTTP requests using HTTP/2 without HTTP/1.1 -Upgrade. It requires prior knowledge that the server supports HTTP/2 straight -away. HTTPS requests will still do HTTP/2 the standard way with negotiated -protocol version in the TLS handshake. - -\fI--http2-prior-knowledge\fP requires that the underlying libcurl was built to support HTTP/2. This option overrides \fI--http1.1\fP and \fI-0, --http1.0\fP and \fI--http2\fP. Added in 7.49.0. -.IP "--http2" -(HTTP) Tells curl to use HTTP version 2. - -See also \fI--no-alpn\fP. \fI--http2\fP requires that the underlying libcurl was built to support HTTP/2. This option overrides \fI--http1.1\fP and \fI-0, --http1.0\fP and \fI--http2-prior-knowledge\fP. Added in 7.33.0. -.IP "--ignore-content-length" -(FTP HTTP) For HTTP, Ignore the Content-Length header. This is particularly useful for -servers running Apache 1.x, which will report incorrect Content-Length for -files larger than 2 gigabytes. - -For FTP (since 7.46.0), skip the RETR command to figure out the size before -downloading a file. -.IP "-i, --include" -Include the HTTP response headers in the output. The HTTP response headers can -include things like server name, cookies, date of the document, HTTP version -and more... - -To view the request headers, consider the \fI-v, --verbose\fP option. - -See also \fI-v, --verbose\fP. -.IP "-k, --insecure" -(TLS) -By default, every SSL connection curl makes is verified to be secure. This -option allows curl to proceed and operate even for server connections -otherwise considered insecure. - -The server connection is verified by making sure the server's certificate -contains the right name and verifies successfully using the cert store. - -See this online resource for further details: - https://curl.haxx.se/docs/sslcerts.html - -See also \fI--proxy-insecure\fP and \fI--cacert\fP. -.IP "--interface " - -Perform an operation using a specified interface. You can enter interface -name, IP address or host name. An example could look like: - - curl --interface eth0:1 https://www.example.com/ - -If this option is used several times, the last one will be used. - -See also \fI--dns-interface\fP. -.IP "-4, --ipv4" -This option tells curl to resolve names to IPv4 addresses only, and not for -example try IPv6. - -See also \fI--http1.1\fP and \fI--http2\fP. This option overrides \fI-6, --ipv6\fP. -.IP "-6, --ipv6" -This option tells curl to resolve names to IPv6 addresses only, and not for -example try IPv4. - -See also \fI--http1.1\fP and \fI--http2\fP. This option overrides \fI-6, --ipv6\fP. -.IP "-j, --junk-session-cookies" -(HTTP) When curl is told to read cookies from a given file, this option will make it -discard all "session cookies". This will basically have the same effect as if -a new session is started. Typical browsers always discard session cookies when -they're closed down. - -See also \fI-b, --cookie\fP and \fI-c, --cookie-jar\fP. -.IP "--keepalive-time " -This option sets the time a connection needs to remain idle before sending -keepalive probes and the time between individual keepalive probes. It is -currently effective on operating systems offering the TCP_KEEPIDLE and -TCP_KEEPINTVL socket options (meaning Linux, recent AIX, HP-UX and more). This -option has no effect if \fI--no-keepalive\fP is used. - -If this option is used several times, the last one will be used. If -unspecified, the option defaults to 60 seconds. - -Added in 7.18.0. -.IP "--key-type " -(TLS) Private key file type. Specify which type your \fI--key\fP provided private key -is. DER, PEM, and ENG are supported. If not specified, PEM is assumed. - -If this option is used several times, the last one will be used. -.IP "--key " -(TLS SSH) Private key file name. Allows you to provide your private key in this separate -file. For SSH, if not specified, curl tries the following candidates in order: -'~/.ssh/id_rsa', '~/.ssh/id_dsa', './id_rsa', './id_dsa'. - -If this option is used several times, the last one will be used. -.IP "--krb " -(FTP) Enable Kerberos authentication and use. The level must be entered and should -be one of 'clear', 'safe', 'confidential', or 'private'. Should you use a -level that is not one of these, 'private' will instead be used. - -If this option is used several times, the last one will be used. - -\fI--krb\fP requires that the underlying libcurl was built to support Kerberos. -.IP "--libcurl " -Append this option to any ordinary curl command line, and you will get a -libcurl-using C source code written to the file that does the equivalent -of what your command-line operation does! - -If this option is used several times, the last given file name will be -used. - -Added in 7.16.1. -.IP "--limit-rate " -Specify the maximum transfer rate you want curl to use - for both downloads -and uploads. This feature is useful if you have a limited pipe and you'd like -your transfer not to use your entire bandwidth. To make it slower than it -otherwise would be. - -The given speed is measured in bytes/second, unless a suffix is appended. -Appending 'k' or 'K' will count the number as kilobytes, 'm' or M' makes it -megabytes, while 'g' or 'G' makes it gigabytes. Examples: 200K, 3m and 1G. - -If you also use the \fI-Y, --speed-limit\fP option, that option will take precedence and -might cripple the rate-limiting slightly, to help keeping the speed-limit -logic working. - -If this option is used several times, the last one will be used. -.IP "-l, --list-only" -(FTP POP3) (FTP) -When listing an FTP directory, this switch forces a name-only view. This is -especially useful if the user wants to machine-parse the contents of an FTP -directory since the normal directory view doesn't use a standard look or -format. When used like this, the option causes a NLST command to be sent to -the server instead of LIST. - -Note: Some FTP servers list only files in their response to NLST; they do not -include sub-directories and symbolic links. - -(POP3) -When retrieving a specific email from POP3, this switch forces a LIST command -to be performed instead of RETR. This is particularly useful if the user wants -to see if a specific message id exists on the server and what size it is. - -Note: When combined with \fI-X, --request\fP, this option can be used to send an UIDL -command instead, so the user may use the email's unique identifier rather than -it's message id to make the request. - -Added in 7.21.5. -.IP "--local-port " -Set a preferred single number or range (FROM-TO) of local port numbers to use -for the connection(s). Note that port numbers by nature are a scarce resource -that will be busy at times so setting this range to something too narrow might -cause unnecessary connection setup failures. - -Added in 7.15.2. -.IP "--location-trusted" -(HTTP) Like \fI-L, --location\fP, but will allow sending the name + password to all hosts that -the site may redirect to. This may or may not introduce a security breach if -the site redirects you to a site to which you'll send your authentication info -(which is plaintext in the case of HTTP Basic authentication). - -See also \fI-u, --user\fP. -.IP "-L, --location" -(HTTP) If the server reports that the requested page has moved to a different -location (indicated with a Location: header and a 3XX response code), this -option will make curl redo the request on the new place. If used together with -\fI-i, --include\fP or \fI-I, --head\fP, headers from all requested pages will be shown. When -authentication is used, curl only sends its credentials to the initial -host. If a redirect takes curl to a different host, it won't be able to -intercept the user+password. See also \fI--location-trusted\fP on how to change -this. You can limit the amount of redirects to follow by using the -\fI--max-redirs\fP option. - -When curl follows a redirect and the request is not a plain GET (for example -POST or PUT), it will do the following request with a GET if the HTTP response -was 301, 302, or 303. If the response code was any other 3xx code, curl will -re-send the following request using the same unmodified method. - -You can tell curl to not change the non-GET request method to GET after a 30x -response by using the dedicated options for that: \fI--post301\fP, \fI--post302\fP and -\fI--post303\fP. -.IP "--login-options " -(IMAP POP3 SMTP) Specify the login options to use during server authentication. - -You can use the login options to specify protocol specific options that may -be used during authentication. At present only IMAP, POP3 and SMTP support -login options. For more information about the login options please see -RFC 2384, RFC 5092 and IETF draft draft-earhart-url-smtp-00.txt - -If this option is used several times, the last one will be used. - -Added in 7.34.0. -.IP "--mail-auth
" -(SMTP) Specify a single address. This will be used to specify the authentication -address (identity) of a submitted message that is being relayed to another -server. - -See also \fI--mail-rcpt\fP and \fI--mail-from\fP. Added in 7.25.0. -.IP "--mail-from
" -(SMTP) Specify a single address that the given mail should get sent from. - -See also \fI--mail-rcpt\fP and \fI--mail-auth\fP. Added in 7.20.0. -.IP "--mail-rcpt
" -(SMTP) Specify a single address, user name or mailing list name. Repeat this -option several times to send to multiple recipients. - -When performing a mail transfer, the recipient should specify a valid email -address to send the mail to. - -When performing an address verification (VRFY command), the recipient should be -specified as the user name or user name and domain (as per Section 3.5 of -RFC5321). (Added in 7.34.0) - -When performing a mailing list expand (EXPN command), the recipient should be -specified using the mailing list name, such as "Friends" or "London-Office". -(Added in 7.34.0) - -Added in 7.20.0. -.IP "-M, --manual" -Manual. Display the huge help text. -.IP "--max-filesize " -Specify the maximum size (in bytes) of a file to download. If the file -requested is larger than this value, the transfer will not start and curl will -return with exit code 63. - -\fBNOTE:\fP The file size is not always known prior to download, and for such -files this option has no effect even if the file transfer ends up being larger -than this given limit. This concerns both FTP and HTTP transfers. - -See also \fI--limit-rate\fP. -.IP "--max-redirs " -(HTTP) Set maximum number of redirection-followings allowed. When \fI-L, --location\fP is used, -is used to prevent curl from following redirections \&"in absurdum". By -default, the limit is set to 50 redirections. Set this option to -1 to make it -unlimited. - -If this option is used several times, the last one will be used. -.IP "-m, --max-time