diff -urN cmake-2.4.3-original/bootstrap cmake-2.4.3/bootstrap
--- cmake-2.4.3-original/bootstrap	2006-07-31 10:49:56.000000000 -0400
+++ cmake-2.4.3/bootstrap	2006-11-06 02:50:36.000000000 -0500
@@ -42,6 +42,13 @@
   cmake_system_darwin=false
 fi
 
+# Determine whether this is BeOS 
+if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
+  cmake_system_beos=true
+else
+  cmake_system_beos=false
+fi
+
 # Choose the generator to use for bootstrapping.
 if ${cmake_system_mingw}; then
   # Bootstrapping from an MSYS prompt.
@@ -523,6 +530,13 @@
   cmake_ld_flags=${LDFLAGS}
 fi
 
+# Add BeOS toolkits...
+if ${cmake_system_beos}; then
+  cmake_ld_flags="${LDFLAGS} -lroot -lbe"
+else
+  cmake_ld_flags=${LDFLAGS}
+fi
+
 # Test C compiler
 cmake_c_compiler=
 
diff -urN cmake-2.4.3-original/Modules/CheckForPthreads.c cmake-2.4.3/Modules/CheckForPthreads.c
--- cmake-2.4.3-original/Modules/CheckForPthreads.c	2006-07-31 10:49:56.000000000 -0400
+++ cmake-2.4.3/Modules/CheckForPthreads.c	2006-11-06 02:52:08.000000000 -0500
@@ -16,7 +16,10 @@
   pthread_create(&tid[0], 0, runner, (void*)1);
   pthread_create(&tid[1], 0, runner, (void*)2);
   
+#ifndef __BEOS__  // (no usleep on BeOS.)
   usleep(1); // for strange behavior on single-processor sun
+#endif
+
   pthread_join(tid[0], 0);
   pthread_join(tid[1], 0);
   if(ac > 1000){return *av[0];}
diff -urN cmake-2.4.3-original/Modules/CMakeDetermineCXXCompiler.cmake cmake-2.4.3/Modules/CMakeDetermineCXXCompiler.cmake
--- cmake-2.4.3-original/Modules/CMakeDetermineCXXCompiler.cmake	2006-07-31 10:49:56.000000000 -0400
+++ cmake-2.4.3/Modules/CMakeDetermineCXXCompiler.cmake	2006-11-07 06:46:23.000000000 -0500
@@ -58,6 +58,14 @@
   SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
 ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
 
+# The g++ that comes with BeOS 5 segfaults if you run "g++ -E"
+#  ("gcc -E" is fine), which throws up a system dialog box that hangs cmake
+#  until the user clicks "OK"...so for now, we just assume it's g++.
+IF(BEOS)
+  SET(CMAKE_COMPILER_IS_GNUCXX 1)
+  SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
+ENDIF(BEOS)
+
 IF(NOT CMAKE_COMPILER_IS_GNUCXX_RUN)
   # test to see if the cxx compiler is gnu
   SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
diff -urN cmake-2.4.3-original/Modules/Platform/BeOS.cmake cmake-2.4.3/Modules/Platform/BeOS.cmake
--- cmake-2.4.3-original/Modules/Platform/BeOS.cmake	1969-12-31 19:00:00.000000000 -0500
+++ cmake-2.4.3/Modules/Platform/BeOS.cmake	2006-11-06 02:50:36.000000000 -0500
@@ -0,0 +1,10 @@
+# GCC is the default compiler on BeOS.
+INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
+
+SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
diff -urN cmake-2.4.3-original/Source/cmCTest.cxx cmake-2.4.3/Source/cmCTest.cxx
--- cmake-2.4.3-original/Source/cmCTest.cxx	2006-07-31 10:49:57.000000000 -0400
+++ cmake-2.4.3/Source/cmCTest.cxx	2006-11-06 02:50:36.000000000 -0500
@@ -48,6 +48,10 @@
 
 #include <memory> // auto_ptr
 
+#if defined(__BEOS__)
+#include <be/kernel/OS.h>   /* disable_debugger() API. */
+#endif
+
 #define DEBUGOUT std::cout << __LINE__ << " "; std::cout
 #define DEBUGERR std::cerr << __LINE__ << " "; std::cerr
 
@@ -584,6 +588,8 @@
   cmSystemTools::PutEnv("DASHBOARD_TEST_FROM_CTEST=" CMake_VERSION);
 #if defined(_WIN32)
   SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+#elif defined(__BEOS__)
+  disable_debugger(1);
 #endif
 }
 
diff -urN cmake-2.4.3-original/Source/cmDependsJavaLexer.cxx cmake-2.4.3/Source/cmDependsJavaLexer.cxx
--- cmake-2.4.3-original/Source/cmDependsJavaLexer.cxx	2006-07-31 10:49:57.000000000 -0400
+++ cmake-2.4.3/Source/cmDependsJavaLexer.cxx	2006-11-06 02:50:36.000000000 -0500
@@ -22,6 +22,10 @@
 #include <errno.h>
 #include <stdlib.h>
 
+#if defined(__BEOS__)
+#include <unistd.h>   /* prevents a conflict with a #define later on... */
+#endif
+
 /* end standard C headers. */
 
 /* flex integer type definitions */
diff -urN cmake-2.4.3-original/Source/cmDependsJavaLexer.h cmake-2.4.3/Source/cmDependsJavaLexer.h
--- cmake-2.4.3-original/Source/cmDependsJavaLexer.h	2006-07-31 10:49:57.000000000 -0400
+++ cmake-2.4.3/Source/cmDependsJavaLexer.h	2006-11-06 02:50:36.000000000 -0500
@@ -22,6 +22,10 @@
 #include <errno.h>
 #include <stdlib.h>
 
+#if defined(__BEOS__)
+#include <unistd.h>   /* prevents a conflict with a #define later on... */
+#endif
+
 /* end standard C headers. */
 
 /* flex integer type definitions */
diff -urN cmake-2.4.3-original/Source/cmMakefile.cxx cmake-2.4.3/Source/cmMakefile.cxx
--- cmake-2.4.3-original/Source/cmMakefile.cxx	2006-07-31 10:49:57.000000000 -0400
+++ cmake-2.4.3/Source/cmMakefile.cxx	2006-11-06 02:50:36.000000000 -0500
@@ -1906,6 +1906,9 @@
 #if defined(__APPLE__)
   this->AddDefinition("APPLE", "1");
 #endif
+#if defined(__BEOS__)
+  this->AddDefinition("BEOS", "1");
+#endif
 
   char temp[1024];
   sprintf(temp, "%d", cmMakefile::GetMinorVersion());
diff -urN cmake-2.4.3-original/Source/cmSystemTools.cxx cmake-2.4.3/Source/cmSystemTools.cxx
--- cmake-2.4.3-original/Source/cmSystemTools.cxx	2006-07-31 10:49:57.000000000 -0400
+++ cmake-2.4.3/Source/cmSystemTools.cxx	2006-11-06 02:50:36.000000000 -0500
@@ -1432,7 +1432,12 @@
     return -1;
     }
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if defined(__BEOS__)  // no fchmod on BeOS...do it to the pathname instead.
+  if ((oflags & O_CREAT) && chmod(pathname, mode))
+    {
+    return -1;
+    }
+#elif !defined(_WIN32) || defined(__CYGWIN__)
   if ((oflags & O_CREAT) && fchmod(fd, mode))
     {
     return -1;
diff -urN cmake-2.4.3-original/Source/kwsys/DynamicLoader.cxx cmake-2.4.3/Source/kwsys/DynamicLoader.cxx
--- cmake-2.4.3-original/Source/kwsys/DynamicLoader.cxx	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/DynamicLoader.cxx	2006-11-06 02:53:33.000000000 -0500
@@ -327,7 +327,112 @@
 #endif //_WIN32
 
 // ---------------------------------------------------------------
-// 4. Implementation for default UNIX machines.
+// 4. Implementation for BeOS
+#ifdef __BEOS__
+#include <string.h> // for strerror()
+#include <be/kernel/image.h>
+#include <be/support/Errors.h>
+#define DYNAMICLOADER_DEFINED 1
+
+namespace KWSYS_NAMESPACE
+{
+
+static image_id last_dynamic_err = B_OK;
+
+//----------------------------------------------------------------------------
+DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname )
+{
+  // image_id's are integers, errors are negative. Add one just in case we
+  //  get a valid image_id of zero (is that even possible?).
+  image_id rc = load_add_on(libname);
+  if (rc < 0)
+    {
+    last_dynamic_err = rc;
+    return 0;
+    }
+
+  return rc+1;
+}
+
+//----------------------------------------------------------------------------
+int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
+{
+  if (!lib)
+    {
+      last_dynamic_err = B_BAD_VALUE;
+      return 0;
+    }
+  else
+    {
+    // The function dlclose() returns 0 on success, and non-zero on error.
+    status_t rc = unload_add_on(lib-1);
+    if (rc != B_OK)
+      {
+      last_dynamic_err = rc;
+      return 0;
+      }
+    }
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
+  DynamicLoader::LibraryHandle lib, const char* sym)
+{
+  // Hack to cast pointer-to-data to pointer-to-function.
+  union 
+  {
+    void* pvoid;
+    DynamicLoader::SymbolPointer psym;
+  } result;
+
+  result.psym = NULL;
+
+  if (!lib)
+    {
+      last_dynamic_err = B_BAD_VALUE;
+    }
+  else
+    {
+    // !!! FIXME: BeOS can do function-only lookups...does this ever
+    // !!! FIXME:  actually _want_ a data symbol lookup, or was this union
+    // !!! FIXME:  a leftover of dlsym()? (s/ANY/TEXT for functions only).
+    status_t rc = get_image_symbol(lib-1,sym,B_SYMBOL_TYPE_ANY,&result.pvoid);
+    if (rc != B_OK)
+      {
+      last_dynamic_err = rc;
+      result.psym = NULL;
+      }
+    }
+  return result.psym;
+}
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LibPrefix()
+{
+  return "lib";
+}
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LibExtension()
+{
+  return ".so";
+}
+
+//----------------------------------------------------------------------------
+const char* DynamicLoader::LastError()
+{
+  const char *retval = strerror(last_dynamic_err);
+  last_dynamic_err = B_OK;
+  return retval;
+}
+
+} // namespace KWSYS_NAMESPACE
+#endif
+
+// ---------------------------------------------------------------
+// 5. Implementation for default UNIX machines.
 // if nothing has been defined then use this
 #ifndef DYNAMICLOADER_DEFINED
 #define DYNAMICLOADER_DEFINED 1
diff -urN cmake-2.4.3-original/Source/kwsys/DynamicLoader.hxx.in cmake-2.4.3/Source/kwsys/DynamicLoader.hxx.in
--- cmake-2.4.3-original/Source/kwsys/DynamicLoader.hxx.in	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/DynamicLoader.hxx.in	2006-11-06 02:50:36.000000000 -0500
@@ -25,6 +25,8 @@
   #if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
     #include <mach-o/dyld.h>
   #endif
+#elif defined(__BEOS__)
+  #include <be/kernel/image.h>
 #endif
 
 namespace @KWSYS_NAMESPACE@
@@ -62,6 +64,8 @@
   #else
     typedef void* LibraryHandle;
   #endif
+#elif defined(__BEOS__)
+  typedef image_id LibraryHandle;
 #else
   typedef void* LibraryHandle;
 #endif
diff -urN cmake-2.4.3-original/Source/kwsys/ProcessUNIX.c cmake-2.4.3/Source/kwsys/ProcessUNIX.c
--- cmake-2.4.3-original/Source/kwsys/ProcessUNIX.c	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/ProcessUNIX.c	2006-11-06 02:58:33.000000000 -0500
@@ -62,6 +62,26 @@
 #include <dirent.h>    /* DIR, dirent */
 #include <ctype.h>     /* isspace */
 
+#if defined(__BEOS__)
+#include <be/kernel/OS.h>
+/* BeOS doesn't have usleep(), but it has snooze(), which is identical. */
+static inline void usleep(unsigned int msec)
+{
+  snooze(msec);
+}
+#endif
+
+/*
+ * BeOS's select() works like WinSock: it's for networking only, and doesn't
+ *  work with Unix file handles...socket and file handles are different
+ *  namespaces (the same descriptor means different things in each context!)
+ * So on Unix-like systems where select() is flakey, we'll set the pipes' file
+ *  handles to be non-blocking and just read them directly without select().
+ */
+#if !defined(__BEOS__)
+#define USE_SELECT 1
+#endif
+
 /* The number of pipes for the child's output.  The standard stdout
    and stderr pipes are the first two.  One more pipe is used to
    detect when the child process has terminated.  The third pipe is
@@ -121,8 +141,7 @@
 static void kwsysProcessKill(pid_t process_id);
 static int kwsysProcessesAdd(kwsysProcess* cp);
 static void kwsysProcessesRemove(kwsysProcess* cp);
-static void kwsysProcessesSignalHandler(int signum, siginfo_t* info,
-                                        void* ucontext);
+static void kwsysProcessesSignalHandler(int signum);
 static char** kwsysProcessParseVerbatimCommand(const char* command);
 
 /*--------------------------------------------------------------------------*/
@@ -176,8 +195,10 @@
   /* The number of pipes left open during execution.  */
   int PipesLeft;
 
+#ifdef USE_SELECT
   /* File descriptor set for call to select.  */
   fd_set PipeSet;
+#endif
 
   /* The number of children still executing.  */
   int CommandsLeft;
@@ -586,6 +607,17 @@
 }
 
 /*--------------------------------------------------------------------------*/
+static int kwsysProcessSetNonBlocking(int fd)
+{
+  int flags = fcntl(fd, F_GETFL);
+  if (flags >= 0)
+    {
+    flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+    }
+  return flags >= 0;
+}
+
+/*--------------------------------------------------------------------------*/
 void kwsysProcess_Execute(kwsysProcess* cp)
 {
   int i;
@@ -653,6 +685,15 @@
   cp->PipeReadEnds[KWSYSPE_PIPE_STDERR] = p[0];
       si.StdErr = p[1];
 
+#ifndef USE_SELECT
+    if(!kwsysProcessSetNonBlocking(p[0]))
+      {
+      kwsysProcessCleanup(cp, 1);
+      kwsysProcessCleanupDescriptor(&si.StdErr);
+      return;
+      }
+#endif
+
     /* Set close-on-exec flag on the pipe's ends.  */
     if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) ||
        (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0))
@@ -692,10 +733,23 @@
   /* Create the pipeline of processes.  */
   {
   int readEnd = -1;
+  int failed = 0;
   for(i=0; i < cp->NumberOfCommands; ++i)
     {
     if(!kwsysProcessCreate(cp, i, &si, &readEnd))
       {
+      failed = 1;
+      }
+
+#ifndef USE_SELECT
+    if(!kwsysProcessSetNonBlocking(readEnd))
+      {
+      failed = 1;
+      }
+#endif
+
+    if(failed)
+      {
       kwsysProcessCleanup(cp, 1);
 
       /* Release resources that may have been allocated for this
@@ -763,6 +817,7 @@
     {
     if(cp->PipeReadEnds[i] >= 0)
       {
+#ifdef USE_SELECT
       /* If the pipe was reported by the last call to select, we must
          read from it.  Ignore the data.  */
       if(FD_ISSET(cp->PipeReadEnds[i], &cp->PipeSet))
@@ -775,6 +830,20 @@
         while((read(cp->PipeReadEnds[i], cp->PipeBuffer,
                     KWSYSPE_PIPE_BUFFER_SIZE) < 0) && (errno == EINTR));
         }
+#else
+      /* Non blocking i/o: read until there's nothing left to read. */
+      while (1)
+        {
+            int br = read(cp->PipeReadEnds[i], cp->PipeBuffer,
+                            KWSYSPE_PIPE_BUFFER_SIZE);
+            if ( ((br < 0) && (errno == EINTR)) || (br > 0) )
+              {
+                continue;
+              }
+
+            break;
+        }
+#endif
 
       /* We are done reading from this pipe.  */
       kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
@@ -789,6 +858,7 @@
   cp->State = kwsysProcess_State_Disowned;
 }
 
+#ifdef USE_SELECT
 /*--------------------------------------------------------------------------*/
 int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
                              double* userTimeout)
@@ -991,6 +1061,179 @@
     }
 }
 
+#else  /* non-blocking read version follows... */
+
+int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
+                             double* userTimeout)
+{
+  int i;
+  int max = -1;
+  kwsysProcessTimeNative timeoutLength;
+  kwsysProcessTime timeoutTime;
+  kwsysProcessTime userStartTime = {0, 0};
+  int user = 0;
+  int expired = 0;
+  int pipeId = kwsysProcess_Pipe_None;
+  int numReady = 0;
+  unsigned int msec = 0;
+
+  /* Make sure we are executing a process.  */
+  if(!cp || cp->State != kwsysProcess_State_Executing || cp->Killed ||
+     cp->TimeoutExpired)
+    {
+    return kwsysProcess_Pipe_None;
+    }
+
+  /* Record the time at which user timeout period starts.  */
+  if(userTimeout)
+    {
+    userStartTime = kwsysProcessTimeGetCurrent();
+    }
+
+  /* Calculate the time at which a timeout will expire, and whether it
+     is the user or process timeout.  */
+  user = kwsysProcessGetTimeoutTime(cp, userTimeout, &timeoutTime);
+
+  /* Data can only be available when pipes are open.  If the process
+     is not running, cp->PipesLeft will be 0.  */
+  while(cp->PipesLeft > 0)
+    {
+    /* Check for any open pipes with data reported ready by the last
+       call to select.  According to "man select_tut" we must deal
+       with all descriptors reported by a call to select before
+       passing them to another select call.  */
+    for(i=0; i < KWSYSPE_PIPE_COUNT; ++i)
+      {
+      if(cp->PipeReadEnds[i] >= 0)
+        {
+        const int fd = cp->PipeReadEnds[i];
+        int n = read(fd, cp->PipeBuffer, KWSYSPE_PIPE_BUFFER_SIZE);
+        if(n > 0)
+          {
+          /* We have data on this pipe.  */
+          if(i == KWSYSPE_PIPE_SIGNAL)
+            {
+            /* A child process has terminated.  */
+            kwsysProcessDestroy(cp);
+            }
+          else if(data && length)
+            {
+            /* Report this data.  */
+            *data = cp->PipeBuffer;
+            *length = n;
+            switch(i)
+              {
+              case KWSYSPE_PIPE_STDOUT:
+                pipeId = kwsysProcess_Pipe_STDOUT; break;
+              case KWSYSPE_PIPE_STDERR:
+                pipeId = kwsysProcess_Pipe_STDERR; break;
+              };
+            }
+          break;
+          }
+        else if (n == 0)  /* EOF */
+          {
+          /* We are done reading from this pipe.  */
+          kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
+          --cp->PipesLeft;
+
+          if(i == KWSYSPE_PIPE_SIGNAL)
+            {
+            /* A child process has terminated.  */
+            kwsysProcessDestroy(cp);
+            break;
+            }
+          }
+        else if (n < 0)  /* error */
+          {
+          if ((errno != EINTR) && (errno != EAGAIN))
+            {
+            strncpy(cp->ErrorMessage,strerror(errno),KWSYSPE_PIPE_BUFFER_SIZE);
+
+            /* Kill the children now.  */
+            kwsysProcess_Kill(cp);
+            cp->Killed = 0;
+            cp->SelectError = 1;
+            break;
+            }
+          }
+        }
+      }
+
+    /* If we have data, break early.  */
+    if(pipeId)
+      {
+      break;
+      }
+
+    if(kwsysProcessGetTimeoutLeft(&timeoutTime, user?userTimeout:0, &timeoutLength))
+      {
+      /* Timeout has already expired.  */
+      expired = 1;
+      break;
+      }
+
+    if((timeoutLength.tv_sec == 0) && (timeoutLength.tv_usec == 0))
+      {
+      /* Timeout has already expired.  */
+      expired = 1;
+      break;
+      }
+
+    /* Sleep a little, try again. */
+    msec = ((timeoutLength.tv_sec * 1000) + (timeoutLength.tv_usec / 1000));
+    if (msec > 100000)
+      {
+      msec = 100000;  /* don't sleep more than 100 milliseconds at a time */
+      }
+    usleep(msec);
+    }
+
+  /* Update the user timeout.  */
+  if(userTimeout)
+    {
+    kwsysProcessTime userEndTime = kwsysProcessTimeGetCurrent();
+    kwsysProcessTime difference = kwsysProcessTimeSubtract(userEndTime,
+                                                     userStartTime);
+    double d = kwsysProcessTimeToDouble(difference);
+    *userTimeout -= d;
+    if(*userTimeout < 0)
+      {
+      *userTimeout = 0;
+      }
+    }
+
+  /* Check what happened.  */
+  if(pipeId)
+    {
+    /* Data are ready on a pipe.  */
+    return pipeId;
+    }
+  else if(expired)
+    {
+    /* A timeout has expired.  */
+    if(user)
+      {
+      /* The user timeout has expired.  It has no time left.  */
+      return kwsysProcess_Pipe_Timeout;
+      }
+    else
+      {
+      /* The process timeout has expired.  Kill the children now.  */
+      kwsysProcess_Kill(cp);
+      cp->Killed = 0;
+      cp->TimeoutExpired = 1;
+      return kwsysProcess_Pipe_None;
+      }
+    }
+  else
+    {
+    /* No pipes are left open.  */
+    return kwsysProcess_Pipe_None;
+    }
+}
+#endif
+
 /*--------------------------------------------------------------------------*/
 int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
 {
@@ -1132,7 +1375,9 @@
   cp->TimeoutExpired = 0;
   cp->PipesLeft = 0;
   cp->CommandsLeft = 0;
+#ifdef USE_SELECT
   FD_ZERO(&cp->PipeSet);
+#endif
   cp->State = kwsysProcess_State_Starting;
   cp->Killed = 0;
   cp->ExitException = kwsysProcess_Exception_None;
@@ -2133,10 +2378,8 @@
 
   /* Switch the pipe to non-blocking mode so that reading a byte can
      be an atomic test-and-set.  */
-  if((oldfl[0] = fcntl(p[0], F_GETFL) < 0) ||
-     (oldfl[1] = fcntl(p[1], F_GETFL) < 0) ||
-     (fcntl(p[0], F_SETFL, oldfl[0] | O_NONBLOCK) < 0) ||
-     (fcntl(p[1], F_SETFL, oldfl[1] | O_NONBLOCK) < 0))
+  if((!kwsysProcessSetNonBlocking(p[0])) ||
+     (!kwsysProcessSetNonBlocking(p[1])))
     {
     return 0;
     }
@@ -2200,8 +2443,8 @@
        interrupted.  */
     struct sigaction newSigChldAction;
     memset(&newSigChldAction, 0, sizeof(struct sigaction));
-    newSigChldAction.sa_sigaction = kwsysProcessesSignalHandler;
-    newSigChldAction.sa_flags = SA_NOCLDSTOP | SA_RESTART | SA_SIGINFO;
+    newSigChldAction.sa_handler = kwsysProcessesSignalHandler;
+    newSigChldAction.sa_flags = SA_NOCLDSTOP;
     while((sigaction(SIGCHLD, &newSigChldAction,
                      &kwsysProcessesOldSigChldAction) < 0) &&
           (errno == EINTR));
@@ -2261,14 +2504,12 @@
 }
 
 /*--------------------------------------------------------------------------*/
-static void kwsysProcessesSignalHandler(int signum, siginfo_t* info,
-                                        void* ucontext)
+static void kwsysProcessesSignalHandler(int signum)
 {
+  struct sigaction newSigChldAction;
+
   /* Signal all process objects that a child has terminated.  */
   int i;
-  (void)signum;
-  (void)info;
-  (void)ucontext;
   for(i=0; i < kwsysProcesses.Count; ++i)
     {
     /* Set the pipe in a signalled state.  */
@@ -2277,6 +2518,15 @@
     read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
     write(cp->SignalPipe, &buf, 1);
     }
+
+    /* Re-Install our handler for SIGCHLD.  Repeat call until it is not
+       interrupted.  */
+    memset(&newSigChldAction, 0, sizeof(struct sigaction));
+    newSigChldAction.sa_handler = kwsysProcessesSignalHandler;
+    newSigChldAction.sa_flags = SA_NOCLDSTOP;
+    while((sigaction(SIGCHLD, &newSigChldAction,
+                     &kwsysProcessesOldSigChldAction) < 0) &&
+          (errno == EINTR));
 }
 
 /*--------------------------------------------------------------------------*/
diff -urN cmake-2.4.3-original/Source/kwsys/SystemTools.cxx cmake-2.4.3/Source/kwsys/SystemTools.cxx
--- cmake-2.4.3-original/Source/kwsys/SystemTools.cxx	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/SystemTools.cxx	2006-11-07 04:44:09.000000000 -0500
@@ -108,6 +108,33 @@
 #define _chdir chdir
 #endif
 
+#if defined(__BEOS__)
+#include <be/kernel/OS.h>
+#include <be/storage/Path.h>
+// BeOS doesn't have usleep(), but it has snooze(), which is identical.
+static inline void usleep(unsigned int msec)
+{
+  ::snooze(msec);
+}
+
+// BeOS also doesn't have realpath(), but its C++ API offers something close.
+static inline char *realpath(const char *path, char *resolved_path)
+{
+  const size_t maxlen = KWSYS_SYSTEMTOOLS_MAXPATH;
+  snprintf(resolved_path, maxlen, "%s", path);
+  BPath normalized(resolved_path, NULL, true);
+  const char *resolved = normalized.Path();
+  if (resolved != NULL)   // NULL == No such file. 
+    {
+    if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) 
+      {
+      return resolved_path;
+      }
+    }
+  return NULL;   // something went wrong.
+}
+#endif
+
 #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) 
 inline int Mkdir(const char* dir)
 {
@@ -291,7 +318,9 @@
     kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
     if(endpos != kwsys_stl::string::npos)
       {
-      path.push_back(pathEnv.substr(start, endpos-start));
+      kwsys_stl::string convertedPath;
+      Realpath(pathEnv.substr(start, endpos-start).c_str(), convertedPath);
+      path.push_back(convertedPath);
       start = endpos+1;
       }
     else
diff -urN cmake-2.4.3-original/Source/kwsys/testDynamicLoader.cxx cmake-2.4.3/Source/kwsys/testDynamicLoader.cxx
--- cmake-2.4.3-original/Source/kwsys/testDynamicLoader.cxx	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/testDynamicLoader.cxx	2006-11-06 02:50:36.000000000 -0500
@@ -17,6 +17,10 @@
 #include KWSYS_HEADER(ios/iostream)
 #include KWSYS_HEADER(stl/string)
 
+#if defined(__BEOS__)
+#include <be/kernel/OS.h>  /* disable_debugger() API. */
+#endif
+
 // Work-around CMake dependency scanning limitation.  This must
 // duplicate the above list of headers.
 #if 0
@@ -88,6 +92,8 @@
 {
 #if defined(_WIN32)
   SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+#elif defined(__BEOS__)
+  disable_debugger(1);
 #endif
   int res;
   if( argc == 3 )
diff -urN cmake-2.4.3-original/Source/kwsys/testProcess.c cmake-2.4.3/Source/kwsys/testProcess.c
--- cmake-2.4.3-original/Source/kwsys/testProcess.c	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Source/kwsys/testProcess.c	2006-11-06 02:50:36.000000000 -0500
@@ -30,6 +30,15 @@
 # include <unistd.h>
 #endif
 
+#if defined(__BEOS__)
+#include <be/kernel/OS.h>
+// BeOS doesn't have usleep, but it has snooze(), which is identical.
+static inline void usleep(unsigned int msec)
+{
+  snooze(msec);
+}
+#endif
+
 int runChild(const char* cmd[], int state, int exception, int value,
              int share, int output, int delay, double timeout, int poll,
              int repeat, int disown);
@@ -72,6 +81,9 @@
 #if defined(_WIN32)
   /* Avoid error diagnostic popups since we are crashing on purpose.  */
   SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+#elif defined(__BEOS__)
+  /* Avoid error diagnostic popups since we are crashing on purpose.  */
+  disable_debugger(1);
 #endif
   (void)argc; (void)argv;
   fprintf(stdout, "Output before crash on stdout from crash test.\n");
@@ -260,6 +272,8 @@
         /* Delay to avoid busy loop during polling.  */
 #if defined(_WIN32)
         Sleep(100);
+#elif defined(__BEOS__)
+        snooze(100000);
 #else
         usleep(100000);
 #endif
diff -urN cmake-2.4.3-original/Tests/Complex/Library/CMakeLists.txt cmake-2.4.3/Tests/Complex/Library/CMakeLists.txt
--- cmake-2.4.3-original/Tests/Complex/Library/CMakeLists.txt	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Tests/Complex/Library/CMakeLists.txt	2006-11-07 07:45:47.000000000 -0500
@@ -46,7 +46,9 @@
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
 ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
+IF(NOT BEOS)  # No libm on BeOS...
+  SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
+ENDIF(NOT BEOS)
 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
 IF(${FOO_BAR_VAR} MATCHES "BAR")
 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
diff -urN cmake-2.4.3-original/Tests/ComplexOneConfig/Library/CMakeLists.txt cmake-2.4.3/Tests/ComplexOneConfig/Library/CMakeLists.txt
--- cmake-2.4.3-original/Tests/ComplexOneConfig/Library/CMakeLists.txt	2006-07-31 10:49:59.000000000 -0400
+++ cmake-2.4.3/Tests/ComplexOneConfig/Library/CMakeLists.txt	2006-11-07 07:32:30.000000000 -0500
@@ -46,7 +46,9 @@
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
 ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)
 SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR)
-SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
+IF(NOT BEOS)  # No libm on BeOS.
+  SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm")
+ENDIF(NOT BEOS)
 GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO)
 IF(${FOO_BAR_VAR} MATCHES "BAR")
 ELSE(${FOO_BAR_VAR} MATCHES "BAR")
diff -urN cmake-2.4.3-original/Utilities/cmtar/encode.c cmake-2.4.3/Utilities/cmtar/encode.c
--- cmake-2.4.3-original/Utilities/cmtar/encode.c	2006-07-31 10:50:01.000000000 -0400
+++ cmake-2.4.3/Utilities/cmtar/encode.c	2006-11-06 02:50:36.000000000 -0500
@@ -197,12 +197,14 @@
 th_set_mode(TAR *t, mode_t fmode)
 {
 #ifndef WIN32
+#ifndef __BEOS__
   if (S_ISSOCK(fmode))
   {
     fmode &= ~S_IFSOCK;
     fmode |= S_IFIFO;
   }
 #endif
+#endif
   /* Looks like on windows the st_mode is longer than 8 characters. */
   int_to_oct(fmode & 07777777, (t)->th_buf.mode, 8);
 }
diff -urN cmake-2.4.3-original/Utilities/cmtar/extract.c cmake-2.4.3/Utilities/cmtar/extract.c
--- cmake-2.4.3-original/Utilities/cmtar/extract.c	2006-07-31 10:50:01.000000000 -0400
+++ cmake-2.4.3/Utilities/cmtar/extract.c	2006-11-06 06:49:39.000000000 -0500
@@ -116,7 +116,7 @@
     return -1;
   }
   /* change permissions */
-  if (!TH_ISSYM(t) && chmod(filename, mode) == -1)
+  if (!TH_ISSYM(t) && chmod(filename, mode & 07777) == -1)
   {
 #ifdef DEBUG
     perror("chmod()");
@@ -718,6 +718,7 @@
   char *filename;
   char buf[T_BLOCKSIZE];
   char *pathname = 0;
+  size_t len = 0;
 
   if (!TH_ISDIR(t))
   {
@@ -750,14 +751,23 @@
     return -1;
     }
 
+    /* Strip trailing '/'...it confuses some Unixes (and BeOS)... */
+    strncpy(buf, filename, sizeof(buf)-1);
+    buf[sizeof(buf)-1] = 0;
+    len = strlen(buf);
+    if ((len > 0) && (buf[len-1] == '/'))
+      {
+      buf[len-1] = '\0';
+      }
+
 #ifdef DEBUG
   printf("  ==> extracting: %s (mode %04o, directory)\n", filename,
          mode);
 #endif
 #ifdef WIN32
-  if (mkdir(filename) == -1)
+  if (mkdir(buf) == -1)
 #else
-  if (mkdir(filename, mode) == -1)
+  if (mkdir(buf, mode & 07777) == -1)
 #endif
   {
 #ifdef __BORLANDC__
@@ -772,7 +782,7 @@
 #endif      
     if (errno == EEXIST)
     {
-      if (chmod(filename, mode) == -1)
+      if (chmod(filename, mode & 07777) == -1)
       {
 #ifdef DEBUG
         perror("chmod()");
@@ -860,7 +870,7 @@
   printf("  ==> extracting: %s (fifo)\n", filename);
 #endif
 #ifndef WIN32
-  if (mkfifo(filename, mode) == -1)
+  if (mkfifo(filename, mode & 07777) == -1)
 #else
     (void)mode;
 #endif
diff -urN cmake-2.4.3-original/Utilities/cmtar/libtar.c cmake-2.4.3/Utilities/cmtar/libtar.c
--- cmake-2.4.3-original/Utilities/cmtar/libtar.c	2006-07-31 10:50:01.000000000 -0400
+++ cmake-2.4.3/Utilities/cmtar/libtar.c	2006-11-06 06:19:15.000000000 -0500
@@ -110,8 +110,13 @@
     return -1;
     }
 
-#if !defined(_WIN32) || defined(__CYGWIN__)
-  if ((oflags & O_CREAT) && fchmod(fd, mode))
+#if defined(__BEOS__)  // no fchmod on BeOS...do it to the pathname instead.
+  if ((oflags & O_CREAT) && chmod(pathname, mode & 07777))
+    {
+    return -1;
+    }
+#elif !defined(_WIN32) || defined(__CYGWIN__)
+  if ((oflags & O_CREAT) && fchmod(fd, mode & 07777))
     {
     return -1;
     }
diff -urN cmake-2.4.3-original/Utilities/cmtar/util.c cmake-2.4.3/Utilities/cmtar/util.c
--- cmake-2.4.3-original/Utilities/cmtar/util.c	2006-07-31 10:50:01.000000000 -0400
+++ cmake-2.4.3/Utilities/cmtar/util.c	2006-11-06 06:21:22.000000000 -0500
@@ -100,6 +100,13 @@
     if (*dirp == '\0')
       continue;
 
+    /*
+     * Don't try to build current or parent dir. It doesn't make sense anyhow,
+     *  but it also returns EINVAL instead of EEXIST on BeOS!
+     */
+    if ((strcmp(dirp, ".") == 0) || (strcmp(dirp, "..") == 0))
+        continue;
+
     if (dst[0] != '\0')
       strcat(dst, "/");
     strcat(dst, dirp);
diff -urN cmake-2.4.3-original/Utilities/cmxmlrpc/xmlrpc_curl_transport.c cmake-2.4.3/Utilities/cmxmlrpc/xmlrpc_curl_transport.c
--- cmake-2.4.3-original/Utilities/cmxmlrpc/xmlrpc_curl_transport.c	2006-07-31 10:50:01.000000000 -0400
+++ cmake-2.4.3/Utilities/cmxmlrpc/xmlrpc_curl_transport.c	2006-11-06 02:50:36.000000000 -0500
@@ -10,6 +10,11 @@
 
 #include "xmlrpc_config.h"
 
+#if defined(__BEOS__)
+/* Some helpful system header has char==bool, then bool.h does int==bool. */
+#define HAVE_BOOL 1
+#endif
+
 #include "bool.h"
 #include "mallocvar.h"
 #include "linklist.h"
