generic: get rid of CheckPrototypeExists macro

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-05-13 03:04:21 +00:00
parent e993c547f2
commit e493884502
3 changed files with 16 additions and 71 deletions

View file

@ -9,7 +9,6 @@ include(CheckSymbolExists)
include(CheckCXXSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckPrototypeExists)
include(CheckTypeSize)
include(CheckStructMember)
include(CheckCXXSourceCompiles)
@ -189,15 +188,8 @@ check_function_exists(mkstemp HAVE_MKSTEMP) # kdecore/fakes.c
check_function_exists(mkdtemp HAVE_MKDTEMP) # kdecore/fakes.c
check_function_exists(strlcpy HAVE_STRLCPY) # kdecore/fakes.c
check_function_exists(strlcat HAVE_STRLCAT) # kdecore/fakes.c
check_cxx_symbol_exists(__CORRECT_ISO_CPP_STRING_H_PROTO "string.h" HAVE_STRCASESTR_OVERLOAD) # glibc-2.9 strangeness
if (HAVE_STRCASESTR_OVERLOAD)
#message(STATUS "string.h defines __CORRECT_ISO_CPP_STRING_H_PROTO")
set(HAVE_STRCASESTR 1)
set(HAVE_STRCASESTR_PROTO 1)
else()
check_function_exists(strcasestr HAVE_STRCASESTR) # kdecore/fakes.c
check_prototype_exists(strcasestr string.h HAVE_STRCASESTR_PROTO)
endif()
check_function_exists(strcasestr HAVE_STRCASESTR) # kdecore/fakes.c
check_symbol_exists(strcasestr string.h HAVE_STRCASESTR_PROTO)
check_function_exists(setenv HAVE_SETENV) # kdecore/fakes.c
check_function_exists(seteuid HAVE_SETEUID) # kdecore/fakes.c
check_function_exists(setmntent HAVE_SETMNTENT) # solid, kio, kdecore
@ -206,18 +198,18 @@ check_function_exists(usleep HAVE_USLEEP) # kdecore/fakes.c, kdeu
# check for prototypes [for functions provided by kdefakes when not available]
check_prototype_exists(mkstemps "stdlib.h;unistd.h" HAVE_MKSTEMPS_PROTO)
check_prototype_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP_PROTO)
check_prototype_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP_PROTO)
check_prototype_exists(strlcat string.h HAVE_STRLCAT_PROTO)
check_prototype_exists(strlcpy string.h HAVE_STRLCPY_PROTO)
check_prototype_exists(res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO)
check_prototype_exists(setenv stdlib.h HAVE_SETENV_PROTO)
check_prototype_exists(unsetenv stdlib.h HAVE_UNSETENV_PROTO)
check_prototype_exists(usleep unistd.h HAVE_USLEEP_PROTO)
check_prototype_exists(initgroups "unistd.h;sys/types.h;unistd.h;grp.h" HAVE_INITGROUPS_PROTO)
check_prototype_exists(setreuid unistd.h HAVE_SETREUID_PROTO)
check_prototype_exists(trunc math.h HAVE_TRUNC)
check_symbol_exists(mkstemps "stdlib.h;unistd.h" HAVE_MKSTEMPS_PROTO)
check_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP_PROTO)
check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP_PROTO)
check_symbol_exists(strlcat string.h HAVE_STRLCAT_PROTO)
check_symbol_exists(strlcpy string.h HAVE_STRLCPY_PROTO)
check_symbol_exists(res_init "sys/types.h;netinet/in.h;arpa/nameser.h;resolv.h" HAVE_RES_INIT_PROTO)
check_symbol_exists(setenv stdlib.h HAVE_SETENV_PROTO)
check_symbol_exists(unsetenv stdlib.h HAVE_UNSETENV_PROTO)
check_symbol_exists(usleep unistd.h HAVE_USLEEP_PROTO)
check_symbol_exists(initgroups "unistd.h;sys/types.h;unistd.h;grp.h" HAVE_INITGROUPS_PROTO)
check_symbol_exists(setreuid unistd.h HAVE_SETREUID_PROTO)
check_symbol_exists(trunc math.h HAVE_TRUNC)
# check for existing datatypes

View file

@ -1,41 +0,0 @@
# - Check if the prototype for a function exists.
# CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
#
# FUNCTION - the name of the function you are looking for
# HEADER - the header(s) where the prototype should be declared
# VARIABLE - variable to store the result
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCXXSourceCompiles)
MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
SET(_INCLUDE_FILES)
FOREACH (it ${_HEADER})
SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
ENDFOREACH (it)
SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
#ifndef ${_SYMBOL}
int i = sizeof(&${_SYMBOL});
#endif
return 0;
}
")
CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)

View file

@ -1,10 +1,4 @@
####### checks for kdecore/network (and netsupp.cpp) ###############
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckPrototypeExists)
include(CheckSymbolExists)
include(CheckTypeSize)
include(CheckStructMember)
# FIXME: the ssl check fails for some reason
if(KATIE_FOUND)
@ -46,7 +40,7 @@ check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
check_function_exists(gethostbyname_r HAVE_GETHOSTBYNAME_R)
check_function_exists(if_nametoindex HAVE_IF_NAMETOINDEX)
check_prototype_exists(getservbyname_r netdb.h HAVE_GETSERVBYNAME_R_PROTO)
check_symbol_exists(getservbyname_r netdb.h HAVE_GETSERVBYNAME_R_PROTO)
check_symbol_exists(freeaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_FREEADDRINFO)
check_symbol_exists(getnameinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETNAMEINFO)
@ -59,7 +53,7 @@ check_struct_member("struct sockaddr" sa_len "sys/types.h;sys/socket.h" HAVE_STR
# check if gai_strerror exists even if EAI_ADDRFAMILY is not defined
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h;netdb.h")
check_prototype_exists(gai_strerror netdb.h HAVE_GAI_STRERROR_PROTO)
check_symbol_exists(gai_strerror netdb.h HAVE_GAI_STRERROR_PROTO)
# check for existing datatypes
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h;netdb.h")