aboutsummaryrefslogtreecommitdiffstats
path: root/packages/openssh/openssh-4.0p1/configure.patch
blob: ddfe21d16442456985dc5eefea0b67cb2175ce63 (plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
Index: openssh-4.0p1/configure.ac
===================================================================
--- openssh-4.0p1.orig/configure.ac	2005-03-07 04:21:37.000000000 -0500
+++ openssh-4.0p1/configure.ac	2005-03-12 23:43:25.057482040 -0500
@@ -718,23 +718,21 @@
 	]
 )
 
-AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
-AC_RUN_IFELSE(
-	[AC_LANG_SOURCE([[
-#include <sys/types.h>
-#include <dirent.h>
-int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
-	]])],
-	[AC_MSG_RESULT(yes)],
-	[
-		AC_MSG_RESULT(no)
-		AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
-	],
-	[ 
-		AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
-		AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
-	]
-)
+AC_CACHE_CHECK([whether struct dirent allocates space for d_name], ac_cv_have_space_d_name_in_struct_dirent, [
+		AC_RUN_IFELSE(
+			[AC_LANG_SOURCE([[
+			#include <sys/types.h>
+			#include <dirent.h>
+			int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
+			]])],
+			[ ac_cv_have_space_d_name_in_struct_dirent="yes" ],
+			[ ac_cv_have_space_d_name_in_struct_dirent="no" ],
+		)
+])
+
+if test "x$ac_cv_dirent_have_space_d_name" = "xyes" ; then
+	AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
+fi
 
 AC_MSG_CHECKING([for /proc/pid/fd directory])
 if test -d "/proc/$$/fd" ; then
@@ -987,20 +985,25 @@
 
 # Check for broken snprintf
 if test "x$ac_cv_func_snprintf" = "xyes" ; then
-	AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
-	AC_RUN_IFELSE(
-		[AC_LANG_SOURCE([[
-#include <stdio.h>
-int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
-		]])],
-		[AC_MSG_RESULT(yes)],
-		[
-			AC_MSG_RESULT(no)
-			AC_DEFINE(BROKEN_SNPRINTF)
-			AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
-		],
-		[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
-	)
+	AC_CACHE_CHECK([whether snprintf correctly terminates long strings],
+		ac_cv_have_broken_snprintf, [
+		AC_RUN_IFELSE(
+			[AC_LANG_SOURCE([[
+			#include <stdio.h>
+			int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
+			]])],
+			[ac_cv_have_broken_snprintf="no"],
+			[ac_cv_have_broken_snprintf="yes"],
+			[
+				AC_MSG_WARN([cross compiling: Assuming working snprintf()])
+				ac_cv_have_broken_snprintf="yes"
+			]
+		)
+	])
+	if test "x$ac_cv_have_broken_snprintf" = "xyes" ; then
+		AC_DEFINE(BROKEN_SNPRINTF)
+		AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
+	fi
 fi
 
 # Check for missing getpeereid (or equiv) support
@@ -1045,49 +1048,49 @@
 
 dnl make sure that openpty does not reacquire controlling terminal
 if test ! -z "$check_for_openpty_ctty_bug"; then
-	AC_MSG_CHECKING(if openpty correctly handles controlling tty)
-	AC_TRY_RUN(
-		[
-#include <stdio.h>
-#include <sys/fcntl.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-int
-main()
-{
-	pid_t pid;
-	int fd, ptyfd, ttyfd, status;
-
-	pid = fork();
-	if (pid < 0) {		/* failed */
-		exit(1);
-	} else if (pid > 0) {	/* parent */
-		waitpid(pid, &status, 0);
-		if (WIFEXITED(status))
-			exit(WEXITSTATUS(status));
-		else
-			exit(2);
-	} else {		/* child */
-		close(0); close(1); close(2);
-		setsid();
-		openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
-		fd = open("/dev/tty", O_RDWR | O_NOCTTY);
-		if (fd >= 0)
-			exit(3);	/* Acquired ctty: broken */
-		else
-			exit(0);	/* Did not acquire ctty: OK */
+	AC_CACHE_CHECK([if openpty acquires controlling terminal],
+			ac_cv_have_openpty_ctty_bug, [
+		AC_TRY_RUN(
+			[
+	#include <stdio.h>
+	#include <sys/fcntl.h>
+	#include <sys/types.h>
+	#include <sys/wait.h>
+	
+	int
+	main()
+	{
+		pid_t pid;
+		int fd, ptyfd, ttyfd, status;
+	
+		pid = fork();
+		if (pid < 0) {		/* failed */
+			exit(1);
+		} else if (pid > 0) {	/* parent */
+			waitpid(pid, &status, 0);
+			if (WIFEXITED(status))
+				exit(WEXITSTATUS(status));
+			else
+				exit(2);
+		} else {		/* child */
+			close(0); close(1); close(2);
+			setsid();
+			openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
+			fd = open("/dev/tty", O_RDWR | O_NOCTTY);
+			if (fd >= 0)
+				exit(3);	/* Acquired ctty: broken */
+			else
+				exit(0);	/* Did not acquire ctty: OK */
+		}
 	}
-}
-		],
-		[
-			AC_MSG_RESULT(yes)
-		],
-		[
-			AC_MSG_RESULT(no)
-			AC_DEFINE(SSHD_ACQUIRES_CTTY)
-		]
-	)
+			],
+			[ ac_cv_have_openpty_ctty_bug="no" ],
+			[ ac_cv_have_openpty_ctty_bug="yes"]
+		)
+	])
+	if test "x$ac_cv_have_openpty_ctty_bug" = "xyes" ; then
+		AC_DEFINE(SSHD_ACQUIRES_CTTY)
+	fi
 fi
 
 if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
@@ -2039,8 +2042,12 @@
 	exit 1;
 else
 dnl test snprintf (broken on SCO w/gcc)
-	AC_RUN_IFELSE(
-		[AC_LANG_SOURCE([[
+	# No need to check for a broken snprintf if we already know it's broken.
+	if test "x$ac_cv_func_snprintf" = "xyes" && test "x$ac_cv_have_broken_snprintf" != "xyes"; then
+		AC_CACHE_CHECK([whether snprintf correctly terminates long strings],
+			ac_cv_have_broken_snprintf, [
+			AC_RUN_IFELSE(
+				[AC_LANG_SOURCE([[
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_SNPRINTF
@@ -2063,9 +2070,20 @@
 #else
 main() { exit(0); }
 #endif
-		]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
-		AC_MSG_WARN([cross compiling: Assuming working snprintf()])
-	)
+				]])],
+				[ac_cv_have_broken_snprintf="no"],
+				[ac_cv_have_broken_snprintf="yes"],
+				[
+					AC_MSG_WARN([cross compiling: Assuming working snprintf()])
+					ac_cv_have_broken_snprintf="yes"
+				]
+			)
+		])
+		if test "x$ac_cv_have_broken_snprintf" = "xyes" ; then
+			AC_DEFINE(BROKEN_SNPRINTF)
+			AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
+		fi
+	fi
 fi
 
 dnl Checks for structure members
@@ -2666,12 +2684,15 @@
 )
 
 if test "x$etc_default_login" != "xno"; then
-	AC_CHECK_FILE("/etc/default/login",
-	    [ external_path_file=/etc/default/login ])
 	if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
 	then
 		AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
-	elif test "x$external_path_file" = "x/etc/default/login"; then
+		external_path_file=/etc/default/login
+	else
+		AC_CHECK_FILE("/etc/default/login",
+		    [ external_path_file=/etc/default/login ])
+	fi
+	if test "x$external_path_file" = "x/etc/default/login"; then
 		AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
 	fi
 fi