ObjFW  Diff

Differences From Artifact [1dac072c32]:

To Artifact [851bfdbc5a]:


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
631
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
687
688
689
690
691
AC_MSG_CHECKING(for atomic operations)
AS_IF([test x"$atomic_ops" != x"none"], [
	AC_DEFINE(OF_HAVE_ATOMIC_OPS, 1, [Whether we have atomic operations])
	AC_SUBST(ATOMIC_H, "atomic.h")
])
AC_MSG_RESULT($atomic_ops)

AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
AC_CHECK_LIB(network, socket, LIBS="$LIBS -lnetwork")
AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32")

AC_CHECK_FUNC(gmtime_r, [
	AC_DEFINE(HAVE_GMTIME_R, 1, [Whether we have gmtime_r])
])
AC_CHECK_FUNC(localtime_r, [
	AC_DEFINE(HAVE_LOCALTIME_R, 1, [Whether we have localtime_r])
])











AC_CHECK_FUNC(kqueue, [
	AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue])
	AC_SUBST(OFSTREAMOBSERVER_KQUEUE_M, "OFStreamObserver_kqueue.m")
])
AC_CHECK_HEADER(poll.h, [
	AC_DEFINE(HAVE_POLL_H, 1, [Whether we have poll.h])
	AC_SUBST(OFSTREAMOBSERVER_POLL_M, "OFStreamObserver_poll.m")
])
AC_CHECK_HEADERS(sys/select.h, [
	AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Whether we have sys/select.h])
	AC_SUBST(OFSTREAMOBSERVER_SELECT_M, "OFStreamObserver_select.m")
])
case "$host_os" in
	mingw*)
		AC_SUBST(OFSTREAMOBSERVER_SELECT_M,
			"OFStreamObserver_select.m")
		;;
esac

AC_MSG_CHECKING(for getaddrinfo)
AC_TRY_COMPILE([
	#include <stddef.h>
	#ifndef _WIN32
	# include <sys/types.h>
	# include <sys/socket.h>
	# include <netdb.h>
	#else
	typedef unsigned char BOOL;
	# include <ws2tcpip.h>
	#endif
], [
	struct addrinfo ai;
	getaddrinfo(NULL, NULL, NULL, NULL);
], [
	AC_MSG_RESULT(yes)
	AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether we have getaddrinfo])

	AS_IF([test x"$enable_threads" != x"no"], [
		AC_MSG_CHECKING(whether getaddrinfo is thread-safe)

		case "$host_os" in
			darwin[[12345]].*)
				have_threadsafe_getaddrinfo="no"
				;;
			darwin*)
				have_threadsafe_getaddrinfo="yes"
				;;
			freebsd[[1234]].* | freebsd5.[[1234]]*)
				have_threadsafe_getaddrinfo="no"
				;;
			freebsd*)
				have_threadsafe_getaddrinfo="yes"
				;;
			netbsd[[123]].*)
				have_threadsafe_getaddrinfo="no"
				;;
			netbsd*)
				have_threadsafe_getaddrinfo="yes"
				;;
			solaris*)
				have_threadsafe_getaddrinfo="yes"
				;;
			*)
				have_threadsafe_getaddrinfo="unknown"
				;;
		esac

		AS_IF([test x"$have_threadsafe_getaddrinfo" = x"unknown"], [

			AC_EGREP_CPP(yes, [
				#ifndef _WIN32
				# include <sys/types.h>
				# include <sys/socket.h>
				# include <netdb.h>
				#else
				# define _WIN32_WINNT 0x0501
				# include <windows.h>
				# include <ws2tcpip.h>
				#endif

				#ifdef h_errno
				yes
				#end
			], [
				have_threadsafe_getaddrinfo="yes"
			], [
				have_threadsafe_getaddrinfo="no"
			])
		])

		AS_IF([test x"$have_threadsafe_getaddrinfo" = x"yes"], [
			AC_DEFINE(HAVE_THREADSAFE_GETADDRINFO, 1,
				[Whether getaddrinfo is thread-safe])
		])

		AC_MSG_RESULT($have_threadsafe_getaddrinfo)
	])
], [
	AC_MSG_RESULT(no)





])

AS_IF([test x"$objc_runtime" = x"Apple runtime"], [
	AC_CHECK_HEADER(Foundation/NSObject.h, [
		AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m")
		AC_SUBST(BRIDGE, "bridge")








<
<
<
<







>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
>
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|

|
|
|
|

|
|
|
|
>
>
>
>
>







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
631
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
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
AC_MSG_CHECKING(for atomic operations)
AS_IF([test x"$atomic_ops" != x"none"], [
	AC_DEFINE(OF_HAVE_ATOMIC_OPS, 1, [Whether we have atomic operations])
	AC_SUBST(ATOMIC_H, "atomic.h")
])
AC_MSG_RESULT($atomic_ops)





AC_CHECK_FUNC(gmtime_r, [
	AC_DEFINE(HAVE_GMTIME_R, 1, [Whether we have gmtime_r])
])
AC_CHECK_FUNC(localtime_r, [
	AC_DEFINE(HAVE_LOCALTIME_R, 1, [Whether we have localtime_r])
])

AC_ARG_ENABLE(sockets,
	AS_HELP_STRING([--disable-sockets], [disable socket support]))
AS_IF([test x"$enable_sockets" != x"no"], [
	AC_DEFINE(OF_HAVE_SOCKETS, 1, [Whether we have sockets])
	AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}')

	AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
	AC_CHECK_LIB(network, socket, LIBS="$LIBS -lnetwork")
	AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32")

	AC_CHECK_FUNC(kqueue, [
		AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue])
		AC_SUBST(OFSTREAMOBSERVER_KQUEUE_M, "OFStreamObserver_kqueue.m")
	])
	AC_CHECK_HEADER(poll.h, [
		AC_DEFINE(HAVE_POLL_H, 1, [Whether we have poll.h])
		AC_SUBST(OFSTREAMOBSERVER_POLL_M, "OFStreamObserver_poll.m")
	])
	AC_CHECK_HEADERS(sys/select.h, [
		AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Whether we have sys/select.h])
		AC_SUBST(OFSTREAMOBSERVER_SELECT_M, "OFStreamObserver_select.m")
	])
	case "$host_os" in
		mingw*)
			AC_SUBST(OFSTREAMOBSERVER_SELECT_M,
				"OFStreamObserver_select.m")
			;;
	esac

	AC_MSG_CHECKING(for getaddrinfo)
	AC_TRY_COMPILE([
		#include <stddef.h>
		#ifndef _WIN32
		# include <sys/types.h>
		# include <sys/socket.h>
		# include <netdb.h>
		#else
		typedef unsigned char BOOL;
		# include <ws2tcpip.h>
		#endif
	], [
		struct addrinfo ai;
		getaddrinfo(NULL, NULL, NULL, NULL);
	], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether we have getaddrinfo])

		AS_IF([test x"$enable_threads" != x"no"], [
			AC_MSG_CHECKING(whether getaddrinfo is thread-safe)

			case "$host_os" in
				darwin[[12345]].*)
					have_threadsafe_getaddrinfo="no"
					;;
				darwin*)
					have_threadsafe_getaddrinfo="yes"
					;;
				freebsd[[1234]].* | freebsd5.[[1234]]*)
					have_threadsafe_getaddrinfo="no"
					;;
				freebsd*)
					have_threadsafe_getaddrinfo="yes"
					;;
				netbsd[[123]].*)
					have_threadsafe_getaddrinfo="no"
					;;
				netbsd*)
					have_threadsafe_getaddrinfo="yes"
					;;
				solaris*)
					have_threadsafe_getaddrinfo="yes"
					;;
				*)
					have_threadsafe_getaddrinfo="unknown"
					;;
			esac

			AS_IF([test x"$have_threadsafe_getaddrinfo" = \
					x"unknown"], [
				AC_EGREP_CPP(yes, [
					#ifndef _WIN32
					# include <sys/types.h>
					# include <sys/socket.h>
					# include <netdb.h>
					#else
					# define _WIN32_WINNT 0x0501
					# include <windows.h>
					# include <ws2tcpip.h>
					#endif

					#ifdef h_errno
					yes
					#end
				], [
					have_threadsafe_getaddrinfo="yes"
				], [
					have_threadsafe_getaddrinfo="no"
				])
			])

			AS_IF([test x"$have_threadsafe_getaddrinfo" = x"yes"], [
				AC_DEFINE(HAVE_THREADSAFE_GETADDRINFO, 1,
					[Whether getaddrinfo is thread-safe])
			])

			AC_MSG_RESULT($have_threadsafe_getaddrinfo)
		])
	], [
		AC_MSG_RESULT(no)
	])
])

AS_IF([test x"$enable_sockets" != x"no" -a x"$enable_threads" != x"no"], [
	AC_SUBST(OFHTTPCLIENTTESTS_M, "OFHTTPClientTests.m")
])

AS_IF([test x"$objc_runtime" = x"Apple runtime"], [
	AC_CHECK_HEADER(Foundation/NSObject.h, [
		AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m")
		AC_SUBST(BRIDGE, "bridge")