Newer
Older
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
[Define to 1 if you have the gethostbyname function.])
ac_cv_func_gethostbyname="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gethostbyname="no"
fi
])
dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
dnl -------------------------------------------------
dnl Verify if gethostbyname_r is available, prototyped,
dnl and can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_gethostbyname_r, then
dnl HAVE_GETHOSTBYNAME_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
#
tst_links_gethostbyname_r="unknown"
tst_proto_gethostbyname_r="unknown"
tst_compi_gethostbyname_r="unknown"
tst_allow_gethostbyname_r="unknown"
tst_nargs_gethostbyname_r="unknown"
#
AC_MSG_CHECKING([if gethostbyname_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
],[
AC_MSG_RESULT([yes])
tst_links_gethostbyname_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_gethostbyname_r="no"
])
#
if test "$tst_links_gethostbyname_r" = "yes"; then
AC_MSG_CHECKING([if gethostbyname_r is prototyped])
AC_EGREP_CPP([gethostbyname_r],[
$curl_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_gethostbyname_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gethostbyname_r="no"
])
fi
#
if test "$tst_proto_gethostbyname_r" = "yes"; then
if test "$tst_nargs_gethostbyname_r" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != gethostbyname_r(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostbyname_r="yes"
tst_nargs_gethostbyname_r="3"
],[
AC_MSG_RESULT([no])
tst_compi_gethostbyname_r="no"
])
fi
if test "$tst_nargs_gethostbyname_r" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != gethostbyname_r(0, 0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostbyname_r="yes"
tst_nargs_gethostbyname_r="5"
],[
AC_MSG_RESULT([no])
tst_compi_gethostbyname_r="no"
])
fi
if test "$tst_nargs_gethostbyname_r" = "unknown"; then
AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostbyname_r="yes"
tst_nargs_gethostbyname_r="6"
],[
AC_MSG_RESULT([no])
tst_compi_gethostbyname_r="no"
])
fi
AC_MSG_CHECKING([if gethostbyname_r is compilable])
if test "$tst_compi_gethostbyname_r" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
#
if test "$tst_compi_gethostbyname_r" = "yes"; then
AC_MSG_CHECKING([if gethostbyname_r usage allowed])
if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gethostbyname_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_gethostbyname_r="no"
fi
fi
#
AC_MSG_CHECKING([if gethostbyname_r might be used])
if test "$tst_links_gethostbyname_r" = "yes" &&
test "$tst_proto_gethostbyname_r" = "yes" &&
test "$tst_compi_gethostbyname_r" = "yes" &&
test "$tst_allow_gethostbyname_r" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
[Define to 1 if you have the gethostbyname_r function.])
dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
dnl [Specifies the number of arguments to gethostbyname_r])
#
if test "$tst_nargs_gethostbyname_r" -eq "3"; then
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
fi
#
ac_cv_func_gethostbyname_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gethostbyname_r="no"
fi
])
dnl CURL_CHECK_FUNC_GETHOSTNAME
dnl -------------------------------------------------
dnl Verify if gethostname is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_gethostname, then
dnl HAVE_GETHOSTNAME will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
#
tst_links_gethostname="unknown"
tst_proto_gethostname="unknown"
tst_compi_gethostname="unknown"
tst_allow_gethostname="unknown"
#
AC_MSG_CHECKING([if gethostname can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_winsock2
$curl_includes_unistd
]],[[
if(0 != gethostname(0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_links_gethostname="yes"
],[
AC_MSG_RESULT([no])
tst_links_gethostname="no"
])
#
if test "$tst_links_gethostname" = "yes"; then
AC_MSG_CHECKING([if gethostname is prototyped])
AC_EGREP_CPP([gethostname],[
$curl_includes_unistd
],[
AC_MSG_RESULT([yes])
tst_proto_gethostname="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gethostname="no"
])
fi
#
if test "$tst_proto_gethostname" = "yes"; then
AC_MSG_CHECKING([if gethostname is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
$curl_includes_unistd
]],[[
if(0 != gethostname(0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostname="yes"
],[
AC_MSG_RESULT([no])
tst_compi_gethostname="no"
])
fi
#
if test "$tst_compi_gethostname" = "yes"; then
AC_MSG_CHECKING([if gethostname usage allowed])
if test "x$curl_disallow_gethostname" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gethostname="yes"
else
AC_MSG_RESULT([no])
tst_allow_gethostname="no"
fi
fi
#
AC_MSG_CHECKING([if gethostname might be used])
if test "$tst_links_gethostname" = "yes" &&
test "$tst_proto_gethostname" = "yes" &&
test "$tst_compi_gethostname" = "yes" &&
test "$tst_allow_gethostname" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
[Define to 1 if you have the gethostname function.])
ac_cv_func_gethostname="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gethostname="no"
fi
])
dnl CURL_CHECK_FUNC_GETIFADDRS
dnl -------------------------------------------------
dnl Verify if getifaddrs is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable curl_disallow_getifaddrs, then
dnl HAVE_GETIFADDRS will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
#
tst_links_getifaddrs="unknown"
tst_proto_getifaddrs="unknown"
tst_compi_getifaddrs="unknown"
tst_works_getifaddrs="unknown"
tst_allow_getifaddrs="unknown"
#
AC_MSG_CHECKING([if getifaddrs can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([getifaddrs])
],[
AC_MSG_RESULT([yes])
tst_links_getifaddrs="yes"
],[
AC_MSG_RESULT([no])
tst_links_getifaddrs="no"
])
#
if test "$tst_links_getifaddrs" = "yes"; then
AC_MSG_CHECKING([if getifaddrs is prototyped])
AC_EGREP_CPP([getifaddrs],[
$curl_includes_ifaddrs
],[
AC_MSG_RESULT([yes])
tst_proto_getifaddrs="yes"
],[
AC_MSG_RESULT([no])
tst_proto_getifaddrs="no"
])
fi
#
if test "$tst_proto_getifaddrs" = "yes"; then
AC_MSG_CHECKING([if getifaddrs is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_ifaddrs
]],[[
if(0 != getifaddrs(0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getifaddrs="yes"
],[
AC_MSG_RESULT([no])
tst_compi_getifaddrs="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_getifaddrs" = "yes"; then
AC_MSG_CHECKING([if getifaddrs seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_stdlib
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
$curl_includes_ifaddrs
]],[[
struct ifaddrs *ifa = 0;
int error;
error = getifaddrs(&ifa);
if(error || !ifa)
exit(1); /* fail */
else
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_getifaddrs="yes"
],[
AC_MSG_RESULT([no])
tst_works_getifaddrs="no"
])
fi
#
if test "$tst_compi_getifaddrs" = "yes" &&
test "$tst_works_getifaddrs" != "no"; then
AC_MSG_CHECKING([if getifaddrs usage allowed])
if test "x$curl_disallow_getifaddrs" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_getifaddrs="yes"
else
AC_MSG_RESULT([no])
tst_allow_getifaddrs="no"
fi
fi
#
AC_MSG_CHECKING([if getifaddrs might be used])
if test "$tst_links_getifaddrs" = "yes" &&
test "$tst_proto_getifaddrs" = "yes" &&
test "$tst_compi_getifaddrs" = "yes" &&
test "$tst_allow_getifaddrs" = "yes" &&
test "$tst_works_getifaddrs" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
[Define to 1 if you have a working getifaddrs function.])
ac_cv_func_getifaddrs="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_getifaddrs="no"
fi
])
dnl CURL_CHECK_FUNC_GETSERVBYPORT_R
dnl -------------------------------------------------
dnl Verify if getservbyport_r is available, prototyped,
dnl and can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_getservbyport_r, then
dnl HAVE_GETSERVBYPORT_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GETSERVBYPORT_R], [
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
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
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
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
#
tst_links_getservbyport_r="unknown"
tst_proto_getservbyport_r="unknown"
tst_compi_getservbyport_r="unknown"
tst_allow_getservbyport_r="unknown"
tst_nargs_getservbyport_r="unknown"
#
AC_MSG_CHECKING([if getservbyport_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([getservbyport_r])
],[
AC_MSG_RESULT([yes])
tst_links_getservbyport_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_getservbyport_r="no"
])
#
if test "$tst_links_getservbyport_r" = "yes"; then
AC_MSG_CHECKING([if getservbyport_r is prototyped])
AC_EGREP_CPP([getservbyport_r],[
$curl_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_getservbyport_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_getservbyport_r="no"
])
fi
#
if test "$tst_proto_getservbyport_r" = "yes"; then
if test "$tst_nargs_getservbyport_r" = "unknown"; then
AC_MSG_CHECKING([if getservbyport_r takes 4 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != getservbyport_r(0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getservbyport_r="yes"
tst_nargs_getservbyport_r="4"
],[
AC_MSG_RESULT([no])
tst_compi_getservbyport_r="no"
])
fi
if test "$tst_nargs_getservbyport_r" = "unknown"; then
AC_MSG_CHECKING([if getservbyport_r takes 5 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != getservbyport_r(0, 0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getservbyport_r="yes"
tst_nargs_getservbyport_r="5"
],[
AC_MSG_RESULT([no])
tst_compi_getservbyport_r="no"
])
fi
if test "$tst_nargs_getservbyport_r" = "unknown"; then
AC_MSG_CHECKING([if getservbyport_r takes 6 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_netdb
]],[[
if(0 != getservbyport_r(0, 0, 0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getservbyport_r="yes"
tst_nargs_getservbyport_r="6"
],[
AC_MSG_RESULT([no])
tst_compi_getservbyport_r="no"
])
fi
AC_MSG_CHECKING([if getservbyport_r is compilable])
if test "$tst_compi_getservbyport_r" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
#
if test "$tst_compi_getservbyport_r" = "yes"; then
AC_MSG_CHECKING([if getservbyport_r usage allowed])
if test "x$curl_disallow_getservbyport_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_getservbyport_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_getservbyport_r="no"
fi
fi
#
AC_MSG_CHECKING([if getservbyport_r might be used])
if test "$tst_links_getservbyport_r" = "yes" &&
test "$tst_proto_getservbyport_r" = "yes" &&
test "$tst_compi_getservbyport_r" = "yes" &&
test "$tst_allow_getservbyport_r" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1,
[Define to 1 if you have the getservbyport_r function.])
AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r,
[Specifies the number of arguments to getservbyport_r])
if test "$tst_nargs_getservbyport_r" -eq "4"; then
AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data),
[Specifies the size of the buffer to pass to getservbyport_r])
else
AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096,
[Specifies the size of the buffer to pass to getservbyport_r])
fi
ac_cv_func_getservbyport_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_getservbyport_r="no"
fi
])
dnl CURL_CHECK_FUNC_GMTIME_R
dnl -------------------------------------------------
dnl Verify if gmtime_r is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable curl_disallow_gmtime_r, then
dnl HAVE_GMTIME_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
AC_REQUIRE([CURL_INCLUDES_TIME])dnl
#
tst_links_gmtime_r="unknown"
tst_proto_gmtime_r="unknown"
tst_compi_gmtime_r="unknown"
tst_works_gmtime_r="unknown"
tst_allow_gmtime_r="unknown"
#
AC_MSG_CHECKING([if gmtime_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([gmtime_r])
],[
AC_MSG_RESULT([yes])
tst_links_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_gmtime_r="no"
])
#
if test "$tst_links_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r is prototyped])
AC_EGREP_CPP([gmtime_r],[
$curl_includes_time
],[
AC_MSG_RESULT([yes])
tst_proto_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gmtime_r="no"
])
fi
#
if test "$tst_proto_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_time
]],[[
if(0 != gmtime_r(0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_compi_gmtime_r="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_gmtime_r" = "yes"; then
AC_MSG_CHECKING([if gmtime_r seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_time
]],[[
time_t local = 1170352587;
struct tm *gmt = 0;
struct tm result;
gmt = gmtime_r(&local, &result);
if(gmt)
exit(0);
else
exit(1);
]])
],[
AC_MSG_RESULT([yes])
tst_works_gmtime_r="yes"
],[
AC_MSG_RESULT([no])
tst_works_gmtime_r="no"
])
fi
#
if test "$tst_compi_gmtime_r" = "yes" &&
test "$tst_works_gmtime_r" != "no"; then
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
AC_MSG_CHECKING([if gmtime_r usage allowed])
if test "x$curl_disallow_gmtime_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gmtime_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_gmtime_r="no"
fi
fi
#
AC_MSG_CHECKING([if gmtime_r might be used])
if test "$tst_links_gmtime_r" = "yes" &&
test "$tst_proto_gmtime_r" = "yes" &&
test "$tst_compi_gmtime_r" = "yes" &&
test "$tst_allow_gmtime_r" = "yes" &&
test "$tst_works_gmtime_r" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
[Define to 1 if you have a working gmtime_r function.])
ac_cv_func_gmtime_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gmtime_r="no"
fi
])
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
dnl CURL_CHECK_FUNC_INET_NTOA_R
dnl -------------------------------------------------
dnl Verify if inet_ntoa_r is available, prototyped,
dnl and can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_inet_ntoa_r, then
dnl HAVE_INET_NTOA_R will be defined.
AC_DEFUN([CURL_CHECK_FUNC_INET_NTOA_R], [
AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
#
tst_links_inet_ntoa_r="unknown"
tst_proto_inet_ntoa_r="unknown"
tst_compi_inet_ntoa_r="unknown"
tst_allow_inet_ntoa_r="unknown"
tst_nargs_inet_ntoa_r="unknown"
#
AC_MSG_CHECKING([if inet_ntoa_r can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([inet_ntoa_r])
],[
AC_MSG_RESULT([yes])
tst_links_inet_ntoa_r="yes"
],[
AC_MSG_RESULT([no])
tst_links_inet_ntoa_r="no"
])
#
if test "$tst_links_inet_ntoa_r" = "yes"; then
AC_MSG_CHECKING([if inet_ntoa_r is prototyped])
AC_EGREP_CPP([inet_ntoa_r],[
$curl_includes_arpa_inet
],[
AC_MSG_RESULT([yes])
tst_proto_inet_ntoa_r="yes"
],[
AC_MSG_RESULT([no])
tst_proto_inet_ntoa_r="no"
])
fi
#
if test "$tst_proto_inet_ntoa_r" = "yes"; then
if test "$tst_nargs_inet_ntoa_r" = "unknown"; then
AC_MSG_CHECKING([if inet_ntoa_r takes 2 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_arpa_inet
]],[[
struct in_addr addr;
if(0 != inet_ntoa_r(addr, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_inet_ntoa_r="yes"
tst_nargs_inet_ntoa_r="2"
],[
AC_MSG_RESULT([no])
tst_compi_inet_ntoa_r="no"
])
fi
if test "$tst_nargs_inet_ntoa_r" = "unknown"; then
AC_MSG_CHECKING([if inet_ntoa_r takes 3 args.])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_arpa_inet
]],[[
struct in_addr addr;
if(0 != inet_ntoa_r(addr, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_inet_ntoa_r="yes"
tst_nargs_inet_ntoa_r="3"
],[
AC_MSG_RESULT([no])
tst_compi_inet_ntoa_r="no"
])
fi
AC_MSG_CHECKING([if inet_ntoa_r is compilable])
if test "$tst_compi_inet_ntoa_r" = "yes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
#
if test "$tst_compi_inet_ntoa_r" = "yes"; then
AC_MSG_CHECKING([if inet_ntoa_r usage allowed])
if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_inet_ntoa_r="yes"
else
AC_MSG_RESULT([no])
tst_allow_inet_ntoa_r="no"
fi
fi
#
AC_MSG_CHECKING([if inet_ntoa_r might be used])
if test "$tst_links_inet_ntoa_r" = "yes" &&
test "$tst_proto_inet_ntoa_r" = "yes" &&
test "$tst_compi_inet_ntoa_r" = "yes" &&
test "$tst_allow_inet_ntoa_r" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_INET_NTOA_R, 1,
[Define to 1 if you have the inet_ntoa_r function.])
dnl AC_DEFINE_UNQUOTED(INET_NTOA_R_ARGS, $tst_nargs_inet_ntoa_r,
dnl [Specifies the number of arguments to inet_ntoa_r])
#
if test "$tst_nargs_inet_ntoa_r" -eq "2"; then
AC_DEFINE(HAVE_INET_NTOA_R_2, 1, [inet_ntoa_r() takes 2 args])
elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then
AC_DEFINE(HAVE_INET_NTOA_R_3, 1, [inet_ntoa_r() takes 3 args])
fi
#
ac_cv_func_inet_ntoa_r="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_inet_ntoa_r="no"
fi
])
dnl CURL_CHECK_FUNC_INET_NTOP
dnl -------------------------------------------------
dnl Verify if inet_ntop is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable curl_disallow_inet_ntop, then
dnl HAVE_INET_NTOP will be defined.
AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
#
tst_links_inet_ntop="unknown"
tst_proto_inet_ntop="unknown"
tst_compi_inet_ntop="unknown"
tst_works_inet_ntop="unknown"
tst_allow_inet_ntop="unknown"
#
AC_MSG_CHECKING([if inet_ntop can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([inet_ntop])
],[
AC_MSG_RESULT([yes])
tst_links_inet_ntop="yes"
],[
AC_MSG_RESULT([no])
tst_links_inet_ntop="no"
])
#
if test "$tst_links_inet_ntop" = "yes"; then
AC_MSG_CHECKING([if inet_ntop is prototyped])
AC_EGREP_CPP([inet_ntop],[
$curl_includes_arpa_inet
],[
AC_MSG_RESULT([yes])
tst_proto_inet_ntop="yes"
],[
AC_MSG_RESULT([no])
tst_proto_inet_ntop="no"
])
fi
#
if test "$tst_proto_inet_ntop" = "yes"; then
AC_MSG_CHECKING([if inet_ntop is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_arpa_inet
]],[[
if(0 != inet_ntop(0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_inet_ntop="yes"
],[
AC_MSG_RESULT([no])
tst_compi_inet_ntop="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_inet_ntop" = "yes"; then
AC_MSG_CHECKING([if inet_ntop seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
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
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
$curl_includes_arpa_inet
$curl_includes_string
]],[[
char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
char ipv4res[sizeof "255.255.255.255"];
unsigned char ipv6a[26];
unsigned char ipv4a[5];
char *ipv6ptr = 0;
char *ipv4ptr = 0;
/* - */
ipv4res[0] = '\0';
ipv4a[0] = 0xc0;
ipv4a[1] = 0xa8;
ipv4a[2] = 0x64;
ipv4a[3] = 0x01;
ipv4a[4] = 0x01;
/* - */
ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
if(!ipv4ptr)
exit(1); /* fail */
if(ipv4ptr != ipv4res)
exit(1); /* fail */
if(!ipv4ptr[0])
exit(1); /* fail */
if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
exit(1); /* fail */
/* - */
ipv6res[0] = '\0';
memset(ipv6a, 0, sizeof(ipv6a));
ipv6a[0] = 0xfe;
ipv6a[1] = 0x80;
ipv6a[8] = 0x02;
ipv6a[9] = 0x14;
ipv6a[10] = 0x4f;
ipv6a[11] = 0xff;
ipv6a[12] = 0xfe;
ipv6a[13] = 0x0b;
ipv6a[14] = 0x76;
ipv6a[15] = 0xc8;
ipv6a[25] = 0x01;
/* - */
ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
if(!ipv6ptr)
exit(1); /* fail */
if(ipv6ptr != ipv6res)
exit(1); /* fail */
if(!ipv6ptr[0])
exit(1); /* fail */
if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
exit(1); /* fail */
/* - */
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_inet_ntop="yes"
],[
AC_MSG_RESULT([no])
tst_works_inet_ntop="no"
])
fi
#
if test "$tst_compi_inet_ntop" = "yes" &&
test "$tst_works_inet_ntop" != "no"; then
AC_MSG_CHECKING([if inet_ntop usage allowed])
if test "x$curl_disallow_inet_ntop" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_inet_ntop="yes"
else
AC_MSG_RESULT([no])
tst_allow_inet_ntop="no"
fi
fi
#
AC_MSG_CHECKING([if inet_ntop might be used])
if test "$tst_links_inet_ntop" = "yes" &&
test "$tst_proto_inet_ntop" = "yes" &&
test "$tst_compi_inet_ntop" = "yes" &&
test "$tst_allow_inet_ntop" = "yes" &&
test "$tst_works_inet_ntop" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
[Define to 1 if you have a IPv6 capable working inet_ntop function.])
ac_cv_func_inet_ntop="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_inet_ntop="no"
fi
])
dnl CURL_CHECK_FUNC_INET_PTON
dnl -------------------------------------------------
dnl Verify if inet_pton is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable curl_disallow_inet_pton, then
dnl HAVE_INET_PTON will be defined.
AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
2912
2913
2914
2915
2916
2917
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
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
AC_REQUIRE([CURL_INCLUDES_STRING])dnl
#
tst_links_inet_pton="unknown"
tst_proto_inet_pton="unknown"
tst_compi_inet_pton="unknown"
tst_works_inet_pton="unknown"
tst_allow_inet_pton="unknown"
#
AC_MSG_CHECKING([if inet_pton can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([inet_pton])
],[
AC_MSG_RESULT([yes])
tst_links_inet_pton="yes"
],[
AC_MSG_RESULT([no])
tst_links_inet_pton="no"
])
#
if test "$tst_links_inet_pton" = "yes"; then
AC_MSG_CHECKING([if inet_pton is prototyped])
AC_EGREP_CPP([inet_pton],[
$curl_includes_arpa_inet
],[
AC_MSG_RESULT([yes])
tst_proto_inet_pton="yes"
],[
AC_MSG_RESULT([no])
tst_proto_inet_pton="no"
])
fi
#
if test "$tst_proto_inet_pton" = "yes"; then
AC_MSG_CHECKING([if inet_pton is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_arpa_inet
]],[[
if(0 != inet_pton(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_inet_pton="yes"
],[
AC_MSG_RESULT([no])
tst_compi_inet_pton="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_inet_pton" = "yes"; then
AC_MSG_CHECKING([if inet_pton seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_arpa_inet
$curl_includes_string
]],[[
unsigned char ipv6a[16+1];
unsigned char ipv4a[4+1];
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
const char *ipv4src = "192.168.100.1";
/* - */
memset(ipv4a, 1, sizeof(ipv4a));
if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
exit(1); /* fail */
/* - */
if( (ipv4a[0] != 0xc0) ||
(ipv4a[1] != 0xa8) ||
(ipv4a[2] != 0x64) ||
(ipv4a[3] != 0x01) ||
(ipv4a[4] != 0x01) )
exit(1); /* fail */
/* - */
memset(ipv6a, 1, sizeof(ipv6a));
if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
exit(1); /* fail */
/* - */
if( (ipv6a[0] != 0xfe) ||
(ipv6a[1] != 0x80) ||
(ipv6a[8] != 0x02) ||
(ipv6a[9] != 0x14) ||
(ipv6a[10] != 0x4f) ||
(ipv6a[11] != 0xff) ||
(ipv6a[12] != 0xfe) ||
(ipv6a[13] != 0x0b) ||