-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
813 lines (724 loc) · 21.4 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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
#
# $Id$
#
# Copyright (C) 2007, 2008 Kolja Waschk and other
# UrJTAG.org developers, (C) 2002, 2003 ETC s.r.o.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Written by Marcel Telka <marcel@telka.sk>, 2002, 2003,
# and other UrJTAG authors, 2007, 2008, ...
#
AC_INIT(UrJTAG,0.10,http://urjtag.org,urjtag)
dnl autoconf-2.61 was released in 2006
AC_PREREQ(2.61)
AC_COPYRIGHT([Copyright (C) 2007/08 Kolja Waschk and other UrJTAG authors; 2002/03 ETC s.r.o.])
AC_REVISION($Revision$)
# Get SVN Revision - idea from xfce-power-manager (C) 2007 by B.Tarricone
dnl get svn revision
AC_MSG_CHECKING([code revision])
SVN=`which svn`
SVN_REVISION=0
if test -n "$SVN" -a -x "$SVN"; then
SVN_REVISION=`LC_ALL=C svn info -R "$srcdir" 2>/dev/null | awk 'BEGIN { x=0 } /^Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }'`
SVN_FROM="svn info"
fi
if test "$SVN_REVISION" -eq 0 -a -e "$srcdir/ChangeLog"; then
SVN_REVISION=`awk 'BEGIN { x=0 } /Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }' "$srcdir/ChangeLog"`
SVN_FROM="ChangeLog"
fi
if test "$SVN_REVISION" -eq 0; then
SVN_REVISION=`git log -n1 --pretty=format:%b 2>/dev/null | sed -n '/^git-svn-id:/{s:.*@::;s: .*::;p}'`
SVN_FROM="git-svn log"
fi
if test "$SVN_REVISION" -eq "0" ; then
AC_MSG_RESULT([unknown, using 0])
else
AC_MSG_RESULT([from $SVN_FROM: $SVN_REVISION])
fi
AC_DEFINE_UNQUOTED([SVN_REVISION], "$SVN_REVISION", [subversion revision number])
AC_SUBST([SVN_REVISION])
AC_CONFIG_AUX_DIR(tools)
dnl automake-1.10 was released in 2006
AM_INIT_AUTOMAKE([1.10 check-news dist-bzip2])
dnl silent rules requires automake-1.11+
m4_ifdef([AM_SILENT_RULES],
[AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
AC_CONFIG_FILES(
Makefile
bindings/Makefile
bindings/python/Makefile
bindings/python/setup.py
doc/Makefile
data/Makefile
extra/fjmem/Makefile
include/Makefile
include/urjtag/Makefile
src/Makefile
src/urjtag.pc
src/lib/Makefile
src/tap/Makefile
src/part/Makefile
src/bus/Makefile
src/flash/Makefile
src/cmd/Makefile
src/svf/Makefile
src/bsdl/Makefile
src/stapl/Makefile
src/jim/Makefile
src/pld/Makefile
src/global/Makefile
src/apps/jtag/Makefile
src/apps/bsdl2jtag/Makefile
src/bfin/Makefile
src/sdu/Makefile
po/Makefile.in
)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(include/urjtag/urjtag.h)
AC_GNU_SOURCE
dnl gettext-0.16.1 was released in 2006
AM_GNU_GETTEXT(external)
AM_GNU_GETTEXT_VERSION(0.16.1)
LT_INIT
AC_PROG_CC
AC_PROG_YACC
AC_PROG_CC_C99
PKG_PROG_PKG_CONFIG
AC_SEARCH_LIBS([ioperm], [ioperm])
if test "$ac_cv_search_ioperm" != "no"; then
AC_DEFINE(HAVE_IOPERM, 1, [Define to 1 if you have the ioperm() function])
HAVE_IOPERM="yes"
else
AC_SEARCH_LIBS([i386_set_ioperm], [i386])
if test "$ac_cv_search_i386_set_ioperm" != "no"; then
AC_DEFINE(HAVE_I386_SET_IOPERM, 1,
[Define to 1 if you have the i386_set_ioperm() function])
HAVE_I386_SET_IOPERM="yes"
fi
fi
AC_CHECK_FUNCS(m4_flatten([
_sleep
getdelim
geteuid
getline
getuid
nanosleep
pread
swprintf
usleep
]))
AC_CHECK_FUNC(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime) ])
dnl check for sigaction with SA_ONESHOT or SA_RESETHAND
AC_TRY_COMPILE([#include <signal.h>], [
#ifndef SA_ONESHOT
# define SA_ONESHOT SA_RESETHAND
#endif
int sa_flags = SA_ONESHOT;
],
[AC_DEFINE([HAVE_SIGACTION_SA_ONESHOT], [1], [Have a defined SA_ONESHOT])],
[])
AC_CHECK_HEADERS([linux/ppdev.h], [HAVE_LINUX_PPDEV_H="yes"])
AC_CHECK_HEADERS([dev/ppbus/ppi.h], [HAVE_DEV_PPBUS_PPI_H="yes"])
AC_CHECK_HEADERS(m4_flatten([
wchar.h
windows.h
sys/wait.h
]))
AC_CHECK_TYPE([wchar_t], [],
[AC_DEFINE([wchar_t], [char], [Make sure we have wchar_t])],
[#include <stddef.h>])
AC_CHECK_TYPE([struct timespec],
[AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Define to 1 if you have the struct timespec type])],
[], [[#include <time.h>]])
dnl See if the windows target is polluting the namespace on us which
dnl will break some of the lex/yacc (e.g. bsdl) builds. We need both
dnl defines as some versions of mingw have changed names over time.
AS_IF([test "x$ac_cv_header_windows_h" = "xyes"],[
AC_MSG_CHECKING([for IN/OUT defines in windows.h])
AC_TRY_COMPILE([#include <windows.h>], [
#if defined(IN) || defined(OUT)
# error "IN/OUT defined"
#endif
],
[AC_MSG_RESULT([no])],[
AS_VAR_APPEND([CPPFLAGS], " -DNO_W32_PSEUDO_MODIFIERS -D_NO_W32_PSEUDO_MODIFIERS")
AC_MSG_RESULT([yes])
])
])
ORIG_LDFLAGS="$LDFLAGS"
case $host_os in
*mingw32*)
AM_CONDITIONAL(MINGW32, true)
# UrJTAG provides a dummy termcap for Windows
LDFLAGS="$LDFLAGS -Wl,-defsym,_tgetent=0 -Wl,-defsym,_tgetnum=0 -Wl,-defsym,_tgetflag=0 -Wl,-defsym,_tgetstr=0 -Wl,-defsym,_tputs=0 -Wl,-defsym,_tgoto=0"
;;
*)
AM_CONDITIONAL(MINGW32, false)
;;
esac
VL_LIB_READLINE
LDFLAGS="$ORIG_LDFLAGS"
dnl check for libusb
AC_ARG_WITH([libusb],
[AS_HELP_STRING([--with-libusb], [lib for USB JTAG cables @<:@default=detect 1.0 0.1@:>@])],,
[with_libusb=detect])
HAVELIBUSB=no
LIBUSB_LIBS=
AS_IF([test "x$with_libusb" != xno], [
AS_IF([test "x$with_libusb" != x0.1 -a \
"x$with_libusb" != x1.0 -a \
"x$with_libusb" != xdetect -a \
"x$with_libusb" != xyes], [
HAVELIBUSB=manual
LIBUSB_LIBS="-L$with_libusb -L$with_libusb/lib -lusb"
LIBUSB_CFLAGS="-I$with_libusb -I$with_libusb/include"
], [
AS_IF([test "x$with_libusb" != x0.1 -a "x$HAVELIBUSB" = xno], [
PKG_CHECK_MODULES(LIBUSB, libusb-1.0, [
HAVELIBUSB=1.0
AC_DEFINE(HAVE_LIBUSB1, 1, [Define if you have libusb-1.0])
], [:])
])
AS_IF([test "x$with_libusb" != x1.0 -a "x$HAVELIBUSB" = xno], [
PKG_CHECK_MODULES(LIBUSB, libusb, [HAVELIBUSB=0.1], [:])
])
AS_IF([test "x$HAVELIBUSB" = xno], [
AS_IF([test "x$with_libusb" != xdetect], [
AC_MSG_ERROR([*** libusb not detected])
], [
AC_MSG_WARN([*** libusb not detected. No support for USB JTAG cables via libusb.])
])
],[
AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb])
])
])
AS_VAR_APPEND([CPPFLAGS], " $LIBUSB_CFLAGS")
])
AC_SUBST(LIBUSB_LIBS)
AM_CONDITIONAL(HAVE_LIBUSB, [test "x$HAVELIBUSB" != "xno"])
dnl Use FTDI library?
AC_ARG_WITH([libftdi],
[AS_HELP_STRING([--with-libftdi],
[use libftdi for FTDI-based cables])],
[], [with_libftdi=check])
HAVELIBFTDI=no
LIBFTDI_LIBS=
AS_IF([test "x$with_libftdi" != xno], [
save_LIBS=$LIBS
save_CPPFLAGS=$CPPFLAGS
PKG_CHECK_MODULES(LIBFTDI, libftdi, [:;], [dnl
AS_IF([test "x$with_libftdi" != xyes -a "x$with_libftdi" != xcheck], [
LIBFTDI_LIBS="-L$with_libftdi -lftdi"
LIBFTDI_CFLAGS="-I$with_libftdi"
],[
AC_PATH_TOOL(LIBFTDI_CONFIG, libftdi-config, no)
AS_IF([test "$LIBFTDI_CONFIG" != "no"],[
LIBFTDI_LIBS=`$LIBFTDI_CONFIG --libs`
LIBFTDI_CFLAGS=`$LIBFTDI_CONFIG --cflags`
])
])
])
AS_VAR_APPEND([LIBS], " $LIBFTDI_LIBS")
AS_VAR_APPEND([CPPFLAGS], " $LIBFTDI_CFLAGS")
AC_CHECK_FUNC([ftdi_usb_open], [
AC_DEFINE(HAVE_LIBFTDI, 1, [Define if you have libftdi])
HAVELIBFTDI=yes
],[
AC_MSG_WARN([*** libftdi not detected. No support for FTDI-based USB JTAG cables via libftdi.])
CPPFLAGS=$save_CPPFLAGS
])
AC_CHECK_FUNC([ftdi_read_data_submit], [
AS_IF([test "x$HAVELIBUSB" = "x0.1"], [
AC_MSG_ERROR([this libftdi cannot be used with libusb-0.1, libusb-1.0 is needed])
])
AC_DEFINE(HAVE_LIBFTDI_ASYNC_MODE, 1, [Define if libftdi support async mode])
HAVELIBFTDI_ASYNCMODE=yes
])
LIBS=$save_LIBS
])
AC_SUBST(LIBFTDI_LIBS)
AM_CONDITIONAL(HAVE_LIBFTDI, [test "x$HAVELIBFTDI" = "xyes"])
AM_CONDITIONAL(HAVE_LIBFTDI_ASYNC_MODE, [test "x$HAVELIBFTDI_ASYNCMODE" = "xyes"])
dnl Use FTDI ftd2xx library?
AC_ARG_WITH([ftd2xx],
[AS_HELP_STRING([--with-ftd2xx],
[use ftd2xx library for FTDI-based cables])],
[], [with_ftd2xx=check])
FTD2XXLIB=
AS_IF([test "x$with_ftd2xx" = xyes -o "x$with_ftd2xx" = xcheck], [
AC_CHECK_LIB([ftd2xx], [FT_OpenEx], [
HAVELIBFTD2XX=yes
LIBS="-lftd2xx $LIBS"
],[
AC_MSG_WARN([*** libftd2xx not found. No support for FTDI-based USB JTAG cables via libftd2xx.])
])
],[
AS_IF([test "x$with_ftd2xx" != xno], [
HAVELIBFTD2XX=yes
case $host in
*cygwin*|*mingw*)
CFLAGS="$CFLAGS -I$with_ftd2xx"
AS_IF([test -d "$with_ftd2xx/i386"], [
FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"
],[
FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"
])
;;
*)
CFLAGS="$CFLAGS -I$with_ftd2xx -L$with_ftd2xx"
LIBS="-lftd2xx $LIBS"
;;
esac
],)
])
AS_IF([test "x$HAVELIBFTD2XX" = xyes], [
AM_CONDITIONAL(HAVE_LIBFTD2XX, true)
AC_DEFINE(HAVE_LIBFTD2XX, 1, [define if you have libftd2xx])
],[
AM_CONDITIONAL(HAVE_LIBFTD2XX, false)
])
AC_SUBST(FTD2XXLIB)
dnl Use InpOut I/O library?
dnl http://www.highrez.co.uk/Downloads/InpOut32/default.htm
AC_ARG_WITH([inpout32],
[AS_HELP_STRING([--with-inpout32],
[use InpOut32.dll for parallel port access on Windows])],
[], [with_inpout32=auto])
case $host in
*cygwin*|*mingw*) ;;
*) with_inpout32=no ;;
esac
HAVE_INPOUTXX=no
AS_IF([test "x$with_inpout32" != xno], [
AC_CHECK_HEADER([inpout32.h], [
HAVE_INPOUTXX=yes
AC_DEFINE(HAVE_INPOUTXX, 1, [define if you have inpout32.dll])
],[:],[
#include <windows.h>
#include <stdbool.h>
])
AS_IF([test "x$with_inpout32$HAVE_INPOUTXX" = "xyesno"], [
AC_MSG_ERROR([inpout32 support requested, but not found])
])
])
AM_CONDITIONAL(HAVE_INPOUTXX, [test "x$HAVE_INPOUTXX" = xyes])
WARNINGCFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith"
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror], [build with -Werror])],
[], [enable_werror=maybe])
AS_IF([test "x$enable_werror" = xmaybe -a -d .svn], [
enable_werror=yes
])
AS_IF([test "x$enable_werror" = xyes], [
WARNINGCFLAGS="$WARNINGCFLAGS -Werror"
])
AC_SUBST(WARNINGCFLAGS)
AS_VAR_PREPEND([CPPFLAGS], '-I$(top_srcdir) -I$(top_srcdir)/include ')
AC_ARG_ENABLE([apps],
[AS_HELP_STRING([--disable-apps],
[disable building the jtag and bsdl2jtag main programs])],,
[enable_apps=yes])
AS_IF([test "x$enable_apps" = xyes], [
AM_CONDITIONAL(ENABLE_APPS, true)
AC_DEFINE(ENABLE_APPS, 1, [define if you want to build the jtag and bsdl2jtag main programs])
],[
AM_CONDITIONAL(ENABLE_APPS, false)
])
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python], [build python language bindings [default=detect]])],
[], [enable_python="detect"])
AS_IF([test "x$enable_python" != "xno"], [
AM_PATH_PYTHON([2.5], [enable_python=yes], [enable_python=no])
])
AM_CONDITIONAL([BIND_PYTHON], [test "x$enable_python" = "xyes"])
# check for lex/flex
AC_PROG_LEX
# check for modern version of flex
AC_PROG_AWK
AC_PROG_SED
AS_IF([test "$LEX" = flex], [
ver_ge_ver () {
v1=$1
v2=$2
v3=$3
ref_v1=$4
ref_v2=$5
ref_v3=$6
AS_IF([test -n "$v1" -a "$v1" -gt "$ref_v1"], [
return 0
])
AS_IF([test -n "$v1" -a "$v1" -eq "$ref_v1"], [
AS_IF([test "$v2" -gt "$ref_v2"], [
return 0
])
AS_IF([test "$v2" -eq "$ref_v2"], [
AS_IF([test "$v3" -ge "$ref_v3"], [
return 0
])
])
])
return 1
}
flex_version=`$LEX --version | $AWK '{print $2}'`
AS_IF([test "$flex_version" = "version"], [
flex_version=`$LEX --version | $AWK '{print $3}'`
])
flex_v1=`echo $flex_version | $AWK -F . '{print $1}' | $SED -e 's/[a-zA-Z]//g'`
flex_v2=`echo $flex_version | $AWK -F . '{print $2}' | $SED -e 's/[a-zA-Z]//g'`
flex_v3=`echo $flex_version | $AWK -F . '{print $3}' | $SED -e 's/[a-zA-Z]//g'`
# svf and bsdl lexer require flex >= 2.5.33
flex_ref_v1=2
flex_ref_v2=5
flex_ref_v3=33
flex_ref_version="$flex_ref_v1.$flex_ref_v2.$flex_ref_v3"
AC_MSG_CHECKING([for flex >= $flex_ref_version, required for SVF and BSDL lexer])
#
AS_IF([ver_ge_ver $flex_v1 $flex_v2 $flex_v3 $flex_ref_v1 $flex_ref_v2 $flex_ref_v3], [
AC_MSG_RESULT([yes - flex $flex_version])
svf_lexer=true
bsdl_lexer=true
], [
AC_MSG_RESULT([no - flex $flex_version])
svf_lexer=false
bsdl_lexer=false
])
], [
svf_lexer=false
bsdl_lexer=false
])
dnl If the transformed svf_flex.c is already existing, it doesn't matter
dnl that flex is too old for building the lexer.
AS_IF([test "x$svf_lexer" = xfalse], [
AS_IF([test -r src/svf/svf_bison.h], [
svf_lexer=true
])
])
dnl Enable SVF player?
AC_ARG_ENABLE(svf,
[AS_HELP_STRING([--disable-svf], [Disable SVF player])],
[case "${enableval}" in
yes) svf=true ;;
no) svf=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-svf) ;;
esac],
[svf=$svf_lexer])
AS_IF([test "x$svf" = xtrue], [
AM_CONDITIONAL(ENABLE_SVF, true)
AC_DEFINE(ENABLE_SVF, 1, [define if SVF player is enabled])
],[
AM_CONDITIONAL(ENABLE_SVF, false)
# SVF is disabled, but the generated files are still required for
# POTFILES. They simply have to exist as empty files.
AS_IF([test ! -r src/svf/svf_flex.c], [
touch src/svf/svf_flex.c
])
AS_IF([test ! -r src/svf/svf_bison.c], [
touch src/svf/svf_bison.c
])
])
dnl If the transformed bsdl_flex.c is already existing, it doesn't matter
dnl that flex is too old for building the lexer.
AS_IF([test "x$bsdl_lexer" = xfalse], [
AS_IF([test -r src/bsdl/bsdl_bison.h], [
bsdl_lexer=true
])
])
dnl Enable STAPL player?
AC_ARG_ENABLE(stapl,
[AS_HELP_STRING([--disable-stapl], [Disable STAPL player])],
[case "${enableval}" in
yes) stapl=true ;;
no) stapl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-stapl) ;;
esac])
AS_IF([test "x$stapl" = xtrue], [
AM_CONDITIONAL(ENABLE_STAPL, true)
AC_DEFINE(ENABLE_STAPL, 1, [define if STAPL player is enabled])
],[
AM_CONDITIONAL(ENABLE_STAPL, false)
])
dnl Enable BSDL subsystem?
AC_ARG_ENABLE(bsdl,
[AS_HELP_STRING([--disable-bsdl], [Disable BSDL subsystem])],
[case "${enableval}" in
yes) bsdl=true ;;
no) bsdl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-bsdl) ;;
esac],
[bsdl=$bsdl_lexer])
AS_IF([test "x$bsdl" = xtrue], [
AM_CONDITIONAL(ENABLE_BSDL, true)
AC_DEFINE(ENABLE_BSDL, 1, [define if BSDL subsystem is enabled])
],[
AM_CONDITIONAL(ENABLE_BSDL, false)
# BSDL is disabled, but the generated files are still required for
# POTFILES. They simply have to exist as empty files.
AS_IF([test ! -r src/bsdl/vhdl_flex.c], [
touch src/bsdl/vhdl_flex.c
])
AS_IF([test ! -r src/bsdl/vhdl_bison.c], [
touch src/bsdl/vhdl_bison.c
])
AS_IF([test ! -r src/bsdl/bsdl_flex.c], [
touch src/bsdl/bsdl_flex.c
])
AS_IF([test ! -r src/bsdl/bsdl_bison.c], [
touch src/bsdl/bsdl_bison.c
])
])
dnl Enable experimental brute-force JEDEC flash autodetection?
AC_ARG_ENABLE(jedec-exp,
[AS_HELP_STRING([--enable-jedec-exp], [Enable experimental JEDEC flash detection])],
[case "${enableval}" in
yes) jedecexp=true ;;
no) jedecexp=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-jedec-exp) ;;
esac],
[jedecexp=false])
AS_IF([test "x$jedecexp" = xtrue], [
AM_CONDITIONAL(JEDEC_EXP, true)
AC_DEFINE(JEDEC_EXP, 1, [define if experimental JEDEC flash detection is enabled])
],[
AM_CONDITIONAL(JEDEC_EXP, false)
])
dnl
dnl URJ_DRIVER_SET([driver set name],
dnl [drivers to enable by default],
dnl [drivers to disable by default],
dnl [extra code to run before processing user list])
dnl
dnl Only the first two arguments are required. The extra code is useful to
dnl automatically strip out drivers if required external libraries were not
dnl found.
dnl
AC_DEFUN([URJ_DRIVER_SET], [
AC_DEFUN([DEF_ENABLE_DRIVERS], m4_flatten([$2]))
AC_DEFUN([DEF_DISABLE_DRIVERS], m4_flatten([$3]))
AC_DEFUN([ALL_DRIVERS], DEF_ENABLE_DRIVERS DEF_DISABLE_DRIVERS)
AC_ARG_ENABLE($1,
[AS_HELP_STRING([--enable-]$1, [Enable default set or specific ]$1[ drivers:])]
[AS_HELP_STRING([], ['default' enables:])]
[AS_HELP_STRING([],DEF_ENABLE_DRIVERS)]
m4_ifnblank([$3], [
[AS_HELP_STRING([], [Disabled by default are:])]
[AS_HELP_STRING([],DEF_DISABLE_DRIVERS)]
])dnl
,
[AS_CASE([${enableval}],
[yes], [drivers=default],
[no], [drivers=none],
[none], [drivers=none],
[drivers=`echo ${enableval} | $SED -e 's/,/ /g'`])]
,
[drivers=default])
# expand 'default' to default enabled $1 drivers
drivers=`echo ${drivers} | $SED -e "s/default/DEF_ENABLE_DRIVERS/"`
m4_ifnblank([$4], $4)
enabled_drivers=''
m4_foreach_w([x], ALL_DRIVERS, [
AC_DEFUN([DRIVER_DEFINE], m4_toupper([ENABLE_]$1[_]x))
AS_IF([echo "$drivers" | $GREP -q "]x["], [
AC_DEFINE(DRIVER_DEFINE, 1, [define if ]x[ is enabled])
AM_CONDITIONAL(DRIVER_DEFINE, true)
AS_VAR_APPEND([enabled_drivers], "x ")
], [
AM_CONDITIONAL(DRIVER_DEFINE, false)
])
])
[enabled_]$1[_drivers]=$enabled_drivers
$1[drivers]=$drivers
])
# Enable bus drivers
URJ_DRIVER_SET([bus], [
arm9tdmi
au1500
avr32
bcm1250
blackfin
bscoach
ejtag
ejtag_dma
fjmem
ixp425
ixp435
ixp465
jopcyc
h7202
lh7a400
mpc5200
mpc824x
mpc8313
mpc837x
ppc405ep
ppc440gx_ebc8
prototype
pxa2x0
pxa27x
s3c4510
sa1110
sh7727
sh7750r
sh7751r
sharc_21065L
sharc_21369_ezkit
slsup3
tx4925
zefant_xs3
])
# Enable cable drivers
URJ_DRIVER_SET([cable], [
arcom
byteblaster
dlc5
ea253
ei012
ft2232
gpio
ice100
igloo
jlink
keithkoep
lattice
mpcbdm
triton
usbblaster
vsllink
wiggler
xpc
],[
ep9307
jim
ts7800
],[
# automatically disable cable drivers when a required feature is not available
AS_IF([test "x$HAVELIBFTDI" != "xyes" -a "x$HAVELIBFTD2XX" != "xyes"], [
drivers=`echo ${drivers} | $SED -e "s/ft2232//" -e "s/usbblaster//"`
])
AS_IF([test "x$HAVELIBUSB" = "xno"], [
drivers=`echo ${drivers} | $SED \
-e s/ice100// \
-e s/jlink// \
-e s/vsllink// \
-e s/xpc//`
])
AS_IF([test "x$ac_cv_func_pread" != "xyes"], [
drivers=`echo ${drivers} | $SED -e s/gpio//`
])
])
dnl the "fake" jim cable driver is special
AS_IF([echo "$enabled_cable_drivers" | $GREP -q jim], [
AC_DEFINE([ENABLE_JIM], 1, [define if jim is enabled])
AM_CONDITIONAL([ENABLE_JIM], true)
],[
AM_CONDITIONAL([ENABLE_JIM], false)
])
# Enable lowlevel drivers
URJ_DRIVER_SET([lowlevel], [
direct
ftdi
ftd2xx
ppdev
ppi
],[
],[
# automatically disable lowlevel drivers when a required feature is not available
AS_IF([test "x$HAVELIBFTDI" != "xyes"], [
drivers=`echo ${drivers} | $SED -e "s/ftdi//"`
])
AS_IF([test "x$HAVELIBFTD2XX" != "xyes"], [
drivers=`echo ${drivers} | $SED -e "s/ftd2xx//"`
])
AS_IF([test "x$HAVE_LINUX_PPDEV_H" != "xyes"], [
drivers=`echo ${drivers} | $SED -e "s/ppdev//"`
])
AS_IF([test "x$HAVE_DEV_PPBUS_PPI_H" != "xyes"], [
drivers=`echo ${drivers} | $SED -e "s/ppi//"`
])
AS_IF([test "x$HAVE_IOPERM" != "xyes" -a "x$HAVE_I386_SET_IOPERM" != "xyes" -a "x$HAVE_INPOUTXX" != "xyes" ], [
drivers=`echo ${drivers} | $SED -e "s/direct//"`
])
])
dnl Enable a relocatable jtag?
AC_ARG_ENABLE(relocatable,
[AS_HELP_STRING([--enable-relocatable], [Enable relocatable paths])],
[relocatable=$enableval], [relocatable=no])
AS_IF([test "x$relocatable" = xyes], [
AM_CONDITIONAL(JTAG_RELOCATABLE, true)
AC_DEFINE(JTAG_RELOCATABLE, 1, [define for relocatable paths])
],[
AM_CONDITIONAL(JTAG_RELOCATABLE, false)
])
dnl Enable use of DMALLOC library?
AC_ARG_ENABLE(dmalloc,
[AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging with dmalloc library])],
[dmalloc=$enableval], [dmalloc=no])
AS_IF([test "x$dmalloc" = xyes], [
AM_CONDITIONAL(DMALLOC, true)
AC_DEFINE(DMALLOC, 1, [define for dmalloc library])
],[
AM_CONDITIONAL(DMALLOC, false)
])
# Enable flash multi-byte write mode?
AC_ARG_ENABLE(flash-multi-byte,
[AS_HELP_STRING([--disable-flash-multi-byte], [Disable flash multi-byte write mode])],
[flash_multi_byte=$enableval], [flash_multi_byte=yes])
AS_IF([test "x$flash_multi_byte" = xyes], [
AC_DEFINE(FLASH_MULTI_BYTE, 1, [define for flash multi-byte write mode])
])
AC_OUTPUT
dnl
dnl Configuration summary
dnl
FLAG_HAVELIBUSB=$HAVELIBUSB
AS_IF([test "x$HAVELIBFTDI_ASYNCMODE" = "xyes"], [
FLAG_HAVELIBFTDI_ASYNCMODE="(have async mode)"
],[
FLAG_HAVELIBFTDI_ASYNCMODE="(no async mode)"
])
AC_DEFUN([MAKE_YESNO_VAR],[dnl
AS_IF([test ${$1:-$2} != $2], [dnl
FLAG_$1=yes
], [dnl
FLAG_$1=no
])
])
MAKE_YESNO_VAR([HAVELIBFTDI], [no])
MAKE_YESNO_VAR([HAVELIBFTD2XX], [no])
MAKE_YESNO_VAR([HAVE_INPOUTXX], [no])
MAKE_YESNO_VAR([svf], [false])
MAKE_YESNO_VAR([bsdl], [false])
MAKE_YESNO_VAR([stapl], [false])
AC_MSG_NOTICE([
urjtag is now configured for
Libraries:
libusb : $FLAG_HAVELIBUSB
libftdi : $FLAG_HAVELIBFTDI $FLAG_HAVELIBFTDI_ASYNCMODE
libftd2xx : $FLAG_HAVELIBFTD2XX
inpout32 : $FLAG_HAVE_INPOUTXX
Subsystems:
SVF : $FLAG_svf
BSDL : $FLAG_bsdl
STAPL : $FLAG_stapl
Drivers:
Bus : $enabled_bus_drivers
Cable : $enabled_cable_drivers
Lowlevel : $enabled_lowlevel_drivers
Language bindings:
python : $enable_python
])