Newer
Older
#***************************************************************************
# $Id$
#
# Copyright (C) 2008 - 2009 by Daniel Stenberg et al
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
dnl CARES_INCLUDES_ARPA_INET
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when arpa/inet.h is to be included.
AC_DEFUN([CARES_INCLUDES_ARPA_INET], [
cares_includes_arpa_inet="\
/* includes start */
#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
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
[], [], [$cares_includes_arpa_inet])
])
dnl CARES_INCLUDES_FCNTL
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when fcntl.h is to be included.
AC_DEFUN([CARES_INCLUDES_FCNTL], [
cares_includes_fcntl="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
# include <fcntl.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h unistd.h fcntl.h,
[], [], [$cares_includes_fcntl])
])
dnl CARES_INCLUDES_NETDB
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when netdb.h is to be included.
AC_DEFUN([CARES_INCLUDES_NETDB], [
cares_includes_netdb="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h netdb.h,
[], [], [$cares_includes_netdb])
])
dnl CARES_INCLUDES_STDLIB
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when stdlib.h is to be included.
AC_DEFUN([CARES_INCLUDES_STDLIB], [
cares_includes_stdlib="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h stdlib.h,
[], [], [$cares_includes_stdlib])
])
dnl CARES_INCLUDES_STRING
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
AC_DEFUN([CARES_INCLUDES_STRING], [
cares_includes_string="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
[], [], [$cares_includes_string])
])
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
dnl CARES_INCLUDES_STROPTS
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when stropts.h is to be included.
AC_DEFUN([CARES_INCLUDES_STROPTS], [
cares_includes_stropts="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_STROPTS_H
# include <stropts.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
[], [], [$cares_includes_stropts])
])
dnl CARES_INCLUDES_SYS_SOCKET
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when sys/socket.h is to be included.
AC_DEFUN([CARES_INCLUDES_SYS_SOCKET], [
cares_includes_sys_socket="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h sys/socket.h,
[], [], [$cares_includes_sys_socket])
])
dnl CARES_INCLUDES_SYS_UIO
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when sys/uio.h is to be included.
AC_DEFUN([CARES_INCLUDES_SYS_UIO], [
cares_includes_sys_uio="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h sys/uio.h,
[], [], [$cares_includes_sys_uio])
])
dnl CARES_INCLUDES_UNISTD
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when unistd.h is to be included.
AC_DEFUN([CARES_INCLUDES_UNISTD], [
cares_includes_unistd="\
/* includes start */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* includes end */"
AC_CHECK_HEADERS(
sys/types.h unistd.h,
[], [], [$cares_includes_unistd])
])
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
dnl CARES_INCLUDES_WINSOCK2
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when winsock(2).h is to be included.
AC_DEFUN([CARES_INCLUDES_WINSOCK2], [
cares_includes_winsock2="\
/* includes start */
#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
/* includes end */"
CURL_CHECK_HEADER_WINDOWS
CURL_CHECK_HEADER_WINSOCK
CURL_CHECK_HEADER_WINSOCK2
])
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
dnl CARES_INCLUDES_WS2TCPIP
dnl -------------------------------------------------
dnl Set up variable with list of headers that must be
dnl included when ws2tcpip.h is to be included.
AC_DEFUN([CARES_INCLUDES_WS2TCPIP], [
cares_includes_ws2tcpip="\
/* includes start */
#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>
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
# endif
# endif
#endif
/* includes end */"
CURL_CHECK_HEADER_WINDOWS
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP
])
dnl CARES_PREPROCESS_CALLCONV
dnl -------------------------------------------------
dnl Set up variable with a preprocessor block which
dnl defines function calling convention.
AC_DEFUN([CARES_PREPROCESS_CALLCONV], [
cares_preprocess_callconv="\
/* preprocess start */
#ifdef HAVE_WINDOWS_H
# define FUNCALLCONV __stdcall
#else
# define FUNCALLCONV
#endif
/* preprocess end */"
])
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
dnl CARES_CHECK_FUNC_FCNTL
dnl -------------------------------------------------
dnl Verify if fcntl 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 cares_disallow_fcntl, then
dnl HAVE_FCNTL will be defined.
AC_DEFUN([CARES_CHECK_FUNC_FCNTL], [
AC_REQUIRE([CARES_INCLUDES_FCNTL])dnl
#
tst_links_fcntl="unknown"
tst_proto_fcntl="unknown"
tst_compi_fcntl="unknown"
tst_allow_fcntl="unknown"
#
AC_MSG_CHECKING([if fcntl can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([fcntl])
],[
AC_MSG_RESULT([yes])
tst_links_fcntl="yes"
],[
AC_MSG_RESULT([no])
tst_links_fcntl="no"
])
#
if test "$tst_links_fcntl" = "yes"; then
AC_MSG_CHECKING([if fcntl is prototyped])
AC_EGREP_CPP([fcntl],[
$cares_includes_fcntl
],[
AC_MSG_RESULT([yes])
tst_proto_fcntl="yes"
],[
AC_MSG_RESULT([no])
tst_proto_fcntl="no"
])
fi
#
if test "$tst_proto_fcntl" = "yes"; then
AC_MSG_CHECKING([if fcntl is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_fcntl
]],[[
if(0 != fcntl(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_fcntl="yes"
],[
AC_MSG_RESULT([no])
tst_compi_fcntl="no"
])
fi
#
if test "$tst_compi_fcntl" = "yes"; then
AC_MSG_CHECKING([if fcntl usage allowed])
if test "x$cares_disallow_fcntl" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_fcntl="yes"
else
AC_MSG_RESULT([no])
tst_allow_fcntl="no"
fi
fi
#
AC_MSG_CHECKING([if fcntl might be used])
if test "$tst_links_fcntl" = "yes" &&
test "$tst_proto_fcntl" = "yes" &&
test "$tst_compi_fcntl" = "yes" &&
test "$tst_allow_fcntl" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
[Define to 1 if you have the fcntl function.])
ac_cv_func_fcntl="yes"
CARES_CHECK_FUNC_FCNTL_O_NONBLOCK
else
AC_MSG_RESULT([no])
ac_cv_func_fcntl="no"
fi
])
dnl CARES_CHECK_FUNC_FCNTL_O_NONBLOCK
dnl -------------------------------------------------
dnl Verify if fcntl with status flag O_NONBLOCK is
dnl available, can be compiled, and seems to work. If
dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
dnl will be defined.
AC_DEFUN([CARES_CHECK_FUNC_FCNTL_O_NONBLOCK], [
#
tst_compi_fcntl_o_nonblock="unknown"
tst_allow_fcntl_o_nonblock="unknown"
#
case $host_os in
sunos4* | aix3* | beos*)
dnl O_NONBLOCK does not work on these platforms
cares_disallow_fcntl_o_nonblock="yes"
;;
esac
#
if test "$ac_cv_func_fcntl" = "yes"; then
AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_fcntl
]],[[
int flags = 0;
if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_fcntl_o_nonblock="yes"
],[
AC_MSG_RESULT([no])
tst_compi_fcntl_o_nonblock="no"
])
fi
#
if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
if test "x$cares_disallow_fcntl_o_nonblock" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_fcntl_o_nonblock="yes"
else
AC_MSG_RESULT([no])
tst_allow_fcntl_o_nonblock="no"
fi
fi
#
AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
test "$tst_allow_fcntl_o_nonblock" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
[Define to 1 if you have a working fcntl O_NONBLOCK function.])
ac_cv_func_fcntl_o_nonblock="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_fcntl_o_nonblock="no"
fi
])
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
dnl CARES_CHECK_FUNC_FREEADDRINFO
dnl -------------------------------------------------
dnl Verify if freeaddrinfo is available, prototyped,
dnl and can be compiled. If all of these are true,
dnl and usage has not been previously disallowed with
dnl shell variable cares_disallow_freeaddrinfo, then
dnl HAVE_FREEADDRINFO will be defined.
AC_DEFUN([CARES_CHECK_FUNC_FREEADDRINFO], [
AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
#
tst_links_freeaddrinfo="unknown"
tst_proto_freeaddrinfo="unknown"
tst_compi_freeaddrinfo="unknown"
tst_allow_freeaddrinfo="unknown"
#
AC_MSG_CHECKING([if freeaddrinfo can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
freeaddrinfo(0);
]])
],[
AC_MSG_RESULT([yes])
tst_links_freeaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_links_freeaddrinfo="no"
])
#
if test "$tst_links_freeaddrinfo" = "yes"; then
AC_MSG_CHECKING([if freeaddrinfo is prototyped])
AC_EGREP_CPP([freeaddrinfo],[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_freeaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_proto_freeaddrinfo="no"
])
fi
#
if test "$tst_proto_freeaddrinfo" = "yes"; then
AC_MSG_CHECKING([if freeaddrinfo is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
freeaddrinfo(0);
]])
],[
AC_MSG_RESULT([yes])
tst_compi_freeaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_compi_freeaddrinfo="no"
])
fi
#
if test "$tst_compi_freeaddrinfo" = "yes"; then
AC_MSG_CHECKING([if freeaddrinfo usage allowed])
if test "x$cares_disallow_freeaddrinfo" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_freeaddrinfo="yes"
else
AC_MSG_RESULT([no])
tst_allow_freeaddrinfo="no"
fi
fi
#
AC_MSG_CHECKING([if freeaddrinfo might be used])
if test "$tst_links_freeaddrinfo" = "yes" &&
test "$tst_proto_freeaddrinfo" = "yes" &&
test "$tst_compi_freeaddrinfo" = "yes" &&
test "$tst_allow_freeaddrinfo" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
[Define to 1 if you have the freeaddrinfo function.])
ac_cv_func_freeaddrinfo="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_freeaddrinfo="no"
fi
])
dnl CARES_CHECK_FUNC_GETADDRINFO
dnl -------------------------------------------------
dnl Verify if getaddrinfo 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 cares_disallow_getaddrinfo, then
dnl HAVE_GETADDRINFO will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [
AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
Yang Tse
committed
AC_REQUIRE([CARES_INCLUDES_STRING])dnl
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
#
tst_links_getaddrinfo="unknown"
tst_proto_getaddrinfo="unknown"
tst_compi_getaddrinfo="unknown"
tst_works_getaddrinfo="unknown"
tst_allow_getaddrinfo="unknown"
#
AC_MSG_CHECKING([if getaddrinfo can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
if(0 != getaddrinfo(0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_links_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_links_getaddrinfo="no"
])
#
if test "$tst_links_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo is prototyped])
AC_EGREP_CPP([getaddrinfo],[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_proto_getaddrinfo="no"
])
fi
#
if test "$tst_proto_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
if(0 != getaddrinfo(0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_compi_getaddrinfo="no"
])
fi
#
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_stdlib
Yang Tse
committed
$cares_includes_string
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
struct addrinfo hints;
struct addrinfo *ai = 0;
int error;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
if(error || !ai)
exit(1); /* fail */
else
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_works_getaddrinfo="no"
])
fi
#
if test "$tst_compi_getaddrinfo" = "yes" &&
test "$tst_works_getaddrinfo" != "no"; then
AC_MSG_CHECKING([if getaddrinfo usage allowed])
if test "x$cares_disallow_getaddrinfo" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_getaddrinfo="yes"
else
AC_MSG_RESULT([no])
tst_allow_getaddrinfo="no"
fi
fi
#
AC_MSG_CHECKING([if getaddrinfo might be used])
if test "$tst_links_getaddrinfo" = "yes" &&
test "$tst_proto_getaddrinfo" = "yes" &&
test "$tst_compi_getaddrinfo" = "yes" &&
test "$tst_allow_getaddrinfo" = "yes" &&
test "$tst_works_getaddrinfo" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
[Define to 1 if you have a working getaddrinfo function.])
ac_cv_func_getaddrinfo="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_getaddrinfo="no"
fi
])
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
dnl CARES_CHECK_FUNC_GETHOSTBYADDR
dnl -------------------------------------------------
dnl Verify if gethostbyaddr is available, prototyped,
dnl and can be compiled. If all of these are true,
dnl and usage has not been previously disallowed with
dnl shell variable cares_disallow_gethostbyaddr, then
dnl HAVE_GETHOSTBYADDR will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYADDR], [
AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
#
tst_links_gethostbyaddr="unknown"
tst_proto_gethostbyaddr="unknown"
tst_compi_gethostbyaddr="unknown"
tst_allow_gethostbyaddr="unknown"
#
AC_MSG_CHECKING([if gethostbyaddr can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_winsock2
$cares_includes_netdb
]],[[
if(0 != gethostbyaddr(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_links_gethostbyaddr="yes"
],[
AC_MSG_RESULT([no])
tst_links_gethostbyaddr="no"
])
#
if test "$tst_links_gethostbyaddr" = "yes"; then
AC_MSG_CHECKING([if gethostbyaddr is prototyped])
AC_EGREP_CPP([gethostbyaddr],[
$cares_includes_winsock2
$cares_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_gethostbyaddr="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gethostbyaddr="no"
])
fi
#
if test "$tst_proto_gethostbyaddr" = "yes"; then
AC_MSG_CHECKING([if gethostbyaddr is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_winsock2
$cares_includes_netdb
]],[[
if(0 != gethostbyaddr(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostbyaddr="yes"
],[
AC_MSG_RESULT([no])
tst_compi_gethostbyaddr="no"
])
fi
#
if test "$tst_compi_gethostbyaddr" = "yes"; then
AC_MSG_CHECKING([if gethostbyaddr usage allowed])
if test "x$cares_disallow_gethostbyaddr" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gethostbyaddr="yes"
else
AC_MSG_RESULT([no])
tst_allow_gethostbyaddr="no"
fi
fi
#
AC_MSG_CHECKING([if gethostbyaddr might be used])
if test "$tst_links_gethostbyaddr" = "yes" &&
test "$tst_proto_gethostbyaddr" = "yes" &&
test "$tst_compi_gethostbyaddr" = "yes" &&
test "$tst_allow_gethostbyaddr" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1,
[Define to 1 if you have the gethostbyaddr function.])
ac_cv_func_gethostbyaddr="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_gethostbyaddr="no"
fi
])
dnl CARES_CHECK_FUNC_GETHOSTBYNAME
dnl -------------------------------------------------
dnl Verify if gethostbyname is available, prototyped,
dnl and can be compiled. If all of these are true,
dnl and usage has not been previously disallowed with
dnl shell variable cares_disallow_gethostbyname, then
dnl HAVE_GETHOSTBYNAME will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYNAME], [
AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
#
tst_links_gethostbyname="unknown"
tst_proto_gethostbyname="unknown"
tst_compi_gethostbyname="unknown"
tst_allow_gethostbyname="unknown"
#
AC_MSG_CHECKING([if gethostbyname can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_winsock2
$cares_includes_netdb
]],[[
if(0 != gethostbyname(0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_links_gethostbyname="yes"
],[
AC_MSG_RESULT([no])
tst_links_gethostbyname="no"
])
#
if test "$tst_links_gethostbyname" = "yes"; then
AC_MSG_CHECKING([if gethostbyname is prototyped])
AC_EGREP_CPP([gethostbyname],[
$cares_includes_winsock2
$cares_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_gethostbyname="yes"
],[
AC_MSG_RESULT([no])
tst_proto_gethostbyname="no"
])
fi
#
if test "$tst_proto_gethostbyname" = "yes"; then
AC_MSG_CHECKING([if gethostbyname is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_winsock2
$cares_includes_netdb
]],[[
if(0 != gethostbyname(0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_gethostbyname="yes"
],[
AC_MSG_RESULT([no])
tst_compi_gethostbyname="no"
])
fi
#
if test "$tst_compi_gethostbyname" = "yes"; then
AC_MSG_CHECKING([if gethostbyname usage allowed])
if test "x$cares_disallow_gethostbyname" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_gethostbyname="yes"
else
AC_MSG_RESULT([no])
tst_allow_gethostbyname="no"
fi
fi
#
AC_MSG_CHECKING([if gethostbyname might be used])
if test "$tst_links_gethostbyname" = "yes" &&
test "$tst_proto_gethostbyname" = "yes" &&
test "$tst_compi_gethostbyname" = "yes" &&
test "$tst_allow_gethostbyname" = "yes"; then
AC_MSG_RESULT([yes])
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 CARES_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 cares_disallow_gethostname, then
dnl HAVE_GETHOSTNAME will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [
AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
AC_REQUIRE([CARES_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([[
$cares_includes_winsock2
$cares_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],[
$cares_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([[
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
$cares_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$cares_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 CARES_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 cares_disallow_getservbyport_r, then
dnl HAVE_GETSERVBYPORT_R will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYPORT_R], [
#
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],[
$cares_includes_netdb