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 32 KiB

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