r18715 - gnucash/trunk - Make more header inclusions conditional on whether they exist.
Christian Stimming
cstim at code.gnucash.org
Wed Feb 24 12:38:15 EST 2010
Author: cstim
Date: 2010-02-24 12:38:14 -0500 (Wed, 24 Feb 2010)
New Revision: 18715
Trac: http://svn.gnucash.org/trac/changeset/18715
Modified:
gnucash/trunk/configure.in
gnucash/trunk/src/libqof/qof/guid.c
gnucash/trunk/src/libqof/qof/qoflog.c
gnucash/trunk/src/libqof/qof/qofsession.c
Log:
Make more header inclusions conditional on whether they exist.
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2010-02-24 17:37:53 UTC (rev 18714)
+++ gnucash/trunk/configure.in 2010-02-24 17:38:14 UTC (rev 18715)
@@ -105,7 +105,7 @@
AC_PROG_LN_S
AC_HEADER_STDC
-AC_CHECK_HEADERS(limits.h sys/times.h sys/wait.h)
+AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h sys/wait.h)
AC_CHECK_FUNCS(stpcpy memcpy timegm towupper)
AC_CHECK_FUNCS(setenv,,[
AC_CHECK_FUNCS(putenv,,[
@@ -248,7 +248,7 @@
AC_MSG_RESULT(no)
fi
-AC_CHECK_HEADERS(dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
+AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
# Gnucash replaced dlopen/dlsym by the g_module functions; dlsym
# is needed optionally in one place for BSD linkers, though.
Modified: gnucash/trunk/src/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/src/libqof/qof/guid.c 2010-02-24 17:37:53 UTC (rev 18714)
+++ gnucash/trunk/src/libqof/qof/guid.c 2010-02-24 17:38:14 UTC (rev 18715)
@@ -29,7 +29,9 @@
# include <sys/types.h>
#endif
#include <ctype.h>
-#include <dirent.h>
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#endif
#include <glib.h>
#include <glib/gstdio.h>
#include <stdlib.h>
@@ -39,7 +41,9 @@
# include <sys/times.h>
#endif
#include <time.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "qof.h"
#include "md5.h"
@@ -373,7 +377,8 @@
/* process and parent ids */
{
- pid_t pid;
+#ifdef HAVE_UNISTD_H
+ pid_t pid;
pid = getpid();
md5_process_bytes(&pid, sizeof(pid), &guid_context);
@@ -384,7 +389,8 @@
md5_process_bytes(&pid, sizeof(pid), &guid_context);
bytes += sizeof(pid);
#endif
- }
+#endif
+ }
/* user info */
{
Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c 2010-02-24 17:37:53 UTC (rev 18714)
+++ gnucash/trunk/src/libqof/qof/qoflog.c 2010-02-24 17:38:14 UTC (rev 18715)
@@ -30,14 +30,25 @@
#include <glib.h>
#include <glib/gstdio.h>
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#else
-#warning unistd required.
+# ifdef __GNUC__
+# warning "<unistd.h> required."
+# endif
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#else
+/* We simply define the struct timeval on our own here. */
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* and microseconds */
+};
+/* include <Winsock2.h> */
+#endif
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "qof.log"
Modified: gnucash/trunk/src/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.c 2010-02-24 17:37:53 UTC (rev 18714)
+++ gnucash/trunk/src/libqof/qof/qofsession.c 2010-02-24 17:38:14 UTC (rev 18715)
@@ -37,7 +37,13 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#else
+# ifdef __GNUC__
+# warning "<unistd.h> required."
+# endif
+#endif
#include <glib.h>
#include "qof.h"
More information about the gnucash-changes
mailing list