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

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