ObjFW  Check-in [aa1266c569]

Overview
Comment:Cache checks that don't work when crosscompiling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aa1266c569210bf42defc4145293230649ca91b0c609371924505071bfea0c30
User & Date: js on 2008-12-19 16:36:00
Other Links: manifest | tags
Context
2008-12-19
17:21
Also set CFLAGS as we also have .c files. check-in: fb2c2513d3 user: js tags: trunk
16:36
Cache checks that don't work when crosscompiling. check-in: aa1266c569 user: js tags: trunk
2008-12-15
12:29
This isn't needed anymore. check-in: 59fbfef638 user: js tags: trunk
Changes

Modified configure.ac from [d990bb463d] to [fd700cf72b].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64


65
66
67
68
69


70
71
72
73
74
75
76
77
78
79
80
81
AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(HAVE_ASPRINTF, 1, "Whether we have asprintf")], [
	have_asprintf="no"
	AC_SUBST(ASPRINTF, "asprintf.c")])

AC_MSG_CHECKING(whether snprintf returns something useful)

AC_TRY_RUN([
	#include <stdio.h>

	int
	main()
	{
		return (snprintf(NULL, 0, "asd") == 3 ? 0 : 1);
	}],
	snprintf_return_useful="yes", snprintf_return_useful="no",
	snprintf_return_useful="no")

AC_MSG_RESULT($snprintf_return_useful)

test x"$have_asprintf" != x"yes" -a x"$snprintf_return_useful" != x"yes" && \
	AC_MSG_ERROR(No asprintf and no snprintf returning required space!)

AC_MSG_CHECKING(whether we have IPv6 support)

AC_TRY_RUN([
	#include <stdlib.h>
	#include <string.h>

	#include <sys/types.h>
	#include <sys/socket.h>
	#include <netinet/in.h>

	int
	main()
	{
		int fd;
		struct sockaddr_in6 addr;

		fd = socket(AF_INET6, SOCK_STREAM, 0);


		/* Do something with it to prevent an error due to -Werror */


		memset(&addr, 0, sizeof(addr));

		exit(fd >= 0 ? 0 : 1);
	}],
	have_ipv6="yes", have_ipv6="no", have_ipv6="no")


AC_MSG_RESULT($have_ipv6)
test x"$have_ipv6" = x"yes" && \
	AC_DEFINE(HAVE_IPV6, 1, "Whether we have IPv6 support")

test x"$cross_compiling" != x"yes" && AC_SUBST(TESTS, "tests")

BUILDSYS_TOUCH_DEPS

AC_SUBST(PACKAGE, objfw)
AC_CONFIG_FILES([buildsys.mk extra.mk])
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT







>
|
|

|
|
|
|
|
|
|
>
|

|



>
|
|
|

|
|
|

|
|
|
|
|

|

>
|
>
>
|

|
|
|
>
>
|
|










25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
AC_CHECK_FUNC(asprintf, [
	have_asprintf="yes"
	AC_DEFINE(HAVE_ASPRINTF, 1, "Whether we have asprintf")], [
	have_asprintf="no"
	AC_SUBST(ASPRINTF, "asprintf.c")])

AC_MSG_CHECKING(whether snprintf returns something useful)
AC_CACHE_VAL(ac_cv_snprintf_useful_ret, [
	AC_TRY_RUN([
		#include <stdio.h>

		int
		main()
		{
			return (snprintf(NULL, 0, "asd") == 3 ? 0 : 1);
		}],
		ac_cv_snprintf_useful_ret="yes",
		ac_cv_snprintf_useful_ret="no",
		ac_cv_snprintf_useful_ret="no")])
AC_MSG_RESULT($ac_cv_snprintf_useful_ret)

test x"$have_asprintf" != x"yes" -a x"$ac_cv_snprintf_useful_ret" != x"yes" && \
	AC_MSG_ERROR(No asprintf and no snprintf returning required space!)

AC_MSG_CHECKING(whether we have IPv6 support)
AC_CACHE_VAL(ac_cv_have_ipv6, [
	AC_TRY_RUN([
		#include <stdlib.h>
		#include <string.h>

		#include <sys/types.h>
		#include <sys/socket.h>
		#include <netinet/in.h>

		int
		main()
		{
			int fd;
			struct sockaddr_in6 addr;

			fd = socket(AF_INET6, SOCK_STREAM, 0);

			/*
			 * Do something with it to prevent an error due to
			 * -Werror
			 */
			memset(&addr, 0, sizeof(addr));

			exit(fd >= 0 ? 0 : 1);
		}],
		ac_cv_have_ipv6="yes",
		ac_cv_have_ipv6="no",
		ac_cv_have_ipv6="no")])
AC_MSG_RESULT($ac_cv_have_ipv6)
test x"$ac_cv_have_ipv6" = x"yes" && \
	AC_DEFINE(HAVE_IPV6, 1, "Whether we have IPv6 support")

test x"$cross_compiling" != x"yes" && AC_SUBST(TESTS, "tests")

BUILDSYS_TOUCH_DEPS

AC_SUBST(PACKAGE, objfw)
AC_CONFIG_FILES([buildsys.mk extra.mk])
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT