require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_LIB_PTHREAD_TYPES_H)) {
    eval 'sub _LIB_PTHREAD_TYPES_H () {1;}' unless defined(&_LIB_PTHREAD_TYPES_H);
    if(defined(&__cplusplus)) {
	eval 'sub __pthread_volatile () {1;}' unless defined(&__pthread_volatile);
    } else {
	eval 'sub __pthread_volatile () { &volatile;}' unless defined(&__pthread_volatile);
    }
    eval 'sub _PTQ_HEAD {
        my($name, $type) = @_;
	    eval q(\'struct name\' { \'struct type\' * &ptqh_first; \'struct type\' ** &ptqh_last; });
    }' unless defined(&_PTQ_HEAD);
    if(defined(&__CPU_SIMPLE_LOCK_PAD)) {
	if((defined(&__SIMPLELOCK_UNLOCKED) ? &__SIMPLELOCK_UNLOCKED : undef) != 0) {
	    die("__CPU_SIMPLE_LOCK_PAD\ incompatible\ with\ __SIMPLELOCK_UNLOCKED\ \=\=\ 0");
	}
    }
    if(defined(&__CPU_SIMPLE_LOCK_PAD)) {
	if(((defined(&__STDC_VERSION__) ? &__STDC_VERSION__ : undef) - 0) >= 199901) {
	    eval 'sub _PTHREAD_MUTEX_PAD {
	        my($a) = @_;
    		eval q(.$a = { 0, 0, 0},);
	    }' unless defined(&_PTHREAD_MUTEX_PAD);
	} else {
	    eval 'sub _PTHREAD_MUTEX_PAD {
	        my($a) = @_;
    		eval q({ 0, 0, 0},);
	    }' unless defined(&_PTHREAD_MUTEX_PAD);
	}
    } else {
	eval 'sub _PTHREAD_MUTEX_PAD {
	    my($a) = @_;
    	    eval q();
	}' unless defined(&_PTHREAD_MUTEX_PAD);
    }
    if(defined(&__CPU_SIMPLE_LOCK_PAD)) {
    }
    eval 'sub _PT_MUTEX_MAGIC () {0x33330003;}' unless defined(&_PT_MUTEX_MAGIC);
    eval 'sub _PT_MUTEX_DEAD () {0xdead0003;}' unless defined(&_PT_MUTEX_DEAD);
    if(((defined(&__STDC_VERSION__) ? &__STDC_VERSION__ : undef) - 0) >= 199901) {
	eval 'sub _PTHREAD_MUTEX_INI {
	    my($a, $b) = @_;
    	    eval q(.$a = $b);
	}' unless defined(&_PTHREAD_MUTEX_INI);
	eval 'sub _PTHREAD_MUTEX_UNI {
	    my($a) = @_;
    	    eval q(.$a = 0);
	}' unless defined(&_PTHREAD_MUTEX_UNI);
    } else {
	eval 'sub _PTHREAD_MUTEX_INI {
	    my($a, $b) = @_;
    	    eval q($b);
	}' unless defined(&_PTHREAD_MUTEX_INI);
	eval 'sub _PTHREAD_MUTEX_UNI {
	    my($a) = @_;
    	    eval q({ 0});
	}' unless defined(&_PTHREAD_MUTEX_UNI);
    }
    eval 'sub _PTHREAD_MUTEX_INITIALIZER () {{  &_PTHREAD_MUTEX_INI( &ptm_magic,  &_PT_MUTEX_MAGIC),  &_PTHREAD_MUTEX_INI( &ptm_errorcheck,  &__SIMPLELOCK_UNLOCKED),  &_PTHREAD_MUTEX_PAD( &ptm_pad1)  &_PTHREAD_MUTEX_UNI( &ptm_ceiling),  &_PTHREAD_MUTEX_PAD( &ptm_pad2)  &_PTHREAD_MUTEX_INI( &ptm_owner,  &NULL),  &_PTHREAD_MUTEX_INI( &ptm_waiters,  &NULL),  &_PTHREAD_MUTEX_INI( &ptm_recursed, 0),  &_PTHREAD_MUTEX_INI( &ptm_spare2,  &NULL), };}' unless defined(&_PTHREAD_MUTEX_INITIALIZER);
    eval 'sub _PT_MUTEXATTR_MAGIC () {0x44440004;}' unless defined(&_PT_MUTEXATTR_MAGIC);
    eval 'sub _PT_MUTEXATTR_DEAD () {0xdead0004;}' unless defined(&_PT_MUTEXATTR_DEAD);
    eval 'sub _PT_COND_MAGIC () {0x55550005;}' unless defined(&_PT_COND_MAGIC);
    eval 'sub _PT_COND_DEAD () {0xdead0005;}' unless defined(&_PT_COND_DEAD);
    eval 'sub _PTHREAD_COND_INITIALIZER () {{  &_PT_COND_MAGIC,  &__SIMPLELOCK_UNLOCKED,  &NULL,  &NULL,  &NULL,  &NULL };}' unless defined(&_PTHREAD_COND_INITIALIZER);
    eval 'sub _PT_CONDATTR_MAGIC () {0x66660006;}' unless defined(&_PT_CONDATTR_MAGIC);
    eval 'sub _PT_CONDATTR_DEAD () {0xdead0006;}' unless defined(&_PT_CONDATTR_DEAD);
    eval 'sub _PTHREAD_ONCE_INIT () {{  &PTHREAD_MUTEX_INITIALIZER, 0};}' unless defined(&_PTHREAD_ONCE_INIT);
    eval 'sub _PT_SPINLOCK_MAGIC () {0x77770007;}' unless defined(&_PT_SPINLOCK_MAGIC);
    eval 'sub _PT_SPINLOCK_DEAD () {0xdead0007;}' unless defined(&_PT_SPINLOCK_DEAD);
    eval 'sub _PT_SPINLOCK_PSHARED () {0x1;}' unless defined(&_PT_SPINLOCK_PSHARED);
    eval 'sub _PTHREAD_SPINLOCK_INITIALIZER () {{  &_PT_SPINLOCK_MAGIC,  &__SIMPLELOCK_UNLOCKED, 0};}' unless defined(&_PTHREAD_SPINLOCK_INITIALIZER);
    eval 'sub _PT_RWLOCK_MAGIC () {0x99990009;}' unless defined(&_PT_RWLOCK_MAGIC);
    eval 'sub _PT_RWLOCK_DEAD () {0xdead0009;}' unless defined(&_PT_RWLOCK_DEAD);
    eval 'sub _PTHREAD_RWLOCK_INITIALIZER () {{  &_PT_RWLOCK_MAGIC,  &__SIMPLELOCK_UNLOCKED, { &NULL,  &NULL}, { &NULL,  &NULL}, 0,  &NULL,  &NULL, };}' unless defined(&_PTHREAD_RWLOCK_INITIALIZER);
    eval 'sub _PT_RWLOCKATTR_MAGIC () {0x99990909;}' unless defined(&_PT_RWLOCKATTR_MAGIC);
    eval 'sub _PT_RWLOCKATTR_DEAD () {0xdead0909;}' unless defined(&_PT_RWLOCKATTR_DEAD);
    eval 'sub _PT_BARRIER_MAGIC () {0x88880008;}' unless defined(&_PT_BARRIER_MAGIC);
    eval 'sub _PT_BARRIER_DEAD () {0xdead0008;}' unless defined(&_PT_BARRIER_DEAD);
    eval 'sub _PT_BARRIERATTR_MAGIC () {0x88880808;}' unless defined(&_PT_BARRIERATTR_MAGIC);
    eval 'sub _PT_BARRIERATTR_DEAD () {0xdead0808;}' unless defined(&_PT_BARRIERATTR_DEAD);
}
1;
