nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 295 lines 6.6 kB view raw
1From: Andrew Ruder <andrew.ruder@elecsyscorp.com> 2Subject: [PATCH] enable cross compilation for expect 3 4This patch was created by running ./configure on a modern Linux machine 5and inserting the results into the cross compilation section of 6each AC_MSG_CHECKING that bombed out with an error. 7 8Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com> 9 10-- 11 12The original patch, and description above, is originally from 13https://github.com/buildroot/buildroot/blob/master/package/expect/0001-enable-cross-compilation.patch 14 15This patch has been further modified to not hard-code Linux assumptions. 16 17--- 18 19Index: expect-5.45/configure.in 20=================================================================== 21--- expect-5.45.orig/configure.in 2013-11-14 07:59:58.732100595 -0600 22+++ expect-5.45/configure.in 2013-11-14 07:59:58.732100595 -0600 23@@ -6,10 +6,12 @@ 24 AC_INIT([expect],[5.45.4]) 25 26 TEA_INIT([3.9]) 27 28 AC_CONFIG_AUX_DIR(tclconfig) 29+ 30+AC_LANG([C]) 31 32 #-------------------------------------------------------------------- 33 # Configure script for package 'Expect'. 34 # TEA compliant. 35 #-------------------------------------------------------------------- 36@@ -465,26 +467,20 @@ 37 # Some systems only define WNOHANG if _POSIX_SOURCE is defined 38 # The following merely tests that sys/wait.h can be included 39 # and if so that WNOHANG is not defined. The only place I've 40 # seen this is ISC. 41 AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE]) 42-AC_TRY_RUN([ 43+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 44 #include <sys/wait.h> 45-int 46-main() { 47 #ifndef WNOHANG 48- return 0; 49-#else 50- return 1; 51+# error "WNOHANG requires _POSIX_SOURCE to be defined" 52 #endif 53-}], 54+]])], 55 AC_MSG_RESULT(yes) 56 AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE) 57 , 58 AC_MSG_RESULT(no) 59-, 60- AC_MSG_ERROR([Expect can't be cross compiled]) 61 ) 62 63 AC_MSG_CHECKING([if any value exists for WNOHANG]) 64 rm -rf wnohang 65 AC_TRY_RUN([ 66@@ -504,11 +501,12 @@ 67 rm -f wnohang 68 , 69 AC_MSG_RESULT(no) 70 AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) 71 , 72- AC_MSG_ERROR([Expect can't be cross compiled]) 73+ AC_MSG_RESULT(yes) 74+ AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) 75 ) 76 77 # 78 # check how signals work 79 # 80@@ -572,11 +570,11 @@ 81 }], 82 AC_MSG_RESULT(yes) 83 AC_DEFINE(REARM_SIG) 84 , 85 AC_MSG_RESULT(no) 86-, AC_MSG_WARN([Expect can't be cross compiled]) 87+, AC_MSG_RESULT(no) 88 ) 89 90 # HPUX7 has trouble with the big cat so split it 91 # Owen Rees <rtor@ansa.co.uk> 29Mar93 92 SEDDEFS="${SEDDEFS}CONFEOF 93@@ -710,25 +708,19 @@ 94 AC_DEFINE(POSIX) 95 fi 96 97 # first check for the pure bsd 98 AC_MSG_CHECKING([for struct sgttyb]) 99-AC_TRY_RUN([ 100+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 101 #include <sgtty.h> 102-int 103-main() 104-{ 105- struct sgttyb tmp; 106- return 0; 107-}], 108+static struct sgttyb tmp; 109+]])], 110 AC_MSG_RESULT(yes) 111 AC_DEFINE(HAVE_SGTTYB) 112 PTY_TYPE=sgttyb 113 , 114 AC_MSG_RESULT(no) 115-, 116- AC_MSG_ERROR([Expect can't be cross compiled]) 117 ) 118 119 # mach systems have include files for unimplemented features 120 # so avoid doing following test on those systems 121 if test $mach -eq 0 ; then 122@@ -735,116 +728,88 @@ 123 # next check for the older style ttys 124 # note that if we detect termio.h (only), we still set PTY_TYPE=termios 125 # since that just controls which of pty_XXXX.c file is use and 126 # pty_termios.c is set up to handle pty_termio. 127 AC_MSG_CHECKING([for struct termio]) 128- AC_TRY_RUN([#include <termio.h> 129- int 130- main() 131- { 132- struct termio tmp; 133- return 0; 134- }], 135+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 136+#include <termio.h> 137+static struct termio tmp; 138+]])], 139 AC_DEFINE(HAVE_TERMIO) 140 PTY_TYPE=termios 141 AC_MSG_RESULT(yes) 142 , 143 AC_MSG_RESULT(no) 144-, 145- AC_MSG_ERROR([Expect can't be cross compiled]) 146 ) 147 148 # now check for the new style ttys (not yet posix) 149 AC_MSG_CHECKING([for struct termios]) 150- AC_TRY_RUN([ 151- /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 152-# ifdef HAVE_INTTYPES_H 153+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 154+/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 155+#ifdef HAVE_INTTYPES_H 156 # include <inttypes.h> 157-# endif 158-# include <termios.h> 159- int 160- main() 161- { 162- struct termios tmp; 163- return 0; 164- }], 165+#endif 166+#include <termios.h> 167+static struct termios tmp; 168+]])], 169 AC_DEFINE(HAVE_TERMIOS) 170 PTY_TYPE=termios 171 AC_MSG_RESULT(yes) 172 , 173 AC_MSG_RESULT(no) 174- , 175- AC_MSG_ERROR([Expect can't be cross compiled]) 176 ) 177 fi 178 179 AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h]) 180-AC_TRY_RUN([ 181+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 182 /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 183 #ifdef HAVE_INTTYPES_H 184-#include <inttypes.h> 185+# include <inttypes.h> 186 #endif 187 #include <termios.h> 188-int 189-main() { 190-#if defined(TCGETS) || defined(TCGETA) 191- return 0; 192-#else 193- return 1; 194+# 195+#if !(defined(TCGETS) || defined(TCGETA)) 196+# error "missing both of TCGETS and TCGETA" 197 #endif 198-}], 199+]])], 200 AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H) 201 AC_MSG_RESULT(yes) 202 , 203 AC_MSG_RESULT(no) 204-, 205- AC_MSG_ERROR([Expect can't be cross compiled]) 206 ) 207 208 AC_MSG_CHECKING([if TIOCGWINSZ in termios.h]) 209-AC_TRY_RUN([ 210+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 211 /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 212 #ifdef HAVE_INTTYPES_H 213-#include <inttypes.h> 214+# include <inttypes.h> 215 #endif 216 #include <termios.h> 217-int 218-main() { 219-#ifdef TIOCGWINSZ 220- return 0; 221-#else 222- return 1; 223+ 224+#ifndef TIOCGWINSZ 225+# error "missing TIOCGWINSZ" 226 #endif 227-}], 228+]])], 229 AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H) 230 AC_MSG_RESULT(yes) 231 , 232 AC_MSG_RESULT(no) 233-, 234- AC_MSG_ERROR([Expect can't be cross compiled]) 235 ) 236 237 # finally check for Cray style ttys 238 AC_MSG_CHECKING([for Cray-style ptys]) 239 SETUID=":" 240-AC_TRY_RUN([ 241-int 242-main(){ 243-#ifdef CRAY 244- return 0; 245-#else 246- return 1; 247+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 248+#ifndef CRAY 249+# error "CRAY is not defined" 250 #endif 251-} 252-], 253+]])], 254 PTY_TYPE=unicos 255 SETUID="chmod u+s" 256 AC_MSG_RESULT(yes) 257 , 258 AC_MSG_RESULT(no) 259-, 260- AC_MSG_ERROR([Expect can't be cross compiled]) 261 ) 262 263 # 264 # Check for select and/or poll. If both exist, we prefer select. 265 # if neither exists, define SIMPLE_EVENT. 266@@ -873,26 +842,24 @@ 267 268 # 269 # check for timezones 270 # 271 AC_MSG_CHECKING([for SV-style timezone]) 272-AC_TRY_RUN([ 273+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 274 extern char *tzname[2]; 275 extern int daylight; 276 int 277 main() 278 { 279 int *x = &daylight; 280 char **y = tzname; 281 282 return 0; 283-}], 284+}]])], 285 AC_DEFINE(HAVE_SV_TIMEZONE) 286 AC_MSG_RESULT(yes), 287 AC_MSG_RESULT(no) 288-, 289- AC_MSG_ERROR([Expect can't be cross compiled]) 290 ) 291 292 293 # Following comment stolen from Tcl's configure.in: 294 # Note: in the following variable, it's important to use the absolute 295