[PATCH] add 'modules path' and handle 'configure
--with-configdir' right
Stefan (metze) Metzmacher
metze at metzemix.de
Tue Nov 26 07:07:01 GMT 2002
Hi Jelmer,
here's the next version of the patch. (it's now attached :-)
I added --with-sambadatadir witch is default ${datadir}/samba (--with-fhs)
or ${datadir}
${datadir} is ${prefix}/share by default, so $(sambadatadir) is
${prefix}/share/samba or ${prefix}/share.
the valid.dat ... files are now installed to sambadatadir
I'm happy with this patch, but NOT with the name 'sambadatadir' DOES
ANYBODY HAVE ABETTER IDEA?
I removed the modules/Makfile.ext_modules.in stuff
I think we should put ALL header files in include/ and then after make
proto we can install all headers to ${prefix}/include/samba
so that the modules only have to include:
#include <samba/includes.h>
metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/Makefile.in HEAD-fix/source/Makefile.in
--- HEAD/source/Makefile.in Tue Nov 26 07:19:11 2002
+++ HEAD-fix/source/Makefile.in Tue Nov 26 07:41:52 2002
@@ -56,8 +56,13 @@ INSTALLPERMS = 0755
# These can be overridden by command line switches (see smbd(8))
# or in smb.conf (see smb.conf(5))
LOGFILEBASE = @logfilebase@
-CONFIGFILE = $(LIBDIR)/smb.conf
-LMHOSTSFILE = $(LIBDIR)/lmhosts
+CONFIGDIR = @configdir@
+CONFIGFILE = $(CONFIGDIR)/smb.conf
+LMHOSTSFILE = $(CONFIGDIR)/lmhosts
+# This is where modules are installed and searched by default
+MODULESDIR = @modulesdir@
+# This is where valid.dat,upcase.dat,lowcase.dat are installed and searched by default
+SAMBADATADIR = @sambadatadir@
# This is where smbpasswd et al go
PRIVATEDIR = @privatedir@
@@ -93,7 +98,8 @@ PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"
PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\"
-PATH_FLAGS = $(PATH_FLAGS5) $(PASSWD_FLAGS)
+PATH_FLAGS6 = $(PATH_FLAGS5) -DMODULESDIR=\"$(MODULESDIR)\" -DSAMBADATADIR=\"$(SAMBADATADIR)\"
+PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
SBIN_PROGS = bin/smbd bin/nmbd bin/swat bin/wrepld @EXTRA_SBIN_PROGS@
@@ -573,7 +579,7 @@ nsswitch : SHOWFLAGS bin/winbindd bin/wb
wins : SHOWFLAGS nsswitch/libnss_wins. at SHLIBEXT@
-modules: SHOWFLAGS $(MODULES)
+modules: SHOWFLAGS proto_exists $(MODULES)
everything: all libsmbclient debug2html smbfilter talloctort
@@ -896,23 +902,23 @@ bin/tdbbackup: $(TDBBACKUP_OBJ) bin/.dum
install: installbin installman installscripts installdat installswat
installdirs:
- @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR)
+ @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(SAMBADATADIR) $(DESTDIR)$(MODULESDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR)
installservers: all installdirs
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(SAMBADATADIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
installbin: all installdirs
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
- @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(SAMBADATADIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SAMBADATADIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
-installmodules: all installdirs
- @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(LIBDIR) $(MODULES)
+installmodules: modules installdirs
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(MODULESDIR) $(MODULES)
installscripts: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
installdat: installdirs
- @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+ @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(SAMBADATADIR) $(srcdir)
installswat: installdirs
@$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
@@ -1001,11 +1007,11 @@ uninstallman:
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(srcdir) $(man_langs)
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)$(SAMBADATADIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
+ @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SAMBADATADIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
uninstallmodules:
- @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(MODULES)
+ @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(MODULESDIR) $(DESTDIR)$(MODULES)
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/configure.in HEAD-fix/source/configure.in
--- HEAD/source/configure.in Fri Nov 22 08:13:31 2002
+++ HEAD-fix/source/configure.in Sun Nov 24 18:00:01 2002
@@ -12,17 +12,21 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
AC_ARG_WITH(fhs,
[ --with-fhs Use FHS-compliant paths (default=no)],
configdir="${sysconfdir}/samba"
+ modulesdir="\${LIBDIR}/samba"
lockdir="\${VARDIR}/cache/samba"
piddir="\$(VARDIR)/run/samba"
logfilebase="\${VARDIR}/log/samba"
privatedir="\${CONFIGDIR}/private"
- swatdir="\${DATADIR}/samba/swat",
+ swatdir="${datadir}/samba/swat"
+ sambadatadir="${datadir}/samba",
configdir="\$(LIBDIR)"
+ modulesdir="\${LIBDIR}"
logfilebase="\$(VARDIR)"
lockdir="\${VARDIR}/locks"
piddir="\$(VARDIR)/locks"
privatedir="\${prefix}/private"
- swatdir="\${prefix}/swat")
+ swatdir="\${prefix}/swat"
+ sambadatadir="${datadir}")
#################################################
# set private directory location
@@ -105,6 +109,38 @@ AC_ARG_WITH(configdir,
esac])
#################################################
+# set modules directory location
+AC_ARG_WITH(modulesdir,
+[ --with-modulesdir=DIR Where to put modules (\$libdir)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody does it
+ #
+ AC_MSG_WARN([--with-modulesdir called without argument - will use default])
+ ;;
+ * )
+ modulesdir="$withval"
+ ;;
+ esac])
+
+#################################################
+# set samba data directory location
+AC_ARG_WITH(modulesdir,
+[ --with-sambadatadir=DIR Where to put shared data (\$datadir)],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody does it
+ #
+ AC_MSG_WARN([--with-sambadatadir called without argument - will use default])
+ ;;
+ * )
+ sambadatadir="$withval"
+ ;;
+ esac])
+
+#################################################
# set log directory location
AC_ARG_WITH(logfilebase,
[ --with-logfilebase=DIR Where to put log files (\$(VARDIR))],
@@ -121,6 +157,8 @@ AC_ARG_WITH(logfilebase,
esac])
AC_SUBST(configdir)
+AC_SUBST(modulesdir)
+AC_SUBST(sambadatadir)
AC_SUBST(lockdir)
AC_SUBST(piddir)
AC_SUBST(logfilebase)
@@ -625,7 +663,7 @@ test "${with_readline+set}" != "set" &&
# test for where we get readline() from
AC_MSG_CHECKING(whether to use readline)
AC_ARG_WITH(readline,
-[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
+[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ],
[ case "$with_readline" in
yes)
AC_MSG_RESULT(yes)
@@ -1954,7 +1992,7 @@ with_ads_support=yes
AC_MSG_CHECKING([whether to use Active Directory])
AC_ARG_WITH(ads,
-[ --with-ads Active Directory support (default yes)],
+[ --with-ads Active Directory support (default yes)],
[ case "$withval" in
no)
with_ads_support=no
@@ -2054,7 +2092,7 @@ with_ldap_support=yes
AC_MSG_CHECKING([whether to use LDAP])
AC_ARG_WITH(ldap,
-[ --with-ldap LDAP support (default yes)],
+[ --with-ldap LDAP support (default yes)],
[ case "$withval" in
no)
with_ldap_support=no
@@ -2250,7 +2288,7 @@ AC_ARG_WITH(sam,
# check for a LDAP password database configuration backwards compatibility
AC_MSG_CHECKING(whether to use LDAP SAM 2.2 compatible configuration)
AC_ARG_WITH(ldapsam,
-[ --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no)],
+[ --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no)],
[ case "$withval" in
yes)
AC_MSG_RESULT(yes)
@@ -2767,7 +2805,7 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
with_sendfile_support=yes
AC_MSG_CHECKING(whether to check to support sendfile)
AC_ARG_WITH(sendfile-support,
-[ --with-sendfile-support Check for sendfile support (default=yes)],
+[ --with-sendfile-support Check for sendfile support (default=yes)],
[ case "$withval" in
yes)
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/dynconfig.c HEAD-fix/source/dynconfig.c
--- HEAD/source/dynconfig.c Tue Nov 5 16:25:26 2002
+++ HEAD-fix/source/dynconfig.c Sun Nov 24 17:26:50 2002
@@ -54,9 +54,9 @@ pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
/**
* @brief Samba library directory.
*
- * @sa lib_path() to get the path to a file inside the LIBDIR.
+ * @sa sambadata_path() to get the path to a file inside the SAMBADATADIR.
**/
-pstring dyn_LIBDIR = LIBDIR;
+pstring dyn_SAMBADATADIR = SAMBADATADIR;
/**
* @brief Directory holding lock files.
@@ -68,3 +68,6 @@ const pstring dyn_PIDDIR = PIDDIR;
const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
+
+/** default for lp_modules_path() **/
+const pstring dyn_MODULESDIR = MODULESDIR;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/dynconfig.h HEAD-fix/source/include/dynconfig.h
--- HEAD/source/include/dynconfig.h Tue Nov 5 16:25:26 2002
+++ HEAD-fix/source/include/dynconfig.h Sun Nov 24 17:27:38 2002
@@ -29,8 +29,9 @@ extern char const *dyn_SBINDIR,
extern pstring dyn_CONFIGFILE;
extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
-extern pstring dyn_LIBDIR;
+extern pstring dyn_SAMBADATADIR;
extern const pstring dyn_LOCKDIR;
extern const pstring dyn_PIDDIR;
extern const pstring dyn_SMB_PASSWD_FILE;
extern const pstring dyn_PRIVATE_DIR;
+extern const pstring dyn_MODULESDIR;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/intl/lang_tdb.c HEAD-fix/source/intl/lang_tdb.c
--- HEAD/source/intl/lang_tdb.c Sat Nov 23 17:52:43 2002
+++ HEAD-fix/source/intl/lang_tdb.c Sun Nov 24 17:35:40 2002
@@ -123,7 +123,7 @@ BOOL lang_tdb_init(const char *lang)
/* if no lang then we don't translate */
if (!lang) return True;
- asprintf(&msg_path, "%s.msg", lib_path((char *)lang));
+ asprintf(&msg_path, "%s.msg", sambadata_path((char *)lang));
if (stat(msg_path, &st) != 0) {
/* the msg file isn't available */
free(msg_path);
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/module.c HEAD-fix/source/lib/module.c
--- HEAD/source/lib/module.c Wed Nov 13 19:52:32 2002
+++ HEAD-fix/source/lib/module.c Fri Nov 22 10:00:56 2002
@@ -27,28 +27,37 @@ NTSTATUS smb_load_module(const char *mod
void *handle;
init_module_function *init;
NTSTATUS nt_status;
+ pstring full_module_name;
+
+ if (module_name[0]=='/') {
+ pstrcpy(full_module_name,module_name);
+ } else {
+ pstrcpy(full_module_name,lp_modules_path());
+ pstrcat(full_module_name,"/");
+ pstrcat(full_module_name,module_name);
+ }
/* Always try to use LAZY symbol resolving; if the plugin has
* backwards compatibility, there might be symbols in the
* plugin referencing to old (removed) functions
*/
- handle = sys_dlopen(module_name, RTLD_LAZY);
+ handle = sys_dlopen(full_module_name, RTLD_LAZY);
if(!handle) {
- DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror()));
+ DEBUG(0, ("Error loading module '%s': %s\n", full_module_name, sys_dlerror()));
return NT_STATUS_UNSUCCESSFUL;
}
init = sys_dlsym(handle, "init_module");
if(!init) {
- DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, sys_dlerror()));
+ DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", full_module_name, sys_dlerror()));
return NT_STATUS_UNSUCCESSFUL;
}
nt_status = init();
- DEBUG(2, ("Module '%s' loaded\n", module_name));
+ DEBUG(2, ("Module '%s' loaded\n", full_module_name));
return nt_status;
}
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/lib/util_unistr.c HEAD-fix/source/lib/util_unistr.c
--- HEAD/source/lib/util_unistr.c Sun Nov 10 00:34:38 2002
+++ HEAD-fix/source/lib/util_unistr.c Sun Nov 24 17:31:13 2002
@@ -43,8 +43,8 @@ void load_case_tables(void)
if (initialised) return;
initialised = 1;
- upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
- lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
+ upcase_table = map_file(sambadata_path("upcase.dat"), 0x20000);
+ lowcase_table = map_file(sambadata_path("lowcase.dat"), 0x20000);
/* we would like Samba to limp along even if these tables are
not available */
@@ -108,7 +108,7 @@ void init_valid_table(void)
if (initialised && mapped_file) return;
initialised = 1;
- valid_table = map_file(lib_path("valid.dat"), 0x10000);
+ valid_table = map_file(sambadata_path("valid.dat"), 0x10000);
if (valid_table) {
mapped_file = 1;
return;
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/param/loadparm.c HEAD-fix/source/param/loadparm.c
--- HEAD/source/param/loadparm.c Mon Nov 25 06:45:26 2002
+++ HEAD-fix/source/param/loadparm.c Mon Nov 25 06:46:44 2002
@@ -111,6 +111,7 @@ typedef struct
char *szPrivateDir;
char **szPassdbBackend;
char **szSamBackend;
+ char *szModulesPath;
char **szModules;
char *szPasswordServer;
char *szSocketOptions;
@@ -796,6 +797,7 @@ static struct parm_struct parm_table[] =
{"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
{"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
+ {"modules path", P_STRING, P_GLOBAL, &Globals.szModulesPath, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL},
{"modules", P_LIST, P_GLOBAL, &Globals.szModules, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL},
{"Logging Options", P_SEP, P_SEPARATOR},
@@ -1382,6 +1384,8 @@ static void init_globals(void)
Globals.ldap_ssl = LDAP_SSL_ON;
Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
+ string_set(&Globals.szModulesPath, dyn_MODULESDIR);
+
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
@@ -1566,6 +1570,7 @@ static FN_GLOBAL_STRING(lp_announce_vers
FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend)
FN_GLOBAL_LIST(lp_sam_backend, &Globals.szSamBackend)
+FN_GLOBAL_STRING(lp_modules_path, &Globals.szModulesPath)
FN_GLOBAL_LIST(lp_modules, &Globals.szModules)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
More information about the samba-technical
mailing list