Skip to content

Commit 8b91b88

Browse files
Erik Schillingabraxa
authored andcommitted
configure: differ between check and yes/no
So far one could only specify yes/no (optionally for all drivers through --enable-all-drivers={yes,no}). However, even when stating a =yes, the dependency check would override it to a =no if the dependencies are missing. This is a bit annoying for scripts since a script may specify --enable-foo-driver=yes but in fact the build may not contain `foo-driver` due to missing build dependencies. This is especially problematic for distro's which look like they currently do not build a defined driver set - which results in random drivers missing [1]. This fixes that by following the autoconf examples [2] that allow a third state `check`. With that `no` means no, `yes` means yes (raise an error if deps are unavailable) and `check` gracefully disables drivers with unavailable dependencies. With that --enable-all-drivers can be used to ensure that all drivers are built in. Certain drivers can still be explicitly disabled by overriding the individual driver setting. This way distros can specify --enable-all-drivers and new drivers with unmet dependencies will cause an error rather than silently getting dropped of the build. [1] https://sigrok.org/bugzilla/show_bug.cgi?id=1699 [2] https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/External-Software.html#External-Software To: [email protected] Cc: Daniel Thompson <[email protected]>
1 parent 47a98d3 commit 8b91b88

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

configure.ac

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,23 @@ sr_check_driver_deps() {
281281

282282
AC_ARG_ENABLE([all-drivers],
283283
[AS_HELP_STRING([--enable-all-drivers],
284-
[enable all drivers by default [default=yes]])],
285-
[], [enable_all_drivers=yes])
284+
[enable all drivers by default [default=check]])],
285+
[], [enable_all_drivers=check])
286286

287287
## _SR_DRIVER(Device name, driver-name, var-name, [dependencies...])
288288
m4_define([_SR_DRIVER], [
289289
AC_ARG_ENABLE([$2],
290290
[AS_HELP_STRING([--enable-$2], [enable $1 support])],
291291
[$3=$enableval], [$3=$enable_all_drivers])
292292
293-
AS_IF([test "x[$]$3" = xyes], [sr_hw_info=yes[]m4_ifval([$4], [
293+
AS_IF([test "x[$]$3" != xno],
294+
[sr_hw_info=yes[]m4_ifval([$4], [
294295
sr_check_driver_deps $4 \
295-
|| $3=no sr_hw_info="no (missing: $sr_deps_missing)"
296+
|| if test "x[$]$3" != xcheck; then
297+
AC_MSG_ERROR([driver $2 is enabled, but deps are missing: $sr_deps_missing])
298+
else
299+
$3=no sr_hw_info="no (missing: $sr_deps_missing)"
300+
fi;
296301
])], [sr_hw_info='no (disabled)'])
297302
sr_driver_summary_append "$2" "$sr_hw_info"
298303

0 commit comments

Comments
 (0)