require '_h2ph_pre.ph';

unless(defined(&_LINUX_LINKAGE_H)) {
    eval 'sub _LINUX_LINKAGE_H () {1;}' unless defined(&_LINUX_LINKAGE_H);
    require 'linux/config.ph';
    if(defined(&__cplusplus)) {
	eval 'sub CPP_ASMLINKAGE () { &extern "C";}' unless defined(&CPP_ASMLINKAGE);
    } else {
	eval 'sub CPP_ASMLINKAGE () {1;}' unless defined(&CPP_ASMLINKAGE);
    }
    if(defined (defined(&__i386__) ? &__i386__ : 0)) {
	eval 'sub asmlinkage () { &CPP_ASMLINKAGE  &__attribute__(( &regparm(0)));}' unless defined(&asmlinkage);
    }
 elsif(defined (defined(&__ia64__) ? &__ia64__ : 0)) {
	eval 'sub asmlinkage () { &CPP_ASMLINKAGE  &__attribute__(( &syscall_linkage));}' unless defined(&asmlinkage);
    } else {
	eval 'sub asmlinkage () { &CPP_ASMLINKAGE;}' unless defined(&asmlinkage);
    }
    eval 'sub SYMBOL_NAME_STR {
        local($X) = @_;
	    eval q($X);
    }' unless defined(&SYMBOL_NAME_STR);
    eval 'sub SYMBOL_NAME {
        local($X) = @_;
	    eval q($X);
    }' unless defined(&SYMBOL_NAME);
    if(defined(&__STDC__)) {
	eval 'sub SYMBOL_NAME_LABEL {
	    local($X) = @_;
    	    eval q($X:);
	}' unless defined(&SYMBOL_NAME_LABEL);
    } else {
	eval 'sub SYMBOL_NAME_LABEL {
	    local($X) = @_;
    	    eval q($X :);
	}' unless defined(&SYMBOL_NAME_LABEL);
    }
    if(defined(&__arm__)) {
	eval 'sub __ALIGN () {. &align 0;}' unless defined(&__ALIGN);
	eval 'sub __ALIGN_STR () {".align 0";}' unless defined(&__ALIGN_STR);
    } else {
	if(defined(&__mc68000__)) {
	    eval 'sub __ALIGN () {. &align 4;}' unless defined(&__ALIGN);
	    eval 'sub __ALIGN_STR () {".align 4";}' unless defined(&__ALIGN_STR);
	} else {
	    if(defined(&__sh__)) {
		eval 'sub __ALIGN () {. &balign 4;}' unless defined(&__ALIGN);
		eval 'sub __ALIGN_STR () {".balign 4";}' unless defined(&__ALIGN_STR);
	    } else {
		if(defined( &__i386__)  && defined( &CONFIG_X86_ALIGNMENT_16)) {
		    eval 'sub __ALIGN () {. &align 16,0x90;}' unless defined(&__ALIGN);
		    eval 'sub __ALIGN_STR () {".align 16,0x90";}' unless defined(&__ALIGN_STR);
		} else {
		    eval 'sub __ALIGN () {. &align 4,0x90;}' unless defined(&__ALIGN);
		    eval 'sub __ALIGN_STR () {".align 4,0x90";}' unless defined(&__ALIGN_STR);
		}
	    }
	}
    }
    if(defined(&__ASSEMBLY__)) {
	eval 'sub ALIGN () { &__ALIGN;}' unless defined(&ALIGN);
	eval 'sub ALIGN_STR () { &__ALIGN_STR;}' unless defined(&ALIGN_STR);
	eval 'sub ENTRY {
	    local($name) = @_;
    	    eval q(. &globl  &SYMBOL_NAME($name);  &ALIGN;  &SYMBOL_NAME_LABEL($name));
	}' unless defined(&ENTRY);
    }
}
1;
