1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

dynconfig: Have only one dynconfig.o in the common code.

This commit is contained in:
Andrew Bartlett 2011-04-27 16:39:42 +10:00
parent 9e29b09d39
commit 3e85b960fa
12 changed files with 32 additions and 212 deletions

View File

@ -1,24 +1,25 @@
/* /*
Unix SMB/CIFS implementation. Unix SMB/CIFS implementation.
Copyright (C) 2001 by Martin Pool <mbp@samba.org> Copyright (C) 2001 by Martin Pool <mbp@samba.org>
Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
Copyright (C) Stefan Metzmacher 2003 Copyright (C) Stefan Metzmacher 2003
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "includes.h" #include "includes.h"
#include "nsswitch/winbind_struct_protocol.h"
/** /**
* @file dynconfig.c * @file dynconfig.c
@ -41,6 +42,9 @@
**/ **/
#include "dynconfig.h" #include "dynconfig.h"
#ifdef strdup
#undef strdup
#endif
#define DEFINE_DYN_CONFIG_PARAM(name) \ #define DEFINE_DYN_CONFIG_PARAM(name) \
const char *dyn_##name = name; \ const char *dyn_##name = name; \
@ -99,13 +103,15 @@ DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR) DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
DEFINE_DYN_CONFIG_PARAM(LOCALEDIR) DEFINE_DYN_CONFIG_PARAM(LOCALEDIR)
DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR) DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR)
/* these are not in s3 */
DEFINE_DYN_CONFIG_PARAM(DATADIR) DEFINE_DYN_CONFIG_PARAM(DATADIR)
DEFINE_DYN_CONFIG_PARAM(SETUPDIR) DEFINE_DYN_CONFIG_PARAM(SETUPDIR)
DEFINE_DYN_CONFIG_PARAM(WINBINDD_SOCKET_DIR) DEFINE_DYN_CONFIG_PARAM(WINBINDD_SOCKET_DIR) /* from winbind_struct_protocol.h in s3 autoconf */
/* these are not in s3 */
#if (_SAMBA_BUILD_ >= 4)
DEFINE_DYN_CONFIG_PARAM(WINBINDD_PRIVILEGED_SOCKET_DIR) DEFINE_DYN_CONFIG_PARAM(WINBINDD_PRIVILEGED_SOCKET_DIR)
DEFINE_DYN_CONFIG_PARAM(NTP_SIGND_SOCKET_DIR) DEFINE_DYN_CONFIG_PARAM(NTP_SIGND_SOCKET_DIR)
DEFINE_DYN_CONFIG_PARAM(PYTHONDIR) DEFINE_DYN_CONFIG_PARAM(PYTHONDIR)
DEFINE_DYN_CONFIG_PARAM(PYTHONARCHDIR) DEFINE_DYN_CONFIG_PARAM(PYTHONARCHDIR)
DEFINE_DYN_CONFIG_PARAM(SCRIPTSBINDIR) DEFINE_DYN_CONFIG_PARAM(SCRIPTSBINDIR)
#endif

View File

@ -1,19 +1,19 @@
/* /*
Unix SMB/CIFS implementation. Unix SMB/CIFS implementation.
Copyright (C) 2001 by Martin Pool <mbp@samba.org> Copyright (C) 2001 by Martin Pool <mbp@samba.org>
Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */

View File

@ -23,7 +23,7 @@
#include "includes.h" #include "includes.h"
#include "lib/util/charset/charset.h" #include "lib/util/charset/charset.h"
#include "system/locale.h" #include "system/locale.h"
#include "dynconfig.h" #include "dynconfig/dynconfig.h"
#ifdef strcasecmp #ifdef strcasecmp
#undef strcasecmp #undef strcasecmp

View File

@ -140,6 +140,7 @@ CONFIGDIR = @configdir@
VARDIR = @localstatedir@ VARDIR = @localstatedir@
MANDIR = @mandir@ MANDIR = @mandir@
DATADIR = @datadir@ DATADIR = @datadir@
SETUPDIR = @datadir@/setup
# The permissions to give the executables and other data # The permissions to give the executables and other data
INSTALLPERMS_BIN = 0755 INSTALLPERMS_BIN = 0755
@ -210,7 +211,9 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
-DCACHEDIR=\"$(CACHEDIR)\" \ -DCACHEDIR=\"$(CACHEDIR)\" \
-DSTATEDIR=\"$(STATEDIR)\" \ -DSTATEDIR=\"$(STATEDIR)\" \
-DNMBDSOCKETDIR=\"$(NMBDSOCKETDIR)\" \ -DNMBDSOCKETDIR=\"$(NMBDSOCKETDIR)\" \
-DLOCALEDIR=\"$(LOCALEDIR)\" -DLOCALEDIR=\"$(LOCALEDIR)\" \
-DDATADIR=\"$(DATADIR)\" \
-DSETUPDIR=\"$(SETUPDIR)\"
# Note that all executable programs now provide for an optional executable suffix. # Note that all executable programs now provide for an optional executable suffix.
@ -485,7 +488,7 @@ READLINE_OBJ = ../libcli/smbreadline/smbreadline.o
# Be sure to include them into your application # Be sure to include them into your application
POPT_LIB_OBJ = lib/popt_common.o POPT_LIB_OBJ = lib/popt_common.o
PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o param/loadparm_server_role.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o PARAM_WITHOUT_REG_OBJ = ../dynconfig/dynconfig.o param/loadparm.o param/loadparm_server_role.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o
PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) $(PRIVILEGES_BASIC_OBJ) PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) $(PRIVILEGES_BASIC_OBJ)
PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ) PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ)
@ -1697,7 +1700,7 @@ BINARY_PREREQS = bin/.dummy
# but since we also require "make install prefix=/opt/samba" *not* to # but since we also require "make install prefix=/opt/samba" *not* to
# rebuild it's a bit hard. # rebuild it's a bit hard.
dynconfig.o: dynconfig.c Makefile ../dynconfig/dynconfig.o: ../dynconfig/dynconfig.c Makefile
@echo Compiling $*.c @echo Compiling $*.c
@$(COMPILE_CC_PATH) && exit 0;\ @$(COMPILE_CC_PATH) && exit 0;\
echo "The following command failed:" 1>&2;\ echo "The following command failed:" 1>&2;\
@ -3302,16 +3305,13 @@ uninstallpammodules::
rm -f "$(DESTDIR)/$(PAMMODULESDIR)/$${module}.@SHLIBEXT@"; \ rm -f "$(DESTDIR)/$(PAMMODULESDIR)/$${module}.@SHLIBEXT@"; \
done done
# Toplevel clean files
TOPFILES=dynconfig.o localedir.o
cleanlibs:: cleanlibs::
-rm -f ../lib/*/*.o ../lib/*/*/*.o \ -rm -f ../lib/*/*.o ../lib/*/*/*.o \
../lib/*/*.ho \ ../lib/*/*.ho \
../libcli/*.o ../libcli/*/*.o ../libcli/*/*/*.o \ ../libcli/*.o ../libcli/*/*.o ../libcli/*/*/*.o \
../librpc/*/*.o \ ../librpc/*/*.o \
../libgpo/*.o ../libgpo/*/*.o \ ../libgpo/*.o ../libgpo/*/*.o \
../libds/*.o ../libds/*/*.o ../libds/*.o ../libds/*/*.o ../dynconfig/*.o
clean:: cleanlibs clean:: cleanlibs
-rm -f include/build_env.h -rm -f include/build_env.h

View File

@ -42,7 +42,7 @@ def configure(conf):
def build(bld): def build(bld):
cflags = dynconfig_cflags(bld) cflags = dynconfig_cflags(bld)
bld.SAMBA3_SUBSYSTEM('DYNCONFIG', bld.SAMBA3_SUBSYSTEM('DYNCONFIG',
'../dynconfig.c', '../../dynconfig/dynconfig.c',
deps='replace talloc tdb popt', deps='replace talloc tdb popt',
cflags=cflags) cflags=cflags)

View File

@ -1,86 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2001 by Martin Pool <mbp@samba.org>
Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com>
Copyright (C) 2007 by Jeremy Allison <jra@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
/**
* @file dynconfig.c
*
* @brief Global configurations, initialized to configured defaults.
*
* This file should be the only file that depends on path
* configuration (--prefix, etc), so that if ./configure is re-run,
* all programs will be appropriately updated. Everything else in
* Samba should import extern variables from here, rather than relying
* on preprocessor macros.
*
* Eventually some of these may become even more variable, so that
* they can for example consistently be set across the whole of Samba
* by command-line parameters, config file entries, or environment
* variables.
*
* @todo Perhaps eventually these should be merged into the parameter
* table? There's kind of a chicken-and-egg situation there...
**/
#define DEFINE_DYN_CONFIG_PARAM(name) \
static char *dyn_##name; \
\
const char *get_dyn_##name(void) \
{\
if (dyn_##name == NULL) {\
return name;\
}\
return dyn_##name;\
}\
\
const char *set_dyn_##name(const char *newpath) \
{\
if (dyn_##name) {\
SAFE_FREE(dyn_##name);\
}\
dyn_##name = SMB_STRDUP(newpath);\
return dyn_##name;\
}\
\
bool is_default_dyn_##name(void) \
{\
return (dyn_##name == NULL);\
}
DEFINE_DYN_CONFIG_PARAM(SBINDIR)
DEFINE_DYN_CONFIG_PARAM(BINDIR)
DEFINE_DYN_CONFIG_PARAM(SWATDIR)
DEFINE_DYN_CONFIG_PARAM(CONFIGFILE) /**< Location of smb.conf file. **/
DEFINE_DYN_CONFIG_PARAM(LOGFILEBASE) /** Log file directory. **/
DEFINE_DYN_CONFIG_PARAM(LMHOSTSFILE) /** Statically configured LanMan hosts. **/
DEFINE_DYN_CONFIG_PARAM(CODEPAGEDIR)
DEFINE_DYN_CONFIG_PARAM(LIBDIR)
DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
DEFINE_DYN_CONFIG_PARAM(STATEDIR) /** Persistent state files. Default LOCKDIR */
DEFINE_DYN_CONFIG_PARAM(CACHEDIR) /** Temporary cache files. Default LOCKDIR */
DEFINE_DYN_CONFIG_PARAM(PIDDIR)
DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR)
DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
DEFINE_DYN_CONFIG_PARAM(LOCALEDIR)

View File

@ -1,100 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2001 by Martin Pool <mbp@samba.org>
Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file dynconfig.h
*
* @brief Exported global configurations.
**/
const char *get_dyn_SBINDIR(void);
const char *set_dyn_SBINDIR(const char *newpath);
bool is_default_dyn_SBINDIR(void);
const char *get_dyn_BINDIR(void);
const char *set_dyn_BINDIR(const char *newpath);
bool is_default_dyn_BINDIR(void);
const char *get_dyn_SWATDIR(void);
const char *set_dyn_SWATDIR(const char *newpath);
bool is_default_dyn_SWATDIR(void);
const char *get_dyn_CONFIGFILE(void);
const char *set_dyn_CONFIGFILE(const char *newpath);
bool is_default_dyn_CONFIGFILE(void);
const char *get_dyn_LOGFILEBASE(void);
const char *set_dyn_LOGFILEBASE(const char *newpath);
bool is_default_dyn_LOGFILEBASE(void);
const char *get_dyn_LMHOSTSFILE(void);
const char *set_dyn_LMHOSTSFILE(const char *newpath);
bool is_default_dyn_LMHOSTSFILE(void);
const char *get_dyn_CODEPAGEDIR(void);
const char *set_dyn_CODEPAGEDIR(const char *newpath);
bool is_default_dyn_CODEPAGEDIR(void);
const char *get_dyn_LIBDIR(void);
const char *set_dyn_LIBDIR(const char *newpath);
bool is_default_dyn_LIBDIR(void);
const char *get_dyn_MODULESDIR(void);
const char *set_dyn_MODULESDIR(const char *newpath);
bool is_default_dyn_MODULESDIR(void);
const char *get_dyn_SHLIBEXT(void);
const char *set_dyn_SHLIBEXT(const char *newpath);
bool is_default_dyn_SHLIBEXT(void);
const char *get_dyn_LOCKDIR(void);
const char *set_dyn_LOCKDIR(const char *newpath);
bool is_default_dyn_LOCKDIR(void);
const char *get_dyn_STATEDIR(void);
const char *set_dyn_STATEDIR(const char *newpath);
bool is_default_dyn_STATEDIR(void);
const char *get_dyn_CACHEDIR(void);
const char *set_dyn_CACHEDIR(const char *newpath);
bool is_default_dyn_CACHEDIR(void);
const char *get_dyn_PIDDIR(void);
const char *set_dyn_PIDDIR(const char *newpath);
bool is_default_dyn_PIDDIR(void);
const char *get_dyn_NMBDSOCKETDIR(void);
const char *set_dyn_NMBDSOCKETDIR(const char *newpath);
bool is_default_dyn_NMBDSOCKETDIR(void);
const char *get_dyn_NCALRPCDIR(void);
const char *set_dyn_NCALRPCDIR(const char *newpath);
bool is_default_dyn_NCALRPCDIR(void);
const char *get_dyn_SMB_PASSWD_FILE(void);
const char *set_dyn_SMB_PASSWD_FILE(const char *newpath);
bool is_default_dyn_SMB_PASSWD_FILE(void);
const char *get_dyn_PRIVATE_DIR(void);
const char *set_dyn_PRIVATE_DIR(const char *newpath);
bool is_default_dyn_PRIVATE_DIR(void);
const char *get_dyn_LOCALEDIR(void);
const char *set_dyn_LOCALEDIR(const char *newpath);
bool is_default_dyn_LOCALEDIR(void);

View File

@ -532,7 +532,7 @@ typedef char fstring[FSTRING_LEN];
#include "libads/ads_status.h" #include "libads/ads_status.h"
#include "../libcli/util/error.h" #include "../libcli/util/error.h"
#include "../lib/util/charset/charset.h" #include "../lib/util/charset/charset.h"
#include "dynconfig.h" #include "dynconfig/dynconfig.h"
#include "locking.h" #include "locking.h"
#include "smb_perfcount.h" #include "smb_perfcount.h"
#include "smb.h" #include "smb.h"

View File

@ -21,7 +21,7 @@ BEGIN {
print ""; print "";
print "#include \"includes.h\""; print "#include \"includes.h\"";
print "#include \"build_env.h\""; print "#include \"build_env.h\"";
print "#include \"dynconfig.h\""; print "#include \"dynconfig/dynconfig.h\"";
print ""; print "";
print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);"; print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);";
print "void build_options(bool screen);"; print "void build_options(bool screen);";

View File

@ -21,7 +21,7 @@ BEGIN {
print ""; print "";
print "#include \"includes.h\""; print "#include \"includes.h\"";
print "#include \"build_env.h\""; print "#include \"build_env.h\"";
print "#include \"dynconfig.h\""; print "#include \"dynconfig/dynconfig.h\"";
print ""; print "";
print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);"; print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);";
print "void build_options(bool screen);"; print "void build_options(bool screen);";

View File

@ -19,7 +19,7 @@
#include "includes.h" #include "includes.h"
#include "web/swat_proto.h" #include "web/swat_proto.h"
#include "dynconfig.h" #include "dynconfig/dynconfig.h"
/** Startup smbd from web interface. */ /** Startup smbd from web interface. */

View File

@ -146,7 +146,7 @@ Build.BuildContext.dynconfig_cflags = dynconfig_cflags
def build(bld): def build(bld):
cflags = bld.dynconfig_cflags() cflags = bld.dynconfig_cflags()
bld.SAMBA_SUBSYSTEM('DYNCONFIG', bld.SAMBA_SUBSYSTEM('DYNCONFIG',
'dynconfig.c', '../../dynconfig/dynconfig.c',
deps='replace talloc', deps='replace talloc',
public_headers=os_path_relpath(os.path.join(Options.launch_dir, 'version.h'), bld.curdir), public_headers=os_path_relpath(os.path.join(Options.launch_dir, 'version.h'), bld.curdir),
header_path='samba', header_path='samba',