how to check for a struct in multiple headers?

Hasso Tepper hasso at kde.org
Fri Mar 31 09:23:24 CEST 2006


Tanner Lovelace wrote:
> On 3/30/06, Benjamin Reed <rangerrick at gmail.com> wrote:
> > I need to make the test for statfs try sys/mount.h, currently I get
> > the following when compiling kdecore:
>
> ---(snip!)---
>
> > What I really want is for HAVE_STRUCT_STATFS to be set if struct
> > statfs is in sys/statfs.h *or* sys/mount.h.
>
> Actually, not even that will work due to how the code is written.
> kmountpoint.cpp has this:
>
> #if defined(HAVE_STRUCT_STATVFS)
>     struct statvfs *mounted;
> #elif defined(HAVE_STRUCT_STATFS)
>     struct statfs *mounted;
> #endif
>
> So, even if it finds HAVE_STRUCT_STATFS it won't be
> used because HAVE_STRUCT_STATVFS was found first
> and it assumes it will use it, which isn't the case in OS X.
> I just verified that by fixing the test for HAVE_STRUCT_STATFS
> and still having the compile fail. :-(
>
> My guess is we need a test about what type of parameter
> getmntinfo takes.  Suggestions?

OK. I think that I'm the one to blame about current situation. I looked at 
a lot of pieces of code how statvfs/statfs thingy is solved in them, but 
I think that MacOS X is too new platform or I didn't try hard enough.

Can you check this code in kmountpoint.cpp instead, does this one work for 
you?

#ifdef ST_RDONLY
    struct statvfs *mounted;
#else
    struct statfs *mounted;
#endif


regards,

-- 
Hasso Tepper
KDE Estonian Team


More information about the Kde-buildsystem mailing list