[libvirt] [PATCH] Fix invocation of rpcgen

Daniel P. Berrange berrange at redhat.com
Mon Jan 12 20:04:15 UTC 2009


On Mon, Jan 12, 2009 at 04:22:51PM +0000, Richard W.M. Jones wrote:
> Currently if rpcgen != glibc's rpcgen, then it gets a bit confused
> with the temporary files.  Also it's best to call the rpcgen that
> configure detected and not some random rpcgen that happens to be in
> the path.
> 
> The attached patch fixes this.


John had a pending patch to change the Makefile.am rule to be a 
standalone one, needing explicit invocation when we make changes
to the protocol definition. Here's an updated version of it which
applies to current CVS & includs your $(RPCGEN) addition. 

I've also fixed the configure.in script so it finds SASL on
OpenSolaris - its named libsasl.so instead of libsasl2.so
for some unknown reason.

Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.197
diff -u -p -r1.197 configure.in
--- configure.in	8 Jan 2009 20:42:01 -0000	1.197
+++ configure.in	12 Jan 2009 16:33:46 -0000
@@ -506,18 +506,26 @@ if test "x$with_sasl" != "xno"; then
         fail=1
     fi])
   if test "x$with_sasl" != "xno" ; then
-    AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
-      if test "x$with_sasl" = "xcheck" ; then
+    AC_CHECK_LIB([sasl2], [sasl_client_init],[
+      SASL_LIBS="$SASL_LIBS -lsasl2"
+      with_sasl=yes
+    ],[
+      AC_CHECK_LIB([sasl], [sasl_client_init],[
+        SASL_LIBS="$SASL_LIBS -lsasl"
+        with_sasl=yes
+      ],[
+        if test "x$with_sasl" = "xcheck" ; then
           with_sasl=no
-      else
+        else
           fail=1
-      fi])
+        fi
+      ])
+    ])
   fi
   test $fail = 1 &&
     AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])
   CFLAGS="$old_cflags"
   LIBS="$old_libs"
-  SASL_LIBS="$SASL_LIBS -lsasl2"
   if test "x$with_sasl" = "xyes" ; then
     AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
       [whether Cyrus SASL is available for authentication])
Index: qemud/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/qemud/Makefile.am,v
retrieving revision 1.70
diff -u -p -r1.70 Makefile.am
--- qemud/Makefile.am	8 Jan 2009 20:42:01 -0000	1.70
+++ qemud/Makefile.am	12 Jan 2009 16:33:46 -0000
@@ -32,27 +32,23 @@ EXTRA_DIST =						\
 	$(DAEMON_SOURCES)
 
 if RPCGEN
-SUFFIXES = .x
-# The subshell ensures that remote_protocol.c ends up
-# including <config.h> before "remote_protocol.h".
-.x.c:
-	rm -f $@ $@-t $@-t1 $@-t2
-	rpcgen -c -o $@-t $<
-	(echo '#include <config.h>'; cat $@-t) > $@-t1
+#
+# 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@/qemud/remote_protocol.x
+	$(RPCGEN) -c -o rp.c-t @top_srcdir@/qemud/remote_protocol.x
 if GLIBC_RPCGEN
-	perl -w rpcgen_fix.pl $@-t1 > $@-t2
-	rm $@-t1
-	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@/qemud/rpcgen_fix.pl rp.h-t > rp.h-t2
+	perl -w @top_srcdir@/qemud/rpcgen_fix.pl rp.c-t > rp.c-t2
+	mv rp.h-t2 @top_srcdir@/qemud/remote_protocol.h
+	mv rp.c-t2 @top_srcdir@/qemud/remote_protocol.c
+	rm -f rp.c-t rp.h-t
+else
+	mv rp.h-t @top_srcdir@/remote_protocol.h
+	mv rp.c-t @top_srcdir@/remote_protocol.c
 endif
 endif
 
Index: qemud/rpcgen_fix.pl
===================================================================
RCS file: /data/cvs/libvirt/qemud/rpcgen_fix.pl,v
retrieving revision 1.4
diff -u -p -r1.4 rpcgen_fix.pl
--- qemud/rpcgen_fix.pl	6 Jan 2009 18:32:03 -0000	1.4
+++ qemud/rpcgen_fix.pl	12 Jan 2009 16:33:46 -0000
@@ -26,6 +26,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;
 


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list