[Gpm] Re: gpm 1.19.3 doesn't build?

Alessandro Rubini rubini@gnu.org
Fri, 15 Dec 2000 14:29:55 +0100


> Somebody (not me) could write an autoconf macro to check that this
> struct is defined, and if not, define it by hand (maybe in gpmInt.h).

Ok. Here it is. 

It at least compiles. Didn't test it, yet.

--- gpm-1.19.3/configure.in	Tue Jul 18 15:17:32 2000
+++ gpm-1.19.3-ps2gunze/configure.in	Fri Dec 15 14:21:25 2000
@@ -51,6 +51,19 @@
 
 AC_CHECK_HEADERS(syslog.h linux/joystick.h ncurses.h ncurses/curses.h curses.h)
 
+# Check for ucred
+AC_MSG_CHECKING(for struct ucred)
+AC_TRY_LINK([
+	#include <sys/types.h>
+	#include <sys/socket.h>
+],[
+	struct ucred sucred; sucred.pid=0;
+],[has_ucred=yes],[has_ucred=no])
+AC_MSG_RESULT($has_ucred)
+if test ${has_ucred} = no ; then CFLAGS="$CFLAGS -DNEED_UCRED"; fi
+
+
+
 AC_ARG_WITH(curses,
 [  --without-curses        disable curses support even if curses found])
 
--- gpm-1.19.3/gpm.c	Tue Jul 18 14:06:06 2000
+++ gpm-1.19.3-ps2gunze/gpm.c	Fri Dec 15 14:23:16 2000
@@ -827,6 +827,14 @@
   uid = statbuf.st_uid;		/* owner of socket */
 #else
   {
+  #ifdef NEED_UCRED /* from autoconf */
+    struct ucred
+    {
+      pid_t pid;                    /* PID of sending process.  */
+      uid_t uid;                    /* UID of sending process.  */
+      gid_t gid;                    /* GID of sending process.  */
+    };
+  #endif /* NEED_UCRED */
     struct ucred sucred;
     socklen_t credlen = sizeof(struct ucred);