- added support for Asix Presto JTAG interface (thanks to Pavel Chromy and Asix for...
[fw/openocd] / configure.in
1 AC_INIT(configure.in)
2
3 AC_SEARCH_LIBS([ioperm], [ioperm])
4
5 AC_CANONICAL_HOST
6
7 AC_CHECK_HEADERS(sys/param.h)
8 AC_CHECK_HEADERS(elf.h)
9
10 AC_C_BIGENDIAN
11
12 AC_CHECK_FUNCS(strndup)
13 AC_CHECK_FUNCS(strnlen)
14 AC_CHECK_FUNCS(gettimeofday)
15 AC_CHECK_FUNCS(usleep)
16
17 build_bitbang=no
18 build_bitq=no
19 is_cygwin=no
20 is_mingw=no
21 is_win32=no
22
23 AC_ARG_ENABLE(parport,
24   AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), 
25   [build_parport=$enableval], [build_parport=no])
26
27 AC_ARG_ENABLE(parport_ppdev,
28   AS_HELP_STRING([--enable-parport_ppdev], [Enable use of ppdev (/dev/parportN) for parport]), 
29   [parport_use_ppdev=$enableval], [parport_use_ppdev=no])
30
31 AC_ARG_ENABLE(ft2232_libftdi,
32   AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver]), 
33   [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
34
35 AC_ARG_ENABLE(ft2232_ftd2xx,
36   AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver]), 
37   [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
38  
39 AC_ARG_ENABLE(amtjtagaccel,
40   AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]), 
41   [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
42
43 AC_ARG_ENABLE(ep93xx,
44   AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]), 
45   [build_ep93xx=$enableval], [build_ep93xx=no])
46
47 AC_ARG_ENABLE(at91rm9200,
48   AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
49   [build_at91rm9200=$enableval], [build_at91rm9200=no])
50
51 AC_ARG_ENABLE(gw16012,
52   AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
53   [build_gw16012=$enableval], [build_gw16012=no])
54
55 AC_ARG_ENABLE(presto,
56   AS_HELP_STRING([--enable-presto], [Enable building support for ASIX Presto Programmer]),
57   [build_presto=$enableval], [build_presto=no])
58
59 AC_ARG_ENABLE(usbprog,
60   AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
61   [build_usbprog=$enableval], [build_usbprog=no])
62
63 AC_ARG_WITH(ftd2xx,
64         [AS_HELP_STRING(--with-ftd2xx,
65            [Where libftd2xx can be found <default=search>])],
66         [],
67         with_ftd2xx=search)
68
69 case $host in 
70   *-*-cygwin*) 
71     is_win32=yes
72
73     AC_ARG_ENABLE(parport_giveio,
74     AS_HELP_STRING([--enable-parport_giveio], [Enable use of giveio for parport instead of ioperm]), 
75     [parport_use_giveio=$enableval], [parport_use_giveio=no])
76         
77         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),[is_mingw=yes],[is_mingw=no])
78         if test $is_mingw = yes; then
79                 AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
80                 parport_use_giveio=yes
81                 is_cygwin=no
82         else
83                 is_cygwin=yes
84                 AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
85         fi
86         
87     AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
88     ;; 
89   *-*-mingw*) 
90     is_mingw=yes
91     is_win32=yes
92
93     parport_use_giveio=yes
94
95     AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
96     AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
97     ;; 
98   *) 
99         parport_use_giveio=no
100     AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
101     AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
102     ;;
103 esac
104
105 if test $build_parport = yes; then
106   build_bitbang=yes
107   AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
108 else
109   AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
110 fi
111
112 if test $build_ep93xx = yes; then
113   build_bitbang=yes
114   AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
115 else
116   AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
117 fi
118
119 if test $build_at91rm9200 = yes; then
120   build_bitbang=yes
121   AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
122 else
123   AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
124 fi
125
126 if test $parport_use_ppdev = yes; then
127   AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
128 else
129   AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
130 fi
131
132 if test $parport_use_giveio = yes; then
133   AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
134 else
135   AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
136 fi
137
138 if test $build_bitbang = yes; then
139   AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
140 else
141   AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
142 fi
143
144 if test $build_ft2232_libftdi = yes; then
145   AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
146 else
147   AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
148 fi
149
150 if test $build_ft2232_ftd2xx = yes; then
151   AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
152 else
153   AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
154 fi
155
156 if test $build_amtjtagaccel = yes; then
157   AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
158 else
159   AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
160 fi
161
162 if test $build_gw16012 = yes; then
163   AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
164 else
165   AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
166 fi
167
168 if test $build_presto = yes; then
169   build_bitq=yes
170   AC_DEFINE(BUILD_PRESTO, 1, [1 if you want the ASIX PRESTO driver.])
171 else
172   AC_DEFINE(BUILD_PRESTO, 0, [0 if you don't want the ASIX PRESTO driver.])
173 fi
174
175 if test $build_bitq = yes; then
176   AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
177 else
178   AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
179 fi
180
181 if test $build_usbprog = yes; then
182   AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
183 else
184   AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
185 fi
186
187 AM_CONFIG_HEADER(config.h)
188 AM_INIT_AUTOMAKE(openocd, 0.1)
189
190 AM_CONDITIONAL(PARPORT, test $build_parport = yes)
191 AM_CONDITIONAL(GIVEIO, test $parport_use_giveio = yes)
192 AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
193 AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
194 AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
195 AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
196 AM_CONDITIONAL(FT2232_FTD2XX, test $build_ft2232_ftd2xx = yes)
197 AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
198 AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
199 AM_CONDITIONAL(PRESTO, test $build_presto = yes)
200 AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
201 AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
202 AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
203 AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
204 AM_CONDITIONAL(FTD2XXDIR, test $with_ftd2xx != search)
205 AM_CONDITIONAL(BITQ, test $build_bitq = yes)
206
207 AC_LANG_C
208 AC_PROG_CC
209 AC_PROG_RANLIB
210
211 AC_SUBST(WITH_FTD2XX, $with_ftd2xx)
212
213 AC_OUTPUT(Makefile src/Makefile src/helper/Makefile src/jtag/Makefile src/xsvf/Makefile src/target/Makefile src/server/Makefile src/flash/Makefile src/pld/Makefile)