autoconf
[Top][All Lists]
Advanced

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

Re: Confirmation my method is right.


From: Eric Blake
Subject: Re: Confirmation my method is right.
Date: Tue, 28 Sep 2010 08:46:10 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

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?


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).



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.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

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