Why are conventions in autoconf scripts prefixed with "x"?

Why do conditional statements in autoconf scripts prefix their variables with "x"? For example, a macro provided by GNU to test Boost has conditions such as

if test "x$want_boost" = "xyes"; then

Why it is not defined as:

if test "$want_boost" = "yes"; then
+5
source share
1 answer

In some early shells, testing an empty string variable was not as easy as it is now, so the best alternative was to see if "x $ variable" was equal to "x". Also, since apparently using test, it’s easier than trying to correctly specify / exclude sequences such as "$ x! =" Y "without losing common sense and / or portability.

+7

All Articles