-
Notifications
You must be signed in to change notification settings - Fork 325
/
Copy pathconfigure.ac
405 lines (329 loc) · 11.8 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
AC_PREREQ([2.69])
AC_INIT([sof],[m4_esyscmd(./version.sh)],[[email protected]])
AC_CONFIG_SRCDIR([src/init/init.c])
AC_CONFIG_HEADERS([src/include/config.h])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability subdir-objects silent-rules color-tests dist-xz tar-ustar])
# Initialize maintainer mode
AM_MAINTAINER_MODE([enable])
# get version info from git
m4_define(sof_major, `cat .version | cut -dv -f2 | cut -d. -f1`)
m4_define(sof_minor, `cat .version | cut -d. -f2 | cut -d- -f1`)
m4_define(sof_micro, `cat .version | cut -d. -f3 | cut -d- -f1`)
AC_DEFINE_UNQUOTED([SOF_MAJOR], sof_major, [Sof major version])
AC_DEFINE_UNQUOTED([SOF_MINOR], sof_minor, [Sof minor version])
AC_DEFINE_UNQUOTED([SOF_MICRO], sof_micro, [Sof micro version])
AC_CANONICAL_HOST
# General compiler flags
CFLAGS="${CFLAGS:+$CFLAGS } -O2 -g -Wall -Werror -Wl,-EL -Wmissing-prototypes"
# General assembler flags
ASFLAGS="-DASSEMBLY"
AC_SUBST(ASFLAGS)
# Cross compiler tool libgcc and headers
AC_ARG_WITH([root-dir],
AS_HELP_STRING([--with-root-dir], [Specify location of cross gcc libraries and headers]),
[], [with_root_dir=no])
# check if we are building FW image or library
AC_ARG_ENABLE(library, [AS_HELP_STRING([--enable-library],[build library])], have_library=$enableval, have_library=no)
if test "$have_library" = "yes"; then
AC_DEFINE([CONFIG_LIB], [1], [Configure for Shared Library])
fi
AM_CONDITIONAL(BUILD_LIB, test "$have_library" = "yes")
# check if we are building tools
AC_ARG_ENABLE(rimage, [AS_HELP_STRING([--enable-rimage],[build rimage tool])], have_rimage=$enableval, have_rimage=no)
if test "$have_rimage" = "yes"; then
AC_DEFINE([CONFIG_RIMAGE], [1], [Configure to build rimage])
fi
AM_CONDITIONAL(BUILD_RIMAGE, test "$have_rimage" = "yes")
# Architecture support
AC_ARG_WITH([arch],
AS_HELP_STRING([--with-arch], [Specify DSP architecture]),
[], [with_arch=no])
case "$with_arch" in
xtensa*)
ARCH_CFLAGS="-mtext-section-literals"
AC_SUBST(ARCH_CFLAGS)
ARCH_LDFLAGS="-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static"
AC_SUBST(XTENSA_LDFLAGS)
# extra CFLAGS defined here otherwise configure working gcc tests fails.
CFLAGS="${CFLAGS:+$CFLAGS }-fno-inline-functions -nostdlib -mlongcalls"
LDFLAGS="${LDFLAGS:+$LDFLAGS }-nostdlib"
#ARCH_ASFLAGS=""
AC_SUBST(ARCH_ASFLAGS)
ARCH="xtensa"
AC_SUBST(ARCH)
AS_IF([test "x$with_root_dir" = xno],
AC_MSG_ERROR([Please specify cross compiler root header directory]),
[ROOT_DIR=$with_root_dir])
AC_SUBST(ROOT_DIR)
;;
host*)
ARCH_CFLAGS="-g"
AC_SUBST(ARCH_CFLAGS)
# extra CFLAGS defined here otherwise configure working gcc tests fails.
CFLAGS="${CFLAGS:+$CFLAGS } -O3"
LDFLAGS="${LDFLAGS:+$LDFLAGS }-lpthread"
ARCH="host"
AC_SUBST(ARCH)
;;
*)
if test "$have_rimage" = "no"; then
AC_MSG_ERROR([DSP architecture not specified])
fi
;;
esac
AM_CONDITIONAL(BUILD_XTENSA, test "$ARCH" = "xtensa")
AM_CONDITIONAL(BUILD_HOST, test "$ARCH" = "host")
# Platform support
AC_ARG_WITH([platform],
AS_HELP_STRING([--with-platform], [Specify Host Platform]),
[], [with_platform=no])
case "$with_platform" in
baytrail*)
PLATFORM_LDSCRIPT="baytrail.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="baytrail"
AC_SUBST(PLATFORM)
FW_NAME="byt"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifiep_bd5"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_BAYTRAIL], [1], [Configure for Baytrail])
AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table])
;;
cherrytrail*)
PLATFORM_LDSCRIPT="baytrail.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="baytrail"
AC_SUBST(PLATFORM)
FW_NAME="cht"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifiep_bd5"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_CHERRYTRAIL], [1], [Configure for Cherrytrail])
AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table])
;;
apollolake*)
PLATFORM_LDSCRIPT="apollolake.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="apollolake"
AC_SUBST(PLATFORM)
FW_NAME="apl"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifi3_std"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_APOLLOLAKE], [1], [Configure for Apololake])
AC_DEFINE([CONFIG_IRQ_MAP], [1], [Configure IRQ maps])
AC_DEFINE([CONFIG_DMA_GW], [1], [Configure DMA Gateway])
;;
haswell*)
PLATFORM_LDSCRIPT="haswell.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="haswell"
AC_SUBST(PLATFORM)
FW_NAME="hsw"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifiep_bd5"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_HASWELL], [1], [Configure for Haswell])
AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table])
;;
broadwell*)
PLATFORM_LDSCRIPT="broadwell.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="haswell"
AC_SUBST(PLATFORM)
FW_NAME="bdw"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifiep_bd5"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_BROADWELL], [1], [Configure for Broadwell])
AC_DEFINE([CONFIG_HOST_PTABLE], [1], [Configure handling host page table])
;;
cannonlake*)
PLATFORM_LDSCRIPT="cannonlake.x"
AC_SUBST(PLATFORM_LDSCRIPT)
PLATFORM="cannonlake"
AC_SUBST(PLATFORM)
FW_NAME="cnl"
AC_SUBST(FW_NAME)
XTENSA_CORE="hifi4_std"
AC_SUBST(XTENSA_CORE)
AC_DEFINE([CONFIG_CANNONLAKE], [1], [Configure for Cannonlake])
AC_DEFINE([CONFIG_IRQ_MAP], [1], [Configure IRQ maps])
AC_DEFINE([CONFIG_DMA_GW], [1], [Configure DMA Gateway])
;;
*)
if test "$have_rimage" = "no"; then
if test "$ARCH" = "host"; then
PLATFORM="host"
AC_SUBST(PLATFORM)
else
AC_MSG_ERROR([Host platform not specified])
fi
fi
;;
esac
AM_CONDITIONAL(BUILD_BAYTRAIL, test "$FW_NAME" = "byt")
AM_CONDITIONAL(BUILD_CHERRYTRAIL, test "$FW_NAME" = "cht")
AM_CONDITIONAL(BUILD_HASWELL, test "$FW_NAME" = "hsw")
AM_CONDITIONAL(BUILD_BROADWELL, test "$FW_NAME" = "bdw")
AM_CONDITIONAL(BUILD_APOLLOLAKE, test "$FW_NAME" = "apl")
AM_CONDITIONAL(BUILD_CANNONLAKE, test "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_BOOTLOADER, test "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_MODULE, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
AM_CONDITIONAL(BUILD_APL_SSP, test "$FW_NAME" = "apl" -o "$FW_NAME" = "cnl")
# DSP core support (Optional)
AC_ARG_WITH([dsp-core],
AS_HELP_STRING([--with-dsp-core], [Specify DSP Core]),
[], [with_dsp_core=no])
case "$with_dsp_core" in
*)
XTENSA_CORE="$with_dsp_core"
AC_SUBST(XTENSA_CORE)
;;
esac
PLATFORM_BOOT_LDR_LDSCRIPT="boot_ldr.x"
AC_SUBST(PLATFORM_BOOT_LDR_LDSCRIPT)
# Optimisation settings and checks
# SSE4_2 support
AC_ARG_ENABLE(sse42, [AS_HELP_STRING([--enable-sse42],[enable SSE42 optimizations])], have_sse42=$enableval, have_sse42=yes)
AX_CHECK_COMPILE_FLAG(-msse4.2, [SSE42_CFLAGS="-DOPS_SSE42 -msse4.2 -ffast-math -ftree-vectorizer-verbose=0"],
[have_sse42=no])
if test "$have_sse42" = "yes"; then
AC_DEFINE(HAVE_SSE42,1,[Define to enable SSE42 optimizations.])
fi
AM_CONDITIONAL(HAVE_SSE42, test "$have_sse42" = "yes")
AC_SUBST(SSE42_CFLAGS)
# AVX support
AC_ARG_ENABLE(avx, [AS_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=yes)
AX_CHECK_COMPILE_FLAG(-mavx, [AVX_CFLAGS="-DOPS_AVX -mavx -ffast-math -ftree-vectorizer-verbose=0"],
[have_avx=no])
if test "$have_avx" = "yes"; then
AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.])
fi
AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes")
AC_SUBST(AVX_CFLAGS)
# AVX2 support
AC_ARG_ENABLE(avx2, [AS_HELP_STRING([--enable-avx2],[enable AVX2 optimizations])], have_avx2=$enableval, have_avx2=yes)
AX_CHECK_COMPILE_FLAG(-mavx2, [AVX2_CFLAGS="-DOPS_AVX2 -mavx2 -ffast-math -ftree-vectorizer-verbose=0"],
[have_avx2=no])
if test "$have_avx2" = "yes"; then
AC_DEFINE(HAVE_AVX2,1,[Define to enable AVX2 optimizations.])
fi
AM_CONDITIONAL(HAVE_AVX2, test "$have_avx2" = "yes")
AC_SUBST(AVX2_CFLAGS)
# FMA support
AC_ARG_ENABLE(fma, [AS_HELP_STRING([--enable-fma],[enable FMA optimizations])], have_fma=$enableval, have_fma=yes)
AX_CHECK_COMPILE_FLAG(-mfma, [FMA_CFLAGS="-DOPS_FMA -mfma -ffast-math -ftree-vectorizer-verbose=0"],
[have_fma=no])
if test "$have_fma" = "yes"; then
AC_DEFINE(HAVE_FMA,1,[Define to enable FMA optimizations.])
fi
AM_CONDITIONAL(HAVE_FMA, test "$have_fma" = "yes")
AC_SUBST(FMA_CFLAGS)
# Hifi2EP
AC_ARG_ENABLE(hifi2ep, [AS_HELP_STRING([--enable-hifi2ep],[enable HiFi2EP optimizations])], have_hifi2ep=$enableval, have_hifi2ep=yes)
AX_CHECK_COMPILE_FLAG(-mhifi2ep, [FMA_CFLAGS="-DOPS_HIFI2EP -mhifi2ep -ffast-math -ftree-vectorizer-verbose=0"],
[have_hifi2ep=no])
if test "$have_hifi2ep" = "yes"; then
AC_DEFINE(HAVE_HIFI2EP,1,[Define to enable Hifi2 EP optimizations.])
fi
AM_CONDITIONAL(HAVE_HIFI2EP, test "$have_hifi2ep" = "yes")
AC_SUBST(HIFI2EP_CFLAGS)
# Hifi3
AC_ARG_ENABLE(hifi3, [AS_HELP_STRING([--enable-hifi3],[enable HiFi3 optimizations])], have_hifi3=$enableval, have_hifi3=yes)
AX_CHECK_COMPILE_FLAG(-mhihi3, [FMA_CFLAGS="-DOPS_HIFI3 -mhifi3 -ffast-math -ftree-vectorizer-verbose=0"],
[have_hifi3=no])
if test "$have_hifi3" = "yes"; then
AC_DEFINE(HAVE_HIFI3,1,[Define to enable Hifi3 optimizations.])
fi
AM_CONDITIONAL(HAVE_HIFI3, test "$have_hifi3" = "yes")
AC_SUBST(HIFI3_CFLAGS)
# Test after CFLAGS set othewise test of cross compiler fails.
AM_PROG_AS
AM_PROG_AR
AC_PROG_CC
LT_INIT
AC_CHECK_TOOL([OBJCOPY], [objcopy], [])
AC_CHECK_TOOL([OBJDUMP], [objdump], [])
# Check for openssl - used by rimage
AC_CHECK_LIB([crypto], [OPENSSL_config], , [have_openssl="no"])
if test "$have_rimage" = "yes"; then
if test "$have_openssl" = "no"; then
AC_MSG_ERROR([Need OpenSSL libcrypto for rimage code signing])
fi
fi
PEM_KEY_PREFIX="/usr/local/share/rimage"
AC_DEFINE_UNQUOTED([PEM_KEY_PREFIX], ["$PEM_KEY_PREFIX"], ["Path for PEM keys"])
AC_SUBST(PEM_KEY_PREFIX)
AM_EXTRA_RECURSIVE_TARGETS([bin])
AM_EXTRA_RECURSIVE_TARGETS([vminstall])
AC_CONFIG_FILES([
Makefile
rimage/Makefile
rimage/keys/Makefile
src/Makefile
src/tasks/Makefile
src/init/Makefile
src/arch/Makefile
src/arch/xtensa/Makefile
src/arch/xtensa/include/Makefile
src/arch/xtensa/include/arch/Makefile
src/arch/xtensa/include/xtensa/Makefile
src/arch/xtensa/include/xtensa/config/Makefile
src/arch/xtensa/hal/Makefile
src/arch/xtensa/xtos/Makefile
src/arch/host/Makefile
src/arch/host/include/Makefile
src/arch/host/include/arch/Makefile
src/audio/Makefile
src/math/Makefile
src/drivers/Makefile
src/include/Makefile
src/include/sof/Makefile
src/include/sof/audio/Makefile
src/include/sof/audio/coefficients/Makefile
src/include/sof/audio/coefficients/src/Makefile
src/include/sof/math/Makefile
src/include/uapi/Makefile
src/ipc/Makefile
src/library/Makefile
src/library/include/Makefile
src/library/include/platform/Makefile
src/lib/Makefile
src/platform/Makefile
src/platform/baytrail/Makefile
src/platform/baytrail/include/Makefile
src/platform/baytrail/include/platform/Makefile
src/platform/baytrail/include/xtensa/Makefile
src/platform/baytrail/include/xtensa/config/Makefile
src/platform/apollolake/Makefile
src/platform/apollolake/include/Makefile
src/platform/apollolake/include/platform/Makefile
src/platform/apollolake/include/xtensa/Makefile
src/platform/apollolake/include/xtensa/config/Makefile
src/platform/haswell/Makefile
src/platform/haswell/include/Makefile
src/platform/haswell/include/platform/Makefile
src/platform/haswell/include/xtensa/Makefile
src/platform/haswell/include/xtensa/config/Makefile
src/platform/cannonlake/Makefile
src/platform/cannonlake/include/Makefile
src/platform/cannonlake/include/platform/Makefile
src/platform/cannonlake/include/xtensa/Makefile
src/platform/cannonlake/include/xtensa/config/Makefile
])
AC_OUTPUT
echo "
---{ $PACKAGE_NAME $VERSION }---
Target Architecture: ${ARCH}
Target Platform: ${PLATFORM}
Target Core: ${XTENSA_CORE}
PEM: ${PEM_KEY_PREFIX}
Compiler: ${CC}
CFLAGS: ${CFLAGS}
LDFLAGS: ${LDFLAGS}
ARCH_CFLAGS: ${ARCH_CFLAGS}
ARCH_LDFLAGS: ${ARCH_LDFLAGS}
"