autoconf
[Top][All Lists]
Advanced

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

Re: Confirmation my method is right.


From: Dr. David Kirkby
Subject: Re: Confirmation my method is right.
Date: Tue, 28 Sep 2010 19:44:46 +0100
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1.7) Gecko/20100214 Thunderbird/3.0.1

On 09/28/10 03:46 PM, Eric Blake wrote:
On 09/28/2010 08:22 AM, Dr. David Kirkby wrote:
I have a header file (it's /usr/include/float.h) of an AIX system, which
should contain:

typedef unsigned short fprnd_t;

but for some reason this, and a few other things seem to be undefined
when gcc gets around to parsing it (I think it might be a gcc bug).

Have you reported this to the gcc folks?

No. I feel its only fair I build gcc from source on the same machine, and use a current version. This is a binary of 4.2.4 (or something close to that).

However, the problem is documented in the GSL INSTALL notes, so I assume I'm not the only one to have hit this.

This problem comes from compiling the GNU Scientific Library on AIX,
where the GSL developers say that gcc's float.h is being used in
preference to the IBM's float.h, and whilst the system's float.h has
this declaration, the gcc one does not.

Indeed this is the reason. However, although it may be solvable by
changing gcc's <float.h> use #include_next <float.h> to also pull in
IBM's definitions, there is no standard that requires the existence of
fprnd_t; therefore, you should always be checking for its existence and
be prepared with a fallback whether or not gcc changes their <float.h>.


typedef unsigned short fprnd_t;


To check if fprnd_t is defined or not, can you confirm.


1) I need to add to configure.ac

AC_CHECK_DECLS(fprnd_t,,,[#include <float.h>])

Get in the habit of proper m4 quoting:

AC_CHECK_DECLS([fprnd_t],,,[[#include <float.h>]])

(the last argument is double-quoted because it is a literal string with
no m4 macro contents, and because it contains a # which can cause
problems in various other macros when not double-quoted, even if
AC_CHECK_DECLS is immune to those problems).

Thank you.

2) I need to add in a C file which will need this declaration.

#infdef HAVE_DECL_FPRND_T
typedef unsigned short fprnd_t;
#endif

Yes, this is one valid approach. Another equally valid approach is:

AC_CHECK_TYPE([fprnd_t], [], [AC_DEFINE([fprnd_t], [unsigned short],
[replacement for a missing fprnd_t type])], [[#include <float.h>]])

at which point config.h already replaces things for you, for less work
in your .c file.

So the source file would be untouched? That seems a bit confusing to me, as it would be hard to know what is happening in a case like this. I think editing the source might be more work, but it would make maintenance easier.

Dave



reply via email to

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