1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

Add the ability to display Samba's build options with smbd -b and as a level 4

DEBUG().  Also included are details like build date/time, location and
compiler.

This should get most of the options we set, except those that don't affect
smbd, like WITH_PAM_SMBPASSWD or WITH_WINBINDD.

This work due to Vance Lankhaar <vlankhaar@hotmail.com>

Some work needs to be done to make it only rebuild when needed (ie smbd being
rebuilt) but its in pretty good shape already.

Also fix up some printf() -> d_printf().

Andrew Bartlett
(This used to be commit beff1d2bea)
This commit is contained in:
Andrew Bartlett 2001-09-19 09:44:12 +00:00
parent ebe02a7e87
commit 6794b58a8c
5 changed files with 54 additions and 24 deletions

View File

@ -63,8 +63,8 @@ BLDSHARED = @BLDSHARED@
PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\"
FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper $(CPPFLAGS) -DLOGFILEBASE=\"$(LOGFILEBASE)\"
FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\"
FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H
FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS)
@ -193,7 +193,8 @@ SMBD_OBJ1 = smbd/server.o smbd/files.o smbd/chgpasswd.o smbd/connection.o \
smbd/vfs.o smbd/vfs-wrap.o smbd/statcache.o \
smbd/posix_acls.o \
smbd/process.o smbd/service.o smbd/error.o \
printing/printfsp.o lib/util_seaccess.o smbd/srvstr.o
printing/printfsp.o lib/util_seaccess.o smbd/srvstr.o \
smbd/build_options.o
PRINTING_OBJ = printing/pcap.o printing/print_svid.o \
printing/print_cups.o printing/print_generic.o \
@ -209,7 +210,6 @@ SMBD_OBJ = $(SMBD_OBJ1) $(MSDFS_OBJ) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \
$(LIB_OBJ) $(PRINTBACKEND_OBJ) $(QUOTAOBJS) $(OPLOCK_OBJ) \
$(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ)
NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \
nmbd/nmbd_browsesync.o nmbd/nmbd_elections.o \
@ -484,7 +484,7 @@ bin/.dummy:
dir=bin $(MAKEDIR); fi
@: >> $@ || : > $@ # what a fancy emoticon!
bin/smbd: $(SMBD_OBJ) bin/.dummy
bin/smbd: build_env $(SMBD_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LIBS)
@ -695,7 +695,7 @@ uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
clean:
-rm -f core */*~ *~ */*.o */*.po */*.po32 */*.@SHLIBEXT@ $(PROGS) $(SPROGS)
-rm -f core */*~ *~ */*.o */*.po */*.po32 */*.@SHLIBEXT@ $(PROGS) $(SPROGS) include/build_env.h
winbindd_proto:
@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
@ -717,6 +717,15 @@ include/proto.h:
proto: delproto include/proto.h
delbuild_env:
@/bin/rm -f include/build_env.h
include/build_env.h:
@echo rebuilding include/build_env.h
@cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > include/build_env.h
build_env: delbuild_env include/build_env.h
@rm -f smbd/build_options.o
etags:
etags `find $(srcdir) -name "*.[ch]" | grep -v /CVS/`

View File

@ -59,6 +59,7 @@
#undef WITH_SYSLOG
#undef WITH_PROFILE
#undef WITH_SSL
#undef SSL_DIR
#undef WITH_LDAP
#undef WITH_NISPLUS
#undef WITH_TDBPWD
@ -66,6 +67,8 @@
#undef WITH_NISPLUS_HOME
#undef WITH_AUTOMOUNT
#undef WITH_SMBMOUNT
#undef WITH_QUOTAS
#undef WITH_WINBIND
#undef HAVE_BROKEN_GETGROUPS
#undef REPLACE_GETPASS
#undef REPLACE_INET_NTOA
@ -76,6 +79,7 @@
#undef WITH_NETATALK
#undef WITH_UTMP
#undef WITH_MSDFS
#undef WITH_LIBICONV
#undef HAVE_INO64_T
#undef HAVE_STRUCT_FLOCK64
#undef SIZEOF_INO_T
@ -93,6 +97,8 @@
#undef HAVE_UINT32_FROM_RPC_RPC_H
#undef KRB4_AUTH
#undef KRB5_AUTH
#undef KRB4_DIR
#undef KRB5_DIR
#undef SEEKDIR_RETURNS_VOID
#undef HAVE_DIRENT_D_OFF
#undef HAVE_GETSPNAM
@ -104,6 +110,7 @@
#undef HAVE_SETRESGID
#undef HAVE_SETRESGID_DECL
#undef HAVE_SHADOW_H
#undef HAVE_CUPS
#undef HAVE_MEMSET
#undef HAVE_STRCASECMP
#undef HAVE_STRUCT_DIRENT64

View File

@ -1046,6 +1046,7 @@ AC_ARG_WITH(libiconv,
CFLAGS="$CFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
AC_CHECK_LIB(iconv, iconv_open)
AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
;;
esac ],
AC_MSG_RESULT(no)
@ -1582,6 +1583,7 @@ AC_ARG_WITH(krb4,
LIBS="$LIBS -lkrb -ldes"
CFLAGS="$CFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
AC_DEFINE_UNQUOTED(KRB4_DIR, ${withval})
;;
*)
AC_MSG_RESULT(no)
@ -1602,6 +1604,7 @@ AC_ARG_WITH(krb5,
LIBS="$LIBS -ldes425 -lkrb5 -lcrypto -lcom_err"
CFLAGS="$CFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
AC_DEFINE_UNQUOTED(KRB5_DIR,${withval})
;;
*)
AC_MSG_RESULT(no)
@ -1818,11 +1821,13 @@ AC_ARG_WITH(ssl,
CFLAGS="-I/usr/local/ssl/include $CFLAGS"
LIBS="-lssl -lcrypto $LIBS"
LDFLAGS="=L/usr/local/ssl/lib $LDFLAGS"
AC_DEFINE(SSL_DIR, "/usr/local/ssl")
;;
* )
CFLAGS="-I${withval} $CFLAGS"
LIBS="-lssl -lcrypto $LIBS"
LDFLAGS="-L${withval}/lib $LDFLAGS"
AC_DEFINE_UNQUOTED(SSL_DIR, "${withval}", Used for determining the compile time options)
;;
esac
@ -1831,9 +1836,10 @@ AC_ARG_WITH(ssl,
CFLAGS="-I/usr/local/ssl/include $CFLAGS"
LIBS="-lssl -lcrypto $LIBS"
LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
AC_DEFINE(SSL_DIR, "/usr/local/ssl")
fi
if test ! -d ${withval}; then
echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
exit 1
@ -1895,6 +1901,7 @@ AC_ARG_WITH(quotas,
yes)
AC_MSG_RESULT(yes)
QUOTAOBJS=smbd/quotas.o
AC_DEFINE(WITH_QUOTAS)
;;
*)
AC_MSG_RESULT(no)
@ -2331,7 +2338,6 @@ if test x"$HAVE_WINBIND" = x"yes"; then
WINBIND_TARGETS="\$(WINBIND_PROGS)"
WINBIND_STARGETS="\$(WINBIND_SPROGS)"
WINBIND_LTARGETS="\$(WINBIND_LPROGS)"
case "$with_pam" in
yes)
WINBIND_PAM_PROGS="\$(WINBIND_PAM_PROGS)"

View File

@ -1,3 +1,4 @@
build_env.h
config.h
stamp-h
proto.h

View File

@ -560,23 +560,23 @@ usage on the program
static void usage(char *pname)
{
printf("Usage: %s [-DaoPh?V] [-d debuglevel] [-l log basename] [-p port]\n", pname);
printf(" [-O socket options] [-s services file]\n");
printf("\t-D Become a daemon\n");
printf("\t-a Append to log file (default)\n");
printf("\t-o Overwrite log file, don't append\n");
printf("\t-h Print usage\n");
printf("\t-? Print usage\n");
printf("\t-V Print version\n");
printf("\t-d debuglevel Set the debuglevel\n");
printf("\t-l log basename. Basename for log/debug files\n");
printf("\t-p port Listen on the specified port\n");
printf("\t-O socket options Socket options\n");
printf("\t-s services file. Filename of services file\n");
printf("\n");
d_printf("Usage: %s [-DaoPh?Vb] [-d debuglevel] [-l log basename] [-p port]\n", pname);
d_printf(" [-O socket options] [-s services file]\n");
d_printf("\t-D Become a daemon\n");
d_printf("\t-a Append to log file (default)\n");
d_printf("\t-o Overwrite log file, don't append\n");
d_printf("\t-h Print usage\n");
d_printf("\t-? Print usage\n");
d_printf("\t-V Print version\n");
d_printf("\t-b Print build options\n");
d_printf("\t-d debuglevel Set the debuglevel\n");
d_printf("\t-l log basename. Basename for log/debug files\n");
d_printf("\t-p port Listen on the specified port\n");
d_printf("\t-O socket options Socket options\n");
d_printf("\t-s services file. Filename of services file\n");
d_printf("\n");
}
/****************************************************************************
main program
****************************************************************************/
@ -600,7 +600,7 @@ static void usage(char *pname)
argc--;
}
while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?Vaof:")) )
while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?bVaof:")) )
switch (opt) {
case 'O':
pstrcpy(user_socket_options,optarg);
@ -648,6 +648,10 @@ static void usage(char *pname)
d_printf("Version %s\n",VERSION);
exit(0);
break;
case 'b':
build_options(True); /* Display output to screen as well as debug */
exit(0);
break;
default:
DEBUG(0,("Incorrect program usage - are you sure the command line is correct?\n"));
usage(argv[0]);
@ -718,6 +722,9 @@ static void usage(char *pname)
DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
(int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
/* Output the build options to the debug log */
build_options(False);
if (sizeof(uint16) < 2 || sizeof(uint32) < 4) {
DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n"));
exit(1);