diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-09 20:06:54 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-09 20:06:54 +0100 |
commit | ec106a14216ee034b7e04c177c89703e63dfd107 (patch) | |
tree | 59c56cd663ee3dc03d0ce63bf4405ee87c14834a /source4/build | |
parent | 4075a2ba982ea56ff925e0a33839f0760fd71911 (diff) | |
parent | 1a2544a24c064e9eecb973439ccd0e7126e06e77 (diff) | |
download | samba-ec106a14216ee034b7e04c177c89703e63dfd107.tar.gz samba-ec106a14216ee034b7e04c177c89703e63dfd107.tar.bz2 samba-ec106a14216ee034b7e04c177c89703e63dfd107.zip |
Merge branch 'v4-0-trivial' into v4-0-python
(This used to be commit b874f07175ae38a041f53f0e4ac6a4050dcefeae)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/m4/check_make.m4 | 8 | ||||
-rw-r--r-- | source4/build/m4/public.m4 | 61 | ||||
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 5 | ||||
-rw-r--r-- | source4/build/smb_build/env.pm | 60 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 5 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 156 |
6 files changed, 44 insertions, 251 deletions
diff --git a/source4/build/m4/check_make.m4 b/source4/build/m4/check_make.m4 index 4780f43e1c..d7799649a7 100644 --- a/source4/build/m4/check_make.m4 +++ b/source4/build/m4/check_make.m4 @@ -46,3 +46,11 @@ AC_ARG_ENABLE(automatic-dependencies, [ automatic_dependencies=no ]) AC_MSG_RESULT($automatic_dependencies) AC_SUBST(automatic_dependencies) + +FIRST_PREREQ="\$*.c" +AC_SUBST(FIRST_PREREQ) + +if test x$GNU_MAKE = xyes; then + FIRST_PREREQ="\$<" +fi + diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 6d693eaeee..4192128bbd 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -34,21 +34,20 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname) +dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname) AC_DEFUN([SMB_LIBRARY], [ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES ################################### # Start Library $1 @<:@LIBRARY::$1@:>@ -DESCRIPTION = $2 -OBJ_FILES = $3 -PRIVATE_DEPENDENCIES = $4 -VERSION = $5 -SO_VERSION = $6 -CFLAGS = $7 -LDFLAGS = $8 -PC_NAME = $9 +OBJ_FILES = $2 +PRIVATE_DEPENDENCIES = $3 +VERSION = $4 +SO_VERSION = $5 +CFLAGS = $6 +LDFLAGS = $7 +PC_NAME = $8 ENABLE = YES # End Library $1 ################################### @@ -65,30 +64,28 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], fi if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://pkg-config.freedesktop.org/ to get pkg-config." + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://pkg-config.freedesktop.org/ to get pkg-config." ac_cv_$1_found=no else if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then - AC_MSG_CHECKING(for $2) + AC_MSG_CHECKING(for $2) - if $PKG_CONFIG --exists '$2' ; then + if $PKG_CONFIG --exists '$2' ; then AC_MSG_RESULT(yes) - $1_CFLAGS="`$PKG_CONFIG --cflags '$2'`" - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $$1_CFLAGS" - AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS]) - AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $$1_CFLAGS" + AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS]) + AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], SMB_ENABLE($1, YES) - AC_MSG_RESULT(yes), + AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_WARN([cannot run when cross-compiling])) - CFLAGS="$OLD_CFLAGS" - + CFLAGS="$OLD_CFLAGS" SMB_EXT_LIB($1, [`$PKG_CONFIG --libs-only-l '$2'`], @@ -98,17 +95,17 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], [ $2 ]) ac_cv_$1_found=yes - else + else AC_MSG_RESULT(no) - $PKG_CONFIG --errors-to-stdout --print-errors '$2' + $PKG_CONFIG --errors-to-stdout --print-errors '$2' ac_cv_$1_found=no - fi - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://pkg-config.freedesktop.org/" - ac_cv_$1_found=no - fi - fi + fi + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://pkg-config.freedesktop.org/" + ac_cv_$1_found=no + fi + fi if test x$ac_cv_$1_found = x"yes"; then ifelse([$3], [], [echo -n ""], [$3]) else diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index d07660ba1d..b7dc9697a9 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -91,6 +91,7 @@ my $section_types = { "LIBRARY_REALNAME" => "string", "PC_NAME" => "string", + "PC_FILE" => "string", "INIT_FUNCTION_TYPE" => "string", "INIT_FUNCTION_SENTINEL" => "string", @@ -98,8 +99,6 @@ my $section_types = { "OBJ_FILES" => "list", - "DESCRIPTION" => "string", - "PRIVATE_DEPENDENCIES" => "list", "PUBLIC_DEPENDENCIES" => "list", @@ -252,6 +251,8 @@ sub run_config_mk($$$$) next; } + $line =~ s/^mkinclude /include /; + # empty line if ($line =~ /^[ \t]*$/) { $section = "GLOBAL"; diff --git a/source4/build/smb_build/env.pm b/source4/build/smb_build/env.pm index 8fbbe9cfd5..76cd8d1a26 100644 --- a/source4/build/smb_build/env.pm +++ b/source4/build/smb_build/env.pm @@ -54,64 +54,4 @@ sub _set_config($$) $self->{automatic_deps} = ($self->{config}->{automatic_dependencies} eq "yes"); } -sub PkgConfig($$$$$$$$$$$$) -{ - my ($self,$path,$name,$libs,$privlibs,$cflags,$version,$desc,$hasmodules,$pubdep,$privdep,$dirs) = @_; - - print __FILE__.": creating $path\n"; - - if ($self->{config}->{libreplace_cv_immediate_structures} eq "yes") { - $cflags .= " -DHAVE_IMMEDIATE_STRUCTURES=1"; - } - - mkpath(dirname($path),0,0755); - open(OUT, ">$path") or die("Can't open $path: $!"); - - foreach (@$dirs) { - print OUT "$_\n"; - } - if ($hasmodules) { - print OUT "modulesdir=$self->{config}->{modulesdir}/$name\n" ; - } - - print OUT "\n"; - - print OUT "Name: $name\n"; - if (defined($desc)) { - print OUT "Description: $desc\n"; - } - print OUT "Requires: $pubdep\n" if defined($pubdep); - print OUT "Requires.private: $privdep\n" if defined($privdep); - print OUT "Version: $version\n"; - print OUT "Libs: $libs\n"; - print OUT "Libs.private: $privlibs\n" if (defined($privlibs)); - print OUT "Cflags: -I\${includedir} $cflags\n"; - - close(OUT); -} - -sub Import($$) -{ - my ($self,$items) = @_; - - foreach (keys %$items) { - if (defined($self->{items})) { - print "Warning: Importing $_ twice!\n"; - } - $self->{items}->{$_} = $items->{$_}; - } -} - -sub GetInfo($$) -{ - my ($self,$name) = @_; - - unless (defined($self->{info}->{$name})) - { - $self->{info}->{$name} = $self->{items}->Build($self); - } - - return $self->{info}->{$name}; -} - 1; diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index e084d48a77..fb769103d0 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -60,8 +60,9 @@ foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->PkgConfig($key, $OUTPUT) if $key->{TYPE} eq "LIBRARY" - and defined($key->{VERSION}); + if (defined($key->{PC_FILE})) { + push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}"); + } $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if ($key->{TYPE} eq "LIBRARY" and diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 7e715b47eb..5799d89c57 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -111,53 +111,9 @@ __EOD__ sub _prepare_suffix_rules($) { my ($self) = @_; - my $first_prereq = '$*.c'; - - if ($self->{config}->{GNU_MAKE} eq 'yes') { - $first_prereq = '$<'; - } $self->output(<< "__EOD__" -FIRST_PREREQ = $first_prereq - -# Dependencies command -DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\ - \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ -# Dependencies for host objects -HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\ - \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ -# Dependencies for precompiled headers -PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\ - \$(CFLAGS) \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@ - -# \$< is broken in older BSD versions: -# when \$@ is foo/bar.o, \$< could be torture/foo/bar.c -# if it also exists. So better use \$* which is foo/bar -# and append .c manually to get foo/bar.c -# -# If we have GNU Make, it is safe to use \$<, which also lets -# building with \$srcdir != \$builddir work. - -# Run a static analysis checker -CHECK = \$(CC_CHECKER) \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(PICFLAG) \$(CPPLAGS) -c \$(FIRST_PREREQ) -o \$@ - -# Run the configured compiler -COMPILE = \$(CC) \$(CFLAGS) \$(PICFLAG) \\ - `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CPPFLAGS) \\ - -c \$(FIRST_PREREQ) -o \$@ - -# Run the compiler for the build host -HCOMPILE = \$(HOSTCC) \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@ - -# Precompile headers -PCHCOMPILE = @\$(CC) -Ilib/replace \\ - \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\ - \$(PICFLAG) \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@ +FIRST_PREREQ = $self->{config}->{FIRST_PREREQ} __EOD__ ); @@ -500,7 +456,6 @@ sub Binary($$) push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}"); } - push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}"); $self->_prepare_list($ctx, "OBJ_LIST"); @@ -552,115 +507,6 @@ sub Manpage($$) push (@{$self->{manpages}}, $path); } -sub PkgConfig($$$) -{ - my ($self,$ctx,$other) = @_; - - my $link_name = $ctx->{NAME}; - - $link_name =~ s/^LIB//g; - $link_name = lc($link_name); - - return if (not defined($ctx->{DESCRIPTION})); - - my $path = output::add_dir_str($ctx->{BASEDIR}, "$link_name.pc"); - - push (@{$self->{pc_files}}, $path); - - my $pubs; - my $privs; - my $privlibs; - my $publibs = ""; - - if (defined($ctx->{PUBLIC_DEPENDENCIES})) { - foreach (@{$ctx->{PUBLIC_DEPENDENCIES}}) { - next if ($other->{$_}->{ENABLE} eq "NO"); - if (defined($other->{$_}->{PC_NAME})) { - $pubs .= "$other->{$_}->{PC_NAME} "; - } elsif ($other->{$_}->{TYPE} eq "EXT_LIB") { - my $e = $other->{$_}; - my $ldflags = join(" ", @{$e->{LDFLAGS}}); - $ldflags .= " " unless $ldflags eq ""; - my $libs = join(" ", @{$e->{LIBS}}); - $libs .= " " unless $libs eq ""; - - $publibs .= $ldflags.$libs; - } else { - s/^LIB//g; - $_ = lc($_); - - $privlibs .= "-l$_ "; - } - } - } - - if (defined($ctx->{PRIVATE_DEPENDENCIES})) { - foreach (@{$ctx->{PRIVATE_DEPENDENCIES}}) { - next if ($other->{$_}->{ENABLE} eq "NO"); - if ($other->{$_}->{TYPE} eq "EXT_LIB") { - my $e = $other->{$_}; - - my $ldflags = join(" ", @{$e->{LDFLAGS}}); - $ldflags .= " " unless $ldflags eq ""; - my $libs = join(" ", @{$e->{LIBS}}); - $libs .= " " unless $libs eq ""; - - $privlibs .= $ldflags.$libs; - } elsif ($other->{$_}->{TYPE} eq "LIBRARY") { - s/^LIB//g; - $_ = lc($_); - - $privs .= "$_ "; - } else { - s/^LIB//g; - $_ = lc($_); - - $privlibs .= "-l$_ "; - } - } - } - - smb_build::env::PkgConfig($self, - $path, - $link_name, - "-L\${libdir} -l$link_name $publibs", - $privlibs, - "", - "$ctx->{VERSION}", - $ctx->{DESCRIPTION}, - defined($ctx->{INIT_FUNCTIONS}), - $pubs, - "", - [ - "prefix=$self->{config}->{prefix}", - "exec_prefix=$self->{config}->{exec_prefix}", - "libdir=$self->{config}->{libdir}", - "includedir=$self->{config}->{includedir}" - ] - ); - my $abs_srcdir = abs_path($self->{config}->{srcdir}); - smb_build::env::PkgConfig($self, - "bin/pkgconfig/$link_name-uninstalled.pc", - $link_name, - "-Lbin/shared -Lbin/static -l$link_name", - $privlibs, - join(' ', - "-I$abs_srcdir", - "-I$abs_srcdir/include", - "-I$abs_srcdir/lib", - "-I$abs_srcdir/lib/replace"), - "$ctx->{VERSION}", - $ctx->{DESCRIPTION}, - defined($ctx->{INIT_FUNCTIONS}), - $pubs, - $privs, - [ - "prefix=bin/", - "includedir=$ctx->{BASEDIR}" - ] - ); -} - sub ProtoHeader($$) { my ($self,$ctx) = @_; |