Automatically write AC_SUBST() vars to mkconfig.mk and use them.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 10 Feb 2008 23:21:20 +0000 (00:21 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 10 Feb 2008 23:21:20 +0000 (00:21 +0100)
source/build/smb_build/makefile.pm
source/configure.ac
source/dynconfig.mk
source/main.mk

index dfa7387c753d6a1b99c4cb87b130f1ea1994da91..c28229c23b1787b558aa6853244741addd53e940 100644 (file)
@@ -50,8 +50,6 @@ sub new($$$)
 
        $self->output("default: all\n\n");
 
-       $self->_prepare_path_vars();
-       $self->_prepare_suffix_rules();
        $self->_prepare_compiler_linker();
 
        if (!$self->{automatic_deps}) {
@@ -69,57 +67,6 @@ sub output($$)
        $self->{output} .= $text;
 }
 
-sub _prepare_path_vars($)
-{
-       my ($self) = @_;
-
-       $self->output(<< "__EOD__"
-prefix = $self->{config}->{prefix}
-exec_prefix = $self->{config}->{exec_prefix}
-selftest_prefix = $self->{config}->{selftest_prefix}
-
-builddir = $self->{config}->{builddir}
-srcdir = $self->{config}->{srcdir}
-datarootdir = $self->{config}->{datarootdir}
-
-VPATH = \$(builddir):\$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
-
-BASEDIR = $self->{config}->{prefix}
-BINDIR = $self->{config}->{bindir}
-SBINDIR = $self->{config}->{sbindir}
-LIBDIR = $self->{config}->{libdir}
-TORTUREDIR = $self->{config}->{libdir}/torture
-MODULESDIR = $self->{config}->{modulesdir}
-INCLUDEDIR = $self->{config}->{includedir}
-CONFIGDIR = $self->{config}->{sysconfdir}
-DATADIR = $self->{config}->{datadir}
-SWATDIR = \$(DATADIR)/swat
-JSDIR = \$(DATADIR)/js
-SETUPDIR = \$(DATADIR)/setup
-VARDIR = $self->{config}->{localstatedir}
-LOGFILEBASE = $self->{config}->{logfilebase}
-NCALRPCDIR = $self->{config}->{localstatedir}/ncalrpc
-LOCKDIR = $self->{config}->{lockdir}
-PIDDIR = $self->{config}->{piddir}
-MANDIR = $self->{config}->{mandir}
-PRIVATEDIR = $self->{config}->{privatedir}
-WINBINDD_SOCKET_DIR = $self->{config}->{winbindd_socket_dir}
-
-__EOD__
-);
-}
-
-sub _prepare_suffix_rules($)
-{
-       my ($self) = @_;
-
-       $self->output(<< "__EOD__"
-FIRST_PREREQ = $self->{config}->{FIRST_PREREQ}
-
-__EOD__
-);
-}
-
 sub _prepare_compiler_linker($)
 {
        my ($self) = @_;
@@ -140,54 +87,22 @@ sub _prepare_compiler_linker($)
        }
 
        $self->output(<< "__EOD__"
-SHELL=$self->{config}->{SHELL}
 
-PERL=$self->{config}->{PERL}
-PYTHON=$self->{config}->{PYTHON}
-SWIG=$self->{config}->{SWIG}
-
-CPP=$self->{config}->{CPP}
 CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
 
-CC=$self->{config}->{CC}
-CFLAGS=$self->{config}->{CFLAGS}
-CFLAG_NO_UNUSED_MACROS=$self->{config}->{CFLAG_NO_UNUSED_MACROS}
-PICFLAG=$self->{config}->{PICFLAG}
-
 INSTALL_LINK_FLAGS=$extra_link_flags
 
 BNLD=$self->{config}->{LD} 
 BNLD_FLAGS=$self->{config}->{LDFLAGS} -L$libdir
 
-STLD=$self->{config}->{STLD}
-STLD_FLAGS=$self->{config}->{STLD_FLAGS}
-
-SHLD=$self->{config}->{SHLD}
 SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
 
-MDLD=$self->{config}->{MDLD}
 MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
 
-SHLIBEXT=$self->{config}->{SHLIBEXT}
-
-HOSTCC=$self->{config}->{HOSTCC}
 HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS)
 
-HOSTLD=$self->{config}->{HOSTLD}
 HOSTLD_FLAGS=$self->{config}->{LDFLAGS}
 
-XSLTPROC=$self->{config}->{XSLTPROC}
-
-LIB_PATH_VAR=$self->{config}->{LIB_PATH_VAR}
-
-LEX=$self->{config}->{LEX}
-YACC=$self->{config}->{YACC}
-YAPP=$self->{config}->{YAPP}
-
-GCOV=$self->{config}->{GCOV}
-
-DEFAULT_TEST_OPTIONS=$self->{config}->{DEFAULT_TEST_OPTIONS}
-
 __EOD__
 );
 }
@@ -281,16 +196,16 @@ sub SharedModule($$)
        } else {
                push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
                push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
-               $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/\n";
-               $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
+               $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
                if (defined($ctx->{ALIASES})) {
                        foreach (@{$ctx->{ALIASES}}) {
-                               $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+                               $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+                               $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+                               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
                        }
                }
        }
index 0857c68426084e574a8d56fd5d90bf84d4b1dab7..f7251f597b44bf6a35accb8747bf0edc241c5fd4 100644 (file)
@@ -205,7 +205,7 @@ fi
 echo "configure: creating mkconfig.mk"
 cat >mkconfig.mk<<CEOF
 # mkconfig.mk - Autogenerated by configure, DO NOT EDIT!
-dnl AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
-dnl AC_Var = $AC_Var])
+AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
+AC_Var = $AC_Var])
 $MAKE_SETTINGS
 CEOF
index 9c872da3e83c69e79f7ecae527749f36a13798a8..ee5defa6d8d434967b0963e2843094dd0259980d 100644 (file)
@@ -4,20 +4,20 @@ OBJ_FILES = dynconfig.o
 # 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))
-CONFIGFILE = $(CONFIGDIR)/smb.conf
+CONFIGFILE = $(sysconfdir)/smb.conf
 PKGCONFIGDIR = $(LIBDIR)/pkgconfig
-LMHOSTSFILE = $(CONFIGDIR)/lmhosts
+LMHOSTSFILE = $(sysconfdir)/lmhosts
 
 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \
-        -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
-        -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DDATADIR=\"$(DATADIR)\" \
-        -DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-        -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
+        -DBINDIR=\"$(bindir)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
+        -DLOCKDIR=\"$(lockdir)\" -DPIDDIR=\"$(piddir)\" -DDATADIR=\"$(datadir)\" \
+        -DLOGFILEBASE=\"$(logfilebase)\" \
+        -DCONFIGDIR=\"$(sysconfdir)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
         -DSWATDIR=\"$(SWATDIR)\" \
-        -DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
-        -DMODULESDIR=\"$(MODULESDIR)\" -DJSDIR=\"$(JSDIR)\" \
+        -DPRIVATE_DIR=\"$(privatedir)\" \
+        -DMODULESDIR=\"$(modulesdir)\" -DJSDIR=\"$(JSDIR)\" \
         -DTORTUREDIR=\"$(TORTUREDIR)\" \
-        -DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(WINBINDD_SOCKET_DIR)\"
+        -DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(winbindd_socket_dir)\"
 
 dynconfig.o: dynconfig.c Makefile
        @echo Compiling $<
index 769cc4f1e46aa8f09b61b0ce01890a1aa508faf9..0f492c10f43d6850da0821779eb83abd5229f6da 100644 (file)
@@ -1,3 +1,12 @@
+VPATH = $(builddir):$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
+
+BASEDIR = $(prefix)
+TORTUREDIR = $(libdir)/torture
+SWATDIR = $(datadir)/swat
+JSDIR = $(datadir)/js
+SETUPDIR = $(datadir)/setup
+NCALRPCDIR = $(localstatedir)/ncalrpc
+
 default: all
 
 include dynconfig.mk
@@ -54,23 +63,23 @@ testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
 showlayout:: 
        @echo 'Samba will be installed into:'
        @echo '  basedir:     $(BASEDIR)'
-       @echo '  bindir:      $(BINDIR)'
-       @echo '  sbindir:     $(SBINDIR)'
-       @echo '  libdir:      $(LIBDIR)'
-       @echo '  modulesdir:  $(MODULESDIR)'
-       @echo '  includedir:  $(INCLUDEDIR)'
-       @echo '  vardir:      $(VARDIR)'
-       @echo '  privatedir:  $(PRIVATEDIR)'
-       @echo '  piddir:      $(PIDDIR)'
-       @echo '  lockdir:     $(LOCKDIR)'
-       @echo '  logfilebase: $(LOGFILEBASE)'
+       @echo '  bindir:      $(bindir)'
+       @echo '  sbindir:     $(sbindir)'
+       @echo '  libdir:      $(libdir)'
+       @echo '  modulesdir:  $(modulesdir)'
+       @echo '  includedir:  $(includedir)'
+       @echo '  vardir:      $(localstatedir)'
+       @echo '  privatedir:  $(privatedir)'
+       @echo '  piddir:      $(piddir)'
+       @echo '  lockdir:     $(lockdir)'
+       @echo '  logfilebase: $(logfilebase)'
        @echo '  setupdir:    $(SETUPDIR)'
        @echo '  jsdir:       $(JSDIR)'
        @echo '  swatdir:     $(SWATDIR)'
-       @echo '  mandir:      $(MANDIR)'
+       @echo '  mandir:      $(mandir)'
        @echo '  torturedir:  $(TORTUREDIR)'
-       @echo '  datadir:     $(DATADIR)'
-       @echo '  winbindd_socket_dir:  $(WINBINDD_SOCKET_DIR)'
+       @echo '  datadir:     $(datadir)'
+       @echo '  winbindd_socket_dir:  $(winbindd_socket_dir)'
 
 showflags::
        @echo '  srcdir     = $(srcdir)'
@@ -93,37 +102,37 @@ install:: showlayout everything installbin installdat installswat installmisc in
 installdirs::
        @$(SHELL) $(srcdir)/script/installdirs.sh \
                $(DESTDIR)$(BASEDIR) \
-               $(DESTDIR)$(BINDIR) \
-               $(DESTDIR)$(SBINDIR) \
+               $(DESTDIR)$(bindir) \
+               $(DESTDIR)$(sbindir) \
                $(DESTDIR)$(TORTUREDIR) \
-               $(DESTDIR)$(LIBDIR) \
-               $(DESTDIR)$(MODULESDIR) \
-               $(DESTDIR)$(MANDIR) \
-               $(DESTDIR)$(VARDIR) \
-               $(DESTDIR)$(PRIVATEDIR) \
-               $(DESTDIR)$(DATADIR) \
-               $(DESTDIR)$(PIDDIR) \
-               $(DESTDIR)$(LOCKDIR) \
-               $(DESTDIR)$(LOGFILEBASE) \
-               $(DESTDIR)$(PRIVATEDIR)/tls \
-               $(DESTDIR)$(INCLUDEDIR) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(modulesdir) \
+               $(DESTDIR)$(mandir) \
+               $(DESTDIR)$(localstatedir) \
+               $(DESTDIR)$(privatedir) \
+               $(DESTDIR)$(datadir) \
+               $(DESTDIR)$(piddir) \
+               $(DESTDIR)$(lockdir) \
+               $(DESTDIR)$(logfilebase) \
+               $(DESTDIR)$(privatedir)/tls \
+               $(DESTDIR)$(includedir) \
                $(DESTDIR)$(PKGCONFIGDIR) \
-               $(DESTDIR)$(CONFIGDIR) \
+               $(DESTDIR)$(sysconfdir) \
 
 installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
        @$(SHELL) $(srcdir)/script/installbin.sh \
                $(INSTALLPERMS) \
                $(DESTDIR)$(BASEDIR) \
-               $(DESTDIR)$(SBINDIR) \
-               $(DESTDIR)$(LIBDIR) \
-               $(DESTDIR)$(VARDIR) \
+               $(DESTDIR)$(sbindir) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(localstatedir) \
                $(SBIN_PROGS)
        @$(SHELL) $(srcdir)/script/installbin.sh \
                $(INSTALLPERMS) \
                $(DESTDIR)$(BASEDIR) \
-               $(DESTDIR)$(BINDIR) \
-               $(DESTDIR)$(LIBDIR) \
-               $(DESTDIR)$(VARDIR) \
+               $(DESTDIR)$(bindir) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(localstatedir) \
                $(BIN_PROGS)
        @$(SHELL) $(srcdir)/script/installtorture.sh \
                $(INSTALLPERMS) \
@@ -131,23 +140,23 @@ installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
                $(TORTURE_PROGS)
 
 installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
-       @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
-       #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
+       @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
+       #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
 
 installheader:: headers installdirs
-       @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
+       @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
 
 installdat:: installdirs
-       @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
+       @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
 
 installswat:: installdirs
        @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
 
 installman:: manpages installdirs
-       @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
+       @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
 
 installmisc:: installdirs
-       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
+       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(bindir)
 
 installpc:: installdirs
        @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
@@ -159,19 +168,19 @@ uninstallmisc::
        #FIXME
 
 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)
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
        @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
 
 uninstalllib::
-       @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
-       #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS) 
+       @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
+       #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(STATIC_LIBS) 
 
 uninstallheader::
-       @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
+       @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
 
 uninstallman::
-       @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
+       @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
 
 Makefile: config.status $(MK_FILES)
        ./config.status