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.
 
 
 
 
 
 

1119 lines
33 KiB

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