require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_SPAWN_H_)) {
    eval 'sub _SYS_SPAWN_H_ () {1;}' unless defined(&_SYS_SPAWN_H_);
    require 'sys/cdefs.ph';
    require 'sys/featuretest.ph';
    require 'sys/types.ph';
    require 'sys/sigtypes.ph';
    require 'sys/signal.ph';
    require 'sys/sched.ph';
    eval("sub FAE_OPEN () { 0; }") unless defined(&FAE_OPEN);
    eval("sub FAE_DUP2 () { 1; }") unless defined(&FAE_DUP2);
    eval("sub FAE_CLOSE () { 2; }") unless defined(&FAE_CLOSE);
    eval("sub FAE_CHDIR () { 3; }") unless defined(&FAE_CHDIR);
    eval("sub FAE_FCHDIR () { 4; }") unless defined(&FAE_FCHDIR);
    eval 'sub fae_path () { ($fae_data->{open}->{path});}' unless defined(&fae_path);
    eval 'sub fae_oflag () { ($fae_data->{open}->{oflag});}' unless defined(&fae_oflag);
    eval 'sub fae_mode () { ($fae_data->{open}->{mode});}' unless defined(&fae_mode);
    eval 'sub fae_newfildes () { ($fae_data->{dup2}->{newfildes});}' unless defined(&fae_newfildes);
    eval 'sub fae_chdir_path () { ($fae_data->{chdir}->{path});}' unless defined(&fae_chdir_path);
    eval 'sub POSIX_SPAWN_RESETIDS () {0x1;}' unless defined(&POSIX_SPAWN_RESETIDS);
    eval 'sub POSIX_SPAWN_SETPGROUP () {0x2;}' unless defined(&POSIX_SPAWN_SETPGROUP);
    eval 'sub POSIX_SPAWN_SETSCHEDPARAM () {0x4;}' unless defined(&POSIX_SPAWN_SETSCHEDPARAM);
    eval 'sub POSIX_SPAWN_SETSCHEDULER () {0x8;}' unless defined(&POSIX_SPAWN_SETSCHEDULER);
    eval 'sub POSIX_SPAWN_SETSIGDEF () {0x10;}' unless defined(&POSIX_SPAWN_SETSIGDEF);
    eval 'sub POSIX_SPAWN_SETSIGMASK () {0x20;}' unless defined(&POSIX_SPAWN_SETSIGMASK);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub POSIX_SPAWN_RETURNERROR () {0x40;}' unless defined(&POSIX_SPAWN_RETURNERROR);
    }
}
1;
