From e2698168fc351a74fb58a7c86306178aa3913a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Sun, 20 Sep 1998 01:34:06 -0700 Subject: [PATCH] made it possible to compile modules outside of source tree Rev: src/Makefile.in:1.117 Rev: src/aclocal.m4:1.1 Rev: src/modules/Gdbm/configure.in:1.3 Rev: src/modules/Gmp/configure.in:1.4 Rev: src/modules/Gz/configure.in:1.12 Rev: src/modules/Image/configure.in:1.9 Rev: src/modules/Image/encodings/configure.in:1.5 Rev: src/modules/MIME/configure.in:1.4 Rev: src/modules/Msql/configure.in:1.4 Rev: src/modules/Mysql/configure.in:1.6 Rev: src/modules/Odbc/configure.in:1.11 Rev: src/modules/Oracle/configure.in:1.12 Rev: src/modules/Pipe/configure.in:1.6 Rev: src/modules/Postgres/configure.in:1.8 Rev: src/modules/Regexp/configure.in:1.6 Rev: src/modules/Ssleay/configure.in:1.5 Rev: src/modules/Yp/configure.in:1.8 Rev: src/modules/_Crypto/configure.in:1.6 Rev: src/modules/_Image_JPEG/configure.in:1.4 Rev: src/modules/_Image_XFace/configure.in:1.3 Rev: src/modules/call_out/configure.in:1.6 Rev: src/modules/dynamic_module_makefile.in:1.44 Rev: src/modules/files/configure.in:1.59 Rev: src/modules/math/configure.in:1.7 Rev: src/modules/readline/configure.in:1.4 Rev: src/modules/spider/configure.in:1.24 Rev: src/modules/sprintf/configure.in:1.5 Rev: src/modules/static_module_makefile.in:1.37 Rev: src/modules/system/configure.in:1.28 Rev: src/pike-module.in:1.1 Rev: src/run_autoconfig:1.23 --- .gitattributes | 1 + src/Makefile.in | 34 +++- src/aclocal.m4 | 41 +++++ src/modules/Gdbm/configure.in | 4 +- src/modules/Gmp/configure.in | 4 +- src/modules/Gz/configure.in | 4 +- src/modules/Image/configure.in | 4 +- src/modules/Image/encodings/configure.in | 4 +- src/modules/MIME/configure.in | 4 +- src/modules/Msql/configure.in | 4 +- src/modules/Mysql/configure.in | 4 +- src/modules/Odbc/configure.in | 4 +- src/modules/Oracle/configure.in | 4 +- src/modules/Pipe/configure.in | 4 +- src/modules/Postgres/configure.in | 4 +- src/modules/Regexp/configure.in | 4 +- src/modules/Ssleay/configure.in | 4 +- src/modules/Yp/configure.in | 4 +- src/modules/_Crypto/configure.in | 4 +- src/modules/_Image_JPEG/configure.in | 4 +- src/modules/_Image_XFace/configure.in | 4 +- src/modules/call_out/configure.in | 4 +- src/modules/dynamic_module_makefile.in | 21 ++- src/modules/files/configure.in | 4 +- src/modules/math/configure.in | 4 +- src/modules/readline/configure.in | 4 +- src/modules/spider/configure.in | 4 +- src/modules/sprintf/configure.in | 4 +- src/modules/static_module_makefile.in | 7 +- src/modules/system/configure.in | 4 +- src/pike-module.in | 221 +++++++++++++++++++++++ src/run_autoconfig | 10 +- 32 files changed, 370 insertions(+), 65 deletions(-) create mode 100644 src/aclocal.m4 create mode 100644 src/pike-module.in diff --git a/.gitattributes b/.gitattributes index e390a9696d..e49bb4ded2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -80,6 +80,7 @@ testfont binary /man/pike.1 foreign_ident /src/Makefile.in foreign_ident /src/acconfig.h foreign_ident +/src/aclocal.m4 foreign_ident /src/alloca.c foreign_ident /src/array.c foreign_ident /src/array.h foreign_ident diff --git a/src/Makefile.in b/src/Makefile.in index 982d4a4bbe..31a36f7b4e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,5 +1,5 @@ # -# $Id: Makefile.in,v 1.116 1998/09/05 15:20:39 grubba Exp $ +# $Id: Makefile.in,v 1.117 1998/09/20 08:30:31 hubbe Exp $ # # This line is needed on some machines. @@ -201,7 +201,7 @@ interpret.o: $(SRCDIR)/interpret.c force : # install -install: pike hilfe +install: pike hilfe pike-module aclocal @echo @echo Installing Pike... @echo @@ -260,12 +260,29 @@ install: pike hilfe chmod u+w "$(exec_prefix)/hilfe"; \ fi; \ else : ; fi + @if [ -f ./pike-module ]; then \ + echo ; echo "Installing pike-module..."; \ + if cmp "$(exec_prefix)/pike-module" ./pike-module >/dev/null 2>&1 ; \ + then \ + echo "$(exec_prefix)/pike-module already installed." ; \ + else \ + if [ -f "$(exec_prefix)/pike-module" ]; then \ + mv "$(exec_prefix)/pike-module" "$(exec_prefix)/pike-module.old" || exit 1; \ + else : ; fi; \ + echo "$(exec_prefix)/pike-module"; \ + $(INSTALL) ./pike-module "$(exec_prefix)" || exit 1; \ + chmod a+rx "$(exec_prefix)/pike-module"; \ + chmod u+w "$(exec_prefix)/pike-module"; \ + fi; \ + else : ; fi @echo ; echo "Installing header-files..."; \ for a in $(SRCDIR)/*.h *.h ; do \ $(INSTALL) $$a "$(prefix)/include/pike" || exit 1; \ chmod a+r "$(prefix)/include/pike" ; \ chmod u+w "$(prefix)/include/pike" ; \ done + @$(INSTALL) modules/dynamic_module_makefile $(prefix)/include/pike/dynamic_module_makefile + @$(INSTALL) ./aclocal $(prefix)/include/pike/aclocal.m4 @echo ; echo "Installing modules written in Pike..."; \ for f in `cd "$(LIBDIR_SRC)"; find . -type f -print | grep -v '/CVS/'`; do \ if cmp "$(share_prefix)/$$f" "$(LIBDIR_SRC)/$$f" >/dev/null 2>&1 ; \ @@ -408,6 +425,19 @@ master.pike: $(LIBDIR_SRC)/master.pike.in Makefile sed -e 's!¤lib_prefix¤!$(TMP_LIBDIR)!' <$(LIBDIR_SRC)/master.pike.in \ | sed -e 's!¤share_prefix¤!$(LIBDIR_SRC)!' >master.pike +pike-module: $(SRCDIR)/pike-module.in Makefile ./pike + $(RUNPIKE) $(SRCDIR)/pike-module.in --fixate=$(SRCDIR)/pike-module.in \ + --set='make=$(MAKE)' --set='make_flags=$(MAKE_FLAGS)' \ + --set='prefix=$(prefix)' --set='pike=$(exec_prefix)/pike' \ + --set='include_path=$(prefix)/include/pike' \ + --set='lib_prefix=$(TMP_LIBDIR)' --set='share_prefix=$(LIBDIR_SRC)' \ + --output=pike-module + -@chmod +x pike-module + +aclocal: $(SRCDIR)/aclocal.m4 + echo >aclocal "define(PIKE_INCLUDE_PATH,$(prefix)/include/pike)" + cat >>aclocal $(SRCDIR)/aclocal.m4 + # make export archive (requires compiled Pike) # Do not compile in source tree if you want to use this! # Beware that export archive this includes bison/yacc/byacc source diff --git a/src/aclocal.m4 b/src/aclocal.m4 new file mode 100644 index 0000000000..65498892a0 --- /dev/null +++ b/src/aclocal.m4 @@ -0,0 +1,41 @@ +define([AC_LOW_MODULE_INIT], +[ +# $Id: aclocal.m4,v 1.1 1998/09/20 08:30:31 hubbe Exp $ + +AC_PROG_CC +AC_DEFINE(POSIX_SOURCE) +AC_SUBST_FILE(dependencies) +dependencies=$srcdir/dependencies + +AC_SUBST_FILE(dynamic_module_makefile) +AC_SUBST_FILE(static_module_makefile) +]) + + +define([AC_MODULE_INIT], +[ +AC_LOW_MODULE_INIT() + +ifdef([PIKE_INCLUDE_PATH], +[ +dynamic_module_makefile=PIKE_INCLUDE_PATH/dynamic_module_makefile +static_module_makefile=PIKE_INCLUDE_PATH/dynamic_module_makefile +],[ +dynamic_module_makefile=../dynamic_module_makefile +static_module_makefile=../static_module_makefile + +counter=. + +while test ! -f "$dynamic_module_makefile" +do + counter=.$counter + if test $counter = .......... ; then + exit 1 + else + : + fi + dynamic_module_makefile=../$dynamic_module_makefile + static_module_makefile=../$static_module_makefile +done +]) +]) diff --git a/src/modules/Gdbm/configure.in b/src/modules/Gdbm/configure.in index 2758d4d9d9..fbb9358958 100644 --- a/src/modules/Gdbm/configure.in +++ b/src/modules/Gdbm/configure.in @@ -1,10 +1,10 @@ -# $Id: configure.in,v 1.2 1998/03/28 14:55:20 grubba Exp $ +# $Id: configure.in,v 1.3 1998/09/20 08:30:50 hubbe Exp $ AC_INIT(gdbmmod.c) AC_CONFIG_HEADER(gdbm_machine.h) AC_ARG_WITH(gdbm, [ --with(out)-gdbm GNU database manager support ],[],[with_gdbm=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_gdbm = xyes; then AC_CHECK_HEADERS(gdbm.h) diff --git a/src/modules/Gmp/configure.in b/src/modules/Gmp/configure.in index 11e1abb2db..fb900b77dd 100644 --- a/src/modules/Gmp/configure.in +++ b/src/modules/Gmp/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.3 1998/07/11 15:56:18 grubba Exp $ +# $Id: configure.in,v 1.4 1998/09/20 08:30:58 hubbe Exp $ AC_INIT(mpz_glue.c) AC_CONFIG_HEADER(gmp_machine.h) AC_ARG_WITH(gmp, [ --with(out)-gmp Support bignums],[],[with_gmp=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_gmp = xyes ; then AC_CHECK_HEADERS(gmp2/gmp.h) diff --git a/src/modules/Gz/configure.in b/src/modules/Gz/configure.in index ad6c26a4ef..b2d7046ede 100644 --- a/src/modules/Gz/configure.in +++ b/src/modules/Gz/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.11 1998/07/18 00:07:05 grubba Exp $ +# $Id: configure.in,v 1.12 1998/09/20 08:31:07 hubbe Exp $ AC_INIT(zlibmod.c) AC_CONFIG_HEADER(zlib_machine.h) AC_ARG_WITH(zlib, [ --with(out)-zlib Support gzip compression],[],[with_zlib=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_zlib = xyes ; then AC_CHECK_HEADERS(zlib.h) diff --git a/src/modules/Image/configure.in b/src/modules/Image/configure.in index dbbae9f19b..8fccaa233b 100644 --- a/src/modules/Image/configure.in +++ b/src/modules/Image/configure.in @@ -1,10 +1,10 @@ -# $Id: configure.in,v 1.8 1998/03/28 14:48:42 grubba Exp $ +# $Id: configure.in,v 1.9 1998/09/20 08:31:15 hubbe Exp $ AC_INIT(image.c) AC_CONFIG_HEADER(config.h) AC_SET_MAKE -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_FUNC_MMAP diff --git a/src/modules/Image/encodings/configure.in b/src/modules/Image/encodings/configure.in index 739e1faa1f..c1f24fade4 100644 --- a/src/modules/Image/encodings/configure.in +++ b/src/modules/Image/encodings/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.4 1998/03/28 14:47:34 grubba Exp $ +# $Id: configure.in,v 1.5 1998/09/20 08:31:22 hubbe Exp $ AC_INIT(gif.c) AC_SET_MAKE -sinclude(../../module_configure.in) +AC_MODULE_INIT() AC_PROG_RANLIB AC_SUBST(RANLIB) diff --git a/src/modules/MIME/configure.in b/src/modules/MIME/configure.in index 6aed4d1fc6..fa32795d82 100644 --- a/src/modules/MIME/configure.in +++ b/src/modules/MIME/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.3 1998/03/28 14:46:31 grubba Exp $ +# $Id: configure.in,v 1.4 1998/09/20 08:31:29 hubbe Exp $ AC_INIT(mime.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_C_CHAR_UNSIGNED diff --git a/src/modules/Msql/configure.in b/src/modules/Msql/configure.in index a265f6f886..570d887513 100644 --- a/src/modules/Msql/configure.in +++ b/src/modules/Msql/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.3 1998/07/15 19:03:07 grubba Exp $ +dnl $Id: configure.in,v 1.4 1998/09/20 08:31:37 hubbe Exp $ dnl (C) 1997 Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> AC_INIT(msqlmod.c) @@ -9,7 +9,7 @@ AC_ARG_WITH(msql, [ --with(out)-msql mSQL Database engine support ],[] echo "Configuring msql module, (C) 1996,1997 Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>" -sinclude(../module_configure.in) +AC_MODULE_INIT() dnl set up "reasonable" search paths pike_msql_reasonable_prefixes="/usr/local /usr /opt" diff --git a/src/modules/Mysql/configure.in b/src/modules/Mysql/configure.in index 99c2eee075..5f95e0af28 100644 --- a/src/modules/Mysql/configure.in +++ b/src/modules/Mysql/configure.in @@ -1,5 +1,5 @@ # -# $Id: configure.in,v 1.5 1998/09/01 17:01:04 hubbe Exp $ +# $Id: configure.in,v 1.6 1998/09/20 08:31:46 hubbe Exp $ # # Configure script for the mysql-module # @@ -20,7 +20,7 @@ AC_INIT(mysql.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() OLD_LIBS=$LIBS OLD_LDFLAGS=$LDFLAGS diff --git a/src/modules/Odbc/configure.in b/src/modules/Odbc/configure.in index daa9d3073c..12296ec412 100644 --- a/src/modules/Odbc/configure.in +++ b/src/modules/Odbc/configure.in @@ -1,5 +1,5 @@ # -# $Id: configure.in,v 1.10 1998/07/13 02:01:40 mast Exp $ +# $Id: configure.in,v 1.11 1998/09/20 08:31:55 hubbe Exp $ # # Configure script for the odbc-module # @@ -9,7 +9,7 @@ AC_INIT(odbc.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() OLD_LIBS=$LIBS OLD_LDFLAGS=$LDFLAGS diff --git a/src/modules/Oracle/configure.in b/src/modules/Oracle/configure.in index df1d4dd7dd..691145b093 100755 --- a/src/modules/Oracle/configure.in +++ b/src/modules/Oracle/configure.in @@ -1,5 +1,5 @@ # -# $Id: configure.in,v 1.11 1998/05/23 23:10:02 grubba Exp $ +# $Id: configure.in,v 1.12 1998/09/20 08:32:03 hubbe Exp $ # # Configure script for the oracle module # @@ -7,7 +7,7 @@ AC_INIT(oracle.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() ORACLE_LIBS="" diff --git a/src/modules/Pipe/configure.in b/src/modules/Pipe/configure.in index bf51a9807e..ae4a007364 100644 --- a/src/modules/Pipe/configure.in +++ b/src/modules/Pipe/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.5 1998/05/17 18:53:28 grubba Exp $ +# $Id: configure.in,v 1.6 1998/09/20 08:32:11 hubbe Exp $ AC_INIT(pipe.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_HAVE_HEADERS(sys/mman.h linux/mman.h sys/file.h) AC_HAVE_FUNCS(mmap munmap geteuid seteuid setresuid madvise) diff --git a/src/modules/Postgres/configure.in b/src/modules/Postgres/configure.in index 08c2a8c237..3ee9ef3d08 100644 --- a/src/modules/Postgres/configure.in +++ b/src/modules/Postgres/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.7 1998/08/25 13:11:50 grubba Exp $ +dnl $Id: configure.in,v 1.8 1998/09/20 08:32:20 hubbe Exp $ dnl (C) 1997 Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> AC_INIT(postgres.c) @@ -16,7 +16,7 @@ AC_ARG_WITH(libpq-dir, [ --with-libpq-dir=dir look for library-files in dir], [pike_postgres_user_lib_directory=$withval]) -sinclude(../module_configure.in) +AC_MODULE_INIT() ac_pike_postgres_skip=no diff --git a/src/modules/Regexp/configure.in b/src/modules/Regexp/configure.in index 00a5fb4802..9dd3089e8f 100644 --- a/src/modules/Regexp/configure.in +++ b/src/modules/Regexp/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.5 1998/03/28 14:37:15 grubba Exp $ +# $Id: configure.in,v 1.6 1998/09/20 08:32:28 hubbe Exp $ AC_INIT(pike_regexp.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_HAVE_HEADERS(string.h) dnl diff --git a/src/modules/Ssleay/configure.in b/src/modules/Ssleay/configure.in index 66f1735040..3ba09fd86b 100644 --- a/src/modules/Ssleay/configure.in +++ b/src/modules/Ssleay/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.4 1998/03/28 14:33:55 grubba Exp $ +# $Id: configure.in,v 1.5 1998/09/20 08:32:36 hubbe Exp $ AC_INIT(ssleay.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_ARG_WITH(ssleay, [ --with-ssleay enable the ssleay-module],[],[with_ssleay=no]) diff --git a/src/modules/Yp/configure.in b/src/modules/Yp/configure.in index 48f77797b5..d93e49a985 100644 --- a/src/modules/Yp/configure.in +++ b/src/modules/Yp/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.7 1998/08/08 20:28:50 grubba Exp $ +# $Id: configure.in,v 1.8 1998/09/20 08:32:45 hubbe Exp $ AC_INIT(yp.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_CHECK_LIB(nsl, gethostbyname) diff --git a/src/modules/_Crypto/configure.in b/src/modules/_Crypto/configure.in index 15acbc8376..0ad5279dde 100755 --- a/src/modules/_Crypto/configure.in +++ b/src/modules/_Crypto/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.5 1998/03/28 14:28:56 grubba Exp $ +# $Id: configure.in,v 1.6 1998/09/20 08:32:53 hubbe Exp $ AC_INIT(crypto.c) AC_SET_MAKE -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_CONFIG_SUBDIRS(lib) diff --git a/src/modules/_Image_JPEG/configure.in b/src/modules/_Image_JPEG/configure.in index 2d5a5c502b..694914cac9 100644 --- a/src/modules/_Image_JPEG/configure.in +++ b/src/modules/_Image_JPEG/configure.in @@ -1,11 +1,11 @@ # -# $Id: configure.in,v 1.3 1998/03/28 13:44:57 grubba Exp $ +# $Id: configure.in,v 1.4 1998/09/20 08:33:00 hubbe Exp $ # AC_INIT(image_jpeg.c) AC_CONFIG_HEADER(config.h) AC_ARG_WITH(jpeglib, [ --with(out)-jpeglib Support JPEG (Image.JPEG)],[],[with_jpeglib=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_jpeglib = xyes ; then AC_CHECK_HEADERS(jpeglib.h) diff --git a/src/modules/_Image_XFace/configure.in b/src/modules/_Image_XFace/configure.in index 4c0910b87d..076ba28010 100755 --- a/src/modules/_Image_XFace/configure.in +++ b/src/modules/_Image_XFace/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.2 1998/03/28 14:54:37 grubba Exp $ +# $Id: configure.in,v 1.3 1998/09/20 08:33:08 hubbe Exp $ AC_INIT(image_xface.c) AC_CONFIG_HEADER(config.h) AC_ARG_WITH(gmp, [ --with(out)-gmp Support bignums],[],[with_gmp=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_gmp = xyes ; then AC_CHECK_HEADERS(gmp.h) diff --git a/src/modules/call_out/configure.in b/src/modules/call_out/configure.in index ac84937bd9..dd92e0762b 100644 --- a/src/modules/call_out/configure.in +++ b/src/modules/call_out/configure.in @@ -1,7 +1,7 @@ -# $Id: configure.in,v 1.5 1998/03/28 14:01:02 grubba Exp $ +# $Id: configure.in,v 1.6 1998/09/20 08:33:16 hubbe Exp $ AC_INIT(call_out.c) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_HAVE_HEADERS(sys/time.h) diff --git a/src/modules/dynamic_module_makefile.in b/src/modules/dynamic_module_makefile.in index 90b3d0006c..4033c7795f 100644 --- a/src/modules/dynamic_module_makefile.in +++ b/src/modules/dynamic_module_makefile.in @@ -1,5 +1,5 @@ # -# $Id: dynamic_module_makefile.in,v 1.43 1998/08/02 11:53:50 grubba Exp $ +# $Id: dynamic_module_makefile.in,v 1.44 1998/09/20 08:30:42 hubbe Exp $ # @@ -8,7 +8,12 @@ CPP=@CPP@ AR=@AR@ LIBGCC=@LIBGCC@ -PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../.. -I. $(MODULE_CPPFLAGS) $(DEFINES) -DDYNAMIC_MODULE +PIKE_SRC_DIR=$(SRCDIR)/../.. +BUILD_BASE=../.. +MODULE_BASE=.. +PIKE_INCLUDES=-I$(PIKE_SRC_DIR) -I$(BUILD_BASE) + +PREFLAGS=-I. -I$(SRCDIR) $(PIKE_INCLUDES) -I. $(MODULE_CPPFLAGS) $(DEFINES) -DDYNAMIC_MODULE CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @CCSHARED@ $(MODULE_CFLAGS) MAKE_FLAGS = "prefix=$(prefix)" "exec_prefix=$(exec_prefix)" "CC=$(CC) @CCSHARED@" "OTHERFLAGS=$(OTHERFLAGS)" "TMP_BINDIR=$(TMP_BINDIR)" "DEFINES=$(DEFINES)" "TMP_LIBDIR=$(TMP_LIBDIR)" "RUNPIKE=$(RUNPIKE)" "INSTALL=$(INSTALL)" "AR=$(AR)" $(MODULE_MAKE_FLAGS) @@ -33,14 +38,14 @@ modlist_headers: Makefile modlist_segment: Makefile echo "" >modlist_segment -Makefile: ../dynamic_module_makefile $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies config.status +Makefile: $(MODULE_BASE)/dynamic_module_makefile $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies config.status CONFIG_FILES=Makefile CONFIG_HEADERS="" ./config.status touch remake @echo "Run make again" @exit 1 -$(SRCDIR)/configure: $(SRCDIR)/configure.in $(SRCDIR)/../module_configure.in - cd $(SRCDIR) && autoconf +$(SRCDIR)/configure: $(SRCDIR)/configure.in $(PIKE_SRC_DIR)/aclocal.m4 + cd $(SRCDIR) && autoconf --localdir=$(PIKE_SRC_DIR) if [ -f $(SRCDIR)/acconfig.h ]; then \ cd $(SRCDIR) && autoheader; \ else :; fi @@ -58,7 +63,11 @@ clean: depend: - gcc -MM $(PREFLAGS) $(SRCDIR)/*.c | $(TMP_BINDIR)/fixdepends.sh $(SRCDIR) + gcc -MM $(PREFLAGS) $(SRCDIR)/*.c \ + |sed -e "s@ $(PIKE_SRC_DIR)/\([-a-zA-Z0-9.,_]*\)@ \$$(PIKE_SRC_DIR)/\1@g" \ + |sed -e "s@ $(SRCDIR)/\([-a-zA-Z0-9.,_]*\)@ \$$(SRCDIR)/\1@g" \ + |sed -e "s@ $(BUILD_BASE)/\([-a-zA-Z0-9.,_]*\)@ \$$(BUILD_BASE)/\1@g" \ + >$(SRCDIR)/dependencies for a in '' $(MODULE_SUBDIRS) ; do if test "x$$a" = "x"; then :; else echo making depend in $$a ; ( cd $$a ; $(MAKE) $(MAKE_FLAGS) depend ) ; fi ; done #verify / debug diff --git a/src/modules/files/configure.in b/src/modules/files/configure.in index 45156da374..538e5a6811 100644 --- a/src/modules/files/configure.in +++ b/src/modules/files/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.58 1998/08/07 00:21:33 grubba Exp $ +# $Id: configure.in,v 1.59 1998/09/20 08:33:25 hubbe Exp $ AC_INIT(file.c) AC_CONFIG_HEADER(file_machine.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_HAVE_HEADERS(sys/types.h arpa/inet.h sys/socketvar.h netinet/in.h \ sys/mount.h ustat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/param.h \ diff --git a/src/modules/math/configure.in b/src/modules/math/configure.in index 82d9a86c44..da42d743c1 100644 --- a/src/modules/math/configure.in +++ b/src/modules/math/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.6 1998/07/23 00:13:12 hubbe Exp $ +# $Id: configure.in,v 1.7 1998/09/20 08:33:34 hubbe Exp $ AC_INIT(math.c) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_CHECK_LIB(m, floor) if test "${ac_cv_lib_m}" = "no" -a "${pike_cv_sys_os}" = "Linux"; then diff --git a/src/modules/readline/configure.in b/src/modules/readline/configure.in index b261ddc11e..3f50a21743 100644 --- a/src/modules/readline/configure.in +++ b/src/modules/readline/configure.in @@ -1,9 +1,9 @@ -# $Id: configure.in,v 1.3 1998/08/02 19:20:22 grubba Exp $ +# $Id: configure.in,v 1.4 1998/09/20 08:33:42 hubbe Exp $ AC_INIT(readlinemod.c) AC_CONFIG_HEADER(readline_machine.h) AC_ARG_WITH(readline,[ --with(out)-readline support command line editing],[],[with_readline=yes]) -sinclude(../module_configure.in) +AC_MODULE_INIT() if test x$with_readline = xyes ; then AC_MSG_CHECKING(Checking for GNU directory) diff --git a/src/modules/spider/configure.in b/src/modules/spider/configure.in index 847767dadb..596e36051e 100644 --- a/src/modules/spider/configure.in +++ b/src/modules/spider/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.23 1998/03/28 13:52:29 grubba Exp $ +# $Id: configure.in,v 1.24 1998/09/20 08:33:50 hubbe Exp $ AC_INIT(spider.c) AC_CONFIG_HEADER(config.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_ARG_WITH(streamed_parser, [ --with-streamed-parser Enable the streamed-parser module.], [AC_DEFINE(ENABLE_STREAMED_PARSER)], []) diff --git a/src/modules/sprintf/configure.in b/src/modules/sprintf/configure.in index 73f335cab1..0d86e80d46 100644 --- a/src/modules/sprintf/configure.in +++ b/src/modules/sprintf/configure.in @@ -1,7 +1,7 @@ -# $Id: configure.in,v 1.4 1998/03/28 13:48:43 grubba Exp $ +# $Id: configure.in,v 1.5 1998/09/20 08:33:58 hubbe Exp $ AC_INIT(sprintf.c) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_OUTPUT(Makefile,echo FOO >stamp-h ) diff --git a/src/modules/static_module_makefile.in b/src/modules/static_module_makefile.in index c8c97652e5..015b932317 100644 --- a/src/modules/static_module_makefile.in +++ b/src/modules/static_module_makefile.in @@ -1,11 +1,12 @@ # -# $Id: static_module_makefile.in,v 1.36 1998/08/02 11:53:28 grubba Exp $ +# $Id: static_module_makefile.in,v 1.37 1998/09/20 08:30:42 hubbe Exp $ # CC=@CC@ CPP=@CPP@ AR=@AR@ +PIKE_SRC_DIR=$(SRCDIR)/../.. PREFLAGS=-I. -I$(SRCDIR) -I$(SRCDIR)/../.. -I../.. -I. -Dpike_module_init=pike_module_$(MODNAME)_init -Dpike_module_exit=pike_module_$(MODNAME)_exit $(MODULE_CPPFLAGS) $(DEFINES) CFLAGS=$(PREFLAGS) $(OTHERFLAGS) $(MODULE_CFLAGS) @@ -49,8 +50,8 @@ Makefile: ../static_module_makefile $(SRCDIR)/Makefile.in $(SRCDIR)/dependencies @echo "Run make again" @exit 1 -$(SRCDIR)/configure: $(SRCDIR)/configure.in $(SRCDIR)/../module_configure.in - cd $(SRCDIR) && autoconf +$(SRCDIR)/configure: $(SRCDIR)/configure.in $(PIKE_SRC_DIR)/aclocal.m4 + cd $(SRCDIR) && autoconf --localdir=$(PIKE_SRC_DIR) if [ -f $(SRCDIR)/acconfig.h ]; then \ cd $(SRCDIR) && autoheader; \ else :; fi diff --git a/src/modules/system/configure.in b/src/modules/system/configure.in index b5b28552cb..d7c9c8793b 100644 --- a/src/modules/system/configure.in +++ b/src/modules/system/configure.in @@ -1,8 +1,8 @@ -# $Id: configure.in,v 1.27 1998/08/04 23:25:35 grubba Exp $ +# $Id: configure.in,v 1.28 1998/09/20 08:34:06 hubbe Exp $ AC_INIT(system.c) AC_CONFIG_HEADER(system_machine.h) -sinclude(../module_configure.in) +AC_MODULE_INIT() AC_CHECK_LIB(bind, __inet_ntoa) AC_CHECK_LIB(socket, socket) diff --git a/src/pike-module.in b/src/pike-module.in new file mode 100644 index 0000000000..8fc99459d2 --- /dev/null +++ b/src/pike-module.in @@ -0,0 +1,221 @@ +#!¤pike¤ + +// Source directory +string srcdir; +string prefix="¤prefix¤"; +string lib_prefix="¤lib_prefix¤"; +string share_prefix="¤share_prefix¤"; +string make="¤make¤"; +string make_flags="¤make_flags¤"; +string include_path="¤include_path¤"; +string configure_command="configure"; + + +#define NOT 0 +#define AUTO 1 +#define ALWAYS 2 + +mapping(string:int) run= +([ + "automake":AUTO, + "autoheader":AUTO, + "autoconf":AUTO, + "configure":AUTO, + "make":AUTO, + ]); + +string fix(string path) +{ + if(search(path,"$src")==-1) return path; + if(!srcdir) + { + string s=Stdio.read_file("Makefile"); + if(s) + { + sscanf(s,"%*s\nSRCDIR=%s\n",srcdir); + } + if(!srcdir && file_stat("configure.in")) + { + srcdir="."; + } + + if(!srcdir) + { + werror("You must provide --source=<source dir>\n"); + exit(1); + } + } + return replace(path,"$src",srcdir); +} + +void do_zero() +{ + foreach(indices(run), string x) if(run[x]==1) m_delete(run,x); +} + +int max_time_of_files(string ... a) +{ + int t=0; + foreach(a,string file) + { + mixed s=file_stat(fix(file)); + if(!s) return 0; + t=max(t,s[3]); + } + return t; +} + + +int just_run(mapping options, string ... cmd) +{ + werror(" %s\n",cmd*" "); + return Process.create_process(cmd,options)->wait(); +} + +void run_or_fail(mapping options,string ... cmd) +{ + werror(" %s\n",cmd*" "); + int ret=Process.create_process(cmd,options)->wait(); + if(ret) + exit(ret); +} + + +int main(int argc, string *argv) +{ + foreach(Getopt.find_all_options(argv,aggregate( + ({"fixate",Getopt.NO_ARG,({"--fixate"}) }), + ({"set",Getopt.NO_ARG,({"--set"}) }), + ({"output",Getopt.NO_ARG,({"--output"}) }), + ({"autoconf",Getopt.NO_ARG,({"--autoconf"}) }), + ({"configure",Getopt.NO_ARG,({"--configure"}) }), + ({"autoheader",Getopt.NO_ARG,({"--autoheader"}) }), + ({"automake",Getopt.NO_ARG,({"--automake"}) }), + ({"all",Getopt.NO_ARG,({"--all"}) }), + ({"make",Getopt.NO_ARG,({"--make"}) }), + ({"auto",Getopt.NO_ARG,({"--auto"}) }), + ({"source",Getopt.HAS_ARG,({"--source"}) }), + )),array opt) + { + switch(opt[0]) + { + case "fixate": + string file=Stdio.read_file(opt[1]); + break; + case "set": + if(sscanf(opt[1],"%s=%s",string var, string value)) + { + file=replace(file,"¤"+var+"¤", + replace(value,"\"","\\\"")); + } + break; + + case "output": + rm(opt[1]); + Stdio.write_file(opt[1],file); + exit(0); + + case "source": srcdir=opt[1]; break; + case "automake": run->automake=ALWAYS; do_zero(); break; + case "autoheader": run->autoheader=ALWAYS; do_zero(); break; + case "autoconf": run->autoconf=ALWAYS; do_zero(); break; + case "configure": run->configure=ALWAYS; do_zero(); break; + case "make": run->make=ALWAYS; do_zero(); break; + + case "all": + run->autoheader=run->autoconf=run->configure=run->make-ALWAYS; + break; + + case "auto": + run->autoheader=run->autoconf=run->configure=run->make=1; + break; + } + } + + argv=Getopt.get_args(argv); + + int tmp1; + if(run->automake) + { + if(tmp1=max_time_of_files("$src/Makefile.am","$src/configure.in")) + { + if(run->automake == ALWAYS || + max_time_of_files("$src/Makefile.in") < tmp1) + { + run_or_fail((["dir":srcdir]),"aclocal"); + run_or_fail((["dir":srcdir]),"automake"); + rm(fix("$src/stamp-h.in")); + } + } + } + + if(run->autoheader) + { + if(tmp1=max_time_of_files("$src/acconfig.h","$src/configure.in")) + { + if(run->autoheader==ALWAYS || + max_time_of_files("$src/stamp-h.in") <= tmp1) + { + run_or_fail((["dir":srcdir]),"autoheader"); + rm(fix("$src/stamp-h.in")); + Stdio.write_file(fix("$src/stamp-h.in"),"foo\n"); + } + } + } + + if(run->autoconf) + { + if(tmp1=max_time_of_files("$src/configure.in")) + { + if(run->autoconf==ALWAYS || + max_time_of_files("$src/configure") <= tmp1) + { + run_or_fail((["dir":srcdir]),"autoconf","--localdir="+include_path); + } + } + } + + if(run->configure) + { + // If there is a makefile, we can use the auto-run-configure + // feature... + if(run->configure == ALWAYS || !max_time_of_files("Makefile")) + { + if(max_time_of_files("$src/configure")) + { + if(!max_time_of_files("config.cache") && + max_time_of_files(include_path+"/config.cache")) + { + Stdio.cp(include_path+"/config.cache","config.cache"); + } + run_or_fail(([]),srcdir+"/"+configure_command); + } + } + } + + if(run->make) + { + string *makecmd=({make})+ + Process.split_quoted_string(make_flags)-({""})+ + ({"PIKE_INCLUDES=-I"+include_path, + "PIKE_SRC_DIR="+include_path, + "BUILD_BASE="+include_path, + "MODULE_BASE="+include_path, + })+ + argv[1..]; + if(tmp1=max_time_of_files("Makefile")) + { + rm("remake"); + tmp1=just_run(([]),@makecmd); + if(tmp1) + { + if(max_time_of_files("remake")) + { + run_or_fail(([]),@makecmd); + }else{ + exit(tmp1); + } + } + } + } +} diff --git a/src/run_autoconfig b/src/run_autoconfig index d74107cf8c..52bd3bd464 100755 --- a/src/run_autoconfig +++ b/src/run_autoconfig @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: run_autoconfig,v 1.22 1998/04/03 14:00:10 grubba Exp $ +# $Id: run_autoconfig,v 1.23 1998/09/20 08:30:32 hubbe Exp $ # # Bootstrap script @@ -15,14 +15,16 @@ else cd "$1" fi +localdir=`pwd` + find . -type d -print|egrep -v '/(CVS)|(RCS)$'| while read dir; do if [ -f $dir/Makefile.am -a -f $dir/configure.in ]; then # aclocal needs to be run before autoconf echo "Running aclocal in $dir" - (cd $dir ; aclocal) + (cd $dir ; aclocal ) echo "Running automake in $dir" - (cd $dir ; automake) + (cd $dir ; automake ) fi if [ -f $dir/acconfig.h -a $dir/configure.in ]; then @@ -33,7 +35,7 @@ find . -type d -print|egrep -v '/(CVS)|(RCS)$'| while read dir; do if [ -f $dir/configure.in ]; then if grep AC_INIT $dir/configure.in >/dev/null; then echo "Running autoconf in $dir" - ( cd $dir ; autoconf ) + ( cd $dir ; autoconf --localdir=$localdir ) else echo "$dir seems to use Cygnus-configure." fi -- GitLab