1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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
|
AC_PREREQ([2.69])
AC_INIT([X15], [0.1], [rbraun@sceen.net], [x15])
AC_CONFIG_SRCDIR([kern/config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([tools/m4])
# Artificially create the doc subdirectory since Automake apparently
# won't do it itself.
AC_CONFIG_COMMANDS([doc/.empty])
AM_INIT_AUTOMAKE([foreign subdir-objects 1.13])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
AC_CANONICAL_HOST
AC_PROG_CPP
AC_PROG_CC
AM_PROG_AS
AM_PROG_CC_C_O
AX_PROG_ASCIIDOC([AC_MSG_NOTICE([asciidoc not found, not building html documentation])])
AX_PROG_HIGHLIGHT([AS_IF([test x"$ASCIIDOC" != x],
[AC_MSG_NOTICE([highlight not found, not building html documentation])])])
AX_PROG_A2X([AC_MSG_NOTICE([a2x not found, not building man pages])])
# Disable PIE if enabled by default
AX_APPEND_COMPILE_FLAGS([-no-pie -fno-pie])
AC_HEADER_ASSERT()
m4_include([arch/x86/configfrag.ac])
AS_IF([test x"$arch" = x], [AC_MSG_ERROR([unsupported architecture])])
AC_SUBST([arch])
AC_ARG_ENABLE([test-module],
[AS_HELP_STRING([--enable-test-module=TEST_MODULE],
[run the given test module instead of booting])],
[enable_test_module=$enableval],
[enable_test_module=no])
AC_ARG_WITH([max-cpus],
[AS_HELP_STRING([--with-max-cpus=MAX_CPUS],
[set the maximum number of supported processors])],
[opt_max_cpus=$withval],
[opt_max_cpus=128])
AC_ARG_WITH([clock-freq],
[AS_HELP_STRING([--with-clock-freq=CLOCK_FREQ],
[set the low resolution clock frequency])],
[opt_clock_freq=$withval],
[opt_clock_freq=200])
AC_ARG_ENABLE([mutex-adaptive],
[AS_HELP_STRING([--enable-mutex-adaptive],
[enable adaptive spinning mutexes])])
AC_ARG_ENABLE([mutex-pi],
[AS_HELP_STRING([--enable-mutex-pi],
[enable priority inheritance for regular mutexes
(note that priority inheritance is always
enabled for real-time mutexes)])],
[],
[enable_mutex_pi=no])
AC_ARG_ENABLE([shell],
[AS_HELP_STRING([--enable-shell],
[enable the diagnostics shell])],
[],
[enable_shell=no])
AC_ARG_ENABLE([thread-stack-guard],
[AS_HELP_STRING([--enable-thread-stack-guard],
[enable kernel thread stack guard pages])],
[],
[enable_thread_stack_guard=no])
AC_DEFINE([__KERNEL__], [1], [kernel code])
AC_DEFINE_UNQUOTED([X15_ARCH], [$arch], [arch])
m4_define([ENABLE_TEST_MODULE],
[AS_CASE(["$enable_test_module"],
[llsync_defer], [test_llsync_defer=yes],
[mutex], [test_mutex=yes],
[mutex_pi], [test_mutex_pi=yes],
[pmap_update_mp], [test_pmap_update_mp=yes],
[sref_dirty_zeroes], [test_sref_dirty_zeroes=yes],
[sref_noref], [test_sref_noref=yes],
[sref_weakref], [test_sref_weakref=yes],
[vm_page_fill], [test_vm_page_fill=yes],
[xcall], [test_xcall=yes],
[AC_MSG_ERROR([invalid test module])])
AC_DEFINE([X15_RUN_TEST_MODULE], [1],
[run test module instead of booting])
AC_MSG_NOTICE([test module enabled: $enable_test_module])])
AS_IF([test x"$enable_test_module" != xno], [ENABLE_TEST_MODULE])
AM_CONDITIONAL([TEST_LLSYNC_DEFER],
[test x"$test_llsync_defer" = xyes])
AM_CONDITIONAL([TEST_MUTEX],
[test x"$test_mutex" = xyes])
AM_CONDITIONAL([TEST_MUTEX_PI],
[test x"$test_mutex_pi" = xyes])
AM_CONDITIONAL([TEST_PMAP_UPDATE_MP],
[test x"$test_pmap_update_mp" = xyes])
AM_CONDITIONAL([TEST_SREF_DIRTY_ZEROES],
[test x"$test_sref_dirty_zeroes" = xyes])
AM_CONDITIONAL([TEST_SREF_NOREF],
[test x"$test_sref_noref" = xyes])
AM_CONDITIONAL([TEST_SREF_WEAKREF],
[test x"$test_sref_weakref" = xyes])
AM_CONDITIONAL([TEST_VM_PAGE_FILL],
[test x"$test_vm_page_fill" = xyes])
AM_CONDITIONAL([TEST_XCALL],
[test x"$test_xcall" = xyes])
AC_DEFINE_UNQUOTED([X15_MAX_CPUS], [$opt_max_cpus],
[maximum number of supported processors])
AC_DEFINE_UNQUOTED([X15_CLOCK_FREQ], [$opt_clock_freq],
[low resolution clock frequency])
AC_MSG_NOTICE([maximum number of supported processors: $opt_max_cpus])
AC_MSG_NOTICE([low resolution clock frequency: $opt_clock_freq Hz])
AS_IF([test x"$enable_mutex_adaptive" = xyes -a x"$enable_mutex_pi" = xyes],
[AC_MSG_ERROR([--enable-mutex-adaptive and --enable-mutex-pi are mutually exclusive])])
AS_IF([test x"$enable_mutex_adaptive" = xyes],
[mutex_impl="adaptive spinning"],
[test x"$enable_mutex_pi" = xyes],
[mutex_impl="priority inheritance"],
[mutex_impl=plain])
AC_MSG_NOTICE([mutex implementation: $mutex_impl])
AS_IF([test x"$enable_mutex_adaptive" = xyes],
[AC_DEFINE_UNQUOTED([X15_MUTEX_ADAPTIVE], [],
[Enable adaptive mutexes])])
AM_CONDITIONAL([MUTEX_ADAPTIVE],
[test x"$enable_mutex_adaptive" = xyes])
AS_IF([test x"$enable_mutex_pi" = xyes],
[AC_DEFINE_UNQUOTED([X15_MUTEX_PI], [],
[Enable priority inheritance for regular mutexes])])
AM_CONDITIONAL([MUTEX_PI],
[test x"$enable_mutex_pi" = xyes])
AM_CONDITIONAL([X15_SHELL],
[test x"$enable_shell" = xyes])
AS_IF([test x"$enable_shell" = xyes],
[AC_DEFINE_UNQUOTED([X15_SHELL], [],
[Enable the diagnostics shell])])
AC_MSG_NOTICE([diagnostics shell: $enable_shell])
AS_IF([test x"$enable_thread_stack_guard" = xyes],
[AC_DEFINE_UNQUOTED([X15_THREAD_STACK_GUARD], [],
[Enable the use of guard pages for thread stacks])])
AC_MSG_NOTICE([thread stack guard pages: $enable_thread_stack_guard])
AH_BOTTOM([#include <kern/config.h>])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
|