configure.ac revision 1.7 1 #
2 # Rump kernel POSIX hypervisor autoconf support.
3 #
4 # NOTE! regen by doing the following
5 # 1) autoreconf -iv
6 # 2) edit rumpuser_port.h (search for RUMPUSER_CONFIG for instructions)
7 # 3) rm -rf autom4te.cache
8 # 4) commit to NetBSD, pullup to https://github.com/rumpkernel/
9 #
10
11 AC_PREREQ([2.66])
12 AC_INIT([rumpuser-posix], [999], [https://github.com/rumpkernel/])
13
14 AC_CONFIG_HEADERS([rumpuser_config.h])
15 AC_CONFIG_AUX_DIR([build-aux])
16 AC_CONFIG_MACRO_DIR([build-aux])
17
18 AC_LANG([C])
19
20 AC_SYS_LARGEFILE
21
22 AC_CHECK_HEADERS([sys/param.h sys/sysctl.h sys/disk.h \
23 sys/disklabel.h sys/dkio.h sys/atomic.h paths.h])
24
25 AC_CANONICAL_TARGET
26
27 AC_CHECK_TYPES([clockid_t, register_t])
28
29 AC_CHECK_FUNCS([kqueue chflags strsuftoll setprogname getprogname \
30 getenv_r posix_memalign memalign aligned_alloc \
31 arc4random_buf getsubopt fsync_range __quotactl utimensat])
32
33 AC_TRY_LINK_FUNC([clock_nanosleep],,
34 AC_CHECK_LIB([rt], [clock_nanosleep])
35 )
36 AC_CHECK_LIB([rt], [clock_gettime],
37 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime]),
38 AC_TRY_LINK_FUNC([clock_gettime],
39 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime])))
40 AC_CHECK_LIB([rt], [clock_nanosleep],
41 AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep]),
42 AC_TRY_LINK_FUNC([clock_nanosleep],
43 AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep])))
44 AC_CHECK_LIB([dl], [dlinfo],
45 AC_DEFINE([HAVE_DLINFO], 1, [dlinfo]),
46 AC_TRY_LINK_FUNC([dlinfo], AC_DEFINE([HAVE_DLINFO], 1, [dlinfo])))
47
48 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,,[#include <netinet/in.h>])
49
50 dnl
51 dnl pthread_setname() sillyness is a bit longer; we need the signature
52 dnl
53 SAVE_CFLAGS="${CFLAGS}"
54 CFLAGS="${SAVE_CFLAGS} -Werror"
55
56 dnl check sys/cdefs.h creatively to process only with cc, not cpp
57 dnl (sys/cdefs.h in at least in musl contains a #warning)
58 AC_CHECK_HEADERS([sys/cdefs.h], [], [], [#include <sys/cdefs.h>])
59
60 SAVE_LIBS="${LIBS}"
61 LIBS="${LIBS} -lpthread"
62 AC_MSG_CHECKING([for two-argument pthread_setname_np()])
63 AC_COMPILE_IFELSE(
64 [AC_LANG_PROGRAM(
65 [[#define _GNU_SOURCE
66 #include <pthread.h>]],
67 [[pthread_t pt;]
68 [pthread_setname_np(pt, "x");return 0;]])
69 ],[
70 AC_MSG_RESULT([yes])
71 AC_DEFINE(HAVE_PTHREAD_SETNAME2, [1],
72 [Define to 1 if you have 2-arg pthread_setname_np()])
73 ],[
74 AC_MSG_RESULT([no])
75 ])
76 AC_MSG_CHECKING([for three-argument pthread_setname_np()])
77 AC_COMPILE_IFELSE(
78 [AC_LANG_PROGRAM(
79 [[#define _GNU_SOURCE
80 #include <pthread.h>]],
81 [[pthread_t pt;]
82 [pthread_setname_np(pt, "X", (void *)0);return 0;]])
83 ],[
84 AC_MSG_RESULT([yes])
85 AC_DEFINE(HAVE_PTHREAD_SETNAME3, [1],
86 [Define to 1 if you have 3-arg pthread_setname_np()])
87 ],[
88 AC_MSG_RESULT([no])
89 ])
90 LIBS="${SAVELIBS}"
91
92 AC_MSG_CHECKING([for ioctl cmd being int])
93 AC_COMPILE_IFELSE(
94 [AC_LANG_PROGRAM(
95 [[#include <sys/ioctl.h>
96 #include <unistd.h>
97 int ioctl(int fd, int, ...);]],
98 [[]
99 [return 0;]])
100 ],[
101 AC_MSG_RESULT([yes])
102 AC_DEFINE(HAVE_IOCTL_CMD_INT, [1],
103 [Define to 1 if ioctl()'s cmd arg is int])
104 ],[
105 AC_MSG_RESULT([no])
106 ])
107 CFLAGS="${SAVE_CFLAGS}"
108
109 AC_OUTPUT
110