diff --git a/CMakeLists.txt b/CMakeLists.txt index 6aade48b9..612bc212d 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 ################# @@ -342,7 +343,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 ) @@ -461,6 +462,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 ) @@ -498,7 +500,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(" @@ -544,6 +552,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 @@ -630,6 +640,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 d29fac364..426bac193 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 @@ -165,7 +151,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 header file. */ #cmakedefine HAVE_DLD_H 1 @@ -192,7 +178,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 @@ -305,9 +291,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 @@ -332,12 +315,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 @@ -413,9 +390,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NET_IF_H 1 -/* Define to 1 if you have the 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 @@ -471,7 +445,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 @@ -594,13 +568,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 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 +#endif + #include #include #include @@ -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;