From

https://github.com/openembedded/openembedded-core/tree/master/meta/recipes-extended/screen/screen

diff -u -r ../screen-4.4.0/configure.ac ./configure.ac
--- ../screen-4.4.0/configure.ac	2016-06-19 15:41:03.000000000 -0400
+++ ./configure.ac	2016-11-07 18:05:24.132420605 -0500
@@ -48,31 +48,6 @@
 AC_ISC_POSIX
 AC_USE_SYSTEM_EXTENSIONS
 
-AC_TRY_RUN(main(){exit(0);},,[
-if test $CC != cc ; then
-AC_NOTE(Your $CC failed - restarting with CC=cc)
-AC_NOTE()
-CC=cc
-export CC
-exec $0 $configure_args
-fi
-])
-
-AC_TRY_RUN(main(){exit(0);},,
-exec 5>&2
-eval $ac_link
-AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
-AC_NOTE($ac_compile)
-AC_MSG_ERROR(Can't run the compiler - sorry))
-
-AC_TRY_RUN([
-main()
-{
-  int __something_strange_();
-  __something_strange_(0);
-}
-],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
-
 AC_PROG_AWK
 
 AC_PROG_INSTALL
@@ -110,7 +85,7 @@
 dnl
 dnl    ****  special unix variants  ****
 dnl
-if test -n "$ISC"; then
+if test "$cross_compiling" = no && test -n "$ISC" ; then
   AC_DEFINE(ISC) LIBS="$LIBS -linet"
 fi
 
@@ -121,10 +96,11 @@
 dnl fi
 dnl fi
 
-if test -f /sysV68 ; then
+if test "$cross_compiling" = no && test -f /sysV68 ; then
 AC_DEFINE(sysV68)
 fi
 
+if test "$cross_compiling" = no ; then
 AC_CHECKING(for MIPS)
 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
 oldlibs="$LIBS"
@@ -148,6 +124,7 @@
 ))
 fi
 fi
+fi
 
 
 AC_CHECKING(for Ultrix)
@@ -157,7 +134,7 @@
 #endif
 ], ULTRIX=1)
 
-if test -f /usr/lib/libpyr.a ; then
+if test "$cross_compiling" = no && test -f /usr/lib/libpyr.a ; then
 oldlibs="$LIBS"
 LIBS="$LIBS -lpyr"
 AC_CHECKING(Pyramid OSX)
@@ -373,7 +350,8 @@
   exit(0);
 }
 ], AC_NOTE(- your fifos are usable) fifo=1,
-AC_NOTE(- your fifos are not usable))
+AC_NOTE(- your fifos are not usable),
+AC_NOTE(- skipping check because we are cross compiling; assuming fifos are usable) fifo=1)
 rm -f /tmp/conftest*
 
 if test -n "$fifo"; then
@@ -421,7 +399,8 @@
   exit(0);
 }
 ], AC_NOTE(- your implementation is ok), 
-AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
+AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1,
+AC_NOTE(- skipping check because we are cross compiling; assuming fifo implementation is ok))
 rm -f /tmp/conftest*
 fi
 
@@ -483,7 +462,9 @@
   exit(0);
 }
 ], AC_NOTE(- your sockets are usable) sock=1,
-AC_NOTE(- your sockets are not usable))
+
+AC_NOTE(- your sockets are not usable),
+AC_NOTE(- skipping check because we are cross compiling; assuming sockets are usable) sock=1)
 rm -f /tmp/conftest*
 
 if test -n "$sock"; then
@@ -522,7 +503,8 @@
 }
 ],AC_NOTE(- you are normal),
 AC_NOTE(- unix domain sockets are not kept in the filesystem)
-AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
+AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1,
+AC_NOTE(- skipping check because we are cross compiling; assuming sockets are normal))
 rm -f /tmp/conftest*
 fi
 
@@ -649,7 +631,8 @@
   exit(0);
 }
 ],AC_NOTE(- select is ok),
-AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
+AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN),
+AC_NOTE(- skipping check because we are cross compiling; assuming select is ok))
 
 dnl
 dnl    ****  termcap or terminfo  ****
@@ -691,24 +674,29 @@
 {
  exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
 }], AC_NOTE(- you use the termcap database),
-AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
+AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO),
+AC_NOTE(- skipping check because we are cross compiling; assuming terminfo database is used) AC_DEFINE(TERMINFO))
 AC_CHECKING(ospeed)
 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
 
 dnl
 dnl    ****  PTY specific things  ****
 dnl
+if test "$cross_compiling" = no ; then
 AC_CHECKING(for /dev/ptc)
 if test -r /dev/ptc; then
 AC_DEFINE(HAVE_DEV_PTC)
 fi
+fi
 
+if test "$cross_compiling" = no ; then
 AC_CHECKING(for SVR4 ptys)
 sysvr4ptys=
 if test -c /dev/ptmx ; then
 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
 sysvr4ptys=1])
 fi
+fi
 
 AC_CHECK_FUNCS(getpt)
 
@@ -718,6 +706,7 @@
 [AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
 fi
 
+if test "$cross_compiling" = no ; then
 AC_CHECKING(for ptyranges)
 if test -d /dev/ptym ; then
 pdir='/dev/ptym'
@@ -741,6 +730,7 @@
 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
 fi
+fi
 
 dnl    ****  pty mode/group handling ****
 dnl
@@ -826,7 +816,8 @@
     else
       AC_NOTE(- can't determine - assume ptys are world accessable)
     fi
-  ]
+  ],
+  AC_NOTE(- skipping check because we are cross compiling; assuming ptys are world accessable)
 )
 rm -f conftest_grp
 fi
@@ -887,14 +878,16 @@
 dnl
 dnl    ****  loadav  ****
 dnl
+if test "$cross_compiling" = no ; then
 AC_CHECKING(for libutil(s))
 test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
 test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
+fi
 
 AC_CHECKING(getloadavg)
 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
-if test -f /usr/lib/libkvm.a ; then
+if test "$cross_compiling" = no && test -f /usr/lib/libkvm.a ; then
 olibs="$LIBS"
 LIBS="$LIBS -lkvm"
 AC_CHECKING(getloadavg with -lkvm)
@@ -910,7 +903,7 @@
 #endif
 ], load=1)
 fi
-if test -z "$load" ; then
+if test -z "$load" && test "$cross_compiling" = no ; then
 AC_CHECKING(for kernelfile)
 for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
   if test -f $core || test -c $core; then
@@ -1103,7 +1096,7 @@
 #endif
   exit(0);
 }
-],,AC_DEFINE(SYSVSIGS))
+],,AC_DEFINE(SYSVSIGS),:)
 
 fi
 
@@ -1112,13 +1105,17 @@
 dnl
 
 AC_CHECKING(for crypt and sec libraries)
+if test "$cross_compiling" = no ; then
 test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
+fi
 oldlibs="$LIBS"
 LIBS="$LIBS -lcrypt"
 AC_CHECKING(crypt)
 AC_TRY_LINK(,,,LIBS="$oldlibs")
+if test "$cross_compiling" = no ; then
 test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
 test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
+fi
 oldlibs="$LIBS"
 LIBS="$LIBS -lsun"
 AC_CHECKING(IRIX sun library)
@@ -1183,7 +1180,7 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEBCOPY))
+}], AC_DEFINE(USEBCOPY),,:)
 
 AC_TRY_RUN([
 #define bcopy(s,d,l) memmove(d,s,l)
@@ -1198,7 +1195,8 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEMEMMOVE))
+}], AC_DEFINE(USEMEMMOVE),,
+  AC_NOTE(- skipping check because we are cross compiling; use memmove) AC_DEFINE(USEMEMMOVE))
 
 
 AC_TRY_RUN([
@@ -1214,7 +1212,7 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEMEMCPY))
+}], AC_DEFINE(USEMEMCPY),,:)
 
 AC_SYS_LONG_FILE_NAMES
 
@@ -1300,8 +1298,6 @@
 dnl Ptx bug workaround -- insert -lc after -ltermcap
 test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
 
-AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
-
 ETCSCREENRC=
 AC_MSG_CHECKING(for the global screenrc file)
 AC_ARG_WITH(sys-screenrc, [  --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ])