summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/public.m471
-rw-r--r--source4/build/make/rules.mk99
-rw-r--r--source4/build/make/templates.mk108
-rw-r--r--source4/build/smb_build/config_mk.pm15
-rw-r--r--source4/build/smb_build/main.pl17
-rw-r--r--source4/build/smb_build/makefile.pm11
-rw-r--r--source4/build/tests/unixsock.c93
7 files changed, 198 insertions, 216 deletions
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index ba8251e65d..d932f09a69 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -12,6 +12,10 @@ dnl SMB_ENABLE(name,default_build)
dnl
dnl SMB_INCLUDE_MK(file)
dnl
+dnl SMB_WRITE_MAKEVARS(file)
+dnl
+dnl SMB_WRITE_PERLVARS(file)
+dnl
dnl #######################################################
dnl ### And now the implementation ###
dnl #######################################################
@@ -150,3 +154,70 @@ $1_ENABLE = $2
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
\$enabled{$1} = \"$2\";"
])
+
+dnl SMB_WRITE_MAKEVARS(path)
+AC_DEFUN([SMB_WRITE_MAKEVARS],
+[
+echo "configure: creating $1"
+cat >$1<<CEOF
+# $1 - Autogenerated by configure, DO NOT EDIT!
+AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
+AC_Var = $AC_Var])
+$MAKE_SETTINGS
+CEOF
+])
+
+dnl SMB_WRITE_PERLVARS(path)
+AC_DEFUN([SMB_WRITE_PERLVARS],
+[
+echo "configure: creating $1"
+cat >$1<<CEOF
+# config.pm - Autogenerate by configure. DO NOT EDIT!
+
+package config;
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(%enabled %config);
+use strict;
+
+use vars qw(%enabled %config);
+
+%config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
+ AC_Var => '$AC_Var',])
+);
+
+$SMB_INFO_ENABLES
+1;
+CEOF
+])
+
+dnl SMB_BUILD_RUN(OUTPUT_FILE)
+AC_DEFUN([SMB_BUILD_RUN],
+[
+AC_OUTPUT_COMMANDS(
+[
+test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && (
+ cd $builddir;
+ # NOTE: We *must* use -R so we don't follow symlinks (at least on BSD
+ # systems).
+ test -d heimdal || cp -R $srcdir/heimdal $builddir/
+ test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/
+ test -d build || builddir="$builddir" \
+ srcdir="$srcdir" \
+ $PERL ${srcdir}/script/buildtree.pl
+ )
+
+$PERL -I${builddir} -I${builddir}/build \
+ -I${srcdir} -I${srcdir}/build \
+ ${srcdir}/build/smb_build/main.pl --output=$1 main.mk || exit $?
+],
+[
+srcdir="$srcdir"
+builddir="$builddir"
+PERL="$PERL"
+
+export PERL
+export srcdir
+export builddir
+])
+])
diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk
index c0359a8297..176e67a691 100644
--- a/source4/build/make/rules.mk
+++ b/source4/build/make/rules.mk
@@ -56,8 +56,6 @@ clean:: clean_pch
@echo Removing generated files
@-rm -f bin/*_init_module.c
@-rm -rf librpc/gen_*
- @echo Removing proto headers
- @-rm -f $(PROTO_HEADERS)
distclean:: clean
-rm -f include/config.h include/config_tmp.h include/build.h
@@ -88,102 +86,7 @@ unused_macros:
@mkdir -p $(@D)
@$(STLD) $(STLD_FLAGS) $@ $^
-###############################################################################
-# Templates
-###############################################################################
-
-# Partially link
-# Arguments: target object file, source object files
-define partial_link_template
-$(1): $(2) ;
- @echo Partially linking $$@
- @mkdir -p $$(@D)
- $$(PARTLINK) -o $$@ $$^
-endef
-
-# Link a binary
-# Arguments: target file, depends, flags
-define binary_link_template
-$(1): $(2) ;
- @echo Linking $$@
- @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
-endef
-
-# Link a host-machine binary
-# Arguments: target file, depends, flags
-define host_binary_link_template
-$(1): $(2) ;
- @echo Linking $$@
- @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
-endef
-
-# Create a prototype header
-# Arguments: header file, c files
-define proto_header_template
-$(1): $(2) ;
- @echo "Creating $$@"
- @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^
-endef
-
-# Shared module
-# Arguments: Target, dependencies, objects
-define shared_module_template
-
-$(1): $(2) ;
- @echo Linking $$@
- @mkdir -p $$(@D)
- @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
-
-endef
-
-# Shared library
-# Arguments: Target, dependencies, link flags, soname
-define shared_library_template
-$(1): $(2)
- @echo Linking $$@
- @mkdir -p $$(@D)
- @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
- $(3) \
- $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
-
-ifneq ($(notdir $(1)),$(notdir $(4)))
-$(4): $(1)
- @echo "Creating symbolic link for $$@"
- @ln -fs $$(<F) $$@
-endif
-
-ifneq ($(notdir $(1)),$(notdir $(5)))
-$(5): $(1)
- @echo "Creating symbolic link for $$@"
- @ln -fs $$(<F) $$@
-endif
-endef
-
-# Shared alias
-# Arguments: Target, subsystem name, alias name
-define shared_module_alias_template
-bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
- @ln -fs $$(<F) $$@
-
-PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
-
-uninstallplugins::
- @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
-installplugins::
- @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
-
-endef
-
-define shared_module_install_template
-installplugins:: bin/modules/$(1)/$(2)
- @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
- @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
- @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
-uninstallplugins::
- @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
- @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
-
-endef
+include build/make/templates.mk
###############################################################################
# File types
diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk
new file mode 100644
index 0000000000..48678c5603
--- /dev/null
+++ b/source4/build/make/templates.mk
@@ -0,0 +1,108 @@
+# Templates file for Samba 4
+# This relies on GNU make.
+#
+# © 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+###############################################################################
+# Templates
+###############################################################################
+
+# Partially link
+# Arguments: target object file, source object files
+define partial_link_template
+$(1): $(2) ;
+ @echo Partially linking $$@
+ @mkdir -p $$(@D)
+ $$(PARTLINK) -o $$@ $$^
+endef
+
+# Link a binary
+# Arguments: target file, depends, flags
+define binary_link_template
+$(1): $(2) ;
+ @echo Linking $$@
+ @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+endef
+
+# Link a host-machine binary
+# Arguments: target file, depends, flags
+define host_binary_link_template
+$(1): $(2) ;
+ @echo Linking $$@
+ @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+endef
+
+# Create a prototype header
+# Arguments: header file, c files
+define proto_header_template
+
+proto:: $(1) ;
+
+clean:: ;
+ rm -f $(1)
+
+$(1): $(2) ;
+ @echo "Creating $$@"
+ @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^
+
+endef
+
+# Shared module
+# Arguments: Target, dependencies, objects
+define shared_module_template
+
+$(1): $(2) ;
+ @echo Linking $$@
+ @mkdir -p $$(@D)
+ @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+endef
+
+# Shared library
+# Arguments: Target, dependencies, link flags, soname
+define shared_library_template
+$(1): $(2)
+ @echo Linking $$@
+ @mkdir -p $$(@D)
+ @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
+ $(3) \
+ $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
+
+ifneq ($(notdir $(1)),$(notdir $(4)))
+$(4): $(1)
+ @echo "Creating symbolic link for $$@"
+ @ln -fs $$(<F) $$@
+endif
+
+ifneq ($(notdir $(1)),$(notdir $(5)))
+$(5): $(1)
+ @echo "Creating symbolic link for $$@"
+ @ln -fs $$(<F) $$@
+endif
+endef
+
+# Shared alias
+# Arguments: Target, subsystem name, alias name
+define shared_module_alias_template
+bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
+ @ln -fs $$(<F) $$@
+
+PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
+
+uninstallplugins::
+ @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
+installplugins::
+ @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
+
+endef
+
+define shared_module_install_template
+installplugins:: bin/modules/$(1)/$(2)
+ @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+ @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
+ @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+uninstallplugins::
+ @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+ @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+
+endef
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 81c3363cfb..88e24a5876 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -33,8 +33,6 @@ my $section_types = {
"ENABLE" => "bool",
- "PRIVATE_PROTO_HEADER" => "string",
-
"CFLAGS" => "list",
"LDFLAGS" => "list",
"STANDARD_VISIBILITY" => "string",
@@ -53,8 +51,6 @@ my $section_types = {
"OUTPUT_TYPE" => "list",
- "PRIVATE_PROTO_HEADER" => "string",
-
"CFLAGS" => "list"
},
"BINARY" => {
@@ -64,8 +60,6 @@ my $section_types = {
"ENABLE" => "bool",
"INSTALLDIR" => "string",
- "PRIVATE_PROTO_HEADER" => "string",
-
"CFLAGS" => "list",
"LDFLAGS" => "list",
"STANDARD_VISIBILITY" => "string",
@@ -84,8 +78,6 @@ my $section_types = {
"ENABLE" => "bool",
- "PRIVATE_PROTO_HEADER" => "string",
-
"CFLAGS" => "list",
"LDFLAGS" => "list",
"STANDARD_VISIBILITY" => "string"
@@ -96,14 +88,11 @@ use vars qw(@parsed_files);
@parsed_files = ();
-sub _read_config_file
+sub _read_config_file($$$)
{
- use File::Basename;
use Cwd;
- my $srcdir = shift;
- my $builddir = shift;
- my $filename = shift;
+ my ($srcdir, $builddir, $filename) = @_;
my @dirlist;
# We need to change our working directory because config.mk files can
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index d31bea73f3..3ff34eedcf 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -11,10 +11,22 @@ use smb_build::config_mk;
use smb_build::output;
use smb_build::summary;
use smb_build::config;
+use Getopt::Long;
use strict;
+my $output_file = "data.mk";
+
+my $result = GetOptions (
+ 'output=s' => \$output_file);
+
+if (not $result) {
+ exit(1);
+}
+
+my $input_file = shift @ARGV;
+
my $INPUT = {};
-my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
+my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, $input_file);
my $subsys_output_type = ["MERGED_OBJ"];
@@ -80,11 +92,10 @@ foreach my $key (values %$OUTPUT) {
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}));
$mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON");
$mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
- $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
$mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS});
}
-$mkenv->write("data.mk");
+$mkenv->write($output_file);
summary::show($OUTPUT, \%config::config);
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 43c4252f9d..a0fee2736b 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -223,21 +223,14 @@ sub PythonFiles($$)
}
}
-sub ProtoHeader($$)
-{
- my ($self,$ctx) = @_;
-
- my $target = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})";
- $self->output("PROTO_HEADERS += $target\n");
- $self->output("\$(call proto_header_template, $target, \$($ctx->{NAME}_OBJ_FILES:.o=.c))\n");
-}
-
sub write($$)
{
my ($self, $file) = @_;
$self->_prepare_mk_files();
+ $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
+
open(MAKEFILE,">$file") || die ("Can't open $file\n");
print MAKEFILE $self->{output};
close(MAKEFILE);
diff --git a/source4/build/tests/unixsock.c b/source4/build/tests/unixsock.c
deleted file mode 100644
index f2765d68f6..0000000000
--- a/source4/build/tests/unixsock.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- c-file-style: "linux" -*-
- *
- * Try creating a Unix-domain socket, opening it, and reading from it.
- * The POSIX name for these is AF_LOCAL/PF_LOCAL.
- *
- * This is used by the Samba autoconf scripts to detect systems which
- * don't have Unix-domain sockets, such as (probably) VMS, or systems
- * on which they are broken under some conditions, such as RedHat 7.0
- * (unpatched). We can't build WinBind there at the moment.
- *
- * Coding standard says to always use exit() for this, not return, so
- * we do.
- *
- * Martin Pool <mbp@samba.org>, June 2000. */
-
-/* TODO: Look for AF_LOCAL (most standard), AF_UNIX, and AF_FILE. */
-
-#include <stdio.h>
-
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
-#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-
-#if HAVE_ERRNO_DECL
-# include <errno.h>
-#else
-extern int errno;
-#endif
-
-static int bind_socket(char const *filename)
-{
- int sock_fd;
- struct sockaddr_un name;
- size_t size;
-
- /* Create the socket. */
- if ((sock_fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
- perror ("socket(PF_LOCAL, SOCK_STREAM)");
- exit(1);
- }
-
- /* Bind a name to the socket. */
- name.sun_family = AF_LOCAL;
- strncpy(name.sun_path, filename, sizeof (name.sun_path));
-
- /* The size of the address is
- the offset of the start of the filename,
- plus its length,
- plus one for the terminating null byte.
- Alternatively you can just do:
- size = SUN_LEN (&name);
- */
- size = SUN_LEN(&name);
- /* XXX: This probably won't work on unfriendly libcs */
-
- if (bind(sock_fd, (struct sockaddr *) &name, size) < 0) {
- perror ("bind");
- exit(1);
- }
-
- return sock_fd;
-}
-
-
-int main(void)
-{
- int sock_fd;
- int kid;
- char const *filename = "conftest.unixsock.sock";
-
- /* abolish hanging */
- alarm(15); /* secs */
-
- if ((sock_fd = bind_socket(filename)) < 0)
- exit(1);
-
- /* the socket will be deleted when autoconf cleans up these
- files. */
-
- exit(0);
-}