summaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
blob: ca458113559cc094b93ae802d07640a80f4aea8e (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
#################################################
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 3
#
#################################################

# required stuff
find_package( TQt )
find_package( TDE )

tde_setup_architecture_flags( )

include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)


##### check for gcc visibility support #########

if( WITH_GCC_VISIBILITY )
  if( NOT UNIX )
    tde_message_fatal( "gcc 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 )


#### check for headers

check_include_file( "unistd.h"           HAVE_UNISTD_H           )
check_include_file( "sys/stat.h"         HAVE_SYS_STAT_H         )
check_include_file( "crypt.h"            HAVE_CRYPT_H            )
check_include_file( "paths.h"            HAVE_PATHS_H            )


#### check for functions

check_function_exists( crypt HAVE_CRYPT )
if( NOT HAVE_CRYPT )
  check_library_exists( crypt crypt "" HAVE_CRYPT_LIB )
  if( HAVE_CRYPT_LIB )
    set( HAVE_CRYPT 1 )
    set( CRYPT_LIBRARIES crypt )
  endif( HAVE_CRYPT_LIB )
endif( NOT HAVE_CRYPT )
if( NOT HAVE_CRYPT )
  check_library_exists( c crypt "" HAVE_CRYPT_LIBC )
  if( HAVE_CRYPT_LIBC )
    set( HAVE_CRYPT 1 )
    set( CRYPT_LIBRARIES c )
  endif( HAVE_CRYPT_LIBC )
endif( NOT HAVE_CRYPT )

check_function_exists( getspent HAVE_GETSPENT )
if( HAVE_GETSPENT )
  set( HAVE_SHADOW 1 )
else( )
  check_library_exists( shadow getspent "" LIBSHADOW )
  if( LIBSHADOW )
    set( HAVE_SHADOW 1 )
    set( SHADOW_LIBRARIES shadow )
  else( )
    check_library_exists( gen getspent "" LIBGEN )
    if( LIBGEN )
      set( HAVE_SHADOW 1 )
      set( SHADOW_LIBRARIES gen )
    endif( )
  endif( )
endif( )

tde_save_and_set( CMAKE_REQUIRED_INCLUDES "pwd.h" )
check_function_exists( fgetpwent HAVE_FGETPWENT )
tde_restore( CMAKE_REQUIRED_INCLUDES )

tde_save_and_set( CMAKE_REQUIRED_INCLUDES "grp.h" )
check_function_exists( fgetgrent HAVE_FGETGRENT )
tde_restore( CMAKE_REQUIRED_INCLUDES )

tde_save_and_set( CMAKE_REQUIRED_INCLUDES "shadow.h" )
check_function_exists( fgetspent HAVE_FGETSPENT )
tde_restore( CMAKE_REQUIRED_INCLUDES )