Skip to content

Commit

Permalink
fix for the static versions of libevent and libcurl
Browse files Browse the repository at this point in the history
  • Loading branch information
d1saster committed Dec 3, 2011
1 parent 225d8b1 commit ab6037e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
49 changes: 26 additions & 23 deletions CMake/HPHPFindLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,19 @@ include_directories(${LIBMEMCACHED_INCLUDE_DIR})
find_package(PCRE REQUIRED)
include_directories(${PCRE_INCLUDE_DIRS})

if (LINUX OR FREEBSD)
FIND_LIBRARY (CRYPT_LIB NAMES xcrypt crypt)
FIND_LIBRARY (RT_LIB rt)
elseif (APPLE)
FIND_LIBRARY (CRYPT_LIB crypto)
FIND_LIBRARY (ICONV_LIB iconv)
endif()

# libevent checks
find_package(LibEvent REQUIRED)
include_directories(${LIBEVENT_INCLUDE_DIR})

set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}")
set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}" ${RT_LIB})
CHECK_FUNCTION_EXISTS("evhttp_bind_socket_with_fd" HAVE_CUSTOM_LIBEVENT)
if (NOT HAVE_CUSTOM_LIBEVENT)
unset(HAVE_CUSTOM_LIBEVENT CACHE)
Expand All @@ -80,7 +88,20 @@ endif()
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})

set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}")
# LDAP
find_package(Ldap REQUIRED)
include_directories(${LDAP_INCLUDE_DIR})

# OpenSSL libs
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

# ZLIB
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})

set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}" ${LDAP_LIBRARIES} ${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES} ${RT_LIB})
CHECK_FUNCTION_EXISTS("curl_multi_select" HAVE_CUSTOM_CURL)
if (NOT HAVE_CUSTOM_CURL)
unset(HAVE_CUSTOM_CURL CACHE)
Expand Down Expand Up @@ -216,14 +237,6 @@ link_directories(${TBB_LIBRARY_DIRS})
find_package(Mcrypt REQUIRED)
include_directories(${Mcrypt_INCLUDE_DIR})

# OpenSSL libs
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

# ZLIB
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})

find_package(BZip2 REQUIRED)
include_directories(${BZIP2_INCLUDE_DIR})
add_definitions(${BZIP2_DEFINITIONS})
Expand All @@ -232,10 +245,6 @@ add_definitions(${BZIP2_DEFINITIONS})
find_package(ONIGURUMA REQUIRED)
include_directories(${ONIGURUMA_INCLUDE_DIRS})

# LDAP
find_package(Ldap REQUIRED)
include_directories(${LDAP_INCLUDE_DIR})

# ncurses, readline and history
#set(CURSES_NEED_NCURSES true)
find_package(Ncurses REQUIRED)
Expand Down Expand Up @@ -270,14 +279,6 @@ if (NOT CCLIENT_HAS_SSL)
add_definitions(-DSKIP_IMAP_SSL=1)
endif()

if (LINUX OR FREEBSD)
FIND_LIBRARY (CRYPT_LIB NAMES xcrypt crypt)
FIND_LIBRARY (RT_LIB rt)
elseif (APPLE)
FIND_LIBRARY (CRYPT_LIB crypto)
FIND_LIBRARY (ICONV_LIB iconv)
endif()

if (LINUX)
FIND_LIBRARY (CAP_LIB cap)

Expand Down Expand Up @@ -336,7 +337,7 @@ macro(hphp_link target)
target_link_libraries(${target} ${PCRE_LIBRARY})
target_link_libraries(${target} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
target_link_libraries(${target} ${LIBEVENT_LIB})
target_link_libraries(${target} ${CURL_LIBRARIES})
target_link_libraries(${target} ${CURL_LIBRARIES})

if (LINUX)
target_link_libraries(${target} ${CAP_LIB})
Expand Down Expand Up @@ -398,4 +399,6 @@ endif()
target_link_libraries(${target} ${PAM_LIBRARY})
endif()

set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,--as-needed")

endmacro()
7 changes: 5 additions & 2 deletions src/third_party/libafdt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ CHECK_FUNCTION_EXISTS("socket" HAVE_SOCKET)
CHECK_FUNCTION_EXISTS("strerror" HAVE_STRERROR)

find_package(LibEvent)
FIND_LIBRARY (RT_LIB rt)

IF(LibEvent_FOUND)
set(CMAKE_REQUIRED_INCLUDES "${LIBEVENT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}")
set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}" ${RT_LIB})
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckLibeventVersion.c VERSION_CHECK_SOURCE)

CHECK_SYMBOL_EXISTS("event_get_version_number" "event.h" HAVE_EVENT_GET_VERSION_NUMBER)

IF(HAVE_EVENT_GET_VERSION_NUMBER)
IF(HAVE_EVENT_GET_VERSION_NUMBER)
SET(CMAKE_REQUIRED_DEFINITIONS
-DHAVE_EVENT_GET_VERSION_NUMBER
-DEVENT_VERSION_WANTED=0x2000900)
Expand All @@ -63,9 +64,11 @@ IF(LibEvent_FOUND)
-DEVENT_VERSION_WANTED=0x1040500)
CHECK_C_SOURCE_COMPILES("${VERSION_CHECK_SOURCE}" HAVE_LIBEVENT_145)
IF(NOT HAVE_LIBEVENT_145)
unset(HAVE_LIBEVENT_145 CACHE)
SET(CMAKE_REQUIRED_DEFINITIONS -DEVENT_VERSION_WANTED=0x1040300)
CHECK_C_SOURCE_COMPILES("${VERSION_CHECK_SOURCE}" HAVE_LIBEVENT_143)
IF(NOT LIBEVENT_VERSION_143)
unset(HAVE_LIBEVENT_143 CACHE)
message(FATAL_ERROR "Couldn't find at least libevent 1.4.3+")
ENDIF()
ELSE()
Expand Down

0 comments on commit ab6037e

Please sign in to comment.