-
Notifications
You must be signed in to change notification settings - Fork 47
/
configure.ac
97 lines (78 loc) · 3.5 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
# The name, version, and maintainer of this package
AC_INIT([freedom-metal], [m4_esyscmd_s([./scripts/git-version])], [https://github.com/sifive/freedom-metal/issues], [freedom-metal], [https://github.com/sifive/freedom-metal])
# Initializes automake, enabling maintainer mode by default (which should be
# disabled by the archive generated by "make dist").
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_MAINTAINER_MODE([disable])
AC_CONFIG_MACRO_DIRS([m4])
AC_CANONICAL_HOST
# Probe for tools that we need in order to build.
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AR
AM_PROG_AS
# autoconf tries very hard to avoid failing, so it'll even go ahead and try to
# build the project using "gcc" if it can't find a suitable C compiler prefixed
# by the host system. This doesn't work when cross compiling, but it's a
# common error for users so we explicitly check for this right here to quickly
# provide an error message.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[
#ifndef __riscv
# error "A RISC-V compiler is required to build Freedom Metal"
#endif
])], [], [AC_MSG_FAILURE([The C compiler doesn't define __riscv, which means it's probably not a RISC-V compiler. You should specify something like --host=riscv64-sifive-elf when building this, as it will only work on RISC-V systems.])])
########################################################
# Options
########################################################
AC_ARG_WITH([builtin-libgloss],
[AS_HELP_STRING([--with-builtin-libgloss], [Build libgloss along with Metal])],
[with_builtin_libgloss="yes"],
[with_builtin_libgloss="no"]
)
AC_ARG_WITH([builtin-libmetal-pico],
[AS_HELP_STRING([--with-builtin-libmetal-pico], [Build libmetal-pico along with Metal])],
[with_builtin_libmetal_pico="yes"],
[with_builtin_libmetal_pico="no"]
)
AC_ARG_WITH([builtin-libmetal-segger],
[AS_HELP_STRING([--with-builtin-libmetal-segger], [Build libmetal-segger along with Metal])],
[with_builtin_libmetal_segger="yes"],
[with_builtin_libmetal_segger="no"]
)
AC_ARG_WITH([machine-header],
[AS_HELP_STRING([--with-machine-header=PATH], [Path to the machine header file])],
[],
[with_machine_header="no"]
)
AC_ARG_WITH([machine-inline],
[AS_HELP_STRING([--with-machine-inline=PATH], [Path to the machine inline file])],
[],
[with_machine_inline="no"]
)
AC_ARG_WITH([platform-header],
[AS_HELP_STRING([--with-platform-header=PATH], [Path to the platform header file])],
[],
[with_platform_header="no"]
)
########################################################
# Process Options
########################################################
AM_CONDITIONAL([WITH_BUILTIN_LIBGLOSS], [test "x$with_builtin_libgloss" = "xyes"])
AM_CONDITIONAL([WITH_BUILTIN_LIBMETAL_PICO], [test "x$with_builtin_libmetal_pico" = "xyes"])
AM_CONDITIONAL([WITH_BUILTIN_LIBMETAL_SEGGER], [test "x$with_builtin_libmetal_segger" = "xyes"])
# Configure the build system to pass in the preconfigured machine support files
AS_IF([test "x$with_machine_header" != "xno"],
[AC_SUBST([MACHINE_HEADER], "$with_machine_header")],
[AC_MSG_FAILURE([--with-machine-header is required])]
)
AS_IF([test "x$with_machine_inline" != "xno"],
[AC_SUBST([MACHINE_INLINE], "$with_machine_inline")],
[AC_MSG_FAILURE([--with-machine-inline is required])]
)
AS_IF([test "x$with_platform_header" != "xno"],
[AC_SUBST([PLATFORM_HEADER], "$with_platform_header")],
[AC_MSG_FAILURE([--with-platform-header is required])]
)
# Generates the remainder of the build system.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT