diff options
author | OBATA Akio <obache@wizdas.com> | 2022-01-17 17:05:30 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2022-02-17 16:26:44 +0100 |
commit | e8860ba1a7dfc4a3f3a1f1bf4317b1e60d39e589 (patch) | |
tree | a6628a95bb1ee2a0226bdbae757c124def7a2b92 | |
parent | a5bb6fd19c165061460268f86e6fb164f9313e2b (diff) | |
download | tdelibs-e8860ba1a7dfc4a3f3a1f1bf4317b1e60d39e589.tar.gz tdelibs-e8860ba1a7dfc4a3f3a1f1bf4317b1e60d39e589.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>
(cherry picked from commit ad41084b8dd4e029e04073e22e52164505719b57)
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | config.h.cmake | 44 | ||||
-rw-r--r-- | dcop/KDE-ICE/Xtranssock.c | 10 |
3 files changed, 32 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8959857a9..8a8e310a0 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 ################# @@ -329,7 +330,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 ) @@ -448,6 +449,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 ) @@ -485,7 +487,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(" @@ -531,6 +539,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> @@ -613,6 +623,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 ########################### diff --git a/config.h.cmake b/config.h.cmake index 426a6879a..dac584141 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -13,20 +13,9 @@ #cmakedefine HAVE_DNSSD 1 #cmakedefine AVAHI_API_0_6 1 -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - /* Use su or sudo */ #define DEFAULT_SUPER_USER_COMMAND "@DEFAULT_SUPER_USER_COMMAND@" -/* Define if getaddrinfo returns AF_UNIX sockets */ -#undef GETADDRINFO_RETURNS_UNIX - /* getmntinfo() uses struct statvfs */ #cmakedefine GETMNTINFO_USES_STATVFS @@ -119,9 +108,6 @@ /* Define to 1 if libbfd provides demangle.h header */ #cmakedefine HAVE_DEMANGLE_H 1 -/* You _must_ have bool */ -#undef HAVE_BOOL - /* Define if getaddrinfo is broken and should be replaced */ #cmakedefine HAVE_BROKEN_GETADDRINFO 1 @@ -162,7 +148,7 @@ #cmakedefine HAVE_DIRENT_H 1 /* Define if you have the GNU dld library. */ -#undef HAVE_DLD +#cmakedefine HAVE_DLD /* Define to 1 if you have the <dld.h> header file. */ #cmakedefine HAVE_DLD_H 1 @@ -186,7 +172,7 @@ #cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 /* Define is posix_fadvise is supported */ -#undef HAVE_FADVISE +#cmakedefine HAVE_FADVISE /* Define if your system has libfam */ #cmakedefine HAVE_FAM 1 @@ -299,9 +285,6 @@ /* Define if you have jasper */ #cmakedefine HAVE_JASPER 1 -/* Define if your locale.h file contains LC_MESSAGES */ -#undef HAVE_LC_MESSAGES - /* Defines if your system has the libart library */ #cmakedefine HAVE_LIBART 1 @@ -326,12 +309,6 @@ /* Define if you have libpng */ #cmakedefine HAVE_LIBPNG 1 -/* Define if you have a working libpthread (will enable threaded code) */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if you have the `qt-mt' library (-lqt-mt). */ -#undef HAVE_LIBQT_MT - /* Defined if you have libthai and want to have it compiled in */ #undef HAVE_LIBTHAI @@ -407,9 +384,6 @@ /* Define to 1 if you have the <net/if.h> header file. */ #cmakedefine HAVE_NET_IF_H 1 -/* Define to 1 if you have the <nl_types.h> header file. */ -#undef HAVE_NL_TYPES_H - /* Define if system has non-POSIX extensions to the ACL support. */ #cmakedefine HAVE_NON_POSIX_ACL_EXTENSIONS 1 @@ -465,7 +439,7 @@ #cmakedefine HAVE_RES_INIT 1 /* Define if you have the res_init prototype */ -#undef HAVE_RES_INIT_PROTO +#cmakedefine HAVE_RES_INIT_PROTO /* Define if revoke(tty) is present in unistd.h */ #cmakedefine HAVE_REVOKE 1 @@ -588,13 +562,19 @@ #cmakedefine HAVE_STRUCT_SOCKADDR_IN6 1 /* Define to 1 if `sin6_scope_id' is member of `struct sockaddr_in6'. */ -#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID +#cmakedefine HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 /* Define to 1 if `sa_len' is member of `struct sockaddr'. */ -#undef HAVE_STRUCT_SOCKADDR_SA_LEN +#cmakedefine HAVE_STRUCT_SOCKADDR_SA_LEN 1 + +/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */ +#cmakedefine HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1 + +/* Define to 1 if `sun_len' is member of `struct sockaddr_un'. */ +#cmakedefine HAVE_STRUCT_SOCKADDR_UN_SUN_LEN 1 /* Define if struct ucred is present from sys/socket.h */ -#undef HAVE_STRUCT_UCRED +#cmakedefine HAVE_STRUCT_UCRED 1 /* Define to 1 if you have the <sysent.h> header file. */ #cmakedefine HAVE_SYSENT_H 1 diff --git a/dcop/KDE-ICE/Xtranssock.c b/dcop/KDE-ICE/Xtranssock.c index bb6d122bc..31a35fcd9 100644 --- a/dcop/KDE-ICE/Xtranssock.c +++ b/dcop/KDE-ICE/Xtranssock.c @@ -47,6 +47,10 @@ from The Open Group. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <ctype.h> #include <unistd.h> #include <stdlib.h> @@ -873,7 +877,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port) else sockname.sin_port = htons (0); -#ifdef BSD44SOCKETS +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sockname.sin_len = sizeof (sockname); #endif sockname.sin_family = AF_INET; @@ -947,7 +951,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port) } namelen = sizeof( sockname ) - sizeof( sockname.sun_path ) + strlen( sockname.sun_path ) + 1; -#if defined(BSD44SOCKETS) +#if defined(HAVE_STRUCT_SOCKADDR_UN_SUN_LEN) sockname.sun_len = namelen; #endif @@ -1278,7 +1282,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) * Build the socket name. */ -#ifdef BSD44SOCKETS +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sockname.sin_len = sizeof (struct sockaddr_in); #endif sockname.sin_family = AF_INET; |