AC_CANONICAL_HOST
-SMB_VERSION_STRING=`cat include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
+AC_SUBST(srcdir)
+export srcdir;
+
+# we always set builddir to "." as that's nicer than
+# having the absolute path of the current work directory
+builddir=.
+AC_SUBST(builddir)
+export builddir;
+
+SMB_VERSION_STRING=`cat ${srcdir}/include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
-SAMBA_VERSION_SVN_REVISION=`cat include/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
+SAMBA_VERSION_SVN_REVISION=`cat ${srcdir}/include/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
if test -n "${SAMBA_VERSION_SVN_REVISION}";then
echo "BUILD REVISION: ${SAMBA_VERSION_SVN_REVISION}"
fi
#
# $filename - the path of the config.mk file
# which should be parsed
-sub run_config_mk($$)
+sub run_config_mk($$$)
{
- sub run_config_mk($$);
- my ($input, $filename) = @_;
+ sub run_config_mk($$$);
+ my ($input, $srcdir, $filename) = @_;
my $result;
my $linenum = -1;
my $infragment = 0;
my $section = "GLOBAL";
my $makefile = "";
- push (@parsed_files, $filename);
+ push (@parsed_files, $srcdir."/".$filename);
- open(CONFIG_MK, $filename) or die("Can't open `$filename'\n");
+ open(CONFIG_MK, $srcdir."/".$filename) or die("Can't open `$srcdir/$filename'\n");
my @lines = <CONFIG_MK>;
close(CONFIG_MK);
# include
if ($line =~ /^include (.*)$/) {
- $makefile .= run_config_mk($input, dirname($filename)."/$1");
+ $makefile .= run_config_mk($input, $srcdir, dirname($filename)."/$1");
next;
}
next;
}
- die("$filename:$linenum: Bad line while parsing $filename");
+ die("$srcdir."/".$filename:$linenum: Bad line while parsing $srcdir."/".$filename");
}
foreach my $section (keys %{$result}) {
my $sectype = $section_types->{$type};
if (not defined($sectype)) {
- die($filename.":[".$section."] unknown section type \"".$type."\"!");
+ die($srcdir."/".$filename.":[".$section."] unknown section type \"".$type."\"!");
}
$input->{$name}{NAME} = $name;
$input->{$name}{TYPE} = $type;
- $input->{$name}{BASEDIR} = dirname($filename);
+ $input->{$name}{BASEDIR} = $srcdir."/".dirname($filename);
foreach my $key (values %{$result->{$section}}) {
$key->{VAL} = smb_build::input::strtrim($key->{VAL});
my $vartype = $sectype->{$key->{KEY}};
if (not defined($vartype)) {
- die($filename.":[".$section."]: unknown attribute type \"$key->{KEY}\"!");
+ die($srcdir."/".$filename.":[".$section."]: unknown attribute type \"$key->{KEY}\"!");
}
if ($vartype eq "string") {
$input->{$name}{$key->{KEY}} = $key->{VAL};
$self->{config} = $config;
- $self->{config}->{srcdir} = '.';
- $self->{config}->{builddir} = '.';
+ if (not defined($self->{config}->{srcdir})) {
+ $self->{config}->{srcdir} = '.';
+ }
+
+ if (not defined($self->{config}->{builddir})) {
+ $self->{config}->{builddir} = '.';
+ }
if ($self->{config}->{prefix} eq "NONE") {
$self->{config}->{prefix} = $self->{config}->{ac_default_prefix};
# Copyright (C) Jelmer Vernooij 2004
# Released under the GNU GPL
+use config;
use strict;
package smb_build::input;
-my $srcdir = ".";
+my $srcdir = $config::config{srcdir};
sub strtrim($)
{
my $INPUT = {};
-my $mkfile = smb_build::config_mk::run_config_mk($INPUT, "main.mk");
+my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, "main.mk");
my $subsystem_output_type;
$self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
$self->output("\t\@echo \"Creating $dir/$ctx->{PRIVATE_PROTO_HEADER}$comment\"\n");
- $self->output("\t\@\$(PERL) \${srcdir}/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
+ $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
}
sub write($$)
AC_MSG_ERROR([summary failure. Aborting config]); exit 1;,
AC_MSG_WARN([cannot run when cross-compiling]))
-builddir=`pwd`
-AC_SUBST(builddir)
-
LIBS=`echo $LIBS | sed -e 's/ *//g'`
if test x"$LIBS" != x""; then
echo "LIBS: $LIBS"
$SMB_INFO_LIBRARIES
CEOF
-AC_OUTPUT_COMMANDS([$PERL -I. -Ibuild build/smb_build/main.pl],[PERL="$PERL";export PERL])
+AC_OUTPUT_COMMANDS(
+[$PERL -I${builddir} -I${srcdir} -I${srcdir}/build ${srcdir}/build/smb_build/main.pl],[
+PERL="$PERL";export PERL;export srcdir; export builddir;
+])
AC_OUTPUT
include/proto.h: $(PROTO_OBJS:.o=.c)
@echo "Creating include/proto.h"
- @$(PERL) script/mkproto.pl --public-define=_PROTO_H_ \
+ @$(PERL) $(srcdir)/script/mkproto.pl --public-define=_PROTO_H_ \
--public=include/proto.h --private=include/proto.h \
$(PROTO_OBJS)