require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_STDARG_H_)) {
    eval 'sub _SYS_STDARG_H_ () {1;}' unless defined(&_SYS_STDARG_H_);
    require 'sys/cdefs.ph';
    require 'sys/ansi.ph';
    require 'sys/featuretest.ph';
    if(defined(&__lint__)) {
	eval 'sub __builtin_next_arg {
	    my($t) = @_;
    	    eval q((($t) ? 0: 0));
	}' unless defined(&__builtin_next_arg);
	eval 'sub __builtin_va_start {
	    my($a, $l) = @_;
    	    eval q((($a) = ( &va_list)( &void *)($l)));
	}' unless defined(&__builtin_va_start);
	eval 'sub __builtin_va_arg {
	    my($a, $t) = @_;
    	    eval q((($a) ? ($t) 0: ($t) 0));
	}' unless defined(&__builtin_va_arg);
	eval 'sub __builtin_va_end {
	    my($a) = @_;
    	    eval q( &__nothing);
	}' unless defined(&__builtin_va_end);
	eval 'sub __builtin_va_copy {
	    my($d, $s) = @_;
    	    eval q((($d) = ($s)));
	}' unless defined(&__builtin_va_copy);
    }
 elsif(!( &__GNUC_PREREQ__(4, 5) || ( &__GNUC_PREREQ__(4, 4)  && (defined(&__GNUC_PATCHLEVEL__) ? &__GNUC_PATCHLEVEL__ : undef) > 2) || defined(&__clang__))) {
	eval 'sub __builtin_va_start {
	    my($ap, $last) = @_;
    	    eval q( &__builtin_stdarg_start(($ap), ($last)));
	}' unless defined(&__builtin_va_start);
    }
    unless(defined(&__VA_LIST_DECLARED)) {
	eval 'sub __VA_LIST_DECLARED () {1;}' unless defined(&__VA_LIST_DECLARED);
    }
    eval 'sub va_start {
        my($ap, $last) = @_;
	    eval q( &__builtin_va_start(($ap), ($last)));
    }' unless defined(&va_start);
    eval 'sub va_arg () { &__builtin_va_arg;}' unless defined(&va_arg);
    eval 'sub va_end {
        my($ap) = @_;
	    eval q( &__builtin_va_end($ap));
    }' unless defined(&va_end);
    eval 'sub __va_copy {
        my($dest, $src) = @_;
	    eval q( &__builtin_va_copy(($dest), ($src)));
    }' unless defined(&__va_copy);
    if(!defined(&_ANSI_SOURCE)  && (defined(&_ISOC99_SOURCE) || ((defined(&__STDC_VERSION__) ? &__STDC_VERSION__ : undef) - 0) >= 199901 || defined(&_NETBSD_SOURCE))) {
	eval 'sub va_copy {
	    my($dest, $src) = @_;
    	    eval q( &__va_copy(($dest), ($src)));
	}' unless defined(&va_copy);
    }
}
1;
