From eb0d024ee1ca1cf55b813d4890d6eef388b5ef94 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Thu, 25 Jan 2007 07:58:55 +0000 Subject: [PATCH] Full automake/autoconf compliance for thrift Summary: Including the compiler!!! Reviewed By: automake git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664949 13f79535-47bb-0310-9956-ffa450edef68 --- bootstrap.sh | 32 +------ cleanup.sh | 41 +++++++++ compiler/cpp/Makefile.am | 23 +++++ compiler/cpp/Makefile.mcslee | 109 ----------------------- compiler/cpp/bootstrap.sh | 9 ++ compiler/cpp/cleanup.sh | 32 +++++++ compiler/cpp/configure.ac | 51 +++++++++++ compiler/cpp/src/thriftl.ll | 2 +- lib/cpp/bootstrap.sh | 32 +------ lib/cpp/cleanup.sh | 31 +++++++ lib/cpp/configure.ac | 2 + lib/cpp/src/server/TThreadPoolServer.cpp | 2 +- lib/java/src/transport/TTransport.java | 9 ++ lib/php/bootstrap.sh | 31 +------ lib/php/cleanup.sh | 31 +++++++ lib/py/bootstrap.sh | 31 +------ lib/py/cleanup.sh | 31 +++++++ 17 files changed, 267 insertions(+), 232 deletions(-) create mode 100755 cleanup.sh create mode 100644 compiler/cpp/Makefile.am delete mode 100644 compiler/cpp/Makefile.mcslee create mode 100755 compiler/cpp/bootstrap.sh create mode 100755 compiler/cpp/cleanup.sh create mode 100644 compiler/cpp/configure.ac create mode 100755 lib/cpp/cleanup.sh create mode 100755 lib/php/cleanup.sh create mode 100755 lib/py/cleanup.sh diff --git a/bootstrap.sh b/bootstrap.sh index 0d29bbe6..d88319ac 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,36 +1,8 @@ #!/bin/sh -subdirs="lib/cpp lib/php lib/py" - -rm -rf \ -AUTHORS \ -COPYING \ -ChangeLog \ -INSTALL \ -Makefile.am \ -Makefile \ -Makefile.in \ -Makefile.orig \ -NEWS \ -aclocal.m4 \ -autom4te.cache \ -autoscan.log \ -config.guess \ -config.h \ -config.hin \ -config.log \ -config.status \ -config.sub \ -configure \ -configure.scan \ -depcomp \ -.deps \ -install-sh \ -.libs \ -libtool \ -ltmain.sh \ -missing +subdirs="compiler/cpp lib/cpp lib/php lib/py" +./cleanup.sh echo "SUBDIRS = ${subdirs}" > Makefile.am aclocal diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 00000000..2cf4c00c --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +subdirs="compiler/cpp lib/cpp lib/php lib/py" + +rm -rf \ +AUTHORS \ +COPYING \ +ChangeLog \ +INSTALL \ +Makefile.am \ +Makefile \ +Makefile.in \ +Makefile.orig \ +NEWS \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.log \ +config.status \ +config.sub \ +configure \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +libtool \ +ltmain.sh \ +missing + +for subdir in ${subdirs}; do + if [ -x "${subdir}/cleanup.sh" ]; then + cwd="`pwd`" + cd ${subdir} + ./cleanup.sh + cd ${cwd} + fi +done diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am new file mode 100644 index 00000000..1678c262 --- /dev/null +++ b/compiler/cpp/Makefile.am @@ -0,0 +1,23 @@ +AM_YFLAGS = -d + +bin_PROGRAMS = thrift + +thrift_OBJDIR = obj + +thrift_SOURCES = src/thrifty.yy \ + src/thriftl.ll \ + src/main.cc \ + src/generate/t_generator.cc \ + src/generate/t_cpp_generator.cc \ + src/generate/t_java_generator.cc \ + src/generate/t_php_generator.cc \ + src/generate/t_xsd_generator.cc \ + src/generate/t_py_generator.cc + +thrift_CXXFLAGS = -Wall -Isrc +thrift_LDFLAGS = -Wall + +thrift_LDADD = @LEXLIB@ + +clean-local: + rm -rf thriftl.cc thrifty.cc thrifty.h diff --git a/compiler/cpp/Makefile.mcslee b/compiler/cpp/Makefile.mcslee deleted file mode 100644 index 218731cd..00000000 --- a/compiler/cpp/Makefile.mcslee +++ /dev/null @@ -1,109 +0,0 @@ -# Makefile for Thrift compiler. This Makefile assumes that you are running on -# some form of *NIX operating system with the following tools and packages -# installed: -# -# g++ -# flex -# bison -# libfl -# -# Author: -# Mark Slee - -# Default build rule -target: thrift - -# Tools -CC = g++ -LD = g++ -LEX = flex -YACC = bison -MKDIR = mkdir - -# Source directory -SRC_DIR = src/ - -# Object file directory -OBJ_DIR = obj/ - -# Generated source dir -GEN_DIR = $(SRC_DIR) - -# Output directory -BIN_DIR = bin/ - -# Source files -SRC_FILES = main.cc \ - generate/t_generator.cc \ - generate/t_xsd_generator.cc \ - generate/t_py_generator.cc \ - generate/t_java_generator.cc \ - generate/t_php_generator.cc \ - generate/t_cpp_generator.cc - -# Autogenerated files -GEN_FILES = thrifty.tab.hh \ - thrifty.tab.cc \ - lex.yy.cc - -# Object files -OBJ_FILES = ${SRC_FILES:.cc=.o} - -# Generated object files -GOB_FILES = thrifty.tab.o \ - lex.yy.o - -# Apply directory prefixes -SRCS = ${addprefix $(SRC_DIR), $(SRC_FILES)} -GENS = ${addprefix $(GEN_DIR), $(GEN_FILES)} -OBJS = ${addprefix $(OBJ_DIR), $(OBJ_FILES)} -GOBS = ${addprefix $(OBJ_DIR), $(GOB_FILES)} - -# Compile with strict warnings -CFL = -g -Wall -I$(SRC_DIR) -I$(OBJ_DIR) - -# Flex library -LIBS = -lfl - -# Build directories -obj_dirs: $(BIN_DIR) $(OBJ_DIR)parse $(OBJ_DIR)generate -$(BIN_DIR): - $(MKDIR) -p $(BIN_DIR) -$(OBJ_DIR)parse: - $(MKDIR) -p $(OBJ_DIR)parse -$(OBJ_DIR)generate: - $(MKDIR) -p $(OBJ_DIR)generate - -# Scanner generation -$(GEN_DIR)lex.yy.cc: $(SRC_DIR)thriftl.ll - $(LEX) -o$@ $(SRC_DIR)thriftl.ll -$(OBJ_DIR)lex.yy.o: $(GEN_DIR)lex.yy.cc - $(CC) $(CFL) -c -o $@ $(GEN_DIR)lex.yy.cc - -# Parser generation -$(GEN_DIR)thrifty.tab.hh: $(GEN_DIR)thrifty.tab.cc -$(GEN_DIR)thrifty.tab.cc: $(SRC_DIR)thrifty.yy - $(YACC) -d -o$(GEN_DIR)thrifty.tab.cc $(SRC_DIR)thrifty.yy -$(OBJ_DIR)thrifty.tab.o: $(GEN_DIR)thrifty.tab.cc - $(CC) $(CFL) -c -o $@ $(GEN_DIR)thrifty.tab.cc - -# C++ compilation -$(OBJS): $(SRCS) - $(CC) $(CFL) -c -o $@ ${subst $(OBJ_DIR),$(SRC_DIR),$*.cc} - -# Main build rule -thrift: obj_dirs $(OBJS) $(GOBS) - $(LD) $(CFL) -o $(BIN_DIR)thrift $(OBJS) $(GOBS) $(LIBS) - -# Install -install: thrift - sudo install bin/thrift /usr/local/bin/thrift - -# Remove auto-gen'd files and binaries -clean: - rm -fr \ - $(OBJ_DIR) \ - $(GENS) \ - $(BIN_DIR)thrift.exe \ - $(BIN_DIR)thrift - diff --git a/compiler/cpp/bootstrap.sh b/compiler/cpp/bootstrap.sh new file mode 100755 index 00000000..3189372b --- /dev/null +++ b/compiler/cpp/bootstrap.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +./cleanup.sh +autoscan +aclocal +libtoolize --automake +touch NEWS README AUTHORS ChangeLog +autoconf +automake -ac diff --git a/compiler/cpp/cleanup.sh b/compiler/cpp/cleanup.sh new file mode 100755 index 00000000..9cea039f --- /dev/null +++ b/compiler/cpp/cleanup.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +rm -rf \ +AUTHORS \ +COPYING \ +ChangeLog \ +INSTALL \ +Makefile \ +Makefile.in \ +Makefile.orig \ +NEWS \ +README \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.log \ +config.status \ +config.sub \ +configure \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +.in \ +libtool \ +ltmain.sh \ +Makefile.in \ +missing diff --git a/compiler/cpp/configure.ac b/compiler/cpp/configure.ac new file mode 100644 index 00000000..eadb7f1a --- /dev/null +++ b/compiler/cpp/configure.ac @@ -0,0 +1,51 @@ +AC_PREREQ(2.59) + +AC_INIT(thrift, 1.0) + +AM_PROG_LEX + +AC_PROG_YACC + +AM_INIT_AUTOMAKE + +AC_CHECK_HEADERS([stddef.h]) + +AC_CHECK_FUNCS([mkdir]) + +AC_CHECK_FUNCS([realpath]) + +AC_CHECK_FUNCS([strdup]) + +AC_FUNC_MALLOC + +AC_FUNC_REALLOC + +AC_FUNC_STAT + +AC_FUNC_VPRINTF + +AC_TYPE_SIZE_T + +AC_C_CONST + +AC_C_VOLATILE + +AC_HEADER_STDBOOL + +AC_HEADER_STDC + +AC_HEADER_TIME + +AC_PROG_CC + +AC_PROG_CXX + +AC_PROG_INSTALL + +AC_PROG_LIBTOOL + +CFLAGS="-O2" + +CXXFLAGS="-O2" + +AC_OUTPUT(Makefile) diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll index 80cbf878..855443b9 100644 --- a/compiler/cpp/src/thriftl.ll +++ b/compiler/cpp/src/thriftl.ll @@ -14,7 +14,7 @@ * Must be included AFTER parse/t_program.h, but I can't remember why anymore * because I wrote this a while ago. */ -#include "thrift.tab.hh" +#include "thrifty.h" void thrift_reserved_keyword(char* keyword) { yyerror("Cannot use reserved language keyword: \"%s\"\n", keyword); diff --git a/lib/cpp/bootstrap.sh b/lib/cpp/bootstrap.sh index 607655d0..34df69d9 100755 --- a/lib/cpp/bootstrap.sh +++ b/lib/cpp/bootstrap.sh @@ -1,36 +1,6 @@ #!/bin/sh -rm -rf \ -AUTHORS \ -COPYING \ -ChangeLog \ -INSTALL \ -Makefile \ -Makefile.in \ -Makefile.orig \ -NEWS \ -README \ -aclocal.m4 \ -autom4te.cache \ -autoscan.log \ -config.guess \ -config.h \ -config.hin \ -config.log \ -config.status \ -config.sub \ -configure \ -configure.scan \ -depcomp \ -.deps \ -install-sh \ -.libs \ -libtool \ -ltmain.sh \ -Makefile.in \ -missing - - +./cleanup.sh autoscan autoheader aclocal -I ./aclocal diff --git a/lib/cpp/cleanup.sh b/lib/cpp/cleanup.sh new file mode 100755 index 00000000..8e5d2172 --- /dev/null +++ b/lib/cpp/cleanup.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +rm -rf \ +AUTHORS \ +COPYING \ +ChangeLog \ +INSTALL \ +Makefile \ +Makefile.in \ +Makefile.orig \ +NEWS \ +README \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.log \ +config.status \ +config.sub \ +configure \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +libtool \ +ltmain.sh \ +Makefile.in \ +missing diff --git a/lib/cpp/configure.ac b/lib/cpp/configure.ac index 8763a4a0..d0fc7c14 100644 --- a/lib/cpp/configure.ac +++ b/lib/cpp/configure.ac @@ -48,6 +48,8 @@ AC_CHECK_HEADERS([sys/time.h]) AC_CHECK_HEADERS([unistd.h]) +AC_C_INLINE + AX_BOOST_BASE([1.33.1]) AX_EVENT_BASE([1.2.0]) diff --git a/lib/cpp/src/server/TThreadPoolServer.cpp b/lib/cpp/src/server/TThreadPoolServer.cpp index 2f85c8bb..1407b8cc 100644 --- a/lib/cpp/src/server/TThreadPoolServer.cpp +++ b/lib/cpp/src/server/TThreadPoolServer.cpp @@ -26,7 +26,7 @@ public: ~Task() {} - void run() { + void run() { try { while (processor_->process(input_, output_)) { if (!input_->getTransport()->peek()) { diff --git a/lib/java/src/transport/TTransport.java b/lib/java/src/transport/TTransport.java index 4664f3fe..890a8107 100644 --- a/lib/java/src/transport/TTransport.java +++ b/lib/java/src/transport/TTransport.java @@ -15,6 +15,15 @@ public abstract class TTransport { */ public abstract boolean isOpen(); + /** + * Is there more data to be read? + * + * @return True if the remote side is still alive and feeding us + */ + public boolean peek() { + return isOpen(); + } + /** * Opens the transport for reading/writing. * diff --git a/lib/php/bootstrap.sh b/lib/php/bootstrap.sh index 11f41a9a..b79e4310 100755 --- a/lib/php/bootstrap.sh +++ b/lib/php/bootstrap.sh @@ -1,35 +1,6 @@ #!/bin/sh -rm -rf \ -AUTHORS \ -COPYING \ -ChangeLog \ -INSTALL \ -Makefile \ -Makefile.in \ -Makefile.orig \ -NEWS \ -README \ -aclocal.m4 \ -autom4te.cache \ -autoscan.log \ -config.guess \ -config.h \ -config.hin \ -config.log \ -config.status \ -config.sub \ -configure \ -configure.scan \ -depcomp \ -.deps \ -install-sh \ -.libs \ -libtool \ -ltmain.sh \ -Makefile.in \ -missing - +./cleanup.sh aclocal touch NEWS README AUTHORS ChangeLog autoconf diff --git a/lib/php/cleanup.sh b/lib/php/cleanup.sh new file mode 100755 index 00000000..8e5d2172 --- /dev/null +++ b/lib/php/cleanup.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +rm -rf \ +AUTHORS \ +COPYING \ +ChangeLog \ +INSTALL \ +Makefile \ +Makefile.in \ +Makefile.orig \ +NEWS \ +README \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.log \ +config.status \ +config.sub \ +configure \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +libtool \ +ltmain.sh \ +Makefile.in \ +missing diff --git a/lib/py/bootstrap.sh b/lib/py/bootstrap.sh index 11f41a9a..b79e4310 100755 --- a/lib/py/bootstrap.sh +++ b/lib/py/bootstrap.sh @@ -1,35 +1,6 @@ #!/bin/sh -rm -rf \ -AUTHORS \ -COPYING \ -ChangeLog \ -INSTALL \ -Makefile \ -Makefile.in \ -Makefile.orig \ -NEWS \ -README \ -aclocal.m4 \ -autom4te.cache \ -autoscan.log \ -config.guess \ -config.h \ -config.hin \ -config.log \ -config.status \ -config.sub \ -configure \ -configure.scan \ -depcomp \ -.deps \ -install-sh \ -.libs \ -libtool \ -ltmain.sh \ -Makefile.in \ -missing - +./cleanup.sh aclocal touch NEWS README AUTHORS ChangeLog autoconf diff --git a/lib/py/cleanup.sh b/lib/py/cleanup.sh new file mode 100755 index 00000000..8e5d2172 --- /dev/null +++ b/lib/py/cleanup.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +rm -rf \ +AUTHORS \ +COPYING \ +ChangeLog \ +INSTALL \ +Makefile \ +Makefile.in \ +Makefile.orig \ +NEWS \ +README \ +aclocal.m4 \ +autom4te.cache \ +autoscan.log \ +config.guess \ +config.h \ +config.hin \ +config.log \ +config.status \ +config.sub \ +configure \ +configure.scan \ +depcomp \ +.deps \ +install-sh \ +.libs \ +libtool \ +ltmain.sh \ +Makefile.in \ +missing -- 2.17.1