  Long gamma-ray bursts are thought to be caused by a subset of exploding
Wolf-Rayet stars. We argue that the circumstellar absorption lines in early
supernova and in gamma-ray burst afterglow spectra may allow us to determine
the main properties of the Wolf-Rayet star progenitors which can produce those
two events. To demonstrate this, we first simulate the hydrodynamic evolution
of the circumstellar medium around a 40 Msun star up to the time of the
supernova explosion. Knowledge of density, temperature and radial velocity of
the circumstellar matter as function of space and time allows us to compute the
column density in the line of sight to the centre of the nebula, as a function
of radial velocity, angle, and time. Our column density profiles indicate the
possible number, strengths, widths and velocities of absorption line components
in supernova and gamma-ray burst afterglow spectra. Our example calculation
shows four distinct line features during the Wolf-Rayet stage, at about 0, 50,
150-700 and 2200 km/s, with only those of the lowest and highest velocity
present at all times. The 150-700 km/s feature decays rapidly as function of
time after the onset of the Wolf-Rayet stage. It consists of a variable number
of components, and, especially in its evolved stage, is depending strongly on
the particular line of sight. A comparison with absorption lines detected in
the afterglow of GRB 021004 suggests that the high velocity absorption
component in GRB 021004 may be attributed to the free streaming Wolf-Rayet
wind, which is consistent with the steep density drop indicated by the
afterglow light curve. The presence of the intermediate velocity components
implies that the duration of the Wolf-Rayet phase of the progenitor of GRB
021004 was much smaller than the average Wolf-Rayet life time.
