Skip to content

Commit

Permalink
Add support for AC_SEARCH_LIBS emulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Jun 13, 2016
1 parent b3672e6 commit 235c5d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions infrastructure/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ endif()
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckLibraryExists)
include(CheckCXXSourceCompiles)

set(boxconfig_cmake_h_dir "${base_dir}/lib/common")
Expand Down Expand Up @@ -366,6 +367,20 @@ foreach(m4_filename boxbackup_tests.m4 ax_check_mount_point.m4)
check_symbol_exists("${decl_name}" "${header_files}" HAVE_DECL_${platform_var_name})
file(APPEND "${boxconfig_h_file}" "#cmakedefine01 HAVE_DECL_${platform_var_name}\n")
endforeach()
elseif(m4_function MATCHES "^ *AC_SEARCH_LIBS\\(\\[([A-Za-z._/ ]+)\\], \\[([A-Za-z._]+)\\]\\)$")
message(STATUS "Processing ac_search_libs: ${CMAKE_MATCH_1} in ${CMAKE_MATCH_2}")

set(function_name ${CMAKE_MATCH_1})
# http://stackoverflow.com/questions/5272781/what-is-common-way-to-split-string-into-list-with-cmake
string(REPLACE " " ";" library_names "${CMAKE_MATCH_2}")

foreach(library_name ${library_names})
string(TOUPPER ${library_name} platform_var_name)
check_library_exists(${library_name} ${function_name} "" HAVE_LIB_${platform_var_name})
if(HAVE_LIB_${platform_var_name})
target_link_libraries(lib_common ${library_name})
endif()
endforeach()
elseif(m4_function MATCHES "^ *AC_CHECK_MEMBERS\\(\\[([A-Za-z._/ ]+)\\.([[A-Za-z_]+)\\](,,, ..(#include <([^>]+)>)..)?\\)$")
message(STATUS "Processing ac_check_members: ${CMAKE_MATCH_1}.${CMAKE_MATCH_2} in ${CMAKE_MATCH_5}")

Expand Down
4 changes: 2 additions & 2 deletions infrastructure/m4/boxbackup_tests.m4
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ AX_PATH_BDB([1.x or 4.1], [
])

# need to find libdl before trying to link openssl, apparently
AC_SEARCH_LIBS([dlsym], ["dl"])
AC_SEARCH_LIBS([dlsym], [dl])
AC_CHECK_FUNCS([dlsym dladdr])

## Check for Open SSL, use old versions only if explicitly requested
Expand Down Expand Up @@ -277,7 +277,7 @@ AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([ftruncate getpeereid getpeername getpid gettimeofday lchown])
AC_CHECK_FUNCS([setproctitle utimensat])
AC_SEARCH_LIBS([setproctitle], ["bsd"])
AC_SEARCH_LIBS([setproctitle], [bsd])

# NetBSD implements kqueue too differently for us to get it fixed by 0.10
# TODO: Remove this when NetBSD kqueue implementation is working. The main
Expand Down

0 comments on commit 235c5d9

Please sign in to comment.