Guest User

Untitled

a guest
Feb 17th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 14.82 KB | None | 0 0
  1. #
  2. # avrdude - A Downloader/Uploader for AVR device programmers
  3. # Copyright (C) 2003, 2004  Theodore A. Roth  <[email protected]>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18.  
  19. #
  20. # $Id: configure.ac 1244 2013-09-18 06:19:42Z joerg_wunsch $
  21. #
  22.  
  23. # Process this file with autoconf to produce a configure script.
  24.  
  25. AC_PREREQ(2.60)
  26. AC_INIT(avrdude, 6.0.1, avrdude-dev@nongnu.org)
  27.  
  28. AC_CANONICAL_BUILD
  29. AC_CANONICAL_HOST
  30. AC_CANONICAL_TARGET
  31.  
  32. AC_CONFIG_SRCDIR([main.c])
  33. AM_INIT_AUTOMAKE
  34. AC_CONFIG_HEADERS(ac_cfg.h)
  35.  
  36. # Checks for programs.
  37. AC_PROG_CC
  38. AC_PROG_INSTALL
  39. AC_PROG_SED
  40. AC_PROG_YACC
  41. AC_PROG_LEX
  42. AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
  43. AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
  44. AC_DEFUN([AC_PROG_RANLIB], [AC_CHECK_TARGET_TOOL(RANLIB, ranlib, :)])
  45. AC_PROG_RANLIB
  46. AN_MAKEVAR([AR], [AC_PROG_AR])
  47. AN_PROGRAM([ar], [AC_PROG_AR])
  48. AC_DEFUN([AC_PROG_AR], [AC_CHECK_TARGET_TOOL(AR, ar, :)])
  49. AC_PROG_AR
  50. AH_TEMPLATE([HAVE_YYLEX_DESTROY],
  51.             [Define if lex/flex has yylex_destroy])
  52. # flex should have this
  53. if test "x$LEX" == xflex; then
  54.    AC_MSG_CHECKING([whether yylex_destroy is generated by flex])
  55.    flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'`
  56.    case $flex_version in
  57.        [[0-1].*)]
  58.            AC_MSG_RESULT([version $flex_version => no])
  59.            ;;
  60.        [2.[0-4].*)]
  61.            AC_MSG_RESULT([version $flex_version => no])
  62.            ;;
  63.        [2.5.[0-8])]
  64.            AC_MSG_RESULT([version $flex_version => no])
  65.            ;;
  66.        [2.5.[0-8][A-Za-z]*)]
  67.            AC_MSG_RESULT([version $flex_version => no])
  68.            ;;
  69.        *)
  70.            AC_MSG_RESULT([version $flex_version => yes])
  71.            AC_DEFINE([HAVE_YYLEX_DESTROY])
  72.            ;;
  73.    esac
  74. fi
  75.  
  76. dnl Makefile.am:77: compiling `config_gram.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
  77. AM_PROG_CC_C_O
  78.  
  79. # Checks for libraries.
  80. AC_CHECK_LIB([termcap], [tputs])
  81. AC_CHECK_LIB([ncurses], [tputs])
  82. AC_CHECK_LIB([readline], [readline])
  83. AH_TEMPLATE([HAVE_LIBELF],
  84.            [Define if ELF support is enabled via libelf])
  85. AC_CHECK_LIB([elf], [elf_begin], [have_libelf=yes])
  86. if test x$have_libelf = xyes; then
  87.   case $target in
  88.       *)
  89.               LIBELF="-lelf"
  90.               ;;
  91.   esac
  92.   AC_DEFINE([HAVE_LIBELF])
  93.   AC_CHECK_HEADERS([libelf.h libelf/libelf.h])
  94. fi
  95. AC_SUBST(LIBELF, $LIBELF)
  96.  
  97. AC_SEARCH_LIBS([gethostent], [nsl])
  98. AC_SEARCH_LIBS([setsockopt], [socket])
  99. AH_TEMPLATE([HAVE_LIBUSB],
  100.            [Define if USB support is enabled via libusb])
  101. AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes])
  102. if test x$have_libusb = xyes; then
  103.   case $target in
  104.       *-*-darwin*)
  105.               LIBUSB="-lusb -framework CoreFoundation -framework IOKit"
  106.               ;;
  107.       *)
  108.               LIBUSB="-lusb"
  109.               ;;
  110.   esac
  111.   AC_DEFINE([HAVE_LIBUSB])
  112.   AC_CHECK_HEADERS([usb.h])
  113.   AC_CHECK_HEADERS([lusb0_usb.h])
  114. fi
  115. AC_SUBST(LIBUSB, $LIBUSB)
  116.  
  117. AH_TEMPLATE([HAVE_LIBUSB_1_0],
  118.            [Define if USB support is enabled via libusb 1.0])
  119. AC_CHECK_LIB([usb-1.0], [libusb_init], [have_libusb_1_0=yes])
  120. if test x$have_libusb_1_0 = xyes; then
  121.   case $target in
  122.       *-*-darwin*)
  123.               LIBUSB_1_0="-lusb-1.0 -framework CoreFoundation -framework IOKit"
  124.               ;;
  125.       *)
  126.               LIBUSB_1_0="-lusb-1.0"
  127.               ;;
  128.   esac
  129.   AC_DEFINE([HAVE_LIBUSB_1_0])
  130.   AC_CHECK_HEADERS([libusb-1.0/libusb.h])
  131.   AC_CHECK_HEADERS([libusb.h])
  132. fi
  133. AH_TEMPLATE([HAVE_LIBUSB_1_0],
  134.            [Define if USB support is enabled via a libusb-1.0 compatible libusb])
  135. AC_CHECK_LIB([usb], [libusb_init], [have_libusb_1_0=yes])
  136. if test x$have_libusb_1_0 = xyes; then
  137.   case $target in
  138.       *-*-freebsd*)
  139.               # FreeBSD 8+ has a native libusb-1.0 API compatible
  140.               # library offered by -lusb (which is also libusb-0.1
  141.               # compatible).  FreeBSD <8 does not have a libusb-1.0
  142.               # at all so probing will fail but we do not have to
  143.               # special-case that.
  144.               LIBUSB_1_0="-lusb"
  145.               ;;
  146.       *)
  147.               LIBUSB_1_0="-lusb-1.0"
  148.               ;;
  149.   esac
  150.   AC_DEFINE([HAVE_LIBUSB_1_0])
  151.   AC_CHECK_HEADERS([libusb.h])
  152. fi
  153. AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0)
  154. AH_TEMPLATE([HAVE_LIBFTDI1],
  155.            [Define if FTDI support is enabled via libftdi1])
  156. AH_TEMPLATE([HAVE_LIBFTDI],
  157.            [Define if FTDI support is enabled via libftdi])
  158. AH_TEMPLATE([HAVE_LIBFTDI_TYPE_232H],
  159.            [Define if libftdi supports FT232H, libftdi version >= 0.20])
  160. AC_CHECK_LIB([ftdi1], [ftdi_new], [have_libftdi1=yes], [], [-lusb-1.0])
  161. AC_CHECK_LIB([ftdi], [ftdi_usb_get_strings], [have_libftdi=yes], [], [-lusb])
  162. if test x$have_libftdi1 = xyes; then
  163.   LIBFTDI1="-lftdi1"
  164.   AC_DEFINE([HAVE_LIBFTDI1])
  165.   AC_SUBST(LIBFTDI1, $LIBFTDI1)
  166. else
  167.   if test x$have_libftdi = xyes; then
  168.      LIBFTDI="-lftdi -lusb"
  169.      AC_DEFINE([HAVE_LIBFTDI])
  170.      AC_SUBST(LIBFTDI, $LIBFTDI)
  171.      AC_CHECK_DECL(TYPE_232H,[have_libftdi_FT232H=yes], [], [[#include <ftdi.h>]])
  172.      if test x$have_libftdi_FT232H = xyes; then
  173.         AC_DEFINE([HAVE_LIBFTDI_TYPE_232H])
  174.      fi
  175.   fi
  176. fi
  177. AC_CHECK_HEADERS([pthread.h])
  178. # as there exits header file only pthread implementations for Windows, check if we have a library
  179. AC_CHECK_LIB([pthread], [pthread_create], [have_pthread=yes])
  180. if test x$have_pthread = xyes; then
  181.   LIBPTHREAD="-lpthread"
  182. fi
  183. AC_SUBST(LIBPTHREAD, $LIBPTHREAD)
  184. # Checks for header files.
  185. AC_CHECK_HEADERS([limits.h stdlib.h string.h])
  186. AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h])
  187. AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
  188. #include <setupapi.h>])
  189.  
  190.  
  191. # Checks for typedefs, structures, and compiler characteristics.
  192. AC_C_CONST
  193. AC_HEADER_TIME
  194.  
  195. # Checks for library functions.
  196. AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep])
  197.  
  198. AC_MSG_CHECKING([for a Win32 HID libray])
  199. SAVED_LIBS="${LIBS}"
  200. case $target in
  201.        *-*-mingw32* | *-*-cygwin* | *-*-windows*)
  202.         LIBHID="-lhid -lsetupapi"
  203.         if test $ac_cv_header_ddk_hidsdi_h = yes
  204.         then
  205.             HIDINCLUDE="#include <ddk/hidsdi.h>"
  206.         else
  207.             HIDINCLUDE="#include \"my_ddk_hidsdi.h\""
  208.         fi
  209.         ;;
  210.     *)
  211.         LIBHID=""
  212.         ;;
  213. esac
  214. LIBS="${LIBS} ${LIBHID}"
  215.  
  216. AH_TEMPLATE([HAVE_LIBHID],
  217.            [Define if HID support is enabled via the Win32 DDK])
  218. AC_TRY_RUN([#include <windows.h>
  219. #include <setupapi.h>
  220. $HIDINCLUDE
  221.  
  222. int
  223. main(void)
  224. {
  225.    GUID hidGuid;
  226.    HidD_GetHidGuid(&hidGuid);
  227.  
  228.    return 0;
  229. }
  230. ], [have_libhid=yes], [have_libhid=no], [have_libhid=no])
  231. AC_MSG_RESULT([$have_libhid])
  232. if test x$have_libhid = xyes; then
  233.   AC_DEFINE([HAVE_LIBHID])
  234. else
  235.   LIBHID=""
  236. fi
  237. LIBS="${SAVED_LIBS}"
  238. AC_SUBST(LIBHID, $LIBHID)
  239.  
  240. # Check for types
  241.  
  242. # Solaris has uint_t and ulong_t typedefs in <sys/types.h>, avoid
  243. # the redeclaration in usbtiny.c.
  244. AC_CHECK_TYPES([uint_t], [], [], [#include <sys/types.h>])
  245. AC_CHECK_TYPES([ulong_t], [], [], [#include <sys/types.h>])
  246.  
  247. # Checks for misc stuff.
  248.  
  249. AC_ARG_ENABLE(
  250.     [versioned-doc],
  251.     AC_HELP_STRING(
  252.         [--enable-versioned-doc],
  253.         [install docs in directory with version name (default)]),
  254.     [case "${enableval}" in
  255.         yes) versioned_doc=yes ;;
  256.         no)  versioned_doc=no ;;
  257.         *)   AC_MSG_ERROR(bad value ${enableval} for versioned-doc option) ;;
  258.         esac],
  259.     [versioned_doc=yes])
  260.  
  261. if test "$versioned_doc" = "yes"; then
  262.    DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude-$(VERSION)'
  263. else
  264.    DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude'
  265. fi
  266.  
  267. AC_ARG_ENABLE(
  268.     [doc],
  269.     AC_HELP_STRING(
  270.         [--enable-doc],
  271.         [Enable building documents]),
  272.     [case "${enableval}" in
  273.         yes) enabled_doc=yes ;;
  274.         no)  enabled_doc=no ;;
  275.         *)   AC_MSG_ERROR(bad value ${enableval} for disable-doc option) ;;
  276.         esac],
  277.     [enabled_doc=no])
  278.  
  279. AC_ARG_ENABLE(
  280.     [parport],
  281.     AC_HELP_STRING(
  282.         [--enable-parport],
  283.         [Enable accessing parallel ports(default)]),
  284.     [case "${enableval}" in
  285.         yes) enabled_parport=yes ;;
  286.         no)  enabled_parport=no ;;
  287.         *)   AC_MSG_ERROR(bad value ${enableval} for enable-parport option) ;;
  288.         esac],
  289.     [enabled_parport=yes])
  290.    
  291. AC_ARG_ENABLE(
  292.     [linuxgpio],
  293.     AC_HELP_STRING(
  294.         [--enable-linuxgpio],
  295.         [Enable the Linux sysfs GPIO interface programmer type]),
  296.     [case "${enableval}" in
  297.         yes) enabled_linuxgpio=yes ;;
  298.         no)  enabled_linuxgpio=no ;;
  299.         *)   AC_MSG_ERROR(bad value ${enableval} for enable-linuxgpio option) ;;
  300.         esac],
  301.     [enabled_linuxgpio=no])
  302.  
  303. DIST_SUBDIRS_AC='doc windows'
  304.  
  305. if test "$enabled_doc" = "yes"; then
  306.     SUBDIRS_AC='doc'
  307. else
  308.     SUBDIRS_AC=''
  309. fi
  310.  
  311. AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
  312. AC_SUBST(SUBDIRS_AC, $SUBDIRS_AC)
  313. AC_SUBST(DIST_SUBDIRS_AC, $DIST_SUBDIRS_AC)
  314.  
  315.  
  316. # Find the parallel serial device files based on target system
  317. # If a system doesn't have a PC style parallel, mark it as unknown.
  318. case $target in
  319.     i[[3456]]86-*-linux*|x86_64-*-linux*)
  320.         DEFAULT_PAR_PORT="/dev/parport0"
  321.         DEFAULT_SER_PORT="/dev/ttyS0"
  322.         ;;
  323.     *-*-linux*)
  324.         DEFAULT_PAR_PORT="unknown"
  325.         DEFAULT_SER_PORT="/dev/ttyS0"
  326.         ;;
  327.     i[[3456]]86-*-*freebsd*|amd64-*-*freebsd*)
  328.         DEFAULT_PAR_PORT="/dev/ppi0"
  329.         DEFAULT_SER_PORT="/dev/cuad0"
  330.         ;;
  331.     *-*-*freebsd*)
  332.         DEFAULT_PAR_PORT="unknown"
  333.         DEFAULT_SER_PORT="/dev/cuad0"
  334.         ;;
  335.     *-*-solaris*)
  336.         DEFAULT_PAR_PORT="/dev/printers/0"
  337.         DEFAULT_SER_PORT="/dev/term/a"
  338.         ;;
  339.     *-*-msdos* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
  340.         DEFAULT_PAR_PORT="lpt1"
  341.         DEFAULT_SER_PORT="com1"
  342.         ;;
  343.     *)
  344.         DEFAULT_PAR_PORT="unknown"
  345.         DEFAULT_SER_PORT="unknown"
  346.         ;;
  347. esac
  348.  
  349. if test "$enabled_parport" = "yes"; then
  350.     AC_MSG_CHECKING([for parallel device])
  351.     if test "$DEFAULT_PAR_PORT" = "unknown"; then
  352.         AC_MSG_NOTICE([parallel port access disabled for this system])
  353.         enabled_parport=no
  354.     else
  355.         AC_MSG_RESULT([$DEFAULT_PAR_PORT])
  356.     fi
  357.     AC_SUBST(DEFAULT_PAR_PORT, $DEFAULT_PAR_PORT)
  358. fi
  359.  
  360. AC_MSG_CHECKING([for serial device])
  361. AC_MSG_RESULT([$DEFAULT_SER_PORT])
  362. AC_SUBST(DEFAULT_SER_PORT, $DEFAULT_SER_PORT)
  363.  
  364. if test "$enabled_parport" = "yes"; then
  365.     AC_DEFINE(HAVE_PARPORT, 1, [parallel port access enabled])
  366.     confsubst="-e /^@HAVE_PARPORT_/d"
  367. else
  368.     confsubst="-e /^@HAVE_PARPORT_BEGIN@/,/^@HAVE_PARPORT_END@/d"
  369. fi
  370.  
  371.  
  372. if test "$enabled_linuxgpio" = "yes"; then
  373.     AC_DEFINE(HAVE_LINUXGPIO, 1, [Linux sysfs GPIO support enabled])
  374.     confsubst="$confsubst -e /^@HAVE_LINUXGPIO_/d"
  375. else
  376.     confsubst="$confsubst -e /^@HAVE_LINUXGPIO_BEGIN@/,/^@HAVE_LINUXGPIO_END@/d"
  377. fi
  378.  
  379.  
  380. # If we are compiling with gcc, enable all warning and make warnings errors.
  381. if test "$GCC" = yes; then
  382.     ENABLE_WARNINGS="-Wall"
  383.  
  384.     # does this compiler support -Wno-pointer-sign ?
  385.     AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
  386.  
  387.     safe_CFLAGS=$CFLAGS
  388.     CFLAGS="$ENABLE_WARNINGS -Wno-pointer-sign"
  389.  
  390.     AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
  391.         no_pointer_sign=yes
  392.         AC_MSG_RESULT([yes])
  393.         ], [
  394.         no_pointer_sign=no
  395.         AC_MSG_RESULT([no])
  396.         ])
  397.     CFLAGS=$safe_CFLAGS
  398.  
  399.     if test x$no_pointer_sign = xyes; then
  400.         ENABLE_WARNINGS="$ENABLE_WARNINGS -Wno-pointer-sign"
  401.     fi
  402. fi
  403. AC_SUBST(ENABLE_WARNINGS,$ENABLE_WARNINGS)
  404.  
  405. # See if we need to drop into the windows subdir.
  406. case $target in
  407.         *-*-mingw32* | *-*-cygwin* | *-*-windows*)
  408.         if test "$GCC" = yes -a \( "$CC" = "cc" -o "$CC" = "gcc" \); then
  409.             # does this compiler support -mno-cygwin?
  410.             AC_MSG_CHECKING([if $CC accepts -mno-cygwin])
  411.  
  412.             safe_CFLAGS="$CFLAGS"
  413.             CFLAGS="$ENABLE_WARNINGS -mno-cygwin"
  414.  
  415.             AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
  416.                 no_cygwin=yes
  417.                 AC_MSG_RESULT([yes])
  418.                 ], [
  419.                 no_cygwin=no
  420.                 AC_MSG_RESULT([no])
  421.                 ])
  422.             CFLAGS="$safe_CFLAGS"
  423.  
  424.             if test x$no_cygwin = xyes; then
  425.                 CFLAGS="${CFLAGS} -mno-cygwin"
  426.             else
  427.                 AC_MSG_NOTICE([Your compiler does not understand the -mno-cygwin option.])
  428.                 AC_MSG_NOTICE([You might want to select an alternative compiler, like])
  429.                 AC_MSG_NOTICE([])
  430.                 AC_MSG_NOTICE([CC=mingw32-gcc ./configure])
  431.                 AC_MSG_NOTICE([])
  432.             fi
  433.         fi
  434.  
  435.         AC_MSG_CHECKING([if linker accepts -static])
  436.  
  437.         safe_LDFLAGS="$LDFLAGS"
  438.         LDFLAGS="${LDFLAGS} -static"
  439.         AC_TRY_LINK(, [ int main () { return 0 ; } ], [
  440.             can_link_static=yes
  441.             AC_MSG_RESULT([yes])
  442.             ], [
  443.             can_link_static_cygwin=no
  444.             AC_MSG_RESULT([no])
  445.             ])
  446.         LDFLAGS="$safe_LDFLAGS"
  447.  
  448.         if test x$can_link_static = xyes; then
  449.             LDFLAGS="${LDFLAGS} -static"
  450.         fi
  451.  
  452.         WINDOWS_DIRS="windows"
  453.         CFLAGS="${CFLAGS} -DWIN32NATIVE"
  454.         ;;
  455. esac
  456. AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
  457.  
  458. AC_CONFIG_FILES([
  459.        doc/Makefile
  460.        windows/Makefile
  461.        avrdude.spec
  462.        Makefile
  463. ])
  464.  
  465. # The procedure to create avrdude.conf involves two steps.  First,
  466. # normal autoconf substitution will be applied, resulting in
  467. # avrdude.conf.tmp.  Finally, a sed command will be applied to filter
  468. # out unwanted parts (currently the parallel port programmer types)
  469. # based on previous configuration results, thereby producing the final
  470. # avrdude.conf file.
  471.  
  472. AC_CONFIG_FILES([avrdude.conf.tmp:avrdude.conf.in],
  473.         [sed $confsubst avrdude.conf.tmp > avrdude.conf],
  474.         [confsubst="$confsubst"])
  475.  
  476. AC_OUTPUT
  477.  
  478. echo ""
  479. echo ""
  480. echo "Configuration summary:"
  481. echo "----------------------"
  482.  
  483. if test x$have_libelf = xyes; then
  484.    echo "DO HAVE    libelf"
  485. else
  486.    echo "DON'T HAVE libelf"
  487. fi
  488.  
  489. if test x$have_libusb = xyes; then
  490.    echo "DO HAVE    libusb"
  491. else
  492.    echo "DON'T HAVE libusb"
  493. fi
  494.  
  495. if test x$have_libusb_1_0 = xyes; then
  496.    echo "DO HAVE    libusb_1_0"
  497. else
  498.    echo "DON'T HAVE libusb_1_0"
  499. fi
  500.  
  501. if test x$have_libftdi1 = xyes; then
  502.    echo "DO HAVE    libftdi1"
  503. else
  504.    echo "DON'T HAVE libftdi1"
  505. fi
  506.  
  507. if test x$have_libftdi = xyes; then
  508.    if test x$have_libftdi1 = xyes; then
  509.        echo "DO HAVE    libftdi (but prefer to use libftdi1)"
  510.    else
  511.        echo "DO HAVE    libftdi"
  512.    fi
  513. else
  514.    echo "DON'T HAVE libftdi"
  515. fi
  516.  
  517. if test x$have_libhid = xyes; then
  518.    echo "DO HAVE    libhid"
  519. else
  520.    echo "DON'T HAVE libhid"
  521. fi
  522.  
  523. if test x$have_pthread = xyes; then
  524.    echo "DO HAVE    pthread"
  525. else
  526.    echo "DON'T HAVE pthread"
  527. fi
  528.  
  529. if test x$enabled_doc = xyes; then
  530.    echo "ENABLED    doc"
  531. else
  532.    echo "DISABLED   doc"
  533. fi
  534.  
  535. if test x$enabled_parport = xyes; then
  536.    echo "ENABLED    parport"
  537. else
  538.    echo "DISABLED   parport"
  539. fi
  540.  
  541. if test x$enabled_linuxgpio = xyes; then
  542.    echo "ENABLED    linuxgpio"
  543. else
  544.    echo "DISABLED   linuxgpio"
  545. fi
Advertisement
Add Comment
Please, Sign In to add comment