2003-02-25 00:57:27 +00:00
|
|
|
#
|
|
|
|
# avrdude - A Downloader/Uploader for AVR device programmers
|
2004-01-27 04:27:18 +00:00
|
|
|
# Copyright (C) 2003, 2004 Theodore A. Roth <troth@openavr.org>
|
2003-02-25 00:57:27 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2003-02-14 20:34:03 +00:00
|
|
|
# Process this file with autoconf to produce a configure script.
|
2003-02-25 00:57:27 +00:00
|
|
|
|
2003-03-06 06:45:54 +00:00
|
|
|
AC_PREREQ(2.57)
|
2007-10-29 23:08:37 +00:00
|
|
|
AC_INIT(avrdude, 5.6cvs, avrdude-dev@nongnu.org)
|
2003-02-25 00:57:27 +00:00
|
|
|
|
|
|
|
AC_CANONICAL_BUILD
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
AC_CANONICAL_TARGET
|
|
|
|
|
2003-02-14 20:34:03 +00:00
|
|
|
AC_CONFIG_SRCDIR([main.c])
|
2003-03-06 06:45:54 +00:00
|
|
|
AM_INIT_AUTOMAKE
|
2006-12-21 22:01:30 +00:00
|
|
|
AM_CONFIG_HEADER(ac_cfg.h)
|
2003-02-14 20:34:03 +00:00
|
|
|
|
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_YACC
|
|
|
|
AM_PROG_LEX
|
2007-01-25 20:51:11 +00:00
|
|
|
AC_PROG_RANLIB
|
2003-02-14 20:34:03 +00:00
|
|
|
|
|
|
|
# Checks for libraries.
|
|
|
|
AC_CHECK_LIB([termcap], [tputs])
|
2003-05-05 02:29:28 +00:00
|
|
|
AC_CHECK_LIB([ncurses], [tputs])
|
2003-02-14 20:34:03 +00:00
|
|
|
AC_CHECK_LIB([readline], [readline])
|
2006-09-24 13:35:40 +00:00
|
|
|
AH_TEMPLATE([HAVE_LIBUSB],
|
|
|
|
[Define if USB support is enabled via libusb])
|
|
|
|
AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes])
|
|
|
|
if test x$have_libusb = xyes; then
|
|
|
|
case $target in
|
|
|
|
*-*-darwin*)
|
|
|
|
LIBUSB="-lusb -framework CoreFoundation -framework IOKit"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LIBUSB="-lusb"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_DEFINE([HAVE_LIBUSB])
|
|
|
|
fi
|
2006-08-11 16:00:12 +00:00
|
|
|
AC_SUBST(LIBUSB, $LIBUSB)
|
2003-02-14 20:34:03 +00:00
|
|
|
|
2007-01-12 22:41:05 +00:00
|
|
|
# Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_CHECK_HEADERS([limits.h stdlib.h string.h])
|
|
|
|
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h])
|
|
|
|
AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
|
|
|
|
#include <setupapi.h>])
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
|
|
|
AC_HEADER_TIME
|
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
AC_PROG_GCC_TRADITIONAL
|
|
|
|
AC_FUNC_MALLOC
|
|
|
|
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday])
|
|
|
|
|
2006-12-20 23:43:34 +00:00
|
|
|
AC_MSG_CHECKING([for a Win32 HID libray])
|
|
|
|
SAVED_LIBS="${LIBS}"
|
|
|
|
case $target in
|
2007-01-12 22:41:05 +00:00
|
|
|
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
2006-12-20 23:43:34 +00:00
|
|
|
LIBHID="-lhid -lsetupapi"
|
2007-01-12 22:41:05 +00:00
|
|
|
if test $ac_cv_header_ddk_hidsdi_h = yes
|
|
|
|
then
|
|
|
|
HIDINCLUDE="#include <ddk/hidsdi.h>"
|
|
|
|
else
|
|
|
|
HIDINCLUDE="#include \"my_ddk_hidsdi.h\""
|
|
|
|
fi
|
2006-12-20 23:43:34 +00:00
|
|
|
;;
|
|
|
|
*)
|
2007-01-12 22:41:05 +00:00
|
|
|
LIBHID=""
|
2006-12-20 23:43:34 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
LIBS="${LIBS} ${LIBHID}"
|
|
|
|
|
|
|
|
AH_TEMPLATE([HAVE_LIBHID],
|
|
|
|
[Define if HID support is enabled via the Win32 DDK])
|
|
|
|
AC_TRY_RUN([#include <windows.h>
|
|
|
|
#include <setupapi.h>
|
|
|
|
$HIDINCLUDE
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
GUID hidGuid;
|
|
|
|
HidD_GetHidGuid(&hidGuid);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
], [have_libhid=yes], [have_libhid=no], [have_libhid=no])
|
|
|
|
AC_MSG_RESULT([$have_libhid])
|
|
|
|
if test x$have_libhid = xyes; then
|
|
|
|
AC_DEFINE([HAVE_LIBHID])
|
|
|
|
else
|
|
|
|
LIBHID=""
|
|
|
|
fi
|
|
|
|
LIBS="${SAVED_LIBS}"
|
2007-01-12 22:41:05 +00:00
|
|
|
AC_SUBST(LIBHID, $LIBHID)
|
2003-02-14 20:34:03 +00:00
|
|
|
|
2003-02-25 00:57:27 +00:00
|
|
|
# Checks for misc stuff.
|
|
|
|
|
2003-03-06 07:48:08 +00:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[versioned-doc],
|
|
|
|
AC_HELP_STRING(
|
|
|
|
[--enable-versioned-doc],
|
|
|
|
[install docs in directory with version name (default)]),
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) versioned_doc=yes ;;
|
|
|
|
no) versioned_doc=no ;;
|
|
|
|
*) AC_MSG_ERROR(bad value ${enableval} for versioned-doc option) ;;
|
|
|
|
esac],
|
|
|
|
[versioned_doc=yes])
|
|
|
|
|
|
|
|
if test "$versioned_doc" = "yes"; then
|
|
|
|
DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude-$(VERSION)'
|
|
|
|
else
|
|
|
|
DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude'
|
|
|
|
fi
|
|
|
|
|
2005-02-10 14:54:57 +00:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[doc],
|
|
|
|
AC_HELP_STRING(
|
|
|
|
[--enable-doc],
|
2006-11-07 20:32:41 +00:00
|
|
|
[Enable building documents]),
|
2005-02-10 14:54:57 +00:00
|
|
|
[case "${enableval}" in
|
|
|
|
yes) enabled_doc=yes ;;
|
|
|
|
no) enabled_doc=no ;;
|
|
|
|
*) AC_MSG_ERROR(bad value ${enableval} for disable-doc option) ;;
|
|
|
|
esac],
|
|
|
|
[enabled_doc=no])
|
|
|
|
|
2005-11-01 23:02:06 +00:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[parport],
|
|
|
|
AC_HELP_STRING(
|
|
|
|
[--enable-parport],
|
|
|
|
[Enable accessing parallel ports(default)]),
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) enabled_parport=yes ;;
|
|
|
|
no) enabled_parport=no ;;
|
|
|
|
*) AC_MSG_ERROR(bad value ${enableval} for enable-parport option) ;;
|
|
|
|
esac],
|
|
|
|
[enabled_parport=yes])
|
|
|
|
|
2005-02-10 14:54:57 +00:00
|
|
|
DIST_SUBDIRS_AC='doc windows'
|
|
|
|
|
2007-01-30 14:41:57 +00:00
|
|
|
if test "$enabled_doc" = "yes"; then
|
|
|
|
SUBDIRS_AC='doc @WINDOWS_DIRS@'
|
|
|
|
else
|
|
|
|
SUBDIRS_AC='@WINDOWS_DIRS@'
|
2005-02-10 14:54:57 +00:00
|
|
|
fi
|
|
|
|
|
2003-03-06 07:48:08 +00:00
|
|
|
AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
|
2005-11-01 23:02:06 +00:00
|
|
|
AC_SUBST(SUBDIRS_AC, $SUBDIRS_AC)
|
2005-02-10 14:54:57 +00:00
|
|
|
AC_SUBST(DIST_SUBDIRS_AC, $DIST_SUBDIRS_AC)
|
|
|
|
|
2003-03-06 07:48:08 +00:00
|
|
|
|
2003-02-25 00:57:27 +00:00
|
|
|
# Find the parallel serial device files based on target system
|
|
|
|
# If a system doesn't have a PC style parallel, mark it as unknown.
|
|
|
|
case $target in
|
2005-11-28 09:47:23 +00:00
|
|
|
i[[3456]]86-*-linux*|x86_64-*-linux*)
|
2003-02-25 00:57:27 +00:00
|
|
|
DEFAULT_PAR_PORT="/dev/parport0"
|
|
|
|
DEFAULT_SER_PORT="/dev/ttyS0"
|
|
|
|
;;
|
|
|
|
*-*-linux*)
|
|
|
|
DEFAULT_PAR_PORT="unknown"
|
|
|
|
DEFAULT_SER_PORT="/dev/ttyS0"
|
|
|
|
;;
|
2005-11-28 09:47:23 +00:00
|
|
|
i[[3456]]86-*-freebsd*|amd64-*-freebsd*)
|
2003-02-25 00:57:27 +00:00
|
|
|
DEFAULT_PAR_PORT="/dev/ppi0"
|
|
|
|
DEFAULT_SER_PORT="/dev/cuaa0"
|
|
|
|
;;
|
|
|
|
*-*-freebsd*)
|
|
|
|
DEFAULT_PAR_PORT="unknown"
|
|
|
|
DEFAULT_SER_PORT="/dev/cuaa0"
|
|
|
|
;;
|
2005-11-01 23:02:06 +00:00
|
|
|
*-*-solaris*)
|
2005-11-03 22:37:37 +00:00
|
|
|
DEFAULT_PAR_PORT="/dev/printers/0"
|
2005-11-01 23:02:06 +00:00
|
|
|
DEFAULT_SER_PORT="/dev/term/a"
|
|
|
|
;;
|
2003-02-25 00:57:27 +00:00
|
|
|
*-*-msdos* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
|
|
|
DEFAULT_PAR_PORT="lpt1"
|
|
|
|
DEFAULT_SER_PORT="com1"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
DEFAULT_PAR_PORT="unknown"
|
|
|
|
DEFAULT_SER_PORT="unknown"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2005-11-01 23:02:06 +00:00
|
|
|
if test "$enabled_parport" = "yes"; then
|
|
|
|
AC_MSG_CHECKING([for parallel device])
|
|
|
|
if test "$DEFAULT_PAR_PORT" = "unknown"; then
|
|
|
|
AC_MSG_NOTICE([parallel port access disabled for this system])
|
|
|
|
enabled_parport=no
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$DEFAULT_PAR_PORT])
|
|
|
|
fi
|
|
|
|
AC_SUBST(DEFAULT_PAR_PORT, $DEFAULT_PAR_PORT)
|
|
|
|
fi
|
2003-02-25 00:57:27 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for serial device])
|
|
|
|
AC_MSG_RESULT([$DEFAULT_SER_PORT])
|
|
|
|
AC_SUBST(DEFAULT_SER_PORT, $DEFAULT_SER_PORT)
|
|
|
|
|
2005-11-01 23:02:06 +00:00
|
|
|
if test "$enabled_parport" = "yes"; then
|
|
|
|
AC_DEFINE(HAVE_PARPORT, 1, [parallel port access enabled])
|
|
|
|
confsubst="-e /^@HAVE_PARPORT_/d"
|
|
|
|
else
|
|
|
|
confsubst="-e /^@HAVE_PARPORT_BEGIN@/,/^@HAVE_PARPORT_END@/d"
|
|
|
|
fi
|
|
|
|
export confsubst
|
|
|
|
|
2003-02-26 00:14:54 +00:00
|
|
|
# See if we need to drop into the windows subdir.
|
|
|
|
case $target in
|
|
|
|
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
|
|
|
WINDOWS_DIRS="windows"
|
2007-01-12 22:41:05 +00:00
|
|
|
CFLAGS="${CFLAGS} -mno-cygwin -DWIN32NATIVE"
|
2006-11-08 12:37:05 +00:00
|
|
|
LDFLAGS="${LDFLAGS} -static"
|
2003-02-26 00:14:54 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
|
|
|
|
|
2003-09-05 04:23:27 +00:00
|
|
|
# If we are compiling with gcc, enable all warning and make warnings errors.
|
|
|
|
if test "$GCC" = yes; then
|
|
|
|
ENABLE_WARNINGS="-Wall"
|
|
|
|
fi
|
|
|
|
AC_SUBST(ENABLE_WARNINGS,$ENABLE_WARNINGS)
|
|
|
|
|
2003-02-26 00:14:54 +00:00
|
|
|
AC_CONFIG_FILES([
|
2007-01-30 14:41:57 +00:00
|
|
|
doc/Makefile
|
2005-02-10 15:39:42 +00:00
|
|
|
windows/Makefile
|
|
|
|
avrdude.spec
|
|
|
|
Makefile
|
2003-02-26 00:14:54 +00:00
|
|
|
])
|
2005-02-10 14:54:57 +00:00
|
|
|
|
2005-11-01 23:02:06 +00:00
|
|
|
# The procedure to create avrdude.conf involves two steps. First,
|
|
|
|
# normal autoconf substitution will be applied, resulting in
|
|
|
|
# avrdude.conf.tmp. Finally, a sed command will be applied to filter
|
|
|
|
# out unwanted parts (currently the parallel port programmer types)
|
|
|
|
# based on previous configuration results, thereby producing the final
|
|
|
|
# avrdude.conf file.
|
|
|
|
|
|
|
|
AC_CONFIG_FILES([avrdude.conf.tmp:avrdude.conf.in],
|
|
|
|
[sed $confsubst avrdude.conf.tmp > avrdude.conf])
|
2005-02-10 14:54:57 +00:00
|
|
|
|
2005-11-01 23:02:06 +00:00
|
|
|
AC_OUTPUT
|