You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

337 lines
10 KiB

  1. AC_PREREQ(2.59)
  2. AC_INIT(configure.in)
  3. AC_CANONICAL_HOST
  4. AC_SEARCH_LIBS([ioperm], [ioperm])
  5. AC_SEARCH_LIBS([dlopen], [dl])
  6. AC_CHECK_HEADERS(jtag_minidriver.h)
  7. AC_CHECK_HEADERS(sys/param.h)
  8. AC_CHECK_HEADERS(sys/time.h)
  9. AC_CHECK_HEADERS(elf.h)
  10. AC_CHECK_HEADERS(strings.h)
  11. AC_HEADER_TIME
  12. AC_C_BIGENDIAN
  13. AC_CHECK_FUNCS(strndup)
  14. AC_CHECK_FUNCS(strnlen)
  15. AC_CHECK_FUNCS(gettimeofday)
  16. AC_CHECK_FUNCS(usleep)
  17. build_bitbang=no
  18. build_bitq=no
  19. is_cygwin=no
  20. is_mingw=no
  21. is_win32=no
  22. AC_ARG_ENABLE(parport,
  23. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  24. [build_parport=$enableval], [build_parport=no])
  25. AC_ARG_ENABLE(dummy,
  26. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  27. [build_dummy=$enableval], [build_dummy=no])
  28. case "${host_cpu}" in
  29. i?86|x86*)
  30. AC_ARG_ENABLE(parport_ppdev,
  31. AS_HELP_STRING([--enable-parport_ppdev], [Enable use of ppdev (/dev/parportN) for parport]),
  32. [parport_use_ppdev=$enableval], [parport_use_ppdev=no])
  33. ;;
  34. *)
  35. parport_use_ppdev=yes
  36. ;;
  37. esac
  38. AC_ARG_ENABLE(ft2232_libftdi,
  39. AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver]),
  40. [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
  41. AC_ARG_ENABLE(ft2232_ftd2xx,
  42. AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver]),
  43. [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
  44. AC_ARG_ENABLE(amtjtagaccel,
  45. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  46. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  47. case "${host_cpu}" in
  48. arm*)
  49. AC_ARG_ENABLE(ep93xx,
  50. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  51. [build_ep93xx=$enableval], [build_ep93xx=no])
  52. AC_ARG_ENABLE(ecosboard,
  53. AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
  54. [build_ecosboard=$enableval], [build_ecosboard=no])
  55. AC_ARG_ENABLE(at91rm9200,
  56. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  57. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  58. ;;
  59. *)
  60. build_ep93xx=no
  61. build_at91rm9200=no
  62. build_ecosboard=no
  63. ;;
  64. esac
  65. AC_ARG_ENABLE(gw16012,
  66. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  67. [build_gw16012=$enableval], [build_gw16012=no])
  68. AC_ARG_ENABLE(presto_libftdi,
  69. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  70. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  71. AC_ARG_ENABLE(presto_ftd2xx,
  72. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  73. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  74. AC_ARG_ENABLE(usbprog,
  75. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  76. [build_usbprog=$enableval], [build_usbprog=no])
  77. AC_ARG_ENABLE(oocd_trace,
  78. AS_HELP_STRING([--enable-oocd_trace], [Enable building support for the OpenOCD+trace ETM capture device]),
  79. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  80. AC_ARG_ENABLE(jlink,
  81. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  82. [build_jlink=$enableval], [build_jlink=no])
  83. AC_ARG_WITH(ftd2xx,
  84. [AS_HELP_STRING(--with-ftd2xx,
  85. [Where libftd2xx can be found <default=search>])],
  86. [],
  87. with_ftd2xx=search)
  88. case $host in
  89. *-cygwin*)
  90. is_win32=yes
  91. AC_ARG_ENABLE(parport_giveio,
  92. AS_HELP_STRING([--enable-parport_giveio], [Enable use of giveio for parport instead of ioperm]),
  93. [parport_use_giveio=$enableval], [parport_use_giveio=no])
  94. AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),[is_mingw=yes],[is_mingw=no])
  95. if test $is_mingw = yes; then
  96. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  97. parport_use_giveio=yes
  98. is_cygwin=no
  99. else
  100. is_cygwin=yes
  101. AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
  102. fi
  103. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  104. ;;
  105. *-mingw*)
  106. is_mingw=yes
  107. is_win32=yes
  108. parport_use_giveio=yes
  109. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  110. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  111. ;;
  112. *)
  113. parport_use_giveio=no
  114. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  115. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  116. ;;
  117. esac
  118. if test $build_parport = yes; then
  119. build_bitbang=yes
  120. AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
  121. else
  122. AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
  123. fi
  124. if test $build_dummy = yes; then
  125. build_bitbang=yes
  126. AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
  127. else
  128. AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
  129. fi
  130. if test $build_ep93xx = yes; then
  131. build_bitbang=yes
  132. AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
  133. else
  134. AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
  135. fi
  136. if test $build_ecosboard = yes; then
  137. build_bitbang=yes
  138. AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
  139. else
  140. AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
  141. fi
  142. if test $build_at91rm9200 = yes; then
  143. build_bitbang=yes
  144. AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
  145. else
  146. AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
  147. fi
  148. if test $parport_use_ppdev = yes; then
  149. AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
  150. else
  151. AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
  152. fi
  153. if test $parport_use_giveio = yes; then
  154. AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
  155. else
  156. AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
  157. fi
  158. if test $build_bitbang = yes; then
  159. AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
  160. else
  161. AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
  162. fi
  163. if test $build_ft2232_libftdi = yes; then
  164. AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
  165. else
  166. AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
  167. fi
  168. if test $build_ft2232_ftd2xx = yes; then
  169. AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
  170. else
  171. AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
  172. fi
  173. if test $build_amtjtagaccel = yes; then
  174. AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
  175. else
  176. AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
  177. fi
  178. if test $build_gw16012 = yes; then
  179. AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
  180. else
  181. AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
  182. fi
  183. if test $build_presto_libftdi = yes; then
  184. build_bitq=yes
  185. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
  186. else
  187. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
  188. fi
  189. if test $build_presto_ftd2xx = yes; then
  190. build_bitq=yes
  191. AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
  192. else
  193. AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  194. fi
  195. if test $build_bitq = yes; then
  196. AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
  197. else
  198. AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
  199. fi
  200. if test $build_usbprog = yes; then
  201. AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
  202. else
  203. AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
  204. fi
  205. if test $build_oocd_trace = yes; then
  206. AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
  207. else
  208. AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
  209. fi
  210. if test $build_jlink = yes; then
  211. AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
  212. else
  213. AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
  214. fi
  215. AM_CONFIG_HEADER(config.h)
  216. AM_INIT_AUTOMAKE(openocd, 1.0)
  217. AM_CONDITIONAL(PARPORT, test $build_parport = yes)
  218. AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
  219. AM_CONDITIONAL(GIVEIO, test $parport_use_giveio = yes)
  220. AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
  221. AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
  222. AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
  223. AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
  224. AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
  225. AM_CONDITIONAL(FT2232_FTD2XX, test $build_ft2232_ftd2xx = yes)
  226. AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
  227. AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
  228. AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
  229. AM_CONDITIONAL(PRESTO_FTD2XX, test $build_presto_ftd2xx = yes)
  230. AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
  231. AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
  232. AM_CONDITIONAL(JLINK, test $build_jlink = yes)
  233. AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
  234. AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
  235. AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
  236. AM_CONDITIONAL(FTD2XXDIR, test $with_ftd2xx != search)
  237. AM_CONDITIONAL(BITQ, test $build_bitq = yes)
  238. AC_LANG_C
  239. AC_PROG_CC
  240. AC_PROG_RANLIB
  241. # Setup for compiling build tools
  242. AC_MSG_CHECKING([for a C compiler for build tools])
  243. if test $cross_compiling = yes; then
  244. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  245. CFLAGS_FOR_BUILD="-g -O2"
  246. else
  247. CC_FOR_BUILD=$CC
  248. CFLAGS_FOR_BUILD=$CFLAGS
  249. fi
  250. AC_MSG_RESULT([$CC_FOR_BUILD])
  251. AC_SUBST(CC_FOR_BUILD)
  252. AC_SUBST(CFLAGS_FOR_BUILD)
  253. AC_MSG_CHECKING([for suffix of executable build tools])
  254. if test $cross_compiling = yes; then
  255. cat >conftest.c <<\_______EOF
  256. int main ()
  257. {
  258. exit (0);
  259. }
  260. _______EOF
  261. for i in .exe ""; do
  262. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  263. if AC_TRY_EVAL(compile); then
  264. if (./conftest) 2>&AC_FD_CC; then
  265. EXEEXT_FOR_BUILD=$i
  266. break
  267. fi
  268. fi
  269. done
  270. rm -f conftest*
  271. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  272. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  273. fi
  274. else
  275. EXEEXT_FOR_BUILD=$EXEEXT
  276. fi
  277. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  278. AC_SUBST(EXEEXT_FOR_BUILD)
  279. AC_SUBST(WITH_FTD2XX, $with_ftd2xx)
  280. 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 doc/Makefile)