-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
96 lines (71 loc) · 2.42 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
dnl Process this file with autoconf to produce a configure script.
dnl SPDX-License-Identifier: BSD-2-Clause-FreeBSD
dnl
dnl Copyright 2018-2024 Dimitar Dimitrov <[email protected]>
dnl All rights reserved.
AC_INIT([gnuprumcu],[0.9.6-rc])
dnl Not sure why this has to be so early.
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(foreign)
AM_SILENT_RULES([yes])
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
AC_CONFIG_HEADERS([config.h])
AC_SUBST(VERSION)
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
dnl Checks for libraries.
dnl Checks for additional header files.
AC_CHECK_HEADERS(stdint.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_ARG_ENABLE([toolchain-check],
[AS_HELP_STRING([--disable-toolchain-check],
[disable pru toolchain verification])],
[],
[enable_toolchain_check=yes])
dnl ==========================================================================
AS_IF([test "x$enable_toolchain_check" != xno],
[
dnl Not sure why configure picks system compiler, even when --host=pru
case "x`${CC} -dumpmachine`x" in
xpru-elfx) ;;
xprux) ;;
*) AC_MSG_ERROR([C compiler is not targeting PRU. Please check your PATH.]) ;;
esac
dnl Check if compiler is working
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AC_MSG_NOTICE([CC works.])], [AC_MSG_ERROR([CC cannot cross-compile a program.])])
dnl Check if we're running with recent-enough binutils.
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
extern int __IMEM_SIZE;], [
return (int)&__IMEM_SIZE > 0x100;
])], [ld_suppports_dynamic_sizes="yes"], [ld_suppports_dynamic_sizes="no"])
],
[ld_suppports_dynamic_sizes="yes"])
dnl Disable testsuite if a crosstoolchain cannot be verified.
AM_CONDITIONAL([ENABLE_TESTSUITE], [test $enable_toolchain_check = yes])
dnl ==========================================================================
dnl Checks for library functions.
dnl Sanity checks
case "$host" in
pru-*-elf)
AC_MSG_NOTICE([Building for pru host. Good.])
;;
*)
AC_MSG_ERROR([Please specify "--host=pru" option to configure.])
;;
esac
case "$ld_suppports_dynamic_sizes" in
yes)
AC_MSG_NOTICE([Binutils is recent enough.])
;;
*)
AC_MSG_ERROR([Please upgrade Binutils to at least version 2.37.])
;;
esac
AC_CONFIG_FILES([Makefile include/Makefile device-specs/Makefile tests/Makefile])
AC_OUTPUT