[openssh-commits] [openssh] branch master updated: wrap some autoconf macros in AC_CACHE_CHECK

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Jul 2 13:49:31 AEST 2025


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

The following commit(s) were added to refs/heads/master by this push:
     new 29cf52148 wrap some autoconf macros in AC_CACHE_CHECK
29cf52148 is described below

commit 29cf521486bf97ab9de5b9b356f812107e0671bc
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Wed Jul 2 13:47:38 2025 +1000

    wrap some autoconf macros in AC_CACHE_CHECK
    
    This allows skipping/overriding the OSSH_CHECK_CFLAG_COMPILE and
    OSSH_CHECK_CFLAG_LINK macros used to discover supported compiler
    or linker flags. E.g.
    
      $ ./configure ossh_cv_cflag__fzero_call_used_regs_used=no
      [...]
      checking if cc supports compile flag -ftrapv and linking succeeds... yes
      checking if cc supports compile flag -fzero-call-used-regs=used and linking succeeds... (cached) no
      checking if cc supports compile flag -ftrivial-auto-var-init=zero... yes
    
    Patch from Colin Watson, ok dtucker@
---
 m4/openssh.m4 | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/m4/openssh.m4 b/m4/openssh.m4
index 176a8d1c9..f420146f1 100644
--- a/m4/openssh.m4
+++ b/m4/openssh.m4
@@ -62,7 +62,8 @@ dnl Check that $CC accepts a flag 'check_flag'. If it is supported append
 dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append
 dnl 'check_flag'.
 AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{
-	AC_MSG_CHECKING([if $CC supports compile flag $1])
+  ossh_cache_var=AS_TR_SH([ossh_cv_cflag_$1])
+  AC_CACHE_CHECK([if $CC supports compile flag $1], [$ossh_cache_var], [
 	saved_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS $WERROR $1"
 	_define_flag="$2"
@@ -71,22 +72,23 @@ AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{
 		[
 if $ac_cv_path_EGREP -i "unrecognized option|warning.*ignored" conftest.err >/dev/null
 then
-		AC_MSG_RESULT([no])
+		eval "$ossh_cache_var=no"
 		CFLAGS="$saved_CFLAGS"
 else
 		dnl If we are compiling natively, try running the program.
 		AC_RUN_IFELSE([OSSH_COMPILER_FLAG_TEST_PROGRAM],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  CFLAGS="$saved_CFLAGS $_define_flag" ],
-			[ AC_MSG_RESULT([no, fails at run time])
+			[ eval "$ossh_cache_var='no, fails at run time'"
 			  CFLAGS="$saved_CFLAGS" ],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  CFLAGS="$saved_CFLAGS $_define_flag" ],
 		)
 fi],
-		[ AC_MSG_RESULT([no])
+		[ eval "$ossh_cache_var=no"
 		  CFLAGS="$saved_CFLAGS" ]
 	)
+  ])
 }])
 
 dnl OSSH_CHECK_CFLAG_LINK(check_flag[, define_flag])
@@ -94,7 +96,8 @@ dnl Check that $CC accepts a flag 'check_flag'. If it is supported append
 dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append
 dnl 'check_flag'.
 AC_DEFUN([OSSH_CHECK_CFLAG_LINK], [{
-	AC_MSG_CHECKING([if $CC supports compile flag $1 and linking succeeds])
+  ossh_cache_var=AS_TR_SH([ossh_cv_cflag_$1])
+  AC_CACHE_CHECK([if $CC supports compile flag $1 and linking succeeds], [$ossh_cache_var], [
 	saved_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS $WERROR $1"
 	_define_flag="$2"
@@ -103,22 +106,23 @@ AC_DEFUN([OSSH_CHECK_CFLAG_LINK], [{
 		[
 if $ac_cv_path_EGREP -i "unrecognized option|warning.*ignored" conftest.err >/dev/null
 then
-		AC_MSG_RESULT([no])
+		eval "$ossh_cache_var=no"
 		CFLAGS="$saved_CFLAGS"
 else
 		dnl If we are compiling natively, try running the program.
 		AC_RUN_IFELSE([OSSH_COMPILER_FLAG_TEST_PROGRAM],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  CFLAGS="$saved_CFLAGS $_define_flag" ],
-			[ AC_MSG_RESULT([no, fails at run time])
+			[ eval "$ossh_cache_var='no, fails at run time'"
 			  CFLAGS="$saved_CFLAGS" ],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  CFLAGS="$saved_CFLAGS $_define_flag" ],
 		)
 fi],
-		[ AC_MSG_RESULT([no])
+		[ eval "$ossh_cache_var=no"
 		  CFLAGS="$saved_CFLAGS" ]
 	)
+  ])
 }])
 
 dnl OSSH_CHECK_LDFLAG_LINK(check_flag[, define_flag])
@@ -126,7 +130,8 @@ dnl Check that $LD accepts a flag 'check_flag'. If it is supported append
 dnl 'define_flag' to $LDFLAGS. If 'define_flag' is not specified, then append
 dnl 'check_flag'.
 AC_DEFUN([OSSH_CHECK_LDFLAG_LINK], [{
-	AC_MSG_CHECKING([if $LD supports link flag $1])
+  ossh_cache_var=AS_TR_SH([ossh_cv_ldflag_$1])
+  AC_CACHE_CHECK([if $LD supports link flag $1], [$ossh_cache_var], [
 	saved_LDFLAGS="$LDFLAGS"
 	LDFLAGS="$LDFLAGS $WERROR $1"
 	_define_flag="$2"
@@ -135,22 +140,23 @@ AC_DEFUN([OSSH_CHECK_LDFLAG_LINK], [{
 		[
 if $ac_cv_path_EGREP -i "unrecognized option|warning.*ignored" conftest.err >/dev/null
 then
-		  AC_MSG_RESULT([no])
+		  eval "$ossh_cache_var=no"
 		  LDFLAGS="$saved_LDFLAGS"
 else
 		  dnl If we are compiling natively, try running the program.
 		  AC_RUN_IFELSE([OSSH_COMPILER_FLAG_TEST_PROGRAM],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  LDFLAGS="$saved_LDFLAGS $_define_flag" ],
-			[ AC_MSG_RESULT([no, fails at run time])
+			[ eval "$ossh_cache_var='no, fails at run time'"
 			  LDFLAGS="$saved_LDFLAGS" ],
-			[ AC_MSG_RESULT([yes])
+			[ eval "$ossh_cache_var=yes"
 			  LDFLAGS="$saved_LDFLAGS $_define_flag" ]
 		  )
 fi		],
-		[ AC_MSG_RESULT([no])
+		[ eval "$ossh_cache_var=no"
 		  LDFLAGS="$saved_LDFLAGS" ]
 	)
+  ])
 }])
 
 dnl OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol)

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list