On Wed, Jul 20, 2011 at 5:30 PM, Mike Frysinger <[email protected]> wrote:
> On Wed, Jul 20, 2011 at 17:18, Jie Zhang wrote:
>> On Tue, Jul 19, 2011 at 2:16 PM, Mike Frysinger wrote:
>>> AC_CHECK_MEMBER([struct timespec.tv_sec])
>>> AF_IF([test "x$ac_cv_member_struct_timespec_tv_sec" = "xyes"],[
>>>    AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [We have struct timespec])
>>> ])
>>
>> AC_CHECK_TYPE is better. How would you like the attached new version
>> of the patch?
>
> that is a better macro.  i was thinking it didnt work for structs, but
> clearly that's not true.
>
> move the code down in configure.ac to where the other existing
> AC_CHECK_TYPE is (for wchar_t), line wrap it the same way as that
> check, and it should be good to go.
>
I thought it would be better to make checking of nanosleep and struct
timespec closer. But I have not strong preference for it. Attached is
the patch I have committed.

Thank you!

Jie
  * sysdep.h (struct timespec): Only define when !HAVE_STRUCT_TIMESPEC.
  * configure.ac: Check struct timespec.

Index: sysdep.h
===================================================================
--- sysdep.h	(revision 1971)
+++ sysdep.h	(working copy)
@@ -75,7 +75,9 @@
 
 #ifndef HAVE_NANOSLEEP
 #include <unistd.h>
+#ifndef HAVE_STRUCT_TIMESPEC
 struct timespec { unsigned long tv_sec, tv_nsec; };
+#endif
 #define nanosleep(req, rem) usleep((req)->tv_sec * 1000 * 1000 + (req)->tv_nsec / 1000)
 #endif
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 1971)
+++ configure.ac	(working copy)
@@ -158,6 +158,10 @@
 	[AC_DEFINE([wchar_t], [char], [Make sure we have wchar_t])],
 	[#include <stddef.h>])
 
+AC_CHECK_TYPE([struct timespec],
+	[AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Define to 1 if you have the struct timespec type])],
+	[], [[#include <time.h>]])
+
 dnl See if the windows target is polluting the namespace on us which
 dnl will break some of the lex/yacc (e.g. bsdl) builds.  We need both
 dnl defines as some versions of mingw have changed names over time.
------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to