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.

configure.in 21 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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. AC_CHECK_FUNCS(vasprintf)
  18. build_bitbang=no
  19. build_bitq=no
  20. is_cygwin=no
  21. is_mingw=no
  22. is_win32=no
  23. # We are not *ALWAYS* being installed in the standard place.
  24. # We may be installed in a "tool-build" specific location.
  25. # Normally with other packages - as part of a tool distro.
  26. # Thus - we should search that 'libdir' also.
  27. #
  28. # And - if we are being installed there - the odds are
  29. # The libraries unique to what we are are there too.
  30. #
  31. # Expand nd deal with NONE - just like configure will do later
  32. OCDprefix=$prefix
  33. OCDxprefix=$exec_prefix
  34. test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
  35. # Let make expand exec_prefix.
  36. test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
  37. # what matters is the "exec-prefix"
  38. if test "$OCDxprefix" != "$ac_default_prefix"
  39. then
  40. # We are installing in a non-standard place
  41. # Nonstandard --prefix and/or --exec-prefix
  42. # We have an override of some sort.
  43. # use build specific install library dir
  44. LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
  45. # RPATH becomes an issue on Linux only
  46. if test $host_os = linux-gnu || test $host_os = linux ; then
  47. LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
  48. fi
  49. # The "INCDIR" is also usable
  50. CFLAGS="$CFLAGS -I$includedir"
  51. fi
  52. AC_ARG_WITH(ftd2xx,
  53. AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
  54. [
  55. # Option Given.
  56. cat << __EOF__
  57. The option: --with-ftd2xx=<PATH> has been removed replaced.
  58. On Linux, the new option is:
  59. --with-ftd2xx-linux-tardir=/path/to/files
  60. Where <path> is the path the the directory where the "tar.gz" file
  61. from FTDICHIP.COM was unpacked, for example:
  62. --with-ftd2xx-linux-tardir=/home/duane/libftd2xx-linux-tardir=/home/duane/libftd2xx0.4.16
  63. On Cygwin/MingW32, the new option is:
  64. --with-ftd2xx-win32-zipdir=/path/to/files
  65. Where <path> is the path to the directory where the "zip" file from
  66. FTDICHIP.COM was unpacked, for example:
  67. --with-ftd2xx-win32-zipdir=/home/duane/ftd2xx.cdm.files
  68. __EOF__
  69. AC_MSG_ERROR([Sorry Cannot continue])
  70. ],
  71. [
  72. # Option not given
  73. true
  74. ]
  75. )
  76. #========================================
  77. # FTD2XXX support comes in 3 forms.
  78. # (1) win32 - via a zip file
  79. # (2) linux - via a tar file
  80. # (3) linux/cygwin/mingw - via libftdi
  81. #
  82. # In case (1) and (2) we need to know where the package was unpacked.
  83. AC_ARG_WITH(ftd2xx-win32-zipdir,
  84. AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
  85. [
  86. # option present
  87. if test -d $with_ftd2xx_win32_zipdir
  88. then
  89. with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
  90. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
  91. else
  92. AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
  93. fi
  94. ],
  95. [
  96. # not given
  97. true
  98. ]
  99. )
  100. AC_ARG_WITH(ftd2xx-linux-tardir,
  101. AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
  102. [
  103. # Option present
  104. if test $is_win32 = yes ; then
  105. AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
  106. fi
  107. if test -d $with_ftd2xx_linux_tardir
  108. then
  109. with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
  110. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
  111. else
  112. AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
  113. fi
  114. ],
  115. [
  116. # Not given
  117. true
  118. ]
  119. )
  120. AC_ARG_WITH(ftd2xx-lib,
  121. AS_HELP_STRING([--with-ftd2xx-lib], [Use static or shared ftd2xx libs on default static]),
  122. [
  123. case "$withval" in
  124. static)
  125. with_ftd2xx_lib=$withval
  126. ;;
  127. shared)
  128. with_ftd2xx_lib=$withval
  129. ;;
  130. *)
  131. AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
  132. ;;
  133. esac
  134. ],
  135. [
  136. # Default is static - it is simpler :-(
  137. with_ftd2xx_lib=static
  138. ]
  139. )
  140. AC_ARG_ENABLE(gccwarnings,
  141. AS_HELP_STRING([--enable-gccwarnings], [Enable compiler warnings, default yes]),
  142. [gcc_warnings=$enableval], [gcc_warnings=yes])
  143. AC_ARG_ENABLE(parport,
  144. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  145. [build_parport=$enableval], [build_parport=no])
  146. AC_ARG_ENABLE(dummy,
  147. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  148. [build_dummy=$enableval], [build_dummy=no])
  149. case "${host_cpu}" in
  150. i?86|x86*)
  151. AC_ARG_ENABLE(parport_ppdev,
  152. AS_HELP_STRING([--enable-parport_ppdev], [Enable use of ppdev (/dev/parportN) for parport]),
  153. [parport_use_ppdev=$enableval], [parport_use_ppdev=no])
  154. ;;
  155. *)
  156. parport_use_ppdev=yes
  157. ;;
  158. esac
  159. AC_ARG_ENABLE(ft2232_libftdi,
  160. AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
  161. [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
  162. AC_ARG_ENABLE(ft2232_ftd2xx,
  163. AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
  164. [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
  165. AC_ARG_ENABLE(amtjtagaccel,
  166. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  167. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  168. AC_ARG_ENABLE(ecosboard,
  169. AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
  170. [build_ecosboard=$enableval], [build_ecosboard=no])
  171. AC_ARG_ENABLE(ioutil,
  172. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  173. [build_ioutil=$enableval], [build_ioutil=no])
  174. AC_ARG_ENABLE(httpd,
  175. AS_HELP_STRING([--enable-httpd], [Enable builtin httpd server - useful for standalone OpenOCD implementations]),
  176. [build_httpd=$enableval], [build_httpd=no])
  177. case "${host_cpu}" in
  178. arm*)
  179. AC_ARG_ENABLE(ep93xx,
  180. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  181. [build_ep93xx=$enableval], [build_ep93xx=no])
  182. AC_ARG_ENABLE(at91rm9200,
  183. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  184. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  185. ;;
  186. *)
  187. build_ep93xx=no
  188. build_at91rm9200=no
  189. ;;
  190. esac
  191. AC_ARG_ENABLE(gw16012,
  192. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  193. [build_gw16012=$enableval], [build_gw16012=no])
  194. AC_ARG_ENABLE(presto_libftdi,
  195. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  196. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  197. AC_ARG_ENABLE(presto_ftd2xx,
  198. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  199. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  200. AC_ARG_ENABLE(usbprog,
  201. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  202. [build_usbprog=$enableval], [build_usbprog=no])
  203. AC_ARG_ENABLE(oocd_trace,
  204. AS_HELP_STRING([--enable-oocd_trace], [Enable building support for the OpenOCD+trace ETM capture device]),
  205. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  206. AC_ARG_ENABLE(jlink,
  207. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  208. [build_jlink=$enableval], [build_jlink=no])
  209. AC_ARG_ENABLE(vsllink,
  210. AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
  211. [build_vsllink=$enableval], [build_vsllink=no])
  212. AC_ARG_ENABLE(rlink,
  213. AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
  214. [build_rlink=$enableval], [build_rlink=no])
  215. case $host in
  216. *-cygwin*)
  217. is_win32=yes
  218. AC_ARG_ENABLE(parport_giveio,
  219. AS_HELP_STRING([--enable-parport_giveio], [Enable use of giveio for parport instead of ioperm]),
  220. [parport_use_giveio=$enableval], [parport_use_giveio=no])
  221. AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),[is_mingw=yes],[is_mingw=no])
  222. if test $is_mingw = yes; then
  223. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  224. parport_use_giveio=yes
  225. is_cygwin=no
  226. else
  227. is_cygwin=yes
  228. AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
  229. fi
  230. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  231. ;;
  232. *-mingw*)
  233. is_mingw=yes
  234. is_win32=yes
  235. parport_use_giveio=yes
  236. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  237. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  238. ;;
  239. *)
  240. parport_use_giveio=no
  241. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  242. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  243. ;;
  244. esac
  245. if test $build_parport = yes; then
  246. build_bitbang=yes
  247. AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
  248. else
  249. AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
  250. fi
  251. if test $build_dummy = yes; then
  252. build_bitbang=yes
  253. AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
  254. else
  255. AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
  256. fi
  257. if test $build_ep93xx = yes; then
  258. build_bitbang=yes
  259. AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
  260. else
  261. AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
  262. fi
  263. if test $build_ecosboard = yes; then
  264. build_bitbang=yes
  265. AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
  266. else
  267. AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
  268. fi
  269. if test $build_ioutil = yes; then
  270. AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
  271. else
  272. AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
  273. fi
  274. if test $build_httpd = yes; then
  275. AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
  276. else
  277. AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.])
  278. fi
  279. if test $build_at91rm9200 = yes; then
  280. build_bitbang=yes
  281. AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
  282. else
  283. AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
  284. fi
  285. if test $parport_use_ppdev = yes; then
  286. AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
  287. else
  288. AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
  289. fi
  290. if test $parport_use_giveio = yes; then
  291. AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
  292. else
  293. AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
  294. fi
  295. if test $build_bitbang = yes; then
  296. AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
  297. else
  298. AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
  299. fi
  300. if test $build_ft2232_libftdi = yes; then
  301. AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
  302. else
  303. AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
  304. fi
  305. if test $build_ft2232_ftd2xx = yes; then
  306. AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
  307. else
  308. AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
  309. fi
  310. if test $build_amtjtagaccel = yes; then
  311. AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
  312. else
  313. AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
  314. fi
  315. if test $build_gw16012 = yes; then
  316. AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
  317. else
  318. AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
  319. fi
  320. if test $build_presto_libftdi = yes; then
  321. build_bitq=yes
  322. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
  323. else
  324. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
  325. fi
  326. if test $build_presto_ftd2xx = yes; then
  327. build_bitq=yes
  328. AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
  329. else
  330. AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  331. fi
  332. if test $build_bitq = yes; then
  333. AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
  334. else
  335. AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
  336. fi
  337. if test $build_usbprog = yes; then
  338. AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
  339. else
  340. AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
  341. fi
  342. if test $build_oocd_trace = yes; then
  343. AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
  344. else
  345. AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
  346. fi
  347. if test $build_jlink = yes; then
  348. AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
  349. else
  350. AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
  351. fi
  352. if test $build_vsllink = yes; then
  353. AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
  354. else
  355. AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
  356. fi
  357. if test $build_rlink = yes; then
  358. AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
  359. else
  360. AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
  361. fi
  362. #-- Deal with MingW/Cygwin FTD2XX issues
  363. if test $is_win32 = yes; then
  364. if test "${with_ftd2xx_linux_tardir+set}" = set
  365. then
  366. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  367. fi
  368. if test $build_ft2232_ftd2xx = yes ; then
  369. AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
  370. # if we are given a zipdir...
  371. if test "${with_ftd2xx_win32_zipdir+set}" = set
  372. then
  373. # Set the CFLAGS for "ftd2xx.h"
  374. f=$with_ftd2xx_win32_zipdir/ftd2xx.h
  375. if test ! -f $f ; then
  376. AC_MSG_ERROR([File: $f cannot be found])
  377. fi
  378. CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
  379. # And calculate the LDFLAGS for the machine
  380. case "$host_cpu" in
  381. i?86|x86_*)
  382. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
  383. LIBS="$LIBS -lftd2xx"
  384. f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
  385. ;;
  386. amd64)
  387. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
  388. LIBS="$LIBS -lftd2xx"
  389. f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
  390. ;;
  391. *)
  392. AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
  393. ;;
  394. esac
  395. if test ! -f $f ; then
  396. AC_MSG_ERROR([Library: $f not found])
  397. fi
  398. else
  399. LIBS="$LIBS -lftd2xx"
  400. AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
  401. fi
  402. fi
  403. fi
  404. if test $is_win32 = no; then
  405. if test "${with_ftd2xx_win32_zipdir+set}" = set
  406. then
  407. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  408. fi
  409. if test $build_ft2232_ftd2xx = yes ; then
  410. AC_MSG_CHECKING([for libftd2xx.a (linux)])
  411. # Must be linux -
  412. # Cause FTDICHIP does not supply a MAC-OS version
  413. if test $host_os != linux-gnu && test $host_os != linux ; then
  414. AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
  415. fi
  416. # Are we given a TAR directory?
  417. if test "${with_ftd2xx_linux_tardir+set}" = set
  418. then
  419. # The .H file is simple..
  420. f=$with_ftd2xx_linux_tardir/ftd2xx.h
  421. if test ! -f $f ; then
  422. AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: $f])
  423. fi
  424. CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
  425. if test $with_ftd2xx_lib = shared
  426. then
  427. LDFLAGS="$LDFLAGS -L$with_ftd2xx_linux_tardir"
  428. LIBS="$LIBS -lftd2xx"
  429. AC_MSG_RESULT([ Assuming: -L$with_ftd2xx_linux_tardir -lftd2xx])
  430. else
  431. # Test #1 - Future proof - if/when ftdichip fixes their distro.
  432. # Try it with the simple ".a" suffix.
  433. f=$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a
  434. if test -f $f ; then
  435. # Yea we are done
  436. LDFLAGS="$LDFLAGS -L$with_ftd2xx_linux_tardir/static_lib"
  437. LIBS="$LIBS -lftd2xx"
  438. else
  439. # Test Number2.
  440. # Grr.. perhaps it exists as a version number?
  441. f="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
  442. count=`ls $f | wc -l`
  443. if test $count -gt 1 ; then
  444. AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
  445. fi
  446. if test $count -ne 1 ; then
  447. AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
  448. fi
  449. # Because the "-l" rules do not understand version numbers...
  450. # we will just stuff the absolute path onto the LIBS variable
  451. f=`ls $f`
  452. #
  453. LIBS="$LIBS $f -lpthread"
  454. # No need to bother with LDFLAGS...
  455. fi
  456. AC_MSG_RESULT([Found: $f])
  457. fi
  458. else
  459. LIBS="$LIBS -lftd2xx"
  460. AC_MSG_RESULT([Assumed: installed])
  461. AC_MSG_WARN([The (linux) FTDICHIP.COM files ftd2xx.h and libftd2xx.so are assumed to be in a proper place])
  462. fi
  463. fi
  464. fi
  465. if test $build_ft2232_ftd2xx = yes; then
  466. # Before we go any further - make sure we can *BUILD* and *RUN*
  467. # a simple app with the "ftd2xx.lib" file - in what ever form we where given
  468. # We should be able to compile, link and run this test program now
  469. AC_MSG_CHECKING([Test: Build & Link with ftd2xx])
  470. #
  471. # Save the LDFLAGS for later..
  472. LDFLAGS_SAVE=$LDFLAGS
  473. CFLAGS_SAVE=$CFLAGS
  474. _LDFLAGS=`eval echo $LDFLAGS`
  475. _CFLAGS=`eval echo $CFLAGS`
  476. LDFLAGS=$_LDFLAGS
  477. CFLAGS=$_CFLAGS
  478. AC_RUN_IFELSE(
  479. [
  480. #include "confdefs.h"
  481. #if IS_WIN32
  482. #include "windows.h"
  483. #endif
  484. #include <stdio.h>
  485. #include <ftd2xx.h>
  486. int
  487. main( int argc, char **argv )
  488. {
  489. DWORD x;
  490. FT_GetLibraryVersion( &x );
  491. return 0;
  492. }
  493. ], [ AC_MSG_RESULT([Success!])] , [ AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib]) ] )
  494. LDFLAGS=$LDFLAGS_SAVE
  495. CFLAGS=$CFLAGS_SAVE
  496. fi
  497. if test $build_ft2232_libftdi = yes ; then
  498. # We assume: the package is preinstalled in the proper place
  499. # these present as 2 libraries..
  500. LIBS="$LIBS -lftdi -lusb"
  501. #
  502. # Try to build a small program.
  503. AC_MSG_CHECKING([Build & Link with libftdi...])
  504. LDFLAGS_SAVE=$LDFLAGS
  505. CFLAGS_SAVE=$CFLAGS
  506. _LDFLAGS=`eval echo $LDFLAGS`
  507. _CFLAGS=`eval echo $CFLAGS`
  508. LDFLAGS=$_LDFLAGS
  509. CFLAGS=$_CFLAGS
  510. AC_RUN_IFELSE(
  511. [
  512. #include <stdio.h>
  513. #include <ftdi.h>
  514. int
  515. main( int argc, char **argv )
  516. {
  517. struct ftdi_context *p;
  518. p = ftdi_new();
  519. if( p != NULL ){
  520. return 0;
  521. } else {
  522. fprintf( stderr, "calling ftdi_new() failed\n");
  523. return 1;
  524. }
  525. }
  526. ]
  527. ,
  528. [ AC_MSG_RESULT([Success]) ]
  529. ,
  530. [ AC_MSG_ERROR([Cannot build & run test program using libftdi]) ] )
  531. # Restore the 'unexpanded ldflags'
  532. LDFLAGS=$LDFLAGS_SAVE
  533. CFLAGS=$CFLAGS_SAVE
  534. fi
  535. AM_CONFIG_HEADER(config.h)
  536. AM_INIT_AUTOMAKE(openocd, 1.0)
  537. AM_CONDITIONAL(PARPORT, test $build_parport = yes)
  538. AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
  539. AM_CONDITIONAL(GIVEIO, test $parport_use_giveio = yes)
  540. AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
  541. AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
  542. AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
  543. AM_CONDITIONAL(HTTPD, test $build_httpd = yes)
  544. AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
  545. AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
  546. AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
  547. AM_CONDITIONAL(FT2232_FTD2XX, test $build_ft2232_ftd2xx = yes)
  548. AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
  549. AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
  550. AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
  551. AM_CONDITIONAL(PRESTO_FTD2XX, test $build_presto_ftd2xx = yes)
  552. AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
  553. AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
  554. AM_CONDITIONAL(JLINK, test $build_jlink = yes)
  555. AM_CONDITIONAL(VSLLINK, test $build_vsllink = yes)
  556. AM_CONDITIONAL(RLINK, test $build_rlink = yes)
  557. AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
  558. AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
  559. AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
  560. AM_CONDITIONAL(BITQ, test $build_bitq = yes)
  561. AC_LANG_C
  562. AC_PROG_CC
  563. AC_PROG_RANLIB
  564. # set default gcc warnings
  565. GCC_WARNINGS="-Wall -Wstrict-prototypes"
  566. # overide default gcc cflags
  567. if test $gcc_warnings = yes; then
  568. CFLAGS="$CFLAGS $GCC_WARNINGS"
  569. fi
  570. # Setup for compiling build tools
  571. AC_MSG_CHECKING([for a C compiler for build tools])
  572. if test $cross_compiling = yes; then
  573. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  574. CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
  575. else
  576. CC_FOR_BUILD=$CC
  577. CFLAGS_FOR_BUILD=$CFLAGS
  578. fi
  579. AC_MSG_RESULT([$CC_FOR_BUILD])
  580. AC_SUBST(CC_FOR_BUILD)
  581. AC_SUBST(CFLAGS_FOR_BUILD)
  582. AC_MSG_CHECKING([for suffix of executable build tools])
  583. if test $cross_compiling = yes; then
  584. cat >conftest.c <<\_______EOF
  585. int main ()
  586. {
  587. exit (0);
  588. }
  589. _______EOF
  590. for i in .exe ""; do
  591. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  592. if AC_TRY_EVAL(compile); then
  593. if (./conftest) 2>&AC_FD_CC; then
  594. EXEEXT_FOR_BUILD=$i
  595. break
  596. fi
  597. fi
  598. done
  599. rm -f conftest*
  600. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  601. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  602. fi
  603. else
  604. EXEEXT_FOR_BUILD=$EXEEXT
  605. fi
  606. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  607. AC_SUBST(EXEEXT_FOR_BUILD)
  608. 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)