Replacement of system-header files
So far, the spice code relied on the inclusion of adequate header
files to describe the system it was compiled on - for instance, if you
compiled on a dynix system, you would include (somewhere) the os-dynix.h
header file whih reads:
/**********
Copyright 1991 Regents of the University of California. All rights reserved.
**********/
/*
* BSD and derivative systems
*/
#include "os_unix.h"
#define HAS_NO_ATRIGH_DECL /* if asinh( ) is not in math.h */
#define HAS_FTIME /* ftime( ), <times.h> */
#define HAS_TERMCAP /* tgetxxx( ) */
#define HAS_VFORK /* BSD-ism, should not be necessary */
#define HAS_INDEX /* index( ) instead of strchr( ) */
#define HAS_BCOPY /* bcopy( ), bzero( ) */
etc.....
This is all stuff that can entirely be determined using autoconf, so that we
end
up with only one config.h file. However, autoconf has some rules when he
creates
a "define" statement in config.h - for example, suppose that I want to test
whether
the 'erfc' function (or macro) is defined in our C library, I would call:
AC_CHECK_FUNCS(erfc)
if this succeds, the 'configure script will automatically produce the
following
in config.h:
/* Define if you have the scalb function. */
#define HAVE_ERFC 1
However, the spice code checks for (in capabil.h)
#ifdef HAS_NO_ERFC
# ifndef HAS_NO_ERFC_DECL
# define HAS_NO_ERFC_DECL
# endif
#endif
This means that we will have to be careful when we use predefined macros like
that.
The preceding would become:
#ifndef HAS_ERFC
# ifndef HAS_NO_ERFC_DECL
# define HAS_NO_ERFC_DECL
# endif
#endif
The best would in fact NOT to use HAS_NO_ERFC_DECL in the code , but to use
directly
HAVE_ERFC - not forgetting to #include <config.h> of course.
One goal would be to throw out 'capabil.h' entirely.
As I guess I am the main 'maintainer' of the autoconf stuff, ask me for the
tests you
need (or implement them yourself if you have autoconf experience) - I will
then
provide with the new #define statement (you can always find it in
src/include/config.h.in
anyways)
I think this is the easiest way to deal with it, but care must be taken not
to forget
statements along the way.
manu
Partial thread listing: