From: Roland Hieber Date: Mon, 17 Jul 2017 11:35:32 +0200 Subject: [PATCH] configure.ac: fix --disable-FEATURE actually enabling the feature A frequently seen antipattern is to use AC_ARG_ENABLE(feature, help, action-if-given, action-if-not-given) as AC_ARG_ENABLE(feature, help, action-if-enabled, action-if-disabled). However, action-if-given is also evaluated for --disable-FEATURE (with enableval=no), which results in --disable-FEATURE and --enable-FEATURE doing the same in this case. Rewrite the single-precision, fixedpoint and cmyk arguments accordingly so the user is not confused if they explicitely want to disable those options. Signed-off-by: Roland Hieber --- configure.ac | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 98d497a973b6..c21803a28586 100644 --- a/configure.ac +++ b/configure.ac @@ -122,16 +122,36 @@ else fi AC_ARG_ENABLE(single-precision, -[ --enable-single-precision use single precision arithmetic (instead of double precision) in the Splash backend], -AC_DEFINE(USE_FLOAT, [1], [Use single precision arithmetic in the Splash backend])) + AC_HELP_STRING([--enable-single-precision], + [use single precision arithmetic (instead of double + precision) in the Splash backend]), + enable_single_precision=$enableval, + enable_single_precision=no) +if test x$enable_single_precision != xno; then + AC_DEFINE(USE_FLOAT, [1], [Use single precision arithmetic in the Splash backend]) +fi AC_ARG_ENABLE(fixedpoint, -[ --enable-fixedpoint use fixed point (instead of double precision) arithmetic in the Splash backend], -AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend])) + AC_HELP_STRING([--enable-fixedpoint], + [use fixed point (instead of double precision) arithmetic + in the Splash backend]), + enable_fixedpoint=$enableval, + enable_fixedpoint=no) +if test x$enable_fixedpoint != xno; then + if test x$enable_single_precision != xno; then + AC_MSG_ERROR([Choose only one of --enable-single-precision or --enable-fixedpoint!]) + fi + AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend]) +fi AC_ARG_ENABLE(cmyk, -[ --enable-cmyk Include support for CMYK rasterization], -AC_DEFINE(SPLASH_CMYK, [1], [Include support for CMYK rasterization])) + AC_HELP_STRING([--enable-cmyk], + [Include support for CMYK rasterization]), + enable_cmyk=$enableval, + enable_cmyk=no) +if test x$enable_cmyk != xno; then + AC_DEFINE(SPLASH_CMYK, [1], [Include support for CMYK rasterization])) +fi dnl Relocation support AC_ARG_ENABLE(relocatable,