# HG changeset patch
# User john.levon(a)sun.com
# Date 1229399266 28800
# Node ID 12c9b283b11f5e20b9dcc91e3d10a862da5d6e81
# Parent 1ba824db09286ebc758e035211da2c533bbd1e0f
rpcgen fixes
quad_t is not a portable type, but rather than force rpcgen
every build, we just patch in the fixes needed.
Also, since we ship the rpcgen-derived files in CVS, don't leave
Makefile rules that could trigger during a normal build: make a special
maintainer target for refreshing the derived sources.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/qemud/Makefile.am b/qemud/Makefile.am
--- a/qemud/Makefile.am
+++ b/qemud/Makefile.am
@@ -32,23 +32,23 @@ EXTRA_DIST = \
$(DAEMON_SOURCES)
if RPCGEN
-SUFFIXES = .x
-.x.c:
- rm -f $@ $@-t $@-t2
- rpcgen -c -o $@-t $<
+#
+# Maintainer-only target for re-generating the derived .c/.h source
+# files, which are actually derived from the .x file.
+#
+rpcgen:
+ rm -f rp.c-t rp.h-t
+ rpcgen -h -o rp.h-t @top_srcdir(a)/qemud/remote_protocol.x
+ rpcgen -c -o rp.c-t @top_srcdir(a)/qemud/remote_protocol.x
if GLIBC_RPCGEN
- perl -w rpcgen_fix.pl $@-t > $@-t2
- chmod 444 $@-t2
- mv $@-t2 $@
-endif
-
-.x.h:
- rm -f $@ $@-t
- rpcgen -h -o $@-t $<
-if GLIBC_RPCGEN
- perl -pi -e 's/\t/ /g' $@-t
- chmod 444 $@-t
- mv $@-t $@
+ perl -w @top_srcdir(a)/qemud/rpcgen_fix.pl rp.h-t \
+ >@top_srcdir(a)/qemud/remote_protocol.h
+ perl -w @top_srcdir(a)/qemud/rpcgen_fix.pl rp.c-t \
+ >@top_srcdir(a)/qemud/remote_protocol.c
+ rm -f rp.c-t rp.h-t
+else
+ mv rp.h-t @top_srcdir(a)/remote_protocol.h
+ mv rp.c-t @top_srcdir(a)/remote_protocol.c
endif
endif
diff --git a/qemud/rpcgen_fix.pl b/qemud/rpcgen_fix.pl
--- a/qemud/rpcgen_fix.pl
+++ b/qemud/rpcgen_fix.pl
@@ -25,6 +25,15 @@ while (<>) {
}
s/\t/ /g;
+
+ # Portability for Solaris RPC
+ s/u_quad_t/uint64_t/g;
+ s/quad_t/int64_t/g;
+ s/xdr_u_quad_t/xdr_uint64_t/g;
+ s/xdr_quad_t/xdr_int64_t/g;
+ s/IXDR_GET_LONG/IXDR_GET_INT32/g;
+ s/XDR_INLINE/(int32_t *)XDR_INLINE/g;
+ s/#include <rpc\/rpc.h>/#include <config.h>\n#include
<rpc\/rpc.h>/g;
if (m/^}/) {
$in_function = 0;