summaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
blob: 14828bc3c0f08a97a0be5ea4d5b58f3eb6de2287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#################################################
#
#  (C) 2012 Golubev Alexander
#  fatzer2 (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

##### check for gcc visibility support #########
# FIXME
# This should check for [T]Qt3 visibility support

if( WITH_GCC_VISIBILITY )
  if( NOT UNIX )
    tde_message_fatal(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" )
  endif( NOT UNIX )
  set( __KDE_HAVE_GCC_VISIBILITY 1 )
  set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
endif( WITH_GCC_VISIBILITY )

tde_setup_architecture_flags( )


##### ark #######################################

if( BUILD_ARK )
  check_symbol_exists( strlcpy string.h HAVE_STRLCPY_PROTO )
  check_symbol_exists( strlcat string.h HAVE_STRLCAT_PROTO )
endif( BUILD_ARK )


##### kcalc #####################################

if( BUILD_KCALC )
  check_type_size( "unsigned long" SIZEOF_UNSIGNED_LONG )
  check_include_file( "stdlib.h" HAVE_STDLIB_H )
  check_include_file( "ieeefp.h" HAVE_IEEEFP_H )

# NOTE: this check could be insufficiant for build on some
#       buggy, very old or unusual system configurations
  check_type_size( "long double" SIZEOF_LONG_DOUBLE)
  if( SIZEOF_LONG_DOUBLE )
    set( HAVE_LONG_DOUBLE 1 )
  endif( SIZEOF_LONG_DOUBLE )

  set( CMAKE_REQUIRED_LIBRARIES m )
  check_symbol_exists( "fabsl"  "math.h" HAVE_L_FUNCS)
  check_symbol_exists( "isinf"  "math.h" HAVE_FUNC_ISINF)
  check_symbol_exists( "round"  "math.h" HAVE_FUNC_ROUND)
  check_symbol_exists( "roundl" "math.h" HAVE_FUNC_ROUNDL)
  
# also libgmp is requred
  set( CMAKE_REQUIRED_LIBRARIES gmp )
# most functions are defined as macros so we can't use check_library exists
  check_symbol_exists( "gmp_asprintf" "gmp.h" HAVE_GMPLIB  )
  set( CMAKE_REQUIRED_LIBRARIES )

  if( HAVE_GMPLIB )
    set( GMP_LIBRARY gmp CACHE INTERNAL "" )
  else( )
    tde_message_fatal( "libgmp is required, but was not found on your system" )
  endif( )
endif ( BUILD_KCALC )


##### klaptopdaemon #############################

if( BUILD_KLAPTOPDAEMON )
# stdint.h
  check_include_file( "stdint.h" HAVE_STDINT_H )
  if( NOT HAVE_STDINT_H )
    tde_message_fatal( "stdint.h header is required, but was not found on your system" )
  endif( NOT HAVE_STDINT_H )

# xtest
  pkg_search_module( XTEST xtst )
   if( XTEST_FOUND )
     set( HAVE_XTEST 1 )
   else( XTEST_FOUND )
     tde_message_fatal( "libXtst is requested, but was not found on your system" )
   endif( XTEST_FOUND )

  if( WITH_XSCREENSAVER )
    pkg_search_module( XSCREENSAVER xscrnsaver )
     if( XSCREENSAVER_FOUND )
       set( HAVE_XSCREENSAVER 1 )
     else( XSCREENSAVER_FOUND )
       tde_message_fatal( "xscreensaver is requested, but was not found on your system" )
     endif( )
  endif( WITH_XSCREENSAVER )
endif( BUILD_KLAPTOPDAEMON )


##### klaptopdaemon and ksim ####################

if( ( BUILD_KLAPTOPDAEMON AND WITH_DPMS ) OR ( BUILD_KSIM AND WITH_SENSORS ) )
  pkg_search_module( XEXT xext )

  if( XEXT_FOUND )
    if( WITH_DPMS )
      set( CMAKE_REQUIRED_LIBRARIES ${XEXT_LIBRARIES} )
      check_symbol_exists( DPMSInfo 
          "X11/Xlib.h;X11/extensions/dpms.h" 
          HAVE_DPMSINFO_PROTO )
      set( CMAKE_REQUIRED_LIBRARIES )
      set( HAVE_DPMS 1 )
    endif( WITH_DPMS )
  else( XEXT_FOUND )
    tde_message_fatal( "libXext is requested, but was not found on your system" )
  endif( XEXT_FOUND )
endif( )


##### kmilo #####################################

if ( BUILD_KMILO )
# FIXME: If anybody will ever compile trinity for POWERPC and especialy for 
#        POWERBOOK he should test those checks and modules
  if( WITH_POWERBOOK )
    check_include_file( "pbbipc.h" HAVE_PBBIPC_H )
    if( NOT HAVE_PBBIPC_H )
      tde_message_fatal( "pbbipc.h header is required, but was not found on your system" )
    endif( NOT HAVE_PBBIPC_H )
  endif( WITH_POWERBOOK )

  if( WITH_POWERBOOK2 )
    check_include_file( "pbb.h" HAVE_PBB_H )
    if( NOT HAVE_PBB_H )
      tde_message_fatal( "pbb.h header is required, but was not found on your system" )
    endif( NOT HAVE_PBB_H )
  endif( WITH_POWERBOOK2 )

endif (BUILD_KMILO)


##### ksim ######################################

if ( BUILD_KSIM )
  check_include_file( "sys/statvfs.h" HAVE_SYS_STATVFS_H )
  check_include_file( "sys/statfs.h"  HAVE_SYS_STATFS_H )
  check_include_file( "sys/vfs.h"     HAVE_SYS_VFS_H )
  check_include_file( "sys/mount.h"   HAVE_SYS_MOUNT_H )
  check_include_file( "mntent.h"      HAVE_MNTENT_H )
  check_include_file( "sys/ucred.h"   HAVE_SYS_UCRED_H )
  check_include_file( "sys/mnttab.h"  HAVE_SYS_MNTTAB_H )

  check_include_file( "sys/loadavg.h"  HAVE_SYS_LOADAVG_H )
  check_function_exists( getloadavg    HAVE_GETLOADAVG )

  check_c_source_compiles(
    "#include <linux/kernel.h>
     int main() { struct sysinfo system; 
     int totalhigh = system.totalhigh; 
     int freehigh = system.freehigh; return 0; }"
    HAVE_SYSINFO_HIGH )

  if( WITH_SNMP )
    check_include_file( "net-snmp/net-snmp-config.h" HAVE_NET_SNMP_NET_SNMP_CONFIG_H )
    check_library_exists( netsnmp init_snmp "" HAVE_NETSNMP )
    if( HAVE_NET_SNMP_NET_SNMP_CONFIG_H AND HAVE_NETSNMP )
     set( NETSNMP_LIBRARIES netsnmp )
    else ()
      tde_message_fatal( "netsnmp is required, but was not found on your system" )
    endif ()
  endif( WITH_SNMP )
endif ( BUILD_KSIM )


##### superkaramba ##############################

if ( BUILD_SUPERKARAMBA )
  check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )

  find_package( PythonLibs )
  if( NOT PYTHONLIBS_FOUND )
    tde_message_fatal( "python is required, but was not found on your system" )
  endif( NOT PYTHONLIBS_FOUND )

  if( WITH_KNEWSTUFF )
    set( HAVE_KNEWSTUFF 1 )
    set( KNEWSTUFF_LIBRARIES knewstuff-shared )
  endif( WITH_KNEWSTUFF )

  if( WITH_XMMS )
    set( HAVE_XMMS 1 )
  endif( WITH_XMMS )
endif ( BUILD_SUPERKARAMBA )


# required stuff
find_package( TQt )
find_package( TDE )