From 1f84a14b0bae513fc2fdad4fe6fca32e05af67bc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 23 May 2003 01:59:43 +0000 Subject: [PATCH] Bug 83: fixes for building when $srcdir != $builddir from David Lee (This used to be commit e48a8b5e9c1a75c6e4bffe022d0e25edae89bc58) --- source3/Makefile.in | 43 ++++++++++++-------- source3/configure.in | 2 +- source3/nsswitch/winbindd.h | 2 +- source3/script/{mkproto.sh => mkproto.sh.in} | 8 +++- 4 files changed, 33 insertions(+), 22 deletions(-) rename source3/script/{mkproto.sh => mkproto.sh.in} (73%) diff --git a/source3/Makefile.in b/source3/Makefile.in index b957d7594b0..28b99c6f62b 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -318,6 +318,8 @@ MANGLE_OBJ = smbd/mangle.o smbd/mangle_hash.o smbd/mangle_map.o smbd/mangle_hash SMBD_OBJ_MAIN = smbd/server.o +BUILDOPT_OBJ = smbd/build_options.o + SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \ smbd/utmp.o smbd/session.o \ smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o smbd/fileio.o \ @@ -330,19 +332,19 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \ smbd/posix_acls.o lib/sysacls.o lib/server_mutex.o \ smbd/process.o smbd/service.o smbd/error.o \ printing/printfsp.o lib/util_seaccess.o \ - smbd/build_options.o lib/sysquotas.o \ - smbd/change_trust_pw.o smbd/fake_file.o \ + lib/sysquotas.o smbd/change_trust_pw.o smbd/fake_file.o \ smbd/quotas.o smbd/ntquotas.o \ $(MANGLE_OBJ) @VFS_STATIC@ SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) \ - $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) $(UBIQX_OBJ) \ + $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) \ $(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \ $(LIB_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) \ $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_SERVER_OBJ) \ $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \ - $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) $(IDMAP_OBJ) + $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) $(IDMAP_OBJ) \ + $(UBIQX_OBJ) $(BUILDOPT_OBJ) PRINTING_OBJ = printing/pcap.o printing/print_svid.o \ printing/print_cups.o printing/print_generic.o \ @@ -701,7 +703,7 @@ smbd/build_options.o: smbd/build_options.c Makefile include/config.h include/bui smbd/build_options.c: include/config.h.in script/mkbuildoptions.awk @echo Generating $@ - @$(AWK) -f $(srcdir)/script/mkbuildoptions.awk > $(builddir)/smbd/build_options.c < $(srcdir)/include/config.h.in + @dir=smbd $(MAKEDIR) && $(AWK) -f $(srcdir)/script/mkbuildoptions.awk > $(builddir)/smbd/build_options.c < $(srcdir)/include/config.h.in .c.po: @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ @@ -1246,42 +1248,47 @@ delheaders: @/bin/rm -f include/proto.h include/build_env.h include/wrepld_proto.h \ nsswitch/winbindd_proto.h web/swat_proto.h \ client/client_proto.h utils/net_proto.h smbd/build_options.c +# Location of mkproto.sh + +MKPROTO_SH = $(builddir)/script/mkproto.sh include/proto.h: smbd/build_options.c @echo Building include/proto.h - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _PROTO_H_ $(builddir)/include/proto.h \ - $(PROTO_OBJ) + $(builddir)/smbd/build_options.o \ + `echo $(PROTO_OBJ) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` include/build_env.h: script/build_env.sh @echo Building include/build_env.h - @cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h + @$(SHELL) $(srcdir)/script/build_env.sh $(srcdir) $(builddir) $(CC) \ + > $(builddir)/include/build_env.h include/wrepld_proto.h: @echo Building include/wrepld_proto.h - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _WREPLD_PROTO_H_ $(builddir)/include/wrepld_proto.h \ - $(WREPL_OBJ1) + `echo $(WREPL_OBJ1) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` nsswitch/winbindd_proto.h: - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _WINBINDD_PROTO_H_ nsswitch/winbindd_proto.h \ - $(WINBINDD_OBJ1) + `echo $(WINBINDD_OBJ1) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` web/swat_proto.h: - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _SWAT_PROTO_H_ web/swat_proto.h \ - $(SWAT_OBJ1) + `echo $(SWAT_OBJ1) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` client/client_proto.h: - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _CLIENT_PROTO_H_ client/client_proto.h \ - $(CLIENT_OBJ1) + `echo $(CLIENT_OBJ1) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` utils/net_proto.h: - @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \ + @$(SHELL) $(MKPROTO_SH) $(AWK) \ -h _CLIENT_PROTO_H_ utils/net_proto.h \ - $(NET_OBJ1) + `echo $(NET_OBJ1) | sed -e 's%\([^ \t]*\)%$(srcdir)/\1%g'` # "make headers" or "make proto" calls a subshell because we need to # make sure these commands are executed in sequence even for a diff --git a/source3/configure.in b/source3/configure.in index ebe0d44192b..ccc7148c6ee 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3797,7 +3797,7 @@ dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS CFLAGS_REMOVE_USR_INCLUDE(CFLAGS) CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS) -AC_OUTPUT(include/stamp-h Makefile script/findsmb) +AC_OUTPUT(include/stamp-h Makefile script/findsmb script/mkproto.sh) ################################################# # Print very concise instructions on building/use diff --git a/source3/nsswitch/winbindd.h b/source3/nsswitch/winbindd.h index 2d9a0b59499..987a58e502f 100644 --- a/source3/nsswitch/winbindd.h +++ b/source3/nsswitch/winbindd.h @@ -219,7 +219,7 @@ struct winbindd_idmap_methods { void (*status)(void); }; -#include "winbindd_proto.h" +#include "../nsswitch/winbindd_proto.h" #include "rpc_parse.h" #include "rpc_client.h" diff --git a/source3/script/mkproto.sh b/source3/script/mkproto.sh.in similarity index 73% rename from source3/script/mkproto.sh rename to source3/script/mkproto.sh.in index 2bf96c9b41d..8d7d300ff5d 100755 --- a/source3/script/mkproto.sh +++ b/source3/script/mkproto.sh.in @@ -1,9 +1,13 @@ -#! /bin/sh +#! /bin/sh -x LANG=C; export LANG LC_ALL=C; export LC_ALL LC_COLLATE=C; export LC_COLLATE +# Need reference point for "mkproto.awk", including when "srcdir != builddir". +# Use of "abs_..." is unpleasant. Is there another way? +abs_srcdir=@abs_srcdir@ + if [ $# -lt 3 ] then echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj" @@ -32,7 +36,7 @@ echo creating $header mkdir -p `dirname $header` ${awk} $headeropt \ - -f script/mkproto.awk $proto_src > $headertmp + -f $abs_srcdir/mkproto.awk $proto_src > $headertmp if cmp -s $header $headertmp 2>/dev/null then -- 2.34.1