Aims. To explore the chemical pattern of early-type stars with planets, searching for a possible signature of planet formation. In particular, we study a likely relation between the lambda Bootis chemical pattern and the presence of giant planets. Methods. We performed a detailed abundance determination in a sample of early-type stars with and without planets via spectral synthesis. Results. We compared the chemical pattern of the stars in our sample (13 stars with planets and 24 stars without detected planets) with those of lambda Bootis and other chemically peculiar stars. We have found four lambda Bootis stars in our sample, two of which present planets and circumstellar disks (HR 8799 and HD 169142) and one without planets detected (HD 110058). We have also identified the first lambda Bootis star orbited by a brown dwarf (zeta Del). This interesting pair lambda Bootis star + brown dwarf could help to test stellar formation scenarios. We found no unique chemical pattern for the group of early-type stars bearing giant planets. However, our results support, in principle, a suggested scenario in which giant planets orbiting pre-main-sequence stars possibly block the dust of the disk and result in a lambda Bootis-like pattern. On the other hand, we do not find a lambda Bootis pattern in different hot-Jupiter planet host stars, which do not support the idea of possible accretion from the winds of hot-Jupiters, recently proposed in the literature. Then, other mechanisms should account for the presence of the lambda Bootis pattern between main-sequence stars. Finally, we suggest that the formation of planets around lambda Bootis stars such as HR 8799 and HD 169142 is also possible through the core accretion process and not only gravitational instability [abridged]