Hi, I've built gpc-19980830 with egcs-1.1.1 using gcc-egcs-2.91.55.diff and the patch below. This patch ensures that -DEGCS is added to CFLAGS if gpc is built with egcs.
diff -urN gpc.orig/p/Make-lang.in gpc/p/Make-lang.in --- gpc.orig/p/Make-lang.in Mon Aug 31 03:05:02 1998 +++ gpc/p/Make-lang.in Sun Dec 6 13:39:11 1998 @@ -45,6 +45,11 @@ gpc_version=$(gpc_release) rts_version=$(gpc_release)
+is_egcs := $(shell if $(CC) --version | grep 'egcs' > /dev/null; then echo y; else echo n; fi) +ifeq ($(is_egcs),y) +GPC_EGCS_FLAG=-DEGCS +endif + # Extra flags to pass to recursive makes. GPC_FLAGS_TO_PASS = \ "CROSS=$(CROSS)" \ @@ -54,6 +59,7 @@ "BISONFLAGS=$(BISONFLAGS)" \ "CFLAGS=$(CFLAGS)" \ "X_CFLAGS=$(X_CFLAGS)" \ + "GPC_EGCS_FLAG=$(GPC_EGCS_FLAG)" \ "LDFLAGS=$(LDFLAGS)" \ "LEX=$(LEX)" \ "LEXFLAGS=$(LEXFLAGS)" \ @@ -219,7 +225,7 @@ $(srcdir)/p/doc/sets.texi
p/gpc.o: $(srcdir)/p/gpc.c $(CONFIG_H) gansidecl.h multilib.h Makefile $(lang_specs_files) - $(CC) -DGPC $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(CC) -DGPC $(GPC_EGCS_FLAG) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ -DGPC_MAJOR=""$(gpc_major)"" \ -DGPC_MINOR=""$(gpc_minor)"" \ -DGPC_RELEASE=""$(gpc_release)"" \ diff -urN gpc.orig/p/Makefile.in gpc/p/Makefile.in --- gpc.orig/p/Makefile.in Thu Jul 30 14:11:35 1998 +++ gpc/p/Makefile.in Sun Dec 6 13:39:41 1998 @@ -126,7 +126,7 @@ all.indirect: Makefile ../gpc1$(exeext) ../gpc-cpp$(exeext) ../libgpc.a
# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file. -INTERNAL_CFLAGS = $(CROSS) -DIN_GCC -DGPC +INTERNAL_CFLAGS = $(CROSS) -DIN_GCC -DGPC $(GPC_EGCS_FLAG)
# This is the variable actually used when we compile. ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \
-- Niels Kristian Bech Jensen - nkbj@image.dk - http://www.image.dk/~nkbj/
---------->> Stop software piracy --- use free software! <<----------
Hi!
Niels Kristian Bech Jensen wrote:
I've built gpc-19980830 with egcs-1.1.1 using gcc-egcs-2.91.55.diff and the patch below. This patch ensures that -DEGCS is added to CFLAGS if gpc is built with egcs.
Great! (-8
There is only one problem:
+is_egcs := $(shell if $(CC) --version | grep 'egcs' > /dev/null; then echo y; else echo n; fi)
This checks whether the EGCS compiler is used to compile GPC, not whether the EGCS source is used as the GPC backend. But never mind: We can use
+is_egcs := $(shell if cat $(srcdir)/version.c | grep 'egcs' > /dev/null; then echo y; else echo n; fi)
instead.
Thanks, (-:
Peter