From f1730891ab3ff7ae0314510a36b3af42f90c0818 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Thu, 1 Feb 2001 02:27:30 -0800
Subject: [PATCH] --without-dynamic modules should now work with post_modules
 [1132]

Rev: src/Makefile.in:1.245
Rev: src/dlopen.c:1.12
Rev: src/module.c:1.13
Rev: src/module_t.c:1.1
Rev: src/modules/static_module_makefile.in:1.61
---
 .gitattributes                        |  1 +
 src/Makefile.in                       | 27 ++++++++++++++++++---------
 src/dlopen.c                          |  4 ++--
 src/module.c                          |  8 +++++++-
 src/module_t.c                        | 11 +++++++++++
 src/modules/static_module_makefile.in |  6 +++---
 6 files changed, 42 insertions(+), 15 deletions(-)
 create mode 100644 src/module_t.c

diff --git a/.gitattributes b/.gitattributes
index 52f663d7a6..4a6032cf8f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -205,6 +205,7 @@ testfont binary
 /src/module.h foreign_ident
 /src/module_support.c foreign_ident
 /src/module_support.h foreign_ident
+/src/module_t.c foreign_ident
 /src/modules/CommonLog/Makefile.in foreign_ident
 /src/modules/CommonLog/acconfig.h foreign_ident
 /src/modules/CommonLog/clf.c foreign_ident
diff --git a/src/Makefile.in b/src/Makefile.in
index 9c93f9d5e2..1dc52d7646 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.244 2001/01/30 21:06:17 hubbe Exp $
+# $Id: Makefile.in,v 1.245 2001/02/01 10:27:28 hubbe Exp $
 #
 
 # This line is needed on some machines.
@@ -133,7 +133,6 @@ OBJ= \
  main.o \
  mapping.o \
  pike_memory.o \
- module.o \
  module_support.o \
  object.o \
  opcodes.o \
@@ -167,8 +166,9 @@ DEPEND= \
 # The following objectfiles differ between tpike & pike:
 #
 
-TOBJ = las_t.o builtin_functions_t.o peep_t.o
-POBJ = las.o builtin_functions.o peep.o
+TOBJ = las_t.o builtin_functions_t.o peep_t.o  module_t.o
+POBJ = las.o builtin_functions.o peep.o module.o
+
 
 #
 # User callable targets
@@ -185,6 +185,15 @@ post_modules: pike
 	   $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) || \
 	     ( test -f remake && $(MAKE) $(MAKE_PARALLEL) $(MAKE_FLAGS) ) ) || exit $$?
 
+post_modules/modlist_headers.h:
+	touch post_modules/modlist_headers.h
+
+post_modules/modlist.h:
+	touch post_modules/modlist.h
+
+post_modules/linker_options:
+	touch post_modules/linker_options
+
 compiler-warnings : clean
 	@echo Summarizing compiler warnings.
 	@echo
@@ -225,27 +234,27 @@ $(TMP_BUILDDIR)/tpike: precompile.sh-stamp
 # the recursive make of tpike-real above, that one will never start to
 # make the $(OBJ)s concurrently with this one. stamp-tpike-predep
 # records the $(POBJ) dependencies without tpike.
-pike: $(OBJ) master.pike modules/linker_options stamp-tpike-predep
+pike: $(OBJ) master.pike modules/linker_options stamp-tpike-predep post_modules/linker_options
 	$(MAKE) $(MAKE_FLAGS) $(MAKE_PARALLEL) $(POBJ)
 	-@if [ -f pike.old ] ; then rm -f pike.old || : ; else : ; fi
 	-@if [ -f pike.old.exe ] ; then rm -f pike.old.exe || : ; else : ; fi
 	-@if [ -f pike ] ; then mv pike pike.old || : ; else : ; fi
-	$(LD) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options` $(LIBS) -o pike
+	$(LD) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options post_modules/linker_options` $(LIBS) -o pike
 
 # purify
 pure: $(OBJ) $(POBJ) master.pike module_objects
 	-@mv pike pike.old 2>/dev/null || true
-	$(SMARTLINK) purify -max-threads=128 -thread_stack_change=8192 -free-queue-length=500 -inuse-at-exit=yes -chain-length=12 $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options` $(LIBS) -o pike
+	$(SMARTLINK) purify -max-threads=128 -thread_stack_change=8192 -free-queue-length=500 -inuse-at-exit=yes -chain-length=12 $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options  post_modules/linker_options` $(LIBS) -o pike
 
 # purecov
 cover: $(OBJ) $(POBJ) master.pike module_objects
 	-@mv pike pike.old 2>/dev/null || true
-	$(SMARTLINK) purecov purify -max-threads=128 -thread_stack_change=8192 -free-queue-length=500 -inuse-at-exit=yes -chain-length=12 $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options` $(LIBS) -o pike
+	$(SMARTLINK) purecov purify -max-threads=128 -thread_stack_change=8192 -free-queue-length=500 -inuse-at-exit=yes -chain-length=12 $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options  post_modules/linker_options` $(LIBS) -o pike
 
 # quantify
 quant: $(OBJ) $(POBJ) master.pike module_objects
 	-@mv pike pike.old 2>/dev/null || true
-	$(SMARTLINK) quantify $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options` $(LIBS) -o pike
+	$(SMARTLINK) quantify $(REALCC) $(LDFLAGS) $(OBJ) $(POBJ) `cat modules/linker_options  post_modules/linker_options` $(LIBS) -o pike
 
 atom: pike
 	atom pike -tool atom -env threads -g -v `find lib/modules -type f -name '*.so' -print | sed -e 's/^/-incobj /g'`
diff --git a/src/dlopen.c b/src/dlopen.c
index a3d679ca76..64c176085f 100644
--- a/src/dlopen.c
+++ b/src/dlopen.c
@@ -29,7 +29,7 @@ static char *dlerr=0;
  *  Separate RWX, RW and R memory sections.
  */
 
-/* #define DLDEBUG 1 */
+#define DLDEBUG 1
 #define DL_VERBOSE 1
 
 #define REALLY_FLUSH() /* do{ fflush(stderr); Sleep(500); }while(0) */
@@ -79,7 +79,7 @@ size_t STRNLEN(char *s, size_t maxlen)
 
 #else /* PIKE_CONCAT */
 
-RCSID("$Id: dlopen.c,v 1.11 2001/01/26 12:40:47 hubbe Exp $");
+RCSID("$Id: dlopen.c,v 1.12 2001/02/01 10:27:29 hubbe Exp $");
 
 #endif
 
diff --git a/src/module.c b/src/module.c
index 37091ad954..524b803abb 100644
--- a/src/module.c
+++ b/src/module.c
@@ -17,8 +17,11 @@
 #include "program_id.h"
 
 #include "modules/modlist_headers.h"
+#ifndef IN_TPIKE
+#include "post_modules/modlist_headers.h"
+#endif
 
-RCSID("$Id: module.c,v 1.12 2000/12/01 08:09:50 hubbe Exp $");
+RCSID("$Id: module.c,v 1.13 2001/02/01 10:27:29 hubbe Exp $");
 
 typedef void (*modfun)(void);
 
@@ -32,6 +35,9 @@ struct static_module
 static struct static_module module_list[] = {
   { "Builtin", low_init_main, low_exit_main }
 #include "modules/modlist.h"
+#ifndef IN_TPIKE
+#include "post_modules/modlist.h"
+#endif
   ,{ "Builtin2", init_main, exit_main }
 };
 
diff --git a/src/module_t.c b/src/module_t.c
new file mode 100644
index 0000000000..f6ee38ec17
--- /dev/null
+++ b/src/module_t.c
@@ -0,0 +1,11 @@
+/*
+ * $Id: module_t.c,v 1.1 2001/02/01 10:27:30 hubbe Exp $
+ *
+ * Used to strap pike.
+ * No post_modules in this one.
+ *
+ * Hubbe
+ */
+
+#define IN_TPIKE
+#include "module.c"
diff --git a/src/modules/static_module_makefile.in b/src/modules/static_module_makefile.in
index 8e8f014c1d..4824c3df1b 100644
--- a/src/modules/static_module_makefile.in
+++ b/src/modules/static_module_makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: static_module_makefile.in,v 1.60 2001/01/26 02:31:13 mast Exp $
+# $Id: static_module_makefile.in,v 1.61 2001/02/01 10:27:30 hubbe Exp $
 #
 
 
@@ -55,7 +55,7 @@ dummy:	linker_options modlist_headers modlist_segment module.pmod module.a
 	fi
 
 linker_options: Makefile $(MODULE_ARCHIVES)
-	echo >linker_options modules/$(MODNAME)/module.a $(MODULE_LDFLAGS)
+	echo >linker_options `pwd`/module.a $(MODULE_LDFLAGS)
 	@for a in '' $(MODULE_ARCHIVES) ; do \
 	  if test "x$$a" = "x"; then :; else \
 	    case "$$a" in \
@@ -63,7 +63,7 @@ linker_options: Makefile $(MODULE_ARCHIVES)
 		echo $$a \
 	      ;; \
 	      *) \
-		echo modules/$(MODNAME)/$$a \
+		echo `pwd`/$$a \
 	      ;; \
             esac >>linker_options; \
 	  fi; \
-- 
GitLab