Skip to content
Tcl Source Code Attachment Details
Login

Attachment Details

Overview

Artifact ID: 726f6d51c753e898012a28ae7e33eb68e9183da4
Ticket: 701232ffffffffffffffffffffffffffffffffff
Date: 2003-03-11 06:32:29
User: nobody
Artifact Attached: a8b6972efc3bee9611de30781410d1f045834625
Filename:tcl8.4.1.patch.3.txt
Description:BeOS port for tcl 8.4.1
Content:
     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
diff -urN ../tcl8.4.1/generic/tclPosixStr.c tcl8.4.1/generic/tclPosixStr.c
--- ../tcl8.4.1/generic/tclPosixStr.c	Wed May 29 02:14:21 2002
+++ tcl8.4.1/generic/tclPosixStr.c	Sun Dec 22 16:02:41 2002
@@ -945,7 +945,9 @@
 	case SIGALRM: return "SIGALRM";
 #endif
 #ifdef SIGBUS
+#  if !defined(SIGSEGV) || (SIGBUS != SIGSEGV)
 	case SIGBUS: return "SIGBUS";
+#  endif
 #endif
 #ifdef SIGCHLD
 	case SIGCHLD: return "SIGCHLD";
@@ -1077,7 +1079,9 @@
 	case SIGALRM: return "alarm clock";
 #endif
 #ifdef SIGBUS
+#  if !defined(SIGSEGV) || (SIGBUS != SIGSEGV)
 	case SIGBUS: return "bus error";
+#  endif
 #endif
 #ifdef SIGCHLD
 	case SIGCHLD: return "child status changed";
diff -urN ../tcl8.4.1/unix/tcl.m4 tcl8.4.1/unix/tcl.m4
--- ../tcl8.4.1/unix/tcl.m4	Tue Oct 22 21:18:39 2002
+++ tcl8.4.1/unix/tcl.m4	Sun Dec 22 16:44:51 2002
@@ -914,6 +914,15 @@
 		fi
 	    fi
 	    ;;
+	BeOS*)
+	    SHLIB_CFLAGS="-fPIC"
+	    SHLIB_LD="cc -nostart"
+	    SHLIB_LD_LIBS='${LIBS}'
+	    SHLIB_SUFFIX=".so"
+	    DL_OBJS="tclLoadDl.o"
+	    DL_LIBS="-ldl"
+	    LDFLAGS="-lsocket -lbind"
+	    ;;
 	BSD/OS-2.1*|BSD/OS-3*)
 	    SHLIB_CFLAGS=""
 	    SHLIB_LD="shlicc -r"
@@ -2314,6 +2323,13 @@
     AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
 	    [LIBS="$LIBS -lnsl"])])
     
+    #--------------------------------------------------------------------
+    # Check for inet_ntoa in -lbind, for BeOS (which also needs -lsocket,
+    # even if the network functions are in -lnet which is always linked 
+    # to, for compatibility.
+    #--------------------------------------------------------------------
+    AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
+
     # Don't perform the eval of the libraries here because DL_LIBS
     # won't be set until we call SC_CONFIG_CFLAGS
 
diff -urN ../tcl8.4.1/unix/tclUnixChan.c tcl8.4.1/unix/tclUnixChan.c
--- ../tcl8.4.1/unix/tclUnixChan.c	Tue Sep  3 04:01:25 2002
+++ tcl8.4.1/unix/tclUnixChan.c	Sun Dec 22 16:02:41 2002
@@ -54,8 +54,15 @@
 #   define IOSTATE			struct termios
 #   define GETIOSTATE(fd, statePtr)	tcgetattr((fd), (statePtr))
 #   define SETIOSTATE(fd, statePtr)	tcsetattr((fd), TCSADRAIN, (statePtr))
-#   define GETCONTROL(fd, intPtr)	ioctl((fd), TIOCMGET, (intPtr))
-#   define SETCONTROL(fd, intPtr)	ioctl((fd), TIOCMSET, (intPtr))
+#   ifdef TIOCMGET
+#       define GETCONTROL(fd, intPtr)	ioctl((fd), TIOCMGET, (intPtr))
+#       define SETCONTROL(fd, intPtr)	ioctl((fd), TIOCMSET, (intPtr))
+#   else
+#       if defined(TCSETDTR) && defined(TCSETRTS)
+#           define SETCONTROLDTR(fd, intPtr)	ioctl((fd), TCSETDTR, (intPtr))
+#           define SETCONTROLRTS(fd, intPtr)	ioctl((fd), TCSETRTS, (intPtr))
+#       endif
+#   endif /* TIOCMGET */
     /*
      * TIP #35 introduced a different on exit flush/close behavior that
      * doesn't work correctly with standard channels on all systems.
@@ -1011,7 +1018,9 @@
 	    return TCL_ERROR;
 	}
 
+#ifdef GETCONTROL
 	GETCONTROL(fsPtr->fd, &control);
+#endif
 	while (argc > 1) {
 	    if (Tcl_GetBoolean(interp, argv[1], &flag) == TCL_ERROR) {
 		return TCL_ERROR;
@@ -1024,8 +1033,13 @@
 		    control &= ~TIOCM_DTR;
 		}
 #else /* !TIOCM_DTR */
+#    if defined(TCSETDTR) && defined(TCSETRTS)
+		control = flag;
+		SETCONTROLDTR(fsPtr->fd, &control);
+#    else
 		UNSUPPORTED_OPTION("-ttycontrol DTR");
 		return TCL_ERROR;
+#    endif /* TCSETDTR && TCSETRTS */
 #endif /* TIOCM_DTR */
 	    } else if (strncasecmp(argv[0], "RTS", strlen(argv[0])) == 0) {
 #ifdef TIOCM_RTS
@@ -1035,8 +1049,13 @@
 		    control &= ~TIOCM_RTS;
 		}
 #else /* !TIOCM_RTS*/
+#    if defined(TCSETDTR) && defined(TCSETRTS)
+		control = flag;
+		SETCONTROLRTS(fsPtr->fd, &control);
+#    else
 		UNSUPPORTED_OPTION("-ttycontrol RTS");
 		return TCL_ERROR;
+#    endif /* TCSETDTR && TCSETRTS */
 #endif /* TIOCM_RTS*/
 	    } else if (strncasecmp(argv[0], "BREAK", strlen(argv[0])) == 0) {
 #ifdef SETBREAK
@@ -1055,8 +1074,9 @@
 	    }
 	    argc -= 2, argv += 2;
 	} /* while (argc > 1) */
-
+#ifdef GETCONTROL
 	SETCONTROL(fsPtr->fd, &control);
+#endif
 	return TCL_OK;
     }
 
@@ -1170,10 +1190,15 @@
      * but not returned by unnamed [fconfigure chan]
      */
     if ((len > 4) && (strncmp(optionName, "-ttystatus", len) == 0)) {
+#ifdef GETCONTROL
 	int status;
 	valid = 1;
 	GETCONTROL(fsPtr->fd, &status);
 	TtyModemStatusStr(status, dsPtr);
+#else
+	UNSUPPORTED_OPTION("-ttystatus");
+	valid = 0;
+#endif /* GETCONTROL */
     }
 #endif /* USE_TERMIOS */
 
diff -urN ../tcl8.4.1/unix/tclUnixPort.h tcl8.4.1/unix/tclUnixPort.h
--- ../tcl8.4.1/unix/tclUnixPort.h	Tue Jul  2 19:10:33 2002
+++ tcl8.4.1/unix/tclUnixPort.h	Sun Dec 22 16:02:41 2002
@@ -406,6 +406,15 @@
 #endif
 
 /*
+ * Make sure that P_tmpdir is defined.
+ * (BeOS needs this)
+ */
+
+#ifndef P_tmpdir
+#   define P_tmpdir "/tmp"
+#endif
+
+/*
  * The following macro defines the type of the mask arguments to
  * select:
  */