]> granicus.if.org Git - re2c/commitdiff
Patch #914462 (automake build patch) by moriyoshi
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 13 Mar 2004 13:40:37 +0000 (13:40 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 13 Mar 2004 13:40:37 +0000 (13:40 +0000)
Slightly modified

.cvsignore
Makefile [deleted file]
Makefile.am [new file with mode: 0755]
README.in
autogen.sh [new file with mode: 0755]
basics.h
configure.in [new file with mode: 0644]
cvsclean.sh [new file with mode: 0755]
makerpm.in
parser.y

index 4b7fac55e596124cce9bd5fb034b7313e3977acc..3b2c6cfc35abafcb5bc2b06edb09c75b2a2e3441 100644 (file)
@@ -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 (file)
index 02958c5..0000000
--- 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 (executable)
index 0000000..62a564b
--- /dev/null
@@ -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
+
index f666f125c1a559acc7c97265f8eba855f90ae80e..c766db025ab6b46ba078c8b6088bf1b9ee680a35 100644 (file)
--- 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 <release>
     rpm -Uhv <packagedir>/re2c-RE2C_VERSION-<release>.rpm
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..e008aef
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+./cvsclean.sh
+aclocal
+autoheader
+automake -a -c -i --foreign
+autoconf
index a6bcf331ebdfde26445e3accdca256149aac09e1..f43c25acfba03f4280ad91755a6d3cd30340ff89 100644 (file)
--- 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 (file)
index 0000000..21a3fb9
--- /dev/null
@@ -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 (executable)
index 0000000..55fe6f6
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo `cat .cvsignore` | xargs rm -rf
index 6234f3bcc23ca75636e5a479908d4ee9cf33ca54..93e0681d5cc3637067302644ffbc674f83df2d60 100644 (file)
@@ -4,10 +4,10 @@
 # M.Boerger <re2c@somabo.de>
 
 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 <release>"
@@ -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 )
 
index 11f3be4a1120a6fa75932d88be51e5119ccbf422..e838a23049de3f63300f68dfabf2bc58b55e3bc9 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -2,10 +2,34 @@
 
 /* $Id$ */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_TIME_H
 #include <time.h>
-#include <iostream.h>
+#endif
+
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #include "globals.h"
 #include "parser.h"
 #include "version.h"