From: helly Date: Sat, 13 Mar 2004 13:40:37 +0000 (+0000) Subject: Patch #914462 (automake build patch) by moriyoshi X-Git-Tag: 0.13.6~735 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3dd0956eac69429e23ecaa4695e915ddb2d6467;p=re2c Patch #914462 (automake build patch) by moriyoshi Slightly modified --- diff --git a/.cvsignore b/.cvsignore index 4b7fac55..3b2c6cfc 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,34 @@ re2c re2c.1 +.deps +autoscan.log +autom4te.cache +config.cache +configure +install-sh +README +aclocal.m4 +Makefile +Makefile.in +makerpm +config.h.in +config.status +config.log +config.sub +config.guess +config.h +depcomp +compile +missing +mkinstalldirs +stamp-h1 +stamp-h.in +parser.cc +scanner.cc +version.h +y.tab.c +y.tab.h +*~ +*.o +*.spec +.#* diff --git a/Makefile b/Makefile deleted file mode 100644 index 02958c5b..00000000 --- a/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -# $Id$ - -BIN = /usr/local/bin -MAN = /usr/local/man -RE2C_VERSION = 0.9.2 - -%.o : %.cc ; $(CC) -o $@ $(CFLAGS) -c $< -%.cc : %.y ; $(YACC) $(YFLAGS) $<; mv $(YTAB).c $@ - -%.cc: %.re - -@if test -x re2c; then \ - echo "re2c -s $< >$@"; \ - ./re2c -s $< >$@; \ - else \ - echo "cp -f bootstrap/$@ $@"; \ - cp -f bootstrap/$@ $@; \ - fi - -SOURCES = code.cc dfa.cc main.cc parser.y actions.cc scanner.re substr.cc\ - translate.cc -OBJS = code.o dfa.o main.o parser.o actions.o scanner.o substr.o\ - translate.o - -CC = g++ -CFLAGS = -O2 -Wall -I. -Wno-unused -Wno-parentheses -Wno-deprecated -YACC = bison -y -YFLAGS = -d -LDFLAGS = - -default: re2c - -clean: - rm -f *.o *.s y.tab.c y.tab.h parser.cc .version version.h - -dist-clean: clean - rm -f re2c scanner.cc README re2c.1 re2c.ps re2c*.spec makerpm - -parser.cc: parser.y - $(YACC) $(YFLAGS) parser.y - mv -f y.tab.c parser.cc - -re2c: README re2c.1 $(OBJS) - $(CC) -o $@ $(OBJS) $(LDFLAGS) - -re2c.ps: - gunzip -c doc/loplas.ps.gz > re2c.ps - -.version: - echo $(RE2C_VERSION) > .version - -version.h: - echo "#define RE2C_VERSION \"$(RE2C_VERSION)\"" > version.h - -README: - cat README.in | sed 's/RE2C_VERSION/$(RE2C_VERSION)/g' > README - -makerpm: - cat makerpm.in | sed 's/RE2C_VERSION/$(RE2C_VERSION)/g' > makerpm - chmod +x makerpm - -re2c.1: - cat re2c.1.in | sed 's/RE2C_VERSION/$(RE2C_VERSION)/g' > re2c.1 - -install: re2c re2c.1 - install -d $(BIN) - install -s re2c $(BIN) - install -d $(MAN)/man1 - install -m 0644 re2c.1 $(MAN)/man1 - -uninstall: - rm -f $(BIN)/re2c - rm -f $(MAN)/man1/re2c.1* - -dist: re2c scanner.cc - mkdir re2c-$(RE2C_VERSION) - cp -P `p4 files ... | sed s/\\\\/\\\\/depot\\\\/home\\\\/re2c\\\\/// | sed '/- delete/d' | sed s/#.*$$//` re2c-$(RE2C_VERSION)/ - tar zcf re2c-$(RE2C_VERSION).tar.gz re2c-$(RE2C_VERSION)/ - rm -rf re2c-$(RE2C_VERSION) - -# -# generated with "gcc -I. -MM -x c++ *.cc *.y *.re" -# and edited by hand -# -actions.o : actions.cc globals.h basics.h parser.h scanner.h \ - token.h substr.h re.h ins.h dfa.h -code.o : code.cc substr.h basics.h globals.h dfa.h re.h token.h \ - ins.h -dfa.o : dfa.cc globals.h basics.h substr.h dfa.h re.h token.h \ - ins.h -main.o : main.cc globals.h basics.h parser.h scanner.h token.h \ - substr.h re.h ins.h dfa.h version.h -substr.o : substr.cc substr.h basics.h -translate.o : translate.cc globals.h basics.h -scanner.o : scanner.re scanner.h token.h substr.h basics.h \ - parser.h re.h ins.h ./parser.o -parser.o : parser.y globals.h basics.h parser.h scanner.h token.h \ - substr.h re.h ins.h version.h diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 00000000..62a564b6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,47 @@ +# $Id$ + +bin_PROGRAMS = re2c +re2c_SOURCES = code.cc dfa.cc main.cc parser.cc actions.cc scanner.re substr.cc\ + translate.cc scanner.cc +man_MANS = re2c.1 +CXXFLAGS = -O2 -Wall -I. -Wno-unused -Wno-parentheses -Wno-deprecated +YFLAGS = -d +CLEANFILES = y.tab.c y.tab.h parser.cc re2c.1 version.h .version makerpm +EXTRA_DIST = $(man_MANS) README + +rpm-files: $(bin_PROGRAMS) $(EXTRA_DIST) + +main.cc: version.h + +parser.cc: version.h parser.y + $(YACC) $(YFLAGS) parser.y + mv -f y.tab.c parser.cc + +scanner.cc: scanner.re + -@if test -x re2c; then \ + echo "re2c -s $< >$@"; \ + re2c -s $< >$@; \ + else \ + echo "cp -f bootstrap/$@ $@"; \ + cp -f bootstrap/$@ $@; \ + fi + +re2c.ps: + gunzip -c doc/loplas.ps.gz > re2c.ps + +.version: + echo $(PACKAGE_VERSION) > .version + +version.h: + echo "#define RE2C_VERSION \"$(PACKAGE_VERSION)\"" > version.h + +README: + cat README.in | sed 's/RE2C_VERSION/$(PACKAGE_VERSION)/g' > README + +makerpm: + cat makerpm.in | sed 's/RE2C_VERSION/$(PACKAGE_VERSION)/g' > makerpm + chmod +x makerpm + +re2c.1: + cat re2c.1.in | sed 's/RE2C_VERSION/$(PACKAGE_VERSION)/g' > re2c.1 + diff --git a/README.in b/README.in index f666f125..c766db02 100644 --- a/README.in +++ b/README.in @@ -20,10 +20,14 @@ x86. You can compile your own version with other gcc version if you have yacc or any working bison version (tested up to bison 1.875). You can install this software by simple typing the following commands: + ./autogen.sh + ./configure make make install Or you can create a rpm package and install it by the following commands: + ./autogen.sh + ./configure make makerpm ./makerpm rpm -Uhv /re2c-RE2C_VERSION-.rpm diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..e008aef6 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,6 @@ +#!/bin/sh +./cvsclean.sh +aclocal +autoheader +automake -a -c -i --foreign +autoconf diff --git a/basics.h b/basics.h index a6bcf331..f43c25ac 100644 --- a/basics.h +++ b/basics.h @@ -2,9 +2,60 @@ #ifndef _basics_h #define _basics_h +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if SIZEOF_CHAR == 1 +typedef unsigned char byte; +#elif SIZEOF_SHORT == 1 +typedef unsigned short byte; +#elif SIZEOF_INT == 1 +typedef unsigned int byte; +#elif SIZEOF_LONG == 1 +typedef unsigned long byte; +#else +typedef unsigned char byte; +#endif + +#if SIZEOF_CHAR == 2 +typedef unsigned char word; +#elif SIZEOF_SHORT == 2 +typedef unsigned short word; +#elif SIZEOF_INT == 2 +typedef unsigned int word; +#elif SIZEOF_LONG == 2 +typedef unsigned long word; +#else +typedef unsigned short word; +#endif + +#if SIZEOF_CHAR == 4 +typedef unsigned char dword; +#elif SIZEOF_SHORT == 4 +typedef unsigned short dword; +#elif SIZEOF_INT == 4 +typedef unsigned int dword; +#elif SIZEOF_LONG == 4 +typedef unsigned long dword; +#else +typedef unsigned long dword; +#endif + +#ifndef HAVE_UINT typedef unsigned int uint; -typedef unsigned char uchar, byte; -typedef unsigned short ushort, word; -typedef unsigned long ulong, dword; +#endif + +#ifndef HAVE_UCHAR +typedef unsigned char uchar; +#endif + +#ifndef HAVE_USHORT +typedef unsigned short ushort; +#endif + +#ifndef HAVE_ULONG +typedef unsigned long ulong; +#endif #endif diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..21a3fb9c --- /dev/null +++ b/configure.in @@ -0,0 +1,54 @@ +AC_PREREQ([2.57]) +AC_INIT([re2c], [0.9.2]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR(actions.cc) +AM_CONFIG_HEADER(config.h) + +RE2C_VERSION=0.9.2 +AC_SUBST(PACKAGE_VERSION) + +# Checks for programs. +AC_PROG_YACC +AC_PROG_CXX +AC_PROG_CC +AC_PROG_INSTALL + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h malloc.h stddef.h stdlib.h string.h strings.h unistd.h memory.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_C_VOLATILE + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_MMAP +AC_CHECK_FUNCS([memset munmap strdup]) + +AC_CHECK_SIZEOF([char]) +AC_CHECK_SIZEOF([short]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) + +AC_CHECK_TYPE([uchar], [ + AC_DEFINE([HAVE_UCHAR], [1], [Define to 1 if you have uchar type definition]) +]) +AC_CHECK_TYPE([ushort], [ + AC_DEFINE([HAVE_USHORT], [1], [Define to 1 if you have uchar type definition]) +]) +AC_CHECK_TYPE([uint], [ + AC_DEFINE([HAVE_UINT], [1], [Define to 1 if you have uchar type definition]) +]) +AC_CHECK_TYPE([ulong], [ + AC_DEFINE([HAVE_ULONG], [1], [Define to 1 if you have uchar type definition]) +]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/cvsclean.sh b/cvsclean.sh new file mode 100755 index 00000000..55fe6f6d --- /dev/null +++ b/cvsclean.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo `cat .cvsignore` | xargs rm -rf diff --git a/makerpm.in b/makerpm.in index 6234f3bc..93e0681d 100644 --- a/makerpm.in +++ b/makerpm.in @@ -4,10 +4,10 @@ # M.Boerger PREFIX="re2c" -#VERSION=RE2C_VERSION +VERSION=RE2C_VERSION TARDIR="`basename \`pwd\``" RELEASE=${1:-1} -VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX-//g"`} +#VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX-//g"`} echo "Usage:" echo "$0 " @@ -18,8 +18,8 @@ echo -n "Building RPM version $VERSION, release: $RELEASE " sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n . echo -TAR=re2c-$VERSION.tar.gz -SPEC=re2c-$VERSION.spec +TAR=$PREFIX-$VERSION.tar.gz +SPEC=$PREFIX-$VERSION.spec # write out the .spec file sed -e "s/RPMVERSION/$VERSION/g" \ @@ -47,15 +47,17 @@ flexible. %setup -q -n RPMTARDIR %build -make clean +./autogen.sh +./configure \ + --prefix=%{_prefix} \ + make re2c #regenerate file scanner.cc rm -f scanner.cc make scanner.cc #regenerate re2c itself rm -f re2c -make re2c -make dist-clean +make rpm-files %install rm -rf $RPM_BUILD_ROOT @@ -93,7 +95,7 @@ SPECDIR=${RPMBASE}/SPECS SRCDIR=${RPMBASE}/SOURCES ( -make clean +#./cvsclean.sh cd .. tar czvf ${SRCDIR}/${TAR} $TARDIR ) diff --git a/parser.y b/parser.y index 11f3be4a..e838a230 100644 --- a/parser.y +++ b/parser.y @@ -2,10 +2,34 @@ /* $Id$ */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_TIME_H #include -#include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_MALLOC_H #include +#endif + +#ifdef HAVE_MEMORY_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + #include "globals.h" #include "parser.h" #include "version.h"