diff -urN cmake-2.6.1/Modules/CMakeFortranCompilerId.F90.in cmake-2.6.1-haiku/Modules/CMakeFortranCompilerId.F90.in --- cmake-2.6.1/Modules/CMakeFortranCompilerId.F90.in 2008-08-01 15:34:50.000000000 +0000 +++ cmake-2.6.1-haiku/Modules/CMakeFortranCompilerId.F90.in 2008-08-20 13:49:06.000000000 +0000 @@ -50,6 +50,10 @@ PRINT *, 'INFO:platform[IRIX]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:platform[HP-UX]' +#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) + PRINT *, 'INFO:platform[Haiku]' +! Haiku also defines __BEOS__ so we must +! put it prior to the check for __BEOS__ #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) PRINT *, 'INFO:platform[BeOS]' #elif defined(__QNX__) || defined(__QNXNTO__) diff -urN cmake-2.6.1/Modules/CMakePlatformId.h.in cmake-2.6.1-haiku/Modules/CMakePlatformId.h.in --- cmake-2.6.1/Modules/CMakePlatformId.h.in 2008-08-01 15:34:50.000000000 +0000 +++ cmake-2.6.1-haiku/Modules/CMakePlatformId.h.in 2008-08-20 13:49:06.000000000 +0000 @@ -35,6 +35,11 @@ #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" +#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU) +# define PLATFORM_ID "Haiku" +! Haiku also defines __BEOS__ so we must +! put it prior to the check for __BEOS__ + #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) # define PLATFORM_ID "BeOS" diff -urN cmake-2.6.1/Modules/CheckForPthreads.c cmake-2.6.1-haiku/Modules/CheckForPthreads.c --- cmake-2.6.1/Modules/CheckForPthreads.c 2008-08-01 15:34:50.000000000 +0000 +++ cmake-2.6.1-haiku/Modules/CheckForPthreads.c 2008-08-20 13:49:06.000000000 +0000 @@ -16,7 +16,7 @@ pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); -#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.) usleep(1); // for strange behavior on single-processor sun #endif diff -urN cmake-2.6.1/Modules/Platform/Haiku.cmake cmake-2.6.1-haiku/Modules/Platform/Haiku.cmake --- cmake-2.6.1/Modules/Platform/Haiku.cmake 1970-01-01 00:00:00.000000000 +0000 +++ cmake-2.6.1-haiku/Modules/Platform/Haiku.cmake 2008-08-20 13:49:06.000000000 +0000 @@ -0,0 +1,14 @@ +SET(BEOS 1) + +# GCC is the default compiler on Haiku. +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,") + +INCLUDE(Platform/UnixPaths) diff -urN cmake-2.6.1/Source/CPack/cmCPackGeneratorFactory.cxx cmake-2.6.1-haiku/Source/CPack/cmCPackGeneratorFactory.cxx --- cmake-2.6.1/Source/CPack/cmCPackGeneratorFactory.cxx 2008-08-01 15:34:53.000000000 +0000 +++ cmake-2.6.1-haiku/Source/CPack/cmCPackGeneratorFactory.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -36,7 +36,7 @@ #endif #if !defined(_WIN32) && !defined(__APPLE__) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) + && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__) # include "cmCPackDebGenerator.h" # include "cmCPackRPMGenerator.h" #endif @@ -75,7 +75,8 @@ cmCPackOSXX11Generator::CreateGenerator); #endif #if !defined(_WIN32) && !defined(__APPLE__) \ - && !defined(__QNXNTO__) && !defined(__BEOS__) + && !defined(__QNXNTO__) && !defined(__BEOS__)\ + && !defined(__HAIKU__) this->RegisterGenerator("DEB", "Debian packages", cmCPackDebGenerator::CreateGenerator); this->RegisterGenerator("RPM", "RPM packages", diff -urN cmake-2.6.1/Source/cmCTest.cxx cmake-2.6.1-haiku/Source/cmCTest.cxx --- cmake-2.6.1/Source/cmCTest.cxx 2008-08-01 15:34:51.000000000 +0000 +++ cmake-2.6.1-haiku/Source/cmCTest.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -49,10 +49,15 @@ #include // auto_ptr -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) #include /* disable_debugger() API. */ #endif +#if defined(__HAIKU__) +#include /* disable_debugger() API. */ +#endif + + #define DEBUGOUT std::cout << __LINE__ << " "; std::cout #define DEBUGERR std::cerr << __LINE__ << " "; std::cerr @@ -607,7 +612,7 @@ cmSystemTools::PutEnv("DASHBOARD_TEST_FROM_CTEST=" CMake_VERSION); #if defined(_WIN32) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) disable_debugger(1); #endif } diff -urN cmake-2.6.1/Source/cmDependsJavaLexer.cxx cmake-2.6.1-haiku/Source/cmDependsJavaLexer.cxx --- cmake-2.6.1/Source/cmDependsJavaLexer.cxx 2008-08-01 15:34:51.000000000 +0000 +++ cmake-2.6.1-haiku/Source/cmDependsJavaLexer.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -23,7 +23,7 @@ #include #include -#if defined(__BEOS__) +#if defined(__BEOS__) || defined (__HAIKU__) #include /* prevents a conflict with a #define later on... */ #endif diff -urN cmake-2.6.1/Source/cmDependsJavaLexer.h cmake-2.6.1-haiku/Source/cmDependsJavaLexer.h --- cmake-2.6.1/Source/cmDependsJavaLexer.h 2008-08-01 15:34:51.000000000 +0000 +++ cmake-2.6.1-haiku/Source/cmDependsJavaLexer.h 2008-08-20 13:49:06.000000000 +0000 @@ -38,7 +38,7 @@ #include #include -#if defined(__BEOS__) +#if defined(__BEOS__) || defined(__HAIKU__) #include /* prevents a conflict with a #define later on... */ #endif diff -urN cmake-2.6.1/Source/cmSystemTools.cxx cmake-2.6.1-haiku/Source/cmSystemTools.cxx --- cmake-2.6.1/Source/cmSystemTools.cxx 2008-08-01 15:34:53.000000000 +0000 +++ cmake-2.6.1-haiku/Source/cmSystemTools.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -970,11 +970,13 @@ error << "SIGFPE"; break; #endif +#ifndef __HAIKU__ #ifdef SIGBUS case SIGBUS: error << "SIGBUS"; break; #endif +#endif #ifdef SIGSEGV case SIGSEGV: error << "SIGSEGV"; @@ -1696,7 +1698,7 @@ } // no fchmod on BeOS 5...do pathname instead. -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) if ((oflags & O_CREAT) && chmod(pathname, mode)) { return -1; diff -urN cmake-2.6.1/Source/kwsys/DynamicLoader.cxx cmake-2.6.1-haiku/Source/kwsys/DynamicLoader.cxx --- cmake-2.6.1/Source/kwsys/DynamicLoader.cxx 2008-08-01 15:34:54.000000000 +0000 +++ cmake-2.6.1-haiku/Source/kwsys/DynamicLoader.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -335,11 +335,21 @@ #endif //_WIN32 // --------------------------------------------------------------- -// 4. Implementation for BeOS -#ifdef __BEOS__ +// 4. Implementation for BeOS / Haiku +#if defined __BEOS__ || defined(__HAIKU__) + #include // for strerror() + +#ifdef __BEOS__ #include #include +#endif + +#ifdef __HAIKU__ +#include +#include +#endif + #define DYNAMICLOADER_DEFINED 1 namespace KWSYS_NAMESPACE diff -urN cmake-2.6.1/Source/kwsys/ProcessUNIX.c cmake-2.6.1-haiku/Source/kwsys/ProcessUNIX.c --- cmake-2.6.1/Source/kwsys/ProcessUNIX.c 2008-08-01 15:34:54.000000000 +0000 +++ cmake-2.6.1-haiku/Source/kwsys/ProcessUNIX.c 2008-08-20 13:49:06.000000000 +0000 @@ -75,7 +75,7 @@ typedef int kwsysProcess_ssize_t; #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void kwsysProcess_usleep(unsigned int msec) @@ -2534,6 +2534,7 @@ } /* If this is the first process, enable the signal handler. */ +#ifndef __HAIKU__ if(newProcesses.Count == 1) { /* Install our handler for SIGCHLD. Repeat call until it is not @@ -2554,6 +2555,7 @@ &kwsysProcessesOldSigChldAction) < 0) && (errno == EINTR)); } +#endif } return 1; diff -urN cmake-2.6.1/Source/kwsys/SystemTools.cxx cmake-2.6.1-haiku/Source/kwsys/SystemTools.cxx --- cmake-2.6.1/Source/kwsys/SystemTools.cxx 2008-08-01 15:34:55.000000000 +0000 +++ cmake-2.6.1-haiku/Source/kwsys/SystemTools.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -131,7 +131,12 @@ #define _chdir chdir #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__HAIKU__) +#include +#include +#endif + +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) #include #include diff -urN cmake-2.6.1/Source/kwsys/testDynamicLoader.cxx cmake-2.6.1-haiku/Source/kwsys/testDynamicLoader.cxx --- cmake-2.6.1/Source/kwsys/testDynamicLoader.cxx 2008-08-01 15:34:55.000000000 +0000 +++ cmake-2.6.1-haiku/Source/kwsys/testDynamicLoader.cxx 2008-08-20 13:49:06.000000000 +0000 @@ -17,10 +17,14 @@ #include KWSYS_HEADER(ios/iostream) #include KWSYS_HEADER(stl/string) -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) #include /* disable_debugger() API. */ #endif +#if defined(__HAIKU__) +#include /* disable_debugger() API. */ +#endif + // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 diff -urN cmake-2.6.1/Source/kwsys/testProcess.c cmake-2.6.1-haiku/Source/kwsys/testProcess.c --- cmake-2.6.1/Source/kwsys/testProcess.c 2008-08-01 15:34:55.000000000 +0000 +++ cmake-2.6.1-haiku/Source/kwsys/testProcess.c 2008-08-20 13:49:06.000000000 +0000 @@ -34,7 +34,7 @@ # pragma warn -8060 /* possibly incorrect assignment */ #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void testProcess_usleep(unsigned int msec) diff -urN cmake-2.6.1/Tests/Complex/Library/CMakeLists.txt cmake-2.6.1-haiku/Tests/Complex/Library/CMakeLists.txt --- cmake-2.6.1/Tests/Complex/Library/CMakeLists.txt 2008-08-01 15:34:55.000000000 +0000 +++ cmake-2.6.1-haiku/Tests/Complex/Library/CMakeLists.txt 2008-08-20 13:49:06.000000000 +0000 @@ -53,7 +53,9 @@ ) SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) IF(NOT BEOS) # No libm on BeOS. - SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") + IF(NOT HAIKU) # libm in included in libroot on Haiku + SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") + ENDIF(NOT HAIKU) ENDIF(NOT BEOS) GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) IF(${FOO_BAR_VAR} MATCHES "BAR") diff -urN cmake-2.6.1/Tests/ComplexOneConfig/Library/CMakeLists.txt cmake-2.6.1-haiku/Tests/ComplexOneConfig/Library/CMakeLists.txt --- cmake-2.6.1/Tests/ComplexOneConfig/Library/CMakeLists.txt 2008-08-01 15:34:56.000000000 +0000 +++ cmake-2.6.1-haiku/Tests/ComplexOneConfig/Library/CMakeLists.txt 2008-08-20 13:49:06.000000000 +0000 @@ -53,7 +53,9 @@ ) SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) IF(NOT BEOS) # No libm on BeOS. + IF(NOT HAIKU) # No limb on Haiku. SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") + ENDIF(NOT HAIKU) ENDIF(NOT BEOS) GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) IF(${FOO_BAR_VAR} MATCHES "BAR") diff -urN cmake-2.6.1/Tests/ComplexRelativePaths/Library/CMakeLists.txt cmake-2.6.1-haiku/Tests/ComplexRelativePaths/Library/CMakeLists.txt --- cmake-2.6.1/Tests/ComplexRelativePaths/Library/CMakeLists.txt 2008-08-01 15:34:56.000000000 +0000 +++ cmake-2.6.1-haiku/Tests/ComplexRelativePaths/Library/CMakeLists.txt 2008-08-20 13:49:07.000000000 +0000 @@ -53,7 +53,9 @@ ) SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES FOO BAR) IF(NOT BEOS) # No libm on BeOS. + IF(NOT HAIKU) # No libm on Haiku. SET_TARGET_PROPERTIES(CMakeTestCLibraryShared PROPERTIES LINK_FLAGS "-lm") + ENDIF(NOT HAIKU) ENDIF(NOT BEOS) GET_TARGET_PROPERTY(FOO_BAR_VAR CMakeTestCLibraryShared FOO) IF(${FOO_BAR_VAR} MATCHES "BAR") diff -urN cmake-2.6.1/Utilities/cmcurl/CMake/CurlTests.c cmake-2.6.1-haiku/Utilities/cmcurl/CMake/CurlTests.c --- cmake-2.6.1/Utilities/cmcurl/CMake/CurlTests.c 2008-08-01 15:34:57.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmcurl/CMake/CurlTests.c 2008-08-20 13:49:07.000000000 +0000 @@ -38,7 +38,7 @@ # define PLATFORM_AIX_V3 #endif -#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) +#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__)) #error "O_NONBLOCK does not work on this platform" #endif int socket; diff -urN cmake-2.6.1/Utilities/cmcurl/curl/curl.h cmake-2.6.1-haiku/Utilities/cmcurl/curl/curl.h --- cmake-2.6.1/Utilities/cmcurl/curl/curl.h 2008-08-01 15:34:57.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmcurl/curl/curl.h 2008-08-20 13:49:07.000000000 +0000 @@ -1133,7 +1133,7 @@ } #endif -#ifdef __BEOS__ +#if defined __BEOS__ || defined __HAIKU__ #include #endif diff -urN cmake-2.6.1/Utilities/cmcurl/if2ip.c cmake-2.6.1-haiku/Utilities/cmcurl/if2ip.c --- cmake-2.6.1/Utilities/cmcurl/if2ip.c 2008-08-01 15:34:57.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmcurl/if2ip.c 2008-08-20 13:49:07.000000000 +0000 @@ -39,7 +39,7 @@ */ #if !defined(WIN32) && !defined(__BEOS__) && !defined(__CYGWIN__) && \ !defined(__riscos__) && !defined(__INTERIX) && !defined(NETWARE) && \ - !defined(_AMIGASF) && !defined(__minix) + !defined(_AMIGASF) && !defined(__minix) && !defined(__HAIKU__) #ifdef HAVE_SYS_SOCKET_H #include diff -urN cmake-2.6.1/Utilities/cmcurl/select.c cmake-2.6.1-haiku/Utilities/cmcurl/select.c --- cmake-2.6.1/Utilities/cmcurl/select.c 2008-08-01 15:34:57.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmcurl/select.c 2008-08-20 13:49:07.000000000 +0000 @@ -39,7 +39,7 @@ #error "We can't compile without select() support!" #endif -#ifdef __BEOS__ +#if defined __BEOS__ && !defined __HAIKU__ /* BeOS has FD_SET defined in socket.h */ #include #endif diff -urN cmake-2.6.1/Utilities/cmcurl/setup.h cmake-2.6.1-haiku/Utilities/cmcurl/setup.h --- cmake-2.6.1/Utilities/cmcurl/setup.h 2008-08-01 15:34:57.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmcurl/setup.h 2008-08-20 13:49:07.000000000 +0000 @@ -264,7 +264,7 @@ #else /* MSDOS */ -#ifdef __BEOS__ +#if defined __BEOS__ && !defined __HAIKU__ #define sclose(x) closesocket(x) #else /* __BEOS__ */ #define sclose(x) close(x) diff -urN cmake-2.6.1/Utilities/cmtar/libtar.c cmake-2.6.1-haiku/Utilities/cmtar/libtar.c --- cmake-2.6.1/Utilities/cmtar/libtar.c 2008-08-01 15:34:58.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmtar/libtar.c 2008-08-20 13:49:07.000000000 +0000 @@ -98,8 +98,8 @@ { return -1; } - -#if defined(__BEOS__) && !defined(__ZETA__) /* no fchmod on BeOS...do pathname instead. */ +/* no fchmod on BeOS...do pathname instead. */ +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) if ((oflags & O_CREAT) && chmod(pathname, mode & 07777)) { return -1; diff -urN cmake-2.6.1/Utilities/cmxmlrpc/xmlrpc_curl_transport.c cmake-2.6.1-haiku/Utilities/cmxmlrpc/xmlrpc_curl_transport.c --- cmake-2.6.1/Utilities/cmxmlrpc/xmlrpc_curl_transport.c 2008-08-01 15:34:58.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmxmlrpc/xmlrpc_curl_transport.c 2008-08-20 13:49:07.000000000 +0000 @@ -10,7 +10,7 @@ #include "xmlrpc_config.h" -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) /* Some helpful system header has char==bool, then bool.h does int==bool. */ #define HAVE_BOOL 1 #endif diff -urN cmake-2.6.1/Utilities/cmzlib/zconf.h cmake-2.6.1-haiku/Utilities/cmzlib/zconf.h --- cmake-2.6.1/Utilities/cmzlib/zconf.h 2008-08-01 15:34:58.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmzlib/zconf.h 2008-08-20 13:49:07.000000000 +0000 @@ -237,7 +237,7 @@ # endif #endif -#if defined (__BEOS__) +#if defined (__BEOS__) && !defined (__HAIKU__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) diff -urN cmake-2.6.1/Utilities/cmzlib/zutil.h cmake-2.6.1-haiku/Utilities/cmzlib/zutil.h --- cmake-2.6.1/Utilities/cmzlib/zutil.h 2008-08-01 15:34:59.000000000 +0000 +++ cmake-2.6.1-haiku/Utilities/cmzlib/zutil.h 2008-08-20 13:49:07.000000000 +0000 @@ -147,7 +147,13 @@ # define OS_CODE 0x0f #endif -#if defined(_BEOS_) || defined(RISCOS) +/* Haiku defines both __HAIKU__ and __BEOS__ (for now) */ +/* many BeOS workarounds are no longer needed in Haiku */ +#if defined(__HAIKU__) && defined(__BEOS__) +undef (__BEOS__) +#endif + +#if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif diff -urN cmake-2.6.1/bootstrap cmake-2.6.1-haiku/bootstrap --- cmake-2.6.1/bootstrap 2008-08-01 15:34:50.000000000 +0000 +++ cmake-2.6.1-haiku/bootstrap 2008-08-20 13:49:07.000000000 +0000 @@ -73,6 +73,13 @@ cmake_system_beos=false fi +# Determine whether this is Haiku +if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then + cmake_system_haiku=true +else + cmake_system_haiku=false +fi + # Choose the generator to use for bootstrapping. if ${cmake_system_mingw}; then # Bootstrapping from an MSYS prompt. @@ -603,6 +610,11 @@ cmake_ld_flags="${LDFLAGS} -lroot -lbe" fi +# Add Haiku toolkits... +if ${cmake_system_haiku}; then + cmake_ld_flags="${LDFLAGS} -lroot -lbe" +fi + # Test C compiler cmake_c_compiler=