require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_THREADS_H_)) {
    eval 'sub _THREADS_H_ () {1;}' unless defined(&_THREADS_H_);
    require 'sys/cdefs.ph';
    require 'limits.ph';
    require 'pthread.ph';
    require 'stdint.ph';
    require 'time.ph';
    unless(defined(&__thread_local_is_defined)) {
	if((((defined(&__cplusplus) ? &__cplusplus : undef) - 0) < 201103)) {
	    eval 'sub thread_local () { &_Thread_local;}' unless defined(&thread_local);
	}
	eval 'sub __thread_local_is_defined () {1;}' unless defined(&__thread_local_is_defined);
    }
    unless(defined(&ONCE_FLAG_INIT)) {
	eval 'sub ONCE_FLAG_INIT () { &PTHREAD_ONCE_INIT;}' unless defined(&ONCE_FLAG_INIT);
    }
    unless(defined(&TSS_DTOR_ITERATIONS)) {
	eval 'sub TSS_DTOR_ITERATIONS () { &PTHREAD_DESTRUCTOR_ITERATIONS;}' unless defined(&TSS_DTOR_ITERATIONS);
    }
    eval("sub mtx_plain () { 1; }") unless defined(&mtx_plain);
    eval("sub mtx_recursive () { 2; }") unless defined(&mtx_recursive);
    eval("sub mtx_timed () { 4; }") unless defined(&mtx_timed);
    eval("sub _MTX_MAXTYPE () { 0x7fffffff; }") unless defined(&_MTX_MAXTYPE);
    eval("sub thrd_timedout () { -1; }") unless defined(&thrd_timedout);
    eval("sub thrd_success () { 0; }") unless defined(&thrd_success);
    eval("sub thrd_busy () { 1; }") unless defined(&thrd_busy);
    eval("sub thrd_error () { 2; }") unless defined(&thrd_error);
    eval("sub thrd_nomem () { 3; }") unless defined(&thrd_nomem);
    eval("sub _THRD_MAXTYPE () { 0x7fffffff; }") unless defined(&_THRD_MAXTYPE);
}
1;
