-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
231 lines (191 loc) · 6.45 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
AC_INIT([arc-toolchain],[1.0])
AC_PROG_CC
AC_PROG_FGREP
AC_PROG_GREP
AC_PATH_PROG([BASH], [bash],
[AC_MSG_ERROR([bash not found])])
AC_PATH_PROGS_FEATURE_CHECK([GAWK], [gawk awk],
[AS_IF([$ac_path_GAWK --version 2>&1 | $FGREP GNU >/dev/null],
[ac_cv_path_GAWK=$ac_path_GAWK ac_path_GAWK_found=:])],
[AC_MSG_ERROR([GNU Awk not found])])
AC_SUBST([GAWK], [$ac_cv_path_GAWK])
AC_PATH_PROGS_FEATURE_CHECK([GSED], [gsed sed],
[AS_IF([$ac_path_GSED --version 2>&1 | $FGREP GNU >/dev/null],
[ac_cv_path_GSED=$ac_path_GSED ac_path_GSED_found=:])],
[AC_MSG_ERROR([GNU sed not found])])
AC_SUBST([GSED], [$ac_cv_path_GSED])
need_gcc_external_libraries="no"
AC_CHECK_LIB(gmp, __gmpz_init, ,
[need_gcc_external_libraries="yes"])
AC_CHECK_LIB(mpfr, mpfr_init, ,
[need_gcc_external_libraries="yes"])
AC_CHECK_LIB(mpc, mpc_init2, ,
[need_gcc_external_libraries="yes"])
AS_IF([test x"$need_gcc_external_libraries" != xno],
[AC_SUBST(NEED_GCC_EXTERNAL_LIBRARIES,true)],
[AC_SUBST(NEED_GCC_EXTERNAL_LIBRARIES,false)])
AC_PATH_PROG([CURL], [curl], [no])
AC_PATH_PROG([WGET], [wget], [no])
AC_PATH_PROG([FTP], [ftp], [no])
AS_IF([test x"$CURL" != xno], [FETCHER="$CURL -L -o - --ftp-pasv --retry 10"],
[test x"$WGET" != xno], [FETCHER="$WGET -O -"],
[test x"$FTP" != xno], [FETCHER="$FTP -o - -p"],
[AC_MSG_ERROR([no file transfer utility found])])
AC_SUBST(FETCHER)
AC_ARG_ENABLE(linux,
[AS_HELP_STRING([--enable-linux],
[set linux as the default make target @<:@--disable-linux@:>@])],
[],
[enable_linux=no]
)
AS_IF([test "x$enable_linux" != xno],
[AC_SUBST(default_target, linux)],
[AC_SUBST(default_target, baremetal)])
AC_ARG_ENABLE(qemu,
[AS_HELP_STRING([--enable-qemu],
[enable building ARC QEMU @<:@--disable-qemu@:>@])],
[],
[enable_qemu=no]
)
AS_IF([test "x$enable_qemu" != xno],
[AC_SUBST(qemu_build, qemu)],
[])
AC_ARG_WITH(sim,
[AS_HELP_STRING([--with-sim=SIM],
[Sets the base ARC Simulator @<:@--with-cpu=qemu@:>@])],
[],
[with_sim=default]
)
AS_IF([test "x$with_sim" != xdefault],
[AC_SUBST(with_sim, $with_sim)],
[AC_SUBST(with_sim,"qemu")])
AC_ARG_ENABLE(werror,
[AS_HELP_STRING([--enable-werror],
[controls if build is compiled with werror or not @<:@--disable-werror@:>@])],
[],
[enable_werror=yes]
)
AS_IF([test "x$enable_werror" != xno],
[AC_SUBST(werror_flag, --enable-werror)],
[AC_SUBST(werror_flag, --disable-werror)])
AC_ARG_ENABLE(debug_info,
[AS_HELP_STRING([--enable-debug-info],
[enable building with debug info @<:@--disable-debug-info@:>@])],
[],
[enable_debug_info=no]
)
AS_IF([test "x$enable_debug_info" != xno],
[AC_SUBST(debug_info_glibc, "-Og -g3 -fvar-tracking-assignments")
AC_SUBST(debug_info, "-O0 -g3 -fvar-tracking-assignments")])
AC_ARG_WITH(cpu,
[AS_HELP_STRING([--with-cpu=CPU],
[Sets the base ARC ISA @<:@--with-cpu=archs@:>@])],
[],
[with_cpu=default]
)
AS_IF([test "x$with_cpu" != xdefault],
[AC_SUBST(with_cpu, --with-cpu=$with_cpu)],
[AC_SUBST(with_cpu,"")])
AC_ARG_WITH(fpu,
[AS_HELP_STRING([--with-fpu=FPU],
[Sets default FPU support @<:@--with-fpu=fpus@:>@])],
[],
[with_fpu=none]
)
AS_IF([test "x$with_fpu" != xnone],
[AC_SUBST(with_fpu, --with-fpu=$with_fpu)],
[AC_SUBST(with_fpu,"")])
AS_IF([test "x$with_host" != xdefault],
[AC_SUBST(configure_host,--host=$with_host)],
[AC_SUBST(configure_host,"")])
AC_ARG_WITH(system-zlib,
[AS_HELP_STRING([--with-system-zlib],
[use zlib from the system instead of the builtin copy from GCC @<:@--with-system-zlib@:>@])],
[],
[with_system_zlib=yes]
)
AS_IF([test "x$with_system_zlib" != xno],
[AC_SUBST(with_system_zlib,--with-system-zlib)],
[AC_SUBST(with_system_zlib,--without-system-zlib)])
AC_ARG_ENABLE(multilib,
[AS_HELP_STRING([--enable-multilib],
[build all ARC runtime libraries @<:@--disable-multilib@:>@])],
[],
[enable_multilib=no]
)
AS_IF([test "x$enable_multilib" != xno],
[AC_SUBST(multilib_flags,--enable-multilib)],
[AC_SUBST(multilib_flags,--disable-multilib)])
AC_ARG_ENABLE(gcc-checking,
[AS_HELP_STRING([--enable-gcc-checking],
[Enable gcc internal checking, it will make gcc very slow, only enable it when developing gcc @<:@--disable-gcc-checking@:>@])],
[],
[enable_gcc_checking=no]
)
AS_IF([test "x$enable_gcc_checking" != xno],
[AC_SUBST(gcc_checking, --enable-checking=yes)],
[AC_SUBST(gcc_checking, --enable-checking=release)])
AC_ARG_WITH(cmodel,
[AS_HELP_STRING([--with-cmodel],
[Select the code model to use when building libc and libgcc @<:@--with-cmodel=medlow@:>@])],
[],
[]
)
AS_IF([test "x$with_cmodel" != x],
[AC_SUBST(cmodel, -mcmodel=$with_cmodel)],
[AC_SUBST(cmodel, "")])
# [AC_SUBST(cmodel, -mcmodel=medlow)])
AC_DEFUN([AX_ARG_WITH_SRC],
[{m4_pushdef([opt_name], with_$1_src)
AC_ARG_WITH($1-src,
[AS_HELP_STRING([--with-$1-src],[Set $1 source path, use builtin source by default])],
[],
[opt_name=default]
)
AS_IF([test "x$opt_name" != xdefault],
[AC_SUBST(opt_name,$opt_name)],
[AC_SUBST(opt_name,"\$(srcdir)/$2")])
m4_popdef([opt_name])
}])
AX_ARG_WITH_SRC(binutils, binutils-gdb)
AX_ARG_WITH_SRC(newlib, newlib)
AX_ARG_WITH_SRC(gcc, gcc)
AX_ARG_WITH_SRC(glibc, glibc)
AX_ARG_WITH_SRC(linux, linux)
AX_ARG_WITH_SRC(qemu, qemu)
AC_ARG_WITH(src,
[AS_HELP_STRING([--with-src],
[Select parent source path, use `arc-gnu-toolchain` as parent source path by default])],
[],
[]
)
AS_IF([test "x$with_src" != x],
[AC_SUBST(with_src, $with_src)],
[AC_SUBST(with_src, "")])
AC_ARG_WITH(target_cflags,
[AS_HELP_STRING([--with-target-cflags],
[Add extra target flags for C for library code])],
[],
[]
)
AC_SUBST(target_cflags, $with_target_cflags)
AC_ARG_WITH(target_cxxflags,
[AS_HELP_STRING([--with-target-cxxflags],
[Add extra target flags for C++ for library code])],
[],
[]
)
AC_SUBST(target_cxxflags, $with_target_cxxflags)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([scripts/wrapper/awk/awk], [chmod +x scripts/wrapper/awk])
AC_CONFIG_FILES([scripts/wrapper/sed/sed], [chmod +x scripts/wrapper/sed])
AC_ARG_WITH(linux-headers-src,
[AS_HELP_STRING([--with-linux-headers-src],[Set linux-headers source path, use builtin source by default])],
[],
[with_linux_headers_src=default]
)
AS_IF([test "x$with_linux_headers_src" != xdefault],
[AC_SUBST(with_linux_headers_src,$with_linux_headers_src)],
[AC_SUBST(with_linux_headers_src,"\$(srcdir)/linux-headers/include")])
AC_OUTPUT
AC_OUTPUT