diff options
author | OBATA Akio <obache@wizdas.com> | 2022-01-17 17:05:30 +0900 |
---|---|---|
committer | OBATA Akio <obache@wizdas.com> | 2022-01-17 17:05:30 +0900 |
commit | ad41084b8dd4e029e04073e22e52164505719b57 (patch) | |
tree | 257afdfd9f0d8048e1d1facfde685c77a38c43a4 /CMakeLists.txt | |
parent | 50a228fc2d0250bcbbb35c676285831a0c35397e (diff) | |
download | tdelibs-ad41084b8dd4e029e04073e22e52164505719b57.tar.gz tdelibs-ad41084b8dd4e029e04073e22e52164505719b57.zip |
Fix feature detections with CMake
* implement missing checks with CMake
* fixes and improve some detections
* remove missing but unused checks
Signed-off-by: OBATA Akio <obache@wizdas.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8748873ff..a6ffc2fb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ include( CheckCXXSourceCompiles ) include( CheckTypeSize ) include( CheckCSourceRuns ) include( CheckLibraryExists ) +include( CheckStructHasMember ) ##### include our cmake modules ################# @@ -346,7 +347,7 @@ check_function_exists( mkstemp HAVE_MKSTEMP ) check_symbol_exists( mkstemp "stdlib.h" HAVE_MKSTEMP_PROTO ) check_function_exists( mkstemps HAVE_MKSTEMPS ) -check_symbol_exists( mkstemps "stdlib.h" HAVE_MKSTEMPS_PROTO ) +check_symbol_exists( mkstemps "stdlib.h;unistd.h" HAVE_MKSTEMPS_PROTO ) check_function_exists( initgroups HAVE_INITGROUPS ) check_symbol_exists( initgroups "grp.h;unistd.h" HAVE_INITGROUPS_PROTO ) @@ -465,6 +466,7 @@ check_function_exists( putenv HAVE_PUTENV ) check_function_exists( poll HAVE_POLL ) check_function_exists( madvise HAVE_MADVISE ) check_function_exists( getgroups HAVE_GETGROUPS ) +check_symbol_exists( posix_fadvise "fcntl.h" HAVE_FADVISE ) check_function_exists( getcwd HAVE_GETCWD ) check_function_exists( dlerror HAVE_DLERROR ) if( NOT HAVE_DLERROR ) @@ -502,7 +504,13 @@ check_type_size( "unsigned long" SIZEOF_UNSIGNED_LONG ) set( CMAKE_EXTRA_INCLUDE_FILES "netdb.h" ) check_type_size( "struct addrinfo" STRUCT_ADDRINFO ) set( CMAKE_EXTRA_INCLUDE_FILES "netinet/in.h" ) -check_type_size( "struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6 ) +check_type_size( "struct sockaddr_in6" STRUCT_SOCKADDR_IN6 ) +check_struct_has_member( "struct sockaddr_in6" sin6_scope_id "sys/types.h;sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID ) +check_struct_has_member( "struct sockaddr" sa_len "sys/types.h;sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_SA_LEN ) +check_struct_has_member( "struct sockaddr_un" sun_len "sys/types.h;sys/un.h" HAVE_STRUCT_SOCKADDR_UN_SUN_LEN ) +set( CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h" ) +check_type_size( "struct ucred" STRUCT_UCRED ) +check_struct_has_member( "struct sockaddr_in" sin_len "sys/types.h;sys/socket.h;netinet/in.h" HAVE_STRUCT_SOCKADDR_IN_SIN_LEN ) unset( CMAKE_EXTRA_INCLUDE_FILES ) check_c_source_compiles(" @@ -548,6 +556,8 @@ endif( NOT HAVE_GOOD_GETADDRINFO ) # save CMAKE_REQUIRED_LIBRARIES set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ) +check_symbol_exists( res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO ) + set( CMAKE_REQUIRED_LIBRARIES resolv ) check_c_source_compiles(" #include <sys/types.h> @@ -634,6 +644,7 @@ if( NOT HAVE_LIBDL ) set( HAVE_LIBDL 1 ) endif( HAVE_DLOPEN ) endif( NOT HAVE_LIBDL ) +check_library_exists( dld, dld_link "" HAVE_DLD ) ##### check for magic ########################### |