Danish media are reporting that an unknown gunman has tried to shoot a Danish writer and historian who is a prominent critic of Islam.