From 51bd9e0bb971e7023c63269efe97bb9f49c62ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Wed, 9 Oct 1996 09:39:53 +0200
Subject: [PATCH] configure improved --with-xxx options

Rev: src/Makefile.src:1.11
Rev: src/README:1.2
Rev: src/configure.in:1.8
Rev: src/machine.h.in:1.7
Rev: src/modules/Makefile.src:1.7
Rev: src/modules/call_out/Makefile.src:1.4
Rev: src/modules/files/Makefile.src:1.4
Rev: src/modules/gdbmmod/Makefile.src:1.4
Rev: src/modules/gdbmmod/configure.in:1.2
Rev: src/modules/gmpmod/Makefile.src:1.4
Rev: src/modules/gmpmod/configure.in:1.3
Rev: src/modules/image/Makefile.src:1.4
Rev: src/modules/math/Makefile.src:1.4
Rev: src/modules/pipe/Makefile.src:1.4
Rev: src/modules/readlinemod/Makefile.src:1.4
Rev: src/modules/readlinemod/configure.in:1.4
Rev: src/modules/regexp/Makefile.src:1.4
Rev: src/modules/spider/Makefile.src:1.4
Rev: src/modules/sprintf/Makefile.src:1.4
Rev: src/testsuite.in:1.4
---
 src/Makefile.src                     | 14 ++--
 src/README                           | 44 +++++++++----
 src/configure.in                     | 96 ++++++++++++++++------------
 src/machine.h.in                     |  3 +
 src/modules/Makefile.src             |  2 +-
 src/modules/call_out/Makefile.src    |  2 +-
 src/modules/files/Makefile.src       |  4 +-
 src/modules/gdbmmod/Makefile.src     |  2 +-
 src/modules/gdbmmod/configure.in     |  8 ++-
 src/modules/gmpmod/Makefile.src      |  2 +-
 src/modules/gmpmod/configure.in      |  9 ++-
 src/modules/image/Makefile.src       |  2 +-
 src/modules/math/Makefile.src        |  2 +-
 src/modules/pipe/Makefile.src        |  2 +-
 src/modules/readlinemod/Makefile.src |  2 +-
 src/modules/readlinemod/configure.in | 13 ++--
 src/modules/regexp/Makefile.src      |  2 +-
 src/modules/spider/Makefile.src      |  2 +-
 src/modules/sprintf/Makefile.src     |  2 +-
 src/testsuite.in                     | 15 ++++-
 20 files changed, 141 insertions(+), 87 deletions(-)

diff --git a/src/Makefile.src b/src/Makefile.src
index 41491904a8..ccbded7699 100644
--- a/src/Makefile.src
+++ b/src/Makefile.src
@@ -37,32 +37,28 @@ PROFIL=
 #Enable warnings from the compiler, if wanted.
 #
 WARN=@WARN@
-#WARN=-W -Wunused -Wformat
-#WARN -Wunused -Wformat -Wuninitialized
-#WARN= -Wall -Wshadow -Dlint
 
 #add extra defines here
-# Be sure to use -g and -DDEBUG when looking for bugs
-DEBUGDEF=-DDEBUG
-DEFINES=-DDEFAULT_MASTER=\"$(lib_prefix)/master.pike\"
+# Be sure to use -g  when looking for bugs
+DEFINES=-DDEFAULT_MASTER=\"$(lib_prefix)/master.pike\" @CPPFLAGS@
 
 # -O should work with all compilers
 OPTIMIZE=@OPTIMIZE@
 
 # Preprocessor flags.
 PREFLAGS=-I. -I$(SRCDIR) $(DEFINES)
-OTHERFLAGS=$(DEBUGDEF) $(OSFLAGS) $(OPTIMIZE) $(WARN) $(PROFIL)
+OTHERFLAGS=@CFLAGS@ $(OSFLAGS) $(OPTIMIZE) $(WARN) $(PROFIL)
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 CC=@CC@
 CPP=@CPP@
 
 LD=$(CC)
-LDFLAGS=$(CFLAGS)
+LDFLAGS=$(CFLAGS) @LDFLAGS@
 
 RUNPIKE=$(TMP_BUILDDIR)/pike -m $(TMP_LIBDIR)/master.pike $(PIKEOPTS)
 
-MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC)" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "DEBUGDEF=$(DEBUGDEF)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)"
+MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC)" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "DEFINES=$(DEFINES)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)"
 
 # Add alloca.o if you don't have alloca() on your machine.
 # Add ualarm.o if you don't have ualarm() on your machine.
diff --git a/src/README b/src/README
index 7581a53997..0762833600 100644
--- a/src/README
+++ b/src/README
@@ -1,17 +1,31 @@
 This is what you need to do to install Pike:
 
 1) Run ./configure, this is a sh script that will generate machine.h and
-   Makefile from machine.h.in and Makefile.in, use --prefix=/foo/bar
-   if you want to install Pike in /foo/bar, default is /usr/local.
-
-   You might have to set the environment variables C_INCLUDE_PATH and
-   LD_LIBRARY_PATH to enable the configure script to find gdbm, readline
-   and gmp. If the configure script does not find those libraries those
-   modules will not be available.
-
-2) edit config.h and Makefile to suit your purposes.
+   Makefile from machine.h.in and Makefile.in.
+
+  Some options for ./configure are:
+  --prefix=/foo/bar   if you want to install Pike in /foo/bar,
+                      default is /usr/local.
+  --without-gdbm      compile without gdbm support
+  --without-gmp       compile without gmp support
+  --without-readline  compile without readline support
+  --without-debug     compile without runtime debugging
+
+   You might also want to set the following environment variables:
+   CFLAGS     Put extra flags for your C compiler here.
+   CPPFLAGS   Put extra flags for your C preprocessor here
+              (such as -I/usr/gnu/include)
+   LDFLAGS    Put extra flags to your linker here, such as -L/usr/gnu/lib
+              and -R/usr/gnu/lib
+
+   Use the above flags to make sure the configure script finds the gdbm,
+   gmp and readline libraries and include files if you need or want those 
+   modules. If the configure script doesn't find them, Pike will sill compile,
+   but without those modules.
+
+2) If needed, edit config.h and Makefile to suit your purposes.
    I've tried to make it so that you don't have to change config.h or
-   Makefile very much. If you need to do what you consider 'unnessecary
+   Makefile at all. If you need to do what you consider 'unnessecary
    changes' then mail me and I'll try to fit it into configure.
    If possible, use gnu make, gcc, gnu sed and bison.
 
@@ -44,15 +58,19 @@ What to do when it doesn't work:
 4) configure might have done something wrong, check machine.h and report
    any errors back to me.
 
-5) Try a different compiler, malloc, compiler-compiler and/or make.
+5) Your gmp/readline/gdbm libraries might not be working or incorrectly 
+   installed, start over by running configure with the approperiate
+   --without-xxx arguments.
+
+6) Try a different compiler, malloc, compiler-compiler and/or make.
    (if you have any other)
 
-6) On Linux Slackware machines (older than slackware 3.0), Pike sometimes
+7) On Linux Slackware machines (older than slackware 3.0), Pike sometimes
    fails to find -lm, this is because of a bug in /usr/lib/libm.sa
    (or possibly libg.a) in slackware.
    Compile with 'make EXTRALIBS="-lc -lm"' to get around this bug.
 
-7)
+8)
 If you find a bug in the interpreter, the first thing to do is to make sure
 the interpreter is compiled with DEBUG defined. If not recompile with DEBUG
 and see if you get another error. When you've done this, please report the
diff --git a/src/configure.in b/src/configure.in
index 73c7e4768c..b04632d6c6 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,7 +1,23 @@
 AC_INIT(interpret.c)
+
+if test x${CLAGS-} != x ; then
+  cflags_is_set=yes
+else
+  cflags_is_set=no
+fi
+
 AC_PROG_CC
 AC_C_CROSS
 
+AC_ARG_WITH(gdbm,    [  --without-gdbm         no GNU database manager support ])
+AC_ARG_WITH(gmp,     [  --without-gmp          no Support bignums])
+AC_ARG_WITH(readline,[  --without-readline     no support for command line editing])
+AC_ARG_WITH(debug,   [  --without-debug        disable run time self tests],[],[with_debug=yes])
+
+if test x$with_debug = xyes ; then
+  AC_DEFINE(DEBUG)
+fi
+
 #############################################################################
 
 # We need some special hacks when running slowaris
@@ -23,56 +39,53 @@ fi
 ])
 AC_MSG_RESULT($pike_cv_sys_os)
 
-dnl
-dnl This enables a mutex lock around accept() unfortunately
-dnl accept bangs out every 20000th time or so when linked
-dnl with libthreads.  Solaris...
-dnl
-dnl if test "$pike_cv_sys_os" = "Solaris"; then
-dnl   AC_DEFINE(SOLARIS)
-dnl  LIBS="$LIBS -lthread"
-dnl fi
-dnl
-
 #############################################################################
 
-OLD_CFLAGS="$CFLAGS"
-OPTIMIZE="";
-
-AC_MSG_CHECKING(-fast)
-AC_CACHE_VAL(pike_cv_option_fast,
-[
-  CFLAGS="$OLD_CFLAGS -fast"
-  AC_TRY_LINK([],[ exit(0); ],pike_cv_option_fast=yes,pike_cv_option_fast=no)
-])
-
-CFLAGS="$OLD_CFLAGS"
-
-if test "$pike_cv_option_fast" = "yes" ; then
-  OPTIMIZE="$OPTIMIZE -fast"
-  AC_MSG_RESULT(-fast found)
-else
-  AC_MSG_RESULT(-fast not found)
-
-  AC_MSG_CHECKING(-O)
-  AC_CACHE_VAL(pike_cv_option_opt,
+if test x${GCC-} != xyes -a $cflags_is_set = no; then
+  OLD_CFLAGS="$CFLAGS"
+  OPTIMIZE="";
+  
+  AC_MSG_CHECKING(-fast)
+  AC_CACHE_VAL(pike_cv_option_fast,
   [
-    CFLAGS="$OLD_CFLAGS -O"
-    AC_TRY_LINK([],[ exit(0); ],pike_cv_option_opt=yes,pike_cv_option_opt=no)
+    CFLAGS="$OLD_CFLAGS -fast"
+    AC_TRY_LINK([],[ exit(0); ],pike_cv_option_fast=yes,pike_cv_option_fast=no)
   ])
-
-  if test "$pike_cv_option_opt" = "yes" ; then
-    CFLAGS="$OLD_CFLAGS -O"
-    OPTIMIZE="$OPTIMIZE -O"
-    AC_MSG_RESULT(-O found)
+  
+  CFLAGS="$OLD_CFLAGS"
+  
+  if test "$pike_cv_option_fast" = "yes" ; then
+    OPTIMIZE="$OPTIMIZE -fast"
+    AC_MSG_RESULT(-fast found)
   else
-    AC_MSG_RESULT(-O not found)
+    AC_MSG_RESULT(-fast not found)
+  
+    case "${CFLAGS-}" in
+      *-O*) ;;
+      *)
+        AC_MSG_CHECKING(-O)
+        AC_CACHE_VAL(pike_cv_option_opt,
+        [
+          CFLAGS="$OLD_CFLAGS -O"
+          AC_TRY_LINK([],[ exit(0); ],pike_cv_option_opt=yes,pike_cv_option_opt=no)
+        ])
+      
+        if test "$pike_cv_option_opt" = "yes" ; then
+          CFLAGS="$OLD_CFLAGS -O"
+          OPTIMIZE="$OPTIMIZE -O"
+          AC_MSG_RESULT(-O found)
+        else
+          AC_MSG_RESULT(-O not found)
+        fi
+      
+        CFLAGS="$OLD_CFLAGS"
+      ;;
+    esac
   fi
-
-  CFLAGS="$OLD_CFLAGS"
 fi
 
 
+
 if test "$GCC" = "yes"; then
   WARN="-g -W -Wformat"
 
@@ -1054,6 +1067,7 @@ AC_SUBST(LIBDIR)
 AC_SUBST(BINDIR)
 AC_SUBST(BUILDDIR)
 AC_SUBST(DOCDIR)
+AC_SUBST(DEBUGDEF)
 
 AC_OUTPUT(Makefile,[echo foo >stamp-h])
 
diff --git a/src/machine.h.in b/src/machine.h.in
index 26f1c88c89..ab080e190d 100644
--- a/src/machine.h.in
+++ b/src/machine.h.in
@@ -1,6 +1,9 @@
 #ifndef MACHINE_H
 #define MACHINE_H
 
+/* Define this if you want run time self tests */
+#undef DEBUG
+
 /* Define for solaris */
 #undef SOLARIS
 
diff --git a/src/modules/Makefile.src b/src/modules/Makefile.src
index 2eb1d96039..dd3e534afc 100644
--- a/src/modules/Makefile.src
+++ b/src/modules/Makefile.src
@@ -3,7 +3,7 @@
 MODULES=@subdirs@
 MODULE_OBJS=@MODULE_OBJS@
 
-MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC)" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)"
+MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC)" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)" "DEFINES=$(DEFINES)"
 
 all: modules
 
diff --git a/src/modules/call_out/Makefile.src b/src/modules/call_out/Makefile.src
index d11d720fa7..7d64103705 100644
--- a/src/modules/call_out/Makefile.src
+++ b/src/modules/call_out/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=call_out.o
diff --git a/src/modules/files/Makefile.src b/src/modules/files/Makefile.src
index 997ece2688..4b89001269 100644
--- a/src/modules/files/Makefile.src
+++ b/src/modules/files/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=file.o efuns.o socket.o
@@ -32,3 +32,5 @@ gdb_verify: module_testsuite
 	@echo >>.gdbinit run -m @srcdir@/../../../lib/master.pike $(PIKEOPTS) @srcdir@/../../../bin/test_pike.pike module_testsuite -v -v -f
 	gdb ../../pike
 	@rm .gdbinit
+
+
diff --git a/src/modules/gdbmmod/Makefile.src b/src/modules/gdbmmod/Makefile.src
index 78f1592cdc..bf59f23126 100644
--- a/src/modules/gdbmmod/Makefile.src
+++ b/src/modules/gdbmmod/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=gdbmmod.o
diff --git a/src/modules/gdbmmod/configure.in b/src/modules/gdbmmod/configure.in
index 95e44af3ea..9daaf33ff3 100644
--- a/src/modules/gdbmmod/configure.in
+++ b/src/modules/gdbmmod/configure.in
@@ -1,12 +1,16 @@
 AC_INIT(gdbmmod.c)
 AC_CONFIG_HEADER(gdbm_machine.h)
 
+AC_ARG_WITH(gdbm,    [  --with(out)-gdbm       GNU database manager support ],[],[with_gdbm=yes])
+
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_SUBST(RANLIB)
 
-AC_CHECK_HEADERS(gdbm.h)
-AC_CHECK_LIB(gdbm, gdbm_open)
+if test x$with_gdbm = xyes; then
+  AC_CHECK_HEADERS(gdbm.h)
+  AC_CHECK_LIB(gdbm, gdbm_open)
+fi
 
 AC_OUTPUT(Makefile,echo FOO >stamp-h )
 
diff --git a/src/modules/gmpmod/Makefile.src b/src/modules/gmpmod/Makefile.src
index 79aeb10def..4ec8783f51 100644
--- a/src/modules/gmpmod/Makefile.src
+++ b/src/modules/gmpmod/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=mpz_glue.o
diff --git a/src/modules/gmpmod/configure.in b/src/modules/gmpmod/configure.in
index a46ff2f47d..bff2645771 100644
--- a/src/modules/gmpmod/configure.in
+++ b/src/modules/gmpmod/configure.in
@@ -1,13 +1,16 @@
 AC_INIT(mpz_glue.c)
 AC_CONFIG_HEADER(gmp_machine.h)
+AC_ARG_WITH(gmp,     [  --with(out)-gmp        Support bignums],[],[with_gmp=yes])
 
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_SUBST(RANLIB)
 
-AC_CHECK_HEADERS(gmp.h)
-if test $ac_cv_header_gmp_h = yes ; then
-  AC_CHECK_LIB(gmp, mpz_set_d)
+if test x$with_gmp = xyes ; then
+  AC_CHECK_HEADERS(gmp.h)
+  if test $ac_cv_header_gmp_h = yes ; then
+    AC_CHECK_LIB(gmp, mpz_set_d)
+  fi
 fi
 
 AC_OUTPUT(Makefile,echo FOO >stamp-h )
diff --git a/src/modules/image/Makefile.src b/src/modules/image/Makefile.src
index 793f177895..fe921440b0 100644
--- a/src/modules/image/Makefile.src
+++ b/src/modules/image/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @DEFS@
 
 FILES=image.o font.o quant.o lzw.o togif.o
diff --git a/src/modules/math/Makefile.src b/src/modules/math/Makefile.src
index 5925740edc..00cd60c6c1 100644
--- a/src/modules/math/Makefile.src
+++ b/src/modules/math/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=math.o
diff --git a/src/modules/pipe/Makefile.src b/src/modules/pipe/Makefile.src
index 74b1fec9d8..5b0fc841b3 100644
--- a/src/modules/pipe/Makefile.src
+++ b/src/modules/pipe/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @DEFS@
 
 FILES=pipe.o
diff --git a/src/modules/readlinemod/Makefile.src b/src/modules/readlinemod/Makefile.src
index 34bf52a050..f3b18e7e3e 100644
--- a/src/modules/readlinemod/Makefile.src
+++ b/src/modules/readlinemod/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=readlinemod.o
diff --git a/src/modules/readlinemod/configure.in b/src/modules/readlinemod/configure.in
index 27a2af217e..260f0e032d 100644
--- a/src/modules/readlinemod/configure.in
+++ b/src/modules/readlinemod/configure.in
@@ -1,16 +1,19 @@
 AC_INIT(readlinemod.c)
 AC_CONFIG_HEADER(readline_machine.h)
+AC_ARG_WITH(readline,[  --with(out)-readline   support command line editing],[],[with_readline=yes])
 
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_SUBST(RANLIB)
 
-AC_CHECK_HEADERS(readline.h history.h readline/readline.h history/history.h readline/history.h)
+if test x$with_readline = xyes ; then
+  AC_CHECK_HEADERS(readline.h history.h readline/readline.h history/history.h readline/history.h)
 
-if test $ac_cv_header_readline_h = yes -o $ac_cv_header_readline_readline_h = yes ; then
-  if test $ac_cv_header_history_h = yes -o $ac_cv_header_history_history_h = yes -o $ac_cv_header_readline_history_h = yes ; then
-    AC_CHECK_LIB(termcap, tputs)
-    AC_CHECK_LIB(readline, readline)
+  if test $ac_cv_header_readline_h = yes -o $ac_cv_header_readline_readline_h = yes ; then
+    if test $ac_cv_header_history_h = yes -o $ac_cv_header_history_history_h = yes -o $ac_cv_header_readline_history_h = yes ; then
+      AC_CHECK_LIB(termcap, tputs)
+      AC_CHECK_LIB(readline, readline)
+    fi
   fi
 fi
 
diff --git a/src/modules/regexp/Makefile.src b/src/modules/regexp/Makefile.src
index b5ae3c8973..7a19278f2e 100644
--- a/src/modules/regexp/Makefile.src
+++ b/src/modules/regexp/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=regexp.o glue.o
diff --git a/src/modules/spider/Makefile.src b/src/modules/spider/Makefile.src
index 5268a03831..9e68430b13 100644
--- a/src/modules/spider/Makefile.src
+++ b/src/modules/spider/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @DEFS@
 
 FILES=spider.o discdate.o stardate.o sdebug.o tree.o lock.o sharedmem.o streamed_parser.o encode_decode.o http_parse.o
diff --git a/src/modules/sprintf/Makefile.src b/src/modules/sprintf/Makefile.src
index f441dcaaa2..fd7767e1e5 100644
--- a/src/modules/sprintf/Makefile.src
+++ b/src/modules/sprintf/Makefile.src
@@ -1,6 +1,6 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../..:../..
-PREFLAGS=-I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
+PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS)
 
 FILES=sprintf.o
diff --git a/src/testsuite.in b/src/testsuite.in
index 35c70d9ac9..1d9d029b82 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -74,10 +74,21 @@ test_any([[
 #include <fifo.h>
 return 0;
 ]],0)
-  test_do(clone(Fifo))
-  re
+  test_true(objectp(clone(Fifo)))
+  test_true(objectp(clone(Queue)))
 ]])
 
+test_any([[
+#include <string.h>
+return 0;
+]],0)
+  test_true(objectp(clone(String_buffer)))
+  test_do(clone(String_buffer)->append("foo"))
+  test_do(add_constant("Flurp",clone(String_buffer)))
+  test_do(Flurp->append("test"))
+  test_do(Flurp->append("test"))
+  test_eq((string)Flurp,"testtest")
+  test_do(add_constant("Flurp"))
 
 // m_delete
 test_equal(([1:1]),m_delete(a(),0))
-- 
GitLab