Add D2XX support for OS X courtesy of Piotr Esden-Tempski <piotr@esden.net>
[openocd.git] / configure.in
1 AC_PREREQ(2.59)
2 AC_INIT(configure.in)
3
4 AC_CANONICAL_HOST
5
6 AC_SEARCH_LIBS([ioperm], [ioperm])
7 AC_SEARCH_LIBS([dlopen], [dl])
8
9 AC_CHECK_HEADERS(jtag_minidriver.h)
10 AC_CHECK_HEADERS(sys/param.h)
11 AC_CHECK_HEADERS(sys/time.h)
12 AC_CHECK_HEADERS(elf.h)
13 AC_CHECK_HEADERS(strings.h)
14 AC_CHECK_HEADERS(stdbool.h)
15
16 AC_HEADER_TIME
17
18 AC_C_BIGENDIAN
19
20 AC_CHECK_FUNCS(strndup)
21 AC_CHECK_FUNCS(strnlen)
22 AC_CHECK_FUNCS(gettimeofday)
23 AC_CHECK_FUNCS(usleep)
24 AC_CHECK_FUNCS(vasprintf)
25
26 build_bitbang=no
27 build_bitq=no
28 is_cygwin=no
29 is_mingw=no
30 is_win32=no
31 is_darwin=no
32 build_release=yes
33
34 AC_ARG_ENABLE(release,
35 AS_HELP_STRING([--enable-release], [Enable Release Build, default no]),
36 [build_release=$enableval], [build_release=no])
37
38 if test $cross_compiling = no; then
39 if test $build_release = no; then
40 # check we can find guess-rev.sh
41 AC_CHECK_FILE("$srcdir/guess-rev.sh", build_release=no, build_release=yes)
42 fi
43 fi
44
45 # We are not *ALWAYS* being installed in the standard place.
46 # We may be installed in a "tool-build" specific location.
47 # Normally with other packages - as part of a tool distro.
48 # Thus - we should search that 'libdir' also.
49 #
50 # And - if we are being installed there - the odds are
51 # The libraries unique to what we are are there too.
52 #
53
54 # Expand nd deal with NONE - just like configure will do later
55 OCDprefix=$prefix
56 OCDxprefix=$exec_prefix
57 test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
58 # Let make expand exec_prefix.
59 test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
60
61 # what matters is the "exec-prefix"
62 if test "$OCDxprefix" != "$ac_default_prefix"
63 then
64 # We are installing in a non-standard place
65 # Nonstandard --prefix and/or --exec-prefix
66 # We have an override of some sort.
67 # use build specific install library dir
68
69 LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
70 # RPATH becomes an issue on Linux only
71 if test $host_os = linux-gnu || test $host_os = linux ; then
72 LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
73 fi
74 # The "INCDIR" is also usable
75 CFLAGS="$CFLAGS -I$includedir"
76 fi
77
78 AC_ARG_WITH(ftd2xx,
79 AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
80 [
81 # Option Given.
82 cat << __EOF__
83
84 The option: --with-ftd2xx=<PATH> has been removed.
85 On Linux, the new option is:
86
87 --with-ftd2xx-linux-tardir=/path/to/files
88
89 Where <path> is the path the the directory where the "tar.gz" file
90 from FTDICHIP.COM was unpacked, for example:
91
92 --with-ftd2xx-linux-tardir=/home/duane/libftd2xx-linux-tardir=/home/duane/libftd2xx0.4.16
93
94 On Cygwin/MingW32, the new option is:
95
96 --with-ftd2xx-win32-zipdir=/path/to/files
97
98 Where <path> is the path to the directory where the "zip" file from
99 FTDICHIP.COM was unpacked, for example:
100
101 --with-ftd2xx-win32-zipdir=/home/duane/ftd2xx.cdm.files
102
103 __EOF__
104
105 AC_MSG_ERROR([Sorry Cannot continue])
106 ],
107 [
108 # Option not given
109 true
110 ]
111 )
112
113 #========================================
114 # FTD2XXX support comes in 4 forms.
115 # (1) win32 - via a zip file
116 # (2) linux - via a tar file
117 # (3) linux/cygwin/mingw - via libftdi
118 # (4) darwin - installed under /usr/local
119 #
120 # In case (1) and (2) we need to know where the package was unpacked.
121
122 AC_ARG_WITH(ftd2xx-win32-zipdir,
123 AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
124 [
125 # option present
126 if test -d $with_ftd2xx_win32_zipdir
127 then
128 with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
129 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
130 else
131 AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
132 fi
133 ],
134 [
135 # not given
136 true
137 ]
138 )
139
140 AC_ARG_WITH(ftd2xx-linux-tardir,
141 AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
142 [
143 # Option present
144 if test $is_win32 = yes ; then
145 AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
146 fi
147 if test -d $with_ftd2xx_linux_tardir
148 then
149 with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
150 AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
151 else
152 AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
153 fi
154 ],
155 [
156 # Not given
157 true
158 ]
159 )
160
161 AC_ARG_WITH(ftd2xx-lib,
162 AS_HELP_STRING([--with-ftd2xx-lib], [Use static or shared ftd2xx libs on default static]),
163 [
164 case "$withval" in
165 static)
166 with_ftd2xx_lib=$withval
167 ;;
168 shared)
169 with_ftd2xx_lib=$withval
170 ;;
171 *)
172 AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
173 ;;
174 esac
175 ],
176 [
177 # Default is static - it is simpler :-(
178 with_ftd2xx_lib=static
179 ]
180 )
181
182 AC_ARG_ENABLE(gccwarnings,
183 AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
184 [gcc_warnings=$enableval], [gcc_warnings=yes])
185
186 AC_ARG_ENABLE(wextra,
187 AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
188 [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
189
190 AC_ARG_ENABLE(werror,
191 AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
192 [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
193
194 # set default verbose options, overridden by following options
195 debug_jtag_io=no
196 debug_usb_io=no
197 debug_usb_comms=no
198
199 AC_ARG_ENABLE(verbose,
200 AS_HELP_STRING([--enable-verbose],
201 [Enable verbose JTAG I/O messages (for debugging).]),
202 [
203 debug_jtag_io=$enableval
204 debug_usb_io=$enableval
205 debug_usb_comms=$enableval
206 ], [])
207
208 AC_ARG_ENABLE(verbose_jtag_io,
209 AS_HELP_STRING([--enable-verbose-jtag-io],
210 [Enable verbose JTAG I/O messages (for debugging).]),
211 [debug_jtag_io=$enableval], [])
212 AC_ARG_ENABLE(verbose_usb_io,
213 AS_HELP_STRING([--enable-verbose-usb-io],
214 [Enable verbose USB I/O messages (for debugging)]),
215 [debug_usb_io=$enableval], [])
216 AC_ARG_ENABLE(verbose_usb_comms,
217 AS_HELP_STRING([--enable-verbose-usb-comms],
218 [Enable verbose USB communication messages (for debugging)]),
219 [debug_usb_comms=$enableval], [])
220
221 AC_MSG_CHECKING([whether to enable verbose JTAB I/O messages]);
222 AC_MSG_RESULT($debug_jtag_io)
223 if test $debug_jtag_io = yes; then
224 AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
225 fi
226
227 AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
228 AC_MSG_RESULT($debug_usb_io)
229 if test $debug_usb_io = yes; then
230 AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
231 fi
232
233 AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
234 AC_MSG_RESULT($debug_usb_comms)
235 if test $debug_usb_comms = yes; then
236 AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
237 fi
238
239
240 AC_ARG_ENABLE(parport,
241 AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
242 [build_parport=$enableval], [build_parport=no])
243
244 AC_ARG_ENABLE(dummy,
245 AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
246 [build_dummy=$enableval], [build_dummy=no])
247
248 case "${host_cpu}" in
249 i?86|x86*)
250 AC_ARG_ENABLE(parport_ppdev,
251 AS_HELP_STRING([--enable-parport_ppdev], [Enable use of ppdev (/dev/parportN) for parport]),
252 [parport_use_ppdev=$enableval], [parport_use_ppdev=no])
253 ;;
254 *)
255 parport_use_ppdev=yes
256 ;;
257 esac
258
259 AC_ARG_ENABLE(ft2232_libftdi,
260 AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
261 [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
262
263 AC_ARG_ENABLE(ft2232_ftd2xx,
264 AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
265 [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
266
267 AC_ARG_ENABLE(amtjtagaccel,
268 AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
269 [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
270
271 AC_ARG_ENABLE(ecosboard,
272 AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
273 [build_ecosboard=$enableval], [build_ecosboard=no])
274
275 AC_ARG_ENABLE(ioutil,
276 AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
277 [build_ioutil=$enableval], [build_ioutil=no])
278
279 AC_ARG_ENABLE(httpd,
280 AS_HELP_STRING([--enable-httpd], [Enable builtin httpd server - useful for standalone OpenOCD implementations]),
281 [build_httpd=$enableval], [build_httpd=no])
282
283 case "${host_cpu}" in
284 arm*)
285 AC_ARG_ENABLE(ep93xx,
286 AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
287 [build_ep93xx=$enableval], [build_ep93xx=no])
288
289 AC_ARG_ENABLE(at91rm9200,
290 AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
291 [build_at91rm9200=$enableval], [build_at91rm9200=no])
292 ;;
293
294 *)
295 build_ep93xx=no
296 build_at91rm9200=no
297 ;;
298 esac
299
300 AC_ARG_ENABLE(gw16012,
301 AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
302 [build_gw16012=$enableval], [build_gw16012=no])
303
304 AC_ARG_ENABLE(presto_libftdi,
305 AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
306 [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
307
308 AC_ARG_ENABLE(presto_ftd2xx,
309 AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
310 [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
311
312 AC_ARG_ENABLE(usbprog,
313 AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
314 [build_usbprog=$enableval], [build_usbprog=no])
315
316 AC_ARG_ENABLE(oocd_trace,
317 AS_HELP_STRING([--enable-oocd_trace], [Enable building support for the OpenOCD+trace ETM capture device]),
318 [build_oocd_trace=$enableval], [build_oocd_trace=no])
319
320 AC_ARG_ENABLE(jlink,
321 AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
322 [build_jlink=$enableval], [build_jlink=no])
323
324 AC_ARG_ENABLE(vsllink,
325 AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
326 [build_vsllink=$enableval], [build_vsllink=no])
327
328 AC_ARG_ENABLE(rlink,
329 AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
330 [build_rlink=$enableval], [build_rlink=no])
331
332 AC_ARG_ENABLE(arm-jtag-ew,
333 AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
334 [build_armjtagew=$enableval], [build_armjtagew=no])
335
336 case $host in
337 *-cygwin*)
338 is_win32=yes
339
340 AC_ARG_ENABLE(parport_giveio,
341 AS_HELP_STRING([--enable-parport_giveio], [Enable use of giveio for parport instead of ioperm]),
342 [parport_use_giveio=$enableval], [parport_use_giveio=no])
343
344 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),[is_mingw=yes],[is_mingw=no])
345 if test $is_mingw = yes; then
346 AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
347 parport_use_giveio=yes
348 is_cygwin=no
349 else
350 is_cygwin=yes
351 AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
352 fi
353
354 AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
355 AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
356 ;;
357 *-mingw*)
358 is_mingw=yes
359 is_win32=yes
360
361 parport_use_giveio=yes
362
363 AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
364 AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
365 AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
366 ;;
367 *darwin*)
368 is_darwin=yes
369
370 parport_use_giveio=no
371
372 AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
373 AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
374 AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
375 ;;
376 *)
377 parport_use_giveio=no
378 AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
379 AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
380 AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
381 ;;
382 esac
383
384 if test $build_parport = yes; then
385 build_bitbang=yes
386 AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
387 else
388 AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
389 fi
390
391 if test $build_dummy = yes; then
392 build_bitbang=yes
393 AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
394 else
395 AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
396 fi
397
398 if test $build_ep93xx = yes; then
399 build_bitbang=yes
400 AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
401 else
402 AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
403 fi
404
405 if test $build_ecosboard = yes; then
406 build_bitbang=yes
407 AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
408 else
409 AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
410 fi
411
412 if test $build_ioutil = yes; then
413 AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
414 else
415 AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
416 fi
417
418 if test $build_httpd = yes; then
419 AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
420 else
421 AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.])
422 fi
423
424 if test $build_at91rm9200 = yes; then
425 build_bitbang=yes
426 AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
427 else
428 AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
429 fi
430
431 if test $parport_use_ppdev = yes; then
432 AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
433 else
434 AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
435 fi
436
437 if test $parport_use_giveio = yes; then
438 AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
439 else
440 AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
441 fi
442
443 if test $build_bitbang = yes; then
444 AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
445 else
446 AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
447 fi
448
449 if test $build_ft2232_libftdi = yes; then
450 AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
451 else
452 AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
453 fi
454
455 if test $build_ft2232_ftd2xx = yes; then
456 AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
457 else
458 AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
459 fi
460
461 if test $build_amtjtagaccel = yes; then
462 AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
463 else
464 AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
465 fi
466
467 if test $build_gw16012 = yes; then
468 AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
469 else
470 AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
471 fi
472
473 if test $build_presto_libftdi = yes; then
474 build_bitq=yes
475 AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
476 else
477 AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
478 fi
479
480 if test $build_presto_ftd2xx = yes; then
481 build_bitq=yes
482 AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
483 else
484 AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
485 fi
486
487 if test $build_bitq = yes; then
488 AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
489 else
490 AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
491 fi
492
493 if test $build_usbprog = yes; then
494 AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
495 else
496 AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
497 fi
498
499 if test $build_oocd_trace = yes; then
500 AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
501 else
502 AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
503 fi
504
505 if test $build_jlink = yes; then
506 AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
507 else
508 AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
509 fi
510
511 if test $build_vsllink = yes; then
512 AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
513 else
514 AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
515 fi
516
517 if test $build_rlink = yes; then
518 AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
519 else
520 AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
521 fi
522
523 if test $build_armjtagew = yes; then
524 AC_DEFINE(BUILD_ARMJTAGEW, 1, [1 if you want the ARM-JTAG-EW JTAG driver.])
525 else
526 AC_DEFINE(BUILD_ARMJTAGEW, 0, [0 if you don't want the ARM-JTAG-EW JTAG driver.])
527 fi
528
529 #-- Deal with MingW/Cygwin FTD2XX issues
530
531 if test $is_win32 = yes; then
532 if test "${with_ftd2xx_linux_tardir+set}" = set
533 then
534 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
535 fi
536
537 if test $build_ft2232_ftd2xx = yes ; then
538 AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
539
540 # if we are given a zipdir...
541 if test "${with_ftd2xx_win32_zipdir+set}" = set
542 then
543 # Set the CFLAGS for "ftd2xx.h"
544 f=$with_ftd2xx_win32_zipdir/ftd2xx.h
545 if test ! -f $f ; then
546 AC_MSG_ERROR([File: $f cannot be found])
547 fi
548 CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
549
550 # And calculate the LDFLAGS for the machine
551 case "$host_cpu" in
552 i?86|x86_*)
553 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
554 LIBS="$LIBS -lftd2xx"
555 f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
556 ;;
557 amd64)
558 LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
559 LIBS="$LIBS -lftd2xx"
560 f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
561 ;;
562 *)
563 AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
564 ;;
565 esac
566 if test ! -f $f ; then
567 AC_MSG_ERROR([Library: $f not found])
568 fi
569 else
570 LIBS="$LIBS -lftd2xx"
571 AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
572 fi
573 fi
574 fi
575
576 if test $is_darwin = yes ; then
577 if test "${with_ftd2xx_win32_zipdir+set}" = set
578 then
579 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
580 fi
581 if test "${with_ftd2xx_linux_tardir+set}" = set
582 then
583 AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
584 fi
585
586 if test $build_ft2232_ftd2xx = yes ; then
587 AC_MSG_CHECKING([for libftd2xx.a (darwin)])
588
589 if test ! -f /usr/local/include/ftd2xx.h ; then
590 AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
591 fi
592
593 CFLAGS="$CFLAGS -I/usr/local/include"
594 LDFLAGS="$LDFLAGS -L/usr/local/lib"
595 LIBS="$LIBS -lftd2xx"
596 AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
597 fi
598 fi
599
600 if test $is_win32 = no && test $is_darwin = no ; then
601
602 if test "${with_ftd2xx_win32_zipdir+set}" = set
603 then
604 AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
605 fi
606
607 if test $build_ft2232_ftd2xx = yes ; then
608 # Must be linux
609 if test $host_os != linux-gnu && test $host_os != linux ; then
610 AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
611 fi
612 # Are we given a TAR directory?
613 if test "${with_ftd2xx_linux_tardir+set}" = set
614 then
615 AC_MSG_CHECKING([uninstalled ftd2xx distribution])
616 # The .H file is simple..
617 FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
618 if test ! -f "${FTD2XX_H}"; then
619 AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
620 fi
621 CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
622 FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
623 FTD2XX_LIB="-lftd2xx"
624 if test $with_ftd2xx_lib != shared; then
625 # Test #1 - Future proof - if/when ftdichip fixes their distro.
626 # Try it with the simple ".a" suffix.
627 FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a"
628 if test -f "${FTD2XX_LIB}"; then
629 FTD2XX_LDFLAGS="${FTD2XX_LDFLAGS}/static_lib"
630 else
631 # Test Number2.
632 # Grr.. perhaps it exists as a version number?
633 FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
634 count=`ls ${FTD2XX_LIB} | wc -l`
635 if test $count -gt 1 ; then
636 AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
637 fi
638 if test $count -ne 1 ; then
639 AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
640 fi
641 # Because the "-l" rules do not understand version numbers...
642 # we will just stuff the absolute path onto the LIBS variable
643 FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
644 FTD2XX_LDFLAGS=""
645 fi
646 fi
647 LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
648 LIBS="${LIBS} ${FTD2XX_LIB}"
649 AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
650 else
651 AC_CHECK_HEADER([ftd2xx.h],[],[
652 AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
653 ])
654 AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
655 AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
656 ],[])
657 fi
658 fi
659 fi
660
661 if test $build_ft2232_ftd2xx = yes; then
662
663 # Before we go any further - make sure we can *BUILD* and *RUN*
664 # a simple app with the "ftd2xx.lib" file - in what ever form we where given
665 # We should be able to compile, link and run this test program now
666 AC_MSG_CHECKING([whether ftd2xx library works])
667
668 #
669 # Save the LDFLAGS for later..
670 LDFLAGS_SAVE=$LDFLAGS
671 CFLAGS_SAVE=$CFLAGS
672 _LDFLAGS=`eval echo $LDFLAGS`
673 _CFLAGS=`eval echo $CFLAGS`
674 LDFLAGS=$_LDFLAGS
675 CFLAGS=$_CFLAGS
676 AC_RUN_IFELSE(
677 [
678 #include "confdefs.h"
679 #if IS_WIN32
680 #include "windows.h"
681 #endif
682 #include <stdio.h>
683 #include <ftd2xx.h>
684
685 int
686 main( int argc, char **argv )
687 {
688 DWORD x;
689 FT_GetLibraryVersion( &x );
690 return 0;
691 }
692 ], [ AC_MSG_RESULT([Success!])] , [ AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib]) ] )
693 LDFLAGS=$LDFLAGS_SAVE
694 CFLAGS=$CFLAGS_SAVE
695 fi
696
697 if test $build_ft2232_libftdi = yes ; then
698 # We assume: the package is preinstalled in the proper place
699 # these present as 2 libraries..
700 LIBS="$LIBS -lftdi -lusb"
701 #
702 # Try to build a small program.
703 AC_MSG_CHECKING([Build & Link with libftdi...])
704
705 LDFLAGS_SAVE=$LDFLAGS
706 CFLAGS_SAVE=$CFLAGS
707 _LDFLAGS=`eval echo $LDFLAGS`
708 _CFLAGS=`eval echo $CFLAGS`
709 LDFLAGS=$_LDFLAGS
710 CFLAGS=$_CFLAGS
711
712 AC_RUN_IFELSE(
713 [
714 #include <stdio.h>
715 #include <ftdi.h>
716
717 int
718 main( int argc, char **argv )
719 {
720 struct ftdi_context *p;
721 p = ftdi_new();
722 if( p != NULL ){
723 return 0;
724 } else {
725 fprintf( stderr, "calling ftdi_new() failed\n");
726 return 1;
727 }
728 }
729 ]
730 ,
731 [ AC_MSG_RESULT([Success]) ]
732 ,
733 [ AC_MSG_ERROR([Cannot build & run test program using libftdi]) ] )
734 # Restore the 'unexpanded ldflags'
735 LDFLAGS=$LDFLAGS_SAVE
736 CFLAGS=$CFLAGS_SAVE
737 fi
738
739 AM_CONFIG_HEADER(config.h)
740 AM_INIT_AUTOMAKE(openocd, 1.0)
741 AM_MAINTAINER_MODE
742
743 AM_CONDITIONAL(RELEASE, test $build_release = yes)
744 AM_CONDITIONAL(PARPORT, test $build_parport = yes)
745 AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
746 AM_CONDITIONAL(GIVEIO, test $parport_use_giveio = yes)
747 AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
748 AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
749 AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
750 AM_CONDITIONAL(HTTPD, test $build_httpd = yes)
751 AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
752 AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
753 AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
754 AM_CONDITIONAL(FT2232_FTD2XX, test $build_ft2232_ftd2xx = yes)
755 AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
756 AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
757 AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
758 AM_CONDITIONAL(PRESTO_FTD2XX, test $build_presto_ftd2xx = yes)
759 AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
760 AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
761 AM_CONDITIONAL(JLINK, test $build_jlink = yes)
762 AM_CONDITIONAL(VSLLINK, test $build_vsllink = yes)
763 AM_CONDITIONAL(RLINK, test $build_rlink = yes)
764 AM_CONDITIONAL(ARMJTAGEW, test $build_armjtagew = yes)
765 AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
766 AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
767 AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
768 AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes)
769 AM_CONDITIONAL(BITQ, test $build_bitq = yes)
770
771 AC_LANG_C
772 AC_PROG_CC
773 AC_PROG_RANLIB
774
775 # set default gcc warnings
776 GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security"
777 if test "${gcc_wextra}" = yes; then
778 GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
779 fi
780 if test "${gcc_werror}" = yes; then
781 GCC_WARNINGS="${GCC_WARNINGS} -Werror"
782 fi
783
784 # overide default gcc cflags
785 if test $gcc_warnings = yes; then
786 CFLAGS="$CFLAGS $GCC_WARNINGS"
787 fi
788
789 # Setup for compiling build tools
790 AC_MSG_CHECKING([for a C compiler for build tools])
791 if test $cross_compiling = yes; then
792 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
793 CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
794 else
795 CC_FOR_BUILD=$CC
796 CFLAGS_FOR_BUILD=$CFLAGS
797 fi
798
799 AC_MSG_RESULT([$CC_FOR_BUILD])
800 AC_SUBST(CC_FOR_BUILD)
801 AC_SUBST(CFLAGS_FOR_BUILD)
802
803 AC_MSG_CHECKING([for suffix of executable build tools])
804 if test $cross_compiling = yes; then
805 cat >conftest.c <<\_______EOF
806 int main ()
807 {
808 exit (0);
809 }
810 _______EOF
811 for i in .exe ""; do
812 compile="$CC_FOR_BUILD conftest.c -o conftest$i"
813 if AC_TRY_EVAL(compile); then
814 if (./conftest) 2>&AC_FD_CC; then
815 EXEEXT_FOR_BUILD=$i
816 break
817 fi
818 fi
819 done
820 rm -f conftest*
821 if test "${EXEEXT_FOR_BUILD+set}" != set; then
822 AC_MSG_ERROR([Cannot determine suffix of executable build tools])
823 fi
824 else
825 EXEEXT_FOR_BUILD=$EXEEXT
826 fi
827 AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
828 AC_SUBST(EXEEXT_FOR_BUILD)
829
830 AC_OUTPUT(Makefile src/Makefile src/helper/Makefile src/jtag/Makefile src/xsvf/Makefile src/svf/Makefile src/target/Makefile src/server/Makefile src/flash/Makefile src/pld/Makefile doc/Makefile)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)