From c7c5d4cc808844a4114b1ee664da4b5402c0d66d Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 12 May 2022 19:00:14 +0200 Subject: Use GP_SLEEP_IF_TTY Only sleep after configure warning message if the output goes to an interactive terminal (isatty()) and therefore sleeping actually has a chance to be noticed by someone watching. --- libgphoto2_port/gphoto-m4/gp-camlibs.m4 | 10 ++++----- libgphoto2_port/gphoto-m4/gp-progs.m4 | 4 ++-- libgphoto2_port/gphoto-m4/gp-sleep.m4 | 40 +++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 16 deletions(-) (limited to 'libgphoto2_port') diff --git a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 index 9deaee3e3..eb71211c0 100644 --- a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 @@ -1,5 +1,5 @@ # gp-camlibs.m4 - define camlibs and camlib infrastructure -*- Autoconf -*- -# serial 13 +# serial 14 dnl | Increment the above serial number every time you edit this file. dnl | When it finds multiple m4 files with the same name, dnl | aclocal will use the one with the highest serial. @@ -163,7 +163,7 @@ AC_MSG_WARN([ # * or even better, just build the standard set of camlibs. # #=====================================================================# ]) -GP_SLEEP([5]) +GP_SLEEP_IF_TTY([5]) ]) dnl dnl @@ -248,7 +248,7 @@ AS_VAR_IF([gp_sh_with_camlibs], [canon], [dnl # driver to prevent unnecessary support requests. # #==============================================================# ]) - GP_SLEEP([5]) + GP_SLEEP_IF_TTY([5]) ])dnl dnl set -x @@ -308,7 +308,7 @@ do # 'standard' instead. # #=============================================================# ]) - GP_SLEEP([5]) + GP_SLEEP_IF_TTY([5]) gp_camlib="standard" ;; esac @@ -438,7 +438,7 @@ AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl # you insist on building these camlibs. # #=========================================================# ]) - GP_SLEEP([5]) + GP_SLEEP_IF_TTY([5]) ]) GP_SET_SPACE_VAR([camlib-set], [gp_camlib_set]) diff --git a/libgphoto2_port/gphoto-m4/gp-progs.m4 b/libgphoto2_port/gphoto-m4/gp-progs.m4 index 2f7dcdbf7..6bf530616 100644 --- a/libgphoto2_port/gphoto-m4/gp-progs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-progs.m4 @@ -1,5 +1,5 @@ # gp-progs.m4 - look for certain well-known tools -*- Autoconf -*- -# serial 13 +# serial 14 dnl | Increment the above serial number every time you edit this file. dnl | When it finds multiple m4 files with the same name, dnl | aclocal will use the one with the highest serial. @@ -71,7 +71,7 @@ dnl #################################################################### m4_pattern_forbid([GP_PROG_SLEEP])dnl AC_DEFUN_ONCE([GP_PROG_SLEEP],[dnl AC_ARG_VAR([SLEEP], [sleep delay command])dnl -AC_MSG_CHECKING([whether to sleep]) +AC_MSG_CHECKING([for sleep]) AS_VAR_IF([SLEEP], [no], [dnl AC_MSG_RESULT([no]) ], [dnl diff --git a/libgphoto2_port/gphoto-m4/gp-sleep.m4 b/libgphoto2_port/gphoto-m4/gp-sleep.m4 index 969a19277..a109b81a4 100644 --- a/libgphoto2_port/gphoto-m4/gp-sleep.m4 +++ b/libgphoto2_port/gphoto-m4/gp-sleep.m4 @@ -1,29 +1,51 @@ # gp-sleep.m4 - look for the sleep(1) tool -*- Autoconf -*- -# serial 13 +# serial 14 dnl | Increment the above serial number every time you edit this file. dnl | When it finds multiple m4 files with the same name, dnl | aclocal will use the one with the highest serial. dnl dnl #################################################################### dnl GP_SLEEP(delay_in_whole_seconds) -dnl If the SLEEP variable is set to "no" or empty or is unset, -dnl do not sleep. -dnl If the SLEEP variable is set to something else, run that something -dnl else with the given delay value. +dnl * If the SLEEP variable is set to "no" or empty or is unset, +dnl do not sleep. +dnl * If stdout (FD 1) is not a TTY (!isatty(1)), do not sleep. +dnl * Otherwise, run ${SLEEP} with the given delay value argument. dnl #################################################################### +dnl +dnl #################################################################### +dnl GP_SLEEP_IF_TTY(delay_in_whole_seconds) +dnl * If the SLEEP variable is set to "no" or empty or is unset, +dnl do not sleep. +dnl * If stdout (FD 1) is not a TTY (!isatty(1)), do not sleep. +dnl * If tty -t is not present and therefore fails, we do not lose +dnl much: Just that interactive users do not benefit from seeing the +dnl warning a bit longer. +dnl * Otherwise, run ${SLEEP} with the given delay value argument. +dnl #################################################################### +dnl AC_DEFUN_ONCE([_GP_SLEEP_INIT], [dnl AC_REQUIRE([GP_PROG_SLEEP])dnl -AS_IF([test "x$SLEEP" != "x" && test "x$SLEEP" != "xno"], [dnl -gp_sleep=[$]SLEEP +AC_MSG_CHECKING([whether configure script should sleep]) +AS_IF([test "x$SLEEP" != x && test "x$SLEEP" != xno], [dnl + AC_MSG_RESULT([yes]) + gp_sleep=[$]SLEEP ], [dnl -gp_sleep=: + AC_MSG_RESULT([no]) + gp_sleep=: ]) ])dnl dnl dnl AC_DEFUN([GP_SLEEP], [dnl AC_REQUIRE([_GP_SLEEP_INIT])dnl -$gp_sleep $1 +[$]gp_sleep $1 +])dnl +dnl +AC_DEFUN([GP_SLEEP_IF_TTY], [dnl +AC_REQUIRE([_GP_SLEEP_INIT])dnl +AS_IF([test -t 1], [dnl +[$]gp_sleep $1 +]) ])dnl dnl dnl -- cgit v1.2.1