diff --git a/m4/ipopt.m4 b/m4/ipopt.m4
index fb54366f7ab49826e4a108a698f43e5435c4c6f2..1df26d222a6770878d8e04cdc8cab9dbe2ccce45 100644
--- a/m4/ipopt.m4
+++ b/m4/ipopt.m4
@@ -15,7 +15,7 @@ ac_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
 ## do nothing if --without-ipopt is used
 AS_IF([test x$with_ipopt != xno], [
     # is --with-ipopt=bla used?
-    AS_IF([test "x$with_ipopt" != x], [
+    AS_IF([test "x$with_ipopt" != xyes], [
         AS_IF([! test -d $with_ipopt], [
             AC_MSG_WARN([IPOpt directory $with_ipopt does not exist])
         ], [