configure.ac: improve option handling logic
PATCH 1/1 configure.ac: improve option handling logic
The configure options currently use hardcoded values in the [action-if-given] branch of the AC_ARG_ENABLE autoconf macro to determine whether the behaviour by passing GCC flags. The issue is, that this branch is always taken when the option is specified on the configure command line, regardless of whether it is enabled or not.
This means that the opposite option can never be explicitly set as passing it would match the branch, and result in the decision variable being set to the same hardcoded value as the other case.
Use $enableval to set the decision variable to "yes" or "no" depending on whether the option was enabled or disabled to make it possible to explicitly set the default case.
--- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
configure.ac +9 -9
@@ -31,25 +31,25 @@ AC_SUBST([FONT_NAME]) AC_ARG_ENABLE([startup-msg], AS_HELP_STRING([--disable-startup-msg], [Disable text banner output on startup]), - [disable_startup_msg=true], - [disable_startup_msg=false]) -AS_IF([test x$disable_startup_msg = xtrue], [ + [enable_startup_msg=$enableval], + [enable_startup_msg=yes]) +AS_IF([test x$enable_startup_msg != xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_DISABLE_STARTUP_MSG" ]) AC_ARG_ENABLE([progress-bar], AS_HELP_STRING([--disable-progress-bar], [Disable progress bar]), - [disable_progress_bar=true], - [disable_progress_bar=false]) -AS_IF([test x$disable_progress_bar = xtrue], [ + [enable_progress_bar=$enableval], + [enable_progress_bar=yes]) +AS_IF([test x$enable_progress_bar != xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_DISABLE_PROGRESS_BAR" ]) AC_ARG_ENABLE([img-fullscreen], AS_HELP_STRING([--enable-img-fullscreen], [Enable the logo image in fullscreen mode)]), - [img_fullscreen=true], - [img_fullscreen=false]) -AS_IF([test x$img_fullscreen = xtrue], [ + [img_fullscreen=$enableval], + [img_fullscreen=no]) +AS_IF([test x$img_fullscreen = xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_IMG_FULLSCREEN=1" ])
Signature · 1 line
2.43.0
PATCH v2 1/1 configure.ac: improve option handling logic
The configure options currently use hardcoded values in the [action-if-given] branch of the AC_ARG_ENABLE autoconf macro to determine whether the behaviour by passing GCC flags. The issue is, that this branch is always taken when the option is specified on the configure command line, regardless of whether it is enabled or not.
This means that the opposite option can never be explicitly set as passing it would match the branch, and result in the decision variable being set to the same hardcoded value as the other case.
Use $enableval to set the decision variable to "yes" or "no" depending on whether the option was enabled or disabled to make it possible to explicitly set the default case.
--- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
configure.ac +9 -9
@@ -31,25 +31,25 @@ AC_SUBST([FONT_NAME]) AC_ARG_ENABLE([startup-msg], AS_HELP_STRING([--disable-startup-msg], [Disable text banner output on startup]), - [disable_startup_msg=true], - [disable_startup_msg=false]) -AS_IF([test x$disable_startup_msg = xtrue], [ + [enable_startup_msg=$enableval], + [enable_startup_msg=yes]) +AS_IF([test x$enable_startup_msg != xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_DISABLE_STARTUP_MSG" ]) AC_ARG_ENABLE([progress-bar], AS_HELP_STRING([--disable-progress-bar], [Disable progress bar]), - [disable_progress_bar=true], - [disable_progress_bar=false]) -AS_IF([test x$disable_progress_bar = xtrue], [ + [enable_progress_bar=$enableval], + [enable_progress_bar=yes]) +AS_IF([test x$enable_progress_bar != xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_DISABLE_PROGRESS_BAR" ]) AC_ARG_ENABLE([img-fullscreen], AS_HELP_STRING([--enable-img-fullscreen], [Enable the logo image in fullscreen mode)]), - [img_fullscreen=true], - [img_fullscreen=false]) -AS_IF([test x$img_fullscreen = xtrue], [ + [enable_img_fullscreen=$enableval], + [enable_img_fullscreen=no]) +AS_IF([test x$enable_img_fullscreen = xyes], [ EXTRA_GCC_FLAGS="$EXTRA_GCC_FLAGS -DPSPLASH_IMG_FULLSCREEN=1" ])
Signature · 1 line
2.43.0
Quoted 10 lines · Olivier Benjamin via lists.yoctoproject.org
The configure options currently use hardcoded values in the [action-if-given] branch of the
AC_ARG_ENABLEautoconf macro to determine whether the behaviour by passing GCC flags. The issue is, that this branch is always taken when the option is specified on the configure command line, regardless of whether it is enabled or not.
This means that the opposite option can never be explicitly set as passing it would match the branch, and result in the decision variable being set to the same hardcoded value as the other case.
Quoted 8 lines
Use $enableval to set the decision variable to "yes" or "no" depending on whether the option was enabled or disabled to make it possible to explicitly set the default case.
Signed-off-by Olivier Benjamin <[email protected]>---
configure.ac | 18 +++++++++---------1 file changed, 9 insertions(+), 9 deletions(-)
I've already merged a couple of very similar patches yesterday?
Cheers,
Richard
Quoted 15 lines · Richard Purdie via lists.yoctoproject.org
Quoted 14 lines · Olivier Benjamin via lists.yoctoproject.org
The configure options currently use hardcoded values in the [action-if-given] branch of the
AC_ARG_ENABLEautoconf macro to determine whether the behaviour by passing GCC flags. The issue is, that this branch is always taken when the option is specified on the configure command line, regardless of whether it is enabled or not.
This means that the opposite option can never be explicitly set as passing it would match the branch, and result in the decision variable being set to the same hardcoded value as the other case.Use $enableval to set the decision variable to "yes" or "no" depending on whether the option was enabled or disabled to make it possible to explicitly set the default case.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Olivier Benjamin <[email protected]>--- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)I've already merged a couple of very similar patches yesterday?
Perfect, thanks for the confirmation.
Quoted 2 lines
Cheers,
Have a great day!
Quoted 12 lines
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#1553): https://lists.yoctoproject.org/g/yocto-patches/message/1553
Mute This Topic: https://lists.yoctoproject.org/mt/113105445/9805101
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto-patches/leave/14189878/9805101/580066470/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Olivier Benjamin, Bootlin Embedded Linux and Kernel engineering https://bootlin.com