Warning, /frameworks/kdelibs4support/src/ConfigureChecks.cmake is written in an unsupported language. File is not indexed.

0001 ####### checks for kdecore/network (and netsupp.cpp) ###############
0002 include(CheckIncludeFiles)
0003 include(CheckFunctionExists)
0004 # TODO: check whether CheckPrototypeExists.cmake is actually necessary or whether something else can be used. Alex
0005 include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/CheckPrototypeExists.cmake)
0006 include(CheckCXXSymbolExists)
0007 include(CheckTypeSize)
0008 include(CheckStructHasMember)
0009 include(CheckCXXSourceRuns)
0010 include(CMakePushCheckState)
0011 
0012 set( KDELIBSUFF ${LIB_SUFFIX} )
0013 
0014 set(CMAKE_REQUIRED_LIBRARIES Qt5::Network)
0015 check_cxx_source_compiles(
0016 "#include <QtNetwork/QSslSocket>
0017 int main()
0018 {
0019     QSslSocket *socket;
0020     return 0;
0021 }" HAVE_QSSLSOCKET)
0022 
0023 if (NOT HAVE_QSSLSOCKET)
0024    message(FATAL_ERROR "KDE Requires Qt to be built with SSL support")
0025 endif (NOT HAVE_QSSLSOCKET)
0026 
0027 set(CMAKE_REQUIRED_LIBRARIES "")
0028 
0029 check_include_files("sys/types.h;sys/socket.h;net/if.h" HAVE_NET_IF_H)
0030 check_include_files("sys/filio.h" HAVE_SYS_FILIO_H)
0031 check_include_files(stropts.h HAVE_STROPTS_H)
0032 check_include_files(paths.h       HAVE_PATHS_H)
0033 check_include_files(sys/stat.h    HAVE_SYS_STAT_H) 
0034 check_include_files(sys/time.h    HAVE_SYS_TIME_H) 
0035 check_include_files(sys/filio.h  HAVE_SYS_FILIO_H)
0036 check_include_file( "stropts.h" HAVE_STROPTS_H )
0037 check_include_files(limits.h   HAVE_LIMITS_H) # for kcmdlineargs
0038 check_include_files(unistd.h      HAVE_UNISTD_H)
0039 
0040 # This is broken on OSX 10.6 (succeeds but shouldn't do) and doesn't exist
0041 # on previous versions so don't do the check on APPLE.
0042 if(NOT APPLE)
0043   check_function_exists(fdatasync      HAVE_FDATASYNC)  # kdecore, kate
0044 endif(NOT APPLE)
0045 
0046 check_function_exists(inet_pton        HAVE_INET_PTON)
0047 check_function_exists(inet_ntop        HAVE_INET_NTOP)
0048 check_function_exists(getprotobyname_r HAVE_GETPROTOBYNAME_R)
0049 check_function_exists(poll             HAVE_POLL)
0050 check_function_exists(getservbyname_r  HAVE_GETSERVBYNAME_R)
0051 check_function_exists(getservbyport_r HAVE_GETSERVBYPORT_R)
0052 check_function_exists(gethostbyname2   HAVE_GETHOSTBYNAME2)
0053 check_function_exists(gethostbyname2_r HAVE_GETHOSTBYNAME2_R)
0054 check_function_exists(gethostbyname    HAVE_GETHOSTBYNAME)
0055 check_function_exists(gethostbyname_r  HAVE_GETHOSTBYNAME_R)
0056 check_function_exists(if_nametoindex  HAVE_IF_NAMETOINDEX)
0057 
0058 check_prototype_exists(getservbyname_r netdb.h      HAVE_GETSERVBYNAME_R_PROTO)
0059 
0060 check_cxx_symbol_exists(posix_madvise   "sys/mman.h"               HAVE_MADVISE)
0061 
0062 check_cxx_symbol_exists(getnameinfo     "sys/types.h;sys/socket.h;netdb.h"     HAVE_GETNAMEINFO)
0063 check_cxx_symbol_exists(getaddrinfo     "sys/types.h;sys/socket.h;netdb.h"     HAVE_GETADDRINFO)
0064 
0065 check_cxx_symbol_exists(res_init        "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT)
0066 # redundant? check_function_exists(res_init        HAVE_RES_INIT)
0067 
0068 
0069 # check if gai_strerror exists even if EAI_ADDRFAMILY is not defined
0070 set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h;netdb.h")
0071 check_prototype_exists(gai_strerror netdb.h HAVE_GAI_STRERROR_PROTO)
0072 
0073 # check for existing datatypes
0074 if(WIN32)
0075     set(CMAKE_EXTRA_INCLUDE_FILES "ws2tcpip.h")
0076 else()
0077     set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h;netdb.h")
0078 endif()
0079 check_type_size("struct addrinfo" HAVE_STRUCT_ADDRINFO)
0080 set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h;netdb.h")
0081 check_type_size("struct sockaddr_in6" HAVE_STRUCT_SOCKADDR_IN6)
0082 set(CMAKE_EXTRA_INCLUDE_FILES)  #reset CMAKE_EXTRA_INCLUDE_FILES
0083 
0084 check_struct_has_member("struct sockaddr" sa_len "sys/types.h;sys/socket.h" HAVE_STRUCT_SOCKADDR_SA_LEN LANGUAGE CXX)
0085 check_struct_has_member(dirent d_type dirent.h HAVE_DIRENT_D_TYPE LANGUAGE CXX)
0086 check_prototype_exists(res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO)
0087 
0088 check_cxx_source_runs("
0089   #include <sys/types.h>
0090   #include <sys/socket.h>
0091   #include <netdb.h>
0092   #include <string.h>
0093   int main()
0094   {
0095     struct addrinfo hint, *res;
0096     int err;
0097     memset(&hint, 0, sizeof(hint));
0098     hint.ai_family = AF_INET;
0099     hint.ai_protocol = 0;
0100     hint.ai_socktype = SOCK_STREAM;
0101     hint.ai_flags = AI_PASSIVE;
0102     err = getaddrinfo(0, \"18300\", &hint, &res);
0103     if (err != 0 || res == 0 || res->ai_family != AF_INET)
0104       return 1;
0105     return 0;
0106   }"
0107   HAVE_GOOD_GETADDRINFO
0108 )
0109 
0110 if( NOT HAVE_GOOD_GETADDRINFO )
0111   set( HAVE_BROKEN_GETADDRINFO 1 )
0112 endif( NOT HAVE_GOOD_GETADDRINFO )