guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libguile-1.8.5 fails to compile under mingw+msys


From: Neil Jerram
Subject: Re: libguile-1.8.5 fails to compile under mingw+msys
Date: Fri, 23 Jan 2009 01:13:15 +0000

Hi again Carlo,

2008/7/22 carlo.bramix <address@hidden>:
> Hello.
>
> Into pthread.h of pthread-win32 package there is this code:
>
> #ifndef HAVE_STRUCT_TIMESPEC
> #define HAVE_STRUCT_TIMESPEC 1
> struct timespec {
>        long tv_sec;
>        long tv_nsec;
> };
> #endif /* HAVE_STRUCT_TIMESPEC */
>
> When configure tries to search if struct timespec exists in pthread.h, the 
> HAVE_STRUCT_TIMESPEC is undefined, so the #ifndef is positive and pthread.h 
> defines the structure.
> At the end, config.h defines HAVE_STRUCT_TIMESPEC.
> When doing the make, since config.h has HAVE_STRUCT_TIMESPEC, when pthread.h 
> is included it finds that the macro is already defined, so the #ifndef fails 
> and the structure timespec remains undeclared.

I finally got round to fixing this; please see
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=d6818567553aafdbbbca327d4a1b1289a6816858.

> I think configure should not test if timespec exists into pthread.h for win32.
> That structure has been added into pthread.h only for compatibility with some 
> pthread function prototypes.
> In other words, this code into configure.in:
>
> # On mingw, struct timespec is in <pthread.h>.
> #
> AC_MSG_CHECKING(for struct timespec)
> AC_CACHE_VAL(scm_cv_struct_timespec,
>    AC_TRY_COMPILE([
> #include <time.h>
> #if HAVE_PTHREAD_H   // <-- REMOVE!
> #include <pthread.h> // <-- REMOVE!
> #endif],             // <-- REMOVE!
>            [struct timespec t;  t.tv_nsec = 100],
>            scm_cv_struct_timespec="yes",
>            scm_cv_struct_timespec="no"))

I didn't do it that way, as it wasn't so long ago that those lines
were added [1], and I'm sure there must have been a good reason for
that.

[1] 
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=80134d3973249c1e06d393e8936fb15e3c03265f

My guess is that MinGW at that time defined struct timespec without
checking HAVE_STRUCT_TIMESPEC first.  If so, I think the fix that I've
done should allow both that old MinGW and the current one to work.

Regards,
       Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]