-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
103 lines (82 loc) · 2.17 KB
/
configure.ac
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
m4_define([fukuro_VERSION],
m4_esyscmd([build-aux/git-version]))
AC_INIT([Fukuro],
m4_defn([fukuro_VERSION]),
[https://github.com/d0p1s4m4/Fukuro/issues])
AC_COPYRIGHT([Copyright (C) 2023 d0p1])
CFLAGS="-ffreestanding -nostdlib -fno-builtin"
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign subdir-objects])
dnl overide default AC_LANG_PROGRAM(C) macro
m4_ifdef([AC_LANG_PROGRAM(c)], m4_undefine[AC_LANG_PROGRAM(c)])
m4_define([AC_LANG_PROGRAM(C)],
[$1
int
_start (void)
{
$2
;
return 0;
}])
AC_CANONICAL_HOST
AS_CASE([$host_cpu],
[i?86], [
systype=i686
],
[x86_64], [systype=amd64],
[systype=$host_cpu]
)
AC_SUBST([systype])
m4_include([sys/configfrag.ac])
AS_IF([! test -d "$srcdir/sys/$systype"],
[AC_MSG_ERROR(["$host_cpu isn't supported by Fukuro"])])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile lib/Makefile srv/Makefile sys/Makefile])
AC_LANG([C])
save_cross_compiling=$cross_compiling
cross_compiling=yes
AM_PROG_AS
cross_compiling=$save_cross_compiling
AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_CC_C_O
AM_PROG_AR
AX_ASM_INLINE
AX_C___ATTRIBUTE__
AC_CHECK_TOOL([STRIP], [strip])
AC_CHECK_TOOL([OBJCOPY], [objcopy])
AC_CHECK_PROG([GZIP], [gzip], [gzip])
AC_CHECK_PROG([QEMU], [qemu-system-$host_cpu], [qemu-system-$host_cpu])
AC_CHECK_PROG([PYTHON3], [python3], [python3])
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
AC_CHECK_PROG([FIG], [fig], [fig])
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_C_BIGENDIAN
AC_CHECK_HEADERS([stdarg.h])
AC_C_STRINGIZE
AC_CHECK_TYPE(uintptr_t)
AC_TYPE_SIZE_T
AC_CONFIG_LINKS(["sys/machine":"$srcdir/sys/$systype"])
AC_ARG_ENABLE([ncpus],
AS_HELP_STRING([--enable-ncpus=N], [specify the maximum number of cpus to be supported]),
[fukuro_ncpus=$enable_ncpus],
[1])
AC_DEFINE_UNQUOTED([NCPUS], [$fukuro_ncpus], [number of CPUs])
m4_include([srv/configfrag.ac])
AC_OUTPUT
AC_MSG_RESULT([
Fukurō version: $PACKAGE_STRING
Architecture: $host_cpu
C Compiler: $CC
ASM Compiler: $CCAS
CFLAGS: $CFLAGS
CCASFLAGS: $CCASFLAG
LDFLAGS: $LDFLAGS
================================
NCPU: $fukuro_ncpus
])