From 2c7934a1ca74830d64e458714a864310e646d915 Mon Sep 17 00:00:00 2001 From: "Theodore A. Roth" Date: Fri, 14 Feb 2003 20:34:03 +0000 Subject: [PATCH] These changes add basic support for a autoconf/automake based build system. * .cvsignore: Ignore autoconf files. * AUTHORS: New file. * ChangeLog: New file. * Makefile: Removed file. * Makefile.am: New file. * NEWS: New file. * README: New file. * bootstrap: New file. * configure.ac: New file. * avr.c: Include ac_cfg.h (generated by autoconf). * config.c: Include ac_cfg.h. Include config_gram.h instead of y.tab.h. * config.h: If HAS_YYSTYPE is not defined, define YYSTYPE. * config_gram.y: Include ac_cfg.h. * fileio.c: Include ac_cfg.h. * lexer.l: Include config_gram.h instead of y.tab.h. * lists.c: Include ac_cfg.h. * main.c: Include ac_cfg.h. * par.c: Include ac_cfg.h. * pgm.c: Include ac_cfg.h. * ppi.c: Include ac_cfg.h. * stk500.c: Include ac_cfg.h. * term.c: Include ac_cfg.h. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@192 81a1dc3b-b13d-400b-aceb-764788c761c2 --- .cvsignore | 12 ++++++ AUTHORS | 0 ChangeLog | 0 Makefile | 115 -------------------------------------------------- Makefile.am | 63 +++++++++++++++++++++++++++ NEWS | 0 README | 0 avr.c | 2 + bootstrap | 30 +++++++++++++ config.c | 4 +- config.h | 2 +- config_gram.y | 2 + configure.ac | 32 ++++++++++++++ fileio.c | 2 + lexer.l | 2 +- lists.c | 3 ++ main.c | 2 + par.c | 2 + pgm.c | 2 + ppi.c | 2 + stk500.c | 2 + term.c | 1 + 22 files changed, 162 insertions(+), 118 deletions(-) create mode 100644 AUTHORS create mode 100644 ChangeLog delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100755 bootstrap create mode 100644 configure.ac diff --git a/.cvsignore b/.cvsignore index 66beb274..5fd94e38 100644 --- a/.cvsignore +++ b/.cvsignore @@ -6,3 +6,15 @@ lexer.c config_gram.c .cvsignore .depend +INSTALL +Makefile.in +ac_cfg.h.in +aclocal.m4 +autom4te.cache +configure +depcomp +install-sh +missing +mkinstalldirs +stamp-h.in + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..e69de29b diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/Makefile b/Makefile deleted file mode 100644 index 4d67530a..00000000 --- a/Makefile +++ /dev/null @@ -1,115 +0,0 @@ -# -# avrdude - A Downloader/Uploader for AVR device programmers -# Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean -# -# 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$ -# - -TARGET = avrdude - -PREFIX ?= /usr/local -BINDIR = ${PREFIX}/bin -MANDIR = ${PREFIX}/man/man1 -MANUAL = avrdude.1 -DOCDIR = ${PREFIX}/share/doc/avrdude -CONFIGDIR = ${PREFIX}/etc - -DIRS = ${BINDIR} ${MANDIR} ${DOCDIR} ${CONFIGDIR} - -INSTALL = /usr/bin/install -c -o root -g wheel - -CFLAGS += -Wall -DCONFIG_DIR=\"${CONFIGDIR}\" ${YYDEF} -#CFLAGS = -g -Wall -DCONFIG_DIR=\"${CONFIGDIR}\" ${YYDEF} -LDFLAGS = -YFLAGS = -t -d -v - -INSTALL_PROGRAM = ${INSTALL} -m 555 -s -INSTALL_DATA = ${INSTALL} -m 444 -INSTALL_MANUAL = ${INSTALL_DATA} - -LIBS = -lreadline - -YYDEF = -DYYSTYPE="struct token_t *" - -SRCS = config_gram.c avr.c config.c fileio.c lexer.c lists.c main.c par.c \ - pgm.c ppi.c stk500.c term.c - -OBJS = config_gram.o avr.o config.o fileio.o lexer.o lists.o main.o par.o \ - pgm.o ppi.o stk500.o term.o - -all : depend ${TARGET} - - -${TARGET} : ${OBJS} - ${CC} ${LDFLAGS} -o ${TARGET} ${OBJS} ${LIBS} - -clean : - rm -f *.o config_gram.c lexer.c ${TARGET} *~ *.core y.tab.h y.output - -install : dirs \ - ${BINDIR}/${TARGET} \ - ${MANDIR}/${MANUAL} \ - ${DOCDIR}/avrdude.pdf \ - ${CONFIGDIR}/avrdude.conf.sample \ - ${CONFIGDIR}/avrdude.conf - -dirs : - @for dir in ${DIRS}; do \ - if [ ! -d $$dir ]; then \ - echo "creating directory $$dir"; \ - mkdir -p $$dir; \ - fi \ - done - -${BINDIR}/${TARGET} : ${TARGET} - ${INSTALL_PROGRAM} ${TARGET} $@ - -${MANDIR}/${MANUAL} : ${MANUAL} - ${INSTALL_MANUAL} ${MANUAL} $@ - -${DOCDIR}/avrdude.pdf : avrdude.pdf - ${INSTALL_DATA} avrdude.pdf $@ - -${CONFIGDIR}/avrdude.conf.sample : avrdude.conf.sample - ${INSTALL_DATA} avrdude.conf.sample $@ - -${CONFIGDIR}/avrdude.conf : avrdude.conf.sample - @if [ -f ${CONFIGDIR}/avrdude.conf ]; then \ - export TS=`date '+%Y%m%d%H%M%S'`; \ - echo "NOTE: backing up ${CONFIGDIR}/avrdude.conf to ${CONFIGDIR}/avrdude.conf.$${TS}"; \ - cp -p ${CONFIGDIR}/avrdude.conf ${CONFIGDIR}/avrdude.conf.$${TS}; \ - fi - ${INSTALL_DATA} avrdude.conf.sample $@ - -.SUFFIXES: .c .y .l - -.y.c: - ${YACC} ${YFLAGS} -b y $< - mv -f y.tab.c $@ - -.l.c: - ${LEX} -t $< > $@ - -depend : - @if [ ! -f y.tab.h ]; then touch y.tab.h; fi - @${MAKE} config_gram.c lexer.c - @${CC} ${CFLAGS} -MM ${SRCS} > .depend - -include .depend - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..12a80db4 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,63 @@ +# +# avrdude - A Downloader/Uploader for AVR device programmers +# Copyright (C) 2003 Theodore A. Roth +# +# 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$ +# + +AM_YFLAGS = -d + +AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" + +bin_PROGRAMS = avrdude + +avrdude_SOURCES = \ + config_gram.y \ + lexer.l \ + avr.c \ + avr.h \ + avrpart.h \ + config.c \ + config.h \ + fileio.c \ + fileio.h \ + linux_ppdev.h \ + lists.c \ + lists.h \ + main.c \ + par.c \ + par.h \ + pgm.c \ + pgm.h \ + pindefs.h \ + ppi.c \ + ppi.h \ + stk500.c \ + stk500.h \ + stk500_private.h \ + term.c \ + term.h + +man_MANS = avrdude.1 + +sysconf_DATA = avrdude.conf + +avrdude.conf: avrdude.conf.sample + cp $< $@ + diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/README b/README new file mode 100644 index 00000000..e69de29b diff --git a/avr.c b/avr.c index 20df82a6..55a95ca9 100644 --- a/avr.c +++ b/avr.c @@ -19,6 +19,8 @@ /* $Id$ */ +#include "ac_cfg.h" + #include #include #include diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..9a5ef9d4 --- /dev/null +++ b/bootstrap @@ -0,0 +1,30 @@ +#! /bin/sh + +# autoconf-2.57 is preferred, but >= 2.53 should be ok + +if [ "x${AUTOHEADER}" = "x" ]; then + AUTOHEADER="autoheader-2.57" +fi + +if [ "x${AUTOCONF}" = "x" ]; then + AUTOCONF="autoconf-2.57" +fi + +# automake-1.7 is preferred, but >= 1.6 should be ok + +if [ "x${ACLOCAL}" = "x" ]; then + ACLOCAL="aclocal-1.7" +fi + +if [ "x${AUTOMAKE}" = "x" ]; then + AUTOMAKE="automake-1.7" +fi + +# Bootstrap the build system. + +set -x + +${ACLOCAL} +${AUTOHEADER} +${AUTOCONF} +${AUTOMAKE} -a -c diff --git a/config.c b/config.c index 0d643754..618850c8 100644 --- a/config.c +++ b/config.c @@ -19,6 +19,8 @@ /* $Id$ */ +#include "ac_cfg.h" + #include #include #include @@ -26,7 +28,7 @@ #include "avr.h" #include "config.h" -#include "y.tab.h" +#include "config_gram.h" char string_buf[MAX_STR_CONST]; char *string_buf_ptr; diff --git a/config.h b/config.h index 590ada5e..00fb4b91 100644 --- a/config.h +++ b/config.h @@ -54,7 +54,7 @@ extern char * infile; extern LISTID string_list; extern LISTID number_list; -#if 0 +#if !defined(HAS_YYSTYPE) #define YYSTYPE struct token_t * #endif extern YYSTYPE yylval; diff --git a/config_gram.y b/config_gram.y index 727602fc..20cfed6d 100644 --- a/config_gram.y +++ b/config_gram.y @@ -20,6 +20,8 @@ /* $Id$ */ %{ +#include "ac_cfg.h" + #include #include #include diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..b647a196 --- /dev/null +++ b/configure.ac @@ -0,0 +1,32 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT(avrdude, 3.1.0cvs, avrdude-dev@nongnu.org) +AC_PREREQ(2.53) +AC_CONFIG_SRCDIR([main.c]) +AM_INIT_AUTOMAKE +AM_CONFIG_HEADER([ac_cfg.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_YACC +AM_PROG_LEX + +# Checks for libraries. +AC_CHECK_LIB([termcap], [tputs]) +AC_CHECK_LIB([readline], [readline]) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/time.h termios.h unistd.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]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/fileio.c b/fileio.c index cf991cfc..37dfab35 100644 --- a/fileio.c +++ b/fileio.c @@ -19,6 +19,8 @@ /* $Id$ */ +#include "ac_cfg.h" + #include #include #include diff --git a/lexer.l b/lexer.l index cea7fbf7..45651e04 100644 --- a/lexer.l +++ b/lexer.l @@ -29,7 +29,7 @@ #include #include "config.h" -#include "y.tab.h" +#include "config_gram.h" #include "lists.h" extern int lineno; diff --git a/lists.c b/lists.c index e2f0592a..ab3b6972 100644 --- a/lists.c +++ b/lists.c @@ -36,6 +36,9 @@ Author : Brian Dean Date : 10 January, 1990 ------------------------------------------------------------------------*/ + +#include "ac_cfg.h" + #include #include diff --git a/main.c b/main.c index f01a3986..b1d51e93 100644 --- a/main.c +++ b/main.c @@ -65,6 +65,8 @@ * */ +#include "ac_cfg.h" + #include #include #include diff --git a/par.c b/par.c index 316836de..3dae6196 100644 --- a/par.c +++ b/par.c @@ -19,6 +19,8 @@ /* $Id$ */ +#include "ac_cfg.h" + #include #include #include diff --git a/pgm.c b/pgm.c index 5d12d148..21ab9bb1 100644 --- a/pgm.c +++ b/pgm.c @@ -19,6 +19,8 @@ /* $Id$ */ +#include "ac_cfg.h" + #include #include #include diff --git a/ppi.c b/ppi.c index 4aa16bbd..ce999049 100644 --- a/ppi.c +++ b/ppi.c @@ -21,6 +21,8 @@ #if defined(__FreeBSD__) || defined(__linux__) +#include "ac_cfg.h" + #include #include #include diff --git a/stk500.c b/stk500.c index 857b8f18..858bd1eb 100644 --- a/stk500.c +++ b/stk500.c @@ -28,6 +28,8 @@ * */ +#include "ac_cfg.h" + #include #include #include diff --git a/term.c b/term.c index bb4110ca..7b65fda3 100644 --- a/term.c +++ b/term.c @@ -19,6 +19,7 @@ /* $Id$ */ +#include "ac_cfg.h" #include #include