summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2022-05-12 19:00:14 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2022-05-19 22:48:45 +0200
commitc7c5d4cc808844a4114b1ee664da4b5402c0d66d (patch)
treea67190389300547baeaf1c7912a8aa10984e3a6b /libgphoto2_port
parent4230f166705570b672009e7c75b0f7d00fa3c460 (diff)
downloadlibgphoto2-c7c5d4cc808844a4114b1ee664da4b5402c0d66d.tar.gz
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.
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/gphoto-m4/gp-camlibs.m410
-rw-r--r--libgphoto2_port/gphoto-m4/gp-progs.m44
-rw-r--r--libgphoto2_port/gphoto-m4/gp-sleep.m440
3 files changed, 38 insertions, 16 deletions
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