1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

New ACC version.

committer: mfx <mfx> 1050608556 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-04-17 19:42:36 +00:00
parent 256b8f066f
commit 390cdbba2d
14 changed files with 817 additions and 243 deletions

View File

@ -19,17 +19,30 @@
* ACC_CONFIG_HEADER if given, then use this as <config.h>
* ACC_CONFIG_INCLUDE include path to acc_ files
* ACC_CONFIG_FRESSTANDING only use <limits.h> and possibly <stdint.h>
* [use this for embedded targets]
*/
#define ACC_VERSION 20030405L
#define ACC_VERSION 20030417L
#if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file
#endif
#include ACC_CONFIG_INCLUDE("acc_init.h")
/* disable pedantic warnings */
#if defined(__INTEL_COMPILER) && defined(__linux__)
# pragma warning(disable: 193) /* #193: zero used for undefined preprocessing identifier */
#endif
#if 0 && defined(__WATCOMC__)
# if (__WATCOMC__ < 1000)
# pragma warning 203 9 /* W203: Preprocessing symbol '%s' has not been declared */
# endif
#endif
#include <limits.h>
#include ACC_CONFIG_INCLUDE("acc_init.h")
#include ACC_CONFIG_INCLUDE("acc_os.h")
#include ACC_CONFIG_INCLUDE("acc_cc.h")
#include ACC_CONFIG_INCLUDE("acc_mm.h")
@ -42,8 +55,11 @@
# include ACC_CONFIG_INCLUDE("acc_auto.h")
#endif
#include ACC_CONFIG_INCLUDE("acc_type.h")
#if !defined(ACC_CONFIG_FREESTANDING)
# include ACC_CONFIG_INCLUDE("acc_incd.h")
# include ACC_CONFIG_INCLUDE("acc_lib.h")
#endif

View File

@ -17,6 +17,7 @@
* CPU architecture - exactly one of:
*
* ACC_ARCH_UNKNOWN [default]
* ACC_ARCH_ALPHA
* ACC_ARCH_IA16 Intel Architecture (8088, 8086, 80186, 80286)
* ACC_ARCH_IA32 Intel Architecture (80386+)
* ACC_ARCH_IA64
@ -36,16 +37,21 @@
#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
# define ACC_ARCH_IA32 1
# define ACC_INFO_ARCH "ia32"
#elif defined(__ia64__) || defined(_M_IA64)
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
# define ACC_ARCH_IA64 1
# define ACC_INFO_ARCH "ia64"
#elif (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32)
#elif (ACC_OS_DOS32 || ACC_OS_OS2)
# error "missing define for CPU architechture"
#elif (ACC_OS_WIN64)
#elif (0 && ACC_OS_WIN32)
# error "missing define for CPU architechture"
#elif (0 && ACC_OS_WIN64)
# error "missing define for CPU architechture"
#elif (ACC_OS_TOS) || defined(__m68000__)
# define ACC_ARCH_M68K 1
# define ACC_INFO_ARCH "m68k"
#elif defined(__alpha__) || defined(__alpha)
# define ACC_ARCH_ALPHA 1
# define ACC_INFO_ARCH "alpha"
#else
# define ACC_ARCH_UNKNOWN 1
# define ACC_INFO_ARCH "unknown"

View File

@ -13,21 +13,41 @@
*/
/*************************************************************************
// Checks for <stdint.h>
**************************************************************************/
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))
# define HAVE_STDINT_H 1
# endif
#elif defined(__dietlibc__)
# undef HAVE_STDINT_H /* incomplete */
#elif (ACC_CC_BORLANDC) && (__BORLANDC__ >= 0x560)
# undef HAVE_STDINT_H /* broken & incomplete */
#elif (ACC_CC_DMC) && (__DMC__ >= 0x825)
# define HAVE_STDINT_H 1
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
/*************************************************************************
// Checks for header files
**************************************************************************/
#define STDC_HEADERS 1
#define HAVE_CONIO_H 1
#define HAVE_ASSERT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_DOS_H 1
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_IO_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MALLOC_H 1
#define HAVE_SHARE_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
@ -39,77 +59,62 @@
#define HAVE_UTIME_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_SYS_TYPES_H 1
#undef HAVE_ALLOCA_H
#undef HAVE_CONIO_H
#undef HAVE_DIRECT_H
#undef HAVE_DOS_H
#undef HAVE_IO_H
#undef HAVE_SHARE_H
#undef HAVE_STDINT_H
#undef HAVE_STRINGS_H
#undef HAVE_SYS_UTIME_H
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
# undef HAVE_CONIO_H
# undef HAVE_DOS_H
# undef HAVE_IO_H
# undef HAVE_SHARE_H
# undef HAVE_SYS_UTIME_H
#if (ACC_OS_POSIX)
# define HAVE_STRINGS_H 1
#elif defined(__dietlibc__)
# undef HAVE_CONIO_H
# undef HAVE_DOS_H
# undef HAVE_IO_H
# undef HAVE_SHARE_H
# undef HAVE_SYS_UTIME_H
# define HAVE_STRINGS_H 1
#elif (ACC_CC_BORLANDC)
# undef HAVE_UNISTD_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_UTIME_H
#elif (ACC_CC_DMC)
# undef HAVE_UNISTD_H /* not working */
#elif (ACC_CC_GNUC && ACC_OS_CYGWIN)
# undef HAVE_CONIO_H
# undef HAVE_DOS_H
# undef HAVE_SHARE_H
#elif (ACC_CC_GNUC && ACC_OS_DOS32 && defined(__DJGPP__))
# undef HAVE_SYS_UTIME_H
#elif (ACC_CC_GNUC && ACC_OS_WIN32 && defined(__MINGW32__))
# undef HAVE_UTIME_H
#elif (ACC_CC_GNUC && ACC_OS_TOS)
# undef HAVE_CONIO_H
# undef HAVE_DOS_H
# undef HAVE_IO_H
# undef HAVE_SHARE_H
# undef HAVE_SYS_UTIME_H
# if (ACC_OS_POSIX_FREEBSD || ACC_OS_POSIX_OPENBSD)
# undef HAVE_MALLOC_H /* deprecated */
# elif (ACC_OS_POSIX_HPUX)
# define HAVE_ALLOCA_H 1
# endif
#elif (ACC_OS_CYGWIN)
# define HAVE_ALLOCA_H 1
# define HAVE_IO_H 1
#elif (ACC_OS_EMX)
# define HAVE_ALLOCA_H 1
# define HAVE_IO_H 1
#elif (ACC_OS_TOS && ACC_CC_GNUC)
# if !defined(__MINT__)
# undef HAVE_MALLOC_H
# endif
#elif (ACC_CC_INTELC && ACC_OS_WIN32)
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
#elif (ACC_CC_LCC && ACC_OS_WIN32)
# undef HAVE_DOS_H
# undef HAVE_SYS_TIME_H
#elif (ACC_CC_MSC)
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
#elif (ACC_CC_PACIFIC && ACC_OS_DOS16)
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# undef HAVE_DIRENT_H
# undef HAVE_FCNTL_H
# undef HAVE_IO_H
# undef HAVE_MALLOC_H
# undef HAVE_SHARE_H
# undef HAVE_MEMORY_H
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_TYPES_H
# undef HAVE_SYS_UTIME_H
#elif ((ACC_CC_PUREC || ACC_CC_TURBOC) && ACC_OS_TOS)
#endif
/* DOS, OS/2 & Windows */
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
#define HAVE_CONIO_H 1
#define HAVE_DIRECT_H 1
#define HAVE_DOS_H 1
#define HAVE_IO_H 1
#define HAVE_SHARE_H 1
#if (ACC_CC_AZTEC_C)
# undef HAVE_CONIO_H
# undef HAVE_DOS_H
# undef HAVE_FCNTL_H
# undef HAVE_IO_H
# undef HAVE_DIRECT_H
# undef HAVE_DIRENT_H
# undef HAVE_MALLOC_H
# undef HAVE_SHARE_H
# undef HAVE_UNISTD_H
@ -117,23 +122,60 @@
# undef HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_TYPES_H
# undef HAVE_SYS_UTIME_H
#elif (ACC_CC_TURBOC && ACC_OS_DOS16)
#elif (ACC_CC_BORLANDC)
# undef HAVE_UNISTD_H
# undef HAVE_SYS_TIME_H
#elif (ACC_CC_DMC)
# undef HAVE_UNISTD_H /* not working */
#elif defined(__DJGPP__)
#elif (ACC_CC_INTELC || ACC_CC_MSC)
# undef HAVE_DIRENT_H
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
# define HAVE_SYS_UTIME_H 1
#elif (ACC_CC_LCC)
# undef HAVE_DIRENT_H
# undef HAVE_DOS_H
# undef HAVE_SYS_TIME_H
#elif defined(__MINGW32__)
# undef HAVE_UTIME_H
# define HAVE_SYS_UTIME_H 1
#elif (ACC_CC_PACIFIC)
# undef HAVE_DIRECT_H
# undef HAVE_DIRENT_H
# undef HAVE_FCNTL_H
# undef HAVE_IO_H
# undef HAVE_MALLOC_H
# undef HAVE_MEMORY_H
# undef HAVE_SHARE_H
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_TYPES_H
#elif (ACC_CC_TURBOC)
# undef HAVE_UNISTD_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_UTIME_H
# if (__TURBOC__ < 0x0400)
# undef HAVE_DIRECT_H
# undef HAVE_DIRENT_H
# undef HAVE_MALLOC_H
# undef HAVE_MEMORY_H
# undef HAVE_UTIME_H
# endif
#elif (ACC_CC_WATCOMC)
# undef HAVE_DIRENT_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
# define HAVE_SYS_UTIME_H 1
# if (__WATCOMC__ < 900)
# undef HAVE_UNISTD_H
# endif
#endif
#endif /* DOS, OS/2 & Windows */
#if (HAVE_SYS_TIME_H && HAVE_TIME_H)
# define TIME_WITH_SYS_TIME 1
@ -141,26 +183,136 @@
/*************************************************************************
// Checks for <stdint.h>
// Checks for library functions
**************************************************************************/
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1))
# define HAVE_STDINT_H 1
# endif
#elif defined(__dietlibc__)
# undef HAVE_STDINT_H /* incomplete */
#elif (ACC_CC_BORLANDC) && (__BORLANDC__ >= 0x560)
# define HAVE_STDINT_H 1
#elif (ACC_CC_DMC) && (__DMC__ >= 0x825)
# define HAVE_STDINT_H 1
#define HAVE_ACCESS 1
#define HAVE_ALLOCA 1
#define HAVE_ATOI 1
#define HAVE_ATOL 1
#define HAVE_CHMOD 1
#define HAVE_CHOWN 1
#define HAVE_CTIME 1
#define HAVE_DIFFTIME 1
#define HAVE_FILENO 1
#define HAVE_FSTAT 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GMTIME 1
#define HAVE_LOCALTIME 1
#define HAVE_LSTAT 1
#define HAVE_MEMCMP 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_SNPRINTF 1
#define HAVE_STRCHR 1
#define HAVE_STRDUP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRRCHR 1
#define HAVE_UMASK 1
#define HAVE_UTIME 1
#define HAVE_VSNPRINTF 1
#if (ACC_OS_POSIX || ACC_OS_CYGWIN)
# define HAVE_STRCASECMP 1
# define HAVE_STRNCASECMP 1
#else
# define HAVE_STRICMP 1
# define HAVE_STRNICMP 1
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#if (ACC_OS_POSIX)
#elif (ACC_OS_CYGWIN)
#elif (ACC_OS_EMX)
# undef HAVE_CHOWN
# undef HAVE_LSTAT
#elif (ACC_OS_TOS && ACC_CC_GNUC)
# if !defined(__MINT__)
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# undef HAVE_ALLOCA
# undef HAVE_ACCESS
# undef HAVE_CHMOD
# undef HAVE_CHOWN
# undef HAVE_FSTAT
# undef HAVE_GETTIMEOFDAY
# undef HAVE_LSTAT
# undef HAVE_SNPRINTF
# undef HAVE_UMASK
# undef HAVE_UTIME
# undef HAVE_VSNPRINTF
#endif
/* DOS, OS/2 & Windows */
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
#undef HAVE_CHOWN
#undef HAVE_GETTIMEOFDAY
#undef HAVE_LSTAT
#undef HAVE_UMASK
#if (ACC_CC_AZTEC_C)
# undef HAVE_DIFFTIME /* difftime() is in the math library */
# undef HAVE_FSTAT
# undef HAVE_STRDUP /* missing in 5.2a */
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
#elif (ACC_CC_BORLANDC)
# if (__BORLANDC__ < 0x0500)
# undef HAVE_DIFFTIME /* difftime() is in the math library */
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#elif (ACC_CC_DMC)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#elif defined(__DJGPP__)
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
#elif (ACC_CC_INTELC || ACC_CC_MSC)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#elif (ACC_CC_LCC)
# define utime _utime
#elif defined(__MINGW32__)
#elif (ACC_CC_PACIFIC)
# undef HAVE_ACCESS
# undef HAVE_ALLOCA
# undef HAVE_CHMOD
# undef HAVE_DIFFTIME
# undef HAVE_FSTAT
# undef HAVE_SNPRINTF
# undef HAVE_STRFTIME
# undef HAVE_UTIME
# undef HAVE_VSNPRINTF
#elif (ACC_CC_TURBOC)
# undef HAVE_ALLOCA
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# if (__TURBOC__ < 0x0295)
# undef HAVE_STRFTIME
# endif
# if (__TURBOC__ < 0x0400)
# undef HAVE_UTIME
# endif
#elif (ACC_CC_WATCOMC)
# if (__WATCOMC__ >= 1100)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
# else
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#endif
#endif /* DOS, OS/2 & Windows */
/*************************************************************************
// Checks for typedefs and structures
**************************************************************************/
@ -169,7 +321,7 @@
#define SIZEOF_INT (__ACC_INT_BIT / 8)
#define SIZEOF_LONG (__ACC_LONG_BIT / 8)
#if (ACC_OS_WIN64)
#if (ACC_OS_WIN64) /* LLP64 programming model */
# define SIZEOF_PTRDIFF_T 8
# define SIZEOF_SIZE_T 8
# define SIZEOF_VOID_P 8
@ -199,140 +351,28 @@
# define SIZEOF_VOID_P SIZEOF_LONG
#endif
#if !defined(SIZEOF_CHAR_P) && (SIZEOF_VOID_P > 0)
# define SIZEOF_CHAR_P SIZEOF_VOID_P
#endif
/* FIXME: add more sizes */
/*************************************************************************
// Checks for library functions
**************************************************************************/
#define HAVE_ACCESS 1
#define HAVE_ATOI 1
#define HAVE_ATOL 1
#define HAVE_CHMOD 1
#define HAVE_CHOWN 1
#define HAVE_CTIME 1
#define HAVE_DIFFTIME 1
#define HAVE_FILENO 1
#define HAVE_FSTAT 1
#define HAVE_GETUMASK 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GMTIME 1
#define HAVE_LOCALTIME 1
#define HAVE_LSTAT 1
#define HAVE_MEMCMP 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_SETMODE 1
#define HAVE_SNPRINTF 1
#define HAVE_STRCHR 1
#define HAVE_STRDUP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRRCHR 1
#define HAVE_UMASK 1
#define HAVE_UTIME 1
#define HAVE_VSNPRINTF 1
#if (ACC_OS_POSIX || ACC_OS_CYGWIN)
# define HAVE_STRCASECMP 1
# define HAVE_STRNCASECMP 1
#else
# define HAVE_STRICMP 1
# define HAVE_STRNICMP 1
#endif
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# undef HAVE_CHOWN
# undef HAVE_GETTIMEOFDAY
# undef HAVE_GETUMASK
# undef HAVE_LSTAT
# undef HAVE_UMASK
#endif
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
# undef HAVE_GETUMASK
# undef HAVE_SETMODE
#elif defined(__dietlibc__)
# undef HAVE_GETUMASK
# undef HAVE_SETMODE
#elif (ACC_CC_BORLANDC)
# if (__BORLANDC__ < 0x500)
# undef HAVE_DIFFTIME /* difftime() is in the math library */
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#elif (ACC_CC_DMC)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#elif (ACC_CC_GNUC && ACC_OS_CYGWIN)
# undef HAVE_GETUMASK
#elif (ACC_CC_GNUC && ACC_OS_DOS32 && defined(__DJGPP__))
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
#elif (ACC_CC_GNUC && ACC_OS_WIN32 && defined(__MINGW32__))
#elif (ACC_CC_GNUC && ACC_OS_TOS)
# undef HAVE_SETMODE
# if !defined(__MINT__)
# undef HAVE_GETUMASK
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#elif (ACC_CC_INTELC && ACC_OS_WIN32)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#elif (ACC_CC_LCC && ACC_OS_WIN32)
# define utime _utime
#elif (ACC_CC_MSC)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
#elif (ACC_CC_PACIFIC && ACC_OS_DOS16)
# undef HAVE_ACCESS
# undef HAVE_CHMOD
# undef HAVE_DIFFTIME
# undef HAVE_FSTAT
# undef HAVE_SETMODE
# undef HAVE_SNPRINTF
# undef HAVE_STRFTIME
# undef HAVE_UTIME
# undef HAVE_VSNPRINTF
#elif ((ACC_CC_PUREC || ACC_CC_TURBOC) && ACC_OS_TOS)
# undef HAVE_ACCESS
# undef HAVE_CHMOD
# undef HAVE_CHOWN
# undef HAVE_FSTAT
# undef HAVE_GETTIMEOFDAY
# undef HAVE_GETUMASK
# undef HAVE_LSTAT
# undef HAVE_SETMODE
# undef HAVE_SNPRINTF
# undef HAVE_UMASK
# undef HAVE_UTIME
# undef HAVE_VSNPRINTF
#elif (ACC_CC_TURBOC && (ACC_OS_DOS16 || ACC_OS_WIN16))
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# if (__TURBOC__ < 0x0295)
# undef HAVE_STRFTIME
# endif
# if (__TURBOC__ < 0x0400)
# undef HAVE_UTIME
# endif
#elif (ACC_CC_WATCOMC)
# if (__WATCOMC__ >= 1100)
# define snprintf _snprintf
# define vsnprintf _vsnprintf
# else
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#if (ACC_ARCH_IA32 && (ACC_CC_DMC || ACC_CC_GNUC))
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#elif (ACC_ARCH_IA32 && (ACC_CC_INTELC || ACC_CC_MSC))
# define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___INT64 8
#elif (ACC_ARCH_IA32 && (ACC_CC_BORLANDC && __BORLANDC__ >= 0x0550))
# define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___INT64 8
#elif (ACC_ARCH_IA32 && (ACC_CC_WATCOMC && __WATCOMC__ >= 1100))
# define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___INT64 8
#elif (ACC_ARCH_M68K && (ACC_CC_GNUC))
# define SIZEOF_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8
#endif

View File

@ -22,9 +22,19 @@
*/
#if defined(__GNUC__) && defined(__VERSION__)
# define ACC_CC_GNUC 1
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)
# elif defined(__GNUC_MINOR__)
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100)
# else
# define ACC_CC_GNUC (__GNUC__ * 0x10000L)
# endif
# define ACC_INFO_CC "gcc"
# define ACC_INFO_CCVER __VERSION__
#elif defined(__AZTEC_C__)
# define ACC_CC_AZTEC_C 1
# define ACC_INFO_CC "Aztec C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__AZTEC_C__)
#elif defined(__BORLANDC__)
# define ACC_CC_BORLANDC 1
# define ACC_INFO_CC "Borland C"
@ -33,6 +43,10 @@
# define ACC_CC_DMC 1
# define ACC_INFO_CC "Digital Mars C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__DMC__)
#elif defined(__DECC)
# define ACC_CC_DECC 1
# define ACC_INFO_CC "DEC C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__DECC)
#elif defined(__INTEL_COMPILER)
# define ACC_CC_INTELC 1
# define ACC_INFO_CC "Intel C"

View File

@ -40,19 +40,8 @@
************************************************************************/
#if !defined(__ACC_UINT_MAX)
# define __ACC_INT_MAX(b) ((1l << ((b)-1)) - 1l)
# define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1ul) << 1) + 1ul)
#endif
#if !defined(ACC_UINT32_C)
# if defined(__PACIFIC__) && defined(DOS)
/* workaround Pacific C */
# define ACC_UINT32_C(c) c
# elif (UINT_MAX < __ACC_UINT_MAX(32))
# define ACC_UINT32_C(c) c ## UL
# else
# define ACC_UINT32_C(c) c ## U
# endif
# define __ACC_INT_MAX(b) ((1l << ((b)-1)) - 1)
# define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1) << 1) + 1)
#endif
@ -61,7 +50,7 @@
************************************************************************/
#if !defined(__ACC_SHORT_BIT)
# if (USHRT_MAX == 0xffff)
# if (USHRT_MAX == 0xffffL)
# define __ACC_SHORT_BIT 16
# elif (USHRT_MAX == __ACC_UINT_MAX(32))
# define __ACC_SHORT_BIT 32
@ -75,7 +64,7 @@
#endif
#if !defined(__ACC_INT_BIT)
# if (UINT_MAX == 0xffff)
# if (UINT_MAX == 0xffffL)
# define __ACC_INT_BIT 16
# elif (UINT_MAX == __ACC_UINT_MAX(32))
# define __ACC_INT_BIT 32

View File

@ -13,10 +13,12 @@
*/
#ifndef __ACC_INCD_H_INCLUDED
#define __ACC_INCD_H_INCLUDED
/* default system includes */
/* see Autoconf:
* headers.m4
* _AC_INCLUDES_DEFAULT_REQUIREMENTS
* ac_includes_default
* headers.m4, _AC_INCLUDES_DEFAULT_REQUIREMENTS ac_includes_default
*/
#include <stdio.h>
@ -54,6 +56,8 @@
# include <unistd.h>
#endif
#endif /* already included */
/*
vi:ts=4:et

76
src/acc/acc_ince.h Normal file
View File

@ -0,0 +1,76 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
#ifndef __ACC_INCE_H_INCLUDED
#define __ACC_INCE_H_INCLUDED
/* extra system includes */
#if defined(HAVE_STDARG_H)
# include <stdarg.h>
#endif
#if defined(HAVE_CTYPE_H)
# include <ctype.h>
#endif
#if defined(HAVE_ERRNO_H)
# include <errno.h>
#endif
#if defined(HAVE_MALLOC_H)
# include <malloc.h>
#endif
#if defined(HAVE_ALLOCA_H)
# include <alloca.h>
#endif
#if defined(HAVE_FCNTL_H)
# include <fcntl.h>
#endif
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
#endif
#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
#if defined(TIME_WITH_SYS_TIME)
# include <sys/time.h>
# include <time.h>
#elif defined(HAVE_TIME_H)
# include <time.h>
#endif
#if defined(HAVE_UTIME_H)
# include <utime.h>
#elif defined(HAVE_SYS_UTIME_H)
# include <sys/utime.h>
#endif
/* DOS, OS/2 & Windows */
#if defined(HAVE_IO_H)
# include <io.h>
#endif
#if defined(HAVE_DOS_H)
# include <dos.h>
#endif
#if defined(HAVE_DIRECT_H)
# include <direct.h>
#endif
#if defined(HAVE_SHARE_H)
# include <share.h>
#endif
#endif /* already included */
/*
vi:ts=4:et
*/

45
src/acc/acc_inci.h Normal file
View File

@ -0,0 +1,45 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
#ifndef __ACC_INCI_H_INCLUDED
#define __ACC_INCI_H_INCLUDED
/* internal system includes */
#if (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
# include <tos.h>
#elif (ACC_OS_WIN32 || ACC_OS_WIN64 || ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)))
# if 1 && !defined(WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN 1
# endif
# include <windows.h>
# define ACC_H_WINDOWS_H 1
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_WIN16)
# if (ACC_CC_BORLANDC || ACC_CC_TURBOC)
# include <dir.h>
# elif defined(__DJGPP__)
# include <sys/exceptn.h>
# elif (ACC_CC_PACIFIC)
# include <unixio.h>
# include <sys.h>
# endif
#endif
#endif /* already included */
/*
vi:ts=4:et
*/

View File

@ -14,16 +14,17 @@
/***********************************************************************
// disable pedantic warnings
// try to detect specific compilers
************************************************************************/
#if defined(__INTEL_COMPILER) && defined(__linux__)
# pragma warning(disable: 193) /* #193: zero used for undefined preprocessing identifier */
#endif
#if 0 && defined(__WATCOMC__)
# if (__WATCOMC__ < 1000)
# pragma warning 203 9 /* W203: Preprocessing symbol '%s' has not been declared */
#if defined(__VERSION) && (UINT_MAX == 0xffffL) && defined(MB_LEN_MAX)
# if (__VERSION == 520) && (MB_LEN_MAX == 1)
# if !defined(__AZTEC_C__)
# define __AZTEC_C__ __VERSION
# endif
# if !defined(__DOS__)
# define __DOS__ 1
# endif
# endif
#endif
@ -40,7 +41,7 @@
/* Microsoft C does not correctly define ptrdiff_t for
* the 16-bit huge memory model.
*/
#if defined(_MSC_VER) && defined(M_I86HM)
#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == 0xffffL)
# if (_MSC_VER <= 800)
# define ptrdiff_t long
# define _PTRDIFF_T_DEFINED

210
src/acc/acc_lib.ch Normal file
View File

@ -0,0 +1,210 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
#if !defined(ACC_VERSION)
#include "acc.h"
#endif
#ifndef __ACC_INCE_H_INCLUDED
#include ACC_CONFIG_INCLUDE("acc_ince.h")
#endif
#ifndef __ACC_INCI_H_INCLUDED
#include ACC_CONFIG_INCLUDE("acc_inci.h")
#endif
/*************************************************************************
// wrap <dirent.h>
**************************************************************************/
#if (HAVE_DIRENT_H)
int acc_opendir(ACC_DIR* dirp, const char* name)
{
dirp->dirp = (ACC_DIR*) opendir(name);
return dirp->dirp ? 0 : -1;
}
int acc_closedir(ACC_DIR* dirp)
{
return closedir((DIR*) dirp->dirp);
}
int acc_readdir(ACC_DIR* dirp, struct acc_dirent* d)
{
const struct dirent *dp;
dp = readdir((DIR*) dirp->dirp);
if (!dp || !dp->d_name[0])
return -1;
if (strlen(dp->d_name) >= sizeof(d->d_name))
return -1;
strcpy(d->d_name, dp->d_name);
return 0;
}
#else
int acc_opendir(ACC_DIR* dirp, const char* name)
{
ACC_UNUSED(dirp); ACC_UNUSED(name);
return -1;
}
int acc_closedir(ACC_DIR* dirp)
{
ACC_UNUSED(dirp);
return -1;
}
int acc_readdir(ACC_DIR* dirp, struct acc_dirent* d)
{
ACC_UNUSED(dirp); ACC_UNUSED(d);
return -1;
}
#endif
/*************************************************************************
// wrap <fnmatch.h>
**************************************************************************/
/*************************************************************************
// wrap <getopt.h>
**************************************************************************/
/*************************************************************************
// wrap misc
**************************************************************************/
long acc_get_osfhandle(int fd)
{
if (fd < 0)
return -1;
#if (ACC_OS_CYGWIN)
return get_osfhandle(fd);
#elif (ACC_OS_EMX && defined(__RSXNT__))
/* FIXME */
return -1;
#elif (ACC_OS_WIN32 || ACC_OS_WIN64)
return _get_osfhandle(fd);
#else
return fd;
#endif
}
int acc_set_binmode(int fd, int binary)
{
#if (ACC_OS_TOS && defined(__MINT__))
int old_binary;
FILE* f;
if (fd == STDIN_FILENO) f = stdin;
else if (fd == STDOUT_FILENO) f = stdout;
else if (fd == STDERR_FILENO) f = stderr;
else return -1;
old_binary = f->__mode.__binary;
__set_binmode(f, binary ? 1 : 0);
return old_binary ? 1 : 0;
#elif (ACC_OS_TOS)
ACC_UNUSED(fd); ACC_UNUSED(binary);
return -1;
#elif (ACC_OS_DOS16 && (ACC_CC_AZTEC_C || ACC_CC_PACIFIC))
ACC_UNUSED(fd); ACC_UNUSED(binary);
return -1;
#elif defined(__DJGPP__)
int r;
unsigned old_flags = __djgpp_hwint_flags;
ACC_COMPILE_TIME_ASSERT(O_BINARY > 0)
ACC_COMPILE_TIME_ASSERT(O_TEXT > 0)
if (fd < 0)
return -1;
r = setmode(fd, binary ? O_BINARY : O_TEXT);
if ((old_flags & 1) != (__djgpp_hwint_flags & 1))
__djgpp_set_ctrl_c(!(old_flags & 1));
if (r == -1)
return -1;
return r & O_BINARY ? 1 : 0;
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64 || ACC_OS_CYGWIN || ACC_OS_EMX)
int r;
ACC_COMPILE_TIME_ASSERT(O_BINARY > 0)
ACC_COMPILE_TIME_ASSERT(O_TEXT > 0)
if (fd < 0)
return -1;
r = setmode(fd, binary ? O_BINARY : O_TEXT);
if (r == -1)
return -1;
return r & O_BINARY ? 1 : 0;
#else
if (fd < 0)
return -1;
ACC_UNUSED(binary);
return 1;
#endif
}
int acc_isatty(int fd)
{
if (fd < 0)
return 0;
#if (ACC_H_WINDOWS_H)
/* work around naive library implementations that think that
* any character device like `nul' is a tty */
{
long h = acc_get_osfhandle(fd);
if (h != -1)
{
DWORD d = 0;
int r = GetConsoleMode((HANDLE)h, &d);
/* fprintf(stderr, "GetConsoleMode %d 0x%lx\n", r, (long) d); */
if (!r)
return 0; /* GetConsoleMode failed -> not a tty */
}
}
#endif
return isatty(fd);
}
int acc_mkdir(const char* name, unsigned mode)
{
ACC_UNUSED(mode);
#if (ACC_OS_POSIX || ACC_OS_CYGWIN || ACC_OS_EMX)
return mkdir(name, mode);
#elif defined(__DJGPP__) || defined(__MINT__)
return mkdir(name, mode);
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
return Dcreate(name);
#elif (ACC_OS_DOS16 && ACC_CC_PACIFIC)
return mkdir((char*)name);
#else
return mkdir(name);
#endif
}
#if 0
int acc_response(int* argc, char*** argv)
{
}
#endif
/*
vi:ts=4:et
*/

72
src/acc/acc_lib.h Normal file
View File

@ -0,0 +1,72 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
#ifndef __ACC_LIB_H_INCLUDED
#define __ACC_LIB_H_INCLUDED
/*************************************************************************
// wrap <dirent.h>
**************************************************************************/
struct ACC_DIR { void* dirp; }; /* opaque type */
typedef struct ACC_DIR ACC_DIR;
struct acc_dirent
{
char d_name[255+1];
};
int acc_opendir(ACC_DIR* dirp, const char* name);
int acc_readdir(ACC_DIR* dirp, struct acc_dirent* d);
int acc_closedir(ACC_DIR* dirp);
/*************************************************************************
// wrap <fnmatch.h>
**************************************************************************/
/*************************************************************************
// wrap <getopt.h>
**************************************************************************/
/*************************************************************************
// wrap <string.h>
**************************************************************************/
/*************************************************************************
// wrap misc
**************************************************************************/
#if defined(__MINGW32__)
# define acc_alloca(x) __builtin_alloca((x))
#elif (HAVE_ALLOCA)
# define acc_alloca(x) alloca((x))
#endif
long acc_get_osfhandle(int fd);
int acc_isatty(int fd);
int acc_mkdir(const char* name, unsigned mode);
int acc_response(int* argc, char*** argv);
int acc_set_binmode(int fd, int binary);
#endif /* already included */
/*
vi:ts=4:et
*/

View File

@ -32,34 +32,73 @@
#endif
#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM)
# define ACC_MM_TINY 1
# define ACC_INFO_MM "tiny"
#elif defined(__HUGE__) || defined(M_I86HM) || defined(_M_I86HM)
# define ACC_MM_HUGE 1
# define ACC_INFO_MM "huge"
#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL)
# define ACC_MM_SMALL 1
# define ACC_INFO_MM "small"
#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM)
# define ACC_MM_MEDIUM 1
# define ACC_INFO_MM "medium"
#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM)
# define ACC_MM_COMPACT 1
# define ACC_INFO_MM "compact"
#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL)
# define ACC_MM_LARGE 1
# define ACC_INFO_MM "large"
#elif (ACC_CC_AZTEC_C)
# if defined(_LARGE_CODE) && defined(_LARGE_DATA)
# define ACC_MM_LARGE 1
# elif defined(_LARGE_CODE)
# define ACC_MM_MEDIUM 1
# elif defined(_LARGE_DATA)
# define ACC_MM_COMPACT 1
# else
# define ACC_MM_SMALL 1
# endif
#else
# error "unknown memory model"
#endif
#if (ACC_CC_AZTEC_C || ACC_CC_PACIFIC)
#elif (ACC_CC_DMC)
# define ACC_HAVE_MM_HUGE_PTR 1
#elif (ACC_CC_TURBOC && __TURBOC__ < 0x0295)
# define ACC_HAVE_MM_HUGE_PTR 1
#elif (ACC_CC_WATCOMC && __WATCOMC__ >= 1200)
/* __huge pointers seem completely broken in OpenWatcom 1.0 */
#else
# define ACC_HAVE_MM_HUGE_PTR 1 /* working __huge pointers */
# define ACC_HAVE_MM_HUGE_ARRAY 1 /* char __huge x[256*1024L] works */
#endif
#if (ACC_MM_TINY)
# undef ACC_HAVE_MM_HUGE_ARRAY
#endif
#else
# define ACC_MM_FLAT 1
# define ACC_INFO_MM "flat"
#endif
#if (ACC_MM_FLAT)
# define ACC_INFO_MM "flat"
#elif (ACC_MM_TINY)
# define ACC_INFO_MM "tiny"
#elif (ACC_MM_SMALL)
# define ACC_INFO_MM "small"
#elif (ACC_MM_MEDIUM)
# define ACC_INFO_MM "medium"
#elif (ACC_MM_COMPACT)
# define ACC_INFO_MM "compact"
#elif (ACC_MM_LARGE)
# define ACC_INFO_MM "large"
#elif (ACC_MM_HUGE)
# define ACC_INFO_MM "huge"
#else
# error "unknown memory model"
#endif
/*
vi:ts=4:et
*/

View File

@ -21,7 +21,7 @@
* ACC_OS_CYGWIN hybrid WIN32 and POSIX
* ACC_OS_DOS16 16-bit DOS (segmented memory model)
* ACC_OS_DOS32
* ACC_OS_EMX hybrid OS/2, DOS32 and POSIX
* ACC_OS_EMX hybrid OS/2, DOS32, WIN32 (with RSX) and POSIX
* ACC_OS_MAC9 Macintosh Classic
* ACC_OS_MACOSX Mac OS/X
* ACC_OS_PALMOS
@ -134,6 +134,9 @@
# elif defined(__OpenBSD__)
# define ACC_OS_POSIX_OPENBSD 1
# define ACC_INFO_OS_POSIX "openbsd"
# elif defined(__osf__)
# define ACC_OS_POSIX_OSF 1
# define ACC_INFO_OS_POSIX "osf"
# elif defined(__solaris__) || defined(__sun)
# if defined(__SVR4) || defined(__svr4__)
# define ACC_OS_POSIX_SOLARIS 1
@ -161,6 +164,9 @@
# if (UINT_MAX != 0xffffffffL)
# error "this should not happen"
# endif
# if (ULONG_MAX != 0xffffffffL)
# error "this should not happen"
# endif
#endif

56
src/acc/acc_type.h Normal file
View File

@ -0,0 +1,56 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
/***********************************************************************
//
************************************************************************/
#if (ACC_CC_GNUC >= 0x020800l) /* 2.8.0 */
# define __acc_gnuc_extension__ __extension__
#else
# define __acc_gnuc_extension__
#endif
#if (SIZEOF_LONG_LONG > 0)
__acc_gnuc_extension__ typedef long long acc_llong_t;
#endif
#if (SIZEOF_UNSIGNED_LONG_LONG > 0)
__acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
#endif
#if (SIZEOF___INT64 > 0)
__acc_gnuc_extension__ typedef __int64 acc_int64_t;
#endif
#if (SIZEOF_UNSIGNED___INT64 > 0)
__acc_gnuc_extension__ typedef unsigned __int64 acc_uint64_t;
#endif
#if !defined(ACC_UINT32_C)
# if defined(__PACIFIC__) && defined(DOS)
/* workaround Pacific C */
# define ACC_UINT32_C(c) c
# elif (UINT_MAX < __ACC_UINT_MAX(32))
# define ACC_UINT32_C(c) c ## UL
# else
# define ACC_UINT32_C(c) c ## U
# endif
#endif
/*
vi:ts=4:et
*/