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 eblake@xxxxxxxxxx +1-801-349-2682
Libvirt virtualization library http://libvirt.org
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf