build: Fix the __progname check to avoid the optimizer discarding the symbol
Because we were assigning to another unused variable, when building the
check with optimizations enabled, which is the default when using gcc as
the compiler, the variable was being discarded. Instead pass it to
printf() so that it cannot do so.