fix curls detection of ssl on AROS. Adjust the used link libraries (linking ssl twice...
[AROS-Contrib.git] / development / libs / curl / curl-7.60.0-aros.diff
blobe6e3f6fb15c860c8a1f900c6e5079013e7c92b54
1 diff -ruN curl-7.60.0/acinclude.m4 curl-7.60.0.aros/acinclude.m4
2 --- curl-7.60.0/acinclude.m4 2018-05-07 10:18:02.000000000 +0100
3 +++ curl-7.60.0.aros/acinclude.m4 2018-06-10 21:07:08.478367466 +0100
4 @@ -1342,6 +1342,12 @@
5 #ifdef HAVE_SYS_SOCKET_H
6 #include <sys/socket.h>
7 #endif
8 +#ifdef __AROS__
9 +#include <proto/bsdsocket.h>
10 +#endif
11 +#endif
12 +#ifdef __AROS__
13 + struct Library *SocketBase;
14 #endif
15 ]],[[
16 recv(0, 0, 0, 0);
17 @@ -1479,6 +1485,12 @@
18 #ifdef HAVE_SYS_SOCKET_H
19 #include <sys/socket.h>
20 #endif
21 +#ifdef __AROS__
22 +#include <proto/bsdsocket.h>
23 +#endif
24 +#endif
25 +#ifdef __AROS__
26 + struct Library *SocketBase;
27 #endif
28 ]],[[
29 send(0, 0, 0, 0);
30 @@ -2047,6 +2059,13 @@
32 done
33 LIBS="$tst_connect_save_LIBS"
34 + if test "$tst_connect_need_LIBS" = unknown; then
35 + dnl on AROS, connect is in bsdsocket.library
36 + AC_TRY_LINK([#include <proto/bsdsocket.h>],
37 + [void *SocketBase; connect(0,0,0);],
38 + [tst_connect_need_LIBS=""],
39 + [])
40 + fi
42 case X-"$tst_connect_need_LIBS" in
43 X-unknown)
44 diff -ruN curl-7.60.0/configure curl-7.60.0.aros/configure
45 --- curl-7.60.0/configure 2018-05-14 13:20:30.000000000 +0100
46 +++ curl-7.60.0.aros/configure 2018-06-10 21:16:06.439408512 +0100
47 @@ -1097,7 +1097,6 @@
48 docdir
49 oldincludedir
50 includedir
51 -runstatedir
52 localstatedir
53 sharedstatedir
54 sysconfdir
55 @@ -1253,7 +1252,6 @@
56 sysconfdir='${prefix}/etc'
57 sharedstatedir='${prefix}/com'
58 localstatedir='${prefix}/var'
59 -runstatedir='${localstatedir}/run'
60 includedir='${prefix}/include'
61 oldincludedir='/usr/include'
62 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
63 @@ -1506,15 +1504,6 @@
64 | -silent | --silent | --silen | --sile | --sil)
65 silent=yes ;;
67 - -runstatedir | --runstatedir | --runstatedi | --runstated \
68 - | --runstate | --runstat | --runsta | --runst | --runs \
69 - | --run | --ru | --r)
70 - ac_prev=runstatedir ;;
71 - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
72 - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
73 - | --run=* | --ru=* | --r=*)
74 - runstatedir=$ac_optarg ;;
76 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
77 ac_prev=sbindir ;;
78 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
79 @@ -1652,7 +1641,7 @@
80 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
81 datadir sysconfdir sharedstatedir localstatedir includedir \
82 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
83 - libdir localedir mandir runstatedir
84 + libdir localedir mandir
86 eval ac_val=\$$ac_var
87 # Remove trailing slashes.
88 @@ -1805,7 +1794,6 @@
89 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
90 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
91 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
92 - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
93 --libdir=DIR object code libraries [EPREFIX/lib]
94 --includedir=DIR C header files [PREFIX/include]
95 --oldincludedir=DIR C header files for non-gcc [/usr/include]
96 @@ -7392,7 +7380,7 @@
97 We can't simply define LARGE_OFF_T to be 9223372036854775807,
98 since some C++ compilers masquerading as C compilers
99 incorrectly reject 9223372036854775807. */
100 -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
101 +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
102 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
103 && LARGE_OFF_T % 2147483647 == 1)
104 ? 1 : -1];
105 @@ -7437,7 +7425,7 @@
106 We can't simply define LARGE_OFF_T to be 9223372036854775807,
107 since some C++ compilers masquerading as C compilers
108 incorrectly reject 9223372036854775807. */
109 -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
110 +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
111 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
112 && LARGE_OFF_T % 2147483647 == 1)
113 ? 1 : -1];
114 @@ -7460,7 +7448,7 @@
115 We can't simply define LARGE_OFF_T to be 9223372036854775807,
116 since some C++ compilers masquerading as C compilers
117 incorrectly reject 9223372036854775807. */
118 -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
119 +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
120 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
121 && LARGE_OFF_T % 2147483647 == 1)
122 ? 1 : -1];
123 @@ -7504,7 +7492,7 @@
124 We can't simply define LARGE_OFF_T to be 9223372036854775807,
125 since some C++ compilers masquerading as C compilers
126 incorrectly reject 9223372036854775807. */
127 -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
128 +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
129 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
130 && LARGE_OFF_T % 2147483647 == 1)
131 ? 1 : -1];
132 @@ -7527,7 +7515,7 @@
133 We can't simply define LARGE_OFF_T to be 9223372036854775807,
134 since some C++ compilers masquerading as C compilers
135 incorrectly reject 9223372036854775807. */
136 -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
137 +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
138 int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
139 && LARGE_OFF_T % 2147483647 == 1)
140 ? 1 : -1];
141 @@ -19676,6 +19664,33 @@
145 +if test "$HAVE_GETHOSTBYNAME" != "1"
146 +then
147 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in bsdsocket.library" >&5
148 +$as_echo_n "checking for gethostbyname in bsdsocket.library... " >&6; }
149 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
150 +/* end confdefs.h. */
151 +#include <proto/bsdsocket.h>
152 +int main (void)
154 +void *SocketBase; gethostbyname("");
156 + return 0;
158 +_ACEOF
159 +if ac_fn_c_try_link "$LINENO"; then :
160 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
161 +$as_echo "yes" >&6; }
162 + HAVE_GETHOSTBYNAME="1"
163 +else
164 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
165 +$as_echo "no" >&6; }
168 +rm -f core conftest.err conftest.$ac_objext \
169 + conftest$ac_exeext conftest.$ac_ext
174 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to provide built-in manual" >&5
175 @@ -20409,6 +20424,23 @@
177 done
178 LIBS="$tst_connect_save_LIBS"
179 + if test "$tst_connect_need_LIBS" = unknown; then
180 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
181 +/* end confdefs.h. */
182 +#include <proto/bsdsocket.h>
183 +int main (void)
185 +void *SocketBase; connect(0,0,0);
187 + return 0;
189 +_ACEOF
190 +if ac_fn_c_try_link "$LINENO"; then :
191 + tst_connect_need_LIBS=""
193 +rm -f core conftest.err conftest.$ac_objext \
194 + conftest$ac_exeext conftest.$ac_ext
195 + fi
197 case X-"$tst_connect_need_LIBS" in
198 X-unknown)
199 @@ -22674,10 +22706,23 @@
200 LIBS="-lcrypto $LIBS"
202 else
204 - LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
205 - CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
206 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Init_ex in -lcrypto" >&5
207 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
208 +/* end confdefs.h. */
209 +#include <openssl/hmac.h>
210 +void *SocketBase;
211 +int main (void)
213 +HMAC_Update(0,0,0);
215 + return 0;
217 +_ACEOF
218 +if ac_fn_c_try_link "$LINENO"; then :
219 + HAVECRYPTO="yes"
220 +else
221 + LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
222 + CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
223 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Init_ex in -lcrypto" >&5
224 $as_echo_n "checking for HMAC_Init_ex in -lcrypto... " >&6; }
225 if ${ac_cv_lib_crypto_HMAC_Init_ex+:} false; then :
226 $as_echo_n "(cached) " >&6
227 @@ -22712,23 +22757,23 @@
228 $as_echo "$ac_cv_lib_crypto_HMAC_Init_ex" >&6; }
229 if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes; then :
231 - HAVECRYPTO="yes"
232 - LIBS="-lcrypto $LIBS"
233 + HAVECRYPTO="yes"
234 + LIBS="-lcrypto $LIBS"
235 else
238 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl" >&5
239 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl" >&5
240 $as_echo_n "checking OpenSSL linking with -ldl... " >&6; }
241 - LIBS="$LIBS -ldl"
242 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
243 + LIBS="$LIBS -ldl"
244 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
245 /* end confdefs.h. */
247 - #include <openssl/err.h>
248 + #include <openssl/err.h>
250 int main (void)
253 - ERR_clear_error();
254 + ERR_clear_error();
257 return 0;
258 @@ -22736,27 +22781,27 @@
259 _ACEOF
260 if ac_fn_c_try_link "$LINENO"; then :
262 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
263 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
264 $as_echo "yes" >&6; }
265 - HAVECRYPTO="yes"
266 + HAVECRYPTO="yes"
268 else
270 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
271 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
272 $as_echo "no" >&6; }
274 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl and -lpthread" >&5
275 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl and -lpthread" >&5
276 $as_echo_n "checking OpenSSL linking with -ldl and -lpthread... " >&6; }
277 - LIBS="$LIBS -lpthread"
278 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext
279 + LIBS="$LIBS -lpthread"
280 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
281 /* end confdefs.h. */
283 - #include <openssl/err.h>
284 + #include <openssl/err.h>
286 int main (void)
289 - ERR_clear_error();
290 + ERR_clear_error();
293 return 0;
294 @@ -22764,17 +22809,17 @@
295 _ACEOF
296 if ac_fn_c_try_link "$LINENO"; then :
298 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
299 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
300 $as_echo "yes" >&6; }
301 - HAVECRYPTO="yes"
302 + HAVECRYPTO="yes"
304 else
306 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
307 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
308 $as_echo "no" >&6; }
309 - LDFLAGS="$CLEANLDFLAGS"
310 - CPPFLAGS="$CLEANCPPFLAGS"
311 - LIBS="$CLEANLIBS"
312 + LDFLAGS="$CLEANLDFLAGS"
313 + CPPFLAGS="$CLEANCPPFLAGS"
314 + LIBS="$CLEANLIBS"
318 @@ -22791,6 +22836,10 @@
322 +rm -f core conftest.err conftest.$ac_objext \
323 + conftest$ac_exeext conftest.$ac_ext
328 if test X"$HAVECRYPTO" = X"yes"; then
329 @@ -22893,8 +22942,38 @@
330 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
331 $as_echo "yes" >&6; }
333 + fi
335 - else
336 + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
337 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl with SocketBase available" >&5
338 +$as_echo_n "checking for ssl with SocketBase available... " >&6; }
339 + OLIBS=$LIBS
340 + LIBS="-lssl $LIBS"
341 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
342 +/* end confdefs.h. */
343 +#include <openssl/ssl.h>
344 +void *SocketBase;
345 +int main (void)
347 +SSL_connect(0);
349 + return 0;
351 +_ACEOF
352 +if ac_fn_c_try_link "$LINENO"; then :
353 + ac_cv_lib_ssl_SSL_connect="yes"
354 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
355 +$as_echo "yes" >&6; }
356 +else
357 + LIBS=$OLIBS
358 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
359 +$as_echo "no" >&6; }
361 +rm -f core conftest.err conftest.$ac_objext \
362 + conftest$ac_exeext conftest.$ac_ext
363 + fi
365 + if test "$ac_cv_lib_ssl_SSL_connect" = yes; then
367 for ac_header in openssl/x509.h openssl/rsa.h openssl/crypto.h \
368 openssl/pem.h openssl/ssl.h openssl/err.h
369 @@ -30031,6 +30110,12 @@
370 #ifdef HAVE_SYS_SOCKET_H
371 #include <sys/socket.h>
372 #endif
373 +#ifdef __AROS__
374 +#include <proto/bsdsocket.h>
375 +#endif
376 +#endif
377 +#ifdef __AROS__
378 + struct Library *SocketBase;
379 #endif
381 int main (void)
382 @@ -30222,6 +30307,12 @@
383 #ifdef HAVE_SYS_SOCKET_H
384 #include <sys/socket.h>
385 #endif
386 +#ifdef __AROS__
387 +#include <proto/bsdsocket.h>
388 +#endif
389 +#endif
390 +#ifdef __AROS__
391 + struct Library *SocketBase;
392 #endif
394 int main (void)
395 diff -ruN curl-7.60.0/configure.ac curl-7.60.0.aros/configure.ac
396 --- curl-7.60.0/configure.ac 2018-05-14 12:01:43.000000000 +0100
397 +++ curl-7.60.0.aros/configure.ac 2018-06-10 21:14:46.240402393 +0100
398 @@ -630,6 +630,19 @@
399 AC_MSG_RESULT(yes)
402 +if test "$HAVE_GETHOSTBYNAME" != "1"
403 +then
404 + dnl AROS gets to gethostbyname via bsdsocket.library
405 + AC_MSG_CHECKING([for gethostbyname in bsdsocket.library])
406 + AC_TRY_LINK([#include <proto/bsdsocket.h>],
407 + [void *SocketBase; gethostbyname("");],
408 + [ dnl worked!
409 + AC_MSG_RESULT([yes])
410 + HAVE_GETHOSTBYNAME="1"],
411 + AC_MSG_RESULT(no)
416 dnl **********************************************************************
417 dnl Check for built-in manual
418 @@ -1645,56 +1658,60 @@
419 AC_CHECK_LIB(crypto, HMAC_Update,[
420 HAVECRYPTO="yes"
421 LIBS="-lcrypto $LIBS"
422 - ],[
423 - LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
424 - CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
425 - AC_CHECK_LIB(crypto, HMAC_Init_ex,[
426 - HAVECRYPTO="yes"
427 - LIBS="-lcrypto $LIBS"], [
429 - dnl still no, but what about with -ldl?
430 - AC_MSG_CHECKING([OpenSSL linking with -ldl])
431 - LIBS="$LIBS -ldl"
432 - AC_TRY_LINK(
434 - #include <openssl/err.h>
435 - ],
437 - ERR_clear_error();
438 - ],
440 - AC_MSG_RESULT(yes)
441 - HAVECRYPTO="yes"
442 - ],
444 - AC_MSG_RESULT(no)
445 - dnl ok, so what about bouth -ldl and -lpthread?
447 - AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
448 - LIBS="$LIBS -lpthread"
449 - AC_TRY_LINK(
451 - #include <openssl/err.h>
452 - ],
454 - ERR_clear_error();
455 - ],
457 - AC_MSG_RESULT(yes)
458 - HAVECRYPTO="yes"
459 - ],
461 - AC_MSG_RESULT(no)
462 - LDFLAGS="$CLEANLDFLAGS"
463 - CPPFLAGS="$CLEANCPPFLAGS"
464 - LIBS="$CLEANLIBS"
465 + ],[AC_TRY_LINK([#include <openssl/hmac.h>
466 +void *SocketBase;],
467 + [HMAC_Update(0,0,0);],
468 + [HAVECRYPTO="yes"],
469 + [LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
470 + CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
471 + AC_CHECK_LIB(crypto, HMAC_Init_ex,[
472 + HAVECRYPTO="yes"
473 + LIBS="-lcrypto $LIBS"], [
475 + dnl still no, but what about with -ldl?
476 + AC_MSG_CHECKING([OpenSSL linking with -ldl])
477 + LIBS="$LIBS -ldl"
478 + AC_TRY_LINK(
480 + #include <openssl/err.h>
481 + ],
483 + ERR_clear_error();
484 + ],
486 + AC_MSG_RESULT(yes)
487 + HAVECRYPTO="yes"
488 + ],
490 + AC_MSG_RESULT(no)
491 + dnl ok, so what about bouth -ldl and -lpthread?
493 + AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
494 + LIBS="$LIBS -lpthread"
495 + AC_TRY_LINK(
497 + #include <openssl/err.h>
498 + ],
500 + ERR_clear_error();
501 + ],
503 + AC_MSG_RESULT(yes)
504 + HAVECRYPTO="yes"
505 + ],
507 + AC_MSG_RESULT(no)
508 + LDFLAGS="$CLEANLDFLAGS"
509 + CPPFLAGS="$CLEANCPPFLAGS"
510 + LIBS="$CLEANLIBS"
512 - ])
513 + ])
515 - ])
516 + ])
518 - ])
519 - ])
520 + ])
521 + ])
522 + ])
524 if test X"$HAVECRYPTO" = X"yes"; then
525 dnl This is only reasonable to do if crypto actually is there: check for
526 @@ -1715,8 +1732,23 @@
527 else
528 AC_MSG_RESULT(yes)
530 + fi
532 + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
533 + dnl on AROS, libssl needs SocketBase
534 + AC_MSG_CHECKING(for ssl with SocketBase available)
535 + OLIBS=$LIBS
536 + LIBS="-lssl $LIBS"
537 + AC_TRY_LINK([#include <openssl/ssl.h>
538 +void *SocketBase;],
539 + [SSL_connect(0);],
540 + [ac_cv_lib_ssl_SSL_connect="yes"
541 + AC_MSG_RESULT([yes])],
542 + [LIBS=$OLIBS
543 + AC_MSG_RESULT([no])])
544 + fi
546 - else
547 + if test "$ac_cv_lib_ssl_SSL_connect" = yes; then
549 dnl Have the libraries--check for OpenSSL headers
550 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
551 diff -ruN curl-7.60.0/lib/aros.c curl-7.60.0.aros/lib/aros.c
552 --- curl-7.60.0/lib/aros.c 1970-01-01 01:00:00.000000000 +0100
553 +++ curl-7.60.0.aros/lib/aros.c 2018-06-10 21:07:08.478367466 +0100
554 @@ -0,0 +1,69 @@
555 +/***************************************************************************
556 + * _ _ ____ _
557 + * Project ___| | | | _ \| |
558 + * / __| | | | |_) | |
559 + * | (__| |_| | _ <| |___
560 + * \___|\___/|_| \_\_____|
562 + * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
564 + * This software is licensed as described in the file COPYING, which
565 + * you should have received as part of this distribution. The terms
566 + * are also available at http://curl.haxx.se/docs/copyright.html.
568 + * You may opt to use, copy, modify, merge, publish, distribute and/or sell
569 + * copies of the Software, and permit persons to whom the Software is
570 + * furnished to do so, under the terms of the COPYING file.
572 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
573 + * KIND, either express or implied.
575 + * $Id$
576 + ***************************************************************************/
578 +#ifdef __AROS__ /* AROS */
580 +#include <errno.h>
581 +#include <aros/symbolsets.h>
582 +#include <exec/libraries.h>
583 +#include <proto/exec.h>
584 +#include <proto/dos.h>
585 +#include <proto/bsdsocket.h>
586 +#include <bsdsocket/socketbasetags.h>
588 +struct Library * __attribute__((weak)) SocketBase = NULL;
590 +void aros_cleanup()
592 + if(SocketBase) {
593 + CloseLibrary(SocketBase);
594 + SocketBase = NULL;
598 +BOOL aros_init()
600 + if(!SocketBase)
601 + SocketBase = OpenLibrary("bsdsocket.library", 4);
603 + if(!SocketBase) {
604 + Printf("No TCP/IP Stack running!", "");
605 + return FALSE;
608 + if(SocketBaseTags(
609 + SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR) &errno,
610 + SBTM_SETVAL(SBTC_LOGTAGPTR), (IPTR) "cURL",
611 + TAG_DONE)) {
613 + Printf("SocketBaseTags ERROR", "");
614 + return FALSE;
617 + return TRUE;
620 +ADD2INIT(aros_init, -50)
621 +ADD2EXIT(aros_cleanup, -50)
623 +#endif /* __AROS__ */
624 diff -ruN curl-7.60.0/lib/connect.c curl-7.60.0.aros/lib/connect.c
625 --- curl-7.60.0/lib/connect.c 2018-05-07 09:20:04.000000000 +0100
626 +++ curl-7.60.0.aros/lib/connect.c 2018-06-10 21:07:08.478367466 +0100
627 @@ -58,6 +58,10 @@
628 #include <inet.h>
629 #endif
631 +#ifdef __AROS__
632 +#include <proto/bsdsocket.h>
633 +#endif
635 #include "urldata.h"
636 #include "sendf.h"
637 #include "if2ip.h"
638 diff -ruN curl-7.60.0/lib/curl_gethostname.c curl-7.60.0.aros/lib/curl_gethostname.c
639 --- curl-7.60.0/lib/curl_gethostname.c 2017-12-02 23:33:20.000000000 +0000
640 +++ curl-7.60.0.aros/lib/curl_gethostname.c 2018-06-10 21:07:08.478367466 +0100
641 @@ -48,6 +48,10 @@
642 * For libcurl static library release builds no overriding takes place.
645 +#ifdef __AROS__
646 +#include <proto/bsdsocket.h>
647 +#endif
649 int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen)
651 #ifndef HAVE_GETHOSTNAME
652 diff -ruN curl-7.60.0/lib/curl_setup.h curl-7.60.0.aros/lib/curl_setup.h
653 --- curl-7.60.0/lib/curl_setup.h 2018-05-07 10:18:02.000000000 +0100
654 +++ curl-7.60.0.aros/lib/curl_setup.h 2018-06-10 21:07:08.478367466 +0100
655 @@ -496,6 +496,13 @@
657 # endif /* MSDOS */
659 +# ifdef __AROS__
660 +# undef HAVE_ALARM
661 +# undef HAVE_SIGNAL
662 +# undef HAVE_SIGACTION
663 +# endif
666 # ifdef __minix
667 /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
668 extern char *strtok_r(char *s, const char *delim, char **last);
669 diff -ruN curl-7.60.0/lib/file.c curl-7.60.0.aros/lib/file.c
670 --- curl-7.60.0/lib/file.c 2018-05-07 09:20:04.000000000 +0100
671 +++ curl-7.60.0.aros/lib/file.c 2018-06-10 21:07:08.478367466 +0100
672 @@ -137,7 +137,7 @@
673 char *real_path;
674 struct FILEPROTO *file = data->req.protop;
675 int fd;
676 -#ifdef DOS_FILESYSTEM
677 +#if defined(DOS_FILESYSTEM) || defined(__AROS__)
678 size_t i;
679 char *actual_path;
680 #endif
681 @@ -183,6 +183,14 @@
683 fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
684 file->path = actual_path;
685 +#elif defined __AROS__
686 + /* On AROS paths can start with volume name, skip slash in this case */
687 + actual_path = real_path;
688 + if(actual_path[0] == '/' && strchr(actual_path, ':'))
689 + actual_path++;
691 + fd = open(actual_path, O_RDONLY);
692 + file->path = actual_path;
693 #else
694 if(memchr(real_path, 0, real_path_len)) {
695 /* binary zeroes indicate foul play */
696 diff -ruN curl-7.60.0/lib/ftp.c curl-7.60.0.aros/lib/ftp.c
697 --- curl-7.60.0/lib/ftp.c 2018-05-14 12:30:44.000000000 +0100
698 +++ curl-7.60.0.aros/lib/ftp.c 2018-06-10 21:07:08.478367466 +0100
699 @@ -46,6 +46,10 @@
700 #define in_addr_t unsigned long
701 #endif
703 +#ifdef __AROS__
704 +#include <proto/bsdsocket.h>
705 +#endif
707 #include <curl/curl.h>
708 #include "urldata.h"
709 #include "sendf.h"
710 diff -ruN curl-7.60.0/lib/getinfo.c curl-7.60.0.aros/lib/getinfo.c
711 --- curl-7.60.0/lib/getinfo.c 2018-05-07 09:20:04.000000000 +0100
712 +++ curl-7.60.0.aros/lib/getinfo.c 2018-06-10 21:07:08.478367466 +0100
713 @@ -31,6 +31,10 @@
714 #include "connect.h" /* Curl_getconnectinfo() */
715 #include "progress.h"
717 +#ifdef __AROS__
718 +#include <proto/bsdsocket.h>
719 +#endif
721 /* The last #include files should be: */
722 #include "curl_memory.h"
723 #include "memdebug.h"
724 diff -ruN curl-7.60.0/lib/hostip4.c curl-7.60.0.aros/lib/hostip4.c
725 --- curl-7.60.0/lib/hostip4.c 2018-05-07 09:20:04.000000000 +0100
726 +++ curl-7.60.0.aros/lib/hostip4.c 2018-06-10 21:07:08.478367466 +0100
727 @@ -45,6 +45,10 @@
728 #include <process.h>
729 #endif
731 +#ifdef __AROS__
732 +#include <proto/bsdsocket.h>
733 +#endif
735 #include "urldata.h"
736 #include "sendf.h"
737 #include "hostip.h"
738 diff -ruN curl-7.60.0/lib/http.c curl-7.60.0.aros/lib/http.c
739 --- curl-7.60.0/lib/http.c 2018-05-14 12:30:44.000000000 +0100
740 +++ curl-7.60.0.aros/lib/http.c 2018-06-10 21:07:08.478367466 +0100
741 @@ -45,6 +45,10 @@
742 #include <sys/param.h>
743 #endif
745 +#ifdef __AROS__
746 +#include <proto/bsdsocket.h>
747 +#endif
749 #include "urldata.h"
750 #include <curl/curl.h>
751 #include "transfer.h"
752 diff -ruN curl-7.60.0/lib/if2ip.c curl-7.60.0.aros/lib/if2ip.c
753 --- curl-7.60.0/lib/if2ip.c 2018-05-07 09:20:04.000000000 +0100
754 +++ curl-7.60.0.aros/lib/if2ip.c 2018-06-10 21:07:08.478367466 +0100
755 @@ -50,6 +50,10 @@
756 # include <inet.h>
757 #endif
759 +#ifdef __AROS__
760 +#include <proto/bsdsocket.h>
761 +#endif
763 #include "inet_ntop.h"
764 #include "strcase.h"
765 #include "if2ip.h"
766 diff -ruN curl-7.60.0/lib/inet_ntop.c curl-7.60.0.aros/lib/inet_ntop.c
767 --- curl-7.60.0/lib/inet_ntop.c 2018-05-14 10:01:32.000000000 +0100
768 +++ curl-7.60.0.aros/lib/inet_ntop.c 2018-06-10 21:07:08.478367466 +0100
769 @@ -32,6 +32,10 @@
770 #include <arpa/inet.h>
771 #endif
773 +#ifdef __AROS__
774 +#include <proto/bsdsocket.h>
775 +#endif
777 #include "inet_ntop.h"
778 #include "curl_printf.h"
780 diff -ruN curl-7.60.0/lib/Makefile.in curl-7.60.0.aros/lib/Makefile.in
781 --- curl-7.60.0/lib/Makefile.in 2018-05-14 13:20:31.000000000 +0100
782 +++ curl-7.60.0.aros/lib/Makefile.in 2018-06-10 21:07:08.478367466 +0100
783 @@ -227,7 +227,7 @@
784 libcurl_la-system_win32.lo libcurl_la-mime.lo \
785 libcurl_la-sha256.lo libcurl_la-setopt.lo \
786 libcurl_la-curl_path.lo libcurl_la-curl_ctype.lo \
787 - libcurl_la-curl_range.lo
788 + libcurl_la-curl_range.lo libcurl_la-aros.lo
789 am__dirstamp = $(am__leading_dot)dirstamp
790 am__objects_2 = vauth/libcurl_la-vauth.lo \
791 vauth/libcurl_la-cleartext.lo vauth/libcurl_la-cram.lo \
792 @@ -714,7 +714,7 @@
793 http_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c rand.c \
794 curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c \
795 x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \
796 - mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c
797 + mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c aros.c
799 LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
800 formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
801 @@ -971,6 +971,7 @@
802 -rm -f *.tab.c
804 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-amigaos.Plo@am__quote@
805 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-aros.Plo@am__quote@
806 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-asyn-ares.Plo@am__quote@
807 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-asyn-thread.Plo@am__quote@
808 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-base64.Plo@am__quote@
809 @@ -1079,6 +1080,7 @@
810 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-wildcard.Plo@am__quote@
811 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-x509asn1.Plo@am__quote@
812 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-amigaos.Plo@am__quote@
813 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-aros.Plo@am__quote@
814 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-asyn-ares.Plo@am__quote@
815 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-asyn-thread.Plo@am__quote@
816 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-base64.Plo@am__quote@
817 @@ -2101,6 +2103,13 @@
818 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
819 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o vauth/libcurl_la-spnego_sspi.lo `test -f 'vauth/spnego_sspi.c' || echo '$(srcdir)/'`vauth/spnego_sspi.c
821 +libcurl_la-aros.lo: aros.c
822 +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-aros.lo -MD -MP -MF $(DEPDIR)/libcurl_la-aros.Tpo -c -o libcurl_la-aros.lo `test -f 'aros.c' || echo '$(srcdir)/'`aros.c
823 +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurl_la-aros.Tpo $(DEPDIR)/libcurl_la-aros.Plo
824 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aros.c' object='libcurl_la-aros.lo' libtool=yes @AMDEPBACKSLASH@
825 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
826 +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-aros.lo `test -f 'aros.c' || echo '$(srcdir)/'`aros.c
828 vtls/libcurl_la-openssl.lo: vtls/openssl.c
829 @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT vtls/libcurl_la-openssl.lo -MD -MP -MF vtls/$(DEPDIR)/libcurl_la-openssl.Tpo -c -o vtls/libcurl_la-openssl.lo `test -f 'vtls/openssl.c' || echo '$(srcdir)/'`vtls/openssl.c
830 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) vtls/$(DEPDIR)/libcurl_la-openssl.Tpo vtls/$(DEPDIR)/libcurl_la-openssl.Plo
831 diff -ruN curl-7.60.0/lib/Makefile.inc curl-7.60.0.aros/lib/Makefile.inc
832 --- curl-7.60.0/lib/Makefile.inc 2018-05-07 10:18:02.000000000 +0100
833 +++ curl-7.60.0.aros/lib/Makefile.inc 2018-06-10 21:07:08.478367466 +0100
834 @@ -54,7 +54,7 @@
835 http_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c rand.c \
836 curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c \
837 x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \
838 - mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c
839 + mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c aros.c
841 LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
842 formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
843 diff -ruN curl-7.60.0/lib/memdebug.c curl-7.60.0.aros/lib/memdebug.c
844 --- curl-7.60.0/lib/memdebug.c 2018-05-07 09:20:04.000000000 +0100
845 +++ curl-7.60.0.aros/lib/memdebug.c 2018-06-10 21:07:08.478367466 +0100
846 @@ -26,6 +26,10 @@
848 #include <curl/curl.h>
850 +#ifdef __AROS__
851 +#include <proto/bsdsocket.h>
852 +#endif
854 #include "urldata.h"
856 #define MEMDEBUG_NODEFINES /* don't redefine the standard functions */
857 diff -ruN curl-7.60.0/lib/multi.c curl-7.60.0.aros/lib/multi.c
858 --- curl-7.60.0/lib/multi.c 2018-05-07 10:18:03.000000000 +0100
859 +++ curl-7.60.0.aros/lib/multi.c 2018-06-10 21:07:08.478367466 +0100
860 @@ -22,6 +22,10 @@
862 #include "curl_setup.h"
864 +#ifdef __AROS__
865 +#include <proto/bsdsocket.h>
866 +#endif
868 #include <curl/curl.h>
870 #include "urldata.h"
871 diff -ruN curl-7.60.0/lib/nonblock.c curl-7.60.0.aros/lib/nonblock.c
872 --- curl-7.60.0/lib/nonblock.c 2018-05-07 09:20:04.000000000 +0100
873 +++ curl-7.60.0.aros/lib/nonblock.c 2018-06-10 21:07:08.478367466 +0100
874 @@ -37,6 +37,10 @@
875 #include <inet.h>
876 #endif
878 +#ifdef __AROS__
879 +#include <proto/bsdsocket.h>
880 +#endif
882 #include "nonblock.h"
885 diff -ruN curl-7.60.0/lib/select.c curl-7.60.0.aros/lib/select.c
886 --- curl-7.60.0/lib/select.c 2018-05-07 09:20:04.000000000 +0100
887 +++ curl-7.60.0.aros/lib/select.c 2018-06-10 21:07:08.478367466 +0100
888 @@ -35,6 +35,10 @@
889 #include <socket.h>
890 #endif
892 +#ifdef __AROS__
893 +#include <proto/bsdsocket.h>
894 +#endif
896 #ifdef MSDOS
897 #include <dos.h> /* delay() */
898 #endif
899 @@ -581,3 +585,4 @@
900 return rc;
902 #endif /* TPF */
904 diff -ruN curl-7.60.0/lib/sendf.c curl-7.60.0.aros/lib/sendf.c
905 --- curl-7.60.0/lib/sendf.c 2018-05-07 09:20:04.000000000 +0100
906 +++ curl-7.60.0.aros/lib/sendf.c 2018-06-10 21:07:08.478367466 +0100
907 @@ -30,6 +30,10 @@
908 #include <linux/tcp.h>
909 #endif
911 +#ifdef __AROS__
912 +#include <proto/bsdsocket.h>
913 +#endif
915 #include <curl/curl.h>
917 #include "urldata.h"
918 diff -ruN curl-7.60.0/lib/telnet.c curl-7.60.0.aros/lib/telnet.c
919 --- curl-7.60.0/lib/telnet.c 2018-05-14 10:01:32.000000000 +0100
920 +++ curl-7.60.0.aros/lib/telnet.c 2018-06-10 21:07:08.478367466 +0100
921 @@ -44,6 +44,10 @@
922 #include <sys/param.h>
923 #endif
925 +#ifdef __AROS__
926 +#include <proto/bsdsocket.h>
927 +#endif
929 #include "urldata.h"
930 #include <curl/curl.h>
931 #include "transfer.h"
932 diff -ruN curl-7.60.0/lib/tftp.c curl-7.60.0.aros/lib/tftp.c
933 --- curl-7.60.0/lib/tftp.c 2018-05-07 10:18:03.000000000 +0100
934 +++ curl-7.60.0.aros/lib/tftp.c 2018-06-10 21:07:08.478367466 +0100
935 @@ -44,6 +44,10 @@
936 #include <sys/param.h>
937 #endif
939 +#ifdef __AROS__
940 +#include <proto/bsdsocket.h>
941 +#endif
943 #include "urldata.h"
944 #include <curl/curl.h>
945 #include "transfer.h"
946 diff -ruN curl-7.60.0/lib/transfer.c curl-7.60.0.aros/lib/transfer.c
947 --- curl-7.60.0/lib/transfer.c 2018-05-14 12:01:43.000000000 +0100
948 +++ curl-7.60.0.aros/lib/transfer.c 2018-06-10 21:07:08.478367466 +0100
949 @@ -54,6 +54,10 @@
950 #error "We can't compile without socket() support!"
951 #endif
953 +#ifdef __AROS__
954 +#include <proto/bsdsocket.h>
955 +#endif
957 #include "urldata.h"
958 #include <curl/curl.h>
959 #include "netrc.h"
960 diff -ruN curl-7.60.0/lib/url.c curl-7.60.0.aros/lib/url.c
961 --- curl-7.60.0/lib/url.c 2018-05-14 12:30:44.000000000 +0100
962 +++ curl-7.60.0.aros/lib/url.c 2018-06-10 21:07:08.478367466 +0100
963 @@ -51,6 +51,10 @@
964 #include <sys/un.h>
965 #endif
967 +#ifdef __AROS__
968 +#include <proto/bsdsocket.h>
969 +#endif
971 #ifndef HAVE_SOCKET
972 #error "We can't compile without socket() support!"
973 #endif
974 diff -ruN curl-7.60.0/lib/vtls/vtls.c curl-7.60.0.aros/lib/vtls/vtls.c
975 --- curl-7.60.0/lib/vtls/vtls.c 2018-05-14 12:01:43.000000000 +0100
976 +++ curl-7.60.0.aros/lib/vtls/vtls.c 2018-06-10 21:07:08.478367466 +0100
977 @@ -50,6 +50,11 @@
979 #include "urldata.h"
981 +#if defined(__AROS__)
982 +#undef connect
983 +#undef shutdown
984 +#endif
986 #include "vtls.h" /* generic SSL protos etc */
987 #include "slist.h"
988 #include "sendf.h"
989 diff -ruN curl-7.60.0/src/tool_main.c curl-7.60.0.aros/src/tool_main.c
990 --- curl-7.60.0/src/tool_main.c 2018-05-07 09:20:04.000000000 +0100
991 +++ curl-7.60.0.aros/src/tool_main.c 2018-06-10 21:07:08.478367466 +0100
992 @@ -32,6 +32,10 @@
993 #include <plarenas.h>
994 #endif
996 +#ifdef __AROS__
997 +#include <proto/bsdsocket.h>
998 +#endif
1000 #define ENABLE_CURLX_PRINTF
1001 /* use our own printf() functions */
1002 #include "curlx.h"
1003 diff -ruN curl-7.60.0/src/tool_sleep.c curl-7.60.0.aros/src/tool_sleep.c
1004 --- curl-7.60.0/src/tool_sleep.c 2018-05-07 09:20:04.000000000 +0100
1005 +++ curl-7.60.0.aros/src/tool_sleep.c 2018-06-10 21:07:08.478367466 +0100
1006 @@ -35,6 +35,10 @@
1007 # include <dos.h>
1008 #endif
1010 +#ifdef __AROS__
1011 +#include <proto/bsdsocket.h>
1012 +#endif
1014 #include "tool_sleep.h"
1016 #include "memdebug.h" /* keep this as LAST include */