fixed LIBDIR/INCDIR check to ensure matching if one of those is undefined