diff options
Diffstat (limited to 'source4')
47 files changed, 3172 insertions, 924 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in deleted file mode 100644 index bf7b1d4895..0000000000 --- a/source4/Makefile.in +++ /dev/null @@ -1,589 +0,0 @@ -######################################################################### -# Makefile.in for Samba - rewritten for autoconf support -# Copyright Andrew Tridgell 1992-2003 -# Copyright (C) 2001 by Martin Pool <mbp@samba.org> -# Copyright (C) 2002 Andrew Bartlett <abartlet@samba.org> -# Copyright (C) 2003 Anthony Liguori <aliguor@us.ibm.com> -# Copyright (C) 2003 James Myers <myersjj@samba.org> -# Copyright (C) 2002-2003 Jelmer Vernooij <jelmer@samba.org> -# Copyright (C) 2004 Stefan Metzmacher <metze@samba.org> -########################################################################### - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -LIBS=@LIBS@ @LDAP_LIBS@ @KRB5_LIBS@ @LIBPOPT_LIBS@ -CC=@CC@ -SHLD=@SHLD@ -CFLAGS=@CFLAGS@ -CPPFLAGS=@CPPFLAGS@ -LDFLAGS=@LDFLAGS@ -LDSHFLAGS=@LDSHFLAGS@ @LDFLAGS@ @CFLAGS@ -PERL=@PERL@ -DYNEXP=@DYNEXP@ - -VPATH=@srcdir@ -srcdir=@srcdir@ -builddir=@builddir@ -SHELL=/bin/sh - -BASEDIR= @prefix@ -BINDIR = @bindir@ -SBINDIR = @sbindir@ -LIBDIR = @libdir@ -CONFIGDIR = @configdir@ -VARDIR = @localstatedir@ - -# The permissions to give the executables -INSTALLPERMS = 0755 - -# set these to where to find various files -# These can be overridden by command line switches (see smbd(8)) -# or in smb.conf (see smb.conf(5)) -LOGFILEBASE = @logfilebase@ -CONFIGFILE = $(CONFIGDIR)/smb.conf -LMHOSTSFILE = $(CONFIGDIR)/lmhosts - -# This is where smbpasswd et al go -PRIVATEDIR = @privatedir@ -SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd - -# the directory where lock files go -LOCKDIR = @lockdir@ - -# the directory where pid files go -PIDDIR = @piddir@ - -FLAGS = $(CFLAGS) -Iinclude -I$(srcdir)/include $(CPPFLAGS) -I. -I$(srcdir) -Ilib -FLAGS32 = - -PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATEDIR)\" -PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" -PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" -PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" -PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \ - -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" -PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS) - -# Note that all executable programs now provide for an optional executable suffix. - -SBIN_PROGS = bin/smbd@EXEEXT@ - -BIN_PROGS = bin/smbclient@EXEEXT@ - -TORTURE_PROGS = bin/smbtorture@EXEEXT@ \ - bin/gentest@EXEEXT@ \ - bin/locktest@EXEEXT@ \ - bin/masktest@EXEEXT@ \ - bin/ndrdump@EXEEXT@ - -LDB_PROGS = bin/ldbadd bin/ldbdel bin/ldbmodify bin/ldbedit bin/ldbsearch -REG_PROGS = bin/regpatch bin/regshell bin/regtree bin/regpatch bin/regdiff - -CHARSET_MODULES = @CHARSET_MODULES@ -CHARSET_LIBDIR = $(LIBDIR)/charset -DCERPC_MODULES = @DCERPC_MODULES@ -DCERPC_LIBDIR = $(LIBDIR)/dcerpc -NTVFS_MODULES = @NTVFS_MODULES@ -NTVFS_LIBDIR = $(LIBDIR)/ntvfs - -MODULES = $(CHARSET_MODULES) $(DCERPC_MODULES) $(NTVFS_MODULES) - -###################################################################### -# object file lists -###################################################################### - -CHARSET_OBJS = @CHARSET_OBJS@ - -LIBLDB_LDAP_OBJS = @LIBLDB_LDAP_OBJS@ -LIBLDB_OBJS = @LIBLDB_OBJS@ - -LIBBASIC_OBJS = @LIBBASIC_OBJS@ -LIBBASIC_LIBS = @LIBBASIC_LIBS@ $(LIBS) - -LIBCLI_RAW_OBJS = @LIBCLI_RAW_OBJS@ -LIBCLI_UTILS_OBJS = @LIBCLI_UTILS_OBJS@ -LIBCLI_NMB_OBJS = @LIBCLI_NMB_OBJS@ -LIBCLI_AUTH_OBJS = @LIBCLI_AUTH_OBJS@ -LIBCLI_OBJS = @LIBCLI_OBJS@ - -LIBNDR_RAW_OBJS = @LIBNDR_RAW_OBJS@ -LIBRPC_RAW_OBJS = @LIBRPC_RAW_OBJS@ -LIBRPC_OBJS = @LIBRPC_OBJS@ -LIBRPC_CLIENT_OBJS = @LIBRPC_CLIENT_OBJS@ - -LIBSMB_OBJS = @LIBSMB_OBJS@ -LIBSMB_LIBS = @LIBSMB_LIBS@ - -LIBPOPT_OBJS = @LIBPOPT_OBJS@ -LIBPOPT_LIBS = @LIBPOPT_LIBS@ - -LIBCMDLINE_OBJS = @LIBCMDLINE_OBJS@ $(LIBPOPT_OBJS) -LIBCMDLINE_LIBS = @LIBCMDLINE_LIBS@ $(LIBPOPT_LIBS) - -CONFIG_OBJS = @CONFIG_OBJS@ -CONFIG_LIBS = @CONFIG_LIBS@ - -PROCESS_MODEL_OBJS = @PROCESS_MODEL_OBJS@ -PROCESS_MODEL_LIBS = @PROCESS_MODEL_LIBS@ - -SMB_OBJS = @SMB_OBJS@ -SMB_LIBS = @SMB_LIBS@ - -AUTH_OBJS = @AUTH_OBJS@ -AUTH_LIBS = @AUTH_LIBS@ - -PASSDB_OBJS = @PASSDB_OBJS@ -PASSDB_LIBS = @PASSDB_LIBS@ - -NTVFS_OBJS = @NTVFS_OBJS@ -NTVFS_LIBS = @NTVFS_LIBS@ - -DCERPC_OBJS = @DCERPC_OBJS@ -DCERPC_LIBS = @DCERPC_LIBS@ - -REG_OBJS = @REG_OBJS@ -REG_LIBS = @REG_LIBS@ - -GTK_OBJS = -GTK_LIBS = @GTK_LIBS@ - -LIBLDB_OBJS = @LIBLDB_OBJS@ - -LDBADD_OBJS = @LDBADD_OBJS@ -LDBADD_LIBS = $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -LDBDEL_OBJS = @LDBDEL_OBJS@ -LDBDEL_LIBS = $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -LDBMODIFY_OBJS = @LDBMODIFY_OBJS@ -LDBMODIFY_LIBS = $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -LDBSEARCH_OBJS = @LDBSEARCH_OBJS@ -LDBSEARCH_LIBS = $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -LDBEDIT_OBJS = @LDBEDIT_OBJS@ -LDBEDIT_LIBS = $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -TORTURE_RAW_OBJS = @TORTURE_RAW_OBJS@ - -TORTURE_RPC_OBJS = @TORTURE_RPC_OBJS@ - -TORTURE_NBENCH_OBJS = @TORTURE_NBENCH_OBJS@ - -TORTURE_BASIC_OBJS = @TORTURE_BASIC_OBJS@ - -DCERPC_COMMON_OBJS = @DCERPC_COMMON_OBJS@ - -TORTURE_OBJS = @TORTURE_OBJS@ -TORTURE_LIBS = @TORTURE_LIBS@ - -CLIENT_OBJS = client/client.o client/clitar.o libcli/raw/clirewrite.o -CLIENT_LIBS = - -SERVER_OBJS = smbd/server.o smbd/process.o \ - lib/server_mutex.o \ - smbd/build_options.o \ - smbd/rewrite.o -SERVER_LIBS = - -SMBD_OBJS = $(SERVER_OBJS) $(PROCESS_MODEL_OBJS) \ - $(DCERPC_OBJS) $(SMB_OBJS) $(AUTH_OBJS) $(PASSDB_OBJS) $(NTVFS_OBJS) \ - $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) \ - $(LIBLDB_OBJS) -SMBD_LIBS = $(SERVER_LIBS) $(PROCESS_MODEL_LIBS) \ - $(DCERPC_LIBS) $(SMB_LIBS) $(AUTH_LIBS) $(PASSDB_LIBS) $(NTVFS_LIBS) \ - $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) - -SMBCLIENT_OBJS = $(CLIENT_OBJS) $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) $(LIBCMDLINE_OBJS) -SMBCLIENT_LIBS = $(CLIENT_LIBS) $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) $(LIBCMDLINE_LIBS) - -SMBTORTURE_OBJS = $(TORTURE_OBJS) $(CONFIG_OBJS) $(LIBSMB_OBJS) $(LIBBASIC_OBJS) -SMBTORTURE_LIBS = $(TORTURE_LIBS) $(CONFIG_LIBS) $(LIBSMB_LIBS) $(LIBBASIC_LIBS) - -GENTEST_OBJS = torture/gentest.o torture/torture_util.o libcli/raw/clirewrite.o \ - $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) -GENTEST_LIBS = $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) - -MASKTEST_OBJS = torture/masktest.o libcli/raw/clirewrite.o \ - $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) -MASKTEST_LIBS = $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) - -LOCKTEST_OBJS = torture/locktest.o libcli/raw/clirewrite.o \ - $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) -LOCKTEST_LIBS = $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) - -NDRDUMP_OBJS = utils/ndrdump.o utils/rewrite.o \ - $(LIBSMB_OBJS) $(CONFIG_OBJS) $(LIBBASIC_OBJS) -NDRDUMP_LIBS = $(LIBSMB_LIBS) $(CONFIG_LIBS) $(LIBBASIC_LIBS) - -REGTREE_OBJS = lib/registry/tools/regtree.o \ - $(REG_OBJS) $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) -REGTREE_LIBS = $(REG_LIBS) $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) - -GREGEDIT_OBJS = lib/registry/tools/gregedit.o \ - $(REG_OBJS) $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) $(GTK_OBJS) -GREGEDIT_LIBS = $(REG_LIBS) $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) $(GTK_LIBS) - -REGSHELL_OBJS = lib/registry/tools/regshell.o \ - $(REG_OBJS) $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) -REGSHELL_LIBS = $(REG_LIBS) $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) - -REGPATCH_OBJS = lib/registry/tools/regpatch.o \ - $(REG_OBJS) $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) -REGPATCH_LIBS = $(REG_LIBS) $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) - -REGDIFF_OBJS = lib/registry/tools/regdiff.o \ - $(REG_OBJS) $(LIBBASIC_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) -REGDIFF_LIBS = $(REG_LIBS) $(LIBBASIC_LIBS) $(CONFIG_LIBS) $(LIBCMDLINE_LIBS) $(LIBSMB_LIBS) - -PROTO_OBJ = $(SERVER_OBJS) $(PROCESS_MODEL_OBJS) $(CLIENT_OBJS) $(TORTURE_OBJS) \ - $(DCERPC_OBJS) $(SMB_OBJS) $(AUTH_OBJS) $(PASSDB_OBJS) $(NTVFS_OBJS) \ - $(LIBBASIC_OBJS) $(LIBLDB_OBJS) $(CONFIG_OBJS) $(LIBCMDLINE_OBJS) $(LIBSMB_OBJS) $(REG_OBJS) - -default: all - -# Swig extensions - -PYTHON_TDB_OBJ = lib/tdb/tdb.o lib/tdb/spinlock.o -PYTHON_TDB_PICOBJ = $(PYTHON_TDB_OBJ:.o=.po) - -swig: scripting/swig/python/_tdb.so - -swig_clean: - rm -f scripting/swig/python/_tdb.so scripting/swig/python/tdb.pyc \ - scripting/swig/python/tdb.py scripting/swig/python/tdb_wrap.c \ - scripting/swig/python/tdb_wrap.po - -scripting/swig/python/tdb.py: scripting/swig/tdb.i - swig -python scripting/swig/tdb.i - mv scripting/swig/tdb.py scripting/swig/python - mv scripting/swig/tdb_wrap.c scripting/swig/python - -scripting/swig/python/_tdb.so: scripting/swig/python/tdb.py scripting/swig/python/tdb_wrap.po $(PYTHON_TDB_PICOBJ) - $(SHLD) $(LDSHFLAGS) -o scripting/swig/python/_tdb.so scripting/swig/python/tdb_wrap.po \ - $(PYTHON_TDB_PICOBJ) - -###################################################################### -# now the rules... -###################################################################### -all: SHOWFLAGS $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) $(LDB_PROGS) $(REG_PROGS) $(MODULES) - -torture : SHOWFLAGS $(TORTURE_PROGS) - -smbtorture : SHOWFLAGS bin/smbtorture@EXEEXT@ - -gentest: SHOWFLAGS bin/gentest@EXEEXT@ - -masktest : SHOWFLAGS bin/masktest@EXEEXT@ - -locktest : SHOWFLAGS bin/locktest@EXEEXT@ - -modules: SHOWFLAGS proto_exists $(MODULES) - -everything: all - -.SUFFIXES: -.SUFFIXES: .c .o .po .po32 .lo - -SHOWFLAGS: basics - @echo "Using FLAGS = $(FLAGS)" - @echo " FLAGS32 = $(FLAGS32)" - @echo " LIBS = $(LIBS)" - @echo " LDSHFLAGS = $(LDSHFLAGS)" - @echo " LDFLAGS = $(LDFLAGS)" - -MAKEDIR = || exec false; \ - if test -d "$$dir"; then :; else \ - echo mkdir "$$dir"; \ - mkdir -p "$$dir" >/dev/null 2>&1 || \ - test -d "$$dir" || \ - mkdir "$$dir" || \ - exec false; fi || exec false - -.c.o: - @echo Compiling $*.c - @$(CC) -I. -I$(srcdir) $(FLAGS) -c $< \ - -o $@ -@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@ - -# 'make pch' is extremely useful for fast compiles if you have gcc-3.4 -pch: pch_clean basics - $(CC) -I. -I$(srcdir) $(FLAGS) -c $(srcdir)/include/includes.h -o $(srcdir)/include/includes.h.gch - -pch_clean: - rm -f $(srcdir)/include/includes.h.gch - -idl_full: build/pidl/idl.pm - CPP="@CPP@" script/build_idl.sh FULL - -idl: build/pidl/idl.pm - @CPP="@CPP@" script/build_idl.sh - -basics: idl proto_test - -build/pidl/idl.pm: build/pidl/idl.yp - -yapp -s build/pidl/idl.yp - -# These dependencies are only approximately correct: we want to make -# sure Samba's paths are updated if ./configure is re-run. Really it -# would be nice if "make prefix=/opt/samba all" also rebuilt things, -# but since we also require "make install prefix=/opt/samba" *not* to -# rebuild it's a bit hard. - -dynconfig.o: dynconfig.c Makefile - @echo Compiling $*.c - @$(CC) $(FLAGS) $(PATH_FLAGS) -c $< -o $@ - -dynconfig.po: dynconfig.c Makefile - @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ - dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi - @echo Compiling $*.c with @PICFLAG@ - @$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@ -@BROKEN_CC@ -mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@ -@POBAD_CC@ @mv $*.po.o $@ - -lib/version.o: lib/version.c include/version.h - @echo Compiling $*.c - @$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) -c $< -o $@ - -lib/version.po: lib/version.c include/version.h - @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ - dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi - @echo Compiling $*.c with @PICFLAG@ - @$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@ -@BROKEN_CC@ -mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@ -@POBAD_CC@ @mv $*.po.o $@ - -.c.po: - @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ - dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi - @echo Compiling $*.c with @PICFLAG@ - @$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@ -@BROKEN_CC@ -mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@ -@POBAD_CC@ @mv $*.po.o $@ - -# this is for IRIX -.c.po32: - @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ - dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi - @echo Compiling $*.c with @PICFLAG@ and -32 - @$(CC) -32 -I. -I$(srcdir) $(FLAGS32) $(PATH_FLAGS) @PICFLAG@ -c $< \ - -o $*.po32.o -@BROKEN_CC@ -mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po32$$%.o%'` $@.o - @mv $*.po32.o $@ - -bin/.dummy: - @if (: >> $@ || : > $@) >/dev/null 2>&1; then :; else \ - dir=bin $(MAKEDIR); fi - @: >> $@ || : > $@ # what a fancy emoticon! - -bin/smbd@EXEEXT@: $(SMBD_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(SMBD_OBJS) $(LDFLAGS) $(DYNEXP) $(SMBD_LIBS) - -bin/smbclient@EXEEXT@: $(SMBCLIENT_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(SMBCLIENT_OBJS) $(LDFLAGS) $(SMBCLIENT_LIBS) - -bin/smbtorture@EXEEXT@: $(SMBTORTURE_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJS) $(LDFLAGS) $(SMBTORTURE_LIBS) - -bin/ldbadd@EXEEXT@: $(LDBADD_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBADD_OBJS) $(LDFLAGS) $(LDBADD_LIBS) - -bin/ldbdel@EXEEXT@: $(LDBDEL_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJS) $(LDFLAGS) $(LDBADD_LIBS) - -bin/ldbmodify@EXEEXT@: $(LDBMODIFY_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJS) $(LDFLAGS) $(LDBADD_LIBS) - -bin/ldbsearch@EXEEXT@: $(LDBSEARCH_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJS) $(LDFLAGS) $(LDBADD_LIBS) - -bin/ldbedit@EXEEXT@: $(LDBEDIT_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJS) $(LDFLAGS) $(LDBADD_LIBS) - -bin/ndrdump@EXEEXT@: $(NDRDUMP_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(NDRDUMP_OBJS) $(LDFLAGS) $(NDRDUMP_LIBS) - -bin/gentest@EXEEXT@: $(GENTEST_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(GENTEST_OBJS) $(LDFLAGS) $(GENTEST_LIBS) - -bin/masktest@EXEEXT@: $(MASKTEST_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJS) $(LDFLAGS) $(MASKTEST_LIBS) - -bin/locktest@EXEEXT@: $(LOCKTEST_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJS) $(LDFLAGS) $(LOCKTEST_LIBS) - - -bin/regshell@EXEEXT@: $(REGSHELL_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(REGSHELL_OBJS) $(LDFLAGS) $(REGSHELL_LIBS) - -bin/regtree@EXEEXT@: $(REGTREE_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(REGTREE_OBJS) $(LDFLAGS) $(REGTREE_LIBS) - -bin/gregedit@EXEEXT@: $(GREGEDIT_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLGS) -o $@ $(GREGEDIT_OBJS) $(LDFLAGS) $(GREGEDIT_LIBS) - -bin/regpatch@EXEEXT@: $(REGPATCH_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(REGPATCH_OBJS) $(LDFLAGS) $(REGPATCH_LIBS) - -bin/regdiff@EXEEXT@: $(REGDIFF_OBJS) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(REGDIFF_OBJS) $(LDFLAGS) $(REGDIFF_LIBS) - -install: installbin installtorture installldb installreg installdat - -# DESTDIR is used here to prevent packagers wasting their time -# duplicating the Makefile. Remove it and you will have the privelege -# of package each samba release for muliple versions of multiple -# distributions and operating systems, or at least supplying patches -# to all the packaging files required for this, prior to committing -# the removal of DESTDIR. Do not remove it even though you think it -# is not used - -installdirs: - @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR) - @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DESTDIR)$(NTVFS_LIBDIR) - -installservers: all installdirs - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS) - -installbin: all installdirs - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS) - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS) - -installtorture: all installdirs - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS) - -installldb: all installdirs - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(LDB_PROGS) - -installreg: all installdirs - @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(REG_PROGS) - -installmodules: all installdirs - @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(NTVFS_LIBDIR) $(NTVFS_MODULES) - @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DCERPC_MODULES) - @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(CHARSET_MODULES) - -installdat: installdirs - @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir) - -# revert to the previously installed version -revert: - @$(SHELL) $(srcdir)/script/revert.sh $(SBINDIR) $(SBIN_PROGS) - -.PHONY: showlayout - -showlayout: - @echo "Samba will be installed into:" - @echo " basedir: $(BASEDIR)" - @echo " bindir: $(BINDIR)" - @echo " sbindir: $(SBINDIR)" - @echo " libdir: $(LIBDIR)" - @echo " vardir: $(VARDIR)" - -uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg - -uninstallbin: - @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS) - @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS) - -uninstalltorture: - @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS) - -uninstallldb: - @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS) - -uninstallreg: - @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS) - -uninstallmodules: - @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(NTVFS_LIBDIR) $(DESTDIR)$(NTVFS_MODULES) - @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(DCERPC_LIBDIR) $(DESTDIR)$(DCERPC_MODULES) - @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSET_LIBDIR) $(DESTDIR)$(CHARSET_MODULES) - -# Toplevel clean files -TOPFILES=dynconfig.o dynconfig.po - -clean: delheaders - -rm -f core */*~ *~ */*.o */*/*.o */*/*/*.o */*/*.po */*/*.po32 */*.po */*.po32 */*.@SHLIBEXT@ \ - $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(MODULES) $(TORTURE_PROGS) \ - .headers.stamp - -rm -rf librpc/gen_* - -# Making this target will just make sure that the prototype files -# exist, not necessarily that they are up to date. Since they're -# removed by "make clean" this will always be run when you do anything -# afterwards. -proto_exists: include/proto.h include/build_env.h - -delheaders: pch_clean - @/bin/rm -f $(srcdir)/include/proto.h $(srcdir)/include/build_env.h - -include/proto.h: - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(PERL) \ - -h _PROTO_H_ $(builddir)/include/proto.h \ - $(PROTO_OBJ) - -include/build_env.h: - @echo Building include/build_env.h - @cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h - -# "make headers" or "make proto" calls a subshell because we need to -# make sure these commands are executed in sequence even for a -# parallel make. -headers: delheaders include/proto.h include/build_env.h - -proto: idl headers - -proto_test: - @[ -f include/proto.h ] || $(MAKE) proto - -.PHONY: headers proto - -etags: - etags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/` - -ctags: - ctags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/` - -realclean: clean delheaders - -rm -f config.log bin/.dummy - -distclean: realclean - -rm -f include/config.h Makefile - -rm -f config.status config.cache - -realdistclean: distclean - -rm -f include/config.h.in - -rm -f lib/version.h - -rm -f configure - -# when configure.in is updated, reconfigure -$(srcdir)/configure: $(srcdir)/configure.in - @echo "WARNING: you need to rerun ./autogen.sh" - -config.status: $(srcdir)/configure - @echo "WARNING: you need to run configure" - -Makefile: $(srcdir)/Makefile.in config.status smb_server/config.m4 - @echo "WARNING: you need to run ./config.status" diff --git a/source4/aclocal.m4 b/source4/aclocal.m4 index f7828a080f..5d0d11cd58 100644 --- a/source4/aclocal.m4 +++ b/source4/aclocal.m4 @@ -36,95 +36,6 @@ if test $ac_cv_dirent_d_off = yes; then fi ]) -dnl Specify the default build method of this module -dnl SMB_MODULE_DEFAULT(1:name,2:default_build) -AC_DEFUN(SMB_MODULE_DEFAULT, -[ - dnl Fall back to static if platform does not support shared libraries - [MODULE_DEFAULT_][$1]=$2 - - if test x"$[MODULE_DEFAULT_][$1]" = xSHARED -a x"$BLDSHARED" = xfalse; then - [MODULE_DEFAULT_][$1]=STATIC - fi -]) - -dnl Mark specified module as shared -dnl SMB_MODULE(1:name,2:subsystem,3:default_build,4:object_files,5:private_proto_file,6:libs,7:whatif-static,8:whatif-shared,9:whatif-not) -AC_DEFUN(SMB_MODULE, -[ - AC_MSG_CHECKING([how to build $1]) - if test -z "$[MODULE_DEFAULT_][$1]"; then - [MODULE_DEFAULT_][$1]=$3 - - if test x"$[MODULE_DEFAULT_][$1]" = xSHARED -a x"$BLDSHARED" = xfalse; then - [MODULE_DEFAULT_][$1]=STATIC - fi - fi - - if test "$[MODULE_][$1]"; then - DEST=$[MODULE_][$1] - elif test "$[MODULE_]translit([$2], [A-Z], [a-z])" -a x"$[MODULE_DEFAULT_][$1]" != xNOT; then - DEST=$[MODULE_]translit([$2], [A-Z], [a-z]) - else - DEST=$[MODULE_DEFAULT_][$1] - fi - - if test x"$DEST" = xSHARED; then - AC_DEFINE([$1][_init], [init_module], [Whether to build $1 as shared module]) - $2_MODULES="$$2_MODULES bin/$1.$SHLIBEXT" - [MODULE_][$1][_PROTO]="$5" - [MODULE_][$1][_LIBS]="$6" - AC_MSG_RESULT([shared]) - [$8] - string_shared_modules="$string_shared_modules $1" - elif test x"$DEST" = xSTATIC; then - [init_static_modules_]translit([$2], [A-Z], [a-z])="$[init_static_modules_]translit([$2], [A-Z], [a-z]) $1_init();" - string_static_modules="$string_static_modules $1" - [MODULE_][$1][_PROTO]="$5" - $2_STATIC="$$2_STATIC $4" - $2_LIBS="$$2_LIBS $6" - [$7] - AC_MSG_RESULT([static]) - else - string_ignored_modules="$string_ignored_modules $1" - [$9] - AC_MSG_RESULT([not]) - fi -]) - -dnl SMB_SUBSYSTEM(1:name,2:init_objectfile,3:extra_objectfiles,4:public_proto_header,5:private_proto_header,6:libs) -AC_DEFUN(SMB_SUBSYSTEM, -[ - dnl the core object files of the subsystem - $1_BASE="$2 $3" - AC_SUBST($1_BASE) - - dnl the staticly linked modules of the subsystem - AC_SUBST($1_STATIC) - - dnl all object files of the subsystem - $1_OBJS="$$1_BASE $$1_STATIC" - AC_SUBST($1_OBJS) - - dnl the libs required by the subsystem - $1_LIBS="$6 $$1_LIBS" - AC_SUBST($1_LIBS) - - dnl the shared objects modules of the subsystem - AC_SUBST($1_MODULES) - - dnl the public_prototype_header file - $1_PUBLIC_HEADER="$4" - AC_SUBST($1_PUBLIC_PROTO) - - dnl the private_prototype_header file - $1_PRIVATE_HEADER="$5" - AC_SUBST($1_PRIVATE_PROTO) - - AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions]) - ifelse([$2], , :, [rm -f $2]) -]) - dnl AC_PROG_CC_FLAG(flag) AC_DEFUN(AC_PROG_CC_FLAG, [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1, @@ -768,3 +679,6 @@ AC_DEFUN(PKG_CHECK_MODULES, [ ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) fi ]) + +sinclude(build/smb_build/public.m4) +sinclude(build/smb_build/core.m4) diff --git a/source4/auth/config.m4 b/source4/auth/config.m4 index 23c7b8a3f5..b84ec5d475 100644 --- a/source4/auth/config.m4 +++ b/source4/auth/config.m4 @@ -5,5 +5,7 @@ SMB_MODULE(auth_builtin,AUTH,STATIC,[auth/auth_builtin.o]) SMB_MODULE(auth_unix,AUTH,STATIC,[auth/auth_unix.o]) SMB_SUBSYSTEM(AUTH,auth/auth.o, - [auth/auth_ntlmssp.o auth/auth_util.o auth/pampass.o auth/pass_check.o], - auth/auth_public_proto.h) + [auth/auth_ntlmssp.o + auth/auth_util.o + auth/pampass.o + auth/pass_check.o]) diff --git a/source4/build/smb_build/config_mk.pl b/source4/build/smb_build/config_mk.pl new file mode 100644 index 0000000000..ba580c7c65 --- /dev/null +++ b/source4/build/smb_build/config_mk.pl @@ -0,0 +1,434 @@ +########################################################### +### SMB Build System ### +### - config.mk parsing functions ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +########################################################### +# The parsing function which parses the file +# +# $result = _parse_config_mk($filename) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $result - the resulting structure +# +# $result->{ERROR_CODE} - the error_code, '0' means success +# $result->{ERROR_STR} - the error string +# +# $result->{$key}{KEY} - the key == the variable which was parsed +# $result->{$key}{VAL} - the value of the variable +sub _parse_config_mk($) +{ + my $filename = shift; + my $result; + my $linenum = -1; + my $waiting = 0; + my $section = "GLOBAL"; + my $key; + + $result->{ERROR_CODE} = -1; + + open(CONFIG_MK, "< $filename") || die ("Can't open $filename\n"); + + while (<CONFIG_MK>) { + my $line = $_; + my $val; + + $linenum++; + + # + # lines beginnig with '#' are ignored + # + if ($line =~ /^\#.*$/) { + next; + } + + # + # + # + if (($waiting == 0) && ($line =~ /^\[([a-zA-Z0-9_:]+)\][\t ]*$/)) { + $section = $1; + next; + } + + # + # 1.) lines with an aplhanumeric character indicate + # a new variable, + # 2.) followed by zero or more whitespaces or tabs + # 3.) then one '=' character + # 4.) followed by the value of the variable + # 5.) a newline ('\n') can be escaped by a '\' before the newline + # and the next line needs to start with a tab ('\t') + # + if (($waiting == 0) && ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/)) { + $key = $1; + $val = $2; + + # + # when we have a '\' before the newline + # then skip it and wait for the next line. + # + if ($val =~ /(.*)(\\)$/) { + $val = $1; + $waiting = 1; + } else { + $waiting = 0; + } + + $result->{$section}{$key}{KEY} = $key; + $result->{$section}{$key}{VAL} = $val; + next; + } + + # + # when we are waiting for a value to continue then + # check if it has a leading tab. + # + if (($waiting == 1) && ($line =~ /^\t(.*)$/)) { + $val = $1; + + # + # when we have a '\' before the newline + # then skip it and wait for the next line. + # + if ($val =~ /(.*)( \\)$/) { + $val = $1; + $waiting = 1; + } else { + $waiting = 0; + } + + $result->{$section}{$key}{VAL} .= " "; + $result->{$section}{$key}{VAL} .= $val; + next; + } + + # + # catch empty lines they're ignored + # and we're no longer waiting for the value to continue + # + if ($line =~ /^$/) { + $waiting = 0; + next; + } + + close(CONFIG_MK); + + $result->{ERROR_STR} = "Bad line while parsing $filename\n$filename:$linenum: $line"; + + return $result; + } + + close(CONFIG_MK); + + $result->{ERROR_CODE} = 0; + + return $result; +} + +########################################################### +# A caching function to avoid to parse +# a file twice or more +# +# $result = _get_parse_results($filename) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $result - the resulting structure +# +# $result->{ERROR_CODE} - the error_code, '0' means success +# $result->{ERROR_STR} - the error string +# +# $result->{$key}{KEY} - the key == the variable which was parsed +# $result->{$key}{VAL} - the value of the variable +my $_get_parse_results_cache; +sub _get_parse_results($) +{ + my $filename = shift; + + if ((!defined($_get_parse_results_cache->{$filename}{ERROR_CODE})) + ||($_get_parse_results_cache->{$filename}{ERROR_CODE} != 0)) { + $_get_parse_results_cache->{$filename} = _parse_config_mk($filename); + } + + return $_get_parse_results_cache->{$filename}; +} + +########################################################### +# The fetching function to fetch the value of a variable +# out of the file +# +# $value = _fetch_var_from_config_mk($filename,$section,$variable) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $section - the section name of the variable +# +# $variable - the variable name of which we want the value +# +# $value - the value of the variable +sub _fetch_var_from_config_mk($$$) +{ + my $filename = shift; + my $section = shift; + my $key = shift; + my $val = ""; + my $result; + + $result = _get_parse_results($filename); + + if ($result->{ERROR_CODE} != 0) { + die ($result->{ERROR_STR}); + } + + if (defined($result->{$section}{$key})) { + $val = $result->{$section}{$key}{VAL}; + } elsif (defined($result->{DEFAULT}{$key})) { + $val = $result->{DEFAULT}{$key}{VAL}; + } + + return $val; +} + +########################################################### +# The fetching function to fetch the array of values of a variable +# out of the file +# +# $array = _fetch_array_from_config_mk($filename,$section,$variable) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $section - the section name of the variable +# +# $variable - the variable name of which we want the value +# +# $array - the array of values of the variable +sub _fetch_array_from_config_mk($$$) +{ + my $filename = shift; + my $section = shift; + my $key = shift; + my @val = (); + my $result; + + $result = _get_parse_results($filename); + + if ($result->{ERROR_CODE} != 0) { + die ($result->{ERROR_STR}); + } + + if (defined($result->{$section}{$key})) { + @val = str2array($result->{$section}{$key}{VAL}); + } elsif (defined($result->{DEFAULT}{$key})) { + @val = str2array($result->{DEFAULT}{$key}{VAL}); + } + + return @val; +} + +########################################################### +# A function for fetching MODULE_<module>_<parameter> +# variables out of a config.mk file +# +# $value = module_get_var($filename,$module,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $module - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $value - the value of the variable +sub module_get_var($$$) +{ + my $filename = shift; + my $module = shift; + my $var = shift; + + my $section = "MODULE::".$module; + + return _fetch_var_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching MODULE_<module>_<parameter> +# variables out of a config.mk file +# +# $array = module_get_array($filename,$module,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $module - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $array - the array of values of the variable +sub module_get_array($$$) +{ + my $filename = shift; + my $module = shift; + my $var = shift; + + my $section = "MODULE::".$module; + + return _fetch_array_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching SUBSYSTEM_<subsystem>_<parameter> +# variables out of a config.mk file +# +# $value = subsystem_get_var($filename,$subsystem,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $subsystem - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $value - the value of the variable +sub subsystem_get_var($$$) +{ + my $filename = shift; + my $subsystem = shift; + my $var = shift; + + my $section = "SUBSYSTEM::".$subsystem; + + return _fetch_var_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching SUBSYSTEM_<subsystem>_<parameter> +# variables out of a config.mk file +# +# $array = subsystem_get_array($filename,$subsystem,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $subsystem - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $array - the array of values of the variable +sub subsystem_get_array($$$) +{ + my $filename = shift; + my $subsystem = shift; + my $var = shift; + + my $section = "SUBSYSTEM::".$subsystem; + + return _fetch_array_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching LIBRARY_<library>_<parameter> +# variables out of a config.mk file +# +# $value = library_get_var($filename,$library,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $library - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $value - the value of the variable +sub library_get_var($$$) +{ + my $filename = shift; + my $library = shift; + my $var = shift; + + my $section = "LIBRARY::".$library; + + return _fetch_var_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching LIBRARY_<library>_<parameter> +# variables out of a config.mk file +# +# $array = library_get_array($filename,$library,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $library - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $array - the array of values of the variable +sub library_get_array($$$) +{ + my $filename = shift; + my $library = shift; + my $var = shift; + + my $section = "LIBRARY::".$library; + + return _fetch_array_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching BINARY_<binary>_<parameter> +# variables out of a config.mk file +# +# $value = binary_get_var($filename,$binary,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $binary - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $value - the value of the variable +sub binary_get_var($$$) +{ + my $filename = shift; + my $binary = shift; + my $var = shift; + + my $section = "BINARY::".$binary; + + return _fetch_var_from_config_mk($filename,$section,$var); +} + +########################################################### +# A function for fetching BINARY_<binary>_<parameter> +# variables out of a config.mk file +# +# $array = binary_get_array($filename,$binary,$parameter) +# +# $filename - the path of the config.mk file +# which should be parsed +# +# $binary - the middle part of the variable name of which we want the value +# +# $parameter - the last part of the variable name of which we want the value +# +# $array - the array of values of the variable +sub binary_get_array($$$) +{ + my $filename = shift; + my $binary = shift; + my $var = shift; + + my $section = "BINARY::".$binary; + + return _fetch_array_from_config_mk($filename,$section,$var); +} diff --git a/source4/build/smb_build/core.m4 b/source4/build/smb_build/core.m4 new file mode 100644 index 0000000000..1dc4b36446 --- /dev/null +++ b/source4/build/smb_build/core.m4 @@ -0,0 +1,76 @@ +dnl SMB Build Core System +dnl ------------------------------------------------------- +dnl Copyright (C) Stefan (metze) Metzmacher 2004 +dnl Released under the GNU GPL +dnl ------------------------------------------------------- +dnl +dnl _SMB_BUILD_CORE( +dnl 1: outputfile +dnl ) + +dnl ####################################################### +dnl ### And now the implementation ### +dnl ####################################################### + +dnl _SMB_BUILD_CORE( +dnl 1: outputfile +dnl ) +AC_DEFUN([_SMB_BUILD_CORE], +[ + +echo "config.status: creating ./config.smb_build.pl" + +cat > config.smb_build.pl <<\_SMB_ACEOF +#!/usr/bin/perl -W +# + +use strict; + +my \$SMB_BUILD_CTX; + +_SMB_ACEOF + +cat >> config.smb_build.pl < build/smb_build/config_mk.pl +cat >> config.smb_build.pl < build/smb_build/input.pl +cat >> config.smb_build.pl < build/smb_build/depend.pl +cat >> config.smb_build.pl < build/smb_build/output.pl +cat >> config.smb_build.pl < build/smb_build/makefile.pl +cat >> config.smb_build.pl < build/smb_build/smb_build_h.pl +cat >> config.smb_build.pl < build/smb_build/main.pl + +cat >> config.smb_build.pl <<\_SMB_ACEOF +########################################################### +### First we list all info from configure ### +########################################################### +# +######################################### +## Start Ext Libs +$SMB_INFO_EXT_LIBS +## End Ext Libs +######################################### +######################################### +## Start Modules +$SMB_INFO_MODULES +## End Modules +######################################### +## Start Subsystems +$SMB_INFO_SUBSYSTEMS +## End Subsystems +######################################### +## Start Libraries +$SMB_INFO_LIBRARIES +## End Libraries +######################################### +## Start Binaries +$SMB_INFO_BINARIES +## End Binaries +######################################### + +smb_build_main(\$SMB_BUILD_CTX); + +0; +_SMB_ACEOF + +$PERL config.smb_build.pl || exit $? + +]) diff --git a/source4/build/smb_build/depend.pl b/source4/build/smb_build/depend.pl new file mode 100644 index 0000000000..23525c0f62 --- /dev/null +++ b/source4/build/smb_build/depend.pl @@ -0,0 +1,475 @@ +########################################################### +### SMB Build System ### +### - the dependency calculation functions ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +########################################################### +# This function resolves the dependencies +# for the SUBSYSTEMS_LIST +# @SUBSYSTEMS_LIST = _do_calc_subsystem_list($SMB_BUILD_CTX, \@SUBSYSTEMS_LIST); +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# \@SUBSYSTEMS_LIST - the reference to the SUBSYSTEMS_LIST +# +# @SUBSYSTEMS_LIST - the expanded resulting SUBSYSTEMS_LIST +# +sub _do_calc_subsystem_list($$) +{ + my $CTX = shift; + my $subsys_list = shift; + my @SUBSYSTEMS_LIST = @$subsys_list; + + # + # now try to resolve the dependencies for the library + # + my $i = 0; + my $count = $#SUBSYSTEMS_LIST; + for (;$i<=$count;$i++) { + # + # see if the current subsystem depends on other not listed subsystems + # + foreach my $elem (@{$CTX->{DEPEND}{SUBSYSTEMS}{$SUBSYSTEMS_LIST[$i]}{SUBSYSTEMS_LIST}}) { + my $seen = 0; + # + # check if it's already in the list + # + foreach my $elem2 (@SUBSYSTEMS_LIST) { + # + # check of the names matche + # + if ($elem eq $elem2) { + # + # mark it as already in the list + # + $seen = 1; + last; + } + } + + # + # if it's already there skip it + # + if ($seen == 1) { + next; + } + + # + # if it's not there add it + # and $count++ + # + push(@SUBSYSTEMS_LIST,$elem); + $count++; + } + } + + return @SUBSYSTEMS_LIST; +} + +########################################################### +# This function resolves the dependencies +# for the LIBRARIES_LIST based on the SUBSYSTEMS_LIST +# @LIBRARIES_LIST = _do_calc_libraries_list($SMB_BUILD_CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST); +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# \@SUBSYSTEMS_LIST - the reference to the SUBSYSTEMS_LIST +# +# \@LIBRARIES_LIST - the reference to the LIBRARIES_LIST +# +# @LIBRARIES_LIST - the expanded resulting LIBRARIES_LIST +# +sub _do_calc_libraries_list($$$) +{ + my $CTX = shift; + my $subsys_list = shift; + my @SUBSYSTEMS_LIST = @$subsys_list; + my $libs_list = shift; + my @LIBRARIES_LIST = @$libs_list; + + # + # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST + # + foreach my $elem (@SUBSYSTEMS_LIST) { + # + # see if the subsystem depends on a not listed LIBRARY + # + foreach my $elem1 (@{$CTX->{DEPEND}{SUBSYSTEMS}{$elem}{LIBRARIES_LIST}}) { + my $seen = 0; + # + # check if it's already in the list + # + foreach my $elem2 (@LIBRARIES_LIST) { + # + # check of the names matche + # + if ($elem1 eq $elem2) { + # + # mark it as already in the list + # + $seen = 1; + last; + } + } + + # + # if it's already there skip it + # + if ($seen == 1) { + next; + } + + # + # if it's not there add it + # + push(@LIBRARIES_LIST,$elem1); + } + } + + return @LIBRARIES_LIST; +} + +########################################################### +# This function creates the dependencies for subsystems +# _do_depend_subsystems($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub _do_depend_subsystems($) +{ + my $CTX = shift; + + # + # loop on all subsystems + # + foreach my $key (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) { + my $name = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; + my @STATIC_MODULES_LIST = (); + + # + # skip when the subsystem was disabled + # + if ($CTX->{INPUT}{SUBSYSTEMS}{$key}{ENABLE} ne "YES" ) { + next; + } + + # + # create the subsystems used OBJ_LIST + # + my @OBJ_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}}) { + push(@OBJ_LIST,$elem); + } + foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}}) { + push(@OBJ_LIST,$elem); + } + + # + # create the subsystems used SUBSYSTEMS_LIST + # + my @SUBSYSTEMS_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}}) { + push(@SUBSYSTEMS_LIST,$elem); + } + + # + # create the subsystems used LIBRARIES_LIST + # + my @LIBRARIES_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}}) { + push(@LIBRARIES_LIST,$elem); + } + + # + # now collect the info from the subsystems static modules + # + foreach my $subkey (sort keys %{$CTX->{INPUT}{MODULES}}) { + # + # we only want STATIC modules + # + if ($CTX->{INPUT}{MODULES}{$subkey}{BUILD} ne "STATIC") { + next; + } + + # + # we only want modules which belong to the current subsystem + # + if ($CTX->{INPUT}{MODULES}{$subkey}{SUBSYSTEM} ne $name) { + next; + } + + # + # add it to the STATIC_MODULES_LIST + # + push(@STATIC_MODULES_LIST,$subkey); + + # + # add OBJS of static modules to the subsystems used OBJ_LIST + # + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}}) { + push(@OBJ_LIST,$elem); + } + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}}) { + push(@OBJ_LIST,$elem); + } + + # + # add SUBSYSTEMS of static modules to the subsystems used SUBSYSTEMS_LIST + # + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}}) { + push(@SUBSYSTEMS_LIST,$elem); + } + + # + # add LIBRARIES of static modules to the subsystems used LIBRARIES_LIST + # + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}}) { + push(@LIBRARIES_LIST,$elem); + } + } + + # + # set the lists + # + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST; + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}} = @STATIC_MODULES_LIST; + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + } + + return; +} + +########################################################### +# This function creates the dependencies for ext libs +# _do_depend_ext_libs($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub _do_depend_ext_libs($) +{ + my $CTX = shift; + + # + # loop over all ext libs + # + foreach my $key (sort keys %{$CTX->{INPUT}{EXT_LIBS}}) { + my $name = $CTX->{INPUT}{EXT_LIBS}{$key}{NAME}; + + # + # if it's not a shared module skip it + # + if ($CTX->{INPUT}{EXT_LIBS}{$key}{ENABLE} ne "YES") { + next; + } + + # + # set the lists + # + $CTX->{DEPEND}{EXT_LIBS}{$key}{NAME} = $name; + @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LIBS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{LIBS}}; + @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{CFLAGS}}; + @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CPPFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{CPPFLAGS}}; + @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LDFLAGS}} = @{$CTX->{INPUT}{EXT_LIBS}{$key}{LDFLAGS}}; + } + + return; +} + +########################################################### +# This function creates the dependencies for shared modules +# _do_depend_shared_modules($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub _do_depend_shared_modules($) +{ + my $CTX = shift; + + # + # loop over all shared modules + # + foreach my $key (sort keys %{$CTX->{INPUT}{MODULES}}) { + my $name = $CTX->{INPUT}{MODULES}{$key}{NAME}; + + # + # if it's not a shared module skip it + # + if ($CTX->{INPUT}{MODULES}{$key}{BUILD} ne "SHARED" ) { + next; + } + + # + # create the shared modules used SUBSYSTEMS_LIST + # + my @SUBSYSTEMS_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}}) { + push(@SUBSYSTEMS_LIST,$elem); + } + + # + # now try to resolve the dependencies for the shared module + # + @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST); + + # + # create the shared modules used LIBRARIES_LIST + # + my @LIBRARIES_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}}) { + push(@LIBRARIES_LIST,$elem); + } + + # + # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST + # + @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST); + + # + # set the lists + # + @{$CTX->{DEPEND}{SHARED_MODULES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; + @{$CTX->{DEPEND}{SHARED_MODULES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + } + + return; +} + +########################################################### +# This function creates the dependencies for libraries +# _do_depend_libraries($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub _do_depend_libraries($) +{ + my $CTX = shift; + + # + # loop over all libraries + # + foreach my $key (sort keys %{$CTX->{INPUT}{LIBRARIES}}) { + my $name = $CTX->{INPUT}{LIBRARIES}{$key}{NAME}; + + # + # if it's not a library skip it + # + if ($CTX->{INPUT}{LIBRARIES}{$key}{BUILD} ne "SHARED" ) { + next; + } + + # + # create the libraries used SUBSYSTEMS_LIST + # + my @SUBSYSTEMS_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { + push(@SUBSYSTEMS_LIST,$elem); + } + + # + # now try to resolve the dependencies for the library + # + @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST); + + # + # create the libraries used LIBRARIES_LIST + # + my @LIBRARIES_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}}) { + push(@LIBRARIES_LIST,$elem); + } + + # + # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST + # + @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST); + + # + # set the lists + # + @{$CTX->{DEPEND}{LIBRARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; + @{$CTX->{DEPEND}{LIBRARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + } + + return; +} + +########################################################### +# This function creates the dependencies for binaries +# _do_depend_binaries($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub _do_depend_binaries($) +{ + my $CTX = shift; + + # + # loop over all binaries + # + foreach my $key (sort keys %{$CTX->{INPUT}{BINARIES}}) { + my $name = $CTX->{INPUT}{BINARIES}{$key}{NAME}; + + # + # skip when the binary was disabled + # + if ($CTX->{INPUT}{BINARIES}{$key}{ENABLE} ne "YES" ) { + next; + } + + # + # create the binaries used SUBSYSTEMS_LIST + # + my @SUBSYSTEMS_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { + push(@SUBSYSTEMS_LIST,$elem); + } + + # + # now try to resolve the dependencies for the binary + # + @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST); + + # + # create the binaries used LIBRARIES_LIST + # + my @LIBRARIES_LIST = (); + foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}}) { + push(@LIBRARIES_LIST,$elem); + } + + # + # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST + # + @LIBRARIES_LIST = _do_calc_libraries_list($CTX, \@SUBSYSTEMS_LIST, \@LIBRARIES_LIST); + + # + # set the lists + # + @{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; + @{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + } + + return; +} + +########################################################### +# This function creates the dependency tree from the SMB_BUILD +# context +# create_depend($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub create_depend($) +{ + my $CTX = shift; + + _do_depend_ext_libs($CTX); + + _do_depend_subsystems($CTX); + + _do_depend_shared_modules($CTX); + + _do_depend_libraries($CTX); + + _do_depend_binaries($CTX); + + return; +} diff --git a/source4/build/smb_build/input.pl b/source4/build/smb_build/input.pl new file mode 100644 index 0000000000..8b5b904f1e --- /dev/null +++ b/source4/build/smb_build/input.pl @@ -0,0 +1,128 @@ +########################################################### +### SMB Build System ### +### - the input checking functions ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + + +sub str2array($) +{ + my $str = shift; + my @ar = (); + + $str =~ s/^[\t\n ]*//g; + + $str =~ s/[\t\n ]*$//g; + + $str =~ s/([\t\n ]+)/ /g; + + if (length($str)==0) { + return (); + } + + @ar = split(/[ \t\n]/,$str); + + return @ar; +} + +sub _check_subsystems($) +{ + my $CTX = shift; + + foreach my $subsys (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) { + if ($CTX->{INPUT}{SUBSYSTEMS}{$subsys}{ENABLE} ne "YES") { + printf("Subsystem: %s disabled!\n",$CTX->{INPUT}{SUBSYSTEMS}{$subsys}{NAME}); + next; + } + } + + return; +} + +sub _check_modules($) +{ + my $CTX = shift; + + foreach my $mod (sort keys %{$CTX->{INPUT}{MODULES}}) { + my $subsys = $CTX->{INPUT}{MODULES}{$mod}{SUBSYSTEM}; + my $default_build = $CTX->{INPUT}{MODULES}{$mod}{DEFAULT_BUILD}; + my $build = $CTX->{INPUT}{MODULES}{$mod}{CHOSEN_BUILD}; + my $use_default = 0; + + if (!(defined($CTX->{INPUT}{SUBSYSTEMS}{$subsys}))) { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT"; + printf("Module: %s...PARENT SUBSYSTEM DISABLED\n",$mod); + next; + } + + if ($build eq "DEFAULT") { + $build = $default_build; + $use_default = 1; + } + + if ($build eq "SHARED") { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "SHARED"; + printf("Module: %s...SHARED\n",$mod); + } elsif ($build eq "STATIC") { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "STATIC"; + printf("Module: %s...STATIC\n",$mod); + } else { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT"; + printf("Module: %s...NOT\n",$mod); + next; + } + } + + return; +} + +sub _check_libraries($) +{ + my $CTX = shift; + + foreach my $lib (sort keys %{$CTX->{INPUT}{LIBRARIES}}) { + if ($CTX->{INPUT}{LIBRARIES}{$lib}{ENABLE} ne "YES") { + printf("Library: %s disabled!\n",$CTX->{INPUT}{LIBRARIES}{$lib}{NAME}); + next; + } + } + + return; +} + +sub _check_binaries($) +{ + my $CTX = shift; + + foreach my $bin (sort keys %{$CTX->{INPUT}{BINARIES}}) { + if ($CTX->{INPUT}{BINARIES}{$bin}{ENABLE} ne "YES") { + printf("Binary: %s disabled!\n",$CTX->{INPUT}{BINARIES}{$bin}{NAME}); + next; + } + } + + return; +} + +########################################################### +# This function checks the input from the configure script +# +# check_input($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub check_input($) +{ + my $CTX = shift; + + _check_subsystems($CTX); + + _check_modules($CTX); + + _check_libraries($CTX); + + _check_binaries($CTX); + + return; +} diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl new file mode 100644 index 0000000000..ebe8e23c1d --- /dev/null +++ b/source4/build/smb_build/main.pl @@ -0,0 +1,38 @@ +########################################################### +### SMB Build System ### +### - the main program ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +use Data::Dumper; +sub _dump_ctx($) +{ + my $ctx = shift; + + open (DUMP,"> config.smb_build.dump"); + + print DUMP Dumper($ctx); + + close(DUMP); + + return; +} + +sub smb_build_main($) +{ + check_input($SMB_BUILD_CTX); + + create_depend($SMB_BUILD_CTX); + + create_output($SMB_BUILD_CTX); + + create_makefile_in($SMB_BUILD_CTX); + + create_smb_build_h($SMB_BUILD_CTX); + + _dump_ctx($SMB_BUILD_CTX); + + return 0; +}
\ No newline at end of file diff --git a/source4/build/smb_build/makefile.pl b/source4/build/smb_build/makefile.pl new file mode 100644 index 0000000000..bb7df5a9f2 --- /dev/null +++ b/source4/build/smb_build/makefile.pl @@ -0,0 +1,852 @@ +########################################################### +### SMB Build System ### +### - create output for Makefile ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +sub _prepare_command_interpreters($) +{ + my $ctx = shift; + my $output; + + $output = " +SHELL=/bin/sh +PERL=\@PERL\@ +"; + return $output; +} + +sub _prepare_path_vars($) +{ + my $ctx = shift; + my $output; + + $output = " +prefix=\@prefix\@ +exec_prefix=\@exec_prefix\@ +VPATH=\@srcdir\@ +srcdir=\@srcdir\@ +builddir=\@builddir\@ + +BASEDIR= \@prefix\@ +BINDIR = \@bindir\@ +SBINDIR = \@sbindir\@ +LIBDIR = \@libdir\@ +CONFIGDIR = \@configdir\@ +VARDIR = \@localstatedir\@ + +# The permissions to give the executables +INSTALLPERMS = 0755 + +# set these to where to find various files +# These can be overridden by command line switches (see smbd(8)) +# or in smb.conf (see smb.conf(5)) +LOGFILEBASE = \@logfilebase\@ +CONFIGFILE = \$(CONFIGDIR)/smb.conf +LMHOSTSFILE = \$(CONFIGDIR)/lmhosts + +# This is where smbpasswd et al go +PRIVATEDIR = \@privatedir\@ +SMB_PASSWD_FILE = \$(PRIVATEDIR)/smbpasswd + +# the directory where lock files go +LOCKDIR = \@lockdir\@ + +# the directory where pid files go +PIDDIR = \@piddir\@ + +PASSWD_FLAGS = -DSMB_PASSWD_FILE=\\\"\$(SMB_PASSWD_FILE)\\\" -DPRIVATE_DIR=\\\"\$(PRIVATEDIR)\\\" +PATH_FLAGS1 = -DCONFIGFILE=\\\"\$(CONFIGFILE)\\\" -DSBINDIR=\\\"\$(SBINDIR)\\\" +PATH_FLAGS2 = \$(PATH_FLAGS1) -DBINDIR=\\\"\$(BINDIR)\\\" +PATH_FLAGS3 = \$(PATH_FLAGS2) -DLMHOSTSFILE=\\\"\$(LMHOSTSFILE)\\\" +PATH_FLAGS4 = \$(PATH_FLAGS3) -DLOCKDIR=\\\"\$(LOCKDIR)\\\" -DPIDDIR=\\\"\$(PIDDIR)\\\" +PATH_FLAGS5 = \$(PATH_FLAGS4) -DLIBDIR=\\\"\$(LIBDIR)\\\" \\ + -DLOGFILEBASE=\\\"\$(LOGFILEBASE)\\\" -DSHLIBEXT=\\\"\@SHLIBEXT\@\\\" +PATH_FLAGS6 = \$(PATH_FLAGS5) -DCONFIGDIR=\\\"\$(CONFIGDIR)\\\" +PATH_FLAGS = \$(PATH_FLAGS6) \$(PASSWD_FLAGS) +"; + return $output; +} + +sub _prepare_compiler_linker($) +{ + my $ctx = shift; + my $output; + + $output = " +CC=\@CC\@ +CC_FLAGS=-I./include -I./ -I./lib \@CFLAGS\@ \@CPPFLAGS\@ + +LD=\@CC\@ +LD_FLAGS=\@LDFLAGS\@ \@CFLAGS\@ + +STLD=ar +STLD_FLAGS=-rc + +SHLD=\@CC\@ +SHLD_FLAGS=\@LDSHFLAGS\@ \@LDFLAGS\@ +"; + return $output; +} + +sub _prepare_default_rule($) +{ + my $ctx = shift; + my $output; + + $output = " +default: all +"; + return $output; +} + +sub _prepare_SUFFIXES($) +{ + my $ctx = shift; + my $output; + + $output = " +.SUFFIXES: +.SUFFIXES: .c .o .h .h.gch .a .so +"; + return $output; +} + +sub _prepare_IDL($) +{ + my $ctx = shift; + my $output; + + $output = " +idl_full: build/pidl/idl.pm + CPP=\"\@CPP\@\" script/build_idl.sh FULL + +idl: build/pidl/idl.pm + \@CPP=\"\@CPP\@\" script/build_idl.sh + +build/pidl/idl.pm: build/pidl/idl.yp + -yapp -s build/pidl/idl.yp + +pch: proto include/includes.h.gch + +pch_clean: + -rm -f include/includes.h.gch + +basics: idl proto_exists + +"; + return $output; +} + +sub _prepare_dummy_MAKEDIR() +{ + my $ctx = shift; + my $output; + + $output = " +MAKEDIR = || exec false; \\ + if test -d \"\$\$dir\"; then :; else \\ + echo mkdir \"\$\$dir\"; \\ + mkdir -p \"\$\$dir\" >/dev/null 2>&1 || \\ + test -d \"\$\$dir\" || \\ + mkdir \"\$\$dir\" || \\ + exec false; fi || exec false + +bin/.dummy: + \@if (: >> \$\@ || : > \$\@) >/dev/null 2>&1; then :; else \\ + dir=bin \$(MAKEDIR); fi + \@: >> \$\@ || : > \$\@ + +dynconfig.o: dynconfig.c Makefile + \@if (: >> \$\@ || : > \$\@) >/dev/null 2>&1; then rm -f \$\@; else \\ + dir=`echo \$\@ | sed 's,/[^/]*\$\$,,;s,^\$\$,.,'` \$(MAKEDIR); fi + \@echo Compiling \$*.c + \@\$(CC) \$(CC_FLAGS) \$(PATH_FLAGS) -c \$< -o \$\@ +\@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@ + +"; + return $output; +} + +########################################################### +# This function creates a standard make rule which is using $(CC) +# +# $output = _prepare_std_CC_rule($srcext,$destext,$message,$comment) +# +# $srcext - sourcefile extension +# +# $destext - destinationfile extension +# +# $message - logmessage which is echoed while running this rule +# +# $comment - just a comment what this rule should do +# +# $output - the resulting output buffer +sub _prepare_std_CC_rule($$$$) +{ + my $src = shift; + my $dst = shift; + my $message = shift; + my $comment = shift; + my $output; + + $output = " +################################### +# Start $comment +.$src.$dst: + \@if (: >> \$\@ || : > \$\@) >/dev/null 2>&1; then rm -f \$\@; else \\ + dir=`echo \$\@ | sed 's,/[^/]*\$\$,,;s,^\$\$,.,'` \$(MAKEDIR); fi + \@echo $message \$*.$src + \@\$(CC) \$(CC_FLAGS) -c \$< -o \$\@ +\@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@ +#End $comment +################################### +"; + + return $output; +} + +sub array2oneperline($) +{ + my $array = shift; + my $i; + my $output = ""; + + foreach my $str (@{$array}) { + if (!defined($str)) { + next; + } + + $output .= " \\\n\t\t"; + $output .= $str; + } + + return $output; +} + +sub array2oneline($) +{ + my $array = shift; + my $i; + my $output = ""; + + foreach my $str (@{$array}) { + if (!defined($str)) { + next; + } + + $output .= $str; + $output .= " "; + } + + return $output; +} + +########################################################### +# This function creates a object file list +# +# $output = _prepare_var_obj_list($var, $var_ctx) +# +# $var_ctx - the subsystem context +# +# $var_ctx->{NAME} - the <var> name +# $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var> +# +# $output - the resulting output buffer +sub _prepare_var_obj_list($$) +{ + my $var = shift; + my $ctx = shift; + my $tmpobjlist; + my $output; + + $tmpobjlist = array2oneperline($ctx->{OBJ_LIST}); + + $output = " +################################### +# Start $var $ctx->{NAME} OBJ LIST +$var\_$ctx->{NAME}_OBJS =$tmpobjlist +# End $var $ctx->{NAME} OBJ LIST +################################### +"; + + return $output; +} + +########################################################### +# This function creates a object file list for a subsystem +# +# $output = _prepare_subsystem_obj_list($subsystem_ctx) +# +# $subsystem_ctx - the subsystem context +# +# $subsystem_ctx->{NAME} - the subsystem name +# $subsystem_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this subsystem +# +# $output - the resulting output buffer +sub _prepare_subsystem_obj_list($) +{ + my $ctx = shift; + + return _prepare_var_obj_list("SUBSYSTEM",$ctx); +} + +########################################################### +# This function creates a object file list for a module +# +# $output = _prepare_module_obj_and_lib_list($module_ctx) +# +# $module_ctx - the module context +# +# $module_ctx->{NAME} - the module binary name +# $module_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this module +# +# $output - the resulting output buffer +sub _prepare_module_objlist($) +{ + my $ctx = shift; + + return _prepare_var_obj_list("MODULE",$ctx); + +} + +########################################################### +# This function creates a make rule for linking a shared module +# +# $output = _prepare_shared_module_rule($module_ctx) +# +# $module_ctx - the module context +# +# $module_ctx->{MODULE} - the module binary name +# $module_ctx->{DEPEND_LIST} - the list of rules on which this module depends +# $module_ctx->{LINK_LIST} - the list of objectfiles and external libraries +# which sould be linked to this module +# $module_ctx->{LINK_FLAGS} - linker flags used by this module +# +# $output - the resulting output buffer +sub _prepare_shared_module_rule($) +{ + my $ctx = shift; + my $tmpdepend; + my $tmplink; + my $tmpflag; + my $output; + + $tmpdepend = array2oneperline($ctx->{DEPEND_LIST}); + $tmplink = array2oneperline($ctx->{LINK_LIST}); + $tmpflag = array2oneperline($ctx->{LINK_FLAGS}); + + $output = " +################################### +# Start Module $ctx->{MODULE} +MODULE_$ctx->{NAME}_DEPEND_LIST =$tmpdepend +MODULE_$ctx->{NAME}_LINK_LIST =$tmplink +MODULE_$ctx->{NAME}_LINK_FLAGS =$tmpflag +# +bin/$ctx->{MODULE}: \$(MODULE_$ctx->{NAME}_DEPEND_LIST) bin/.dummy + \@echo Linking \$\@ + \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\ + \$(MODULE_$ctx->{NAME}_LINK_FLAGS) \\ + \$(MODULE_$ctx->{NAME}_LINK_LIST) +# Module $ctx->{MODULE} +################################### +"; + + return $output; +} + +########################################################### +# This function creates a object file list for a library +# +# $output = _prepare_library_obj_and_lib_list($library_ctx) +# +# $library_ctx - the library context +# +# $library_ctx->{NAME} - the library binary name +# $library_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this library +# +# $output - the resulting output buffer +sub _prepare_library_obj_list($) +{ + my $ctx = shift; + + return _prepare_var_obj_list("LIBRARY",$ctx); + +} + +########################################################### +# This function creates a make rule for linking a library +# +# $output = _prepare_library_rule($library_ctx) +# +# $library_ctx - the library context +# +# $library_ctx->{LIBRARY} - the library name +# $library_ctx->{STATIC_LIBRARY} - the static library name +# $library_ctx->{SHARED_LIBRARY} - the shared library name +# $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends +# $library_ctx->{STATIC_LINK_LIST} - the list of objectfiles which sould be linked +# to this static library +# $library_ctx->{STATIC_LINK_FLAGS} - linker flags used by this static library +# $library_ctx->{SHARED_LINK_LIST} - the list of objectfiles and external libraries +# which sould be linked to this shared library +# $library_ctx->{SHARED_LINK_FLAGS} - linker flags used by this shared library +# +# $output - the resulting output buffer +sub _prepare_library_rule($) +{ + my $ctx = shift; + my $tmpdepend; + my $tmpstlink; + my $tmpstflag; + my $tmpshlink; + my $tmpshflag; + my $output; + + $tmpdepend = array2oneperline($ctx->{DEPEND_LIST}); + + $tmpstlink = array2oneperline($ctx->{STATIC_LINK_LIST}); + $tmpstflag = array2oneperline($ctx->{STATIC_LINK_FLAGS}); + + $tmpshlink = array2oneperline($ctx->{SHARED_LINK_LIST}); + $tmpshflag = array2oneperline($ctx->{SHARED_LINK_FLAGS}); + + $output = " +################################### +# Start Library $ctx->{LIBRARY} +# +LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend +# +LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink +LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS =$tmpstflag +# +LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink +LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag +# +# Static $ctx->{STATIC_LIBRARY} +bin/$ctx->{STATIC_LIBRARY}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy + \@echo Linking \$\@ + \@\$(STLD) \$(STLD_FLAGS) \$\@ \\ + \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS) \\ + \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)"; + + if (defined($ctx->{SHARED_LIBRARY})) { + $output .= " +# Shared $ctx->{SHARED_LIBRARY} +bin/$ctx->{SHARED_LIBRARY}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy + \@echo Linking \$\@ + \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\ + \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\ + \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)"; + } +$output .= " +# End Library $ctx->{LIBRARY} +################################### +"; + + return $output; +} + +########################################################### +# This function creates a object file list for a binary +# +# $output = _prepare_binary_obj_and_lib_list($binary_ctx) +# +# $binary_ctx - the binary context +# +# $binary_ctx->{NAME} - the binary name +# $binary_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this binary +# +# $output - the resulting output buffer +sub _prepare_binary_obj_list($) +{ + my $ctx = shift; + + return _prepare_var_obj_list("BINARY",$ctx); + +} + +########################################################### +# This function creates a make rule for linking a binary +# +# $output = _prepare_binary_rule($binary_ctx) +# +# $binary_ctx - the binary context +# +# $binary_ctx->{NAME} - the binary name +# $binary_ctx->{BINARY} - the binary binary name +# +# $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends +# $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries +# which sould be linked to this binary +# $binary_ctx->{LINK_FLAGS} - linker flags used by this binary +# +# $output - the resulting output buffer +sub _prepare_binary_rule($) +{ + my $ctx = shift; + my $tmpdepend; + my $tmplink; + my $tmpflag; + my $output; + + $tmpdepend = array2oneperline($ctx->{DEPEND_LIST}); + $tmplink = array2oneperline($ctx->{LINK_LIST}); + $tmpflag = array2oneperline($ctx->{LINK_FLAGS}); + + $output = " +################################### +# Start Binary $ctx->{BINARY} +# +BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend +BINARY_$ctx->{NAME}_LINK_LIST =$tmplink +BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag +# +bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) + \@echo Linking \$\@ + \@\$(LD) \$(LD_FLAGS) -o \$\@ \\ + \$(BINARY_$ctx->{NAME}_LINK_FLAGS) \\ + \$(BINARY_$ctx->{NAME}_LINK_LIST) +# End Binary $ctx->{BINARY} +################################### +"; + + return $output; +} + +########################################################### +# This function creates a object file list for make proto +# +# $output = _prepare_proto_obj_list($proto_ctx) +# +# $proto_ctx - the proto context + +# $proto_ctx->{OBJ_LIST} - the list of objectfiles which sould be scanned by make proto +# +# $output - the resulting output buffer +sub _prepare_proto_obj_list($) +{ + my $ctx = shift; + my $tmplist; + my $output; + + $tmplist = array2oneperline($ctx->{OBJ_LIST}); + + $output = " +################################### +# Start PROTO OBJ LIST +PROTO_OBJS =$tmplist +# End PROTO OBJ LIST +################################### +"; + + return $output; +} + +sub _prepare_proto_rules() +{ + my $output = ""; + + $output .= " +# Making this target will just make sure that the prototype files +# exist, not necessarily that they are up to date. Since they're +# removed by 'make clean' this will always be run when you do anything +# afterwards. +proto_exists: \$(builddir)/include/proto.h \$(builddir)/include/build_env.h + +delheaders: pch_clean + -rm -f \$(builddir)/include/proto.h \$(builddir)/include/build_env.h: + +include/proto.h: + \@cd \$(srcdir) && \$(SHELL) script/mkproto.sh \$(PERL) \\ + -h _PROTO_H_ \$(builddir)/include/proto.h \\ + \$(PROTO_OBJS) + +include/build_env.h: + \@echo Building include/build_env.h + \@cd \$(srcdir) && \$(SHELL) script/build_env.sh \$(srcdir) \$(builddir) \$(CC) > \$(builddir)/include/build_env.h + +# 'make headers' or 'make proto' calls a subshell because we need to +# make sure these commands are executed in sequence even for a +# parallel make. +headers: delheaders \$(builddir)/include/proto.h \$(builddir)/include/build_env.h + +proto: idl headers + +proto_test: + \@[ -f \$(builddir)/include/proto.h ] || \$(MAKE) proto + +clean: delheaders + -rm -f *.o */*.o */*/*.o */*/*/*.o bin/* + -rm -rf librpc/gen_* + +distclean: clean + -rm -f bin/.dummy + -rm -f include/config.h + -rm -f Makefile* + -rm -f config.status + -rm -f config.smb_build.* + -rm -f config.log config.cache + +removebackup: + -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~ + +realdistclean: distclean removebackup + -rm -f include/config.h.in + -rm -f lib/version.h + -rm -f configure +"; + + return $output; +} + +sub _prepare_make_target($) +{ + my $ctx = shift; + my $tmpdepend; + my $output; + + $tmpdepend = array2oneperline($ctx->{DEPEND_LIST}); + + $output = " +################################### +# Start Target $ctx->{TARGET} +$ctx->{TARGET}: basics $tmpdepend +# End Target $ctx->{TARGET} +################################### +"; + + return $output; +} + +sub _prepare_obj_lists($) +{ + my $CTX = shift; + my $output = ""; + + foreach my $key (sort keys %{$CTX->{OUTPUT}{SUBSYSTEMS}}) { + $output .= _prepare_subsystem_obj_list(\%{$CTX->{OUTPUT}{SUBSYSTEMS}{$key}}); + } + + foreach my $key (sort keys %{$CTX->{OUTPUT}{SHARED_MODULES}}) { + $output .= _prepare_module_obj_list(\%{$CTX->{OUTPUT}{SHARED_MODULES}{$key}}); + } + + foreach my $key (sort keys %{$CTX->{OUTPUT}{LIBRARIES}}) { + $output .= _prepare_library_obj_list(\%{$CTX->{OUTPUT}{LIBRARIES}{$key}}); + } + + foreach my $key (sort keys %{$CTX->{OUTPUT}{BINARIES}}) { + $output .= _prepare_binary_obj_list(\%{$CTX->{OUTPUT}{BINARIES}{$key}}); + } + + $output .= _prepare_proto_obj_list(\%{$CTX->{OUTPUT}{PROTO}}); + + return $output; +} + +sub _prepare_install_rules($) +{ + my $CTX = shift; + my $output = ""; + + $output .= " + +showlayout: + \@echo \"Samba will be installed into:\" + \@echo \" basedir: \$(BASEDIR)\" + \@echo \" bindir: \$(BINDIR)\" + \@echo \" sbindir: \$(SBINDIR)\" + \@echo \" libdir: \$(LIBDIR)\" + \@echo \" vardir: \$(VARDIR)\" + +SBIN_PROGS = bin/smbd + +BIN_PROGS = bin/smbclient + +TORTURE_PROGS = bin/smbtorture \\ + bin/gentest \\ + bin/locktest \\ + bin/masktest \\ + bin/ndrdump + +LDB_PROGS = bin/ldbadd \\ + bin/ldbdel \\ + bin/ldbmodify \\ + bin/ldbedit \\ + bin/ldbsearch + +REG_PROGS = bin/regpatch \\ + bin/regshell \\ + bin/regtree \\ + bin/regpatch \\ + bin/regdiff + +install: showlayout installbin installtorture installldb installreg installdat + +# DESTDIR is used here to prevent packagers wasting their time +# duplicating the Makefile. Remove it and you will have the privelege +# of package each samba release for muliple versions of multiple +# distributions and operating systems, or at least supplying patches +# to all the packaging files required for this, prior to committing +# the removal of DESTDIR. Do not remove it even though you think it +# is not used + +installdirs: + +installbin: all installdirs + \@\$(SHELL) \$(srcdir)/script/installbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(SBINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(SBIN_PROGS) + \@\$(SHELL) \$(srcdir)/script/installbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(BIN_PROGS) + +installtorture: all installdirs + \@\$(SHELL) \$(srcdir)/script/installbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(TORTURE_PROGS) + +installldb: all installdirs + \@\$(SHELL) \$(srcdir)/script/installbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(LDB_PROGS) + +installreg: all installdirs + \@\$(SHELL) \$(srcdir)/script/installbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(REG_PROGS) + +installdat: installdirs + \@\$(SHELL) \$(srcdir)/script/installdat.sh \$(DESTDIR)\$(LIBDIR) \$(srcdir) + +uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg + +uninstallbin: + \@\$(SHELL) \$(srcdir)/script/uninstallbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(SBINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(DESTDIR)\$(SBIN_PROGS) + +uninstalltorture: + \@\$(SHELL) \$(srcdir)/script/uninstallbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(DESTDIR)\$(TORTURE_PROGS) + +uninstallldb: + \@\$(SHELL) \$(srcdir)/script/uninstallbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(DESTDIR)\$(LDB_PROGS) + +uninstallreg: + \@\$(SHELL) \$(srcdir)/script/uninstallbin.sh \$(INSTALLPERMS) \$(DESTDIR)\$(BASEDIR) \$(DESTDIR)\$(BINDIR) \$(DESTDIR)\$(LIBDIR) \$(DESTDIR)\$(VARDIR) \$(DESTDIR)\$(REG_PROGS) + +# Swig extensions + +PYTHON_TDB_OBJ = lib/tdb/tdb.o lib/tdb/spinlock.o +PYTHON_TDB_PICOBJ = \$(PYTHON_TDB_OBJ:.o=.po) + +swig: scripting/swig/python/_tdb.so + +swig_clean: + -rm -f scripting/swig/python/_tdb.so scripting/swig/python/tdb.pyc \\ + scripting/swig/python/tdb.py scripting/swig/python/tdb_wrap.c \\ + scripting/swig/python/tdb_wrap.po + +scripting/swig/python/tdb.py: scripting/swig/tdb.i + swig -python scripting/swig/tdb.i + mv scripting/swig/tdb.py scripting/swig/python + mv scripting/swig/tdb_wrap.c scripting/swig/python + +scripting/swig/python/_tdb.so: scripting/swig/python/tdb.py scripting/swig/python/tdb_wrap.po \$(PYTHON_TDB_PICOBJ) + \$(SHLD) \$(LDSHFLAGS) -o scripting/swig/python/_tdb.so scripting/swig/python/tdb_wrap.po \\ + \$(PYTHON_TDB_PICOBJ) + +"; + + return $output; +} + +sub _prepare_rule_lists($) +{ + my $CTX = shift; + my $output = ""; + + foreach my $key (sort keys %{$CTX->{OUTPUT}{SHARED_MODULES}}) { + $output .= _prepare_shared_module_rule(\%{$CTX->{OUTPUT}{SHARED_MODULES}{$key}}); + } + + foreach my $key (sort keys %{$CTX->{OUTPUT}{LIBRARIES}}) { + $output .= _prepare_library_rule(\%{$CTX->{OUTPUT}{LIBRARIES}{$key}}); + } + + foreach my $key (sort keys %{$CTX->{OUTPUT}{BINARIES}}) { + $output .= _prepare_binary_rule(\%{$CTX->{OUTPUT}{BINARIES}{$key}}); + } + + my $idl_ctx; + $output .= _prepare_IDL($idl_ctx); + + $output .= _prepare_proto_rules(); + + $output .= _prepare_install_rules($CTX); + + return $output; +} + +########################################################### +# This function prepares the output for Makefile +# +# $output = _prepare_makefile_in($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# $output - the resulting output buffer +sub _prepare_makefile_in($) +{ + my $CTX = shift; + my $output; + + $output = "########################################\n"; + $output .= "# Autogenerated by config.smb_build.pl #\n"; + $output .= "########################################\n"; + + my $cmd_ctx; + $output .= _prepare_command_interpreters($cmd_ctx); + + my $path_ctx; + $output .= _prepare_path_vars($path_ctx); + + my $compiler_ctx; + $output .= _prepare_compiler_linker($compiler_ctx); + + my $rules_ctx; + $output .= _prepare_default_rule($rules_ctx); + + my $suffix_ctx; + $output .= _prepare_SUFFIXES($suffix_ctx); + + $output .= _prepare_dummy_MAKEDIR(); + + $output .= _prepare_std_CC_rule("c","o","Compiling","Rule for std objectfiles"); + $output .= _prepare_std_CC_rule("h","h.gch","Precompiling","Rule for precompiled headerfiles"); + + $output .= _prepare_obj_lists($CTX); + + $output .= _prepare_rule_lists($CTX); + + $output .= _prepare_make_target(\%{$CTX->{OUTPUT}{TARGETS}{ALL}}); + + return $output; +} + +########################################################### +# This function creates Makefile.in from the SMB_BUILD +# context +# +# create_makefile_in($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# $output - the resulting output buffer +sub create_makefile_in($) +{ + my $CTX = shift; + my $output; + + $output = _prepare_makefile_in($CTX); + + open(MAKEFILE_IN,"> Makefile.in") || die ("Can't open Makefile.in\n"); + + print MAKEFILE_IN $output; + + close(MAKEFILE_IN); + + print "config.smb_build.pl: creating Makefile.in\n"; + return; +} diff --git a/source4/build/smb_build/output.pl b/source4/build/smb_build/output.pl new file mode 100644 index 0000000000..2705cd8e79 --- /dev/null +++ b/source4/build/smb_build/output.pl @@ -0,0 +1,191 @@ +########################################################### +### SMB Build System ### +### - the output generating functions ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +sub _generate_ext_libs($) +{ + my $CTX = shift; + + # + # loop over all binaries + # + foreach my $key (sort keys %{$CTX->{DEPEND}{EXT_LIBS}}) { + my $NAME = $CTX->{INPUT}{EXT_LIBS}{$key}{NAME}; + + # + # set the lists + # + $CTX->{OUTPUT}{EXT_LIBS}{$key}{NAME} = $NAME; + @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{LIBS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LIBS}}; + @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{CFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CFLAGS}}; + @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{CPPFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{CPPFLAGS}}; + @{$CTX->{OUTPUT}{EXT_LIBS}{$key}{LDFLAGS}} = @{$CTX->{DEPEND}{EXT_LIBS}{$key}{LDFLAGS}}; + } + + return; +} + +sub _generate_subsystems($) +{ + my $CTX = shift; + + # + # loop over all subsystems + # + foreach my $key (sort keys %{$CTX->{DEPEND}{SUBSYSTEMS}}) { + my $NAME = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; + my @OBJ_LIST = @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}}; + + push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(SUBSYSTEM_$key\_OBJS)"); + + # + # set the lists + # + $CTX->{OUTPUT}{SUBSYSTEMS}{$key}{NAME} = $NAME; + @{$CTX->{OUTPUT}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST; + } + + return; +} + +sub _generate_shared_modules($) +{ + my $CTX = shift; + + # + # loop over all shared modules + # + foreach my $key (sort keys %{$CTX->{DEPEND}{SHARED_MODULES}}) { + my $NAME = $CTX->{INPUT}{MODULES}{$key}{NAME}; + my @OBJ_LIST = (); + # + my $MODULE = $NAME.".so"; + my @DEPEND_LIST = ("\$(MODULE_$NAME\_OBJS)"); + my @LINK_LIST = ("\$(MODULE_$NAME\_OBJS)"); + my @LINK_FLAGS = (); + + push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(MODULE_$key\_OBJS)"); + push(@{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}},"bin/$MODULE"); + + push(@OBJ_LIST,@{$CTX->{INPUT}{MODULES}{$key}{INIT_OBJ_FILES}}); + push(@OBJ_LIST,@{$CTX->{INPUT}{MODULES}{$key}{ADD_OBJ_FILES}}); + + foreach my $elem (@{$CTX->{DEPEND}{SHARED_MODULES}{$key}{SUBSYSTEMS_LIST}}) { + if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) { + die("Shared Module[$NAME] depends on unkown Subsystem[$elem]!\n"); + } + push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)"); + push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)"); + } + + foreach my $elem (@{$CTX->{DEPEND}{SHARED_MODULES}{$key}{LIBRARIES_LIST}}) { + if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) { + die("Share Module[$NAME] depends on unkown External Library[$elem]!\n"); + } + push(@LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}}); + push(@LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}}); + } + + # + # set the lists + # + $CTX->{OUTPUT}{SHARED_MODULES}{$key}{NAME} = $NAME; + @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{OBJ_LIST}} = @OBJ_LIST; + # + $CTX->{OUTPUT}{SHARED_MODULES}{$key}{MODULE} = $MODULE; + @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{DEPEND_LIST}} = @DEPEND_LIST; + @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{LINK_LIST}} = @LINK_LIST; + @{$CTX->{OUTPUT}{SHARED_MODULES}{$key}{LINK_FLAGS}} = @LINK_FLAGS; + } + + return; +} + +sub _generate_libraries($) +{ + return; +} + +sub _generate_binaries($) +{ + my $CTX = shift; + + # + # loop over all binaries + # + foreach my $key (sort keys %{$CTX->{DEPEND}{BINARIES}}) { + my $NAME = $CTX->{INPUT}{BINARIES}{$key}{NAME}; + my @OBJ_LIST = @{$CTX->{INPUT}{BINARIES}{$key}{OBJ_FILES}}; + # + my $BINARY = $NAME; + my @DEPEND_LIST = ("\$(BINARY_$NAME\_OBJS)"); + my @LINK_LIST = ("\$(BINARY_$NAME\_OBJS)"); + my @LINK_FLAGS = (); + + push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(BINARY_$key\_OBJS)"); + push(@{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}},"bin/$BINARY"); + + foreach my $elem (@{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}}) { + if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) { + die("Binary[$NAME] depends on unkown Subsystem[$elem]!\n"); + } + push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)"); + push(@LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)"); + } + + foreach my $elem (@{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}}) { + if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) { + die("Binary[$NAME] depends on unkown External Library[$elem]!\n"); + } + push(@LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}}); + push(@LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}}); + } + + # + # set the lists + # + $CTX->{OUTPUT}{BINARIES}{$key}{NAME} = $NAME; + @{$CTX->{OUTPUT}{BINARIES}{$key}{OBJ_LIST}} = @OBJ_LIST; + # + $CTX->{OUTPUT}{BINARIES}{$key}{BINARY} = $BINARY; + @{$CTX->{OUTPUT}{BINARIES}{$key}{DEPEND_LIST}} = @DEPEND_LIST; + @{$CTX->{OUTPUT}{BINARIES}{$key}{LINK_LIST}} = @LINK_LIST; + @{$CTX->{OUTPUT}{BINARIES}{$key}{LINK_FLAGS}} = @LINK_FLAGS; + } + + return; +} + +########################################################### +# This function generates the output +# +# create_output($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub create_output($) +{ + my $CTX = shift; + + $CTX->{OUTPUT}{PROTO} = (); + @{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}} = (); + + $CTX->{OUTPUT}{TARGETS}{ALL} = (); + $CTX->{OUTPUT}{TARGETS}{ALL}{TARGET} = "all"; + @{$CTX->{OUTPUT}{TARGETS}{ALL}{DEPEND_LIST}} = (); + + _generate_ext_libs($CTX); + + _generate_subsystems($CTX); + + _generate_shared_modules($CTX); + + _generate_libraries($CTX); + + _generate_binaries($CTX); + + return; +} diff --git a/source4/build/smb_build/public.m4 b/source4/build/smb_build/public.m4 new file mode 100644 index 0000000000..9bfcd549b8 --- /dev/null +++ b/source4/build/smb_build/public.m4 @@ -0,0 +1,441 @@ +dnl SMB Build System +dnl ---------------- +dnl ---------------- +dnl +dnl SMB_MODULE_DEFAULT( +dnl 1:name, +dnl 2:default_build +dnl ) +dnl +dnl SMB_MODULE ( +dnl 1:name, +dnl 2:subsystem, +dnl 3:default_build, +dnl 4:init_obj_files, +dnl 5:add_obj_files, +dnl 6:required_libs, +dnl 7:required_subsystems +dnl ) +dnl +dnl SMB_MODULE_MK( +dnl 1:name, +dnl 2:subsystem, +dnl 3:default_build, +dnl 4:config_mk_file +dnl ) +dnl +dnl SMB_SUBSYSTEM_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +dnl +dnl SMB_SUBSYSTEM( +dnl 1:name, +dnl 2:init_obj_files, +dnl 3:add_obj_files, +dnl 4:required_libs, +dnl 5:required_subsystems +dnl ) +dnl +dnl SMB_SUBSYSTEM_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +dnl +dnl SMB_EXT_LIB_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +dnl +dnl SMB_EXT_LIB( +dnl 1:name, +dnl 2:libs, +dnl 3:cflags, +dnl 4:cppflags, +dnl 5:ldflags +dnl ) +dnl +dnl SMB_LIBRARY_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +dnl +dnl SMB_LIBRARY( +dnl 1:name, +dnl 2:obj_files, +dnl 3:required_libs, +dnl 4:required_subsystems +dnl ) +dnl +dnl SMB_LIBRARY_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +dnl +dnl SMB_BINARY_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +dnl +dnl SMB_BINARY( +dnl 1:name, +dnl 2:build_targets, +dnl 3:install_path +dnl 4:obj_files, +dnl 5:required_libs, +dnl 6:required_subsystems +dnl ) +dnl +dnl SMB_BINARY_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +dnl +dnl SMB_MAKE_TARGET( +dnl 1:name +dnl 2:calledname +dnl ) +dnl +dnl SMB_AC_OUTPUT( +dnl 1: outputfile +dnl ) + +dnl ####################################################### +dnl ### And now the implementation ### +dnl ####################################################### + +dnl SMB_MODULE_DEFAULT( +dnl 1:name, +dnl 2:default_build +dnl ) +AC_DEFUN([SMB_MODULE_DEFAULT], +[ + [SMB_MODULE_DEFAULT_][$1]="$2" +]) + +dnl SMB_MODULE ( +dnl 1:name, +dnl 2:subsystem, +dnl 3:default_build, +dnl 4:init_obj_files, +dnl 5:add_obj_files, +dnl 6:required_libs, +dnl 7:required_subsystems +dnl ) +AC_DEFUN([SMB_MODULE], +[ + + if test -z "$[SMB_MODULE_DEFAULT_][$1]"; then + [SMB_MODULE_DEFAULT_][$1]=$3 + fi + + if test "$[SMB_MODULE_][$1]"; then + [SMB_MODULE_][$1]=$[SMB_MODULE_][$1] + elif test "$[SMB_MODULE_]translit([$2], [A-Z], [a-z])" -a x"$[SMB_MODULE_DEFAULT_][$1]" != xNOT; then + [SMB_MODULE_][$1]=$[SMB_MODULE_]translit([$2], [A-Z], [a-z]) + else + [SMB_MODULE_][$1]="DEFAULT"; + fi + +SMB_INFO_MODULES="$SMB_INFO_MODULES +################################### +# Start MODULE $1 +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{NAME} = \"$1\"; +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{SUBSYSTEM} = \"$2\"; +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{DEFAULT_BUILD} = \"$[SMB_MODULE_DEFAULT_][$1]\"; +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{INIT_OBJ_FILES}} = str2array(\"$4\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{ADD_OBJ_FILES}} = str2array(\"$5\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$6\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$7\"); +# +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{CHOSEN_BUILD} = \"$[SMB_MODULE_][$1]\"; +# End MODULE $1 +################################### +" +]) + +dnl SMB_MODULE_MK( +dnl 1:name, +dnl 2:subsystem, +dnl 3:default_build, +dnl 4:config_mk_file +dnl ) +AC_DEFUN([SMB_MODULE_MK], +[ + + if test -z "$[SMB_MODULE_DEFAULT_][$1]"; then + [SMB_MODULE_DEFAULT_][$1]=$3 + fi + + if test "$[SMB_MODULE_][$1]"; then + [SMB_MODULE_][$1]=$[SMB_MODULE_][$1] + elif test "$[SMB_MODULE_]translit([$2], [A-Z], [a-z])" -a x"$[SMB_MODULE_DEFAULT_][$1]" != xNOT; then + [SMB_MODULE_][$1]=$[SMB_MODULE_]translit([$2], [A-Z], [a-z]) + else + [SMB_MODULE_][$1]="DEFAULT"; + fi + +SMB_INFO_MODULES="$SMB_INFO_MODULES +################################### +# Start MODULE $1 +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{NAME} = \"$1\"; +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{SUBSYSTEM} = \"$2\"; +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{DEFAULT_BUILD} = \"$[SMB_MODULE_DEFAULT_][$1]\"; +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{INIT_OBJ_FILES}} = module_get_array(\"$4\", \"$1\", \"INIT_OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{ADD_OBJ_FILES}} = module_get_array(\"$4\", \"$1\", \"ADD_OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_LIBRARIES}} = module_get_array(\"$4\", \"$1\", \"REQUIRED_LIBRARIES\"); +@{\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{REQUIRED_SUBSYSTEMS}} = module_get_array(\"$4\", \"$1\", \"REQUIRED_SUBSYSTEMS\"); +# +\$SMB_BUILD_CTX->{INPUT}{MODULES}{$1}{CHOSEN_BUILD} = \"$[SMB_MODULE_][$1]\"; +# End MODULE $1 +################################### +" +]) + +dnl SMB_SUBSYSTEM_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +AC_DEFUN([SMB_SUBSYSTEM_ENABLE], +[ + [SMB_SUBSYSTEM_ENABLE_][$1]="$2" +]) + +dnl SMB_SUBSYSTEM( +dnl 1:name, +dnl 2:init_obj_files, +dnl 3:add_obj_files, +dnl 4:required_libs, +dnl 5:required_subsystems +dnl ) +AC_DEFUN([SMB_SUBSYSTEM], +[ + + if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then + [SMB_SUBSYSTEM_ENABLE_][$1]="YES"; + fi + +SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS +################################### +# Start Subsystem $1 +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{INIT_OBJ_FILES}} = str2array(\"$2\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ADD_OBJ_FILES}} = str2array(\"$3\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$4\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$5\"); +# +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ENABLE} = \"$[SMB_SUBSYSTEM_ENABLE_][$1]\"; +# End Subsystem $1 +################################### +" +]) + +dnl SMB_SUBSYSTEM_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +AC_DEFUN([SMB_SUBSYSTEM_MK], +[ + + if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then + [SMB_SUBSYSTEM_ENABLE_][$1]="YES"; + fi + +SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS +################################### +# Start Subsystem $1 +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{INIT_OBJ_FILES}} = subsystem_get_array(\"$2\", \"$1\", \"INIT_OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ADD_OBJ_FILES}} = subsystem_get_array(\"$2\", \"$1\", \"ADD_OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_LIBRARIES}} = subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\"); +@{\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{REQUIRED_SUBSYSTEMS}} = subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\"); +# +\$SMB_BUILD_CTX->{INPUT}{SUBSYSTEMS}{$1}{ENABLE} = \"$[SMB_SUBSYSTEM_ENABLE_][$1]\"; +# End Subsystem $1 +################################### +" +]) + +dnl SMB_EXT_LIB_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +AC_DEFUN([SMB_EXT_LIB_ENABLE], +[ + [SMB_EXT_LIB_ENABLE_][$1]="$2" +]) + +dnl SMB_EXT_LIB( +dnl 1:name, +dnl 2:libs, +dnl 3:cflags, +dnl 4:cppflags, +dnl 5:ldflags +dnl ) +AC_DEFUN([SMB_EXT_LIB], +[ + + if test -z "$[SMB_EXT_LIB_ENABLE_][$1]"; then + [SMB_EXT_LIB_ENABLE_][$1]="NO"; + fi + +SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS +################################### +# Start Ext Lib $1 +\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{LIBS}} = str2array(\"$2\"); +@{\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{CFLAGS}} = str2array(\"$3\"); +@{\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{CPPFLAGS}} = str2array(\"$4\"); +@{\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{LDFLAGS}} = str2array(\"$5\"); +# +\$SMB_BUILD_CTX->{INPUT}{EXT_LIBS}{$1}{ENABLE} = \"$[SMB_EXT_LIB_ENABLE_][$1]\"; +# End Ext Lib $1 +################################### +" +]) + + +dnl SMB_LIBRARY_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +AC_DEFUN([SMB_LIBRARY_ENABLE], +[ + [SMB_LIBRARY_ENABLE_][$1]="$2" +]) + +dnl SMB_LIBRARY( +dnl 1:name, +dnl 2:obj_files, +dnl 3:required_libs, +dnl 4:required_subsystems +dnl ) +AC_DEFUN([SMB_LIBRARY], +[ + + if test -z "$[SMB_LIBRARY_ENABLE_][$1]"; then + [SMB_LIBRARY_ENABLE_][$1]="YES"; + fi + +SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES +################################### +# Start Library $1 +\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{OBJ_FILES}} = str2array(\"$2\"); +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$3\"); +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$4\"); +# +\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{ENABLE} = \"$[SMB_LIBRARY_ENABLE_][$1]\"; +# End Library $1 +################################### +" +]) + +dnl SMB_LIBRARY_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +AC_DEFUN([SMB_LIBRARY_MK], +[ + + if test -z "$[SMB_LIBRARY_ENABLE_][$1]"; then + [SMB_LIBRARY_ENABLE_][$1]="YES"; + fi + +SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES +################################### +# Start Library $1 +\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{OBJ_FILES}} = library_get_array(\"$2\", \"$1\", \"OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_LIBRARIES}} = library_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\"); +@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_SUBSYSTEMS}} = library_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\"); +# +\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{ENABLE} = \"$[SMB_LIBRARY_ENABLE_][$1]\"; +# End Library $1 +################################### +" +]) + +dnl SMB_BINARY_ENABLE( +dnl 1:name, +dnl 2:default_build +dnl ) +AC_DEFUN([SMB_BINARY_ENABLE], +[ + [SMB_BINARY_ENABLE_][$1]="$2"; +]) + +dnl SMB_BINARY( +dnl 1:name, +dnl 2:build_targets, +dnl 3:install_path +dnl 4:objfiles, +dnl 5:required_libs, +dnl 6:required_subsystems +dnl ) +AC_DEFUN([SMB_BINARY], +[ + + if test -z "$[SMB_BINARY_ENABLE_][$1]"; then + [SMB_BINARY_ENABLE_][$1]="YES"; + fi + +SMB_INFO_BINARIES="$SMB_INFO_BINARIES +################################### +# Start Binary $1 +\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{BUILD_TARGETS}} = str2array(\"$2\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{INSTALL_PATH}} = str2array(\"$3\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{OBJ_FILES}} = str2array(\"$4\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$5\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$6\"); +# +\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{ENABLE} = \"$[SMB_BINARY_ENABLE_][$1]\"; +# End Binary $1 +################################### +" +]) + +dnl SMB_BINARY_MK( +dnl 1:name, +dnl 2:config_mk_file +dnl ) +AC_DEFUN([SMB_BINARY_MK], +[ + + if test -z "$[SMB_BINARY_ENABLE_][$1]"; then + [SMB_BINARY_ENABLE_][$1]="YES"; + fi + +SMB_INFO_BINARIES="$SMB_INFO_BINARIES +################################### +# Start Binary $1 +\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{NAME} = \"$1\"; +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{BUILD_TARGETS}} = binary_get_array(\"$2\", \"$1\", \"BUILD_TARGETS\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{INSTALL_PATH}} = binary_get_array(\"$2\", \"$1\", \"INSTALL_PATH\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{OBJ_FILES}} = binary_get_array(\"$2\", \"$1\", \"OBJ_FILES\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{REQUIRED_LIBRARIES}} = binary_get_array(\"$2\", \"$1\",\"REQUIRED_LIBRARIES\"); +@{\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{REQUIRED_SUBSYSTEMS}} = binary_get_array(\"$2\", \"$1\",\"REQUIRED_SUBSYSTEMS\"); +# +\$SMB_BUILD_CTX->{INPUT}{BINARIES}{$1}{ENABLE} = \"$[SMB_BINARY_ENABLE_][$1]\"; +# End Binary $1 +################################### +" +]) + +dnl SMB_MAKE_TARGET( +dnl 1:name +dnl 2:calledname +dnl ) +AC_DEFUN([SMB_MAKE_TARGET], +[ + echo "#SMB_MAKE_TARGET TOTO" +]) + +dnl SMB_AC_OUTPUT( +dnl 1: outputfile +dnl ) +AC_DEFUN([SMB_AC_OUTPUT], +[ + AC_OUTPUT([$1],[],[_SMB_BUILD_CORE([[$1][.in]])]) +]) diff --git a/source4/build/smb_build/smb_build_h.pl b/source4/build/smb_build/smb_build_h.pl new file mode 100644 index 0000000000..7a829dd684 --- /dev/null +++ b/source4/build/smb_build/smb_build_h.pl @@ -0,0 +1,84 @@ +########################################################### +### SMB Build System ### +### - create output for smb_build.h ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +sub _add_define_section($) +{ + my $DEFINE = shift; + my $output = ""; + + $output .= " +/* $DEFINE->{COMMENT} */ +#define $DEFINE->{KEY} $DEFINE->{VAL} +"; + + return $output; +} + +sub _prepare_smb_build_h($) +{ + my $CTX = shift; + my $output = ""; + + # + # loop over all subsystems + # + foreach my $key (sort keys %{$CTX->{DEPEND}{SUBSYSTEMS}}) { + my $NAME = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; + my $DEFINE = (); + my $name = lc($NAME); + + $DEFINE->{COMMENT} = "SUBSYSTEM $NAME INIT"; + $DEFINE->{KEY} = "static_init_$name"; + $DEFINE->{VAL} = "do { \\\n"; + foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}}) { + $DEFINE->{VAL} .= "\t\t$subkey\_init(); \\\n"; + } + $DEFINE->{VAL} .= "\t} while(0)"; + + push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE); + } + + # + # loop over all SMB_BUILD_H define sections + # + foreach my $key (@{$CTX->{OUTPUT}{SMB_BUILD_H}}) { + $output .= _add_define_section($key); + } + + return $output; +} + +########################################################### +# This function creates include/smb_build.h from the SMB_BUILD +# context +# +# create_smb_build_h($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# $output - the resulting output buffer +sub create_smb_build_h($) +{ + my $CTX = shift; + my $output = "/* autogenerated by config.smb_build.pl */\n"; + + $output .= _prepare_smb_build_h($CTX); + + # + # TODO: check if directory include/ exists + # + + open(SMB_BUILD_H,"> include/smb_build.h") || die ("Can't open include/smb_build.h\n"); + + print SMB_BUILD_H $output; + + close(SMB_BUILD_H); + + print "config.smb_build.pl: creating include/smb_build.h\n"; + return; +} diff --git a/source4/configure.in b/source4/configure.in index 3b5640112c..4bc3bea1d1 100644 --- a/source4/configure.in +++ b/source4/configure.in @@ -170,7 +170,7 @@ AC_ARG_WITH(exclude-modules, [ if test $withval; then for i in `echo $withval | sed -e's/,/ /g'` do - eval MODULE_$i=NOT + eval SMB_MODULE_$i=NOT done fi ]) @@ -180,7 +180,7 @@ AC_ARG_WITH(shared-modules, [ if test $withval; then for i in `echo $withval | sed -e's/,/ /g'` do - eval MODULE_$i=SHARED + eval SMB_MODULE_$i=SHARED done fi ]) @@ -190,7 +190,7 @@ AC_ARG_WITH(static-modules, [ if test $withval; then for i in `echo $withval | sed -e's/,/ /g'` do - eval MODULE_$i=STATIC + eval SMB_MODULE_$i=STATIC done fi ]) @@ -214,6 +214,60 @@ sinclude(lib/registry/config.m4) sinclude(torture/config.m4) sinclude(scripting/config.m4) +ALLLIBS_LIBS="$LIBS" +ALLLIBS_CFLAGS="$CFLAGS" +ALLLIBS_CPPFLAGS="$CPPFLAGS" +ALLLIBS_LDFLAGS="$LDFLAGS" + +SMB_EXT_LIB_ENABLE(ALLLIBS,YES) + +SMB_EXT_LIB(ALLLIBS, + [${ALLLIBS_LIBS}], + [${ALLLIBS_CFLAGS}], + [${ALLLIBS_CPPFLAGS}], + [${ALLLIBS_LDFLAGS}]) + +SMB_BINARY(smbd, [ALL], [SBIN], + [smbd/server.o + smbd/process.o + lib/server_mutex.o + smbd/build_options.o + smbd/rewrite.o], + [], + [PROCESS_MODEL SMB AUTH PASSDB NTVFS DCERPC LIBBASIC CONFIG LIBCMDLINE LIBSMB REGISTRY]) + +SMB_BINARY(smbclient, [ALL], [BIN], + [client/client.o + client/clitar.o + libcli/raw/clirewrite.o], + [], + [LIBSMB CONFIG LIBBASIC LIBCMDLINE]) + +SMB_BINARY(ndrdump, [ALL], [BIN], + [utils/ndrdump.o + utils/rewrite.o], + [], + [LIBSMB CONFIG LIBBASIC LIBCMDLINE]) + +SMB_BINARY(gentest, [ALL], [BIN], + [torture/gentest.o + torture/torture_util.o + libcli/raw/clirewrite.o], + [], + [LIBSMB CONFIG LIBBASIC LIBCMDLINE]) + +SMB_BINARY(masktest, [ALL], [BIN], + [torture/masktest.o + libcli/raw/clirewrite.o], + [], + [LIBSMB CONFIG LIBBASIC LIBCMDLINE]) + +SMB_BINARY(locktest, [ALL], [BIN], + [torture/locktest.o + libcli/raw/clirewrite.o], + [], + [LIBSMB CONFIG LIBBASIC LIBCMDLINE]) + AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules]) ################################################# @@ -243,4 +297,4 @@ dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS CFLAGS_REMOVE_USR_INCLUDE(CFLAGS) CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS) -AC_OUTPUT(Makefile) +SMB_AC_OUTPUT(Makefile) diff --git a/source4/dynconfig.c b/source4/dynconfig.c index 8147b22160..7c09f9805b 100644 --- a/source4/dynconfig.c +++ b/source4/dynconfig.c @@ -40,7 +40,7 @@ * table? There's kind of a chicken-and-egg situation there... **/ -char const *dyn_SBINDIR = SBINDIR, +const char *dyn_SBINDIR = SBINDIR, *dyn_BINDIR = BINDIR; pstring dyn_CONFIGFILE = CONFIGFILE; /**< Location of smb.conf file. **/ diff --git a/source4/include/includes.h b/source4/include/includes.h index de06b4d8a5..42d4c2552e 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -23,6 +23,7 @@ #ifndef NO_CONFIG_H /* for some tests */ #include "config.h" +#include "smb_build.h" #endif #include "local.h" diff --git a/source4/lib/basic.m4 b/source4/lib/basic.m4 index 712a4826b7..ac5f82440e 100644 --- a/source4/lib/basic.m4 +++ b/source4/lib/basic.m4 @@ -1,26 +1,26 @@ dnl # LIB BASIC subsystem SMB_SUBSYSTEM(LIBBASIC,[lib/version.o], - [lib/debug.o lib/fault.o \ - lib/getsmbpass.o lib/interface.o \ - lib/interfaces.o lib/pidfile.o lib/replace.o \ - lib/signal.o lib/system.o lib/sendfile.o lib/time.o \ - lib/genrand.o lib/username.o \ - lib/util_getent.o lib/util_pw.o lib/smbrun.o \ - lib/bitmap.o lib/snprintf.o lib/dprintf.o \ - lib/xfile.o lib/wins_srv.o \ - lib/util_str.o lib/util_sid.o lib/util_uuid.o \ - lib/util_unistr.o lib/util_file.o lib/data_blob.o \ - lib/util.o lib/util_sock.o \ - lib/talloc.o lib/substitute.o lib/fsusage.o \ - lib/ms_fnmatch.o lib/select.o lib/messages.o \ - lib/tallocmsg.o lib/dmallocmsg.o \ - lib/smbpasswd.o \ - nsswitch/wb_client.o nsswitch/wb_common.o \ - lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o \ - lib/gencache.o lib/module.o lib/mutex.o \ - lib/ldap_escape.o lib/events.o \ - lib/crypto/crc32.o lib/crypto/md5.o \ - lib/crypto/hmacmd5.o lib/crypto/md4.o \ - lib/tdb/tdb.o lib/tdb/spinlock.o lib/tdb/tdbutil.o \$(CHARSET_OBJS)], - lib/libbasic_public_proto.h) + [lib/debug.o lib/fault.o + lib/getsmbpass.o lib/interface.o + lib/interfaces.o lib/pidfile.o lib/replace.o + lib/signal.o lib/system.o lib/sendfile.o lib/time.o + lib/genrand.o lib/username.o + lib/util_getent.o lib/util_pw.o lib/smbrun.o + lib/bitmap.o lib/snprintf.o lib/dprintf.o + lib/xfile.o lib/wins_srv.o + lib/util_str.o lib/util_sid.o lib/util_uuid.o + lib/util_unistr.o lib/util_file.o lib/data_blob.o + lib/util.o lib/util_sock.o + lib/talloc.o lib/substitute.o lib/fsusage.o + lib/ms_fnmatch.o lib/select.o lib/messages.o + lib/tallocmsg.o lib/dmallocmsg.o + lib/smbpasswd.o + nsswitch/wb_client.o nsswitch/wb_common.o + lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o + lib/gencache.o lib/module.o lib/mutex.o + lib/ldap_escape.o lib/events.o + lib/crypto/crc32.o lib/crypto/md5.o + lib/crypto/hmacmd5.o lib/crypto/md4.o + lib/tdb/tdb.o lib/tdb/spinlock.o lib/tdb/tdbutil.o],[], + [CHARSET]) diff --git a/source4/lib/cmdline/config.m4 b/source4/lib/cmdline/config.m4 index 6e9a8f4508..8316dff10f 100644 --- a/source4/lib/cmdline/config.m4 +++ b/source4/lib/cmdline/config.m4 @@ -72,8 +72,10 @@ AC_CHECK_LIB(readline, rl_completion_matches, TMP_LIBCMDLINE_OBJS="lib/cmdline/readline.o lib/cmdline/popt_common.o" TMP_LIBCMDLINE_LIBS="$TERMLIBS" +#hack... +LIBS="$LIBS $TERMLIBS" + SMB_SUBSYSTEM(LIBCMDLINE,[], [${TMP_LIBCMDLINE_OBJS}], - [], - [], - [${TMP_LIBCMDLINE_LIBS}]) + [ALLLIBS], + [LIBPOPT]) diff --git a/source4/lib/iconv.m4 b/source4/lib/iconv.m4 index 26512ff326..282fa69b2d 100644 --- a/source4/lib/iconv.m4 +++ b/source4/lib/iconv.m4 @@ -63,4 +63,4 @@ if test x"$ICONV_FOUND" = x"no" -o x"$samba_cv_HAVE_NATIVE_ICONV" != x"yes" ; th Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!]) fi -SMB_SUBSYSTEM(CHARSET,lib/iconv.o,lib/charcnv.o) +SMB_SUBSYSTEM(CHARSET,lib/iconv.o,lib/charcnv.o,[${TMP_CHARSET_LIBS}]) diff --git a/source4/lib/ldb/config.m4 b/source4/lib/ldb/config.m4 index f450acce00..16805132fd 100644 --- a/source4/lib/ldb/config.m4 +++ b/source4/lib/ldb/config.m4 @@ -1,45 +1,19 @@ if test x"$with_ldap_support" = x"yes"; then -SMB_SUBSYSTEM(LIBLDB_LDAP,[lib/ldb/ldb_ldap/ldb_ldap.o]) + SMB_MODULE_DEFAULT(libldb_ldap,STATIC) fi -SMB_SUBSYSTEM(LIBLDB,[lib/ldb/common/ldb.o], - [lib/ldb/common/ldb_ldif.o \ - lib/ldb/common/ldb_parse.o \ - lib/ldb/common/ldb_msg.o \ - lib/ldb/common/util.o \ - lib/ldb/common/ldb_utf8.o \ - lib/ldb/common/ldb_alloc.o \ - lib/ldb/common/ldb_debug.o \ - lib/ldb/ldb_tdb/ldb_search.o \ - lib/ldb/ldb_tdb/ldb_tdb.o \ - lib/ldb/ldb_tdb/ldb_pack.o \ - lib/ldb/ldb_tdb/ldb_index.o \ - lib/ldb/ldb_tdb/ldb_match.o \ - lib/ldb/ldb_tdb/ldb_cache.o \ - \$(LIBLDB_LDAP_OBJS)], - lib/ldb/include/ldb.h) - -SMB_SUBSYSTEM(LDBADD,[], - [lib/ldb/tools/ldbadd.o \ - \$(LIBBASIC_OBJS) \$(LIBSMB_OBJS) \$(CONFIG_OBJS) \$(LIBLDB_OBJS)], - lib/ldb/include/proto.h) - -SMB_SUBSYSTEM(LDBDEL,[], - [lib/ldb/tools/ldbdel.o \ - \$(LIBBASIC_OBJS) \$(LIBSMB_OBJS) \$(CONFIG_OBJS) \$(LIBLDB_OBJS)], - lib/ldb/include/proto.h) - -SMB_SUBSYSTEM(LDBMODIFY,[], - [lib/ldb/tools/ldbmodify.o \ - \$(LIBBASIC_OBJS) \$(LIBSMB_OBJS) \$(CONFIG_OBJS) \$(LIBLDB_OBJS)], - lib/ldb/include/proto.h) - -SMB_SUBSYSTEM(LDBSEARCH,[], - [lib/ldb/tools/ldbsearch.o \ - \$(LIBBASIC_OBJS) \$(LIBSMB_OBJS) \$(CONFIG_OBJS) \$(LIBLDB_OBJS)], - lib/ldb/include/proto.h) - -SMB_SUBSYSTEM(LDBEDIT,[], - [lib/ldb/tools/ldbedit.o \ - \$(LIBBASIC_OBJS) \$(LIBSMB_OBJS) \$(CONFIG_OBJS) \$(LIBLDB_OBJS)], - lib/ldb/include/proto.h) +SMB_MODULE_MK(libldb_ldap,LIBLDB,NOT,lib/ldb/config.mk) + +SMB_MODULE_MK(libldb_tdb,LIBLDB,STATIC,lib/ldb/config.mk) + +SMB_SUBSYSTEM_MK(LIBLDB,lib/ldb/config.mk) + +SMB_BINARY_MK(ldbadd,lib/ldb/config.mk) + +SMB_BINARY_MK(ldbdel,lib/ldb/config.mk) + +SMB_BINARY_MK(ldbmodify,lib/ldb/config.mk) + +SMB_BINARY_MK(ldbsearch,lib/ldb/config.mk) + +SMB_BINARY_MK(ldbedit,lib/ldb/config.mk) diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk new file mode 100644 index 0000000000..c44d3e6bf0 --- /dev/null +++ b/source4/lib/ldb/config.mk @@ -0,0 +1,88 @@ +################################################ +# Start MODULE libldb_ldap +[MODULE::libldb_ldap] +INIT_OBJ_FILES = \ + lib/ldb/ldb_ldap/ldb_ldap.o +# End MODULE libldb_tdb +################################################ + +################################################ +# Start MODULE libldb_tdb +[MODULE::libldb_tdb] +INIT_OBJ_FILES = \ + lib/ldb/ldb_tdb/ldb_tdb.o +ADD_OBJ_FILES = \ + lib/ldb/ldb_tdb/ldb_search.o \ + lib/ldb/ldb_tdb/ldb_pack.o \ + lib/ldb/ldb_tdb/ldb_index.o \ + lib/ldb/ldb_tdb/ldb_match.o \ + lib/ldb/ldb_tdb/ldb_cache.o +# End MODULE libldb_tdb +################################################ + +################################################ +# Start SUBSYSTEM LIBLDB +[SUBSYSTEM::LIBLDB] +INIT_OBJ_FILES = \ + lib/ldb/common/ldb.o +ADD_OBJ_FILES = \ + lib/ldb/common/ldb_ldif.o \ + lib/ldb/common/ldb_parse.o \ + lib/ldb/common/ldb_msg.o \ + lib/ldb/common/util.o \ + lib/ldb/common/ldb_utf8.o \ + lib/ldb/common/ldb_alloc.o \ + lib/ldb/common/ldb_debug.o +# +# End SUBSYSTEM LIBLDB +################################################ + +################################################ +# Start BINARY ldbadd +[BINARY::ldbadd] +OBJ_FILES= \ + lib/ldb/tools/ldbadd.o +REQUIRED_SUBSYSTEMS = \ + LIBBASIC LIBSMB CONFIG LIBCMDLINE LIBLDB +# End BINARY ldbadd +################################################ + +################################################ +# Start BINARY ldbdel +[BINARY::ldbdel] +OBJ_FILES= \ + lib/ldb/tools/ldbdel.o +REQUIRED_SUBSYSTEMS = \ + LIBBASIC LIBSMB CONFIG LIBCMDLINE LIBLDB +# End BINARY ldbdel +################################################ + +################################################ +# Start BINARY ldbmodify +[BINARY::ldbmodify] +OBJ_FILES= \ + lib/ldb/tools/ldbmodify.o +REQUIRED_SUBSYSTEMS = \ + LIBBASIC LIBSMB CONFIG LIBCMDLINE LIBLDB +# End BINARY ldbmodify +################################################ + +################################################ +# Start BINARY ldbsearch +[BINARY::ldbsearch] +OBJ_FILES= \ + lib/ldb/tools/ldbsearch.o +REQUIRED_SUBSYSTEMS = \ + LIBBASIC LIBSMB CONFIG LIBCMDLINE LIBLDB +# End BINARY ldbsearch +################################################ + +################################################ +# Start BINARY ldbedit +[BINARY::ldbedit] +OBJ_FILES= \ + lib/ldb/tools/ldbedit.o +REQUIRED_SUBSYSTEMS = \ + LIBBASIC LIBSMB CONFIG LIBCMDLINE LIBLDB +# End BINARY ldbedit +################################################ diff --git a/source4/lib/popt/config.m4 b/source4/lib/popt/config.m4 index 6ac5d91079..5af1d08d20 100644 --- a/source4/lib/popt/config.m4 +++ b/source4/lib/popt/config.m4 @@ -33,8 +33,9 @@ else AC_MSG_RESULT(no) fi +#hack +LIBS="$LIBS ${TMP_LIBPOPT_LIBS}" + SMB_SUBSYSTEM(LIBPOPT,[], [${TMP_LIBPOPT_OBJS}], - [], - [], - [${TMP_LIBPOPT_LIBS}]) + []) diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index 3600ab62ea..4d1726c542 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -83,7 +83,7 @@ WERROR reg_open(const char *backend, const char *location, const char *credentia if (!NT_STATUS_IS_OK(status)) return WERR_GENERAL_FAILURE; - static_init_reg; + static_init_registry; reg_first_init = False; } diff --git a/source4/lib/registry/config.m4 b/source4/lib/registry/config.m4 index d8acb26397..af4470d983 100644 --- a/source4/lib/registry/config.m4 +++ b/source4/lib/registry/config.m4 @@ -5,16 +5,28 @@ if test t$BLDSHARED = ttrue; then fi LIBWINREG=libwinregistry -PKG_CHECK_MODULES(GCONF, gconf-2.0, [ SMB_MODULE_DEFAULT(reg_gconf,STATIC) - CFLAGS="$CFLAGS $GCONF_CFLAGS";], [AC_MSG_WARN([GConf not found, not building reg_gconf])]) +PKG_CHECK_MODULES(GCONF, gconf-2.0, [ SMB_MODULE_DEFAULT(registry_gconf,STATIC) + CFLAGS="$CFLAGS $GCONF_CFLAGS";], [AC_MSG_WARN([GConf not found, not building registry_gconf])]) +AC_CONFIG_FILES(lib/registry/winregistry.pc) -PKG_CHECK_MODULES(GTK, glib-2.0 gtk+-2.0, [ CFLAGS="$CFLAGS $GTK_CFLAGS"; ], [ AC_MSG_WARN([Will be unable to build gregedit])]) +SMB_BINARY_ENABLE(gregedit,NO) -SMB_MODULE(reg_nt4, REG, STATIC, lib/registry/reg_backend_nt4/reg_backend_nt4.o) -SMB_MODULE(reg_w95, REG, STATIC, lib/registry/reg_backend_w95/reg_backend_w95.o) -SMB_MODULE(reg_dir, REG, STATIC, lib/registry/reg_backend_dir/reg_backend_dir.o) -SMB_MODULE(reg_rpc, REG, STATIC, lib/registry/reg_backend_rpc/reg_backend_rpc.o) -SMB_MODULE(reg_gconf, REG, NOT, lib/registry/reg_backend_gconf/reg_backend_gconf.o, [], [$GCONF_LIBS]) -SMB_MODULE(reg_ldb, REG, NOT, lib/registry/reg_backend_ldb/reg_backend_ldb.o) -SMB_SUBSYSTEM(REG,lib/registry/common/reg_interface.o,[lib/registry/common/reg_objects.o lib/registry/common/reg_util.o],lib/registry/common/winregistry_proto.h,[]) -AC_CONFIG_FILES(lib/registry/winregistry.pc) +PKG_CHECK_MODULES(GTK, glib-2.0 gtk+-2.0, [ SMB_BINARY_ENABLE(gregedit,YES) + CFLAGS="$CFLAGS $GTK_CFLAGS"; ], [ AC_MSG_WARN([Will be unable to build gregedit])]) + +SMB_MODULE(registry_nt4, REGISTRY, STATIC, lib/registry/reg_backend_nt4/reg_backend_nt4.o) +SMB_MODULE(registry_w95, REGISTRY, STATIC, lib/registry/reg_backend_w95/reg_backend_w95.o) +SMB_MODULE(registry_dir, REGISTRY, STATIC, lib/registry/reg_backend_dir/reg_backend_dir.o) +SMB_MODULE(registry_rpc, REGISTRY, STATIC, lib/registry/reg_backend_rpc/reg_backend_rpc.o,[],[],[LIBSMB]) +SMB_MODULE(registry_gconf, REGISTRY, NOT, lib/registry/reg_backend_gconf/reg_backend_gconf.o]) +SMB_MODULE(registry_ldb, REGISTRY, NOT, lib/registry/reg_backend_ldb/reg_backend_ldb.o,[],[],[LIBLDB]) +SMB_SUBSYSTEM(REGISTRY,lib/registry/common/reg_interface.o, + [lib/registry/common/reg_objects.o lib/registry/common/reg_util.o], + [], + [LIBBASIC]) + +SMB_BINARY(regdiff, [REG], [BIN], lib/registry/tools/regdiff.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY]) +SMB_BINARY(regpatch, [REG], [BIN], lib/registry/tools/regpatch.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY]) +SMB_BINARY(regshell, [REG], [BIN], lib/registry/tools/regshell.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY]) +SMB_BINARY(regtree, [REG], [BIN], lib/registry/tools/regtree.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY]) +SMB_BINARY(gregedit, [REG], [BIN], lib/registry/tools/gregedit.o,[],[CONFIG LIBBASIC LIBCMDLINE REGISTRY]) diff --git a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c index 960d5f3e04..517324fdd2 100644 --- a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c +++ b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c @@ -138,7 +138,7 @@ static struct registry_ops reg_backend_dir = { .del_value = reg_dir_del_value, }; -NTSTATUS reg_dir_init(void) +NTSTATUS registry_dir_init(void) { return register_backend("registry", ®_backend_dir); } diff --git a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c index 1acb3cbcec..8f9fd6625b 100644 --- a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c +++ b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c @@ -194,7 +194,7 @@ static struct registry_ops reg_backend_gconf = { */ }; -NTSTATUS reg_gconf_init(void) +NTSTATUS registry_gconf_init(void) { return register_backend("registry", ®_backend_gconf); } diff --git a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c index 9e561b1e6c..498dc6991b 100644 --- a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c @@ -21,7 +21,7 @@ #include "includes.h" #include "lib/registry/common/registry.h" -char *reg_path_to_ldb(TALLOC_CTX *mem_ctx, const char *path) +static char *reg_path_to_ldb(TALLOC_CTX *mem_ctx, const char *path) { char *ret = talloc_strdup(mem_ctx, "(dn="); char *begin = (char *)path; @@ -116,7 +116,7 @@ static struct registry_ops reg_backend_ldb = { .fetch_subkeys = ldb_fetch_subkeys, }; -NTSTATUS reg_ldb_init(void) +NTSTATUS registry_ldb_init(void) { return register_backend("registry", ®_backend_ldb); } diff --git a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c index ff39954a9f..cb3c284811 100644 --- a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c @@ -1752,7 +1752,7 @@ static struct registry_ops reg_backend_nt4 = { */ }; -NTSTATUS reg_nt4_init(void) +NTSTATUS registry_nt4_init(void) { return register_backend("registry", ®_backend_nt4); } diff --git a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c index de2c2261b9..0b2919366d 100644 --- a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c @@ -429,7 +429,7 @@ static struct registry_ops reg_backend_rpc = { .num_values = rpc_num_values, }; -NTSTATUS reg_rpc_init(void) +NTSTATUS registry_rpc_init(void) { return register_backend("registry", ®_backend_rpc); } diff --git a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c index 80108fd541..c5d2e24103 100644 --- a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c +++ b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c @@ -361,7 +361,7 @@ static struct registry_ops reg_backend_w95 = { .get_subkey_by_index = w95_get_subkey_by_index, }; -NTSTATUS reg_w95_init(void) +NTSTATUS registry_w95_init(void) { return register_backend("registry", ®_backend_w95); } diff --git a/source4/lib/registry/reg_backend_wine/reg_backend_wine.c b/source4/lib/registry/reg_backend_wine/reg_backend_wine.c index fd7d04bcf0..249af27e13 100644 --- a/source4/lib/registry/reg_backend_wine/reg_backend_wine.c +++ b/source4/lib/registry/reg_backend_wine/reg_backend_wine.c @@ -26,7 +26,7 @@ static REG_OPS reg_backend_wine = { .name = "wine", }; -NTSTATUS reg_wine_init(void) +NTSTATUS registry_wine_init(void) { register_backend("registry", ®_backend_wine); return NT_STATUS_OK; diff --git a/source4/lib/registry/tools/gregedit.c b/source4/lib/registry/tools/gregedit.c index 4bbde9a37d..b5751ca00b 100644 --- a/source4/lib/registry/tools/gregedit.c +++ b/source4/lib/registry/tools/gregedit.c @@ -142,7 +142,7 @@ static void registry_load_root() gtk_widget_set_sensitive( save_as, True ); } -GtkWidget* create_rpcwin (void) +static GtkWidget* create_rpcwin (void) { GtkWidget *dialog_vbox1; GtkWidget *table1; @@ -242,7 +242,7 @@ static void on_open_file_activate (GtkMenuItem *menuitem, gpointer user_data) gtk_widget_destroy(openfilewin); } -void on_open_gconf_activate (GtkMenuItem *menuitem, +static void on_open_gconf_activate (GtkMenuItem *menuitem, gpointer user_data) { WERROR error = reg_open("gconf", NULL, NULL, ®istry); @@ -254,8 +254,7 @@ void on_open_gconf_activate (GtkMenuItem *menuitem, registry_load_root(); } -void -on_open_remote_activate (GtkMenuItem *menuitem, +static void on_open_remote_activate (GtkMenuItem *menuitem, gpointer user_data) { char *location, *credentials; @@ -281,8 +280,7 @@ on_open_remote_activate (GtkMenuItem *menuitem, } -void -on_save_activate (GtkMenuItem *menuitem, +static void on_save_activate (GtkMenuItem *menuitem, gpointer user_data) { WERROR error = reg_save(registry, NULL); @@ -292,8 +290,7 @@ on_save_activate (GtkMenuItem *menuitem, } -void -on_save_as_activate (GtkMenuItem *menuitem, +static void on_save_as_activate (GtkMenuItem *menuitem, gpointer user_data) { gint result; @@ -316,55 +313,49 @@ on_save_as_activate (GtkMenuItem *menuitem, } -void -on_quit_activate (GtkMenuItem *menuitem, +static void on_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); } -void -on_cut_activate (GtkMenuItem *menuitem, +static void on_cut_activate (GtkMenuItem *menuitem, gpointer user_data) { /* FIXME */ } -void -on_copy_activate (GtkMenuItem *menuitem, +static void on_copy_activate (GtkMenuItem *menuitem, gpointer user_data) { /* FIXME */ } -void -on_paste_activate (GtkMenuItem *menuitem, +static void on_paste_activate (GtkMenuItem *menuitem, gpointer user_data) { /* FIXME */ } -void -on_delete_activate (GtkMenuItem *menuitem, +static void on_delete_activate (GtkMenuItem *menuitem, gpointer user_data) { /* FIXME */ } -void -on_about_activate (GtkMenuItem *menuitem, +static void on_about_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_dialog_run(GTK_DIALOG(create_aboutwin())); gtk_widget_destroy(aboutwin); } -void on_key_activate (GtkTreeView *treeview, +static void on_key_activate (GtkTreeView *treeview, GtkTreePath *path, gpointer user_data) { @@ -400,7 +391,7 @@ void on_key_activate (GtkTreeView *treeview, if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) gtk_show_werror(error); } -GtkWidget* create_mainwin (void) +static GtkWidget* create_mainwin (void) { GtkWidget *vbox1; GtkWidget *menubar; @@ -685,7 +676,7 @@ static GtkWidget* create_aboutwin (void) } -GtkWidget* create_openfilewin (void) +static GtkWidget* create_openfilewin (void) { GtkWidget *ok_button; GtkWidget *cancel_button; @@ -704,7 +695,7 @@ GtkWidget* create_openfilewin (void) return openfilewin; } -GtkWidget* create_savefilewin (void) +static GtkWidget* create_savefilewin (void) { GtkWidget *ok_button; GtkWidget *cancel_button; diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 888270f61f..d9419208cd 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -21,7 +21,7 @@ #include "includes.h" -void writediff(REG_KEY *oldkey, REG_KEY *newkey, FILE *out) +static void writediff(REG_KEY *oldkey, REG_KEY *newkey, FILE *out) { int i; REG_KEY *t1, *t2; diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index d4b036afe9..64c2637a0c 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -664,7 +664,7 @@ static CMD_FILE *cmd_file_create(const char *file) char *str_type(unsigned char type); -int nt_apply_reg_command_file(REG_KEY *root, const char *cmd_file_name) +static int nt_apply_reg_command_file(REG_KEY *root, const char *cmd_file_name) { CMD *cmd; BOOL modified = False; diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index b78f4256f0..e8b01081e8 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -173,7 +173,7 @@ static REG_KEY *cmd_help(REG_KEY *cur, int argc, char **argv) return NULL; } -REG_KEY *process_cmd(REG_KEY *k, char *line) +static REG_KEY *process_cmd(REG_KEY *k, char *line) { int argc; char **argv = NULL; @@ -196,7 +196,7 @@ REG_KEY *process_cmd(REG_KEY *k, char *line) return k; } -int main (int argc, char **argv) + int main(int argc, char **argv) { int opt; const char *backend = "dir"; diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 4d0d4b2909..477c63af2c 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -21,7 +21,7 @@ #include "includes.h" -void print_tree(int l, REG_KEY *p, int fullpath, int novals) +static void print_tree(int l, REG_KEY *p, int fullpath, int novals) { REG_KEY *subkey; REG_VAL *value; diff --git a/source4/libads/config.m4 b/source4/libads/config.m4 index a7a882f048..2f26fa1732 100644 --- a/source4/libads/config.m4 +++ b/source4/libads/config.m4 @@ -86,6 +86,8 @@ if test x"$with_ldap_support" != x"no"; then LIBS=$ac_save_LIBS fi +#hack +LIBS="$LIBS $LDAP_LIBS" ################################################# # active directory support @@ -440,3 +442,6 @@ if test x"$with_ads_support" != x"no"; then fi LIBS="$ac_save_LIBS" fi + +#hack +LIBS="$LIBS $KRB5_LIBS" diff --git a/source4/libcli/config.m4 b/source4/libcli/config.m4 index 7fdbe17349..788d7e3a0c 100644 --- a/source4/libcli/config.m4 +++ b/source4/libcli/config.m4 @@ -1,40 +1,56 @@ dnl # LIBCLI subsystem SMB_SUBSYSTEM(LIBCLI_RAW,[], - [libcli/raw/rawfile.o libcli/raw/smb_signing.o \ - libcli/raw/clisocket.o libcli/raw/clitransport.o \ - libcli/raw/clisession.o libcli/raw/clitree.o \ - libcli/raw/clikrb5.o libcli/raw/clispnego.o libcli/raw/rawrequest.o \ - libcli/raw/rawreadwrite.o libcli/raw/rawsearch.o \ - libcli/raw/rawsetfileinfo.o libcli/raw/raweas.o \ - libcli/raw/rawtrans.o libcli/raw/clioplock.o \ - libcli/raw/rawnegotiate.o libcli/raw/rawfsinfo.o \ - libcli/raw/rawfileinfo.o libcli/raw/rawnotify.o \ - libcli/raw/rawioctl.o libcli/raw/rawacl.o \ - libcli/raw/rawdate.o ], - libcli/raw/libcli_raw_public_proto.h) + [libcli/raw/rawfile.o + libcli/raw/smb_signing.o + libcli/raw/clisocket.o + libcli/raw/clitransport.o + libcli/raw/clisession.o + libcli/raw/clitree.o + libcli/raw/clikrb5.o + libcli/raw/clispnego.o + libcli/raw/rawrequest.o + libcli/raw/rawreadwrite.o + libcli/raw/rawsearch.o + libcli/raw/rawsetfileinfo.o + libcli/raw/raweas.o + libcli/raw/rawtrans.o + libcli/raw/clioplock.o + libcli/raw/rawnegotiate.o + libcli/raw/rawfsinfo.o + libcli/raw/rawfileinfo.o + libcli/raw/rawnotify.o + libcli/raw/rawioctl.o + libcli/raw/rawacl.o + libcli/raw/rawdate.o]) SMB_SUBSYSTEM(LIBCLI_UTILS,[], - [libcli/util/asn1.o \ - libcli/util/smberr.o \ - libcli/util/doserr.o libcli/util/errormap.o \ - libcli/util/pwd_cache.o libcli/util/clierror.o libcli/util/cliutil.o \ - libcli/util/nterr.o libcli/util/smbdes.o libcli/util/smbencrypt.o \ - libcli/util/dom_sid.o], - libcli/util/libcli_utils_public_proto.h) + [libcli/util/asn1.o + libcli/util/smberr.o + libcli/util/doserr.o + libcli/util/errormap.o + libcli/util/pwd_cache.o + libcli/util/clierror.o + libcli/util/cliutil.o + libcli/util/nterr.o + libcli/util/smbdes.o + libcli/util/smbencrypt.o + libcli/util/dom_sid.o]) SMB_SUBSYSTEM(LIBCLI_AUTH,[], - [libcli/auth/ntlmssp.o libcli/auth/ntlmssp_parse.o \ - libcli/auth/ntlmssp_sign.o libcli/auth/schannel.o \ - libcli/auth/credentials.o libcli/auth/session.o \ - libcli/auth/ntlm_check.o], - libcli/auth/libcli_auth_public_proto.h) + [libcli/auth/ntlmssp.o + libcli/auth/ntlmssp_parse.o + libcli/auth/ntlmssp_sign.o + libcli/auth/schannel.o + libcli/auth/credentials.o + libcli/auth/session.o + libcli/auth/ntlm_check.o]) SMB_SUBSYSTEM(LIBCLI_NMB,[], - [libcli/unexpected.o libcli/namecache.o libcli/nmblib.o \ - libcli/namequery.o], - libcli/libcli_nmb_public_proto.h) + [libcli/unexpected.o + libcli/namecache.o + libcli/nmblib.o + libcli/namequery.o]) -SMB_SUBSYSTEM(LIBCLI,[], - [\$(LIBCLI_RAW_OBJS) \$(LIBCLI_UTILS_OBJS) \$(LIBCLI_AUTH_OBJS) \$(LIBCLI_NMB_OBJS)], - librpc/libcli_public_proto.h) +SMB_SUBSYSTEM(LIBCLI,[],[],[], + [LIBCLI_RAW LIBCLI_UTILS LIBCLI_AUTH LIBCLI_NMB]) diff --git a/source4/libcli/libsmb.m4 b/source4/libcli/libsmb.m4 index e34c171e48..fe2a5b17ba 100644 --- a/source4/libcli/libsmb.m4 +++ b/source4/libcli/libsmb.m4 @@ -1,8 +1,12 @@ dnl # LIBSMB subsystem SMB_SUBSYSTEM(LIBSMB,[], - [libcli/clireadwrite.o libcli/cliconnect.o \ - libcli/clifile.o libcli/clilist.o libcli/clitrans2.o \ - libcli/climessage.o libcli/clideltree.o \ - \$(LIBCLI_OBJS) \$(LIBRPC_OBJS)], - libcli/libsmb_public_proto.h) + [libcli/clireadwrite.o + libcli/cliconnect.o + libcli/clifile.o + libcli/clilist.o + libcli/clitrans2.o + libcli/climessage.o + libcli/clideltree.o], + [], + [LIBCLI LIBRPC]) diff --git a/source4/librpc/config.m4 b/source4/librpc/config.m4 index 3674cf98c7..ff012c0301 100644 --- a/source4/librpc/config.m4 +++ b/source4/librpc/config.m4 @@ -1,30 +1,44 @@ dnl # LIBRPC subsystem SMB_SUBSYSTEM(LIBNDR_RAW,[], - [librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \ - librpc/ndr/ndr_spoolss_buf.o \ - librpc/gen_ndr/tables.o librpc/gen_ndr/ndr_dcerpc.o \ - librpc/gen_ndr/ndr_echo.o librpc/gen_ndr/ndr_misc.o \ - librpc/gen_ndr/ndr_lsa.o librpc/gen_ndr/ndr_dfs.o \ - librpc/gen_ndr/ndr_samr.o librpc/gen_ndr/ndr_spoolss.o \ - librpc/gen_ndr/ndr_wkssvc.o librpc/gen_ndr/ndr_srvsvc.o \ - librpc/gen_ndr/ndr_atsvc.o librpc/gen_ndr/ndr_eventlog.o \ - librpc/gen_ndr/ndr_epmapper.o librpc/gen_ndr/ndr_winreg.o \ - librpc/gen_ndr/ndr_mgmt.o librpc/gen_ndr/ndr_protected_storage.o \ - librpc/gen_ndr/ndr_dcom.o librpc/gen_ndr/ndr_wzcsvc.o \ - librpc/gen_ndr/ndr_browser.o librpc/gen_ndr/ndr_w32time.o \ - librpc/gen_ndr/ndr_scerpc.o librpc/gen_ndr/ndr_ntsvcs.o \ - librpc/gen_ndr/ndr_netlogon.o librpc/gen_ndr/ndr_trkwks.o \ - librpc/gen_ndr/ndr_keysvc.o], - librpc/gen_ndr/libndr_raw_public_proto.h) + [librpc/ndr/ndr.o + librpc/ndr/ndr_basic.o + librpc/ndr/ndr_sec.o + librpc/ndr/ndr_spoolss_buf.o + librpc/gen_ndr/tables.o + librpc/gen_ndr/ndr_dcerpc.o + librpc/gen_ndr/ndr_echo.o + librpc/gen_ndr/ndr_misc.o + librpc/gen_ndr/ndr_lsa.o + librpc/gen_ndr/ndr_dfs.o + librpc/gen_ndr/ndr_samr.o + librpc/gen_ndr/ndr_spoolss.o + librpc/gen_ndr/ndr_wkssvc.o + librpc/gen_ndr/ndr_srvsvc.o + librpc/gen_ndr/ndr_atsvc.o + librpc/gen_ndr/ndr_eventlog.o + librpc/gen_ndr/ndr_epmapper.o + librpc/gen_ndr/ndr_winreg.o + librpc/gen_ndr/ndr_mgmt.o + librpc/gen_ndr/ndr_protected_storage.o + librpc/gen_ndr/ndr_dcom.o + librpc/gen_ndr/ndr_wzcsvc.o + librpc/gen_ndr/ndr_browser.o + librpc/gen_ndr/ndr_w32time.o + librpc/gen_ndr/ndr_scerpc.o + librpc/gen_ndr/ndr_ntsvcs.o + librpc/gen_ndr/ndr_netlogon.o + librpc/gen_ndr/ndr_trkwks.o + librpc/gen_ndr/ndr_keysvc.o]) SMB_SUBSYSTEM(LIBRPC_RAW,[], - [librpc/rpc/dcerpc.o librpc/rpc/dcerpc_auth.o \ - librpc/rpc/dcerpc_util.o \ - librpc/rpc/dcerpc_schannel.o librpc/rpc/dcerpc_ntlm.o \ - librpc/rpc/dcerpc_smb.o librpc/rpc/dcerpc_tcp.o], - librpc/rpc/librpc_raw_public_proto.h) + [librpc/rpc/dcerpc.o + librpc/rpc/dcerpc_auth.o + librpc/rpc/dcerpc_util.o + librpc/rpc/dcerpc_schannel.o + librpc/rpc/dcerpc_ntlm.o + librpc/rpc/dcerpc_smb.o + librpc/rpc/dcerpc_tcp.o]) -SMB_SUBSYSTEM(LIBRPC,[], - [\$(LIBNDR_RAW_OBJS) \$(LIBRPC_RAW_OBJS)], - librpc/librpc_public_proto.h) +SMB_SUBSYSTEM(LIBRPC,[],[],[], + [LIBNDR_RAW LIBRPC_RAW]) diff --git a/source4/ntvfs/config.m4 b/source4/ntvfs/config.m4 index 420c3ec62a..1cf5b39a7c 100644 --- a/source4/ntvfs/config.m4 +++ b/source4/ntvfs/config.m4 @@ -233,8 +233,8 @@ samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)]) SMB_MODULE(ntvfs_cifs, NTVFS, STATIC, [ntvfs/cifs/vfs_cifs.o]) SMB_MODULE(ntvfs_simple, NTVFS, STATIC, - [ntvfs/simple/vfs_simple.o ntvfs/simple/svfs_util.o], - ntvfs/simple/svfs_private.h) + [ntvfs/simple/vfs_simple.o], + [ntvfs/simple/svfs_util.o]) SMB_MODULE(ntvfs_print, NTVFS, STATIC, [ntvfs/print/vfs_print.o]) @@ -245,5 +245,5 @@ SMB_MODULE(ntvfs_posix, NTVFS, STATIC, [ntvfs/posix/vfs_posix.o]) SMB_MODULE(ntvfs_nbench, NTVFS, STATIC, [ntvfs/nbench/vfs_nbench.o]) SMB_SUBSYSTEM(NTVFS,ntvfs/ntvfs_base.o, - [ntvfs/ntvfs_generic.o ntvfs/ntvfs_util.o], - ntvfs_public_proto.h) + [ntvfs/ntvfs_generic.o + ntvfs/ntvfs_util.o]) diff --git a/source4/passdb/config.m4 b/source4/passdb/config.m4 index 18895e6c68..78d827bf3a 100644 --- a/source4/passdb/config.m4 +++ b/source4/passdb/config.m4 @@ -8,8 +8,11 @@ SMB_MODULE(passdb_unix,PASSDB,STATIC,[passdb/pdb_unix.o]) if test x"$with_ldap_support" = x"yes"; then SMB_MODULE_DEFAULT(passdb_ldap,STATIC) fi -SMB_MODULE(passdb_ldap,PASSDB,NOT,[passdb/pdb_ldap.o],[],[$LDAP_LIBS]) +SMB_MODULE(passdb_ldap,PASSDB,NOT,[passdb/pdb_ldap.o]) SMB_SUBSYSTEM(PASSDB,passdb/pdb_interface.o, - [passdb/passdb.o passdb/machine_sid.o passdb/util_sam_sid.o passdb/pdb_get_set.o passdb/pdb_compat.o], - passdb/passdb_public_proto.h) + [passdb/passdb.o + passdb/machine_sid.o + passdb/util_sam_sid.o + passdb/pdb_get_set.o + passdb/pdb_compat.o]) diff --git a/source4/rpc_server/config.m4 b/source4/rpc_server/config.m4 index 09e76c2ead..8c5f8baafc 100644 --- a/source4/rpc_server/config.m4 +++ b/source4/rpc_server/config.m4 @@ -1,16 +1,20 @@ dnl # DCERPC Server subsystem SMB_SUBSYSTEM(DCERPC_COMMON,[], - [rpc_server/common/server_info.o rpc_server/common/share_info.o]) + [rpc_server/common/server_info.o + rpc_server/common/share_info.o]) + +SMB_SUBSYSTEM(SAMDB,[rpc_server/samr/samdb.o],[],[],[LIBLDB]) SMB_MODULE(dcerpc_rpcecho,DCERPC,STATIC,[rpc_server/echo/rpc_echo.o]) SMB_MODULE(dcerpc_epmapper,DCERPC,STATIC,[rpc_server/epmapper/rpc_epmapper.o]) -SMB_MODULE(dcerpc_remote,DCERPC,STATIC,[rpc_server/remote/dcesrv_remote.o]) -SMB_MODULE(dcerpc_srvsvc,DCERPC,STATIC,[rpc_server/srvsvc/dcesrv_srvsvc.o]) -SMB_MODULE(dcerpc_wkssvc,DCERPC,STATIC,[rpc_server/wkssvc/dcesrv_wkssvc.o]) -SMB_MODULE(dcerpc_samr,DCERPC,STATIC,[rpc_server/samr/dcesrv_samr.o rpc_server/samr/samdb.o]) -SMB_MODULE(dcerpc_winreg,DCERPC,STATIC,[rpc_server/winreg/rpc_winreg.o \$(REG_OBJS)],[],[\$(REG_LIBS)]) +SMB_MODULE(dcerpc_remote,DCERPC,STATIC,[rpc_server/remote/dcesrv_remote.o],[],[],[LIBSMB]) +SMB_MODULE(dcerpc_srvsvc,DCERPC,STATIC,[rpc_server/srvsvc/dcesrv_srvsvc.o],[],[],[DCERPC_COMMON]) +SMB_MODULE(dcerpc_wkssvc,DCERPC,STATIC,[rpc_server/wkssvc/dcesrv_wkssvc.o],[],[],[DCERPC_COMMON]) +SMB_MODULE(dcerpc_samr,DCERPC,STATIC,[rpc_server/samr/dcesrv_samr.o],[],[],[SAMDB DCERPC_COMMON]) +SMB_MODULE(dcerpc_winreg,DCERPC,STATIC,[rpc_server/winreg/rpc_winreg.o],[],[],[REGISTRY]) SMB_SUBSYSTEM(DCERPC,rpc_server/dcerpc_server.o, - [rpc_server/dcerpc_tcp.o rpc_server/dcesrv_auth.o rpc_server/handles.o \$(DCERPC_COMMON_OBJS)], - rpc_server/dcesrv_public_proto.h) + [rpc_server/dcerpc_tcp.o + rpc_server/dcesrv_auth.o + rpc_server/handles.o]) diff --git a/source4/smb_server/config.m4 b/source4/smb_server/config.m4 index e49f610317..e94dbf1444 100644 --- a/source4/smb_server/config.m4 +++ b/source4/smb_server/config.m4 @@ -1,17 +1,16 @@ dnl # SMB server subsystem SMB_SUBSYSTEM(SMB,smb_server/smb_server.o, - [smb_server/conn.o \ - smb_server/connection.o \ - smb_server/negprot.o \ - smb_server/nttrans.o \ - smb_server/password.o \ - smb_server/reply.o \ - smb_server/request.o \ - smb_server/search.o \ - smb_server/service.o \ - smb_server/session.o \ - smb_server/sesssetup.o \ - smb_server/srvtime.o \ - smb_server/trans2.o],\ - smb_server/smb_server_public_proto.h) + [smb_server/conn.o + smb_server/connection.o + smb_server/negprot.o + smb_server/nttrans.o + smb_server/password.o + smb_server/reply.o + smb_server/request.o + smb_server/search.o + smb_server/service.o + smb_server/session.o + smb_server/sesssetup.o + smb_server/srvtime.o + smb_server/trans2.o]) diff --git a/source4/smbd/process_model.m4 b/source4/smbd/process_model.m4 index a7f6fb0793..93dfeddcef 100644 --- a/source4/smbd/process_model.m4 +++ b/source4/smbd/process_model.m4 @@ -12,6 +12,7 @@ AC_ARG_WITH(pthreads, yes) AC_MSG_RESULT(yes) SMB_MODULE_DEFAULT(process_model_thread,STATIC) + SMB_EXT_LIB_ENABLE(PTHREAD,YES) ;; *) AC_MSG_RESULT(no) @@ -20,8 +21,9 @@ AC_ARG_WITH(pthreads, AC_MSG_RESULT(no) ) +SMB_EXT_LIB(PTHREAD,[-lpthread]) + SMB_MODULE(process_model_thread,PROCESS_MODEL,NOT, - [smbd/process_thread.o],[],[-lpthread]) + [smbd/process_thread.o],[],[PTHREAD]) -SMB_SUBSYSTEM(PROCESS_MODEL,smbd/process_model.o, - [],smbd/process_model_public_proto.h) +SMB_SUBSYSTEM(PROCESS_MODEL,smbd/process_model.o) diff --git a/source4/torture/config.m4 b/source4/torture/config.m4 index f2fb4cbac2..587840a0f1 100755..100644 --- a/source4/torture/config.m4 +++ b/source4/torture/config.m4 @@ -1,32 +1,64 @@ dnl # TORTURE subsystem +SMB_SUBSYSTEM(TORTURE_BASIC,[], + [torture/basic/scanner.o + torture/basic/utable.o + torture/basic/charset.o + torture/basic/mangle_test.o + torture/basic/denytest.o + torture/basic/aliases.o], + [], + [LIBSMB]) + SMB_SUBSYSTEM(TORTURE_RAW,[], - [torture/raw/qfsinfo.o torture/raw/qfileinfo.o torture/raw/setfileinfo.o \ - torture/raw/search.o torture/raw/close.o torture/raw/open.o torture/raw/mkdir.o \ - torture/raw/oplock.o torture/raw/notify.o torture/raw/mux.o torture/raw/ioctl.o \ - torture/raw/chkpath.o torture/raw/unlink.o torture/raw/read.o torture/raw/context.o \ - torture/raw/write.o torture/raw/lock.o torture/raw/rename.o torture/raw/seek.o], - torture/raw/torture_raw_public_proto.h) + [torture/raw/qfsinfo.o + torture/raw/qfileinfo.o + torture/raw/setfileinfo.o + torture/raw/search.o + torture/raw/close.o + torture/raw/open.o + torture/raw/mkdir.o + torture/raw/oplock.o + torture/raw/notify.o + torture/raw/mux.o + torture/raw/ioctl.o + torture/raw/chkpath.o + torture/raw/unlink.o + torture/raw/read.o + torture/raw/context.o + torture/raw/write.o + torture/raw/lock.o + torture/raw/rename.o + torture/raw/seek.o], + [], + [LIBSMB]) SMB_SUBSYSTEM(TORTURE_RPC,[], - [torture/rpc/lsa.o torture/rpc/echo.o torture/rpc/dfs.o \ - torture/rpc/spoolss.o torture/rpc/samr.o torture/rpc/wkssvc.o \ - torture/rpc/srvsvc.o torture/rpc/atsvc.o torture/rpc/eventlog.o \ - torture/rpc/epmapper.o torture/rpc/winreg.o torture/rpc/mgmt.o \ - torture/rpc/scanner.o torture/rpc/autoidl.o torture/rpc/netlogon.o], - torture/rpc/torture_rpc_public_proto.h) + [torture/rpc/lsa.o + torture/rpc/echo.o + torture/rpc/dfs.o + torture/rpc/spoolss.o + torture/rpc/samr.o + torture/rpc/wkssvc.o + torture/rpc/srvsvc.o + torture/rpc/atsvc.o + torture/rpc/eventlog.o + torture/rpc/epmapper.o + torture/rpc/winreg.o + torture/rpc/mgmt.o + torture/rpc/scanner.o + torture/rpc/autoidl.o + torture/rpc/netlogon.o], + [], + [LIBSMB]) SMB_SUBSYSTEM(TORTURE_NBENCH,[], - [torture/nbench/nbio.o torture/nbench/nbench.o]) - -SMB_SUBSYSTEM(TORTURE_BASIC,[], - [torture/basic/scanner.o torture/basic/utable.o \ - torture/basic/charset.o torture/basic/mangle_test.o \ - torture/basic/denytest.o \ - torture/basic/aliases.o]) + [torture/nbench/nbio.o + torture/nbench/nbench.o]) -SMB_SUBSYSTEM(TORTURE,[], - [torture/torture.o torture/torture_util.o \ - libcli/raw/clirewrite.o \$(TORTURE_RAW_OBJS) \ - \$(TORTURE_RPC_OBJS) \$(TORTURE_NBENCH_OBJS) \$(TORTURE_BASIC_OBJS)], - torture/torture_public_proto.h) +SMB_BINARY(smbtorture, [ALL], [BIN], + [torture/torture.o + torture/torture_util.o + libcli/raw/clirewrite.o], + [], + [TORTURE_BASIC TORTURE_RAW TORTURE_RPC TORTURE_NBENCH CONFIG LIBCMDLINE LIBBASIC]) diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index d02d993604..3bced67422 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -82,7 +82,7 @@ static void show_functions(const struct dcerpc_interface_table *p) exit(1); } -int main(int argc, char *argv[]) + int main(int argc, char *argv[]) { const struct dcerpc_interface_table *p; const struct dcerpc_interface_call *f; diff --git a/source4/utils/rewrite.c b/source4/utils/rewrite.c index 5c0b2b6956..789551081d 100644 --- a/source4/utils/rewrite.c +++ b/source4/utils/rewrite.c @@ -12,14 +12,14 @@ BOOL become_user_permanently(uid_t uid, gid_t gid) BOOL is_setuid_root(void) { return False; } -int share_mode_forall(SHAREMODE_FN(fn)) + int share_mode_forall(SHAREMODE_FN(fn)) { return 0; } #define BRLOCK_FN(fn) \ void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, int pid, \ enum brl_type lock_type, \ br_off start, br_off size) -int brl_forall(BRLOCK_FN(fn)) + int brl_forall(BRLOCK_FN(fn)) { return 0; } BOOL locking_end(void) |