Newer
Older
/* headers for ioctlsocket test (Windows) */
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#endif
]],[[
/* ioctlsocket source code (Windows) */
SOCKET sd;
unsigned long flags = 0;
sd = socket(0, 0, 0);
ioctlsocket(sd, FIONBIO, &flags);
]])
],[
dnl ioctlsocket test was good
nonblock="ioctlsocket"
AC_DEFINE(HAVE_IOCTLSOCKET, 1,
[use ioctlsocket() for non-blocking sockets])
])
fi
#
if test "$nonblock" = "unknown"; then
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
/* headers for IoctlSocket test (Amiga?) */
#include <sys/ioctl.h>
]],[[
/* IoctlSocket source code (Amiga?) */
int socket;
int flags = IoctlSocket(socket, FIONBIO, (long)1);
]])
],[
dnl Ioctlsocket test was good
nonblock="IoctlSocket"
AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1,
[use Ioctlsocket() for non-blocking sockets])
])
fi
#
if test "$nonblock" = "unknown"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
/* headers for SO_NONBLOCK test (BeOS) */
#include <socket.h>
]],[[
/* SO_NONBLOCK source code (BeOS) */
long b = 1;
int socket;
int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
]])
],[
dnl the SO_NONBLOCK test was good
nonblock="SO_NONBLOCK"
AC_DEFINE(HAVE_SO_NONBLOCK, 1,
[use SO_NONBLOCK for non-blocking sockets])
])
fi
#
#
if test "$nonblock" = "unknown"; then
AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
[disabled non-blocking sockets])
AC_MSG_WARN([non-block sockets disabled])
fi
])
dnl TYPE_IN_ADDR_T
dnl -------------------------------------------------
dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
dnl and a few other things.
AC_DEFUN([TYPE_IN_ADDR_T], [
AC_CHECK_TYPE([in_addr_t], ,[
dnl in_addr_t not available
AC_CACHE_CHECK([for in_addr_t equivalent],
[curl_cv_in_addr_t_equiv], [
curl_cv_in_addr_t_equiv="unknown"
for t in "unsigned long" int size_t unsigned long; do
if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
]],[[
$t data = inet_addr ("1.2.3.4");
]])
],[
curl_cv_in_addr_t_equiv="$t"
])
fi
done
])
case "$curl_cv_in_addr_t_equiv" in
unknown)
AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
;;
*)
AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
[Type to use in place of in_addr_t when system does not provide it.])
;;
esac
],[
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
dnl -------------------------------------------------
dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
AC_REQUIRE([AC_HEADER_TIME])dnl
AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
AC_MSG_CHECKING([for monotonic clock_gettime])
AC_COMPILE_IFELSE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
],[
AC_MSG_RESULT([yes])
ac_cv_func_clock_gettime="yes"
],[
AC_MSG_RESULT([no])
ac_cv_func_clock_gettime="no"
])
dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
dnl until library linking and run-time checks for clock_gettime succeed.
]) dnl AC_DEFUN
dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
dnl -------------------------------------------------
dnl If monotonic clock_gettime is available then,
dnl check and prepended to LIBS any needed libraries.
AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
if test "$ac_cv_func_clock_gettime" = "yes"; then
#
AC_MSG_CHECKING([for clock_gettime in libraries])
#
curl_cv_save_LIBS="$LIBS"
curl_cv_gclk_LIBS="unknown"
#
for x_xlibs in '' '-lrt' '-lposix4' ; do
if test "$curl_cv_gclk_LIBS" = "unknown"; then
if test -z "$x_xlibs"; then
LIBS="$curl_cv_save_LIBS"
else
LIBS="$x_xlibs $curl_cv_save_LIBS"
fi
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
]],[[
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
]])
],[
curl_cv_gclk_LIBS="$x_xlibs"
])
fi
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
done
#
LIBS="$curl_cv_save_LIBS"
#
case X-"$curl_cv_gclk_LIBS" in
X-unknown)
AC_MSG_RESULT([cannot find clock_gettime])
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
ac_cv_func_clock_gettime="no"
;;
X-)
AC_MSG_RESULT([no additional lib required])
ac_cv_func_clock_gettime="yes"
;;
*)
if test -z "$curl_cv_save_LIBS"; then
LIBS="$curl_cv_gclk_LIBS"
else
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
fi
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
ac_cv_func_clock_gettime="yes"
;;
esac
#
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$ac_cv_func_clock_gettime" = "yes"; then
AC_MSG_CHECKING([if monotonic clock_gettime works])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
]],[[
struct timespec ts;
if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
exit(0);
else
exit(1);
]])
],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
ac_cv_func_clock_gettime="no"
LIBS="$curl_cv_save_LIBS"
])
fi
#
case "$ac_cv_func_clock_gettime" in
yes)
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
[Define to 1 if you have the clock_gettime function and monotonic timer.])
;;
esac
#
fi
#
]) dnl AC_DEFUN
dnl CURL_CHECK_FUNC_SELECT
dnl -------------------------------------------------
dnl Test if the socket select() function is available,
dnl and check its return type and the types of its
dnl arguments. If the function succeeds HAVE_SELECT
dnl will be defined, defining the types of the
dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
dnl and SELECT_TYPE_ARG5, defining the type of the
dnl function return value in SELECT_TYPE_RETV, and
dnl also defining the type qualifier of fifth argument
dnl in SELECT_QUAL_ARG5.
AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
AC_CHECK_HEADERS(sys/select.h sys/socket.h)
#
AC_MSG_CHECKING([for select])
AC_LINK_IFELSE([
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
#ifndef HAVE_WINDOWS_H
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#endif
],[
AC_MSG_RESULT([yes])
curl_cv_select="yes"
],[
AC_MSG_RESULT([no])
curl_cv_select="no"
])
#
if test "$curl_cv_select" = "yes"; then
AC_CACHE_CHECK([types of args and return type for select],
[curl_cv_func_select_args], [
curl_cv_func_select_args="unknown"
for sel_retv in 'int' 'ssize_t'; do
for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
if test "$curl_cv_func_select_args" = "unknown"; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#define SELECTCALLCONV PASCAL
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
#ifndef HAVE_WINDOWS_H
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#define SELECTCALLCONV
#endif
#ifndef HAVE_STRUCT_TIMEVAL
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
struct timeval {
long tv_sec;
long tv_usec;
};
#endif
extern $sel_retv SELECTCALLCONV select($sel_arg1,
$sel_arg234,
$sel_arg234,
$sel_arg234,
$sel_arg5);
]],[[
$sel_arg1 nfds=0;
$sel_arg234 rfds=0;
$sel_arg234 wfds=0;
$sel_arg234 efds=0;
$sel_retv res = select(nfds, rfds, wfds, efds, 0);
]])
],[
curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
])
fi
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
done
done
done
done
]) # AC_CACHE_CHECK
if test "$curl_cv_func_select_args" = "unknown"; then
AC_MSG_WARN([Cannot find proper types to use for select args])
AC_MSG_WARN([HAVE_SELECT will not be defined])
else
select_prev_IFS=$IFS; IFS=','
set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
IFS=$select_prev_IFS
shift
#
sel_qual_type_arg5=$[3]
#
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
[Define to the type of arg 1 for select.])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
[Define to the type of args 2, 3 and 4 for select.])
AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
[Define to the function return type for select.])
#
prev_sh_opts=$-
#
case $prev_sh_opts in
*f*)
;;
*)
set -f
;;
esac
#
case "$sel_qual_type_arg5" in
const*)
sel_qual_arg5=const
sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
;;
*)
sel_qual_arg5=
sel_type_arg5=$sel_qual_type_arg5
;;
esac
#
AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
[Define to the type qualifier of arg 5 for select.])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
[Define to the type of arg 5 for select.])
#
case $prev_sh_opts in
*f*)
;;
*)
set +f
;;
esac
#
AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
[Define to 1 if you have the select function.])
ac_cv_func_select="yes"
fi
fi
]) # AC_DEFUN
dnl ************************************************************
dnl check for "localhost", if it doesn't exist, we can't do the
dnl gethostbyname_r tests!
dnl
AC_DEFUN([CURL_CHECK_WORKING_RESOLVER],[
AC_MSG_CHECKING([if "localhost" resolves])
AC_TRY_RUN([
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
#ifndef NULL
#define NULL (void *)0
#endif
int
main () {
struct hostent *h;
h = gethostbyname("localhost");
exit (h == NULL ? 1 : 0); }],[
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve])
]
)
])
dnl ************************************************************
Daniel Stenberg
committed
dnl check for working getaddrinfo() that works with AI_NUMERICHOST
AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
AC_TRY_RUN( [
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
int main(void)
{
struct addrinfo hints, *ai;
int error;
memset(&hints, 0, sizeof(hints));
Daniel Stenberg
committed
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
if (error) {
return 1;
return 0;
}
],[
ac_cv_working_getaddrinfo="yes"
],[
ac_cv_working_getaddrinfo="no"
],[
ac_cv_working_getaddrinfo="yes"
])])
if test "$ac_cv_working_getaddrinfo" = "yes"; then
AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
IPV6_ENABLED=1
AC_SUBST(IPV6_ENABLED)
fi
])
AC_DEFUN([CURL_CHECK_LOCALTIME_R],
AC_CHECK_FUNCS(localtime_r,[
AC_MSG_CHECKING(whether localtime_r is declared)
AC_EGREP_CPP(localtime_r,[
#undef _REENTRANT
#include <time.h>],[
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
AC_EGREP_CPP(localtime_r,[
#undef _REENTRANT
#define _REENTRANT
#include <time.h>],[
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))])])
dnl
dnl This function checks for strerror_r(). If it isn't found at first, it
dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
dnl in order to find this function.
dnl
dnl If the function is found, it will then proceed to check how the function
dnl actually works: glibc-style or POSIX-style.
dnl
dnl glibc:
dnl char *strerror_r(int errnum, char *buf, size_t n);
dnl
dnl What this one does is to return the error string (no surprises there),
dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
dnl parameters are only meant as an optional working area, in case strerror_r
dnl needs it. A quick test on a few systems shows that it's generally not
dnl touched at all.
dnl
dnl POSIX:
dnl int strerror_r(int errnum, char *buf, size_t n);
dnl
AC_DEFUN([CURL_CHECK_STRERROR_R],
[
AC_CHECK_FUNCS(strerror_r)
if test "x$ac_cv_func_strerror_r" = "xyes"; then
AC_MSG_CHECKING(whether strerror_r is declared)
AC_EGREP_CPP(strerror_r,[
#undef _REENTRANT
#include <string.h>],[
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
#undef _REENTRANT
#define _REENTRANT
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
) dnl with _THREAD_SAFE
]) dnl plain cpp for it
dnl determine if this strerror_r() is glibc or POSIX
AC_MSG_CHECKING([for a glibc strerror_r API])
AC_TRY_RUN([
#include <string.h>
#include <errno.h>
int
main () {
char buffer[1024]; /* big enough to play with */
char *string =
strerror_r(EACCES, buffer, sizeof(buffer));
/* this should've returned a string */
if(!string || !string[0])
return 99;
return 0;
}
],
GLIBC_STRERROR_R="1"
AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]),
dnl Use an inferior method of strerror_r detection while cross-compiling
AC_EGREP_CPP(yes, [
#include <features.h>
#ifdef __GLIBC__
yes
#endif
],
dnl looks like glibc, so assume a glibc-style strerror_r()
GLIBC_STRERROR_R="1"
AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
AC_MSG_RESULT([yes]),
AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
) dnl while cross-compiling
)
if test -z "$GLIBC_STRERROR_R"; then
AC_MSG_CHECKING([for a POSIX strerror_r API])
AC_TRY_RUN([
#include <string.h>
#include <errno.h>
int
main () {
char buffer[1024]; /* big enough to play with */
int error =
strerror_r(EACCES, buffer, sizeof(buffer));
/* This should've returned zero, and written an error string in the
buffer.*/
if(!buffer[0] || error)
return 99;
return 0;
}
],
AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]) ,
dnl cross-compiling!
AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
)
fi dnl if not using glibc API
fi dnl we have a strerror_r
AC_DEFUN([CURL_CHECK_INET_NTOA_R],
[
dnl determine if function definition for inet_ntoa_r exists.
AC_CHECK_FUNCS(inet_ntoa_r,[
AC_MSG_CHECKING(whether inet_ntoa_r is declared)
AC_EGREP_CPP(inet_ntoa_r,[
#undef _REENTRANT
AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
AC_EGREP_CPP(inet_ntoa_r,[
#undef _REENTRANT
#define _REENTRANT
#include <arpa/inet.h>],[
AC_DEFINE(HAVE_INET_NTOA_R_DECL, 1, [inet_ntoa_r() is declared])
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))])])
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
dnl CURL_CHECK_GETHOSTBYADDR_R
dnl -------------------------------------------------
dnl check number of arguments for gethostbyaddr_r, it
dnl might take either 5, 7, or 8 arguments.
AC_DEFUN([CURL_CHECK_GETHOSTBYADDR_R], [
#
AC_MSG_CHECKING([for gethostbyaddr_r])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyaddr_r="yes"
],[
AC_MSG_RESULT([no])
tmp_cv_gethostbyaddr_r="no"
])
#
if test "$tmp_cv_gethostbyaddr_r" != "yes"; then
AC_MSG_CHECKING([deeper for gethostbyaddr_r])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
gethostbyaddr_r();
]])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyaddr_r="yes"
],[
AC_MSG_RESULT([but still no])
tmp_cv_gethostbyaddr_r="no"
])
fi
#
if test "$tmp_cv_gethostbyaddr_r" = "yes"; then
ac_cv_gethostbyaddr_r_args="unknown"
AC_MSG_CHECKING([if gethostbyaddr_r takes 5 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
struct hostent_data hdata;
int rc;
rc = gethostbyaddr_r(address, length, type, &h, &hdata);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
ac_cv_gethostbyaddr_r_args="5"
],[
AC_MSG_RESULT([no])
])
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 5 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <sys/types.h>
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
struct hostent_data hdata;
int rc;
rc = gethostbyaddr_r(address, length, type, &h, &hdata);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args])
ac_cv_gethostbyaddr_r_args="5"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyaddr_r takes 7 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
char buffer[8192];
int h_errnop;
struct hostent * hp;
hp = gethostbyaddr_r(address, length, type, &h,
buffer, 8192, &h_errnop);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
ac_cv_gethostbyaddr_r_args="7"
],[
AC_MSG_RESULT([no])
])
fi
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 7 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
char buffer[8192];
int h_errnop;
struct hostent * hp;
hp = gethostbyaddr_r(address, length, type, &h,
buffer, 8192, &h_errnop);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args])
ac_cv_gethostbyaddr_r_args="7"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyaddr_r takes 8 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
char buffer[8192];
int h_errnop;
struct hostent * hp;
int rc;
rc = gethostbyaddr_r(address, length, type, &h,
buffer, 8192, &hp, &h_errnop);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
ac_cv_gethostbyaddr_r_args="8"
],[
AC_MSG_RESULT([no])
])
fi
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_CHECKING([if gethostbyaddr_r with -D_REENTRANT takes 8 arguments])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef _REENTRANT
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>
]],[[
char * address;
int length;
int type;
struct hostent h;
char buffer[8192];
int h_errnop;
struct hostent * hp;
int rc;
rc = gethostbyaddr_r(address, length, type, &h,
buffer, 8192, &hp, &h_errnop);
]])
],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args])
ac_cv_gethostbyaddr_r_args="8"
],[
AC_MSG_RESULT([no])
])
fi
if test "$ac_cv_gethostbyaddr_r_args" = "unknown"; then
AC_MSG_WARN([Cannot find out how to use gethostbyaddr_r])
AC_MSG_WARN([HAVE_GETHOSTBYADDR_R will not be defined])
ac_cv_func_gethostbyaddr_r="no"
else
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1,
[Define to 1 if you have the gethostbyaddr_r function.])
ac_cv_func_gethostbyaddr_r="yes"
fi
else
ac_cv_func_gethostbyaddr_r="no"
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
dnl CURL_CHECK_GETHOSTBYNAME_R
dnl -------------------------------------------------
dnl check number of arguments for gethostbyname_r, it
dnl might take either 3, 5, or 6 arguments.
AC_DEFUN([CURL_CHECK_GETHOSTBYNAME_R], [
#
AC_MSG_CHECKING([for gethostbyname_r])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyname_r="yes"
],[
AC_MSG_RESULT([no])
tmp_cv_gethostbyname_r="no"
])
#
if test "$tmp_cv_gethostbyname_r" != "yes"; then
AC_MSG_CHECKING([deeper for gethostbyname_r])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
gethostbyname_r();
]])
],[
AC_MSG_RESULT([yes])
tmp_cv_gethostbyname_r="yes"
],[
AC_MSG_RESULT([but still no])