backport from 1.9 (rev #9843)

fixed regression - can now directly compile with TLS=1 make without setting the USE_TLS define via menuconfig