2005年12月19日月曜日

screen-4.0.2 on cygwin

こことかここを参考に、cygwin上でscreen-4.0.2をmakeできました。

reattachの動作が怪しいけれど、画面切り替えができるだけで便利。

以下、source codeへのpatch:


diff -c screen-4.0.2.orig/configure screen-4.0.2/configure
*** screen-4.0.2.orig/configure Fri Dec 5 22:46:53 2003
--- screen-4.0.2/configure Mon Dec 19 11:03:33 2005
***************
*** 4156,4361 ****
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext

- { echo "$as_me:$LINENO: checking fifos..." >&5
- echo "$as_me: checking fifos..." >&6;}
- if test "$cross_compiling" = yes; then
- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
- See \`config.log' for more details." >&5
- echo "$as_me: error: cannot run test program while cross compiling
- See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- else
- cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- /* confdefs.h. */
- _ACEOF
- cat confdefs.h >>conftest.$ac_ext
- cat >>conftest.$ac_ext <<_ACEOF
- /* end confdefs.h. */
-
- #include
- #include
- #include
-
- #ifndef O_NONBLOCK
- #define O_NONBLOCK O_NDELAY
- #endif
- #ifndef S_IFIFO
- #define S_IFIFO 0010000
- #endif
-
- char *fin = "/tmp/conftest$$";
-
- main()
- {
- struct stat stb;
- #ifdef FD_SET
- fd_set f;
- #else
- int f;
- #endif
-
- (void)alarm(5);
- #ifdef POSIX
- if (mkfifo(fin, 0777))
- #else
- if (mknod(fin, S_IFIFO|0777, 0))
- #endif
- exit(1);
- if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
- exit(1);
- close(0);
- #ifdef __386BSD__
- /*
- * The next test fails under 386BSD, but screen works using fifos.
- * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
- * the select() configuration test.
- */
- exit(0);
- #endif
- if (open(fin, O_RDONLY | O_NONBLOCK))
- exit(1);
- if (fork() == 0)
- {
- close(0);
- if (open(fin, O_WRONLY | O_NONBLOCK))
- exit(1);
- close(0);
- if (open(fin, O_WRONLY | O_NONBLOCK))
- exit(1);
- if (write(0, "TEST", 4) == -1)
- exit(1);
- exit(0);
- }
- #ifdef FD_SET
- FD_SET(0, &f);
- #else
- f = 1;
- #endif
- if (select(1, &f, 0, 0, 0) == -1)
- exit(1);
- exit(0);
- }
-
- _ACEOF
- rm -f conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- echo "- your fifos are usable" 1>&6
- fifo=1
- else
- echo "$as_me: program exited with status $ac_status" >&5
- echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5

! ( exit $ac_status )
echo "- your fifos are not usable" 1>&6
!
! fi
! rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
! fi
! rm -f /tmp/conftest*
!
! if test -n "$fifo"; then
! { echo "$as_me:$LINENO: checking for broken fifo implementation..." >&5
! echo "$as_me: checking for broken fifo implementation..." >&6;}
! if test "$cross_compiling" = yes; then
! { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
! See \`config.log' for more details." >&5
! echo "$as_me: error: cannot run test program while cross compiling
! See \`config.log' for more details." >&2;}
! { (exit 1); exit 1; }; }
! else
! cat >conftest.$ac_ext <<_ACEOF
! #line $LINENO "configure"
! /* confdefs.h. */
! _ACEOF
! cat confdefs.h >>conftest.$ac_ext
! cat >>conftest.$ac_ext <<_ACEOF
! /* end confdefs.h. */
!
! #include
! #include
! #include
! #include
!
! #ifndef O_NONBLOCK
! #define O_NONBLOCK O_NDELAY
! #endif
! #ifndef S_IFIFO
! #define S_IFIFO 0010000
! #endif
!
! char *fin = "/tmp/conftest$$";
!
! main()
! {
! struct timeval tv;
! #ifdef FD_SET
! fd_set f;
! #else
! int f;
! #endif
!
! #ifdef POSIX
! if (mkfifo(fin, 0600))
! #else
! if (mknod(fin, S_IFIFO|0600, 0))
! #endif
! exit(1);
! close(0);
! if (open(fin, O_RDONLY|O_NONBLOCK))
! exit(1);
! #ifdef FD_SET
! FD_SET(0, &f);
! #else
! f = 1;
! #endif
! tv.tv_sec = 1;
! tv.tv_usec = 0;
! if (select(1, &f, 0, 0, &tv))
! exit(1);
! exit(0);
! }
!
! _ACEOF
! rm -f conftest$ac_exeext
! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
! (eval $ac_link) 2>&5
! ac_status=$?
! echo "$as_me:$LINENO: \$? = $ac_status" >&5
! (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
! { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
! (eval $ac_try) 2>&5
! ac_status=$?
! echo "$as_me:$LINENO: \$? = $ac_status" >&5
! (exit $ac_status); }; }; then
! echo "- your implementation is ok" 1>&6
!
! else
! echo "$as_me: program exited with status $ac_status" >&5
! echo "$as_me: failed program was:" >&5
! sed 's/^/| /' conftest.$ac_ext >&5
!
! ( exit $ac_status )
! echo "- you have a broken implementation" 1>&6
! cat >>confdefs.h <<\_ACEOF
! #define BROKEN_PIPE 1
! _ACEOF
! fifobr=1
! fi
! rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
! fi
! rm -f /tmp/conftest*
! fi


{ echo "$as_me:$LINENO: checking sockets..." >&5
--- 4156,4170 ----
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext


! # Cygwin patch:
! # Cygwin's fifo implementation is broken; see
! # http://cygwin.com/ml/cygwin-apps/2005-04/msg00163.html.
! # Unfortunately, the "broken fifo implementation test" that was in this
! # script doesn't detect this, so just short-circuit the whole thing here.
! echo "$as_me: checking fifos..." >&6
echo "- your fifos are not usable" 1>&6
! fifo=


{ echo "$as_me:$LINENO: checking sockets..." >&5
Common subdirectories: screen-4.0.2.orig/doc and screen-4.0.2/doc
Common subdirectories: screen-4.0.2.orig/etc and screen-4.0.2/etc
diff -c screen-4.0.2.orig/misc.c screen-4.0.2/misc.c
*** screen-4.0.2.orig/misc.c Fri Dec 5 22:45:41 2003
--- screen-4.0.2/misc.c Mon Dec 19 11:06:26 2005
***************
*** 613,619 ****
*/
# endif /* NEEDSETENV */
#else /* USESETENV */
! # if defined(linux) || defined(__convex__) || (BSD >= 199103)
setenv(var, value, 1);
# else
setenv(var, value);
--- 613,619 ----
*/
# endif /* NEEDSETENV */
#else /* USESETENV */
! # if defined(linux) || defined(__convex__) || (BSD >= 199103) || (__CYGWIN__)
setenv(var, value, 1);
# else
setenv(var, value);
diff -c screen-4.0.2.orig/pty.c screen-4.0.2/pty.c
*** screen-4.0.2.orig/pty.c Mon Sep 8 23:26:18 2003
--- screen-4.0.2/pty.c Mon Dec 19 11:10:25 2005
***************
*** 34,42 ****
--- 34,44 ----
#endif

/* for solaris 2.1, Unixware (SVR4.2) and possibly others */
+ #ifndef __CYGWIN__
#ifdef HAVE_SVR4_PTYS
# include
#endif
+ #endif

#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
# include
Common subdirectories: screen-4.0.2.orig/terminfo and screen-4.0.2/terminfo
Common subdirectories: screen-4.0.2.orig/utf8encodings and screen-4.0.2/utf8encodings
diff -c screen-4.0.2.orig/utmp.c screen-4.0.2/utmp.c
*** screen-4.0.2.orig/utmp.c Mon Sep 8 23:27:17 2003
--- screen-4.0.2/utmp.c Mon Dec 19 11:09:41 2005
***************
*** 102,112 ****
#endif


! # if defined(GETUTENT) && (!defined(SVR4) || defined(__hpux))
# if defined(hpux) /* cruel hpux release 8.0 */
# define pututline _pututline
# endif /* hpux */
extern struct utmp *getutline(), *pututline();
# if defined(_SEQUENT_)
extern struct utmp *ut_add_user(), *ut_delete_user();
extern char *ut_find_host();
--- 102,114 ----
#endif


! # if defined(GETUTENT) && (!defined(SVR4) || defined(__hpux)) || !defined(__CYGWIN__)
# if defined(hpux) /* cruel hpux release 8.0 */
# define pututline _pututline
# endif /* hpux */
+ #ifndef __CYGWIN__
extern struct utmp *getutline(), *pututline();
+ #endif
# if defined(_SEQUENT_)
extern struct utmp *ut_add_user(), *ut_delete_user();
extern char *ut_find_host();
***************
*** 581,587 ****
--- 583,591 ----
}
#endif
setutent();
+ #ifndef __CYGWIN__
return pututline(u) != 0;
+ #endif
}

static void
***************
*** 589,597 ****
struct utmp *u;
{
u->ut_type = DEAD_PROCESS;
! #if !defined(linux) || defined(EMPTY)
! u->ut_exit.e_termination = 0;
! u->ut_exit.e_exit = 0;
#endif
#if !defined(sun) || !defined(SVR4)
u->ut_user[0] = 0; /* for Digital UNIX, kilbi@rad.rwth-aachen.de */
--- 593,601 ----
struct utmp *u;
{
u->ut_type = DEAD_PROCESS;
! #if !defined(linux) || defined(EMPTY) || defined(__CYGWIN__)
! /* u->ut_exit.e_termination = 0; */
! /* u->ut_exit.e_exit = 0; */
#endif
#if !defined(sun) || !defined(SVR4)
u->ut_user[0] = 0; /* for Digital UNIX, kilbi@rad.rwth-aachen.de */



1 件のコメント:

Leo さんのコメント...

どうもこのままコピペすると、 <や>で囲まれた部分がHTMLとして認識されて消えているので、おかしなことになるみたい。。。
すみません。

License

Creative Commons LicenseLeo's Chronicle by Taro L. Saito is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.1 Japan License.