-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.ac
executable file
·391 lines (314 loc) · 13.1 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
AC_INIT([adv_jtag_bridge],[3.0.0])
AM_INIT_AUTOMAKE([-Wall -Werror])
LT_INIT
# Use "make V=1" in order to see the gcc command-lines during compilation.
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
# These compilation flags must be set before AC_PROG_CC/CXX,
# or you'll get "-g -O2" by default.
CFLAGS="${CFLAGS=} -g -Wall"
AC_PROG_CC
AC_PROG_INSTALL
AC_CONFIG_MACRO_DIR([m4])
# ----------- Detect host type -----------
AC_CANONICAL_HOST
case $host in
*-cygwin) # Normally it is "i686-pc-cygwin"
echo "Host system: Cygwin detected."
MY_HOST=cygwin
CFLAGS="$CFLAGS -D__CYGWIN_HOST__"
AC_CHECK_HEADER(sys/io.h,,[AC_MSG_ERROR([Include file 'sys/io.h' not found, please install the Cygwin 'ioperm' package.])])
LIBS+=-lioperm
;;
*-linux-*)
echo "Host system: Linux detected."
MY_HOST=linux
CFLAGS="$CFLAGS -D__LINUX_HOST__"
;;
*freebsd*)
echo "Host system: FreeBSD detected."
MY_HOST=freebsd
CFLAGS="$CFLAGS -D__FREEBSD_HOST__"
;;
*)
echo "Host system: Unknown, assuming a Linux host."
MY_HOST=linux
;;
esac
# ----------- Check whether debug or release build -----------
AC_MSG_CHECKING(whether to generate a debug build)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug=[[yes/no]]],
[generate a debug build with assertions and no optimization [default=no]])],
[case "${enableval}" in
yes) debug_build=true ;;
no) debug_build=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
debug_build=false)
if [ test x$debug_build = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -O0 -DDEBUG"
else
AC_MSG_RESULT(no)
# If we let the 'omit frame pointer' optimisation enabled,
# we'll have difficulty later on while trying
# to analyse crash dump files sent by the users.
CFLAGS="$CFLAGS -O2 -DNDEBUG -fno-omit-frame-pointer"
fi
# ----------- Check whether legacy debug_if -----------
AC_MSG_CHECKING(whether to build for the legacy debug unit)
AC_ARG_ENABLE([legacy-debug-if],
[AS_HELP_STRING([--enable-legacy-debug-if=[[yes/no]]],
[build for the legacy debug unit, as opposed to the newer Advanced Debug Unit [default=no]])],
[case "${enableval}" in
yes) legacy_debug_if=true ;;
no) legacy_debug_if=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-legacy-debug-if]) ;;
esac],
legacy_debug_if=false)
if [ test x$legacy_debug_if = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -D__LEGACY__"
else
AC_MSG_RESULT(no)
fi
# ----------- Check whether to build for PULP ---------
AC_MSG_CHECKING(whether to build for PULP)
AC_ARG_ENABLE([pulp],
[AS_HELP_STRING([--enable-pulp=[[yes/no]]],
[build for PULP [default=no]])],
[case "${enableval}" in
yes) pulp=true ;;
no) pulp=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-pulp]) ;;
esac],
pulp=false)
if [ test x$pulp = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DPULP"
else
AC_MSG_RESULT(no)
fi
# ----------- Check whether to ZYNQ cable -----------
AC_MSG_CHECKING(whether to support ZYNQ cable)
AC_ARG_ENABLE([zynq-cable],
[AS_HELP_STRING([--enable-zynq-cable=[[yes/no]]],
[support ZYNQ cable [default=yes]])],
[case "${enableval}" in
yes) support_zynq=true ;;
no) support_zynq=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-zynq-cable]) ;;
esac],
support_zynq=not_given)
if [ test $support_zynq = not_given ]
then
support_zynq=false
fi
AM_CONDITIONAL(SUPPORT_ZYNQ_CABLE,[test x$support_zynq = xtrue])
AM_COND_IF([SUPPORT_ZYNQ_CABLE],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
# ----------- Check whether to support parallel cables -----------
AC_MSG_CHECKING(whether to support parallel cables)
AC_ARG_ENABLE([parallel-cables],
[AS_HELP_STRING([--enable-parallel-cables=[[yes/no]]],
[support parallel cables (requires libioperm under Cygwin) [default=yes]])],
[case "${enableval}" in
yes) support_parallel=true ;;
no) support_parallel=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-parallel-cables]) ;;
esac],
support_parallel=not_given)
if [ test $support_parallel = not_given ]
then
support_parallel=true
fi
if [ test $MY_HOST = freebsd ] && [ test $support_parallel = true ]
then
AC_MSG_ERROR([Support for parallel cables is not available under FreeBSD.])
fi
AM_CONDITIONAL(SUPPORT_PARALLEL_CABLES,[test x$support_parallel = xtrue])
AM_COND_IF([SUPPORT_PARALLEL_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
# ----------- Check whether to support USB cables -----------
AC_MSG_CHECKING(whether to support usb cables)
AC_ARG_ENABLE([usb-cables],
[AS_HELP_STRING([--enable-usb-cables=[[yes/no]]],
[support usb cables (requires libusb) [default=no]])],
[case "${enableval}" in
yes) support_usb=true ;;
no) support_usb=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-usb-cables]) ;;
esac],
support_usb=false)
AM_CONDITIONAL(SUPPORT_USB_CABLES,[test x$support_usb = xtrue])
AM_COND_IF([SUPPORT_USB_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
if [ test $support_usb = true ]
then
AC_CHECK_HEADER(usb.h,,[AC_MSG_ERROR([Include file 'usb.h' not found, please install the libusb-0.1 development files (for example, that would be package 'libusb-win32' under Cygwin, and 'libusb-dev' under Ubuntu).])])
fi
# ------ At least one from (parallel, usb) must be enabled ------
#if [ test x$support_parallel = xfalse ] && [ test x$support_usb = xfalse ]; then
# AC_MSG_ERROR([Support for both parallel and usb cables is disabled.])
#fi
# ------ Check whether the xilinx parallel cable mode is given ------
# This argument should be called --set-xxx and not --enable-xxx ,
# but autoconf identifies only the --enable and --with prefixes
# for recursive configuration option processing.
AC_MSG_CHECKING(xilinx parallel cable speed limit scheme)
AC_ARG_ENABLE([xpc3-limit-scheme],
[AS_HELP_STRING([--enable-xpc3-limit-scheme=[[sleep_wait/timer_wait/no_wait]]],
[limit Xilinx parallel cable speed, as some clones cannot operate as fast as we can drive them [default=no_wait]])],
[case "${enableval}" in
sleep_wait) xpc3_limit_scheme=sleep_wait ;;
timer_wait) xpc3_limit_scheme=timer_wait ;;
no_wait) xpc3_limit_scheme=no_wait ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-xpc3-limit-scheme]) ;;
esac],
xpc3_limit_scheme=not_given)
if [ ! test $xpc3_limit_scheme = not_given ] && [ test $support_parallel = false ]
then
AC_MSG_ERROR([Option --enable-xpc3-limit-scheme can only be supplied if support for the parallel cables has been enabled.])
fi
if [ test $xpc3_limit_scheme = not_given ]
then
xpc3_limit_scheme=no_wait
fi
AC_MSG_RESULT($xpc3_limit_scheme)
case "${xpc3_limit_scheme}" in
sleep_wait)
CFLAGS="$CFLAGS -D__PARALLEL_SLEEP_WAIT__"
;;
timer_wait)
CFLAGS="$CFLAGS -D__PARALLEL_TIMER_BUSY_WAIT__"
;;
no_wait)
# no_wait is the default, nothing to define
;;
*)
AC_MSG_ERROR([Internal error in --enable-xpc3-limit-scheme.])
;;
esac
# ----------- Check whether to support FTDI cables -----------
AC_MSG_CHECKING(whether to support ftdi cables)
AC_ARG_ENABLE([ftdi-cables],
[AS_HELP_STRING([--enable-ftdi-cables=[[yes/no]]],
[support ftdi cables (requires libftdi) [default=no]])],
[case "${enableval}" in
yes) support_ftdi=true ;;
no) support_ftdi=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ftdi-cables]) ;;
esac],
support_ftdi=not_given)
if [ test $support_ftdi = not_given ]
then
support_ftdi=$support_usb
fi
AM_CONDITIONAL(SUPPORT_FTDI_CABLES,[test x$support_ftdi = xtrue])
AM_COND_IF([SUPPORT_FTDI_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
if [ test x$support_usb = xfalse ] && [ test x$support_ftdi = xtrue ]; then
AC_MSG_ERROR([Support for FTDI cables requires support for USB cables.])
fi
if [ test $support_ftdi = true ]
then
AC_CHECK_HEADER(ftdi.h,,[AC_MSG_ERROR([Include file 'ftdi.h' not found, please install the libftdi development files (for example, that would be package 'libftdi-dev' under Ubuntu).])])
fi
# ----------- Check whether to enable the high-speed mode -----------
AC_MSG_CHECKING(whether to enable the high-speed mode)
AC_ARG_ENABLE([high-speed],
[AS_HELP_STRING([--enable-high-speed=[[yes/no]]],
[enable the high-speed mode at the cost of some error checking (requires hardware HDL support) [default=yes]])],
[case "${enableval}" in
yes) enable_high_speed=true ;;
no) enable_high_speed=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-high-speed]) ;;
esac],
enable_high_speed=true)
if [ test x$enable_high_speed = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DADBG_OPT_HISPEED"
else
AC_MSG_RESULT(no)
fi
# ----------- Check whether to enable the JSP server -----------
AC_MSG_CHECKING(whether to enable the JSP server)
AC_ARG_ENABLE([jsp-server],
[AS_HELP_STRING([--enable-jsp-server=[[yes/no]]],
[enable the JSP server (requires hardware HDL support) [default=yes]])],
[case "${enableval}" in
yes) enable_jsp_server=true ;;
no) enable_jsp_server=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-server]) ;;
esac],
enable_jsp_server=not_given)
if [ test x$legacy_debug_if = xtrue ] && [ test x$enable_jsp_server = xtrue ]
then
AC_MSG_ERROR([Option --enable-jsp-server cannot be true when using the legacy_debug_if hardware.])
fi
if [ test $enable_jsp_server = not_given ]
then
if [ test x$legacy_debug_if = xtrue ]
then
enable_jsp_server=false
else
enable_jsp_server=true
fi
fi
AM_CONDITIONAL(INCLUDE_JSP_SERVER,[test x$enable_jsp_server = xtrue])
AM_COND_IF([INCLUDE_JSP_SERVER],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
# ----------- Check whether to enable the JSP multi device support -----------
AC_MSG_CHECKING(whether to enable the JSP multi device chain support)
AC_ARG_ENABLE([jsp-multi-device-chain],
[AS_HELP_STRING([--enable-jsp-multi-device-chain=[[yes/no]]],
[enable the JTAG Serial Port (JSP) multi device chain support (slower, requires hardware HDL support) [default=yes]])],
[case "${enableval}" in
yes) enable_jsp_multi_device_chain=true ;;
no) enable_jsp_multi_device_chain=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-multi-device-chain]) ;;
esac],
enable_jsp_multi_device_chain=not_given)
if [ ! test $enable_jsp_multi_device_chain = not_given ] && [ test $enable_jsp_server = false ]
then
AC_MSG_ERROR([Option --enable-jsp-multi-device-chain can only be supplied if the JSP server has been enabled.])
fi
if [ test $enable_jsp_multi_device_chain = not_given ]
then
enable_jsp_multi_device_chain=true
fi
if [ test x$enable_jsp_multi_device_chain = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DENABLE_JSP_MULTI"
else
AC_MSG_RESULT(no)
fi
# ----------- Check whether to optimize the JSP for parallel or USB -----------
AC_MSG_CHECKING(whether to optimize the JSP for USB)
AC_ARG_ENABLE([jsp-optimize-for-usb],
[AS_HELP_STRING([--enable-jsp-optimize-for-usb=[[yes/no]]],
[optimizes the JTAG Serial Port (JSP) for USB cables (as opposed to optimizing for parallel cables) [default=yes]])],
[case "${enableval}" in
yes) enable_jsp_optimize_for_usb=true ;;
no) enable_jsp_optimize_for_usb=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-optimize-for-usb]) ;;
esac],
enable_jsp_optimize_for_usb=not_given)
if [ ! test $enable_jsp_optimize_for_usb = not_given ] && [ test $enable_jsp_server = false ]
then
AC_MSG_ERROR([Option --enable-jsp-optimize-for-usb can only be supplied if the JSP server has been enabled.])
fi
if [ test $enable_jsp_optimize_for_usb = not_given ]
then
enable_jsp_optimize_for_usb=true
fi
if [ test x$enable_jsp_optimize_for_usb = xtrue ]
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DOPTIMIZE_JSP_FOR_USB"
else
AC_MSG_RESULT(no)
fi
# ----------------------------------------
AC_CONFIG_FILES([Makefile])
AC_OUTPUT