require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&HEIM_BASE_H)) {
    eval 'sub HEIM_BASE_H () {1;}' unless defined(&HEIM_BASE_H);
    require 'sys/types.ph';
    if(!defined(&WIN32)  && !defined(&HAVE_DISPATCH_DISPATCH_H)  && defined(&ENABLE_PTHREAD_SUPPORT)) {
	require 'pthread.ph';
    }
    require 'krb5/krb5-types.ph';
    require 'stdarg.ph';
    if(defined(&HAVE_STDBOOL_H)) {
	require 'stdbool.ph';
    } else {
	unless(defined(&false)) {
	    eval 'sub false () {0;}' unless defined(&false);
	}
	unless(defined(&true)) {
	    eval 'sub true () {1;}' unless defined(&true);
	}
    }
    eval 'sub HEIM_BASE_API_VERSION () {20130210;}' unless defined(&HEIM_BASE_API_VERSION);
    if(defined(&WIN32)) {
	eval 'sub HEIM_BASE_ONCE_INIT () {0;}' unless defined(&HEIM_BASE_ONCE_INIT);
    }
 elsif(defined(&HAVE_DISPATCH_DISPATCH_H)) {
	eval 'sub HEIM_BASE_ONCE_INIT () {0;}' unless defined(&HEIM_BASE_ONCE_INIT);
    }
 elsif(defined(&ENABLE_PTHREAD_SUPPORT)) {
	eval 'sub HEIM_BASE_ONCE_INIT () { &PTHREAD_ONCE_INIT;}' unless defined(&HEIM_BASE_ONCE_INIT);
    } else {
	eval 'sub HEIM_BASE_ONCE_INIT () {0;}' unless defined(&HEIM_BASE_ONCE_INIT);
    }
    if(!defined(&__has_extension)) {
	eval 'sub __has_extension {
	    my($x) = @_;
    	    eval q(0);
	}' unless defined(&__has_extension);
    }
    eval 'sub HEIM_REQUIRE_GNUC {
        my($m,$n,$p) = @_;
	    eval q(((( &__GNUC__ * 10000) + ( &__GNUC_MINOR__ * 100) +  &__GNUC_PATCHLEVEL__) >= ((($m) * 10000) + (($n) * 100) + ($p))));
    }' unless defined(&HEIM_REQUIRE_GNUC);
    if( &__has_extension((defined(&__builtin_expect) ? &__builtin_expect : undef)) ||  &HEIM_REQUIRE_GNUC(3,0,0)) {
	eval 'sub heim_builtin_expect {
	    my($_op,$_res) = @_;
    	    eval q( &__builtin_expect($_op,$_res));
	}' unless defined(&heim_builtin_expect);
    } else {
	eval 'sub heim_builtin_expect {
	    my($_op,$_res) = @_;
    	    eval q(($_op));
	}' unless defined(&heim_builtin_expect);
    }
    eval 'sub heim_assert {
        my($e,$t) = @_;
	    eval q(( &heim_builtin_expect(!($e), 0) ?  &heim_abort($t \\":\\" $e) : ( &void)0));
    }' unless defined(&heim_assert);
    if(defined(&__BLOCKS__)) {
    }
    if(defined(&__BLOCKS__)) {
    }
    if(defined(&__BLOCKS__)) {
    }
    eval 'sub HSTR {
        my($_str) = @_;
	    eval q(( &__heim_string_constant(\\"\\" $_str \\"\\")));
    }' unless defined(&HSTR);
    unless(defined(&__HEIM_BASE_DATA__)) {
	eval 'sub __HEIM_BASE_DATA__ () {1;}' unless defined(&__HEIM_BASE_DATA__);
    }
    eval 'sub HEIM_DB_TYPE_VERSION_01 () {1;}' unless defined(&HEIM_DB_TYPE_VERSION_01);
    if(defined(&__BLOCKS__)) {
    }
    eval("sub HEIM_JSON_F_NO_C_NULL () { 1; }") unless defined(&HEIM_JSON_F_NO_C_NULL);
    eval("sub HEIM_JSON_F_STRICT_STRINGS () { 2; }") unless defined(&HEIM_JSON_F_STRICT_STRINGS);
    eval("sub HEIM_JSON_F_NO_DATA () { 4; }") unless defined(&HEIM_JSON_F_NO_DATA);
    eval("sub HEIM_JSON_F_NO_DATA_DICT () { 8; }") unless defined(&HEIM_JSON_F_NO_DATA_DICT);
    eval("sub HEIM_JSON_F_STRICT_DICT () { 16; }") unless defined(&HEIM_JSON_F_STRICT_DICT);
    eval("sub HEIM_JSON_F_STRICT () { 31; }") unless defined(&HEIM_JSON_F_STRICT);
    eval("sub HEIM_JSON_F_CNULL2JSNULL () { 32; }") unless defined(&HEIM_JSON_F_CNULL2JSNULL);
    eval("sub HEIM_JSON_F_TRY_DECODE_DATA () { 64; }") unless defined(&HEIM_JSON_F_TRY_DECODE_DATA);
    eval("sub HEIM_JSON_F_ONE_LINE () { 128; }") unless defined(&HEIM_JSON_F_ONE_LINE);
}
1;
