From e681abe5cbcb58fb71baad1190135961fe39ebc7 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 29 Nov 2010 12:02:06 -0600 Subject: [PATCH] cmake: solaris fixes. --- cmake/libs.cmake | 11 +++++++++++ cmake/package.cmake | 4 +++- cmake/v8_build.cmake | 4 ++++ deps/c-ares/CMakeLists.txt | 18 +++++++++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/cmake/libs.cmake b/cmake/libs.cmake index e953bbe327..2844d86ac0 100644 --- a/cmake/libs.cmake +++ b/cmake/libs.cmake @@ -2,6 +2,7 @@ # libraries # +include(CheckLibraryExists) include(FindPackageHandleStandardArgs) set(HAVE_CONFIG_H True) add_definitions(-DHAVE_CONFIG_H=1) @@ -10,6 +11,8 @@ find_package(OpenSSL QUIET) find_package(Threads) find_library(RT rt) find_library(DL dl) +check_library_exists(socket socket "" HAVE_SOCKET_LIB) +check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB) if(RT) set(extra_libs ${extra_libs} ${RT}) @@ -24,6 +27,14 @@ if(${node_platform} MATCHES freebsd) set(extra_libs ${extra_libs} KVM) endif() +if(${HAVE_SOCKET_LIB}) + set(extra_libs ${extra_libs} socket) +endif() + +if(${HAVE_NSL_LIB}) + set(extra_libs ${extra_libs} nsl) +endif() + if(${OPENSSL_FOUND} MATCHES True) add_definitions(-DHAVE_OPENSSL=1) set(HAVE_OPENSSL True) diff --git a/cmake/package.cmake b/cmake/package.cmake index 7f6c3cfcc6..720e2dd755 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -10,8 +10,10 @@ if(${node_platform} MATCHES darwin) set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/LICENSE.txt") set(CPACK_RESOURCE_FILE_README "${PROJECT_BINARY_DIR}/ChangeLog.txt") #set(CPACK_RESOURCE_FILE_WELCOME "") -else() +elseif(${node_platform} MATCHES linux) set(CPACK_GENERATOR "TGZ;DEB;RPM") +else() + set(CPACK_GENERATOR "TGZ") endif() set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Tom Hughes ") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Evented I/O for V8 JavaScript.") diff --git a/cmake/v8_build.cmake b/cmake/v8_build.cmake index d2bb76fb9f..ea27e5fd08 100644 --- a/cmake/v8_build.cmake +++ b/cmake/v8_build.cmake @@ -22,6 +22,10 @@ if(NOT SHARED_V8) elseif(${node_platform} MATCHES linux) execute_process(COMMAND sh -c "cat /proc/cpuinfo | grep processor | sort | uniq | wc -l" OUTPUT_VARIABLE cpu_count) + elseif(${node_platform} MATCHES sunos) + execute_process(COMMAND sh -c "psrinfo | wc -l" OUTPUT_VARIABLE cpu_count) + else() + set(cpu_count 1) endif() if(${cpu_count} GREATER 1) diff --git a/deps/c-ares/CMakeLists.txt b/deps/c-ares/CMakeLists.txt index 98be04a376..7bbb95b879 100644 --- a/deps/c-ares/CMakeLists.txt +++ b/deps/c-ares/CMakeLists.txt @@ -2,5 +2,21 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${node_platform}-${cares_arch}) add_definitions(-DHAVE_CONFIG_H=1) +include(CheckLibraryExists) +check_library_exists(socket socket "" HAVE_SOCKET_LIB) +check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB) + file(GLOB lib_sources *.c) -add_library(cares ${lib_sources}) \ No newline at end of file +add_library(cares ${lib_sources}) + +if(${HAVE_SOCKET_LIB}) + set(cares_libs ${cares_libs} socket) +endif() + +if(${HAVE_NSL_LIB}) + set(cares_libs ${cares_libs} nsl) +endif() + +if(cares_libs) + target_link_libraries(cares ${cares_libs}) +endif()