From 20c97ae7933557f18aeade296cd1192441e55268 Mon Sep 17 00:00:00 2001 From: "crowder%fiverocks.com" Date: Fri, 1 Jun 2007 18:31:02 +0000 Subject: [PATCH] backing out checkin on closed tree --- js/src/Makefile.ref | 26 ++++++++++++++++++++++++++ js/src/js.c | 9 +++++++++ 2 files changed, 35 insertions(+) diff --git a/js/src/Makefile.ref b/js/src/Makefile.ref index 91af44d7fdc..587ab86ce28 100644 --- a/js/src/Makefile.ref +++ b/js/src/Makefile.ref @@ -100,6 +100,25 @@ CFLAGS += -fp:precise endif endif # WINNT +# +# Ask perl what flags it was built with, so we can build js with similar flags +# and link properly. Viva gmake. +# +ifdef JS_PERLCONNECT +DEFINES += -DPERLCONNECT -D_GNU_SOURCE + +PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts) +PERLLDFLAGS := $(shell perl -MExtUtils::Embed -e ldopts) + +# perl erroneously reports compiler flag -rdynamic (interpreted by ld +# as -r) when it really meant -export-dynamic. +PERLLDFLAGS := $(subst -rdynamic,-export-dynamic,$(PERLLDFLAGS)) + +CFLAGS += $(PERLCFLAGS) +#LDFLAGS += $(PERLLDFLAGS) #PH removed this assgnment +INCLUDES += -I. #needed for perlconnect/jsperl.c +endif + # # Server-related changes : # @@ -240,6 +259,10 @@ ifdef JS_LIVECONNECT DIRS += liveconnect endif +ifdef JS_PERLCONNECT +JS_CFILES += perlconnect/jsperl.c +endif + ifdef JS_HAS_FILE_OBJECT JS_CFILES += jsfile.c JS_HFILES += jsfile.h @@ -257,6 +280,9 @@ else LIBRARY = $(OBJDIR)/libjs.a SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX) PROGRAM = $(OBJDIR)/js +ifdef JS_PERLCONNECT +PROG_LIBS += $(PERLLDFLAGS) +endif endif include rules.mk diff --git a/js/src/js.c b/js/src/js.c index 49ae2c6484d..e822f83ce9b 100644 --- a/js/src/js.c +++ b/js/src/js.c @@ -64,6 +64,10 @@ #include "jsscope.h" #include "jsscript.h" +#ifdef PERLCONNECT +#include "perlconnect/jsperl.h" +#endif + #ifdef LIVECONNECT #include "jsjava.h" #endif @@ -3194,6 +3198,11 @@ main(int argc, char **argv, char **envp) if (!JS_DefineFunctions(cx, it, its_methods)) return 1; +#ifdef PERLCONNECT + if (!JS_InitPerlClass(cx, glob)) + return 1; +#endif + #ifdef JSDEBUGGER /* * XXX A command line option to enable debugging (or not) would be good