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.
 
 
 
 
 
 

1187 lines
36 KiB

  1. AC_PREREQ(2.60)
  2. AC_INIT([openocd], [0.5.0-dev],
  3. [OpenOCD Mailing List <openocd-development@lists.berlios.de>])
  4. AC_CONFIG_SRCDIR([src/openocd.c])
  5. m4_include(config_subdir.m4)dnl
  6. AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip])
  7. AM_MAINTAINER_MODE
  8. AM_CONFIG_HEADER(config.h)
  9. AH_BOTTOM([
  10. #include <helper/system.h>
  11. #include <helper/replacements.h>
  12. ])
  13. AC_LANG_C
  14. AC_PROG_CC
  15. AC_PROG_CC_C99
  16. AM_PROG_CC_C_O
  17. AC_PROG_RANLIB
  18. dnl disable checks for C++, Fortran and GNU Java Compiler
  19. m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
  20. m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
  21. m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
  22. AC_DISABLE_SHARED
  23. AC_PROG_LIBTOOL
  24. AC_SUBST(LIBTOOL_DEPS)
  25. dnl configure checks required for Jim files (these are obsolete w/ C99)
  26. AC_C_CONST
  27. AC_TYPE_LONG_LONG_INT
  28. AC_SEARCH_LIBS([ioperm], [ioperm])
  29. AC_SEARCH_LIBS([dlopen], [dl])
  30. AC_CHECK_HEADERS(sys/socket.h)
  31. AC_CHECK_HEADERS(arpa/inet.h, [], [], [dnl
  32. #include <stdio.h>
  33. #ifdef STDC_HEADERS
  34. # include <stdlib.h>
  35. # include <stddef.h>
  36. #else
  37. # ifdef HAVE_STDLIB_H
  38. # include <stdlib.h>
  39. # endif
  40. #endif
  41. #ifdef HAVE_SYS_SOCKET_H
  42. # include <sys/socket.h>
  43. #endif
  44. ])
  45. AC_CHECK_HEADERS(elf.h)
  46. AC_CHECK_HEADERS(dirent.h)
  47. AC_CHECK_HEADERS(fcntl.h)
  48. AC_CHECK_HEADERS(ifaddrs.h, [], [], [dnl
  49. #include <stdio.h>
  50. #ifdef STDC_HEADERS
  51. # include <stdlib.h>
  52. # include <stddef.h>
  53. #else
  54. # ifdef HAVE_STDLIB_H
  55. # include <stdlib.h>
  56. # endif
  57. #endif
  58. #ifdef HAVE_SYS_SOCKET_H
  59. # include <sys/socket.h>
  60. #endif
  61. ])
  62. AC_CHECK_HEADERS(malloc.h)
  63. AC_CHECK_HEADERS(netdb.h)
  64. AC_CHECK_HEADERS([netinet/in.h], [], [], [dnl
  65. #include <stdio.h>
  66. #ifdef STDC_HEADERS
  67. # include <stdlib.h>
  68. # include <stddef.h>
  69. #else
  70. # ifdef HAVE_STDLIB_H
  71. # include <stdlib.h>
  72. # endif
  73. #endif
  74. #ifdef HAVE_SYS_SOCKET_H
  75. # include <sys/socket.h>
  76. #endif
  77. ])
  78. AC_CHECK_HEADERS(netinet/tcp.h, [], [], [dnl
  79. #include <stdio.h>
  80. #ifdef STDC_HEADERS
  81. # include <stdlib.h>
  82. # include <stddef.h>
  83. #else
  84. # ifdef HAVE_STDLIB_H
  85. # include <stdlib.h>
  86. # endif
  87. #endif
  88. #ifdef HAVE_SYS_SOCKET_H
  89. # include <sys/socket.h>
  90. #endif
  91. ])
  92. AC_CHECK_HEADERS(pthread.h)
  93. AC_CHECK_HEADERS(strings.h)
  94. AC_CHECK_HEADERS(sys/ioctl.h)
  95. AC_CHECK_HEADERS(sys/param.h)
  96. AC_CHECK_HEADERS(sys/poll.h)
  97. AC_CHECK_HEADERS(sys/select.h)
  98. AC_CHECK_HEADERS(sys/stat.h)
  99. AC_CHECK_HEADERS(sys/time.h)
  100. AC_CHECK_HEADERS(sys/types.h)
  101. AC_CHECK_HEADERS(unistd.h)
  102. AC_CHECK_HEADERS([net/if.h], [], [], [dnl
  103. #include <stdio.h>
  104. #ifdef STDC_HEADERS
  105. # include <stdlib.h>
  106. # include <stddef.h>
  107. #else
  108. # ifdef HAVE_STDLIB_H
  109. # include <stdlib.h>
  110. # endif
  111. #endif
  112. #ifdef HAVE_SYS_SOCKET_H
  113. # include <sys/socket.h>
  114. #endif
  115. ])
  116. AC_HEADER_ASSERT
  117. AC_HEADER_STDBOOL
  118. AC_HEADER_TIME
  119. AC_C_BIGENDIAN
  120. AC_CHECK_FUNCS(strndup)
  121. AC_CHECK_FUNCS(strnlen)
  122. AC_CHECK_FUNCS(gettimeofday)
  123. AC_CHECK_FUNCS(usleep)
  124. AC_CHECK_FUNCS(vasprintf)
  125. build_bitbang=no
  126. build_bitq=no
  127. is_cygwin=no
  128. is_mingw=no
  129. is_win32=no
  130. is_darwin=no
  131. if test $cross_compiling = no; then
  132. # guess-rev.sh only exists in the repository, not in the released archives
  133. AC_CHECK_FILE("$srcdir/guess-rev.sh", has_guess_rev=yes, has_guess_rev=no)
  134. AC_MSG_CHECKING([whether to build a release])
  135. if test $has_guess_rev = no; then
  136. build_release=yes
  137. else
  138. build_release=no
  139. fi
  140. AC_MSG_RESULT($build_release)
  141. else
  142. build_release=yes
  143. fi
  144. # We are not *ALWAYS* being installed in the standard place.
  145. # We may be installed in a "tool-build" specific location.
  146. # Normally with other packages - as part of a tool distro.
  147. # Thus - we should search that 'libdir' also.
  148. #
  149. # And - if we are being installed there - the odds are
  150. # The libraries unique to what we are are there too.
  151. #
  152. # Expand nd deal with NONE - just like configure will do later
  153. OCDprefix=$prefix
  154. OCDxprefix=$exec_prefix
  155. test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
  156. # Let make expand exec_prefix.
  157. test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
  158. # what matters is the "exec-prefix"
  159. if test "$OCDxprefix" != "$ac_default_prefix"
  160. then
  161. # We are installing in a non-standard place
  162. # Nonstandard --prefix and/or --exec-prefix
  163. # We have an override of some sort.
  164. # use build specific install library dir
  165. LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
  166. # RPATH becomes an issue on Linux only
  167. if test $host_os = linux-gnu || test $host_os = linux ; then
  168. LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
  169. fi
  170. # The "INCDIR" is also usable
  171. CFLAGS="$CFLAGS -I$includedir"
  172. fi
  173. AC_ARG_WITH(ftd2xx,
  174. AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
  175. [
  176. # Option Given.
  177. cat << __EOF__
  178. The option: --with-ftd2xx=<PATH> has been removed.
  179. On Linux, the new option is:
  180. --with-ftd2xx-linux-tardir=/path/to/files
  181. Where <path> is the path the the directory where the "tar.gz" file
  182. from FTDICHIP.COM was unpacked, for example:
  183. --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
  184. On Cygwin/MingW32, the new option is:
  185. --with-ftd2xx-win32-zipdir=/path/to/files
  186. Where <path> is the path to the directory where the "zip" file from
  187. FTDICHIP.COM was unpacked, for example:
  188. --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
  189. __EOF__
  190. AC_MSG_ERROR([Sorry Cannot continue])
  191. ], [true])
  192. #========================================
  193. # FTD2XXX support comes in 4 forms.
  194. # (1) win32 - via a zip file
  195. # (2) linux - via a tar file
  196. # (3) linux/cygwin/mingw - via libftdi
  197. # (4) darwin - installed under /usr/local
  198. #
  199. # In case (1) and (2) we need to know where the package was unpacked.
  200. AC_ARG_WITH(ftd2xx-win32-zipdir,
  201. AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
  202. [
  203. # option present
  204. if test -d $with_ftd2xx_win32_zipdir
  205. then
  206. with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
  207. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
  208. else
  209. AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
  210. fi
  211. ], [true])
  212. AC_ARG_WITH(ftd2xx-linux-tardir,
  213. AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
  214. [
  215. # Option present
  216. if test $is_win32 = yes ; then
  217. AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
  218. fi
  219. if test -d $with_ftd2xx_linux_tardir
  220. then
  221. with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
  222. AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
  223. else
  224. AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
  225. fi
  226. ], [true])
  227. AC_ARG_WITH(ftd2xx-lib,
  228. AS_HELP_STRING([--with-ftd2xx-lib],
  229. [Use static or shared ftd2xx libs on default static]),
  230. [
  231. case "$withval" in
  232. static)
  233. with_ftd2xx_lib=$withval
  234. ;;
  235. shared)
  236. with_ftd2xx_lib=$withval
  237. ;;
  238. *)
  239. AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
  240. ;;
  241. esac
  242. ], [
  243. # Default is static - it is simpler :-(
  244. with_ftd2xx_lib=static
  245. ])
  246. AC_ARG_ENABLE(doxygen-html,
  247. AS_HELP_STRING([--disable-doxygen-html],
  248. [Disable building Doxygen manual as HTML.]),
  249. [doxygen_as_html=$enableval], [doxygen_as_html=yes])
  250. AC_SUBST(doxygen_as_html)
  251. AC_MSG_CHECKING([whether to build Doxygen as HTML])
  252. AC_MSG_RESULT($doxygen_as_html)
  253. AC_ARG_ENABLE(doxygen-pdf,
  254. AS_HELP_STRING([--enable-doxygen-pdf],
  255. [Enable building Doxygen manual as PDF.]),
  256. [doxygen_as_pdf=$enableval], [doxygen_as_pdf=no])
  257. AC_SUBST(doxygen_as_pdf)
  258. AC_MSG_CHECKING([whether to build Doxygen as PDF])
  259. AC_MSG_RESULT($doxygen_as_pdf)
  260. AC_ARG_ENABLE(gccwarnings,
  261. AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
  262. [gcc_warnings=$enableval], [gcc_warnings=yes])
  263. AC_ARG_ENABLE(wextra,
  264. AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
  265. [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
  266. AC_ARG_ENABLE(werror,
  267. AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  268. [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
  269. # set default verbose options, overridden by following options
  270. debug_jtag_io=no
  271. debug_usb_io=no
  272. debug_usb_comms=no
  273. AC_ARG_ENABLE(verbose,
  274. AS_HELP_STRING([--enable-verbose],
  275. [Enable verbose JTAG I/O messages (for debugging).]),
  276. [
  277. debug_jtag_io=$enableval
  278. debug_usb_io=$enableval
  279. debug_usb_comms=$enableval
  280. ], [])
  281. AC_ARG_ENABLE(verbose_jtag_io,
  282. AS_HELP_STRING([--enable-verbose-jtag-io],
  283. [Enable verbose JTAG I/O messages (for debugging).]),
  284. [debug_jtag_io=$enableval], [])
  285. AC_ARG_ENABLE(verbose_usb_io,
  286. AS_HELP_STRING([--enable-verbose-usb-io],
  287. [Enable verbose USB I/O messages (for debugging)]),
  288. [debug_usb_io=$enableval], [])
  289. AC_ARG_ENABLE(verbose_usb_comms,
  290. AS_HELP_STRING([--enable-verbose-usb-comms],
  291. [Enable verbose USB communication messages (for debugging)]),
  292. [debug_usb_comms=$enableval], [])
  293. AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
  294. AC_MSG_RESULT($debug_jtag_io)
  295. if test $debug_jtag_io = yes; then
  296. AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
  297. fi
  298. AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
  299. AC_MSG_RESULT($debug_usb_io)
  300. if test $debug_usb_io = yes; then
  301. AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
  302. fi
  303. AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
  304. AC_MSG_RESULT($debug_usb_comms)
  305. if test $debug_usb_comms = yes; then
  306. AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
  307. fi
  308. debug_malloc=no
  309. AC_ARG_ENABLE(malloc_logging,
  310. AS_HELP_STRING([--enable-malloc-logging],
  311. [Include free space in logging messages (requires malloc.h).]),
  312. [debug_malloc=$enableval], [])
  313. AC_MSG_CHECKING([whether to enable malloc free space logging]);
  314. AC_MSG_RESULT($debug_malloc)
  315. if test $debug_malloc = yes; then
  316. AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
  317. fi
  318. AC_ARG_ENABLE(dummy,
  319. AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
  320. [build_dummy=$enableval], [build_dummy=no])
  321. AC_ARG_ENABLE(parport,
  322. AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
  323. [build_parport=$enableval], [build_parport=no])
  324. AC_ARG_ENABLE(parport_ppdev,
  325. AS_HELP_STRING([--disable-parport-ppdev],
  326. [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
  327. [parport_use_ppdev=$enableval], [parport_use_ppdev=yes])
  328. AC_ARG_ENABLE(parport_giveio,
  329. AS_HELP_STRING([--enable-parport-giveio],
  330. [Enable use of giveio for parport (for CygWin only)]),
  331. [parport_use_giveio=$enableval], [parport_use_giveio=])
  332. AC_ARG_ENABLE(ft2232_libftdi,
  333. AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
  334. [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
  335. AC_ARG_ENABLE(ft2232_ftd2xx,
  336. AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
  337. [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
  338. AC_ARG_ENABLE(usb_blaster_libftdi,
  339. AS_HELP_STRING([--enable-usb_blaster_libftdi], [Enable building support for the Altera USB-Blaster using the libftdi driver, opensource alternate of FTD2XX]),
  340. [build_usb_blaster_libftdi=$enableval], [build_usb_blaster_libftdi=no])
  341. AC_ARG_ENABLE(usb_blaster_ftd2xx,
  342. AS_HELP_STRING([--enable-usb_blaster_ftd2xx], [Enable building support for the Altera USB-Blaster using the FTD2XX driver from ftdichip.com]),
  343. [build_usb_blaster_ftd2xx=$enableval], [build_usb_blaster_ftd2xx=no])
  344. AC_ARG_ENABLE(amtjtagaccel,
  345. AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
  346. [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
  347. AC_ARG_ENABLE(ecosboard,
  348. AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCos based JTAG debugger]),
  349. [build_ecosboard=$enableval], [build_ecosboard=no])
  350. AC_ARG_ENABLE(zy1000_master,
  351. AS_HELP_STRING([--enable-zy1000-master], [Use ZY1000 JTAG master registers]),
  352. [build_zy1000_master=$enableval], [build_zy1000_master=no])
  353. AC_ARG_ENABLE(zy1000,
  354. AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]),
  355. [build_zy1000=$enableval], [build_zy1000=no])
  356. AC_ARG_ENABLE(ioutil,
  357. AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
  358. [build_ioutil=$enableval], [build_ioutil=no])
  359. case "${host_cpu}" in
  360. arm*)
  361. AC_ARG_ENABLE(ep93xx,
  362. AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
  363. [build_ep93xx=$enableval], [build_ep93xx=no])
  364. AC_ARG_ENABLE(at91rm9200,
  365. AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
  366. [build_at91rm9200=$enableval], [build_at91rm9200=no])
  367. ;;
  368. *)
  369. build_ep93xx=no
  370. build_at91rm9200=no
  371. ;;
  372. esac
  373. AC_ARG_ENABLE(gw16012,
  374. AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
  375. [build_gw16012=$enableval], [build_gw16012=no])
  376. AC_ARG_ENABLE(presto_libftdi,
  377. AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
  378. [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
  379. AC_ARG_ENABLE(presto_ftd2xx,
  380. AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
  381. [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
  382. AC_ARG_ENABLE(usbprog,
  383. AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
  384. [build_usbprog=$enableval], [build_usbprog=no])
  385. AC_ARG_ENABLE(oocd_trace,
  386. AS_HELP_STRING([--enable-oocd_trace],
  387. [Enable building support for some prototype OpenOCD+trace ETM capture hardware]),
  388. [build_oocd_trace=$enableval], [build_oocd_trace=no])
  389. AC_ARG_ENABLE(jlink,
  390. AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
  391. [build_jlink=$enableval], [build_jlink=no])
  392. AC_ARG_ENABLE(vsllink,
  393. AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
  394. [build_vsllink=$enableval], [build_vsllink=no])
  395. AC_ARG_ENABLE(rlink,
  396. AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
  397. [build_rlink=$enableval], [build_rlink=no])
  398. AC_ARG_ENABLE(arm-jtag-ew,
  399. AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
  400. [build_armjtagew=$enableval], [build_armjtagew=no])
  401. AC_ARG_ENABLE(buspirate,
  402. AS_HELP_STRING([--enable-buspirate], [Enable building support for the Buspirate]),
  403. [build_buspirate=$enableval], [build_buspirate=no])
  404. AC_ARG_ENABLE(minidriver_dummy,
  405. AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
  406. [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
  407. AC_ARG_ENABLE(internal-jimtcl,
  408. AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]),
  409. [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
  410. build_minidriver=no
  411. AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
  412. if test $build_zy1000 = yes; then
  413. if test $build_minidriver = yes; then
  414. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  415. fi
  416. AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
  417. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  418. build_minidriver=yes
  419. fi
  420. AC_MSG_RESULT($build_zy1000)
  421. AC_MSG_CHECKING([whether to enable dummy minidriver])
  422. if test $build_minidriver_dummy = yes; then
  423. if test $build_minidriver = yes; then
  424. AC_MSG_ERROR([Multiple minidriver options have been enabled.])
  425. fi
  426. build_minidriver=yes
  427. AC_DEFINE(BUILD_MINIDRIVER_DUMMY, 1, [Use the dummy minidriver.])
  428. AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
  429. [Define to 1 if you have the <jtag_minidriver.h> header file.])
  430. fi
  431. AC_MSG_RESULT($build_minidriver_dummy)
  432. AC_MSG_CHECKING([whether standard drivers can be built])
  433. if test "$build_minidriver" = yes; then
  434. AC_MSG_RESULT([no])
  435. AC_MSG_WARN([Using the minidriver disables all other drivers.])
  436. sleep 2
  437. else
  438. AC_MSG_RESULT([yes])
  439. fi
  440. case "${host_cpu}" in
  441. i?86|x86*)
  442. ;;
  443. *)
  444. if test x$parport_use_ppdev = xno; then
  445. AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
  446. fi
  447. parport_use_ppdev=yes
  448. ;;
  449. esac
  450. case $host in
  451. *-cygwin*)
  452. is_win32=yes
  453. parport_use_ppdev=no
  454. AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),
  455. [is_mingw=yes],[is_mingw=no])
  456. if test $is_mingw = yes; then
  457. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  458. if test x$parport_use_giveio = xno; then
  459. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  460. fi
  461. parport_use_giveio=yes
  462. is_cygwin=no
  463. else
  464. is_cygwin=yes
  465. AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
  466. # sys/io.h needed under cygwin for parport access
  467. if test $build_parport = yes; then
  468. AC_CHECK_HEADERS(sys/io.h,[],AC_MSG_ERROR([Please install the cygwin ioperm package]))
  469. fi
  470. fi
  471. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  472. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  473. ;;
  474. *-mingw*)
  475. is_mingw=yes
  476. is_win32=yes
  477. parport_use_ppdev=no
  478. if test x$parport_use_giveio = xno; then
  479. AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
  480. fi
  481. parport_use_giveio=yes
  482. CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO"
  483. AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
  484. AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
  485. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  486. ;;
  487. *darwin*)
  488. is_darwin=yes
  489. if test x$parport_use_giveio = xyes; then
  490. AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
  491. fi
  492. parport_use_giveio=no
  493. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  494. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  495. AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
  496. ;;
  497. *)
  498. if test x$parport_use_giveio = xyes; then
  499. AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
  500. fi
  501. parport_use_giveio=no
  502. AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
  503. AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
  504. AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
  505. ;;
  506. esac
  507. if test $build_parport = yes; then
  508. build_bitbang=yes
  509. AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
  510. else
  511. AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
  512. fi
  513. if test $build_dummy = yes; then
  514. build_bitbang=yes
  515. AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
  516. else
  517. AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
  518. fi
  519. if test $build_ep93xx = yes; then
  520. build_bitbang=yes
  521. AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
  522. else
  523. AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
  524. fi
  525. if test $build_ecosboard = yes; then
  526. AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
  527. else
  528. AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
  529. fi
  530. if test $build_zy1000 = yes; then
  531. AC_DEFINE(BUILD_ZY1000, 1, [1 if you want ZY1000.])
  532. else
  533. AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.])
  534. fi
  535. if test $build_zy1000_master = yes; then
  536. AC_DEFINE(BUILD_ZY1000_MASTER, 1, [1 if you want ZY1000 JTAG master registers.])
  537. else
  538. AC_DEFINE(BUILD_ZY1000_MASTER, 0, [0 if you don't want ZY1000 JTAG master registers.])
  539. fi
  540. if test $build_at91rm9200 = yes; then
  541. build_bitbang=yes
  542. AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
  543. else
  544. AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
  545. fi
  546. if test x$parport_use_ppdev = xyes; then
  547. AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
  548. else
  549. AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
  550. fi
  551. if test x$parport_use_giveio = xyes; then
  552. AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
  553. else
  554. AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
  555. fi
  556. if test $build_bitbang = yes; then
  557. AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
  558. else
  559. AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
  560. fi
  561. if test $build_ft2232_libftdi = yes; then
  562. AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
  563. else
  564. AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
  565. fi
  566. if test $build_ft2232_ftd2xx = yes; then
  567. AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
  568. else
  569. AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
  570. fi
  571. if test $build_usb_blaster_libftdi = yes; then
  572. build_bitbang=yes
  573. AC_DEFINE(BUILD_USB_BLASTER_LIBFTDI, 1, [1 if you want libftdi usb_blaster.])
  574. else
  575. AC_DEFINE(BUILD_USB_BLASTER_LIBFTDI, 0, [0 if you don't want libftdi usb_blaster.])
  576. fi
  577. if test $build_usb_blaster_ftd2xx = yes; then
  578. build_bitbang=yes
  579. AC_DEFINE(BUILD_USB_BLASTER_FTD2XX, 1, [1 if you want ftd2xx usb_blaster.])
  580. else
  581. AC_DEFINE(BUILD_USB_BLASTER_FTD2XX, 0, [0 if you don't want ftd2xx usb_blaster.])
  582. fi
  583. if test $build_amtjtagaccel = yes; then
  584. AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
  585. else
  586. AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
  587. fi
  588. if test $build_gw16012 = yes; then
  589. AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
  590. else
  591. AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
  592. fi
  593. if test $build_presto_libftdi = yes; then
  594. build_bitq=yes
  595. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
  596. else
  597. AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
  598. fi
  599. if test $build_presto_ftd2xx = yes; then
  600. build_bitq=yes
  601. AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
  602. else
  603. AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
  604. fi
  605. if test $build_bitq = yes; then
  606. AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
  607. else
  608. AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
  609. fi
  610. if test $build_usbprog = yes; then
  611. AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
  612. else
  613. AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
  614. fi
  615. if test $build_oocd_trace = yes; then
  616. AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
  617. else
  618. AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
  619. fi
  620. if test $build_jlink = yes; then
  621. AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
  622. else
  623. AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
  624. fi
  625. if test $build_vsllink = yes; then
  626. AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
  627. else
  628. AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
  629. fi
  630. if test $build_rlink = yes; then
  631. AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
  632. else
  633. AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
  634. fi
  635. if test $build_armjtagew = yes; then
  636. AC_DEFINE(BUILD_ARMJTAGEW, 1, [1 if you want the ARM-JTAG-EW JTAG driver.])
  637. else
  638. AC_DEFINE(BUILD_ARMJTAGEW, 0, [0 if you don't want the ARM-JTAG-EW JTAG driver.])
  639. fi
  640. if test $build_buspirate = yes; then
  641. AC_DEFINE(BUILD_BUSPIRATE, 1, [1 if you want the Buspirate JTAG driver.])
  642. else
  643. AC_DEFINE(BUILD_BUSPIRATE, 0, [0 if you don't want the Buspirate JTAG driver.])
  644. fi
  645. if test "$use_internal_jimtcl" = yes; then
  646. if test -f "$srcdir/jimtcl/configure.ac"; then
  647. AX_CONFIG_SUBDIR_OPTION([jimtcl], [--with-jim-ext=nvp --disable-lineedit])
  648. else
  649. AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
  650. fi
  651. fi
  652. #-- Deal with MingW/Cygwin FTD2XX issues
  653. if test $is_win32 = yes; then
  654. if test "${with_ftd2xx_linux_tardir+set}" = set
  655. then
  656. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  657. fi
  658. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes -o $build_usb_blaster_ftd2xx = yes ; then
  659. AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
  660. # if we are given a zipdir...
  661. if test "${with_ftd2xx_win32_zipdir+set}" = set
  662. then
  663. # Set the CFLAGS for "ftd2xx.h"
  664. f=$with_ftd2xx_win32_zipdir/ftd2xx.h
  665. if test ! -f $f ; then
  666. AC_MSG_ERROR([File: $f cannot be found])
  667. fi
  668. CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
  669. # And calculate the LDFLAGS for the machine
  670. case "$host_cpu" in
  671. i?86|x86_32)
  672. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
  673. LIBS="$LIBS -lftd2xx"
  674. f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
  675. ;;
  676. amd64|x86_64)
  677. LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
  678. LIBS="$LIBS -lftd2xx"
  679. f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
  680. ;;
  681. *)
  682. AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
  683. ;;
  684. esac
  685. if test ! -f $f ; then
  686. AC_MSG_ERROR([Library: $f not found])
  687. fi
  688. else
  689. LIBS="$LIBS -lftd2xx"
  690. AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
  691. fi
  692. fi
  693. fi # win32
  694. if test $is_darwin = yes ; then
  695. if test "${with_ftd2xx_win32_zipdir+set}" = set
  696. then
  697. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  698. fi
  699. if test "${with_ftd2xx_linux_tardir+set}" = set
  700. then
  701. AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
  702. fi
  703. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
  704. AC_MSG_CHECKING([for libftd2xx.a (darwin)])
  705. if test ! -f /usr/local/include/ftd2xx.h ; then
  706. AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
  707. fi
  708. CFLAGS="$CFLAGS -I/usr/local/include"
  709. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  710. LIBS="$LIBS -lftd2xx"
  711. AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
  712. fi
  713. fi # darwin
  714. if test $is_win32 = no && test $is_darwin = no ; then
  715. if test "${with_ftd2xx_win32_zipdir+set}" = set
  716. then
  717. AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
  718. fi
  719. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
  720. # Must be linux
  721. if test $host_os != linux-gnu && test $host_os != linux ; then
  722. AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
  723. fi
  724. # Are we given a TAR directory?
  725. if test "${with_ftd2xx_linux_tardir+set}" = set
  726. then
  727. AC_MSG_CHECKING([uninstalled ftd2xx distribution])
  728. # The .H file is simple..
  729. FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
  730. if test ! -f "${FTD2XX_H}"; then
  731. AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
  732. fi
  733. CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
  734. FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
  735. FTD2XX_LIB="-lftd2xx"
  736. if test $with_ftd2xx_lib != shared; then
  737. # Test #1 - Future proof - if/when ftdichip fixes their distro.
  738. # Try it with the simple ".a" suffix.
  739. FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a"
  740. if test -f "${FTD2XX_LIB}"; then
  741. FTD2XX_LDFLAGS="${FTD2XX_LDFLAGS}/static_lib"
  742. else
  743. # Test Number2.
  744. # Grr.. perhaps it exists as a version number?
  745. FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
  746. count=`ls ${FTD2XX_LIB} | wc -l`
  747. if test $count -gt 1 ; then
  748. AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
  749. fi
  750. if test $count -ne 1 ; then
  751. AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
  752. fi
  753. # Because the "-l" rules do not understand version numbers...
  754. # we will just stuff the absolute path onto the LIBS variable
  755. FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
  756. FTD2XX_LDFLAGS=""
  757. fi
  758. fi
  759. LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
  760. LIBS="${LIBS} ${FTD2XX_LIB}"
  761. AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
  762. else
  763. AC_CHECK_HEADER([ftd2xx.h],[],[
  764. AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
  765. ])
  766. AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
  767. AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
  768. ],[])
  769. fi
  770. fi
  771. fi # linux
  772. if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes; then
  773. # Before we go any further - make sure we can *BUILD* and *RUN*
  774. # a simple app with the "ftd2xx.lib" file - in what ever form we where given
  775. # We should be able to compile, link and run this test program now
  776. AC_MSG_CHECKING([whether ftd2xx library works])
  777. #
  778. # Save the LDFLAGS for later..
  779. LDFLAGS_SAVE=$LDFLAGS
  780. CFLAGS_SAVE=$CFLAGS
  781. _LDFLAGS=`eval echo $LDFLAGS`
  782. _CFLAGS=`eval echo $CFLAGS`
  783. LDFLAGS=$_LDFLAGS
  784. CFLAGS=$_CFLAGS
  785. AC_RUN_IFELSE([
  786. #include "confdefs.h"
  787. #if IS_WIN32
  788. #include "windows.h"
  789. #endif
  790. #include <stdio.h>
  791. #include <ftd2xx.h>
  792. int
  793. main( int argc, char **argv )
  794. {
  795. DWORD x;
  796. FT_GetLibraryVersion( &x );
  797. return 0;
  798. }
  799. ], [
  800. AC_MSG_RESULT([Success!])
  801. ], [
  802. AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
  803. ], [
  804. AC_MSG_RESULT([Skipping as we are cross-compiling])
  805. ])
  806. AC_MSG_CHECKING([for ftd2xx highspeed device support])
  807. AC_COMPILE_IFELSE([
  808. #include "confdefs.h"
  809. #if IS_WIN32
  810. #include "windows.h"
  811. #endif
  812. #include <stdio.h>
  813. #include <ftd2xx.h>
  814. DWORD x = FT_DEVICE_4232H;
  815. ], [
  816. AC_DEFINE(BUILD_FT2232_HIGHSPEED, [1],
  817. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  818. build_ft2232_highspeed=yes
  819. ], [
  820. build_ft2232_highspeed=no
  821. ])
  822. AC_MSG_RESULT([$build_ft2232_highspeed])
  823. if test $build_ft2232_highspeed = no; then
  824. AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
  825. fi
  826. LDFLAGS=$LDFLAGS_SAVE
  827. CFLAGS=$CFLAGS_SAVE
  828. fi
  829. if test $build_ft2232_libftdi = yes ; then
  830. # We assume: the package is preinstalled in the proper place
  831. # these present as 2 libraries..
  832. LIBS="$LIBS -lftdi -lusb"
  833. #
  834. # Try to build a small program.
  835. AC_MSG_CHECKING([Build & Link with libftdi...])
  836. LDFLAGS_SAVE=$LDFLAGS
  837. CFLAGS_SAVE=$CFLAGS
  838. _LDFLAGS=`eval echo $LDFLAGS`
  839. _CFLAGS=`eval echo $CFLAGS`
  840. LDFLAGS=$_LDFLAGS
  841. CFLAGS=$_CFLAGS
  842. AC_RUN_IFELSE([
  843. #include <stdio.h>
  844. #include <ftdi.h>
  845. int
  846. main( int argc, char **argv )
  847. {
  848. struct ftdi_context *p;
  849. p = ftdi_new();
  850. if( p != NULL ){
  851. return 0;
  852. } else {
  853. fprintf( stderr, "calling ftdi_new() failed\n");
  854. return 1;
  855. }
  856. }
  857. ], [
  858. AC_MSG_RESULT([Success])
  859. ], [
  860. AC_MSG_ERROR([Cannot build & run test program using libftdi])
  861. ], [
  862. AC_MSG_RESULT([Skipping as we are cross-compiling])
  863. ])
  864. AC_MSG_CHECKING([for libftdi highspeed device support])
  865. AC_COMPILE_IFELSE([
  866. #include <stdio.h>
  867. #include <ftdi.h>
  868. enum ftdi_chip_type x = TYPE_2232H;
  869. ], [
  870. AC_DEFINE(BUILD_FT2232_HIGHSPEED, [1],
  871. [Support FT2232H/FT4232HS with FTD2XX or libftdi.])
  872. build_ft2232_highspeed=yes
  873. ], [
  874. build_ft2232_highspeed=no
  875. ])
  876. AC_MSG_RESULT([$build_ft2232_highspeed])
  877. if test $build_ft2232_highspeed = no; then
  878. AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
  879. fi
  880. # Restore the 'unexpanded ldflags'
  881. LDFLAGS=$LDFLAGS_SAVE
  882. CFLAGS=$CFLAGS_SAVE
  883. fi
  884. # check for usb.h when a driver will require it
  885. build_usb=no
  886. if test $build_jlink = yes -o $build_vsllink = yes -o $build_usbprog = yes -o \
  887. $build_rlink = yes -o $build_armjtagew = yes
  888. then
  889. AC_CHECK_HEADERS([usb.h],[],
  890. [AC_MSG_ERROR([usb.h is required to build some OpenOCD driver(s)])])
  891. build_usb=yes
  892. fi
  893. AM_CONDITIONAL(RELEASE, test $build_release = yes)
  894. AM_CONDITIONAL(PARPORT, test $build_parport = yes)
  895. AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
  896. AM_CONDITIONAL(GIVEIO, test x$parport_use_giveio = xyes)
  897. AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
  898. AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
  899. AM_CONDITIONAL(ZY1000, test $build_zy1000 = yes)
  900. AM_CONDITIONAL(ZY1000_MASTER, test $build_zy1000_master = yes)
  901. AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
  902. AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
  903. AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
  904. AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
  905. AM_CONDITIONAL(FT2232_DRIVER, test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes)
  906. AM_CONDITIONAL(USB_BLASTER_LIBFTDI, test $build_usb_blaster_libftdi = yes)
  907. AM_CONDITIONAL(USB_BLASTER_DRIVER, test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes)
  908. AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
  909. AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
  910. AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
  911. AM_CONDITIONAL(PRESTO_DRIVER, test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes)
  912. AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
  913. AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
  914. AM_CONDITIONAL(JLINK, test $build_jlink = yes)
  915. AM_CONDITIONAL(VSLLINK, test $build_vsllink = yes)
  916. AM_CONDITIONAL(RLINK, test $build_rlink = yes)
  917. AM_CONDITIONAL(ARMJTAGEW, test $build_armjtagew = yes)
  918. AM_CONDITIONAL(BUSPIRATE, test $build_buspirate = yes)
  919. AM_CONDITIONAL(USB, test $build_usb = yes)
  920. AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
  921. AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
  922. AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
  923. AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes)
  924. AM_CONDITIONAL(BITQ, test $build_bitq = yes)
  925. AM_CONDITIONAL(MINIDRIVER, test $build_minidriver = yes)
  926. AM_CONDITIONAL(MINIDRIVER_DUMMY, test $build_minidriver_dummy = yes)
  927. AM_CONDITIONAL(INTERNAL_JIMTCL, test $use_internal_jimtcl = yes)
  928. # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
  929. AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
  930. AC_COMPILE_IFELSE([
  931. #define _GNU_SOURCE
  932. #include <unistd.h>
  933. #include <stdlib.h>
  934. int main(int argc, char **argv) { char **ep = environ; }
  935. ], [
  936. AC_MSG_RESULT([yes])
  937. has_environ=yes
  938. ], [
  939. AC_MSG_RESULT([no])
  940. # Possibility #2: can environ be found in an available library?
  941. AC_MSG_CHECKING([for extern environ])
  942. AC_LINK_IFELSE([
  943. extern char **environ;
  944. int main(int argc, char **argv) { char **ep = environ; }
  945. ], [
  946. AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
  947. has_environ=yes
  948. ], [
  949. has_environ=no
  950. ])
  951. AC_MSG_RESULT([${has_environ}])
  952. ])
  953. if test "${has_environ}" != "yes" ; then
  954. AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
  955. fi
  956. AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
  957. # set default gcc warnings
  958. GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
  959. if test "${gcc_wextra}" = yes; then
  960. GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
  961. GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
  962. GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
  963. GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
  964. fi
  965. if test "${gcc_werror}" = yes; then
  966. GCC_WARNINGS="${GCC_WARNINGS} -Werror"
  967. fi
  968. # overide default gcc cflags
  969. if test $gcc_warnings = yes; then
  970. CFLAGS="$CFLAGS $GCC_WARNINGS"
  971. fi
  972. # Setup for compiling build tools
  973. AC_MSG_CHECKING([for a C compiler for build tools])
  974. if test $cross_compiling = yes; then
  975. AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
  976. CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
  977. else
  978. CC_FOR_BUILD=$CC
  979. CFLAGS_FOR_BUILD=$CFLAGS
  980. fi
  981. AC_MSG_RESULT([$CC_FOR_BUILD])
  982. AC_SUBST(CC_FOR_BUILD)
  983. AC_SUBST(CFLAGS_FOR_BUILD)
  984. AC_MSG_CHECKING([for suffix of executable build tools])
  985. if test $cross_compiling = yes; then
  986. cat >conftest.c <<\_______EOF
  987. int main ()
  988. {
  989. exit (0);
  990. }
  991. _______EOF
  992. for i in .exe ""; do
  993. compile="$CC_FOR_BUILD conftest.c -o conftest$i"
  994. if AC_TRY_EVAL(compile); then
  995. if (./conftest) 2>&AC_FD_CC; then
  996. EXEEXT_FOR_BUILD=$i
  997. break
  998. fi
  999. fi
  1000. done
  1001. rm -f conftest*
  1002. if test "${EXEEXT_FOR_BUILD+set}" != set; then
  1003. AC_MSG_ERROR([Cannot determine suffix of executable build tools])
  1004. fi
  1005. else
  1006. EXEEXT_FOR_BUILD=$EXEEXT
  1007. fi
  1008. AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
  1009. AC_SUBST(EXEEXT_FOR_BUILD)
  1010. AC_OUTPUT(dnl
  1011. Makefile dnl
  1012. src/Makefile dnl
  1013. src/helper/Makefile dnl
  1014. src/jtag/Makefile dnl
  1015. src/jtag/drivers/Makefile dnl
  1016. src/xsvf/Makefile dnl
  1017. src/svf/Makefile dnl
  1018. src/target/Makefile dnl
  1019. src/server/Makefile dnl
  1020. src/flash/Makefile dnl
  1021. src/flash/nor/Makefile dnl
  1022. src/flash/nand/Makefile dnl
  1023. src/pld/Makefile dnl
  1024. doc/Makefile dnl
  1025. )