Rework yacc rule for gcc platforms.

Generalized the OSX ppc workaround for ancient bison versions,
factored out for all gcc platforms. Put bison version detection
into configure accordingly, to switch on that, and not on platform.
This commit is contained in:
Thorsten Behrens
2011-12-08 12:03:38 +01:00
parent 704ee5bc85
commit 456ec763d7
7 changed files with 36 additions and 59 deletions

View File

@@ -6790,6 +6790,7 @@ dnl ***************************************
dnl Checking for bison and flex
dnl ***************************************
AC_PATH_PROG(BISON, bison)
ANCIENT_BISON="NO"
if test -z "$BISON"; then
AC_MSG_ERROR([no bison found in \$PATH, install it])
else
@@ -6807,7 +6808,12 @@ else
else
AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
fi
if test "$_bison_longver" -lt 2000; then
ANCIENT_BISON="YES"
fi
fi
AC_SUBST(ANCIENT_BISON)
AC_PATH_PROG(FLEX, flex)
if test -z "$FLEX"; then
AC_MSG_ERROR([no flex found in \$PATH, install it])

View File

@@ -1657,6 +1657,7 @@ ToFile( "DPKG", "@DPKG@", "e" );
ToFile( "PKGMK", "@PKGMK@", "e" );
ToFile( "GNUMAKE", "@GNUMAKE@", "e" );
ToFile( "GNUTAR", "@GNUTAR@", "e" );
ToFile( "ANCIENT_BISON", "@ANCIENT_BISON@", "e" );
ToFile( "UPD", $UPD, "e" );
ToFile( "WORK_STAMP", $WORK_STAMP, "e" );
ToFile( "SOLARVER", $SOLARVER, "e" );

View File

@@ -81,17 +81,6 @@ gb_LinkTarget_LDFLAGS := \
$(subst -L../lib , ,$(SOLARLIB)) \
#man ld says: obsolete -Wl,-multiply_defined,suppress \
# YaccTarget class
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) --defines=$(4) -o $(3) $(1) )
endef
# ObjCxxObject class
define gb_ObjCxxObject__command

View File

@@ -124,16 +124,6 @@ define gb_Helper_convert_native
$(1)
endef
# YaccTarget class
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) --defines=$(4) -o $(3) $(1) )
endef
# AsmObject class
gb_AsmObject_get_source = $(1)/$(2).s

View File

@@ -25,6 +25,35 @@ gb_YACC := bison
gb_CLASSPATHSEP := :
# YaccTarget class
ifeq ($(ANCIENT_BISON),YES)
#
# There are ancient versions of bison out there, which do not handle
# well .cxx extensions, nor do they support --defines=<file>. The
# result is that the header is named <foo>.cxx.h instead of <foo>.hxx
# so we queue a mv to rename the header accordingly.
# One example is XCode versions 2.x, which are used on OSX ppc
# machines.
#
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) -d -o $(3) $(1) && mv $(3).h $(4) )
endef
else
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) --defines=$(4) -o $(3) $(1) )
endef
endif
# use CC/CXX if they are nondefaults
ifneq ($(origin CC),default)
gb_CC := $(CC)

View File

@@ -101,33 +101,6 @@ endif
gb_COMPILERNOOPTFLAGS := -O0
# YaccTarget class
ifeq ($(CPUNAME),POWERPC)
#
# PowerPC mac version of bison is ancient. it does not handle well
# .cxx extension nor does it support --defines=<file>
# the result is that the header is named <foo>.cxx.h instead of <foo>.hxx
# so we queue a mv to rename the header accordingly.
#
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) -d -o $(3) $(1) && mv $(3).h $(4) )
endef
else
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) --defines=$(4) -o $(3) $(1) )
endef
endif
# ObjCxxObject class
define gb_ObjCxxObject__command

View File

@@ -165,17 +165,6 @@ gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
gb_COMPILERNOOPTFLAGS := -O0
# YaccTarget class
define gb_YaccTarget__command
$(call gb_Output_announce,$(2),$(true),YAC,3)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(3)) && \
$(gb_YACC) $(T_YACCFLAGS) --defines=$(4) -o $(3) $(1) )
endef
# AsmObject class
gb_AsmObject_get_source = $(1)/$(2).s