Makefile.mk: drop in favour of autotools and cmake (MS-DOS, AmigaOS3)

`Makefile.mk` supported MS-DOS and Amiga, but `./configure` also
supported them in a better tested and more flexible way.

This patch also adds CMake support for MS-DOS/DJGPP and Amiga OS 3.

`Makefile.mk` was not maintained. Delete it in favour of first-tier
build methods.

Also include some non-MS-DOS/AmigaOS-specific tidy-up, see details at
the end of this message.

Details:

- fix/silence all MS-DOS/DJGPP build warnings and issues.
- add MS-DOS support to cmake.
  - default to `ENABLE_THREADED_RESOLVER=OFF` for MS-DOS.
  - add support for `WATT_ROOT`.
  - use static libcurl with MS-DOS.
  - fixup default CMake suffixes/prefixes for DJGPP.
  - disable hidden symbols for MS-DOS. Not supported on MS-DOS.
  - opt-in MS-DOS into `USE_UNIX_SOCKETS`.
- improve MS-DOS support in autotools.
  - default to `--disable-threaded-resolver` for MS-DOS.
- make sure to use `close_s()` (from Watt-32) with autotools and cmake.
  `Makefile.mk` used it before this patch.
- GHA: add DJGPP cmake (~30s) and autotools (~60s) build jobs.
  Also build tests and examples with cmake.
- improve AmigaOS support in autotools:
  - configure: detect `CloseSocket()` when it's a macro.
  - configure: fix `IoctlSocket` detection on AmigaOS.
  - curl-amissl.m4: pass AmiSSL libs to tests/servers.
- add AmigaOS3 support to cmake:
  - cmake: fix `HAVE_IOCTLSOCKET_CAMEL` and
    `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` detections.
  - set necessary system libs.
  - add AmiSSL support.
  - inet_ntop, inet_pton: fix using it for AmigaOS. cmake detects them,
    and they did not compile with AmigaOS.
  - cmake: better sync `gethostname` detection with autotools.
    Fixes detection for AmigaOS, where `gethostname` is a macro.
  - cmake: fix `sys/utime.h` detection on AmigaOS.
  - cmake: force-disable `getaddrinfo` for AmigaOS.
  - cmake: tweak threading and static/shared default for AmigaOS.
  - cmake: rely on manual variable `AMIGA` to enable the platform.
- GHA: add AmigaOS cmake and autotools (~45s) jobs.
  Also build tests and examples with cmake.
- INSTALL: update MS-DOS and AmigaOS build instructions.
- amigaos: fix `-Wpointer-sign` and
  `zero or negative size array '_args'` in `Printf()`.
- amigaos: fix `-Wpointer-sign`
- amigaos: fix `-Wredundant-decls` `errno` and `h_errno`.
- amigaos: brute-force silence `lseek()` size warnings.
- amigaos: server/resolve: silence `-Wdiscarded-qualifiers`.
- amigaos: server/resolve: fix `-Wpointer-sign`.
- amigaos: fix `CURL_SA_FAMILY_T` type.
- nonblock: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS.
  `ioctl` is also detected, but fails when used. Make the above override
  it for a successful build.
  Authored-by: Darren Banfi
  Fixes #15537
  Closes #15603
- tftpd: prefer `HAVE_IOCTLSOCKET_CAMEL_FIONBIO` for AmigaOS.
- tftpd: tidy-up conditional code.
- curl: set stack size to 16384 for AmigaOS3/4
  Overriding the default 4096.
  Suggested-by: Darren Banfi
  Ref: https://github.com/curl/curl/pull/15543#issuecomment-2498783123
  Ref: https://wiki.amigaos.net/wiki/Controlling_Application_Stack
- functypes.h: fix `SEND_QUAL_ARG2` for AmigaOS.
- tftp: add missing cast in sendto() call for AmigaOS.
- getinfo: fix warning with AmigaOS.
- tool_operate: silence warning with AmigaOS
- amigaos: fix building libtests due to missing `RLIMIT_NOFILE`.
- curl_gethostname: silence warning for AmigaOS.
- ftp: silence `-Wtype-limits` for AmigaOS.
- libtest: fix timeval initialization for AmigaOS.
- examples: fix `timeval` initialization for AmigaOS.
- examples: silence warning for AmigaOS.
- configure: fix IPv6 detection for cross-builds.
- netrc: fix to build with AmigaOS cleanly.
- buildinfo: detect and add `DOS` tag for MS-DOS builds.
- buildinfo: add `AMIGA` to buildinfo.txt in auttools.
- build: move `USE_WATT32` macro definition to cmake/configure.

Non-MS-DOS/AmigeOS-specific tidy-ups:

- configure: sync `sa_family_t` detection with cmake.
- configure: sync `ADDRESS_FAMILY` detection signals with cmake.
- doh: use `CURL_SA_FAMILY_T`.
- lib: drop mingw-specific `CURL_SA_FAMILY_T` workaround.
- cmake: extend instead of override check-specific
  configurations/requirements.
  This allows to honor global requirements added earlier.
  Necessary for AmigaOS for example.
- cmake: omit warning on disabled IPv6 for MS-DOS and AmigaOS.
  No IPv6 support on these platforms. Also sync with autotools.
- lib1960: use libcurl `inet_pton()` wrapper.
- cmake: detect LibreSSL (to match autotools).
- cmake: say the specific OpenSSL flavour detected.
- hostip: add missing `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` guard.
- lib: simplify classic mac feature guards.

Follow-up to a8861b6ccdd7ca35b6115588a578e36d765c9e38 #9764

Closes #15543
This commit is contained in:
Viktor Szakats 2024-11-16 19:04:36 +01:00
parent 607bec04d9
commit a3585c9576
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
74 changed files with 734 additions and 1019 deletions

1
.github/labeler.yml vendored
View File

@ -63,7 +63,6 @@ build:
**/CMakeLists.txt,\
**/Makefile.am,\
**/Makefile.inc,\
**/Makefile.mk,\
**/*.m4,\
**/*.mk,\
*.m4,\

View File

@ -37,11 +37,8 @@ my %remove = (
'#define CURL_EXTERN_SYMBOL' => 1,
'#define CURL_OS "Linux"' => 1,
'#define CURL_OS "x86_64-pc-linux-gnu"' => 1,
'#define CURL_SA_FAMILY_T ADDRESS_FAMILY' => 1,
'#define CURL_SA_FAMILY_T sa_family_t' => 1,
'#define GETHOSTNAME_TYPE_ARG2 int' => 1,
'#define GETHOSTNAME_TYPE_ARG2 size_t' => 1,
'#define HAVE_ADDRESS_FAMILY 1' => 1,
'#define HAVE_BROTLI 1' => 1,
'#define HAVE_BROTLI_DECODE_H 1' => 1,
'#define HAVE_DECL_GETPWUID_R 0' => 1,
@ -74,7 +71,6 @@ my %remove = (
'#define HAVE_OPENSSL_SSL_H 1' => 1,
'#define HAVE_OPENSSL_X509_H 1' => 1,
'#define HAVE_QUICHE_H 1' => 1,
'#define HAVE_SA_FAMILY_T 1' => 1,
'#define HAVE_SETJMP_H 1' => 1,
'#define HAVE_SSL_ECH_SET1_ECHCONFIG 1' => 1,
'#define HAVE_SSL_SET1_ECH_CONFIG_LIST 1' => 1,

View File

@ -37,7 +37,7 @@ permissions: {}
jobs:
netbsd:
name: 'NetBSD (cmake, openssl, clang)'
name: 'NetBSD (CM, openssl, clang)'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
@ -77,7 +77,7 @@ jobs:
echo '::endgroup::'
openbsd:
name: 'OpenBSD (cmake, libressl, clang)'
name: 'OpenBSD (CM, libressl, clang)'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
@ -118,7 +118,7 @@ jobs:
echo '::endgroup::'
freebsd:
name: 'FreeBSD (${{ matrix.build }}, openssl, ${{ matrix.compiler }}, ${{ matrix.arch }})'
name: "FreeBSD (${{ matrix.build && 'CM' || 'AM' }}, openssl, ${{ matrix.compiler }}, ${{ matrix.arch }})"
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
@ -194,7 +194,7 @@ jobs:
echo '::endgroup::'
omnios:
name: 'OmniOS (autotools, openssl, gcc, amd64)'
name: 'OmniOS (AM, openssl, gcc, amd64)'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@ -224,3 +224,199 @@ jobs:
echo '::group::build examples'
gmake -j3 examples
echo '::endgroup::'
amiga:
name: "AmigaOS (${{ matrix.build == 'cmake' && 'CM' || 'AM' }}, AmiSSL, gcc, m68k)"
runs-on: 'ubuntu-24.04'
timeout-minutes: 30
env:
amissl-version: 5.18
strategy:
matrix:
build: [autotools, cmake]
fail-fast: false
steps:
- name: 'install compiler'
if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
run: |
cd "${HOME}" || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location https://github.com/bebbo/amiga-gcc/releases/download/Mechen/amiga-gcc.tgz | tar -xz
cd opt/appveyor || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 \
--location https://github.com/jens-maus/amissl/releases/download/${{ env.amissl-version }}/AmiSSL-${{ env.amissl-version }}-SDK.lha --output bin.lha
7z x -bd -y bin.lha
rm -f bin.lha
mv "$HOME/opt/appveyor" /opt
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: 'configure'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake -B bld \
-DAMIGA=1 \
-DCMAKE_SYSTEM_NAME=Generic \
-DCMAKE_SYSTEM_PROCESSOR=m68k \
-DCMAKE_C_COMPILER_TARGET=m68k-unknown-amigaos \
-DCMAKE_C_COMPILER=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-gcc \
-DCMAKE_C_FLAGS='-O0 -msoft-float -mcrt=clib2' \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DCURL_USE_LIBPSL=OFF \
-DAMISSL_INCLUDE_DIR=/opt/appveyor/AmiSSL/Developer/include \
-DAMISSL_STUBS_LIBRARY=/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3/libamisslstubs.a \
-DAMISSL_AUTO_LIBRARY=/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a
else
autoreconf -fi
mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
CC=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-gcc \
AR=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-ar \
RANLIB=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-ranlib \
--host=m68k-amigaos \
--disable-shared \
--without-libpsl \
--with-amissl \
LDFLAGS=-L/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3 \
CPPFLAGS=-I/opt/appveyor/AmiSSL/Developer/include \
CFLAGS='-O0 -msoft-float -mcrt=clib2' \
LIBS='-lnet -lm -latomic'
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5
else
make -j5 -C bld
fi
- name: 'build tests'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target testdeps
else
make -j5 -C bld -C tests
fi
- name: 'build examples'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target curl-examples
else
make -j5 -C bld examples
fi
msdos:
name: "MS-DOS (${{ matrix.build == 'cmake' && 'CM' || 'AM' }}, openssl, djgpp, i586)"
runs-on: 'ubuntu-24.04'
timeout-minutes: 30
env:
toolchain-version: '3.4'
strategy:
matrix:
build: [autotools, cmake]
fail-fast: false
steps:
- name: 'install packages'
run: sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install libfl2 ${{ matrix.build == 'cmake' && 'ninja-build' || '' }}
- name: 'cache compiler (djgpp)'
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
id: cache-compiler
with:
path: ~/djgpp
key: ${{ runner.os }}-djgpp-${{ env.toolchain-version }}-amd64
- name: 'install compiler (djgpp)'
if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
run: |
cd "${HOME}" || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location 'https://github.com/andrewwutw/build-djgpp/releases/download/v${{ env.toolchain-version }}/djgpp-linux64-gcc1220.tar.bz2' | tar -xj
cd djgpp || exit 1
for f in wat3211b.zip zlb13b.zip ssl102ub.zip; do
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 \
"https://www.delorie.com/pub/djgpp/current/v2tk/$f" --output bin.zip
unzip -q bin.zip
rm -f bin.zip
done
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: 'configure'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake -B bld -G Ninja \
-DCMAKE_SYSTEM_NAME=DOS \
-DCMAKE_SYSTEM_PROCESSOR=x86 \
-DCMAKE_C_COMPILER_TARGET=i586-pc-msdosdjgpp \
-DCMAKE_C_COMPILER=$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DCURL_USE_LIBPSL=OFF \
-DOPENSSL_INCLUDE_DIR=$HOME/djgpp/include \
-DOPENSSL_SSL_LIBRARY=$HOME/djgpp/lib/libssl.a \
-DOPENSSL_CRYPTO_LIBRARY=$HOME/djgpp/lib/libcrypto.a \
-DZLIB_INCLUDE_DIR=$HOME/djgpp/include" \
-DZLIB_LIBRARY=$HOME/djgpp/lib/libz.a" \
-DWATT_ROOT=$HOME/djgpp/net/watt
else
autoreconf -fi
mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
CC=$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc \
AR=$HOME/djgpp/bin/i586-pc-msdosdjgpp-ar \
RANLIB=$HOME/djgpp/bin/i586-pc-msdosdjgpp-ranlib \
WATT_ROOT=$HOME/djgpp/net/watt \
--host=i586-pc-msdosdjgpp \
--with-openssl=$HOME/djgpp \
--with-zlib=$HOME/djgpp \
--without-libpsl \
--disable-shared
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld
else
make -j5 -C bld
fi
- name: 'build tests'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
fi
- name: 'build examples'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
fi

View File

@ -29,6 +29,8 @@ if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
# e.g. curl_easy_perform_ev() or curl_dbg_*(),
# so disable symbol hiding for debug builds and for memory tracking.
set(CURL_HIDDEN_SYMBOLS OFF)
elseif(DOS OR AMIGA)
set(CURL_HIDDEN_SYMBOLS OFF)
endif()
set(CURL_HIDES_PRIVATE_SYMBOLS FALSE)

View File

@ -181,9 +181,7 @@ int main(void)
#ifdef HAVE_IOCTLSOCKET_CAMEL
/* includes start */
#ifdef _WIN32
# include <winsock2.h>
#endif
#include <proto/bsdsocket.h>
int main(void)
{
/* IoctlSocket source code */
@ -196,8 +194,9 @@ int main(void)
#ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
/* includes start */
#ifdef _WIN32
# include <winsock2.h>
#include <proto/bsdsocket.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
int main(void)
{

View File

@ -175,7 +175,7 @@ if(NOT _GSS_FOUND) # Not found by pkg-config. Let us take more traditional appr
if(_GSS_INCLUDE_DIRS) # jay, we have found something
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIRS}")
check_include_files("gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _gss_have_mit_headers)
if(_gss_have_mit_headers)

View File

@ -40,7 +40,7 @@ if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
set(CMAKE_EXTRA_INCLUDE_FILES "")
if(WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
elseif(HAVE_SYS_SOCKET_H)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
endif()

View File

@ -27,6 +27,7 @@ set(_picky "")
if(CURL_WERROR AND
((CMAKE_COMPILER_IS_GNUCC AND
NOT DOS AND # Watt-32 headers use the '#include_next' GCC extension
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0 AND
NOT CMAKE_VERSION VERSION_LESS 3.23.0) OR # to avoid check_symbol_exists() conflicting with GCC -pedantic-errors
CMAKE_C_COMPILER_ID MATCHES "Clang"))

View File

@ -108,6 +108,12 @@ endif()
if(MSYS)
set(_target_flags "${_target_flags} MSYS")
endif()
if(DOS)
set(_target_flags "${_target_flags} DOS")
endif()
if(AMIGA)
set(_target_flags "${_target_flags} AMIGA")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
set(_target_flags "${_target_flags} GCC")
endif()
@ -201,11 +207,20 @@ if(WIN32)
endif()
# Avoid storing HAVE_WIN32_WINNT in CMake cache
unset(HAVE_WIN32_WINNT CACHE)
elseif(DOS OR AMIGA)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_STATIC_LIBS ON)
if(DOS AND CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()
endif()
option(CURL_LTO "Enable compiler Link Time Optimizations" OFF)
cmake_dependent_option(ENABLE_THREADED_RESOLVER "Enable threaded DNS lookup"
ON "NOT ENABLE_ARES"
ON "NOT ENABLE_ARES;NOT DOS;NOT AMIGA"
OFF)
include(PickyWarnings)
@ -420,7 +435,9 @@ if(ENABLE_IPV6 AND NOT WIN32)
check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
if(NOT DOS AND NOT AMIGA)
message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
endif()
# Force the feature off as this name is used as guard macro...
set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE)
endif()
@ -469,6 +486,9 @@ endif()
# If we are on Haiku, make sure that the network library is brought in.
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
list(APPEND CURL_LIBS "network")
elseif(AMIGA)
list(APPEND CURL_LIBS "net" "m" "atomic")
list(APPEND CMAKE_REQUIRED_LIBRARIES "net" "m" "atomic")
endif()
# Include all the necessary files for macros
@ -489,6 +509,8 @@ elseif(APPLE)
set(HAVE_EVENTFD 0)
set(HAVE_GETPASS_R 0)
set(HAVE_SENDMMSG 0)
elseif(AMIGA)
set(HAVE_GETADDRINFO 0) # Breaks the build when detected and used.
endif()
if(ENABLE_THREADED_RESOLVER)
@ -503,15 +525,34 @@ if(ENABLE_THREADED_RESOLVER)
endif()
# Check for all needed libraries
if(NOT WIN32 AND NOT APPLE)
if(DOS)
if(WATT_ROOT)
set(USE_WATT32 ON)
# FIXME upstream: must specify the full path to avoid CMake converting "watt" to "watt.lib"
list(APPEND CURL_LIBS "${WATT_ROOT}/lib/libwatt.a")
include_directories(SYSTEM "${WATT_ROOT}/inc")
list(APPEND CMAKE_REQUIRED_INCLUDES "${WATT_ROOT}/inc")
else()
message(FATAL_ERROR "Set WATT_ROOT variable to the root installation of Watt-32.")
endif()
elseif(AMIGA)
if(AMISSL_INCLUDE_DIR AND AMISSL_STUBS_LIBRARY AND AMISSL_AUTO_LIBRARY)
set(USE_AMISSL ON)
list(APPEND CMAKE_REQUIRED_INCLUDES "${AMISSL_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${AMISSL_STUBS_LIBRARY}" "${AMISSL_AUTO_LIBRARY}")
set(OPENSSL_INCLUDE_DIR "${AMISSL_INCLUDE_DIR}")
set(OPENSSL_SSL_LIBRARY "${AMISSL_STUBS_LIBRARY}")
set(OPENSSL_CRYPTO_LIBRARY "${AMISSL_AUTO_LIBRARY}")
set(CURL_USE_OPENSSL ON)
set(CURL_CA_FALLBACK ON CACHE BOOL "")
endif()
elseif(NOT WIN32 AND NOT APPLE)
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
if(HAVE_LIBSOCKET)
set(CURL_LIBS "socket;${CURL_LIBS}")
endif()
endif()
check_function_exists("gethostname" HAVE_GETHOSTNAME)
if(WIN32)
list(APPEND CURL_LIBS "ws2_32" "bcrypt")
endif()
@ -637,14 +678,29 @@ if(CURL_USE_OPENSSL)
set(_curl_ca_bundle_supported TRUE)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
if(NOT DEFINED HAVE_BORINGSSL)
check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL)
endif()
if(NOT DEFINED HAVE_AWSLC)
check_symbol_exists("OPENSSL_IS_AWSLC" "openssl/base.h" HAVE_AWSLC)
endif()
if(NOT DEFINED HAVE_LIBRESSL)
check_symbol_exists("LIBRESSL_VERSION_NUMBER" "openssl/opensslv.h" HAVE_LIBRESSL)
endif()
cmake_pop_check_state()
if(HAVE_BORINGSSL)
set(_openssl "BoringSSL")
elseif(HAVE_AWSLC)
set(_openssl "AWS-LC")
elseif(HAVE_LIBRESSL)
set(_openssl "LibreSSL")
elseif(USE_AMISSL)
set(_openssl "AmiSSL")
else()
set(_openssl "OpenSSL")
endif()
endif()
if(CURL_USE_MBEDTLS)
@ -730,8 +786,8 @@ if(CURL_USE_GNUTLS)
if(NOT DEFINED HAVE_GNUTLS_SRP AND NOT CURL_DISABLE_SRP)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${GNUTLS_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES})
check_symbol_exists("gnutls_srp_verifier" "gnutls/gnutls.h" HAVE_GNUTLS_SRP)
cmake_pop_check_state()
endif()
@ -804,8 +860,8 @@ endif()
macro(curl_openssl_check_symbol_exists _symbol _files _variable _extra_libs)
cmake_push_check_state()
if(USE_OPENSSL)
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
if(HAVE_LIBZ)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
endif()
@ -814,8 +870,8 @@ macro(curl_openssl_check_symbol_exists _symbol _files _variable _extra_libs)
list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL
endif()
elseif(USE_WOLFSSL)
set(CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIRS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}")
if(HAVE_LIBZ)
list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") # Public wolfSSL headers require zlib headers
@ -910,6 +966,9 @@ if(USE_NGTCP2)
else()
find_package(NGTCP2 REQUIRED "quictls")
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_quictls")
if(NOT HAVE_LIBRESSL)
set(_openssl "quictls")
endif()
endif()
curl_openssl_check_quic()
elseif(USE_GNUTLS)
@ -949,8 +1008,8 @@ if(USE_QUICHE)
endif()
if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "${QUICHE_LIBRARIES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${QUICHE_INCLUDE_DIRS}")
list(APPEND 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()
@ -1015,7 +1074,7 @@ if(NOT CURL_DISABLE_LDAP)
# Check for LDAP
cmake_push_check_state()
if(USE_OPENSSL)
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
endif()
find_package(LDAP)
if(LDAP_FOUND)
@ -1076,7 +1135,7 @@ if(APPLE)
option(USE_APPLE_IDN "Use Apple built-in IDN support" OFF)
if(USE_APPLE_IDN)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES "icucore")
list(APPEND CMAKE_REQUIRED_LIBRARIES "icucore")
check_symbol_exists("uidna_openUTS46" "unicode/uidna.h" HAVE_APPLE_IDN)
cmake_pop_check_state()
if(HAVE_APPLE_IDN)
@ -1216,8 +1275,8 @@ if(CURL_USE_GSSAPI)
endif()
if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
set(CMAKE_REQUIRED_FLAGS ${GSS_CFLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${GSS_CFLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
curl_required_libpaths("${GSS_LIBRARY_DIRS}")
check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
endif()
@ -1282,7 +1341,7 @@ endif()
option(ENABLE_UNIX_SOCKETS "Enable Unix domain sockets support" ON)
if(ENABLE_UNIX_SOCKETS)
if(WIN32)
if(WIN32 OR DOS)
set(USE_UNIX_SOCKETS ON)
else()
include(CheckStructHasMember)
@ -1430,7 +1489,7 @@ check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file_concat_curl("sys/time.h" HAVE_SYS_TIME_H)
check_include_file_concat_curl("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file("sys/un.h" HAVE_SYS_UN_H)
check_include_file("sys/utime.h" HAVE_SYS_UTIME_H)
check_include_file_concat_curl("sys/utime.h" HAVE_SYS_UTIME_H) # sys/types.h (AmigaOS)
check_include_file("sys/xattr.h" HAVE_SYS_XATTR_H)
check_include_file_concat_curl("arpa/inet.h" HAVE_ARPA_INET_H)
@ -1458,7 +1517,7 @@ check_include_file("termios.h" HAVE_TERMIOS_H)
check_include_file_concat_curl("unistd.h" HAVE_UNISTD_H)
check_include_file("utime.h" HAVE_UTIME_H)
if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
if(AMIGA)
check_include_file_concat_curl("proto/bsdsocket.h" HAVE_PROTO_BSDSOCKET_H)
endif()
@ -1504,10 +1563,14 @@ if(SIZEOF_SUSECONDS_T)
endif()
# Check for some functions that are used
# Apply to all feature checks
if(WIN32)
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32") # Apply to all feature checks
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
elseif(HAVE_LIBSOCKET)
list(APPEND CMAKE_REQUIRED_LIBRARIES "socket") # Apply to all feature checks
list(APPEND CMAKE_REQUIRED_LIBRARIES "socket")
elseif(DOS)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${WATT_ROOT}/lib/libwatt.a")
endif()
check_function_exists("fnmatch" HAVE_FNMATCH)
@ -1544,6 +1607,7 @@ check_function_exists("utime" HAVE_UTIME)
check_symbol_exists("gmtime_r" "stdlib.h;time.h" HAVE_GMTIME_R)
check_symbol_exists("gethostbyname_r" "netdb.h" HAVE_GETHOSTBYNAME_R)
check_symbol_exists("gethostname" "${CURL_INCLUDES}" HAVE_GETHOSTNAME) # winsock2.h unistd.h proto/bsdsocket.h
check_symbol_exists("signal" "signal.h" HAVE_SIGNAL)
check_symbol_exists("strtoll" "stdlib.h" HAVE_STRTOLL)
@ -1568,7 +1632,7 @@ if(WIN32 OR CYGWIN)
check_function_exists("_setmode" HAVE__SETMODE)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "AmigaOS")
if(AMIGA)
check_symbol_exists("CloseSocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET_CAMEL) # sys/socket.h proto/bsdsocket.h
endif()
@ -1597,11 +1661,11 @@ endif()
cmake_push_check_state()
if(WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
check_type_size("ADDRESS_FAMILY" SIZEOF_ADDRESS_FAMILY)
set(HAVE_ADDRESS_FAMILY ${HAVE_SIZEOF_ADDRESS_FAMILY})
elseif(HAVE_SYS_SOCKET_H)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
list(APPEND 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})
endif()
@ -1635,7 +1699,7 @@ endforeach()
cmake_push_check_state()
if(HAVE_FILE_OFFSET_BITS)
set(_FILE_OFFSET_BITS 64)
set(CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
endif()
check_type_size("off_t" SIZEOF_OFF_T)
@ -1650,10 +1714,10 @@ endif()
# Include this header to get the type
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/include")
set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
list(APPEND CMAKE_REQUIRED_INCLUDES "${PROJECT_SOURCE_DIR}/include")
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "curl/system.h")
check_type_size("curl_off_t" SIZEOF_CURL_OFF_T)
set(CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "curl/curl.h")
check_type_size("curl_socket_t" SIZEOF_CURL_SOCKET_T)
cmake_pop_check_state() # pop curl system headers
cmake_pop_check_state() # pop -D_FILE_OFFSET_BITS=64
@ -1972,8 +2036,8 @@ message(STATUS "Features: ${SUPPORT_FEATURES}")
# Clear list and collect SSL backends
set(_items "")
curl_add_if("Schannel" _ssl_enabled AND USE_SCHANNEL)
curl_add_if("OpenSSL" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
curl_add_if("OpenSSL v3+" _ssl_enabled AND USE_OPENSSL AND NOT OPENSSL_VERSION VERSION_LESS 3.0.0)
curl_add_if("${_openssl}" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0)
curl_add_if("${_openssl} v3+" _ssl_enabled AND USE_OPENSSL AND NOT OPENSSL_VERSION VERSION_LESS 3.0.0)
curl_add_if("Secure Transport" _ssl_enabled AND USE_SECTRANSP)
curl_add_if("mbedTLS" _ssl_enabled AND USE_MBEDTLS)
curl_add_if("BearSSL" _ssl_enabled AND USE_BEARSSL)

View File

@ -38,10 +38,6 @@ vc-x64:
cd winbuild
nmake /f Makefile.vc MACHINE=x64
djgpp%:
$(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
$(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=i586-pc-msdosdjgpp-
cygwin:
./configure
make
@ -50,10 +46,6 @@ cygwin-ssl:
./configure --with-openssl
make
amiga%:
$(MAKE) -C lib -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
$(MAKE) -C src -f Makefile.mk CFG=$@ CROSSPREFIX=m68k-amigaos-
unix: all
unix-ssl: ssl

View File

@ -1563,6 +1563,8 @@ AC_DEFUN([CURL_PREPARE_BUILDINFO], [
fi
case $host_os in
msys*) curl_pflags="${curl_pflags} MSYS";;
msdos*) curl_pflags="${curl_pflags} DOS";;
amiga*) curl_pflags="${curl_pflags} AMIGA";;
esac
if test "x$compiler_id" = 'xGNU_C'; then
curl_pflags="${curl_pflags} GCC"

View File

@ -1214,12 +1214,19 @@ fi
if test "$HAVE_GETHOSTBYNAME" != "1"; then
dnl gethostbyname in the watt lib?
clean_CPPFLAGS=$CPPFLAGS
clean_LDFLAGS=$LDFLAGS
CPPFLAGS="-I${WATT_ROOT}/inc"
LDFLAGS="-L${WATT_ROOT}/lib"
AC_CHECK_LIB(watt, gethostbyname,
[
HAVE_GETHOSTBYNAME="1"
CPPFLAGS="-I${WATT_ROOT}/inc"
LDFLAGS="-L${WATT_ROOT}/lib"
LIBS="-lwatt $LIBS"
AC_DEFINE(USE_WATT32, 1, [if Watt-32 is in use])
],
[
CPPFLAGS=$clean_CPPFLAGS
LDFLAGS=$clean_LDFLAGS
]
)
fi
@ -1784,35 +1791,35 @@ AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
;;
esac ],
AC_RUN_IFELSE([AC_LANG_SOURCE([[
/* are AF_INET6 and sockaddr_in6 available? */
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#if defined (__TANDEM)
# include <netinet/in6.h>
#endif
#endif
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
/* are AF_INET6 and sockaddr_in6 available? */
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef __TANDEM
#include <netinet/in6.h>
#endif
#endif
int main(void)
{
struct sockaddr_in6 s;
(void)s;
return socket(AF_INET6, SOCK_STREAM, 0) < 0;
}
]])
int main(void)
{
struct sockaddr_in6 s;
(void)s;
return socket(AF_INET6, SOCK_STREAM, 0) < 0;
}
]])
],
AC_MSG_RESULT(yes)
ipv6=yes,
AC_MSG_RESULT(no)
ipv6=no,
AC_MSG_RESULT(yes)
ipv6=yes
))
AC_MSG_RESULT(yes)
ipv6=yes,
AC_MSG_RESULT(no)
ipv6=no
)
)
if test "$ipv6" = yes; then
curl_ipv6_msg="enabled"
@ -1820,24 +1827,26 @@ if test "$ipv6" = yes; then
IPV6_ENABLED=1
AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#if defined (__TANDEM)
# include <netinet/in6.h>
#endif
#endif
]], [[
struct sockaddr_in6 s;
s.sin6_scope_id = 0;
]])], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#ifdef __TANDEM
#include <netinet/in6.h>
#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
@ -4018,12 +4027,12 @@ AC_CHECK_TYPE([bool],[
# 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]),
AC_DEFINE(HAVE_SA_FAMILY_T, 1, [Define to 1 if symbol `sa_family_t' exists]),
[
# 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]),
AC_DEFINE(HAVE_ADDRESS_FAMILY, 1, [Define to 1 if symbol `ADDRESS_FAMILY' exists]),
[],
[
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN

View File

@ -182,8 +182,8 @@ assumes that CMake generates `Makefile`:
- `CURL_ENABLE_SSL`: Enable SSL support. Default: `ON`
- `CURL_WINDOWS_SSPI`: Enable SSPI on Windows. Default: =`CURL_USE_SCHANNEL`
- `ENABLE_IPV6`: Enable IPv6 support. Default: `ON`
- `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled
- `ENABLE_IPV6`: Enable IPv6 support. Default: `ON` if target supports IPv6.
- `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled and target supports threading.
- `ENABLE_UNICODE`: Use the Unicode version of the Windows API functions. Default: `OFF`
- `ENABLE_UNIX_SOCKETS`: Enable Unix domain sockets support. Default: `ON`
- `USE_ECH`: Enable ECH support. Default: `OFF`
@ -304,6 +304,9 @@ Details via CMake
## Dependency options
- `PERL_EXECUTABLE` Perl binary used throughout the build and tests.
- `AMISSL_INCLUDE_DIR`: The AmiSSL include directory.
- `AMISSL_STUBS_LIBRARY`: Path to `amisslstubs` library.
- `AMISSL_AUTO_LIBRARY`: Path to `amisslauto` library.
- `BEARSSL_INCLUDE_DIR`: The BearSSL include directory.
- `BEARSSL_LIBRARY`: Path to `bearssl` library.
- `BROTLI_INCLUDE_DIR`: The brotli include directory.
@ -345,6 +348,7 @@ Details via CMake
- `QUICHE_LIBRARY`: Path to `quiche` library.
- `RUSTLS_INCLUDE_DIR`: The Rustls include directory.
- `RUSTLS_LIBRARY`: Path to `rustls` library.
- `WATT_ROOT`: Set this variable to the root installation of Watt-32.
- `WOLFSSH_INCLUDE_DIR`: The wolfSSH include directory.
- `WOLFSSH_LIBRARY`: Path to `wolfssh` library.
- `WOLFSSL_INCLUDE_DIR`: The wolfSSL include directory.

View File

@ -211,17 +211,34 @@ Run `make`
## MS-DOS
Requires DJGPP in the search path and pointing to the Watt-32 stack via
`WATT_PATH=c:/djgpp/net/watt`.
You can use either autotools or cmake:
Run `make -f Makefile.dist djgpp` in the root curl dir.
./configure \
CC=/path/to/djgpp/bin/i586-pc-msdosdjgpp-gcc \
AR=/path/to/djgpp/bin/i586-pc-msdosdjgpp-ar \
RANLIB=/path/to/djgpp/bin/i586-pc-msdosdjgpp-ranlib \
WATT_ROOT=/path/to/djgpp/net/watt \
--host=i586-pc-msdosdjgpp \
--with-openssl=/path/to/djgpp \
--with-zlib=/path/to/djgpp \
--without-libpsl \
--disable-shared
For build configuration options, please see the mingw-w64 section.
cmake . \
-DCMAKE_SYSTEM_NAME=DOS \
-DCMAKE_C_COMPILER_TARGET=i586-pc-msdosdjgpp \
-DCMAKE_C_COMPILER=/path/to/djgpp/bin/i586-pc-msdosdjgpp-gcc \
-DWATT_ROOT=/path/to/djgpp/net/watt \
-DOPENSSL_INCLUDE_DIR=/path/to/djgpp/include \
-DOPENSSL_SSL_LIBRARY=/path/to/djgpp/lib/libssl.a \
-DOPENSSL_CRYPTO_LIBRARY=/path/to/djgpp/lib/libcrypto.a \
-DZLIB_INCLUDE_DIR=/path/to/djgpp/include \
-DZLIB_LIBRARY=/path/to/djgpp/lib/libz.a \
-DCURL_USE_LIBPSL=OFF
Notes:
- DJGPP 2.04 beta has a `sscanf()` bug so the URL parsing is not done
properly. Use DJGPP 2.03 until they fix it.
- Requires DJGPP 2.04 or upper.
- Compile Watt-32 (and OpenSSL) with the same version of DJGPP. Otherwise
things go wrong because things like FS-extensions and `errno` values have
@ -229,9 +246,31 @@ Notes:
## AmigaOS
Run `make -f Makefile.dist amiga` in the root curl dir.
You can use either autotools or cmake:
For build configuration options, please see the mingw-w64 section.
./configure \
CC=/opt/amiga/bin/m68k-amigaos-gcc \
AR=/opt/amiga/bin/m68k-amigaos-ar \
RANLIB=/opt/amiga/bin/m68k-amigaos-ranlib \
--host=m68k-amigaos \
--with-amissl \
CFLAGS='-O0 -msoft-float -mcrt=clib2' \
CPPFLAGS=-I/path/to/AmiSSL/Developer/include \
LDFLAGS=-L/path/to/AmiSSL/Developer/lib/AmigaOS3 \
LIBS='-lnet -lm -latomic' \
--without-libpsl \
--disable-shared
cmake . \
-DAMIGA=1 \
-DCMAKE_SYSTEM_NAME=Generic \
-DCMAKE_C_COMPILER_TARGET=m68k-unknown-amigaos \
-DCMAKE_C_COMPILER=/opt/amiga/bin/m68k-amigaos-gcc \
-DCMAKE_C_FLAGS='-O0 -msoft-float -mcrt=clib2' \
-DAMISSL_INCLUDE_DIR=/path/to/AmiSSL/Developer/include \
-DAMISSL_STUBS_LIBRARY=/path/to/AmiSSL/Developer/lib/AmigaOS3/libamisslstubs.a \
-DAMISSL_AUTO_LIBRARY=/path/to/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a \
-DCURL_USE_LIBPSL=OFF
## Disabling Specific Protocols in Windows builds

View File

@ -24,7 +24,7 @@
AUTOMAKE_OPTIONS = foreign nostdinc
EXTRA_DIST = README.md Makefile.example Makefile.mk CMakeLists.txt \
EXTRA_DIST = README.md Makefile.example CMakeLists.txt \
$(COMPLICATED_EXAMPLES) .checksrc
# Specify our include paths here, and do it relative to $(top_srcdir) and

View File

@ -1,52 +0,0 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# 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.
#
# SPDX-License-Identifier: curl
#
#***************************************************************************
# Build libcurl via lib/Makefile.mk first.
PROOT := ../..
### Common
include $(PROOT)/lib/Makefile.mk
### Local
CPPFLAGS += -DCURL_NO_OLDIES
LDFLAGS += -L$(PROOT)/lib
LIBS := -lcurl $(LIBS)
### Sources and targets
# Provides check_PROGRAMS
include Makefile.inc
TARGETS := $(patsubst %,%$(BIN_EXT),$(strip $(check_PROGRAMS)))
TOCLEAN := $(TARGETS)
### Rules
%$(BIN_EXT): %.c $(PROOT)/lib/libcurl.a
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ $(LIBS)
all: $(TARGETS)

View File

@ -28,14 +28,14 @@
#include <stdio.h>
#include <curl/curl.h>
#ifndef _WIN32
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__AMIGA__)
#include <net/if.h>
#endif
int main(void)
{
#ifndef _WIN32
/* Windows users need to find how to use if_nametoindex() */
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__AMIGA__)
/* Windows/MS-DOS users need to find how to use if_nametoindex() */
CURL *curl;
CURLcode res;

View File

@ -100,11 +100,19 @@ int main(void)
curl_multi_timeout(multi_handle, &curl_timeo);
if(curl_timeo >= 0) {
#if defined(MSDOS) || defined(__AMIGA__)
timeout.tv_sec = (time_t)(curl_timeo / 1000);
#else
timeout.tv_sec = curl_timeo / 1000;
#endif
if(timeout.tv_sec > 1)
timeout.tv_sec = 1;
else
#if defined(MSDOS) || defined(__AMIGA__)
timeout.tv_usec = (time_t)(curl_timeo % 1000) * 1000;
#else
timeout.tv_usec = (int)(curl_timeo % 1000) * 1000;
#endif
}
/* get file descriptors from the transfers */
@ -127,7 +135,8 @@ int main(void)
rc = 0;
#else
/* Portable sleep for platforms other than Windows. */
struct timeval wait = { 0, 100 * 1000 }; /* 100ms */
struct timeval wait = {0};
wait.tv_usec = 100 * 1000; /* 100ms */
rc = select(0, NULL, NULL, NULL, &wait);
#endif
}

View File

@ -37,8 +37,13 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms)
fd_set infd, outfd, errfd;
int res;
#if defined(MSDOS) || defined(__AMIGA__)
tv.tv_sec = (time_t)(timeout_ms / 1000);
tv.tv_usec = (time_t)(timeout_ms % 1000) * 1000;
#else
tv.tv_sec = timeout_ms / 1000;
tv.tv_usec = (int)(timeout_ms % 1000) * 1000;
#endif
FD_ZERO(&infd);
FD_ZERO(&outfd);
@ -51,6 +56,9 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms)
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#if defined(__DJGPP__)
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4127) /* conditional expression is constant */

View File

@ -28,9 +28,9 @@ CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
CHECKSRC_DIST = .checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc \
vtls/.checksrc
EXTRA_DIST = Makefile.mk config-win32.h config-win32ce.h config-plan9.h \
config-riscos.h config-mac.h curl_config.h.in config-dos.h libcurl.rc \
config-amigaos.h config-win32ce.h config-os400.h setup-os400.h \
EXTRA_DIST = config-win32.h config-win32ce.h config-plan9.h \
config-riscos.h config-mac.h curl_config.h.in libcurl.rc \
config-win32ce.h config-os400.h setup-os400.h \
$(CMAKE_DIST) setup-win32.h Makefile.soname optiontable.pl libcurl.def \
$(CHECKSRC_DIST)

View File

@ -1,340 +0,0 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# 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.
#
# SPDX-License-Identifier: curl
#
#***************************************************************************
# Makefile to build curl parts with GCC-like toolchains and optional features.
#
# Usage: make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...]
# Example: make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6
#
# Look for ' ?=' to find accepted customization variables.
# This script is reused by 'src' and 'docs/examples' Makefile.mk scripts.
ifndef PROOT
PROOT := ..
LOCAL := 1
endif
### Common
CFLAGS ?=
CPPFLAGS ?=
LDFLAGS ?=
LIBS ?=
CROSSPREFIX ?=
ifeq ($(CC),cc)
CC := gcc
endif
CC := $(CROSSPREFIX)$(CC)
AR := $(CROSSPREFIX)$(AR)
TRIPLET ?= $(shell $(CC) -dumpmachine)
BIN_EXT :=
ifneq ($(findstring msdos,$(TRIPLET)),)
# Cross-tools: https://github.com/andrewwutw/build-djgpp
MSDOS := 1
BIN_EXT := .exe
else ifneq ($(findstring amigaos,$(TRIPLET)),)
# Cross-tools: https://github.com/bebbo/amiga-gcc
AMIGA := 1
endif
CPPFLAGS += -I. -I$(PROOT)/include
### Deprecated settings. For compatibility.
ifdef WATT_ROOT
WATT_PATH := $(realpath $(WATT_ROOT))
endif
### Optional features
ifneq ($(findstring -debug,$(CFG)),)
CFLAGS += -g
CPPFLAGS += -DDEBUGBUILD
else
CPPFLAGS += -DNDEBUG
endif
ifneq ($(findstring -trackmem,$(CFG)),)
CPPFLAGS += -DCURLDEBUG
endif
ifneq ($(findstring -map,$(CFG)),)
MAP := 1
endif
# CPPFLAGS below are only necessary when building libcurl via 'lib' (see
# comments below about exceptions). Always include them anyway to match
# behavior of other build systems.
ifneq ($(findstring -sync,$(CFG)),)
CPPFLAGS += -DUSE_SYNC_DNS
else ifneq ($(findstring -ares,$(CFG)),)
LIBCARES_PATH ?= $(PROOT)/../c-ares
CPPFLAGS += -DUSE_ARES
CPPFLAGS += -isystem "$(LIBCARES_PATH)/include"
LDFLAGS += -L"$(LIBCARES_PATH)/lib"
LIBS += -lcares
endif
ifneq ($(findstring -rtmp,$(CFG)),)
LIBRTMP_PATH ?= $(PROOT)/../librtmp
CPPFLAGS += -DUSE_LIBRTMP
CPPFLAGS += -isystem "$(LIBRTMP_PATH)"
LDFLAGS += -L"$(LIBRTMP_PATH)/librtmp"
LIBS += -lrtmp
ZLIB := 1
endif
ifneq ($(findstring -ssh2,$(CFG)),)
LIBSSH2_PATH ?= $(PROOT)/../libssh2
CPPFLAGS += -DUSE_LIBSSH2
CPPFLAGS += -isystem "$(LIBSSH2_PATH)/include"
LDFLAGS += -L"$(LIBSSH2_PATH)/lib"
LIBS += -lssh2
else ifneq ($(findstring -libssh,$(CFG)),)
LIBSSH_PATH ?= $(PROOT)/../libssh
CPPFLAGS += -DUSE_LIBSSH
CPPFLAGS += -isystem "$(LIBSSH_PATH)/include"
LDFLAGS += -L"$(LIBSSH_PATH)/lib"
LIBS += -lssh
else ifneq ($(findstring -wolfssh,$(CFG)),)
WOLFSSH_PATH ?= $(PROOT)/../wolfssh
CPPFLAGS += -DUSE_WOLFSSH
CPPFLAGS += -isystem "$(WOLFSSH_PATH)/include"
LDFLAGS += -L"$(WOLFSSH_PATH)/lib"
LIBS += -lwolfssh
endif
ifneq ($(findstring -ssl,$(CFG)),)
OPENSSL_PATH ?= $(PROOT)/../openssl
CPPFLAGS += -DUSE_OPENSSL
CPPFLAGS += -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include
OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib
CPPFLAGS += -isystem "$(OPENSSL_INCLUDE)"
LDFLAGS += -L"$(OPENSSL_LIBPATH)"
OPENSSL_LIBS ?= -lssl -lcrypto
LIBS += $(OPENSSL_LIBS)
ifneq ($(findstring -srp,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h),)
# OpenSSL 1.0.1 and later.
CPPFLAGS += -DHAVE_OPENSSL_SRP -DUSE_TLS_SRP
endif
endif
SSLLIBS += 1
endif
ifneq ($(findstring -wolfssl,$(CFG)),)
WOLFSSL_PATH ?= $(PROOT)/../wolfssl
CPPFLAGS += -DUSE_WOLFSSL
CPPFLAGS += -DSIZEOF_LONG_LONG=8
CPPFLAGS += -isystem "$(WOLFSSL_PATH)/include"
LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
LIBS += -lwolfssl
SSLLIBS += 1
endif
ifneq ($(findstring -mbedtls,$(CFG)),)
MBEDTLS_PATH ?= $(PROOT)/../mbedtls
CPPFLAGS += -DUSE_MBEDTLS
CPPFLAGS += -isystem "$(MBEDTLS_PATH)/include"
LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
SSLLIBS += 1
endif
ifneq ($(findstring -bearssl,$(CFG)),)
BEARSSL_PATH ?= $(PROOT)/../bearssl
CPPFLAGS += -DUSE_BEARSSL
CPPFLAGS += -isystem "$(BEARSSL_PATH)/inc"
LDFLAGS += -L"$(BEARSSL_PATH)/build"
LIBS += -lbearssl
SSLLIBS += 1
endif
ifneq ($(findstring -nghttp2,$(CFG)),)
NGHTTP2_PATH ?= $(PROOT)/../nghttp2
CPPFLAGS += -DUSE_NGHTTP2
CPPFLAGS += -isystem "$(NGHTTP2_PATH)/include"
LDFLAGS += -L"$(NGHTTP2_PATH)/lib"
LIBS += -lnghttp2
endif
ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2)
NGHTTP3_PATH ?= $(PROOT)/../nghttp3
CPPFLAGS += -DUSE_NGHTTP3
CPPFLAGS += -isystem "$(NGHTTP3_PATH)/include"
LDFLAGS += -L"$(NGHTTP3_PATH)/lib"
LIBS += -lnghttp3
NGTCP2_PATH ?= $(PROOT)/../ngtcp2
CPPFLAGS += -DUSE_NGTCP2
CPPFLAGS += -isystem "$(NGTCP2_PATH)/include"
LDFLAGS += -L"$(NGTCP2_PATH)/lib"
NGTCP2_LIBS ?=
ifeq ($(NGTCP2_LIBS),)
ifneq ($(findstring -ssl,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/aead.h),)
NGTCP2_LIBS := -lngtcp2_crypto_boringssl
else # including libressl
NGTCP2_LIBS := -lngtcp2_crypto_quictls
endif
else ifneq ($(findstring -wolfssl,$(CFG)),)
NGTCP2_LIBS := -lngtcp2_crypto_wolfssl
endif
endif
LIBS += -lngtcp2 $(NGTCP2_LIBS)
endif
ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
ZLIB_PATH ?= $(PROOT)/../zlib
# These CPPFLAGS are also required when compiling the curl tool via 'src'.
CPPFLAGS += -DHAVE_LIBZ
CPPFLAGS += -isystem "$(ZLIB_PATH)/include"
LDFLAGS += -L"$(ZLIB_PATH)/lib"
ZLIB_LIBS ?= -lz
LIBS += $(ZLIB_LIBS)
ZLIB := 1
endif
ifneq ($(findstring -zstd,$(CFG)),)
ZSTD_PATH ?= $(PROOT)/../zstd
CPPFLAGS += -DHAVE_ZSTD
CPPFLAGS += -isystem "$(ZSTD_PATH)/include"
LDFLAGS += -L"$(ZSTD_PATH)/lib"
ZSTD_LIBS ?= -lzstd
LIBS += $(ZSTD_LIBS)
endif
ifneq ($(findstring -brotli,$(CFG)),)
BROTLI_PATH ?= $(PROOT)/../brotli
CPPFLAGS += -DHAVE_BROTLI
CPPFLAGS += -isystem "$(BROTLI_PATH)/include"
LDFLAGS += -L"$(BROTLI_PATH)/lib"
BROTLI_LIBS ?= -lbrotlidec -lbrotlicommon
LIBS += $(BROTLI_LIBS)
endif
ifneq ($(findstring -gsasl,$(CFG)),)
LIBGSASL_PATH ?= $(PROOT)/../gsasl
CPPFLAGS += -DUSE_GSASL
CPPFLAGS += -isystem "$(LIBGSASL_PATH)/include"
LDFLAGS += -L"$(LIBGSASL_PATH)/lib"
LIBS += -lgsasl
endif
ifneq ($(findstring -idn2,$(CFG)),)
LIBIDN2_PATH ?= $(PROOT)/../libidn2
CPPFLAGS += -DHAVE_LIBIDN2 -DHAVE_IDN2_H
CPPFLAGS += -isystem "$(LIBIDN2_PATH)/include"
LDFLAGS += -L"$(LIBIDN2_PATH)/lib"
LIBS += -lidn2
ifneq ($(findstring -psl,$(CFG)),)
LIBPSL_PATH ?= $(PROOT)/../libpsl
CPPFLAGS += -DUSE_LIBPSL
CPPFLAGS += -isystem "$(LIBPSL_PATH)/include"
LDFLAGS += -L"$(LIBPSL_PATH)/lib"
LIBS += -lpsl
endif
endif
ifneq ($(findstring -ipv6,$(CFG)),)
CPPFLAGS += -DUSE_IPV6
endif
ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
WATT_PATH ?= $(PROOT)/../watt
CPPFLAGS += -isystem "$(WATT_PATH)/inc"
LDFLAGS += -L"$(WATT_PATH)/lib"
LIBS += -lwatt
endif
ifneq ($(findstring 11,$(subst $(subst ,, ),,$(SSLLIBS))),)
CPPFLAGS += -DCURL_WITH_MULTI_SSL
endif
### Common rules
OBJ_DIR := $(TRIPLET)
ifneq ($(findstring /sh,$(SHELL)),)
DEL = rm -f $1
COPY = -cp -afv $1 $2
MKDIR = mkdir -p $1
RMDIR = rm -fr $1
else
DEL = -del 2>NUL /q /f $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
MKDIR = -md 2>NUL $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
endif
all: $(TARGETS)
$(OBJ_DIR):
-$(call MKDIR, $(OBJ_DIR))
$(OBJ_DIR)/%.o: %.c
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@
clean:
@$(call DEL, $(TOCLEAN))
@$(RMDIR) $(OBJ_DIR)
distclean vclean: clean
@$(call DEL, $(TARGETS) $(TOVCLEAN))
### Local
ifdef LOCAL
CPPFLAGS += -DBUILDING_LIBCURL
### Sources and targets
# Provides CSOURCES, HHEADERS
include Makefile.inc
vpath %.c vauth vquic vssh vtls
libcurl_a_LIBRARY := libcurl.a
TARGETS := $(libcurl_a_LIBRARY)
libcurl_a_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(strip $(CSOURCES))))
libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
TOCLEAN :=
TOVCLEAN :=
### Rules
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@$(call DEL, $@)
$(AR) rcs $@ $(libcurl_a_OBJECTS)
all: $(OBJ_DIR) $(TARGETS)
endif

View File

@ -196,12 +196,11 @@ int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
*/
struct Library *SocketBase = NULL;
extern int errno, h_errno;
#ifdef __libnix__
void __request(const char *msg);
#else
# define __request(msg) Printf(msg "\n\a")
# define __request(msg) Printf((const unsigned char *)(msg "\n\a"), 0)
#endif
void Curl_amiga_cleanup(void)
@ -215,7 +214,7 @@ void Curl_amiga_cleanup(void)
CURLcode Curl_amiga_init(void)
{
if(!SocketBase)
SocketBase = OpenLibrary("bsdsocket.library", 4);
SocketBase = OpenLibrary((const unsigned char *)"bsdsocket.library", 4);
if(!SocketBase) {
__request("No TCP/IP Stack running!");

View File

@ -1,127 +0,0 @@
#ifndef HEADER_CURL_CONFIG_AMIGAOS_H
#define HEADER_CURL_CONFIG_AMIGAOS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* 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.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
/* Hand crafted config file for AmigaOS */
/* ================================================================ */
#ifdef __AMIGA__ /* Any AmigaOS flavour */
#define HAVE_ARPA_INET_H 1
#define HAVE_CLOSESOCKET_CAMEL 1
#define HAVE_IOCTLSOCKET_CAMEL 1
#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1
#define HAVE_LONGLONG 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NET_IF_H 1
#define HAVE_PWD_H 1
#define HAVE_SELECT 1
#define HAVE_SIGNAL 1
#define HAVE_SOCKET 1
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1
#define HAVE_STRICMP 1
#define HAVE_STRINGS_H 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOCKIO_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_WRITABLE_ARGV 1
#define HAVE_SYS_IOCTL_H 1
#define SIZEOF_INT 4
#define SIZEOF_SIZE_T 4
#ifndef SIZEOF_CURL_OFF_T
#define SIZEOF_CURL_OFF_T 8
#endif
#define USE_MANUAL 1
#define CURL_DISABLE_LDAP 1
#ifndef CURL_OS
#define CURL_OS "AmigaOS"
#endif
#define PACKAGE "curl"
#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
#define PACKAGE_NAME "curl"
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
#if defined(USE_AMISSL)
#define CURL_CA_PATH "AmiSSL:Certs"
#elif defined(__MORPHOS__)
#define CURL_CA_BUNDLE "MOSSYS:Data/SSL/curl-ca-bundle.crt"
#else
#define CURL_CA_BUNDLE "s:curl-ca-bundle.crt"
#endif
#define STDC_HEADERS 1
#define in_addr_t int
#ifndef F_OK
# define F_OK 0
#endif
#ifndef O_RDONLY
# define O_RDONLY 0x0000
#endif
#ifndef LONG_MAX
# define LONG_MAX 0x7fffffffL
#endif
#ifndef LONG_MIN
# define LONG_MIN (-0x7fffffffL-1)
#endif
#define HAVE_RECV 1
#define RECV_TYPE_ARG1 long
#define RECV_TYPE_ARG2 char *
#define RECV_TYPE_ARG3 long
#define RECV_TYPE_ARG4 long
#define RECV_TYPE_RETV long
#define HAVE_SEND 1
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
#define SEND_TYPE_ARG2 char *
#define SEND_TYPE_ARG3 int
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV int
#endif /* __AMIGA__ */
#endif /* HEADER_CURL_CONFIG_AMIGAOS_H */

View File

@ -1,136 +0,0 @@
#ifndef HEADER_CURL_CONFIG_DOS_H
#define HEADER_CURL_CONFIG_DOS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* 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.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
/* lib/config-dos.h - Hand crafted config file for DOS */
/* ================================================================ */
#ifndef CURL_OS
#if defined(DJGPP)
#define CURL_OS "MSDOS/djgpp"
#elif defined(__HIGHC__)
#define CURL_OS "MSDOS/HighC"
#else
#define CURL_OS "MSDOS/?"
#endif
#endif
#define PACKAGE "curl"
#define USE_MANUAL 1
#define HAVE_ARPA_INET_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FREEADDRINFO 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_IO_H 1
#define HAVE_IOCTL_FIONBIO 1
#define HAVE_IOCTLSOCKET 1
#define HAVE_IOCTLSOCKET_FIONBIO 1
#define HAVE_LOCALE_H 1
#define HAVE_LONGLONG 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETINET_TCP_H 1
#define HAVE_NET_IF_H 1
#define HAVE_RECV 1
#define HAVE_SELECT 1
#define HAVE_SEND 1
#define HAVE_SETLOCALE 1
#define HAVE_SETMODE 1
#define HAVE_SIGNAL 1
#define HAVE_SOCKET 1
#define HAVE_STRDUP 1
#define HAVE_STRICMP 1
#define HAVE_STRTOLL 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_SIZE_T 4
#define SIZEOF_CURL_OFF_T 8
#define STDC_HEADERS 1
/* Qualifiers for send() and recv() */
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
#define SEND_TYPE_ARG2 void *
#define SEND_TYPE_ARG3 int
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV int
#define RECV_TYPE_ARG1 int
#define RECV_TYPE_ARG2 void *
#define RECV_TYPE_ARG3 int
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV int
#define BSD
/* CURLDEBUG definition enables memory tracking */
/* #define CURLDEBUG */
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
#define in_addr_t u_long
#if defined(__HIGHC__) || \
(defined(__GNUC__) && (__GNUC__ < 4))
#define ssize_t int
#endif
/* Target HAVE_x section */
#if defined(DJGPP)
#define HAVE_BASENAME 1
#define HAVE_STRCASECMP 1
#define HAVE_SIGACTION 1
#define HAVE_SIGSETJMP 1
#define HAVE_SYS_TIME_H 1
#define HAVE_TERMIOS_H 1
#elif defined(__HIGHC__)
#define HAVE_SYS_TIME_H 1
#define strerror(e) strerror_s_((e))
#endif
#ifdef MSDOS /* Watt-32 */
#define HAVE_CLOSE_S 1
#endif
#undef word
#undef byte
#endif /* HEADER_CURL_CONFIG_DOS_H */

View File

@ -318,11 +318,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr->sin_addr, curr, sizeof(struct in_addr));
#ifdef __MINGW32__
addr->sin_family = (short)(he->h_addrtype);
#else
addr->sin_family = (CURL_SA_FAMILY_T)(he->h_addrtype);
#endif
addr->sin_port = htons((unsigned short)port);
break;
@ -331,11 +327,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr6 = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr));
#ifdef __MINGW32__
addr6->sin6_family = (short)(he->h_addrtype);
#else
addr6->sin6_family = (CURL_SA_FAMILY_T)(he->h_addrtype);
#endif
addr6->sin6_port = htons((unsigned short)port);
break;
#endif

View File

@ -736,6 +736,9 @@ ${SIZEOF_TIME_T_CODE}
/* if OpenSSL is in use */
#cmakedefine USE_OPENSSL 1
/* if AmiSSL is in use */
#cmakedefine USE_AMISSL 1
/* if librtmp/rtmpdump is in use */
#cmakedefine USE_LIBRTMP 1
@ -785,6 +788,9 @@ ${SIZEOF_TIME_T_CODE}
/* to enable Windows SSL */
#cmakedefine USE_SCHANNEL 1
/* if Watt-32 is in use */
#cmakedefine USE_WATT32 1
/* enable multiple SSL backends */
#cmakedefine CURL_WITH_MULTI_SSL 1

View File

@ -73,7 +73,11 @@ int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
#else /* DEBUGBUILD */
name[0] = '\0';
#ifdef __AMIGA__
err = gethostname((unsigned char *)name, namelen);
#else
err = gethostname(name, namelen);
#endif
#endif

View File

@ -149,10 +149,6 @@
# include "config-riscos.h"
#endif
#ifdef __AMIGA__
# include "config-amigaos.h"
#endif
#ifdef __OS400__
# include "config-os400.h"
#endif
@ -161,10 +157,6 @@
# include "config-plan9.h"
#endif
#ifdef MSDOS
# include "config-dos.h"
#endif
#endif /* HAVE_CONFIG_H */
/* ================================================================ */
@ -491,6 +483,14 @@
FILE *curlx_win32_fopen(const char *filename, const char *mode);
#endif
#ifdef __DJGPP__
/* Requires DJGPP 2.04 */
# include <unistd.h>
# undef lseek
# define lseek(fdes,offset,whence) llseek(fdes, offset, whence)
# define LSEEK_ERROR (offset_t)-1
#endif
/*
* Small file (<2Gb) support using Win32 functions.
*/
@ -908,6 +908,8 @@ endings either CRLF or LF so 't' is appropriate.
# define CURL_SA_FAMILY_T sa_family_t
# elif defined(HAVE_ADDRESS_FAMILY)
# define CURL_SA_FAMILY_T ADDRESS_FAMILY
# elif defined(__AMIGA__)
# define CURL_SA_FAMILY_T unsigned char
# else
/* use a sensible default */
# define CURL_SA_FAMILY_T unsigned short

View File

@ -187,7 +187,7 @@ struct timeval {
# define sclose(x) closesocket((x))
#elif defined(HAVE_CLOSESOCKET_CAMEL)
# define sclose(x) CloseSocket((x))
#elif defined(HAVE_CLOSE_S)
#elif defined(MSDOS) /* Watt-32 */
# define sclose(x) close_s((x))
#elif defined(USE_LWIPSOCK)
# define sclose(x) lwip_close((x))

View File

@ -961,11 +961,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname,
addr = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in_addr) == sizeof(de->addr[i].ip.v4));
memcpy(&addr->sin_addr, &de->addr[i].ip.v4, sizeof(struct in_addr));
#ifdef __MINGW32__
addr->sin_family = (short)addrtype;
#else
addr->sin_family = addrtype;
#endif
addr->sin_family = (CURL_SA_FAMILY_T)addrtype;
addr->sin_port = htons((unsigned short)port);
break;
@ -974,11 +970,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname,
addr6 = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6));
memcpy(&addr6->sin6_addr, &de->addr[i].ip.v6, sizeof(struct in6_addr));
#ifdef __MINGW32__
addr6->sin6_family = (short)addrtype;
#else
addr6->sin6_family = addrtype;
#endif
addr6->sin6_family = (CURL_SA_FAMILY_T)addrtype;
addr6->sin6_port = htons((unsigned short)port);
break;
#endif

View File

@ -553,8 +553,13 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
if(data->state.resume_from) {
if(!S_ISDIR(statbuf.st_mode)) {
#ifdef __AMIGA__
if(data->state.resume_from !=
lseek(fd, (off_t)data->state.resume_from, SEEK_SET))
#else
if(data->state.resume_from !=
lseek(fd, data->state.resume_from, SEEK_SET))
#endif
return CURLE_BAD_DOWNLOAD_RESUME;
}
else {

View File

@ -2079,10 +2079,19 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
/* If we asked for a time of the file and we actually got one as well,
we "emulate" an HTTP-style header in our output. */
#if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__))
#pragma GCC diagnostic push
/* 'time_t' is unsigned in MSDOS and AmigaOS. Silence:
warning: comparison of unsigned expression in '>= 0' is always true */
#pragma GCC diagnostic ignored "-Wtype-limits"
#endif
if(data->req.no_body &&
ftpc->file &&
data->set.get_filetime &&
(data->info.filetime >= 0) ) {
#if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__))
#pragma GCC diagnostic pop
#endif
char headerbuf[128];
int headerbuflen;
time_t filetime = data->info.filetime;

View File

@ -62,6 +62,7 @@
/* int send(int, const char *, int, int); */
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2
#define SEND_TYPE_ARG2 char *
#define SEND_TYPE_ARG3 int
#define SEND_TYPE_RETV int

View File

@ -238,8 +238,10 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
case CURLINFO_FILETIME:
if(data->info.filetime > LONG_MAX)
*param_longp = LONG_MAX;
#if !defined(MSDOS) && !defined(__AMIGA__)
else if(data->info.filetime < LONG_MIN)
*param_longp = LONG_MIN;
#endif
else
*param_longp = (long)data->info.filetime;
break;

View File

@ -198,7 +198,7 @@ hostcache_entry_is_stale(void *datap, void *hc)
if(dns->timestamp) {
/* age in seconds */
time_t age = prune->now - dns->timestamp;
if(age >= prune->max_age_sec)
if(age >= (time_t)prune->max_age_sec)
return TRUE;
if(age > prune->oldest)
prune->oldest = age;
@ -541,7 +541,9 @@ static struct Curl_addrinfo *get_localhost6(int port, const char *name)
sa6.sin6_family = AF_INET6;
sa6.sin6_port = htons(port16);
sa6.sin6_flowinfo = 0;
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
sa6.sin6_scope_id = 0;
#endif
(void)Curl_inet_pton(AF_INET6, "::1", ipv6);
memcpy(&sa6.sin6_addr, ipv6, sizeof(ipv6));

View File

@ -2903,7 +2903,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
(void)curlx_strtoofft(v, NULL, 10, &retry_after);
if(!retry_after) {
time_t date = Curl_getdate_capped(v);
if(-1 != date)
if((time_t)-1 != date)
/* convert date to number of seconds into the future */
retry_after = date - time(NULL);
}

View File

@ -35,6 +35,10 @@ char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
#ifdef _WIN32
#define Curl_inet_ntop(af,addr,buf,size) \
inet_ntop(af, addr, buf, size)
#elif defined(__AMIGA__)
#define Curl_inet_ntop(af,addr,buf,size) \
(char *)inet_ntop(af, (void *)addr, (unsigned char *)buf, \
(curl_socklen_t)(size))
#else
#define Curl_inet_ntop(af,addr,buf,size) \
inet_ntop(af, addr, buf, (curl_socklen_t)(size))

View File

@ -32,7 +32,11 @@ int Curl_inet_pton(int, const char *, void *);
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#if defined(__AMIGA__)
#define Curl_inet_pton(x,y,z) inet_pton(x,(unsigned char *)y,z)
#else
#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)
#endif
#endif
#endif /* HEADER_CURL_INET_PTON_H */

View File

@ -1170,10 +1170,17 @@ CURLMcode curl_multi_fdset(CURLM *m,
if(!FDSET_SOCK(data->last_poll.sockets[i]))
/* pretend it does not exist */
continue;
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
if(data->last_poll.actions[i] & CURL_POLL_IN)
FD_SET(data->last_poll.sockets[i], read_fd_set);
if(data->last_poll.actions[i] & CURL_POLL_OUT)
FD_SET(data->last_poll.sockets[i], write_fd_set);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if((int)data->last_poll.sockets[i] > this_max_fd)
this_max_fd = (int)data->last_poll.sockets[i];
}

View File

@ -26,7 +26,9 @@
#ifndef CURL_DISABLE_NETRC
#ifdef HAVE_PWD_H
#undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */
#include <pwd.h>
#define __NO_NET_API
#endif
#include <curl/curl.h>

View File

@ -63,6 +63,12 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
flags &= ~O_NONBLOCK;
return sfcntl(sockfd, F_SETFL, flags);
#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
/* Amiga */
long flags = nonblock ? 1L : 0L;
return IoctlSocket(sockfd, FIONBIO, (char *)&flags);
#elif defined(HAVE_IOCTL_FIONBIO)
/* older Unix versions */
@ -75,12 +81,6 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
unsigned long flags = nonblock ? 1UL : 0UL;
return ioctlsocket(sockfd, (long)FIONBIO, &flags);
#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
/* Amiga */
long flags = nonblock ? 1L : 0L;
return IoctlSocket(sockfd, FIONBIO, (char *)&flags);
#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
/* Orbis OS */

View File

@ -558,7 +558,7 @@ static int parsedate(const char *date, time_t *output)
if(tzoff == -1)
tzoff = 0;
if((tzoff > 0) && (t > TIME_T_MAX - tzoff)) {
if((tzoff > 0) && (t > (time_t)(TIME_T_MAX - tzoff))) {
*output = TIME_T_MAX;
return PARSEDATE_LATER; /* time_t overflow */
}
@ -586,7 +586,7 @@ time_t curl_getdate(const char *p, const time_t *now)
(void)now; /* legacy argument from the past that we ignore */
if(rc == PARSEDATE_OK) {
if(parsed == -1)
if(parsed == (time_t)-1)
/* avoid returning -1 for a working scenario */
parsed++;
return parsed;
@ -606,7 +606,7 @@ time_t Curl_getdate_capped(const char *p)
switch(rc) {
case PARSEDATE_OK:
if(parsed == -1)
if(parsed == (time_t)-1)
/* avoid returning -1 for a working scenario */
parsed++;
return parsed;

View File

@ -78,7 +78,7 @@ int Curl_wait_ms(timediff_t timeout_ms)
return -1;
}
#if defined(MSDOS)
delay(timeout_ms);
delay((unsigned int)timeout_ms);
#elif defined(_WIN32)
/* prevent overflow, timeout_ms is typecast to ULONG/DWORD. */
#if TIMEDIFF_T_MAX >= ULONG_MAX

View File

@ -524,7 +524,7 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
not have a size_t argument, like older unixes that want an 'int' */
senddata = sendto(state->sockfd, (void *)state->spacket.data,
(SEND_TYPE_ARG3)sbytes, 0,
&data->conn->remote_addr->curl_sa_addr,
(struct sockaddr *)&data->conn->remote_addr->curl_sa_addr,
(curl_socklen_t)data->conn->remote_addr->addrlen);
if(senddata != (ssize_t)sbytes) {
char buffer[STRERROR_LEN];

View File

@ -50,6 +50,7 @@ if test "$HAVE_PROTO_BSDSOCKET_H" = "1"; then
check_for_ca_bundle=1
with_ca_fallback=yes
LIBS="-lamisslstubs -lamisslauto $LIBS"
CURL_NETWORK_AND_TIME_LIBS="-lamisslstubs -lamisslauto $CURL_NETWORK_AND_TIME_LIBS"
AC_DEFINE(USE_AMISSL, 1, [if AmiSSL is in use])
AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use])
AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \

View File

@ -43,9 +43,20 @@ AS_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]),
dnl --disable-threaded-resolver option used
want_thres="no"
;;
yes)
dnl --enable-threaded-resolver option used
want_thres="yes"
;;
*)
dnl configure option not specified
want_thres="yes"
case $host_os in
msdos* | amiga*)
want_thres="no"
;;
*)
want_thres="yes"
;;
esac
;;
esac
AC_MSG_RESULT([$want_thres])

View File

@ -742,7 +742,6 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
#
tst_links_closesocket_camel="unknown"
tst_proto_closesocket_camel="unknown"
tst_compi_closesocket_camel="unknown"
tst_allow_closesocket_camel="unknown"
#
@ -764,20 +763,6 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
])
#
if test "$tst_links_closesocket_camel" = "yes"; then
AC_MSG_CHECKING([if CloseSocket is prototyped])
AC_EGREP_CPP([CloseSocket],[
$curl_includes_bsdsocket
$curl_includes_sys_socket
],[
AC_MSG_RESULT([yes])
tst_proto_closesocket_camel="yes"
],[
AC_MSG_RESULT([no])
tst_proto_closesocket_camel="no"
])
fi
#
if test "$tst_proto_closesocket_camel" = "yes"; then
AC_MSG_CHECKING([if CloseSocket is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
@ -809,7 +794,6 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
#
AC_MSG_CHECKING([if CloseSocket might be used])
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
AC_MSG_RESULT([yes])
@ -2870,7 +2854,6 @@ AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
#
tst_links_ioctlsocket_camel="unknown"
tst_proto_ioctlsocket_camel="unknown"
tst_compi_ioctlsocket_camel="unknown"
tst_allow_ioctlsocket_camel="unknown"
#
@ -2890,19 +2873,6 @@ AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
])
#
if test "$tst_links_ioctlsocket_camel" = "yes"; then
AC_MSG_CHECKING([if IoctlSocket is prototyped])
AC_EGREP_CPP([IoctlSocket],[
$curl_includes_bsdsocket
],[
AC_MSG_RESULT([yes])
tst_proto_ioctlsocket_camel="yes"
],[
AC_MSG_RESULT([no])
tst_proto_ioctlsocket_camel="no"
])
fi
#
if test "$tst_proto_ioctlsocket_camel" = "yes"; then
AC_MSG_CHECKING([if IoctlSocket is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
@ -2933,7 +2903,6 @@ AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
#
AC_MSG_CHECKING([if IoctlSocket might be used])
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
AC_MSG_RESULT([yes])

View File

@ -27,7 +27,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
.DELETE_ON_ERROR:
EXTRA_DIST = mk-file-embed.pl mkhelp.pl \
Makefile.mk curl.rc Makefile.inc CMakeLists.txt .checksrc
curl.rc Makefile.inc CMakeLists.txt .checksrc
# Specify our include paths here, and do it relative to $(top_srcdir) and
# $(top_builddir), to ensure that these paths which belong to the library

View File

@ -1,95 +0,0 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# 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.
#
# SPDX-License-Identifier: curl
#
#***************************************************************************
# See usage in lib/Makefile.mk
PROOT := ..
### Common
include $(PROOT)/lib/Makefile.mk
### Local
CPPFLAGS += -I$(PROOT)/lib
LDFLAGS += -L$(PROOT)/lib
LIBS := -lcurl $(LIBS)
### Sources and targets
# Provides CURL_CFILES, CURLX_CFILES
include Makefile.inc
TARGETS := curl$(BIN_EXT)
CURL_CFILES += $(notdir $(CURLX_CFILES))
ifneq ($(CURL_CA_EMBED),)
CPPFLAGS += -DCURL_CA_EMBED
CURL_CFILES += tool_ca_embed.c
endif
curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES)))
ifdef MAP
CURL_MAP := curl.map
LDFLAGS += -Wl,-Map,$(CURL_MAP)
TOVCLEAN := $(CURL_MAP)
endif
vpath %.c $(PROOT)/lib
TOCLEAN := $(curl_OBJECTS)
### Rules
PERL ?= perl
ifneq ($(wildcard tool_hugehelp.c.cvs),)
TOCLEAN += tool_hugehelp.c
# Load DPAGES
include $(PROOT)/docs/cmdline-opts/Makefile.inc
$(PROOT)/docs/cmdline-opts/curl.txt: $(addprefix $(PROOT)/docs/cmdline-opts/,$(DPAGES)) $(PROOT)/scripts/managen
cd $(PROOT)/docs/cmdline-opts && $(PERL) ../../scripts/managen ascii $(DPAGES) > curl.txt
# Necessary for the generated tools_hugehelp.c
CPPFLAGS += -DUSE_MANUAL
ifdef ZLIB
_MKHELPOPT += -c
endif
tool_hugehelp.c: $(PROOT)/docs/cmdline-opts/curl.txt mkhelp.pl
$(PERL) mkhelp.pl $(_MKHELPOPT) < $< > $@
else
tool_hugehelp.c:
@echo Creating $@
@$(call COPY, $@.cvs, $@)
endif
ifneq ($(CURL_CA_EMBED),)
TOCLEAN += tool_ca_embed.c
tool_ca_embed.c: mk-file-embed.pl
$(PERL) mk-file-embed.pl --var curl_ca_embed < $(CURL_CA_EMBED) > $@
endif
$(TARGETS): $(curl_OBJECTS) $(PROOT)/lib/libcurl.a
$(CC) $(LDFLAGS) -o $@ $(curl_OBJECTS) $(LIBS)
all: $(OBJ_DIR) $(TARGETS)

View File

@ -74,7 +74,14 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
timeout.tv_usec = (int)((wait%1000)*1000);
FD_ZERO(&bits);
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(per->infd, &bits);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(!select(per->infd + 1, &bits, NULL, NULL, &timeout))
return 0; /* timeout */
}

View File

@ -80,7 +80,11 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
}
#endif
#ifdef __AMIGA__
if(LSEEK_ERROR == lseek(per->infd, (off_t)offset, whence))
#else
if(LSEEK_ERROR == lseek(per->infd, offset, whence))
#endif
/* could not rewind, the reason is in errno but errno is just not portable
enough and we do not actually care that much why we failed. We will let
libcurl know that it may try other means if it wants to. */

View File

@ -242,7 +242,8 @@ SANITIZE_ERR_OK: Good -- 'path' can be truncated
SANITIZE_ERR_INVALID_PATH: Bad -- 'path' cannot be truncated
!= SANITIZE_ERR_OK && != SANITIZE_ERR_INVALID_PATH: Error
*/
SANITIZEcode truncate_dryrun(const char *path, const size_t truncate_pos)
static SANITIZEcode truncate_dryrun(const char *path,
const size_t truncate_pos)
{
size_t len;
@ -291,8 +292,8 @@ sanitize_file_name.
Success: (SANITIZE_ERR_OK) *sanitized points to a sanitized copy of file_name.
Failure: (!= SANITIZE_ERR_OK) *sanitized is NULL.
*/
SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags)
static SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags)
{
char dos_name[PATH_MAX];
static const char illegal_chars_dos[] = ".+, ;=[]" /* illegal in DOS */

View File

@ -40,14 +40,6 @@ typedef enum {
SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name,
int flags);
#ifdef UNITTESTS
SANITIZEcode truncate_dryrun(const char *path, const size_t truncate_pos);
SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags);
SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized,
const char *file_name,
int flags);
#endif /* UNITTESTS */
#if defined(MSDOS) && (defined(__DJGPP__) || defined(__GO32__))

View File

@ -24,8 +24,9 @@
#include "tool_setup.h"
#ifdef HAVE_PWD_H
# undef __NO_NET_API /* required for building for AmigaOS */
# include <pwd.h>
#undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */
#include <pwd.h>
#define __NO_NET_API
#endif
#ifdef HAVE_SYS_STAT_H

View File

@ -45,10 +45,6 @@
#include "memdebug.h" /* keep this as LAST include */
#ifdef MSDOS
# define USE_WATT32
#endif
#define ALLOW_BLANK TRUE
#define DENY_BLANK FALSE

View File

@ -36,10 +36,6 @@
#include "memdebug.h" /* keep this as LAST include */
#ifdef MSDOS
# define USE_WATT32
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif

View File

@ -63,6 +63,15 @@
int vms_show = 0;
#endif
#if defined(__AMIGA__)
#if defined(__GNUC__)
#define CURL_USED __attribute__((used))
#else
#define CURL_USED
#endif
static const char CURL_USED min_stack[] = "$STACK:16384";
#endif
#ifdef __MINGW32__
/*
* There seems to be no way to escape "*" in command-line arguments with MinGW

View File

@ -676,7 +676,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
outs->bytes);
fflush(outs->stream);
/* truncate file at the position where we started appending */
#ifdef HAVE_FTRUNCATE
#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__)
if(ftruncate(fileno(outs->stream), outs->init)) {
/* when truncate fails, we cannot just append as then we will
create something strange, bail out */

View File

@ -35,8 +35,8 @@ nothing
</stdout>
# This test case previously tested an overflow case ("2094 Nov 6 =>
# 2147483647") for 32bit time_t, but since some systems have 64bit time_t and
# handles this (returning 3939840000), and some 64bit-time_t systems don't
# 2147483647") for 32-bit time_t, but since some systems have 64-bit time_t and
# handles this (returning 3939840000), and some 64-bit time_t systems don't
# handle this and return -1 for this, it turned very tricky to write a fine
# test case and thus it is now removed until we have a way to write test cases
# for this kind of things.

View File

@ -22,7 +22,8 @@
#
###########################################################################
# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'TIMEDIFF', 'THREADS', 'FIRSTFILES' variables
# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'INET_PTON', 'TIMEDIFF', 'THREADS',
# 'FIRSTFILES' variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
@ -50,7 +51,7 @@ if(CURL_TEST_BUNDLES)
list(APPEND libtests_SOURCES ${TESTUTIL} ${TSTTRACE})
if(LIB_SELECTED STREQUAL LIB_SHARED)
# These are part of the libcurl static lib. Add them here when linking shared.
list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${TIMEDIFF} ${THREADS})
list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
endif()
endif()
@ -63,7 +64,7 @@ foreach(_target IN LISTS LIBTESTPROGS)
if(LIB_SELECTED STREQUAL LIB_STATIC)
# These are part of the libcurl static lib. Do not compile/link them again.
list(REMOVE_ITEM _sources ${WARNLESS} ${MULTIBYTE} ${TIMEDIFF} ${THREADS})
list(REMOVE_ITEM _sources ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
endif()
string(TOUPPER ${_target} _upper_target)

View File

@ -103,7 +103,7 @@ CLEANFILES += libtest_bundle.c
if USE_CPPFLAG_CURL_STATICLIB
else
# These are part of the libcurl static lib. Add them here when linking shared.
libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(TIMEDIFF) $(THREADS)
libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(INET_PTON) $(TIMEDIFF) $(THREADS)
endif
else
noinst_PROGRAMS = $(LIBTESTPROGS)

View File

@ -33,6 +33,9 @@ WARNLESS = ../../lib/warnless.c ../../lib/warnless.h
# files used only in some libcurl test programs
MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h
# files used only in some libcurl test programs
INET_PTON = ../../lib/inet_pton.c ../../lib/inet_pton.h
# these files are used in every single test program below
TIMEDIFF = ../../lib/timediff.c ../../lib/timediff.h
FIRSTFILES = first.c first.h
@ -641,7 +644,7 @@ lib1958_LDADD = $(TESTUTIL_LIBS)
lib1959_SOURCES = lib1959.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1959_LDADD = $(TESTUTIL_LIBS)
lib1960_SOURCES = lib1960.c $(SUPPORTFILES)
lib1960_SOURCES = lib1960.c $(SUPPORTFILES) $(INET_PTON)
lib1960_LDADD = $(TESTUTIL_LIBS)
lib1964_SOURCES = lib1964.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)

View File

@ -115,7 +115,8 @@ CURLcode test(char *URL)
rc = 0;
#else
/* Portable sleep for platforms other than Windows. */
struct timeval wait = { 0, 100 * 1000 }; /* 100ms */
struct timeval wait = {0};
wait.tv_usec = 100 * 1000; /* 100ms */
rc = select(0, NULL, NULL, NULL, &wait);
#endif
}

View File

@ -23,18 +23,7 @@
***************************************************************************/
#include "test.h"
#ifdef HAVE_INET_PTON
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include "inet_pton.h"
#include "memdebug.h"
/* to prevent libcurl from closing our socket */
@ -101,7 +90,7 @@ CURLcode test(char *URL)
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
if(inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
if(Curl_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
fprintf(stderr, "inet_pton failed\n");
goto test_cleanup;
}
@ -139,11 +128,3 @@ test_cleanup:
return res;
}
#else
CURLcode test(char *URL)
{
(void)URL;
printf("lacks inet_pton\n");
return CURLE_OK;
}
#endif

View File

@ -218,7 +218,14 @@ static void updateFdSet(struct Sockets *sockets, fd_set* fdset,
{
int i;
for(i = 0; i < sockets->count; ++i) {
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockets->sockets[i], fdset);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(*maxFd < sockets->sockets[i] + 1) {
*maxFd = sockets->sockets[i] + 1;
}
@ -261,8 +268,9 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
CURLcode res = CURLE_OK;
CURL *curl = NULL; CURLM *m = NULL;
struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
struct timeval timeout = {-1, 0};
int success = 0;
struct timeval timeout = {0};
timeout.tv_sec = (time_t)-1;
/* set the limits */
max_timer_calls = timercb;
@ -303,14 +311,15 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
while(!checkForCompletion(m, &success)) {
fd_set readSet, writeSet;
curl_socket_t maxFd = 0;
struct timeval tv = {10, 0};
struct timeval tv = {0};
tv.tv_sec = 10;
FD_ZERO(&readSet);
FD_ZERO(&writeSet);
updateFdSet(&sockets.read, &readSet, &maxFd);
updateFdSet(&sockets.write, &writeSet, &maxFd);
if(timeout.tv_sec != -1) {
if(timeout.tv_sec != (time_t)-1) {
int usTimeout = getMicroSecondTimeout(&timeout);
tv.tv_sec = usTimeout / 1000000;
tv.tv_usec = usTimeout % 1000000;
@ -333,7 +342,7 @@ static CURLcode testone(char *URL, int timercb, int socketcb)
goto test_cleanup;
}
if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
if(timeout.tv_sec != (time_t)-1 && getMicroSecondTimeout(&timeout) == 0) {
/* Curl's timer has elapsed. */
if(socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout")) {
res = TEST_ERR_BAD_TIMEOUT;

View File

@ -186,7 +186,14 @@ static void updateFdSet(struct Sockets *sockets, fd_set* fdset,
{
int i;
for(i = 0; i < sockets->count; ++i) {
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockets->sockets[i], fdset);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(*maxFd < sockets->sockets[i] + 1) {
*maxFd = sockets->sockets[i] + 1;
}
@ -227,8 +234,9 @@ CURLcode test(char *URL)
struct_stat file_info;
CURLM *m = NULL;
struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
struct timeval timeout = {-1, 0};
int success = 0;
struct timeval timeout = {0};
timeout.tv_sec = (time_t)-1;
assert(test_argc >= 5);
@ -299,14 +307,15 @@ CURLcode test(char *URL)
while(!checkForCompletion(m, &success)) {
fd_set readSet, writeSet;
curl_socket_t maxFd = 0;
struct timeval tv = {10, 0};
struct timeval tv = {0};
tv.tv_sec = 10;
FD_ZERO(&readSet);
FD_ZERO(&writeSet);
updateFdSet(&sockets.read, &readSet, &maxFd);
updateFdSet(&sockets.write, &writeSet, &maxFd);
if(timeout.tv_sec != -1) {
if(timeout.tv_sec != (time_t)-1) {
int usTimeout = getMicroSecondTimeout(&timeout);
tv.tv_sec = usTimeout / 1000000;
tv.tv_usec = usTimeout % 1000000;
@ -322,7 +331,7 @@ CURLcode test(char *URL)
checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read");
checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write");
if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
if(timeout.tv_sec != (time_t)-1 && getMicroSecondTimeout(&timeout) == 0) {
/* Curl's timer has elapsed. */
notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
}

View File

@ -748,7 +748,14 @@ static bool incoming(curl_socket_t listenfd)
FD_ZERO(&fds_err);
/* there's always a socket to wait for */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockfd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
do {
/* select() blocking behavior call on blocking descriptors please */

View File

@ -142,7 +142,11 @@ int main(int argc, char *argv[])
/* gethostbyname() resolve */
struct hostent *he;
#ifdef __AMIGA__
he = gethostbyname((unsigned char *)host);
#else
he = gethostbyname(host);
#endif
rc = !he;
}

View File

@ -996,7 +996,14 @@ static bool juggle(curl_socket_t *sockfdp,
FD_ZERO(&fds_write);
FD_ZERO(&fds_err);
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET((curl_socket_t)fileno(stdin), &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
switch(*mode) {
@ -1005,7 +1012,14 @@ static bool juggle(curl_socket_t *sockfdp,
/* server mode */
sockfd = listenfd;
/* there's always a socket to wait for */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockfd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
maxfd = (int)sockfd;
break;
@ -1019,7 +1033,14 @@ static bool juggle(curl_socket_t *sockfdp,
}
else {
/* there's always a socket to wait for */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockfd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
maxfd = (int)sockfd;
}
break;
@ -1029,7 +1050,14 @@ static bool juggle(curl_socket_t *sockfdp,
sockfd = *sockfdp;
/* sockfd turns CURL_SOCKET_BAD when our connection has been closed */
if(CURL_SOCKET_BAD != sockfd) {
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockfd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
maxfd = (int)sockfd;
}
else {

View File

@ -717,16 +717,37 @@ static bool incoming(curl_socket_t listenfd)
FD_ZERO(&fds_err);
/* there's always a socket to wait for */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sockfd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
for(i = 0; i < 2; i++) {
if(c[i].used) {
curl_socket_t fd = c[i].clientfd;
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(fd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if((int)fd > maxfd)
maxfd = (int)fd;
fd = c[i].remotefd;
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(fd, &fds_read);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if((int)fd > maxfd)
maxfd = (int)fd;
}

View File

@ -902,13 +902,21 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
int rc;
fd_set input;
fd_set output;
struct timeval timeout = {1, 0}; /* 1000 ms */
struct timeval timeout = {0};
timeout.tv_sec = 1; /* 1000 ms */
logmsg("Got EAGAIN from sread");
FD_ZERO(&input);
FD_ZERO(&output);
got = 0;
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(sock, &input);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
do {
logmsg("Wait until readable");
rc = select((int)sock + 1, &input, &output, NULL, &timeout);
@ -1375,10 +1383,18 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
error = SOCKERRNO;
if((error == EINPROGRESS) || (error == EWOULDBLOCK)) {
fd_set output;
struct timeval timeout = {1, 0}; /* 1000 ms */
struct timeval timeout = {0};
timeout.tv_sec = 1; /* 1000 ms */
FD_ZERO(&output);
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(serverfd, &output);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
while(1) {
rc = select((int)serverfd + 1, NULL, &output, NULL, &timeout);
if(rc < 0 && SOCKERRNO != EINTR)
@ -1488,9 +1504,10 @@ static void http_connect(curl_socket_t *infdp,
fd_set input;
fd_set output;
struct timeval timeout = {1, 0}; /* 1000 ms */
ssize_t rc;
curl_socket_t maxfd = (curl_socket_t)-1;
struct timeval timeout = {0};
timeout.tv_sec = 1; /* 1000 ms */
FD_ZERO(&input);
FD_ZERO(&output);
@ -1502,7 +1519,14 @@ static void http_connect(curl_socket_t *infdp,
/* listener socket is monitored to allow client to establish
secondary tunnel only when this tunnel is not established
and primary one is fully operational */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(rootfd, &input);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
maxfd = rootfd;
}
@ -1512,14 +1536,28 @@ static void http_connect(curl_socket_t *infdp,
if(clientfd[i] != CURL_SOCKET_BAD) {
if(poll_client_rd[i]) {
/* unless told not to do so, monitor readability */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(clientfd[i], &input);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(clientfd[i] > maxfd)
maxfd = clientfd[i];
}
if(poll_client_wr[i] && toc[i]) {
/* unless told not to do so, monitor writability
if there is data ready to be sent to client */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(clientfd[i], &output);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(clientfd[i] > maxfd)
maxfd = clientfd[i];
}
@ -1528,14 +1566,28 @@ static void http_connect(curl_socket_t *infdp,
if(serverfd[i] != CURL_SOCKET_BAD) {
if(poll_server_rd[i]) {
/* unless told not to do so, monitor readability */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(serverfd[i], &input);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(serverfd[i] > maxfd)
maxfd = serverfd[i];
}
if(poll_server_wr[i] && tos[i]) {
/* unless told not to do so, monitor writability
if there is data ready to be sent to server */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(serverfd[i], &output);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(serverfd[i] > maxfd)
maxfd = serverfd[i];
}
@ -2323,9 +2375,10 @@ int main(int argc, char *argv[])
for(;;) {
fd_set input;
fd_set output;
struct timeval timeout = {0, 250000L}; /* 250 ms */
curl_socket_t maxfd = (curl_socket_t)-1;
int active;
struct timeval timeout = {0};
timeout.tv_usec = 250000L; /* 250 ms */
/* Clear out closed sockets */
for(socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
@ -2347,7 +2400,14 @@ int main(int argc, char *argv[])
for(socket_idx = 0; socket_idx < num_sockets; ++socket_idx) {
/* Listen on all sockets */
#if defined(__DJGPP__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
FD_SET(all_sockets[socket_idx], &input);
#if defined(__DJGPP__)
#pragma GCC diagnostic pop
#endif
if(all_sockets[socket_idx] > maxfd)
maxfd = all_sockets[socket_idx];
}

View File

@ -512,21 +512,20 @@ skipit:
static int synchnet(curl_socket_t f /* socket to flush */)
{
#if defined(HAVE_IOCTLSOCKET)
unsigned long i;
#else
int i;
#endif
int j = 0;
char rbuf[PKTSIZE];
srvr_sockaddr_union_t fromaddr;
curl_socklen_t fromaddrlen;
for(;;) {
#if defined(HAVE_IOCTLSOCKET)
#if defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
long i;
(void) IoctlSocket(f, FIONBIO, &i);
#elif defined(HAVE_IOCTLSOCKET)
unsigned long i;
(void) ioctlsocket(f, FIONREAD, &i);
#else
int i;
(void) ioctl(f, FIONREAD, &i);
#endif
if(i) {

View File

@ -40,6 +40,10 @@
#include <sys/poll.h>
#endif
#ifdef MSDOS
#include <dos.h> /* delay() */
#endif
#include "curlx.h" /* from the private lib dir */
#include "getpart.h"
#include "util.h"

View File

@ -84,7 +84,7 @@
} \
} while(0)
#define abort_test(msg) \
#define unittest_abort(msg) \
do { \
fprintf(stderr, "%s:%d test ABORTED: '%s'\n", \
__FILE__, __LINE__, msg); \