require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_DLFCN_H_)) {
    eval 'sub _DLFCN_H_ () {1;}' unless defined(&_DLFCN_H_);
    require 'sys/featuretest.ph';
    require 'sys/cdefs.ph';
    require 'machine/ansi.ph';
    if(defined(&_BSD_SSIZE_T_)) {
	undef(&_BSD_SSIZE_T_) if defined(&_BSD_SSIZE_T_);
    }
    if(defined(&_NETBSD_SOURCE)) {
    }
    if(defined(&_NETBSD_SOURCE)) {
    }
    eval 'sub RTLD_LAZY () {1;}' unless defined(&RTLD_LAZY);
    eval 'sub RTLD_NOW () {2;}' unless defined(&RTLD_NOW);
    eval 'sub RTLD_GLOBAL () {0x100;}' unless defined(&RTLD_GLOBAL);
    eval 'sub RTLD_LOCAL () {0x200;}' unless defined(&RTLD_LOCAL);
    eval 'sub RTLD_NODELETE () {0x1000;}' unless defined(&RTLD_NODELETE);
    eval 'sub RTLD_NOLOAD () {0x2000;}' unless defined(&RTLD_NOLOAD);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub DL_LAZY () { &RTLD_LAZY;}' unless defined(&DL_LAZY);
    }
    eval 'sub RTLD_NEXT () {(( &void *) -1);}' unless defined(&RTLD_NEXT);
    eval 'sub RTLD_DEFAULT () {(( &void *) -2);}' unless defined(&RTLD_DEFAULT);
    eval 'sub RTLD_SELF () {(( &void *) -3);}' unless defined(&RTLD_SELF);
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub DL_GETERRNO () {1;}' unless defined(&DL_GETERRNO);
	eval 'sub DL_GETSYMBOL () {2;}' unless defined(&DL_GETSYMBOL);
	if(0) {
	    eval 'sub DL_SETSRCHPATH () { &x;}' unless defined(&DL_SETSRCHPATH);
	    eval 'sub DL_GETLIST () { &x;}' unless defined(&DL_GETLIST);
	    eval 'sub DL_GETREFCNT () { &x;}' unless defined(&DL_GETREFCNT);
	    eval 'sub DL_GETLOADADDR () { &x;}' unless defined(&DL_GETLOADADDR);
	}
    }
    if(defined(&_NETBSD_SOURCE)) {
	eval 'sub RTLD_DI_LINKMAP () {3;}' unless defined(&RTLD_DI_LINKMAP);
	if(0) {
	    eval 'sub RTLD_DI_ARGSINFO () {1;}' unless defined(&RTLD_DI_ARGSINFO);
	    eval 'sub RTLD_DI_CONFIGADDR () {2;}' unless defined(&RTLD_DI_CONFIGADDR);
	    eval 'sub RTLD_DI_LMID () {4;}' unless defined(&RTLD_DI_LMID);
	    eval 'sub RTLD_DI_SERINFO () {5;}' unless defined(&RTLD_DI_SERINFO);
	    eval 'sub RTLD_DI_SERINFOSIZE () {6;}' unless defined(&RTLD_DI_SERINFOSIZE);
	    eval 'sub RTLD_DI_ORIGIN () {7;}' unless defined(&RTLD_DI_ORIGIN);
	    eval 'sub RTLD_DI_GETSIGNAL () {8;}' unless defined(&RTLD_DI_GETSIGNAL);
	    eval 'sub RTLD_DI_SETSIGNAL () {9;}' unless defined(&RTLD_DI_SETSIGNAL);
	}
    }
}
1;
