iverilog/vvp/config.h.in

200 lines
4.4 KiB
C
Raw Permalink Normal View History

2001-03-11 01:29:38 +01:00
#ifndef __config_H
#define __config_H
/*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
2001-03-11 01:29:38 +01:00
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if defined(__cplusplus)
# if !defined(__GNUC__)
using namespace std;
# elif (__GNUC__ == 3)
using namespace std;
# endif
2001-03-11 01:29:38 +01:00
#endif
2002-05-24 02:43:16 +02:00
# define SIZEOF_UNSIGNED_LONG_LONG 0
#ifndef SIZEOF_UNSIGNED_LONG
2001-03-11 01:29:38 +01:00
# define SIZEOF_UNSIGNED_LONG 0
#endif
2001-03-11 01:29:38 +01:00
# define SIZEOF_UNSIGNED 0
2001-09-18 00:26:33 +02:00
# undef NEED_LU
# undef NEED_TU
2001-09-18 00:26:33 +02:00
# undef WLU
# undef WTU
# undef HAVE_IOSFWD
# undef HAVE_DLFCN_H
# undef HAVE_DL_H
# undef HAVE_GETOPT_H
2001-09-15 20:27:04 +02:00
# undef HAVE_MALLOC_H
# undef HAVE_LIBREADLINE
# undef HAVE_READLINE_READLINE_H
# undef HAVE_LIBHISTORY
# undef HAVE_READLINE_HISTORY_H
# undef HAVE_INTTYPES_H
2006-04-27 07:04:59 +02:00
# undef HAVE_LROUND
# undef HAVE_LLROUND
2007-06-13 03:03:57 +02:00
# undef HAVE_NAN
# undef UINT64_T_AND_ULONG_SAME
/*
* Define this if you want to compile vvp with memory freeing and
* special valgrind hooks for the memory pools.
*/
# undef CHECK_WITH_VALGRIND
/* Figure if I can use readline. */
#undef USE_READLINE
2003-05-20 05:48:23 +02:00
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_READLINE_READLINE_H
# define USE_READLINE
#endif
#endif
/* Figure if I can use history. */
#undef USE_HISTORY
#ifdef HAVE_LIBHISTORY
#ifdef HAVE_READLINE_HISTORY_H
# define USE_HISTORY
#endif
#endif
2001-03-22 22:26:53 +01:00
#ifndef MODULE_DIR
# define MODULE_DIR "."
#endif
#ifdef HAVE_INTTYPES_H
/* This is needed in C++ to get the PRI?64 formats. */
# ifndef __STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS
# endif
# include <inttypes.h>
typedef uint64_t vvp_time64_t;
# define TIME_FMT_O PRIo64
# define TIME_FMT_U PRIu64
# define TIME_FMT_X PRIx64
# if UINT64_T_AND_ULONG_SAME
# define UL_AND_TIME64_SAME
# endif
#else /* HAVE_INTTYPES_H */
2005-09-14 04:50:07 +02:00
#if SIZEOF_UNSIGNED >= 8
typedef unsigned vvp_time64_t;
# define TIME_FMT_O "o"
# define TIME_FMT_U "u"
# define TIME_FMT_X "x"
#else
# if SIZEOF_UNSIGNED_LONG >= 8
typedef unsigned long vvp_time64_t;
# define UL_AND_TIME64_SAME
# define TIME_FMT_O "lo"
# define TIME_FMT_U "lu"
# define TIME_FMT_X "lx"
# else
# if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG
typedef unsigned long long vvp_time64_t;
# define TIME_FMT_O "llo"
# define TIME_FMT_U "llu"
# define TIME_FMT_X "llx"
# else
typedef unsigned long vvp_time64_t;
# define UL_AND_TIME64_SAME
# define TIME_FMT_O "lo"
# define TIME_FMT_U "lu"
# define TIME_FMT_X "lx"
# endif
# endif
#endif
#endif /* HAVE_INTTYPES_H */
2007-06-13 03:03:57 +02:00
# include <math.h>
/* getrusage, /proc/self/statm */
# undef HAVE_SYS_RESOURCE_H
# undef LINUX
2001-09-18 00:26:33 +02:00
2006-04-27 07:04:59 +02:00
#if !defined(HAVE_LROUND)
/*
* If the system doesn't provide the lround function, then we provide
* it ourselves here. It is simply the nearest integer, rounded away
* from zero.
*/
inline long int lround(double x)
{
if (x >= 0.0)
return (long)floor(x+0.5);
else
return (long)ceil(x-0.5);
}
#endif /* HAVE_LROUND */
#if ((SIZEOF_UNSIGNED_LONG < 8) && (SIZEOF_UNSIGNED_LONG_LONG >= 8))
#if !defined(HAVE_LLROUND)
/*
* We also need an equivalent function with a 64-bit return value if
* it is not available.
*/
inline int64_t i64round(double x)
{
if (x >= 0.0)
return (int64_t)floor(x+0.5);
else
return (int64_t)ceil(x-0.5);
}
#else /* HAVE_LLROUND */
# define i64round llround
#endif /* HAVE_LLROUND */
2006-04-27 07:04:59 +02:00
#else
# define i64round lround
2006-04-27 07:04:59 +02:00
#endif
2007-06-13 03:03:57 +02:00
#if !defined(HAVE_NAN)
# define nan(x) (NAN)
#endif
#if !defined(INFINITY)
# define INFINITY HUGE_VAL
#endif
2001-09-18 00:26:33 +02:00
/*
* When doing dynamic linking, we need a uniform way to identify the
* symbol. Some compilers put leading _, some trailing _. The
* configure script figures out which is the local convention and
* defines NEED_LU and NEED_TU as required.
*/
#ifdef NEED_LU
#define LU "_"
#else
#define LU ""
#endif
#ifdef NEED_TU
#define TU "_"
#else
#define TU ""
#endif
2001-03-11 01:29:38 +01:00
#endif