You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2014/07/10 15:25:00 UTC

git commit: THRIFT-2602: Fix missing dist files Client: build process Patch: jfarrell

Repository: thrift
Updated Branches:
  refs/heads/master ef7d56c1d -> 4f54d13e7


THRIFT-2602: Fix missing dist files
Client: build process
Patch: jfarrell

Adding macro check around bison version and removing am__yacc_c2h and will
conditionally include the necessary h/hh file, this will fix the mentioned
missing .hh file in dist and make it compatible with automake 1.11 and above


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4f54d13e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4f54d13e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4f54d13e

Branch: refs/heads/master
Commit: 4f54d13e7924424358e401840f985936f9867274
Parents: ef7d56c
Author: jfarrell <jf...@apache.org>
Authored: Thu Jul 10 09:23:43 2014 -0400
Committer: jfarrell <jf...@apache.org>
Committed: Thu Jul 10 09:23:43 2014 -0400

----------------------------------------------------------------------
 aclocal/ac_prog_bison.m4    | 54 ++++++++++++++++++++++++++++++++++++++++
 compiler/cpp/src/thriftl.ll |  4 +++
 configure.ac                |  1 +
 3 files changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/4f54d13e/aclocal/ac_prog_bison.m4
----------------------------------------------------------------------
diff --git a/aclocal/ac_prog_bison.m4 b/aclocal/ac_prog_bison.m4
new file mode 100644
index 0000000..1e2d200
--- /dev/null
+++ b/aclocal/ac_prog_bison.m4
@@ -0,0 +1,54 @@
+dnl
+dnl Check Bison version
+dnl AC_PROG_BISON([MIN_VERSION=2.6])
+dnl
+dnl Will define BISON_USE_PARSER_H_EXTENSION if Automake is < 1.11
+dnl for use with .h includes.
+dnl
+
+AC_DEFUN([AC_PROG_BISON], [
+if test "x$1" = "x" ; then
+  bison_required_version="2.6"
+else
+  bison_required_version="$1"
+fi
+
+AC_CHECK_PROG(have_prog_bison, [bison], [yes],[no])
+
+AC_DEFINE_UNQUOTED([BISON_VERSION], [0.0], [Bison version if bison is not available])
+
+#Do not use *.h extension for parser header files, use newer *.hh
+bison_use_parser_h_extension=false
+
+if test "$have_prog_bison" = "yes" ; then
+  AC_MSG_CHECKING([for bison version >= $bison_required_version])
+  bison_version=`bison --version | head -n 1 | cut '-d ' -f 4`
+  AC_DEFINE_UNQUOTED([BISON_VERSION], [$bison_version], [Defines bison version])
+  if test "$bison_version" \< "$bison_required_version" ; then
+    BISON=:
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([Bison version 2.6 or higher must be installed on the system!])
+  else
+    AC_MSG_RESULT([yes])
+    BISON=bison
+    AC_SUBST(BISON)
+
+    #Verify automake version 1.11 headers for yy files are .h, > 1.12 uses .hh
+    automake_version=`automake --version | head -n 1 | cut '-d ' -f 4`
+    AC_DEFINE_UNQUOTED([AUTOMAKE_VERSION], [$automake_version], [Defines automake version])
+
+    if test "$automake_version" \< "1.12" ; then
+      #Use *.h extension for parser header file
+      bison_use_parser_h_extension=true
+      echo "Automake version < 1.12"
+      AC_DEFINE([BISON_USE_PARSER_H_EXTENSION], [1], [Use *.h extension for parser header file])
+    fi
+  fi
+else
+  BISON=:
+  AC_MSG_RESULT([NO])
+fi
+
+AM_CONDITIONAL([BISON_USE_PARSER_H_EXTENSION], [test x$bison_use_parser_h_extension = xtrue])
+AC_SUBST(BISON)
+])

http://git-wip-us.apache.org/repos/asf/thrift/blob/4f54d13e/compiler/cpp/src/thriftl.ll
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index aee4406..5afc601 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -61,7 +61,11 @@
  * Must be included AFTER parse/t_program.h, but I can't remember why anymore
  * because I wrote this a while ago.
  */
+#if defined(BISON_USE_PARSER_H_EXTENSION)
 #include "thrifty.h"
+#else
+#include "thrifty.hh"
+#endif
 
 void thrift_reserved_keyword(char* keyword) {
   yyerror("Cannot use reserved language keyword: \"%s\"\n", keyword);

http://git-wip-us.apache.org/repos/asf/thrift/blob/4f54d13e/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index e20dc64..49d704e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ AC_PROG_CXX
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 AC_PROG_MAKE_SET
+AC_PROG_BISON
 AC_PROG_YACC
 AC_PROG_LEX
 AM_PROG_LEX