Former Formula 1 boss Bernie Ecclestone has been detained at a Portuguese airport for possessing a firearm without a permit.