expect: cross compile

This commit is contained in:
Đoàn Trần Công Danh 2020-04-03 23:01:46 +07:00 committed by Piraty
parent 10c039db79
commit 4459113b9d
5 changed files with 320 additions and 1 deletions

View File

@ -0,0 +1,21 @@
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
configure.in | 2 ++
1 file changed, 2 insertions(+)
diff --git configure.in configure.in
index aa6fd6e..ad8db32 100755
--- configure.in
+++ configure.in
@@ -9,6 +9,8 @@ TEA_INIT([3.9])
AC_CONFIG_AUX_DIR(tclconfig)
+AC_PROG_CC([cc gcc])
+
#--------------------------------------------------------------------
# Configure script for package 'Expect'.
# TEA compliant.
--
2.26.0.292.g33ef6b2f38

View File

@ -0,0 +1,41 @@
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
configure.in | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git configure.in configure.in
index ad8db32..6570a07 100755
--- configure.in
+++ configure.in
@@ -469,21 +469,19 @@ memcpy(s1,s2,0);
# 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_PROGRAM([[
#include <sys/wait.h>
-main() {
-#ifndef WNOHANG
- return 0;
-#else
- return 1;
+]],[[
+#ifdef WNOHANG
+ #error WNOHANG
#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])
--
2.26.0.292.g33ef6b2f38

View File

@ -0,0 +1,56 @@
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
configure.in | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git configure.in configure.in
index 6570a07..0e4c9d1 100755
--- configure.in
+++ configure.in
@@ -486,6 +486,25 @@ AC_LANG_PROGRAM([[
AC_MSG_CHECKING([if any value exists for WNOHANG])
rm -rf wnohang
+AC_COMPILE_IFELSE([
+AC_LANG_PROGRAM([[
+#include <sys/wait.h>
+]],[[
+#ifdef WNOHANG
+ int wnohang_value = WNOHANG;
+#else
+ #error no value
+#endif
+]])],
+ AC_MSG_RESULT(yes)
+,
+ AC_MSG_RESULT(no)
+ expect_cv_wnohang_value=1
+)
+
+AC_CACHE_CHECK([value of WNOHANG], [expect_cv_wnohang_value],
+[
+rm -rf wnohang
AC_TRY_RUN([
#include <stdio.h>
#include <sys/wait.h>
@@ -500,14 +519,15 @@ main() {
#endif
}],
AC_MSG_RESULT(yes)
- AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`)
rm -f wnohang
,
AC_MSG_RESULT(no)
- AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
,
AC_MSG_ERROR([Expect can't be cross compiled])
)
+])
+
+AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, $expect_cv_wnohang_value)
#
# check how signals work
--
2.26.0.292.g33ef6b2f38

View File

@ -0,0 +1,195 @@
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
configure.in | 79 +++++++++++++++++++++-------------------------------
1 file changed, 32 insertions(+), 47 deletions(-)
diff --git configure.in configure.in
index 0e4c9d1..d41a7a4 100755
--- configure.in
+++ configure.in
@@ -732,20 +732,17 @@ fi
# first check for the pure bsd
AC_MSG_CHECKING([for struct sgttyb])
-AC_TRY_RUN([
+AC_COMPILE_IFELSE([
+AC_LANG_PROGRAM([[
#include <sgtty.h>
-main()
-{
+]],[[
struct sgttyb tmp;
- exit(0);
-}],
+]])],
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
@@ -757,107 +754,99 @@ if test $mach -eq 0 ; then
# 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>
- main()
- {
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ #include <termio.h>
+ ]],[[
struct termio tmp;
- exit(0);
- }],
+ ]])],
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([
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
# ifdef HAVE_INTTYPES_H
# include <inttypes.h>
# endif
# include <termios.h>
- main()
- {
+ ]],[[
struct termios tmp;
- exit(0);
- }],
+ ]])],
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_PROGRAM([[
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <termios.h>
-main() {
+]],[[
#if defined(TCGETS) || defined(TCGETA)
return 0;
#else
- return 1;
+ #error no TCGETS or 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_PROGRAM([[
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <termios.h>
-main() {
+]],[[
#ifdef TIOCGWINSZ
return 0;
#else
- return 1;
+ #error no 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([
-main(){
+AC_COMPILE_IFELSE([
+AC_LANG_PROGRAM([[
+]],[[
#ifdef CRAY
return 0;
#else
- return 1;
+ #error no CRAY
#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])
)
#
@@ -895,21 +884,17 @@ AC_FUNC_SETPGRP
# check for timezones
#
AC_MSG_CHECKING([for SV-style timezone])
-AC_TRY_RUN([
+AC_LINK_IFELSE([
+AC_LANG_PROGRAM([[
extern char *tzname[2];
extern int daylight;
-main()
-{
+]],[[
int *x = &daylight;
char **y = tzname;
-
- exit(0);
-}],
+]])],
AC_DEFINE(HAVE_SV_TIMEZONE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
-,
- AC_MSG_ERROR([Expect can't be cross compiled])
)
--
2.26.0.292.g33ef6b2f38

View File

@ -4,7 +4,9 @@ version=5.45.4
revision=2
wrksrc=${pkgname}${version}
build_style=gnu-configure
configure_args="expect_cv_wnohang_value=1"
make_check_target="test"
hostmakedepends="automake libtool tcl-devel"
makedepends="tcl-devel"
short_desc="Programmed dialogue with interactive programs"
maintainer="Leah Neukirchen <leah@vuxu.org>"
@ -12,7 +14,6 @@ license="Public Domain"
homepage="http://www.nist.gov/el/msid/expect.cfm"
distfiles="${SOURCEFORGE_SITE}/${pkgname}/Expect/${version}/${pkgname}${version}.tar.gz"
checksum=49a7da83b0bdd9f46d04a04deec19c7767bb9a323e40c4781f89caf760b92c34
nocross=yes
alternatives="
mkpasswd:mkpasswd:/usr/bin/expect-mkpasswd
@ -20,11 +21,16 @@ alternatives="
LDFLAGS+=" -Wl,-rpath=/usr/lib:/usr/lib/${pkgname}${version}"
pre_configure() {
autoreconf -fi
}
post_install() {
rm ${DESTDIR}/usr/bin/weather
mv ${DESTDIR}/usr/bin/{,expect-}mkpasswd
mv ${DESTDIR}/usr/share/man/man1/{,expect-}mkpasswd.1
}
expect-devel_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" -- development files"