South African President Cyril Ramaphosa has ordered an inquiry to establish whether previous governments intentionally blocked investigations and prosecutions of apartheid-era crimes.