about summary refs log tree commit diff
path: root/pkgs/tools/misc/expect/0004-enable-cross-compilation.patch
blob: c09623d292b2e9fa6605b573f3fd862c5da7d62e (plain) (blame)
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
From: Andrew Ruder <andrew.ruder@elecsyscorp.com>
Subject: [PATCH] enable cross compilation for expect

This patch was created by running ./configure on a modern Linux machine
and inserting the results into the cross compilation section of
each AC_MSG_CHECKING that bombed out with an error.

Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>

--

The original patch, and description above, is originally from
https://github.com/buildroot/buildroot/blob/master/package/expect/0001-enable-cross-compilation.patch

This patch has been further modified to not hard-code Linux assumptions.

---

Index: expect-5.45/configure.in
===================================================================
--- expect-5.45.orig/configure.in	2013-11-14 07:59:58.732100595 -0600
+++ expect-5.45/configure.in	2013-11-14 07:59:58.732100595 -0600
@@ -6,10 +6,12 @@
 AC_INIT([expect],[5.45.4])
 
 TEA_INIT([3.9])
 
 AC_CONFIG_AUX_DIR(tclconfig)
+
+AC_LANG([C])
 
 #--------------------------------------------------------------------
 # Configure script for package 'Expect'.
 # TEA compliant.
 #--------------------------------------------------------------------
@@ -465,26 +467,20 @@
 # Some systems only define WNOHANG if _POSIX_SOURCE is defined
 # The following merely tests that sys/wait.h can be included
 # and if so that WNOHANG is not defined.  The only place I've
 # seen this is ISC.
 AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <sys/wait.h>
-int
-main() {
 #ifndef WNOHANG
-	return 0;
-#else
-	return 1;
+#  error "WNOHANG requires _POSIX_SOURCE to be defined"
 #endif
-}],
+]])],
 	AC_MSG_RESULT(yes)
 	AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE)
 ,
 	AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 AC_MSG_CHECKING([if any value exists for WNOHANG])
 rm -rf wnohang
 AC_TRY_RUN([
@@ -504,11 +501,12 @@
 	rm -f wnohang
 ,
 	AC_MSG_RESULT(no)
 	AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
 ,
-	AC_MSG_ERROR([Expect can't be cross compiled])
+	AC_MSG_RESULT(yes)
+	AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
 )
 
 #
 # check how signals work
 #
@@ -572,11 +570,11 @@
 }],
 	AC_MSG_RESULT(yes)
 	AC_DEFINE(REARM_SIG)
 ,
 	AC_MSG_RESULT(no)
-, AC_MSG_WARN([Expect can't be cross compiled])
+, AC_MSG_RESULT(no)
 )
 
 # HPUX7 has trouble with the big cat so split it
 # Owen Rees <rtor@ansa.co.uk> 29Mar93 
 SEDDEFS="${SEDDEFS}CONFEOF
@@ -710,25 +708,19 @@
     AC_DEFINE(POSIX)
 fi
 
 # first check for the pure bsd
 AC_MSG_CHECKING([for struct sgttyb])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <sgtty.h>
-int
-main()
-{
-  struct sgttyb tmp;
-  return 0;
-}],
+static struct sgttyb tmp;
+]])],
         AC_MSG_RESULT(yes)
         AC_DEFINE(HAVE_SGTTYB)
         PTY_TYPE=sgttyb
 ,
         AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 # mach systems have include files for unimplemented features
 # so avoid doing following test on those systems
 if test $mach -eq 0 ; then
@@ -735,116 +728,88 @@
   # next check for the older style ttys
   # note that if we detect termio.h (only), we still set PTY_TYPE=termios
   # since that just controls which of pty_XXXX.c file is use and
   # pty_termios.c is set up to handle pty_termio.
   AC_MSG_CHECKING([for struct termio])
-  AC_TRY_RUN([#include <termio.h>
-  int
-  main()
-  {
-    struct termio tmp;
-    return 0;
-  }],
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <termio.h>
+static struct termio tmp;
+]])],
         AC_DEFINE(HAVE_TERMIO)
         PTY_TYPE=termios
         AC_MSG_RESULT(yes)
 ,
         AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
   # now check for the new style ttys (not yet posix)
   AC_MSG_CHECKING([for struct termios])
-  AC_TRY_RUN([
-  /* including termios.h on Solaris 5.6 fails unless inttypes.h included */
-#  ifdef HAVE_INTTYPES_H
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
+#ifdef HAVE_INTTYPES_H
 #  include <inttypes.h>
-#  endif
-#  include <termios.h>
-  int
-  main()
-  {
-    struct termios tmp;
-    return 0;
-  }],
+#endif
+#include <termios.h>
+static struct termios tmp;
+]])],
         AC_DEFINE(HAVE_TERMIOS)
         PTY_TYPE=termios
         AC_MSG_RESULT(yes)
   ,
         AC_MSG_RESULT(no)
-  ,
-	AC_MSG_ERROR([Expect can't be cross compiled])
   )
 fi
 
 AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 /* including termios.h on Solaris 5.6 fails unless inttypes.h included */
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+#  include <inttypes.h>
 #endif
 #include <termios.h>
-int
-main() {
-#if defined(TCGETS) || defined(TCGETA)
-	return 0;
-#else
-	return 1;
+#
+#if !(defined(TCGETS) || defined(TCGETA))
+#  error "missing both of TCGETS and TCGETA"
 #endif
-}],
+]])],
 	AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H)
 	AC_MSG_RESULT(yes)
 ,
 	AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 AC_MSG_CHECKING([if TIOCGWINSZ in termios.h])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 /* including termios.h on Solaris 5.6 fails unless inttypes.h included */
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+#  include <inttypes.h>
 #endif
 #include <termios.h>
-int
-main() {
-#ifdef TIOCGWINSZ
-	return 0;
-#else
-	return 1;
+
+#ifndef TIOCGWINSZ
+#  error "missing TIOCGWINSZ"
 #endif
-}],
+]])],
 	AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H)
 	AC_MSG_RESULT(yes)
 ,
 	AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 # finally check for Cray style ttys
 AC_MSG_CHECKING([for Cray-style ptys])
 SETUID=":"
-AC_TRY_RUN([
-int
-main(){
-#ifdef CRAY
-	return 0;
-#else
-	return 1;
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifndef CRAY
+#  error "CRAY is not defined"
 #endif
-}
-],
+]])],
 	PTY_TYPE=unicos
 	SETUID="chmod u+s"
 	AC_MSG_RESULT(yes)
 ,
 	AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 #
 # Check for select and/or poll. If both exist, we prefer select.
 # if neither exists, define SIMPLE_EVENT.
@@ -873,26 +842,24 @@
 
 #
 # check for timezones
 #
 AC_MSG_CHECKING([for SV-style timezone])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 extern char *tzname[2];
 extern int daylight;
 int
 main()
 {
   int *x = &daylight;
   char **y = tzname;
 
   return 0;
-}],
+}]])],
 	AC_DEFINE(HAVE_SV_TIMEZONE)
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no)
-,
-	AC_MSG_ERROR([Expect can't be cross compiled])
 )
 
 
 # Following comment stolen from Tcl's configure.in:
 #   Note:  in the following variable, it's important to use the absolute