1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
From 1506d4bbf5fa2d7a3d2f8ae77914dd46b10c40ea Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Wed, 3 Apr 2024 11:52:04 +0100
Subject: Add Autoconf cache variables for OSSH_CHECK_*FLAG_*
This allows overriding them on configure's command line in case the
automatic checks go wrong somehow. bz#3673
Forwarded: https://bugzilla.mindrot.org/show_bug.cgi?id=3673#c3
Last-Update: 2024-04-03
Patch-Name: configure-cache-vars.patch
---
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)
|