require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NETCAN_CAN_H)) {
    eval 'sub _NETCAN_CAN_H () {1;}' unless defined(&_NETCAN_CAN_H);
    require 'sys/featuretest.ph';
    require 'sys/types.ph';
    eval 'sub CAN_EFF_FLAG () {0x80000000;}' unless defined(&CAN_EFF_FLAG);
    eval 'sub CAN_RTR_FLAG () {0x40000000;}' unless defined(&CAN_RTR_FLAG);
    eval 'sub CAN_ERR_FLAG () {0x20000000;}' unless defined(&CAN_ERR_FLAG);
    eval 'sub CAN_SFF_MASK () {0x7ff;}' unless defined(&CAN_SFF_MASK);
    eval 'sub CAN_EFF_MASK () {0x1fffffff;}' unless defined(&CAN_EFF_MASK);
    eval 'sub CAN_ERR_MASK () {0x1fffffff;}' unless defined(&CAN_ERR_MASK);
    eval 'sub CAN_MAX_DLC () {8;}' unless defined(&CAN_MAX_DLC);
    eval 'sub CAN_MAX_DLEN () {8;}' unless defined(&CAN_MAX_DLEN);
    eval 'sub CAN_MTU () {($sizeof{\'struct can_frame\'});}' unless defined(&CAN_MTU);
    eval 'sub CAN_RAW () {1;}' unless defined(&CAN_RAW);
    eval 'sub CAN_NPROTO () {2;}' unless defined(&CAN_NPROTO);
    eval 'sub SOL_CAN_RAW () { &CAN_RAW;}' unless defined(&SOL_CAN_RAW);
    eval 'sub CAN_RAW_FILTER () {1;}' unless defined(&CAN_RAW_FILTER);
    eval 'sub CAN_RAW_LOOPBACK () {4;}' unless defined(&CAN_RAW_LOOPBACK);
    eval 'sub CAN_RAW_RECV_OWN_MSGS () {5;}' unless defined(&CAN_RAW_RECV_OWN_MSGS);
    eval 'sub CAN_INV_FILTER () {0x20000000;}' unless defined(&CAN_INV_FILTER);
    if(defined(&_NETBSD_SOURCE)) {
	if(defined(&_KERNEL)) {
	    eval 'sub satoscan {
	        my($sa) = @_;
    		eval q((($sa)));
	    }' unless defined(&satoscan);
	    eval 'sub scantosa {
	        my($scan) = @_;
    		eval q((($scan)));
	    }' unless defined(&scantosa);
	}
    }
}
1;
