Flying at an airspeed corresponding to an aircraft's maximum glide ratio in calm air will maximize the distance covered for a given altitude (AGL). But in a headwind, the horizontal velocity would be reduced by the headwind velocity and the maximum distance at that airspeed would be correspondingly reduced. At an extreme case, if the headwind is greater than the best glide speed, an aircraft would move backwards relative to the ground if it flew at best glide speed. But an aircraft could always pitch for a greater airspeed into the wind an achieve some forward distance even if the headwind was greater than the best glide speed.
My question is how to determine the best "penetration" speed if one is forced to try and glide for maximum distance into a headwind? And can this be approximated in flight?
I am mostly interested in small GA aircraft that might be considering a forced landing, so time is of the essence. A corollary question would be above what headwind speed is it best not to try for any distance and only consider landing in the downwind direction. I understand that maximum range would always be downwind, but for some small headwind speeds and enough altitude, an upwind landing location might still be practical.