diff --git a/ao.m4 b/ao.m4
index 1186862cdc16f5f1a6468cb91795643be8101140..e135e9d4a373b7916fb75441993d4cfa68a38f57 100644
--- a/ao.m4
+++ b/ao.m4
@@ -13,11 +13,11 @@ dnl
 AC_ARG_WITH(ao-prefix,[  --with-ao-prefix=PFX   Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="")
 AC_ARG_ENABLE(aotest, [  --disable-aotest       Do not try to compile and run a test ao program],, enable_aotest=yes)
 
-  if test "x$ao_prefix" != "xNONE" ; then
+  if test "x$ao_prefix" != "x"; then
     ao_args="$ao_args --prefix=$ao_prefix"
     AO_CFLAGS="-I$ao_prefix/include"
     AO_LIBS="-L$ao_prefix/lib"
-  elif test "$prefix" != ""; then
+  elif test "x$prefix" != "xNONE"; then
     ao_args="$ao_args --prefix=$prefix"
     AO_CFLAGS="-I$prefix/include"
     AO_LIBS="-L$prefix/lib"