-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
106 lines (87 loc) · 3.03 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
104
105
106
AC_INIT([MACHINA],[0.0])
AC_CONFIG_MACRO_DIRS([nux/m4 m4])
AC_CONFIG_SUBDIRS(nux)
nux_dir=nux
libec_dir=nux/libec
AC_MK_DIR([${nux_dir}/mk])
AC_NUXROOT_DIR([${nux_dir}])
AC_LIBEC_DIR([${libec_dir}])
AC_SUBST(COMPILE_IN_KERNEL,["include "'$(SRCROOT)'"/kern/compile-in-kernel.mk"])
AC_KMOD_DIR(kstest, tests/libkstest/kern)
AC_KMOD_DIR(kutest, tests/libkutest/kern)
AC_LIB_DIR(libmachina,libmachina)
AC_LIB_DIR(libmach3,libmach3/user)
AC_LIB_DIR(libkmach3,libmach3/kern)
AC_ARG_VAR([ARCH], [The architecture to compile for: i386, amd64 or riscv64])
if test x"${ARCH}" == x ; then
AC_MSG_ERROR([Please select a valid architecture with `./configure ARCH=<arch>`])
fi
AS_CASE([${ARCH}],
[i386], [tool_prefix=i686-unknown-elf] [upmachine=I386],
[amd64], [tool_prefix=amd64-unknown-elf] [upmachine=AMD64],
[riscv64], [tool_prefix=riscv64-unknown-elf upmachine=RISCV64],
[*], [AC_MSG_ERROR([Supported Architectures: i386, amd64, riscv64])])
AC_ARG_VAR([TOOLCHAIN],[toolchain prefix @<:@default: <ARCH>-elf@:>@])
if test x"${TOOLCHAIN}" != x ; then
tool_prefix="${TOOLCHAIN}"
fi
AC_PROG_CC
AC_PROG_YACC
AC_PROG_LEX([])
# This is used by the mig script. Behaviour of CPP and GCC -E are
# different, so let's stick to a standard one.
AC_SUBST(CPP, "${CC} -E")
AC_CHECK_TOOL(TARGET_CC, ${tool_prefix}-gcc, :)
if test x"${TARGET_CC}" = 'x:' ; then
AC_MSG_ERROR([${tool_prefix}-gcc not found])
fi
AC_CHECK_TOOL(TARGET_LD, ${tool_prefix}-ld, :)
if test x"${TARGET_LD}" = 'x:' ; then
AC_MSG_ERROR([${tool_prefix}-ld not found])
fi
AC_CHECK_TOOL(TARGET_AR, ${tool_prefix}-ar, :)
if test x"${TARGET_AR}" = 'x:' ; then
AC_MSG_ERROR([${tool_prefix}-ar not found])
fi
AC_CHECK_TOOL(TARGET_OBJCOPY, ${tool_prefix}-objcopy, :)
if test x"${TARGET_OBJCOPY}" = 'x:' ; then
AC_MSG_ERROR([${tool_prefix}-objcopy not found])
fi
machine=${ARCH}
AC_ARG_ENABLE([opt],
AS_HELP_STRING([--disable-opt],[compile without compiler optimizations]))
AS_IF([test "x$enable_opt" != "xno"],
[optflags='-O7 -g'],
[optflags='-O0 -g'])
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror],[compile ignoring compiler warnings]))
AS_IF([test "x$enable_relax" != "xno"],
[wflags='-Werror'],
[wflags=''])
AC_SUBST(MACHINE, ${machine})
AC_SUBST(CONFIGURE_FLAGS, ["${optflags} ${wflags} -DMCN_MACHINE_${upmachine}=1 -I\$(SRCROOT)/include -I\$(BUILDROOT)/include -I\$(SRCROOT)/${nux_dir}/include -I\$(BUILDROOT)/${nux_dir}/include"])
AC_SUBST(APXH_SUBDIRS, [${apxh_subdirs}])
AC_CONFIG_FILES([tools/mig/mig:tools/mig/mig.in], [chmod +x tools/mig/mig])
AC_SUBST(MIG, '$(BUILDROOT)/tools/mig/mig')
AC_SUBST(MIGCOM, '$(BUILDROOT)/tools/mig/migcom')
AC_MK_CONFIG_FILES([
Makefile
libmachina/Makefile
libmach3/Makefile
libmach3/user/Makefile
libmach3/kern/Makefile
kern/Makefile
tests/Makefile
tests/libkutest/Makefile
tests/libkutest/user/Makefile
tests/libkutest/kern/Makefile
tests/libkstest/Makefile
tests/libkstest/user/Makefile
tests/libkstest/kern/Makefile
tests/libcstest/Makefile
tests/libcstest/user/Makefile
tests/test/Makefile
bootstrap/Makefile
tools/mig/Makefile
])
AC_OUTPUT