require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_ARM_PARAM_H_)) {
    eval 'sub _ARM_PARAM_H_ () {1;}' unless defined(&_ARM_PARAM_H_);
    if(defined(&_KERNEL)) {
	unless(defined(&MACHINE_ARCH)) {
	    unless(defined(&__ARMEB__)) {
		if(defined(&__ARM_EABI__)) {
		    eval 'sub _MACHINE_ARCH () { &earm;}' unless defined(&_MACHINE_ARCH);
		    eval 'sub MACHINE_ARCH () {"earm";}' unless defined(&MACHINE_ARCH);
		} else {
		    eval 'sub _MACHINE_ARCH () { &arm;}' unless defined(&_MACHINE_ARCH);
		    eval 'sub MACHINE_ARCH () {"arm";}' unless defined(&MACHINE_ARCH);
		}
	    } else {
		if(defined(&__ARM_EABI__)) {
		    eval 'sub _MACHINE_ARCH () { &earmeb;}' unless defined(&_MACHINE_ARCH);
		    eval 'sub MACHINE_ARCH () {"earmeb";}' unless defined(&MACHINE_ARCH);
		} else {
		    eval 'sub _MACHINE_ARCH () { &armeb;}' unless defined(&_MACHINE_ARCH);
		    eval 'sub MACHINE_ARCH () {"armeb";}' unless defined(&MACHINE_ARCH);
		}
	    }
	}
    } else {
	undef(&_MACHINE) if defined(&_MACHINE);
	undef(&MACHINE) if defined(&MACHINE);
	undef(&_MACHINE_ARCH) if defined(&_MACHINE_ARCH);
	undef(&MACHINE_ARCH) if defined(&MACHINE_ARCH);
	eval 'sub _MACHINE () { &arm;}' unless defined(&_MACHINE);
	eval 'sub MACHINE () {"arm";}' unless defined(&MACHINE);
	unless(defined(&__ARMEB__)) {
	    if(defined(&__ARM_EABI__)) {
		if(defined(&__ARM_PCS_VFP)) {
		    if(defined(&_ARM_ARCH_7)) {
			eval 'sub _MACHINE_ARCH () { &earmv7hf;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv7hf";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(defined(&_ARM_ARCH_6)) {
			eval 'sub _MACHINE_ARCH () { &earmv6hf;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv6hf";}' unless defined(&MACHINE_ARCH);
		    } else {
			eval 'sub _MACHINE_ARCH () { &earmhf;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmhf";}' unless defined(&MACHINE_ARCH);
		    }
		} else {
		    if(defined(&_ARM_ARCH_7)) {
			eval 'sub _MACHINE_ARCH () { &earmv7;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv7";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(defined(&_ARM_ARCH_6)) {
			eval 'sub _MACHINE_ARCH () { &earmv6;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv6";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(!defined(&_ARM_ARCH_5T)) {
			eval 'sub _MACHINE_ARCH () { &earmv4;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv4";}' unless defined(&MACHINE_ARCH);
		    } else {
			eval 'sub _MACHINE_ARCH () { &earm;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earm";}' unless defined(&MACHINE_ARCH);
		    }
		}
	    } else {
		eval 'sub _MACHINE_ARCH () { &arm;}' unless defined(&_MACHINE_ARCH);
		eval 'sub MACHINE_ARCH () {"arm";}' unless defined(&MACHINE_ARCH);
	    }
	} else {
	    if(defined(&__ARM_EABI__)) {
		if(defined(&__ARM_PCS_VFP)) {
		    if(defined(&_ARM_ARCH_7)) {
			eval 'sub _MACHINE_ARCH () { &earmv7hfeb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv7hfeb";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(defined(&_ARM_ARCH_6)) {
			eval 'sub _MACHINE_ARCH () { &earmv6hfeb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv6hfeb";}' unless defined(&MACHINE_ARCH);
		    } else {
			eval 'sub _MACHINE_ARCH () { &earmhfeb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmhfeb";}' unless defined(&MACHINE_ARCH);
		    }
		} else {
		    if(defined(&_ARM_ARCH_7)) {
			eval 'sub _MACHINE_ARCH () { &earmv7eb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv7eb";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(defined(&_ARM_ARCH_6)) {
			eval 'sub _MACHINE_ARCH () { &earmv6eb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv6eb";}' unless defined(&MACHINE_ARCH);
		    }
 elsif(!defined(&_ARM_ARCH_5T)) {
			eval 'sub _MACHINE_ARCH () { &earmv4eb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmv4eb";}' unless defined(&MACHINE_ARCH);
		    } else {
			eval 'sub _MACHINE_ARCH () { &earmeb;}' unless defined(&_MACHINE_ARCH);
			eval 'sub MACHINE_ARCH () {"earmeb";}' unless defined(&MACHINE_ARCH);
		    }
		}
	    } else {
		eval 'sub _MACHINE_ARCH () { &armeb;}' unless defined(&_MACHINE_ARCH);
		eval 'sub MACHINE_ARCH () {"armeb";}' unless defined(&MACHINE_ARCH);
	    }
	}
    }
    eval 'sub MAXCPUS () {8;}' unless defined(&MAXCPUS);
    eval 'sub MID_MACHINE () { &MID_ARM6;}' unless defined(&MID_MACHINE);
    eval 'sub STACK_ALIGNBYTES () {(8- 1);}' unless defined(&STACK_ALIGNBYTES);
    if(defined(&__ARM_EABI__)) {
	eval 'sub ALIGNBYTES32 () {3;}' unless defined(&ALIGNBYTES32);
    } else {
	eval 'sub ALIGNBYTES32 () {7;}' unless defined(&ALIGNBYTES32);
    }
    eval 'sub MSIZE () {256;}' unless defined(&MSIZE);
    unless(defined(&MCLSHIFT)) {
	eval 'sub MCLSHIFT () {11;}' unless defined(&MCLSHIFT);
    }
    eval 'sub MCLBYTES () {(1<<  &MCLSHIFT);}' unless defined(&MCLBYTES);
    unless(defined(&NMBCLUSTERS_MAX)) {
	eval 'sub NMBCLUSTERS_MAX () {(0x4000000 /  &MCLBYTES);}' unless defined(&NMBCLUSTERS_MAX);
    }
    if(defined(&_KERNEL)) {
	if(defined(&COMPAT_16)) {
	    eval 'sub COMPAT_ZERODEV {
	        my($x) = @_;
    		eval q(($x ==  &makedev(0,  &_DEV_ZERO_oARM)));
	    }' unless defined(&COMPAT_ZERODEV);
	}
    }
}
1;
