Index: cmake/Modules/FindLibtirpc.cmake =================================================================== --- /dev/null +++ cmake/Modules/FindLibtirpc.cmake @@ -0,0 +1,22 @@ +# CMake find_package() Module for libtirpc +# +# Example usage: +# +# find_package(Libtirpc) +# +# If successful the following variables will be defined +# Libtirpc_FOUND +# Libtirpc_INCLUDE_DIRS + +find_path(Libtirpc_INCLUDE_DIR + NAMES rpc/xdr.h + PATH_SUFFIXES tirpc +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libtirpc + REQUIRED_VARS Libtirpc_INCLUDE_DIR) + +if(Libtirpc_FOUND) + set(Libtirpc_INCLUDE_DIRS ${Libtirpc_INCLUDE_DIR}) +endif() Index: lib/sanitizer_common/CMakeLists.txt =================================================================== --- lib/sanitizer_common/CMakeLists.txt +++ lib/sanitizer_common/CMakeLists.txt @@ -193,9 +193,12 @@ set(SANITIZER_COMMON_DEFINITIONS) -include(CheckIncludeFile) -append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS) -append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS) +find_package(Libtirpc) + +if (Libtirpc_FOUND) + include_directories(${Libtirpc_INCLUDE_DIRS}) + list(APPEND SANITIZER_COMMON_DEFINITIONS HAVE_RPC_XDR_H=1) +endif() set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF SANITIZER_CFLAGS) Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc =================================================================== --- lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -114,8 +114,6 @@ #include #if HAVE_RPC_XDR_H # include -#elif HAVE_TIRPC_RPC_XDR_H -# include #endif #include #include @@ -1210,7 +1208,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_gid); CHECK_SIZE_AND_OFFSET(group, gr_mem); -#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H +#if HAVE_RPC_XDR_H CHECK_TYPE_SIZE(XDR); CHECK_SIZE_AND_OFFSET(XDR, x_op); CHECK_SIZE_AND_OFFSET(XDR, x_ops);