dynconfig: Have only one dynconfig.o in the common code.
authorAndrew Bartlett <abartlet@samba.org>
Wed, 27 Apr 2011 06:39:42 +0000 (16:39 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 27 Apr 2011 12:22:26 +0000 (22:22 +1000)
12 files changed:
dynconfig/dynconfig.c [moved from source4/dynconfig/dynconfig.c with 94% similarity]
dynconfig/dynconfig.h [moved from source4/dynconfig/dynconfig.h with 99% similarity]
lib/util/charset/codepoints.c
source3/Makefile.in
source3/build/wscript
source3/dynconfig.c [deleted file]
source3/include/dynconfig.h [deleted file]
source3/include/includes.h
source3/script/mkbuildoptions-waf.awk
source3/script/mkbuildoptions.awk
source3/web/startstop.c
source4/dynconfig/wscript

similarity index 94%
rename from source4/dynconfig/dynconfig.c
rename to dynconfig/dynconfig.c
index 65e57e0fc174f2ac3e43aea20dc090e82e79cbe1..4bcdab35961dd8a041f99e928759123c3b66b08a 100644 (file)
@@ -1,24 +1,25 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    Copyright (C) 2001 by Martin Pool <mbp@samba.org>
    Copyright (C) Jim McDonough (jmcd@us.ibm.com)  2003.
    Copyright (C) Stefan Metzmacher     2003
-   
+
    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"
+#include "nsswitch/winbind_struct_protocol.h"
 
 /**
  * @file dynconfig.c
@@ -41,6 +42,9 @@
  **/
 
 #include "dynconfig.h"
+#ifdef strdup
+#undef strdup
+#endif
 
 #define DEFINE_DYN_CONFIG_PARAM(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(LOCALEDIR)
 DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR)
-
-/* these are not in s3 */
 DEFINE_DYN_CONFIG_PARAM(DATADIR)
 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(NTP_SIGND_SOCKET_DIR)
 DEFINE_DYN_CONFIG_PARAM(PYTHONDIR)
 DEFINE_DYN_CONFIG_PARAM(PYTHONARCHDIR)
 DEFINE_DYN_CONFIG_PARAM(SCRIPTSBINDIR)
+#endif
similarity index 99%
rename from source4/dynconfig/dynconfig.h
rename to dynconfig/dynconfig.h
index ee710f3de92849991706a9d3378b986a884940de..e53cd8ff5fab7f0e473295c0840e19c76737501e 100644 (file)
@@ -1,19 +1,19 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    Copyright (C) 2001 by Martin Pool <mbp@samba.org>
    Copyright (C) Jim McDonough (jmcd@us.ibm.com)  2003.
-   
-   
+
+
    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/>.
 */
index cd54420e8e2656268a1556c455c51a73992d7a72..5e8ac64ed4f0e92ac0908f0f09b3ca6e78022a65 100644 (file)
@@ -23,7 +23,7 @@
 #include "includes.h"
 #include "lib/util/charset/charset.h"
 #include "system/locale.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 
 #ifdef strcasecmp
 #undef strcasecmp
index baac3cdcafee73c938709ee6887380cd20a4e286..ae275f808c65ddc60f4bd78402d7bfedb4bd4461 100644 (file)
@@ -140,6 +140,7 @@ CONFIGDIR = @configdir@
 VARDIR = @localstatedir@
 MANDIR = @mandir@
 DATADIR = @datadir@
+SETUPDIR = @datadir@/setup
 
 # The permissions to give the executables and other data
 INSTALLPERMS_BIN = 0755
@@ -210,7 +211,9 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
        -DCACHEDIR=\"$(CACHEDIR)\" \
        -DSTATEDIR=\"$(STATEDIR)\" \
        -DNMBDSOCKETDIR=\"$(NMBDSOCKETDIR)\" \
-       -DLOCALEDIR=\"$(LOCALEDIR)\"
+       -DLOCALEDIR=\"$(LOCALEDIR)\" \
+       -DDATADIR=\"$(DATADIR)\" \
+       -DSETUPDIR=\"$(SETUPDIR)\"
 
 # 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
 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_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
 # rebuild it's a bit hard.
 
-dynconfig.o: dynconfig.c Makefile
+../dynconfig/dynconfig.o: ../dynconfig/dynconfig.c Makefile
        @echo Compiling $*.c
        @$(COMPILE_CC_PATH) && exit 0;\
                echo "The following command failed:" 1>&2;\
@@ -3302,16 +3305,13 @@ uninstallpammodules::
                rm -f "$(DESTDIR)/$(PAMMODULESDIR)/$${module}.@SHLIBEXT@"; \
        done
 
-# Toplevel clean files
-TOPFILES=dynconfig.o localedir.o
-
 cleanlibs::
        -rm -f ../lib/*/*.o ../lib/*/*/*.o \
                ../lib/*/*.ho \
                ../libcli/*.o ../libcli/*/*.o ../libcli/*/*/*.o \
                ../librpc/*/*.o \
                ../libgpo/*.o ../libgpo/*/*.o \
-               ../libds/*.o ../libds/*/*.o
+               ../libds/*.o ../libds/*/*.o ../dynconfig/*.o
 
 clean:: cleanlibs
        -rm -f include/build_env.h
index d370daf8996a0f4266e027db24dc918dc6bfd9ed..b9c6bd264c8e196a0b74cb2c317160186d29f734 100644 (file)
@@ -42,7 +42,7 @@ def configure(conf):
 def build(bld):
     cflags = dynconfig_cflags(bld)
     bld.SAMBA3_SUBSYSTEM('DYNCONFIG',
-                        '../dynconfig.c',
+                        '../../dynconfig/dynconfig.c',
                         deps='replace talloc tdb popt',
                         cflags=cflags)
 
diff --git a/source3/dynconfig.c b/source3/dynconfig.c
deleted file mode 100644 (file)
index 32f64a6..0000000
+++ /dev/null
@@ -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)
diff --git a/source3/include/dynconfig.h b/source3/include/dynconfig.h
deleted file mode 100644 (file)
index d0e42dc..0000000
+++ /dev/null
@@ -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);
index 8f220dfaec5fbbad14b435c191825868a863432b..014d1d44bd2eb562ad600e2f0138bf808e70e828 100644 (file)
@@ -532,7 +532,7 @@ typedef char fstring[FSTRING_LEN];
 #include "libads/ads_status.h"
 #include "../libcli/util/error.h"
 #include "../lib/util/charset/charset.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 #include "locking.h"
 #include "smb_perfcount.h"
 #include "smb.h"
index ddb3f6527a9d34ad19eb8692bf6479eb28933513..2d7063a79e6a18e6bff525b54b2bded339d11817 100644 (file)
@@ -21,7 +21,7 @@ BEGIN {
        print "";
        print "#include \"includes.h\"";
        print "#include \"build_env.h\"";
-       print "#include \"dynconfig.h\"";
+       print "#include \"dynconfig/dynconfig.h\"";
        print "";
        print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);";
        print "void build_options(bool screen);";
index 1955a80b46cc377df3ed9da13a4b0863eb1c8f33..3cd0dace213d02553b42d7e4de3e263b0f9784e5 100644 (file)
@@ -21,7 +21,7 @@ BEGIN {
        print "";
        print "#include \"includes.h\"";
        print "#include \"build_env.h\"";
-       print "#include \"dynconfig.h\"";
+       print "#include \"dynconfig/dynconfig.h\"";
        print "";
        print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);";
        print "void build_options(bool screen);";
index 81350e62f5ca9bcd4bd33aa1e15149bce57a8c38..e23acf8931376fc9d54c2d5c8d07f9667158df2f 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "web/swat_proto.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 
 
 /** Startup smbd from web interface. */
index f815e81a2d325c86db08b89a8bf24794ccb56809..cc3ff45d35b3622c334f2ea81c80d341ac6fc108 100755 (executable)
@@ -146,7 +146,7 @@ Build.BuildContext.dynconfig_cflags = dynconfig_cflags
 def build(bld):
     cflags = bld.dynconfig_cflags()
     bld.SAMBA_SUBSYSTEM('DYNCONFIG',
-                        'dynconfig.c',
+                        '../../dynconfig/dynconfig.c',
                         deps='replace talloc',
                         public_headers=os_path_relpath(os.path.join(Options.launch_dir, 'version.h'), bld.curdir),
                         header_path='samba',