Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix for the static versions of libevent and libcurl

  • Loading branch information...
commit ab6037e27955c5df4e5eaa73ab41dcaffc235825 1 parent 225d8b1
d1saster authored
Showing with 31 additions and 25 deletions.
  1. +26 −23 CMake/HPHPFindLibs.cmake
  2. +5 −2 src/third_party/libafdt/CMakeLists.txt
49 CMake/HPHPFindLibs.cmake
View
@@ -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)
@@ -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)
@@ -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})
@@ -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)
@@ -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)
@@ -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})
@@ -398,4 +399,6 @@ endif()
target_link_libraries(${target} ${PAM_LIBRARY})
endif()
+ set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,--as-needed")
+
endmacro()
7 src/third_party/libafdt/CMakeLists.txt
View
@@ -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)
@@ -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()
Please sign in to comment.
Something went wrong with that request. Please try again.