1 |
59 |
nyawn |
AC_INIT([adv_jtag_bridge],[3.0.0])
|
2 |
|
|
AM_INIT_AUTOMAKE([-Wall -Werror])
|
3 |
|
|
LT_INIT
|
4 |
|
|
|
5 |
|
|
# Use "make V=1" in order to see the gcc command-lines during compilation.
|
6 |
|
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
7 |
|
|
|
8 |
|
|
# These compilation flags must be set before AC_PROG_CC/CXX,
|
9 |
|
|
# or you'll get "-g -O2" by default.
|
10 |
|
|
CFLAGS="${CFLAGS=} -g -Wall"
|
11 |
|
|
|
12 |
|
|
AC_PROG_CC
|
13 |
|
|
AC_PROG_INSTALL
|
14 |
|
|
|
15 |
|
|
AC_CONFIG_MACRO_DIR([m4])
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
# ----------- Detect host type -----------
|
19 |
|
|
|
20 |
|
|
AC_CANONICAL_HOST
|
21 |
|
|
|
22 |
|
|
case $host in
|
23 |
|
|
*-cygwin) # Normally it is "i686-pc-cygwin"
|
24 |
|
|
echo "Host system: Cygwin detected."
|
25 |
|
|
MY_HOST=cygwin
|
26 |
|
|
CFLAGS="$CFLAGS -D__CYGWIN_HOST__"
|
27 |
|
|
AC_CHECK_HEADER(sys/io.h,,[AC_MSG_ERROR([Include file 'sys/io.h' not found, please install the Cygwin 'ioperm' package.])])
|
28 |
|
|
LIBS+=-lioperm
|
29 |
|
|
;;
|
30 |
|
|
*-linux-*)
|
31 |
|
|
echo "Host system: Linux detected."
|
32 |
|
|
MY_HOST=linux
|
33 |
|
|
CFLAGS="$CFLAGS -D__LINUX_HOST__"
|
34 |
|
|
;;
|
35 |
|
|
*freebsd*)
|
36 |
|
|
echo "Host system: FreeBSD detected."
|
37 |
|
|
MY_HOST=freebsd
|
38 |
|
|
CFLAGS="$CFLAGS -D__FREEBSD_HOST__"
|
39 |
|
|
;;
|
40 |
|
|
*)
|
41 |
|
|
echo "Host system: Unknown, assuming a Linux host."
|
42 |
|
|
MY_HOST=linux
|
43 |
|
|
;;
|
44 |
|
|
esac
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
# ----------- Check whether debug or release build -----------
|
48 |
|
|
|
49 |
|
|
AC_MSG_CHECKING(whether to generate a debug build)
|
50 |
|
|
AC_ARG_ENABLE([debug],
|
51 |
|
|
[AS_HELP_STRING([--enable-debug=[[yes/no]]],
|
52 |
|
|
[generate a debug build with assertions and no optimization [default=no]])],
|
53 |
|
|
[case "${enableval}" in
|
54 |
|
|
yes) debug_build=true ;;
|
55 |
|
|
no) debug_build=false ;;
|
56 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
57 |
|
|
esac],
|
58 |
|
|
debug_build=false)
|
59 |
|
|
|
60 |
|
|
if [ test x$debug_build = xtrue ]
|
61 |
|
|
then
|
62 |
|
|
AC_MSG_RESULT(yes)
|
63 |
|
|
CFLAGS="$CFLAGS -O0 -DDEBUG"
|
64 |
|
|
else
|
65 |
|
|
AC_MSG_RESULT(no)
|
66 |
|
|
# If we let the 'omit frame pointer' optimisation enabled,
|
67 |
|
|
# we'll have difficulty later on while trying
|
68 |
|
|
# to analyse crash dump files sent by the users.
|
69 |
|
|
CFLAGS="$CFLAGS -O2 -DNDEBUG -fno-omit-frame-pointer"
|
70 |
|
|
fi
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
# ----------- Check whether legacy debug_if -----------
|
74 |
|
|
|
75 |
|
|
AC_MSG_CHECKING(whether to build for the legacy debug unit)
|
76 |
|
|
AC_ARG_ENABLE([legacy-debug-if],
|
77 |
|
|
[AS_HELP_STRING([--enable-legacy-debug-if=[[yes/no]]],
|
78 |
|
|
[build for the legacy debug unit, as opposed to the newer Advanced Debug Unit [default=no]])],
|
79 |
|
|
[case "${enableval}" in
|
80 |
|
|
yes) legacy_debug_if=true ;;
|
81 |
|
|
no) legacy_debug_if=false ;;
|
82 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-legacy-debug-if]) ;;
|
83 |
|
|
esac],
|
84 |
|
|
legacy_debug_if=false)
|
85 |
|
|
|
86 |
|
|
if [ test x$legacy_debug_if = xtrue ]
|
87 |
|
|
then
|
88 |
|
|
AC_MSG_RESULT(yes)
|
89 |
|
|
CFLAGS="$CFLAGS -D__LEGACY__"
|
90 |
|
|
else
|
91 |
|
|
AC_MSG_RESULT(no)
|
92 |
|
|
fi
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
# ----------- Check whether to support parallel cables -----------
|
96 |
|
|
|
97 |
|
|
AC_MSG_CHECKING(whether to support parallel cables)
|
98 |
|
|
AC_ARG_ENABLE([parallel-cables],
|
99 |
|
|
[AS_HELP_STRING([--enable-parallel-cables=[[yes/no]]],
|
100 |
|
|
[support parallel cables (requires libioperm under Cygwin) [default=yes]])],
|
101 |
|
|
[case "${enableval}" in
|
102 |
|
|
yes) support_parallel=true ;;
|
103 |
|
|
no) support_parallel=false ;;
|
104 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-parallel-cables]) ;;
|
105 |
|
|
esac],
|
106 |
|
|
support_parallel=not_given)
|
107 |
|
|
|
108 |
|
|
if [ test $support_parallel = not_given ]
|
109 |
|
|
then
|
110 |
|
|
support_parallel=true
|
111 |
|
|
fi
|
112 |
|
|
|
113 |
|
|
if [ test $MY_HOST = freebsd ] && [ test $support_parallel = true ]
|
114 |
|
|
then
|
115 |
|
|
AC_MSG_ERROR([Support for parallel cables is not available under FreeBSD.])
|
116 |
|
|
fi
|
117 |
|
|
|
118 |
|
|
AM_CONDITIONAL(SUPPORT_PARALLEL_CABLES,[test x$support_parallel = xtrue])
|
119 |
|
|
AM_COND_IF([SUPPORT_PARALLEL_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
# ----------- Check whether to support USB cables -----------
|
123 |
|
|
|
124 |
|
|
AC_MSG_CHECKING(whether to support usb cables)
|
125 |
|
|
AC_ARG_ENABLE([usb-cables],
|
126 |
|
|
[AS_HELP_STRING([--enable-usb-cables=[[yes/no]]],
|
127 |
|
|
[support usb cables (requires libusb) [default=yes]])],
|
128 |
|
|
[case "${enableval}" in
|
129 |
|
|
yes) support_usb=true ;;
|
130 |
|
|
no) support_usb=false ;;
|
131 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-usb-cables]) ;;
|
132 |
|
|
esac],
|
133 |
|
|
support_usb=true)
|
134 |
|
|
|
135 |
|
|
AM_CONDITIONAL(SUPPORT_USB_CABLES,[test x$support_usb = xtrue])
|
136 |
|
|
AM_COND_IF([SUPPORT_USB_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
|
137 |
|
|
|
138 |
|
|
if [ test $support_usb = true ]
|
139 |
|
|
then
|
140 |
|
|
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).])])
|
141 |
|
|
fi
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
# ------ At least one from (parallel, usb) must be enabled ------
|
145 |
|
|
|
146 |
|
|
if [ test x$support_parallel = xfalse ] && [ test x$support_usb = xfalse ]; then
|
147 |
|
|
AC_MSG_ERROR([Support for both parallel and usb cables is disabled.])
|
148 |
|
|
fi
|
149 |
|
|
|
150 |
|
|
# ------ Check whether the xilinx parallel cable mode is given ------
|
151 |
|
|
# This argument should be called --set-xxx and not --enable-xxx ,
|
152 |
|
|
# but autoconf identifies only the --enable and --with prefixes
|
153 |
|
|
# for recursive configuration option processing.
|
154 |
|
|
|
155 |
|
|
AC_MSG_CHECKING(xilinx parallel cable speed limit scheme)
|
156 |
|
|
AC_ARG_ENABLE([xpc3-limit-scheme],
|
157 |
|
|
[AS_HELP_STRING([--enable-xpc3-limit-scheme=[[sleep_wait/timer_wait/no_wait]]],
|
158 |
|
|
[limit Xilinx parallel cable speed, as some clones cannot operate as fast as we can drive them [default=no_wait]])],
|
159 |
|
|
[case "${enableval}" in
|
160 |
|
|
sleep_wait) xpc3_limit_scheme=sleep_wait ;;
|
161 |
|
|
timer_wait) xpc3_limit_scheme=timer_wait ;;
|
162 |
|
|
no_wait) xpc3_limit_scheme=no_wait ;;
|
163 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-xpc3-limit-scheme]) ;;
|
164 |
|
|
esac],
|
165 |
|
|
xpc3_limit_scheme=not_given)
|
166 |
|
|
|
167 |
|
|
if [ ! test $xpc3_limit_scheme = not_given ] && [ test $support_parallel = false ]
|
168 |
|
|
then
|
169 |
|
|
AC_MSG_ERROR([Option --enable-xpc3-limit-scheme can only be supplied if support for the parallel cables has been enabled.])
|
170 |
|
|
fi
|
171 |
|
|
|
172 |
|
|
if [ test $xpc3_limit_scheme = not_given ]
|
173 |
|
|
then
|
174 |
|
|
xpc3_limit_scheme=no_wait
|
175 |
|
|
fi
|
176 |
|
|
|
177 |
|
|
AC_MSG_RESULT($xpc3_limit_scheme)
|
178 |
|
|
|
179 |
|
|
case "${xpc3_limit_scheme}" in
|
180 |
|
|
sleep_wait)
|
181 |
|
|
CFLAGS="$CFLAGS -D__PARALLEL_SLEEP_WAIT__"
|
182 |
|
|
;;
|
183 |
|
|
timer_wait)
|
184 |
|
|
CFLAGS="$CFLAGS -D__PARALLEL_TIMER_BUSY_WAIT__"
|
185 |
|
|
;;
|
186 |
|
|
no_wait)
|
187 |
|
|
# no_wait is the default, nothing to define
|
188 |
|
|
;;
|
189 |
|
|
*)
|
190 |
|
|
AC_MSG_ERROR([Internal error in --enable-xpc3-limit-scheme.])
|
191 |
|
|
;;
|
192 |
|
|
esac
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
# ----------- Check whether to support FTDI cables -----------
|
196 |
|
|
|
197 |
|
|
AC_MSG_CHECKING(whether to support ftdi cables)
|
198 |
|
|
AC_ARG_ENABLE([ftdi-cables],
|
199 |
|
|
[AS_HELP_STRING([--enable-ftdi-cables=[[yes/no]]],
|
200 |
|
|
[support ftdi cables (requires libftdi) [default=yes]])],
|
201 |
|
|
[case "${enableval}" in
|
202 |
|
|
yes) support_ftdi=true ;;
|
203 |
|
|
no) support_ftdi=false ;;
|
204 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ftdi-cables]) ;;
|
205 |
|
|
esac],
|
206 |
|
|
support_ftdi=not_given)
|
207 |
|
|
|
208 |
|
|
if [ test $support_ftdi = not_given ]
|
209 |
|
|
then
|
210 |
|
|
support_ftdi=$support_usb
|
211 |
|
|
fi
|
212 |
|
|
|
213 |
|
|
AM_CONDITIONAL(SUPPORT_FTDI_CABLES,[test x$support_ftdi = xtrue])
|
214 |
|
|
AM_COND_IF([SUPPORT_FTDI_CABLES],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
|
215 |
|
|
|
216 |
|
|
if [ test x$support_usb = xfalse ] && [ test x$support_ftdi = xtrue ]; then
|
217 |
|
|
AC_MSG_ERROR([Support for FTDI cables requires support for USB cables.])
|
218 |
|
|
fi
|
219 |
|
|
|
220 |
|
|
if [ test $support_ftdi = true ]
|
221 |
|
|
then
|
222 |
|
|
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).])])
|
223 |
|
|
fi
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
# ----------- Check whether to enable the high-speed mode -----------
|
227 |
|
|
|
228 |
|
|
AC_MSG_CHECKING(whether to enable the high-speed mode)
|
229 |
|
|
AC_ARG_ENABLE([high-speed],
|
230 |
|
|
[AS_HELP_STRING([--enable-high-speed=[[yes/no]]],
|
231 |
|
|
[enable the high-speed mode at the cost of some error checking (requires hardware HDL support) [default=yes]])],
|
232 |
|
|
[case "${enableval}" in
|
233 |
|
|
yes) enable_high_speed=true ;;
|
234 |
|
|
no) enable_high_speed=false ;;
|
235 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-high-speed]) ;;
|
236 |
|
|
esac],
|
237 |
|
|
enable_high_speed=true)
|
238 |
|
|
|
239 |
|
|
if [ test x$enable_high_speed = xtrue ]
|
240 |
|
|
then
|
241 |
|
|
AC_MSG_RESULT(yes)
|
242 |
|
|
CFLAGS="$CFLAGS -DADBG_OPT_HISPEED"
|
243 |
|
|
else
|
244 |
|
|
AC_MSG_RESULT(no)
|
245 |
|
|
fi
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
# ----------- Check whether to enable the JSP server -----------
|
249 |
|
|
|
250 |
|
|
AC_MSG_CHECKING(whether to enable the JSP server)
|
251 |
|
|
AC_ARG_ENABLE([jsp-server],
|
252 |
|
|
[AS_HELP_STRING([--enable-jsp-server=[[yes/no]]],
|
253 |
|
|
[enable the JSP server (requires hardware HDL support) [default=yes]])],
|
254 |
|
|
[case "${enableval}" in
|
255 |
|
|
yes) enable_jsp_server=true ;;
|
256 |
|
|
no) enable_jsp_server=false ;;
|
257 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-server]) ;;
|
258 |
|
|
esac],
|
259 |
|
|
enable_jsp_server=not_given)
|
260 |
|
|
|
261 |
|
|
if [ test x$legacy_debug_if = xtrue ] && [ test x$enable_jsp_server = xtrue ]
|
262 |
|
|
then
|
263 |
|
|
AC_MSG_ERROR([Option --enable-jsp-server cannot be true when using the legacy_debug_if hardware.])
|
264 |
|
|
fi
|
265 |
|
|
|
266 |
|
|
if [ test $enable_jsp_server = not_given ]
|
267 |
|
|
then
|
268 |
|
|
if [ test x$legacy_debug_if = xtrue ]
|
269 |
|
|
then
|
270 |
|
|
enable_jsp_server=false
|
271 |
|
|
else
|
272 |
|
|
enable_jsp_server=true
|
273 |
|
|
fi
|
274 |
|
|
fi
|
275 |
|
|
|
276 |
|
|
AM_CONDITIONAL(INCLUDE_JSP_SERVER,[test x$enable_jsp_server = xtrue])
|
277 |
|
|
AM_COND_IF([INCLUDE_JSP_SERVER],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
# ----------- Check whether to enable the JSP multi device support -----------
|
281 |
|
|
|
282 |
|
|
AC_MSG_CHECKING(whether to enable the JSP multi device chain support)
|
283 |
|
|
AC_ARG_ENABLE([jsp-multi-device-chain],
|
284 |
|
|
[AS_HELP_STRING([--enable-jsp-multi-device-chain=[[yes/no]]],
|
285 |
|
|
[enable the JTAG Serial Port (JSP) multi device chain support (slower, requires hardware HDL support) [default=yes]])],
|
286 |
|
|
[case "${enableval}" in
|
287 |
|
|
yes) enable_jsp_multi_device_chain=true ;;
|
288 |
|
|
no) enable_jsp_multi_device_chain=false ;;
|
289 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-multi-device-chain]) ;;
|
290 |
|
|
esac],
|
291 |
|
|
enable_jsp_multi_device_chain=not_given)
|
292 |
|
|
|
293 |
|
|
if [ ! test $enable_jsp_multi_device_chain = not_given ] && [ test $enable_jsp_server = false ]
|
294 |
|
|
then
|
295 |
|
|
AC_MSG_ERROR([Option --enable-jsp-multi-device-chain can only be supplied if the JSP server has been enabled.])
|
296 |
|
|
fi
|
297 |
|
|
|
298 |
|
|
if [ test $enable_jsp_multi_device_chain = not_given ]
|
299 |
|
|
then
|
300 |
|
|
enable_jsp_multi_device_chain=true
|
301 |
|
|
fi
|
302 |
|
|
|
303 |
|
|
if [ test x$enable_jsp_multi_device_chain = xtrue ]
|
304 |
|
|
then
|
305 |
|
|
AC_MSG_RESULT(yes)
|
306 |
|
|
CFLAGS="$CFLAGS -DENABLE_JSP_MULTI"
|
307 |
|
|
else
|
308 |
|
|
AC_MSG_RESULT(no)
|
309 |
|
|
fi
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
# ----------- Check whether to optimize the JSP for parallel or USB -----------
|
313 |
|
|
|
314 |
|
|
AC_MSG_CHECKING(whether to optimize the JSP for USB)
|
315 |
|
|
AC_ARG_ENABLE([jsp-optimize-for-usb],
|
316 |
|
|
[AS_HELP_STRING([--enable-jsp-optimize-for-usb=[[yes/no]]],
|
317 |
|
|
[optimizes the JTAG Serial Port (JSP) for USB cables (as opposed to optimizing for parallel cables) [default=yes]])],
|
318 |
|
|
[case "${enableval}" in
|
319 |
|
|
yes) enable_jsp_optimize_for_usb=true ;;
|
320 |
|
|
no) enable_jsp_optimize_for_usb=false ;;
|
321 |
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-jsp-optimize-for-usb]) ;;
|
322 |
|
|
esac],
|
323 |
|
|
enable_jsp_optimize_for_usb=not_given)
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
if [ ! test $enable_jsp_optimize_for_usb = not_given ] && [ test $enable_jsp_server = false ]
|
327 |
|
|
then
|
328 |
|
|
AC_MSG_ERROR([Option --enable-jsp-optimize-for-usb can only be supplied if the JSP server has been enabled.])
|
329 |
|
|
fi
|
330 |
|
|
|
331 |
|
|
if [ test $enable_jsp_optimize_for_usb = not_given ]
|
332 |
|
|
then
|
333 |
|
|
enable_jsp_optimize_for_usb=true
|
334 |
|
|
fi
|
335 |
|
|
|
336 |
|
|
if [ test x$enable_jsp_optimize_for_usb = xtrue ]
|
337 |
|
|
then
|
338 |
|
|
AC_MSG_RESULT(yes)
|
339 |
|
|
CFLAGS="$CFLAGS -DOPTIMIZE_JSP_FOR_USB"
|
340 |
|
|
else
|
341 |
|
|
AC_MSG_RESULT(no)
|
342 |
|
|
fi
|
343 |
|
|
|
344 |
|
|
# ----------------------------------------
|
345 |
|
|
|
346 |
|
|
AC_CONFIG_FILES([Makefile])
|
347 |
|
|
AC_OUTPUT
|