[Gnucash-changes] r13525 - gnucash/trunk - Make seed collection parts that depend on particular functions

Christian Stimming cstim at cvs.gnucash.org
Tue Mar 7 17:01:36 EST 2006


Author: cstim
Date: 2006-03-07 17:01:35 -0500 (Tue, 07 Mar 2006)
New Revision: 13525
Trac: http://svn.gnucash.org/trac/changeset/13525

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/configure.in
   gnucash/trunk/lib/libqof/qof/guid.c
Log:
Make seed collection parts that depend on particular functions
#ifdef'd on that to enable easier windows/mingw32 porting.




Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-07 22:00:44 UTC (rev 13524)
+++ gnucash/trunk/ChangeLog	2006-03-07 22:01:35 UTC (rev 13525)
@@ -1,5 +1,12 @@
 2006-03-07  Christian Stimming  <stimming at tuhh.de>
 
+	* lib/libqof/qof/guid.c: Make seed collection parts that depend on
+	particular functions #ifdef'd on that to enable easier
+	windows/mingw32 porting.
+
+	* lib/libc/setenv.h: Fix old libc substitution files, now needed
+	for windows/mingw32 porting.
+
 	* Makefile.am: Add po/gnucash.pot to EXTRA_DIST because the
 	translation template is needed in the tarball for translators.
 

Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2006-03-07 22:00:44 UTC (rev 13524)
+++ gnucash/trunk/configure.in	2006-03-07 22:01:35 UTC (rev 13525)
@@ -114,6 +114,9 @@
   AC_MSG_ERROR([Cannot find ltdl.h -- libtool-devel (or libtool-ltdl-devel) not installed?])
 fi
 
+# These are unavailable on windows/mingw32
+AC_CHECK_FUNCS(getppid getuid gethostname gmtime_r)
+
 ### --------------------------------------------------------------------------
 ### See if we have pkg-config
 

Modified: gnucash/trunk/lib/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/guid.c	2006-03-07 22:00:44 UTC (rev 13524)
+++ gnucash/trunk/lib/libqof/qof/guid.c	2006-03-07 22:01:35 UTC (rev 13525)
@@ -27,7 +27,9 @@
 # include <config.h>
 #endif
 
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <ctype.h>
 #include <dirent.h>
 #include <glib.h>
@@ -35,7 +37,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/times.h>
+#ifdef HAVE_TIMES
+# include <sys/times.h>
+#endif
 #include <time.h>
 #include <unistd.h>
 #include "qof.h"
@@ -285,7 +289,9 @@
   size_t total;
   time_t t_time;
   clock_t clocks;
+#ifdef HAVE_TIMES
   struct tms tms_buf;
+#endif
 
   total = 0;
 
@@ -293,10 +299,12 @@
   md5_process_bytes(&t_time, sizeof(t_time), &guid_context);
   total += sizeof(t_time);
 
+#ifdef HAVE_TIMES
   clocks = times(&tms_buf);
   md5_process_bytes(&clocks, sizeof(clocks), &guid_context);
   md5_process_bytes(&tms_buf, sizeof(tms_buf), &guid_context);
   total += sizeof(clocks) + sizeof(tms_buf);
+#endif
 
   return total;
 }
@@ -380,13 +388,16 @@
     md5_process_bytes(&pid, sizeof(pid), &guid_context);
     bytes += sizeof(pid);
 
+#ifdef HAVE_GETPPID
     pid = getppid();
     md5_process_bytes(&pid, sizeof(pid), &guid_context);
     bytes += sizeof(pid);
+#endif
   }
 
   /* user info */
   {
+#ifdef HAVE_GETUID
     uid_t uid;
     gid_t gid;
     char *s;
@@ -405,16 +416,19 @@
     gid = getgid();
     md5_process_bytes(&gid, sizeof(gid), &guid_context);
     bytes += sizeof(gid);
+#endif
   }
 
   /* host info */
   {
+#ifdef HAVE_GETHOSTNAME
     char string[1024];
 
     memset(string, 0, sizeof(string));
     gethostname(string, sizeof(string));
     md5_process_bytes(string, sizeof(string), &guid_context);
     bytes += sizeof(string);
+#endif
   }
 
   /* plain old random */



More information about the gnucash-changes mailing list