On the distance of the globular cluster M4 (NGC 6121) using RR Lyrae stars. I. Optical and near-infrared period-Luminosity and period-Wesenheit relations