You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kvirc/ConfigureChecks.cmake

434 lines
11 KiB
CMake

###########################################
# #
# Improvements and feedback are welcome #
# #
# This file is released under GPL >= 3 #
# #
###########################################
# required stuff
find_package( TQt )
if( WITH_TDE )
find_package( TDE )
endif( )
tde_setup_compiler_flags( )
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
tde_setup_largefiles( )
##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY )
##### build with X integration
unset( COMPILE_NO_X )
unset( COMPILE_NO_X_BELL )
unset( COMPILE_ON_WINDOWS )
##### check for X server
pkg_search_module( X11 x11 )
if( NOT X11_FOUND )
tde_message_fatal( "X11 support is required but not found on your system" )
endif( )
##### build with TDE integration
if( WITH_TDE )
set( COMPILE_TDE_SUPPORT 1 )
message( "-- Building with TDE support" )
endif( )
##### check for pthread
find_package ( Threads REQUIRED )
##### check size of various types
check_type_size( "int" SIZEOF_INT )
check_type_size( "long" SIZEOF_LONG_INT )
check_type_size( "long" SIZEOF_LONG_LONG_INT )
check_type_size( "short" SIZEOF_SHORT_INT )
check_type_size( "int" SIZEOF_UNSIGNED_INT )
check_type_size( "long" SIZEOF_UNSIGNED_LONG_INT )
check_type_size( "long" SIZEOF_UNSIGNED_LONG_LONG_INT )
check_type_size( "short" SIZEOF_UNSIGNED_SHORT_INT )
check_type_size( "void*" SIZEOF_VOID_P )
##### check for various functions
check_symbol_exists( inet_aton "arpa/inet.h" HAVE_INET_ATON )
check_symbol_exists( inet_ntoa "arpa/inet.h" HAVE_INET_NTOA )
check_symbol_exists( putenv "stdlib.h" HAVE_PUTENV )
check_symbol_exists( setenv "stdlib.h" HAVE_SETENV )
check_symbol_exists( unsetenv "stdlib.h" HAVE_UNSETENV )
##### check for processor type
if( WITH_ix86_ASM )
if( CMAKE_SYSTEM_PROCESSOR MATCHES "^i[3-6]86$" )
set( COMPILE_ix86_ASM 1 )
message( "-- Building with ix86 assembly optimization" )
else( )
message( "-- Building without ix86 assembly optimization" )
endif()
endif()
##### check for aRts
if( WITH_ARTS )
pkg_search_module( ARTS arts )
if( NOT ARTS_FOUND )
tde_message_fatal( "aRts support was requested but not found on your system" )
endif( )
set( COMPILE_ARTS_SUPPORT 1 )
list( APPEND ARTS_LIBRARIES "mcop" )
list( APPEND ARTS_LIBRARIES "soundserver_idl" )
endif( )
##### check for audiofile
if( WITH_AUDIOFILE )
if( NOT WITH_OSS )
tde_message_fatal( "audiofile requires OSS support. Please enabled it with -DWITH_OSS=ON" )
endif( )
pkg_search_module( AUDIOFILE audiofile )
if( NOT AUDIOFILE_FOUND )
tde_message_fatal( "audiofile support was requested, but not found on your system" )
endif( )
set( COMPILE_AUDIOFILE_SUPPORT 1 )
endif( )
##### Optimize for big channels
if( WITH_BIG_CHANNELS )
set( AVERAGE_CHANNEL_USERS 349 )
else( )
set( AVERAGE_CHANNEL_USERS 101 )
endif( )
message( "-- Using ${AVERAGE_CHANNEL_USERS} as size for channel dict" )
##### check for cryptography support
if( WITH_CRYPT )
set( COMPILE_CRYPT_SUPPORT 1 )
message( "-- Building with cryptology support" )
else( )
message( "-- Building without cryptology support" )
endif( )
##### check for DCC voice sound support
if( WITH_DCC_VOICE )
if( NOT WITH_OSS )
tde_message_fatal( "DCC voice sound requires OSS support. Please enabled it with -DWITH_OSS=ON" )
endif( )
message( "-- Building with DCC voice sound support" )
else( )
set( COMPILE_DISABLE_DCC_VOICE 1 )
message( "-- Building without DCC voice sound support" )
endif( )
##### check for dynamic label support
if( WITH_DYN_LABELS )
check_c_source_compiles("
int main(int argc,char ** argv)
{
int retVal = 10;
void * label = &&action4;
goto action2;
action1:
retVal -= 4;
label = &&endofcode;
goto *label;
action2:
retVal -= 5;
goto *label;
action3:
retVal += 40;
action4:
retVal -= 1;
label = &&action1;
goto *label;
endofcode:
return retVal;
}"
DYN_LABELS_SUPPORT
)
if( NOT DYN_LABELS_SUPPORT )
tde_message_fatal( "Dynamic label support was requested but your compiler does not support it" )
endif( )
set( COMPILE_USE_DYNAMIC_LABELS 1 )
endif( )
##### check for ESound Daemon
if( WITH_ESD )
check_library_exists( esd esd_play_file HAVE_ESD )
if( NOT HAVE_ESD )
tde_message_fatal( "ESound Daemon support was requested but not found on your system" )
endif( )
set( COMPILE_ESD_SUPPORT 1 )
set( ESD_LIBRARIES "esd" )
endif( )
##### check for GSM support
if( WITH_GSM )
check_include_file_cxx( gsm.h HAVE_GSM_H )
find_library( GSM_LIBRARY gsm )
if( NOT HAVE_GSM_H OR GSM_LIBRARY-NOTFOUND )
tde_message_fatal( "GSM support was requested but not found on your system" )
endif()
set( COMPILE_USE_GSM 1 )
endif( )
##### check for info tips support
if( WITH_INFO_TIPS )
set( COMPILE_INFO_TIPS 1 )
message( "-- Building with info tips support" )
else( )
message( "-- Building without info tips support" )
endif( )
##### check for interface address capabilities
check_c_source_compiles("
#include <stdio.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
int main(int argc,char ** argv)
{
struct ifreq ifr;
int ret;
struct sockaddr * sa;
ret = IFNAMSIZ;
ret = ioctl(ret,SIOCGIFADDR,&ifr);
if(ifr.ifr_name != 0)sa = (struct sockaddr *)&(ifr.ifr_addr);
return 0;
}"
IF_ADDR_SUPPORT
)
if( IF_ADDR_SUPPORT )
message( "-- Building with interface address support" )
set( COMPILE_GET_INTERFACE_ADDRESS 1 )
else( )
message( "-- Building without interface address support" )
endif( )
##### check for inter-process communication support
if( WITH_IPC )
message( "-- Building with inter-process communication support" )
else( )
set( COMPILE_NO_IPC 1 )
message( "-- Building without inter-process communication support" )
endif( )
##### check for IP v6 support
if( WITH_IPV6 )
check_c_source_compiles("
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
int main(void) {
struct sockaddr_in6 addr;
(void)addr;
return 0;
}"
COMPILE_IPV6_SUPPORT )
if ( NOT COMPILE_IPV6_SUPPORT )
tde_message_fatal( "IP v6 support was requested but your system does not support it" )
endif( )
endif( )
##### check for malloc memory check support
if( WITH_MEMORY_CHECKS )
set( COMPILE_MEMORY_CHECKS 1 )
message( "-- Building with malloc memory check support" )
else( )
message( "-- Building without malloc memory check support" )
endif( )
##### check for memory profiling support
if( WITH_MEMORY_PROFILE )
set( COMPILE_MEMORY_PROFILE 1 )
message( "-- Building with memory profiling support" )
else( )
message( "-- Building without memory profiling support" )
endif( )
##### check whether to ignore SIGALARM signal
if( WITH_NO_SIGALARM )
message( "-- Building ignoring SIGALARM signal" )
set( COMPILE_IGNORE_SIGALARM 1 )
endif( )
##### check for OSS support
if( WITH_OSS )
check_include_file("linux/soundcard.h" HAVE_LINUX_SOUNDCARD_H )
check_include_file("sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
check_include_file("soundcard.h" HAVE_SOUNDCARD_H )
if( HAVE_LINUX_SOUNDCARD_H OR HAVE_SYS_SOUNDCARD_H OR HAVE_SOUNDCARD_H )
set( COMPILE_OSS_SUPPORT 1 )
else( )
tde_message_fatal( "OSS support was requested but not found on your system" )
endif( )
endif( )
##### check for Perl support
if( WITH_PERL )
find_package( PerlLibs )
if( NOT PERL_FOUND )
tde_message_fatal( "Perl support was requested but Perl was not found on your system" )
endif( )
# check if perl was compiled with MULTIPLICITY option
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${PERL_INCLUDE_PATH}" )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "${PERL_LIBRARY}" )
check_c_source_compiles("
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
#ifndef MULTIPLICITY
#error No MULTIPLICITY power detected!!!
#endif
int main(void) {}
"
PERL_HAS_MULTIPLICITY
)
tde_restore( CMAKE_REQUIRED_INCLUDES )
tde_restore( CMAKE_REQUIRED_LIBRARIES )
if( NOT PERL_HAS_MULTIPLICITY )
tde_message_fatal( "Perl MULTIPLICITY support is required but the Perl in your system was compiled without it" )
endif()
set( COMPILE_PERL_SUPPORT 1 )
endif( )
##### check for SSL support
if( WITH_SSL )
pkg_search_module( SSL openssl )
if( NOT SSL_FOUND )
check_include_file( openssl/ssl.h HAVE_OPENSSL_H )
check_library_exists( ssl OPENSSL_init_ssl "" HAVE_LIBSSL_11 )
check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO )
if( NOT HAVE_LIBSSL_11 )
check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
endif( )
if( HAVE_OPENSSL_H AND HAVE_LIBCRYPTO AND (HAVE_LIBSSL_11 OR HAVE_LIBSSL) )
set( SSL_FOUND 1 CACHE INTERNAL "" FORCE )
find_file( OPENSSLV_H openssl/opensslv.h )
file( STRINGS "${OPENSSLV_H}" SSL_VERSION REGEX "#[ \t]*define[ \t]*OPENSSL_VERSION_TEXT" )
string( REGEX REPLACE "# *define[ \t]*OPENSSL_VERSION_TEXT[ \t]*\"[^0-9 ]* *([^ ]*).*" "\\1" SSL_VERSION "${SSL_VERSION}" )
set( SSL_VERSION "${SSL_VERSION}" CACHE INTERNAL "" FORCE )
message( STATUS "Found OpenSSL: version ${SSL_VERSION}" )
set( SSL_LIBRARIES "ssl;crypto" CACHE INTERNAL "ssl and crypto libs" FORCE )
endif( )
endif( )
if( NOT SSL_FOUND )
tde_message_fatal( "SSL support was requested but not found on your system" )
endif( )
set( COMPILE_SSL_SUPPORT 1 )
endif( )
##### check for system memmove and memcpy usage
if( WITH_SYSTEM_MEMMOVE )
set( COMPILE_WITH_SYSTEM_MEMMOVE 1 )
message( "-- Using system memmove and memcpy" )
else( )
message( "-- Not using system memmove and memcpy" )
endif( )
##### check for pseudo transparency support
if( WITH_TRANSPARENCY )
set( COMPILE_PSEUDO_TRANSPARENCY 1 )
message( "-- Building with pseudo transparency support" )
else( )
message( "-- Building without pseudo transparency support" )
endif( )
##### check for XScreenSaver support
if( WITH_XSCREENSAVER )
pkg_search_module( XSCREENSAVER xscrnsaver )
if( NOT XSCREENSAVER_FOUND )
tde_message_fatal( "xscreensaver was requested, but was not found on your system" )
endif( )
set( COMPILE_XSS_SUPPORT 1 )
endif( )
##### check for zlib
if( WITH_ZLIB )
find_package( ZLIB )
if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib was requested, but was not found on your system" )
endif( )
set( COMPILE_ZLIB_SUPPORT 1 )
endif( )