gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] [gpsd-commit-watch] [SCM] GPSD branch, master, updated. r


From: Greg Troxel
Subject: Re: [gpsd-dev] [gpsd-commit-watch] [SCM] GPSD branch, master, updated. release-3.9-547-gcbf524c
Date: Fri, 01 Nov 2013 11:45:17 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.4 (berkeley-unix)

"Eric S. Raymond" <address@hidden> writes:

> Greg Troxel <address@hidden>:
>> The right thing is to have a configure-time (first half of scons) test
>> that looks for endian.h and sys/endian.h, and then
>> 
>>   #ifdef HAVE_ENDIAN_H
>>   etc.
>
> Think about what happens with a configure-time test if the configure
> host has different endianness from the compilation target.

Sorry, that's not what I meant.

Stepping back from autoconf/scons/etc., I mean 'configure time' to be
the things that happen to figure out the system, as opposed to running
the (maybe cross) compiler to build objects for the target.

First, for header files we need (that are not required by
posix, or for which we cut slack to nonconforming implemenations), the
build needs to determine if they are present.  Present of course means
"usable by the compiler, which may be cross".

Then, to determine target endianness, some test program needs to be
compiled.  Since we can't run target programs (in the general case), it
will have to #error out or something in one endianness case.

So given that endian.h is in different places (actually, and posix seems
not to specify this), I think the following steps should be happening:

  check for presence of endian.h
  (if not found) check for presence of sys/endian.h

when building the endian test program

#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif /* HAVE_ENDIAN_H */
#ifdef SYS_HAVE_ENDIAN_H
#include <sys/endian.h>
#endif /* SYS_HAVE_ENDIAN_H */

This is instead of the -I/usr/include/sys hack, which can in general
have unknown other consequences from getting an expected file, perhaps
by includes in endian.h.

Another place this sort of thing is needed is <sys/timepps.h>.  On
NetBSD, this needs:

  #include <sys/time.h>
  #include <sys/timepps.h>

to build.  Perhaps that's a bug, but a) it's real and b) longstanding
unix practice is to make people include prereq headers, even though I
know the recent trend has been to include them from each file.  (I'm
inclined to fix the bug, but gpsd will still need to cope for quite a
while.)

So, gpsd will have to  check for sys/time.h and #include it before using
sys/timepps.h, both in the test for if sys/timepps.h is present (scons
says it isn't on NetBSD now, even though it is) and when it's used.

This is a normal problem, but I'm not familiar enough with scons to know
how to do it.

Attachment: pgppLsmiYtFBY.pgp
Description: PGP signature


reply via email to

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