[PATCH] gdb, gdbsupport: configure: factor out yes/no/auto value checking

Tom Tromey tom@tromey.com
Tue Aug 23 19:17:41 GMT 2022


>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> From: Simon Marchi <simon.marchi@efficios.com>
Simon> Factor out the code that checks that a value is yes/no or yes/no/auto.
Simon> Add two macros to gdbsupport/common.m4 and use them in gdb/configure.ac

Simon> I inspected the changes to configure.  Other than whitespace changes, we
Simon> have some benign changes to the error messages (one of them had an error
Simon> actually).  There are changes to the --enable-source-highlight and
Simon> --enable-libbacktrace handling, but setting enable_source_highlight /
Simon> enable_libbacktrace was not really useful anyway, they already had the
Simon> right value.

This looks reasonable to me.

Simon> +AC_ARG_ENABLE([gdbmi],

I was very surprised to learn today that this really can be disabled.

Simon> -AC_ARG_ENABLE(source-highlight,
Simon> -  AS_HELP_STRING([--enable-source-highlight],
Simon> -    [enable source-highlight for source listings]),
Simon> -  [case "${enableval}" in
Simon> -  yes)  enable_source_highlight=yes ;;
Simon> -  no)   enable_source_highlight=no  ;;
Simon> -  *)    AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;;
Simon> -esac],
Simon> -[enable_source_highlight=auto])
Simon> +AC_ARG_ENABLE([source-highlight],
Simon> +	      [AS_HELP_STRING([--enable-source-highlight],
Simon> +			      [enable source-highlight for source listings])],
Simon> +	      [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-source-highlight])],
Simon> +	      [enable_source_highlight=auto])

This defaults to 'auto' but, weirdly, doesn't let one explicitly specify
'auto'.  I wonder if switching it to GDB_CHECK_YES_NO_AUTO_VAL would be
an improvement.

Tom


More information about the Gdb-patches mailing list