require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_ARM_LIMITS_H_)) {
    eval 'sub _ARM_LIMITS_H_ () {1;}' unless defined(&_ARM_LIMITS_H_);
    require 'sys/featuretest.ph';
    eval 'sub CHAR_BIT () {8;}' unless defined(&CHAR_BIT);
    eval 'sub UCHAR_MAX () {0xff;}' unless defined(&UCHAR_MAX);
    eval 'sub SCHAR_MAX () {0x7f;}' unless defined(&SCHAR_MAX);
    eval 'sub SCHAR_MIN () {(-0x7f-1);}' unless defined(&SCHAR_MIN);
    eval 'sub USHRT_MAX () {0xffff;}' unless defined(&USHRT_MAX);
    eval 'sub SHRT_MAX () {0x7fff;}' unless defined(&SHRT_MAX);
    eval 'sub SHRT_MIN () {(-0x7fff-1);}' unless defined(&SHRT_MIN);
    eval 'sub UINT_MAX () {0xffffffff;}' unless defined(&UINT_MAX);
    eval 'sub INT_MAX () {0x7fffffff;}' unless defined(&INT_MAX);
    eval 'sub INT_MIN () {(-0x7fffffff-1);}' unless defined(&INT_MIN);
    if(defined(&_LP64)) {
	eval 'sub ULONG_MAX () {0xffffffffffffffff;}' unless defined(&ULONG_MAX);
	eval 'sub LONG_MAX () {0x7fffffffffffffff;}' unless defined(&LONG_MAX);
	eval 'sub LONG_MIN () {(-0x7fffffffffffffff-1);}' unless defined(&LONG_MIN);
    } else {
	eval 'sub ULONG_MAX () {0xffffffff;}' unless defined(&ULONG_MAX);
	eval 'sub LONG_MAX () {0x7fffffff;}' unless defined(&LONG_MAX);
	eval 'sub LONG_MIN () {(-0x7fffffff-1);}' unless defined(&LONG_MIN);
    }
    if(defined(&_ISOC99_SOURCE) || ((defined(&__STDC_VERSION__) ? &__STDC_VERSION__ : undef) - 0) >= 199901 || defined(&_NETBSD_SOURCE)) {
	eval 'sub ULLONG_MAX () {0xffffffffffffffff;}' unless defined(&ULLONG_MAX);
	eval 'sub LLONG_MAX () {0x7fffffffffffffff;}' unless defined(&LLONG_MAX);
	eval 'sub LLONG_MIN () {(-0x7fffffffffffffff-1);}' unless defined(&LLONG_MIN);
    }
    if(defined(&_POSIX_C_SOURCE) || defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	eval 'sub SSIZE_MAX () { &LONG_MAX;}' unless defined(&SSIZE_MAX);
	if(defined(&_NETBSD_SOURCE)) {
	    eval 'sub SSIZE_MIN () { &LONG_MIN;}' unless defined(&SSIZE_MIN);
	    eval 'sub SIZE_T_MAX () { &ULONG_MAX;}' unless defined(&SIZE_T_MAX);
	    eval 'sub UQUAD_MAX () {0xffffffffffffffff;}' unless defined(&UQUAD_MAX);
	    eval 'sub QUAD_MAX () {0x7fffffffffffffff;}' unless defined(&QUAD_MAX);
	    eval 'sub QUAD_MIN () {(-0x7fffffffffffffff-1);}' unless defined(&QUAD_MIN);
	}
    }
    if(defined(&_XOPEN_SOURCE) || defined(&_NETBSD_SOURCE)) {
	if(defined(&_LP64)) {
	    eval 'sub LONG_BIT () {64;}' unless defined(&LONG_BIT);
	} else {
	    eval 'sub LONG_BIT () {32;}' unless defined(&LONG_BIT);
	}
	eval 'sub WORD_BIT () {32;}' unless defined(&WORD_BIT);
	eval 'sub DBL_DIG () { &__DBL_DIG__;}' unless defined(&DBL_DIG);
	eval 'sub DBL_MAX () { &__DBL_MAX__;}' unless defined(&DBL_MAX);
	eval 'sub DBL_MIN () { &__DBL_MIN__;}' unless defined(&DBL_MIN);
	eval 'sub FLT_DIG () { &__FLT_DIG__;}' unless defined(&FLT_DIG);
	eval 'sub FLT_MAX () { &__FLT_MAX__;}' unless defined(&FLT_MAX);
	eval 'sub FLT_MIN () { &__FLT_MIN__;}' unless defined(&FLT_MIN);
	if(defined(&__ARM_PCS_AAPCS64)) {
	    eval 'sub LDBL_DIG () { &__LDBL_DIG__;}' unless defined(&LDBL_DIG);
	    eval 'sub LDBL_MAX () { &__LDBL_MAX__;}' unless defined(&LDBL_MAX);
	    eval 'sub LDBL_MIN () { &__LDBL_MIN__;}' unless defined(&LDBL_MIN);
	}
    }
}
1;
