summaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
blob: 6176f72acfa8ef3062ca7eeef495b864085c258d (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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#################################################
#
#  (C) 2016 Slávek Banko
#  slavek.banko (AT) axis.cz
#
#  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 )


##### set architecture flags ####################
tde_setup_architecture_flags( )


##### required stuff ############################

find_package( TQt )
find_package( TDE )
set( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}:${LIB_INSTALL_DIR}/pkgconfig" )


##### check system configuration ################

check_symbol_exists( strdup "string.h" HAVE_STRDUP_DECL )
check_type_size( ushort USHORT )
check_type_size( boolean BOOLEAN )

check_type_size( "int" SIZEOF_INT )
check_type_size( "long" SIZEOF_LONG )
check_type_size( "short" SIZEOF_SHORT )
check_type_size( "unsigned char" SIZEOF_UNSIGNED_CHAR )
check_type_size( "unsigned int" SIZEOF_UNSIGNED_INT )
check_type_size( "unsigned long" SIZEOF_UNSIGNED_LONG )
check_type_size( "unsigned short" SIZEOF_UNSIGNED_SHORT )

pkg_search_module( LIBXML libxml-2.0>=2.6.0 )
if( NOT LIBXML_FOUND )
  tde_message_fatal( "libxml at least 2.6.0 is required, but not found on your system" )
endif( NOT LIBXML_FOUND )

pkg_search_module( LIBXSLT libexslt>=0.8.0 )
if( NOT LIBXSLT_FOUND )
  pkg_search_module( LIBXSLT libxslt>=1.0.19 )
  if( NOT LIBXSLT_FOUND )
    tde_message_fatal( "libxslt at least 1.0.19 is required, but not found on your system" )
  endif( )
endif( NOT LIBXSLT_FOUND )

pkg_search_module( TAGLIB taglib )
if( TAGLIB_FOUND )
  set( HAVE_TAGLIB 1 )
endif( TAGLIB_FOUND )

pkg_search_module( YAZ yaz )
if( YAZ_FOUND )
  set( HAVE_YAZ 1 )
endif( YAZ_FOUND )

if( WITH_LIBKCDDB )
  message( "-- checking for 'libkcddb'" )

  find_path(
    LIBKCDDB_INCLUDE_DIR
      cddb.h
    PATHS
      ${TDE_INCLUDE_DIR}/tde/libkcddb
      ${TDE_INCLUDE_DIR}/libkcddb
    NO_DEFAULT_PATH
  )

  find_library(
    LIBKCDDB_LIBRARY
      kcddb
    PATHS
      ${TDE_LIB_DIR}
      ${TQT_LIBRARY_DIRS}
  )
  if( LIBKCDDB_LIBRARY )
    get_filename_component( LIBKCDDB_LIBRARY_DIR ${LIBKCDDB_LIBRARY} PATH CACHE )
  endif( )

  if( NOT LIBKCDDB_INCLUDE_DIR OR NOT LIBKCDDB_LIBRARY_DIR )
    tde_message_fatal( "libkcddb is required, but was not found on your system" )
  else( )
    set( HAVE_KCDDB 1 )
  endif( )
endif( WITH_LIBKCDDB )

if( WITH_LIBKCAL )
  message( "-- checking for 'libkcal'" )

  find_path(
    LIBKCAL_INCLUDE_DIR
      kcalversion.h
    PATHS
      ${TDE_INCLUDE_DIR}/libkcal
      ${TDE_INCLUDE_DIR}
      ${TQT_INCLUDE_DIRS}
  )

  find_library(
    LIBKCAL_LIBRARY
      kcal
    PATHS
      ${TDE_LIB_DIR}
      ${TQT_LIBRARY_DIRS}
  )
  if( LIBKCAL_LIBRARY )
    get_filename_component( LIBKCAL_LIBRARY_DIR ${LIBKCAL_LIBRARY} PATH CACHE )
  endif( )

  if( NOT LIBKCAL_INCLUDE_DIR OR NOT LIBKCAL_LIBRARY_DIR )
    tde_message_fatal( "libkcal is required, but was not found on your system" )
  else( )
    set( HAVE_KCAL 1 )
  endif( )
endif( WITH_LIBKCAL )

if( WITH_LIBBTPARSE )
  check_library_exists( btparse bt_initialize "" HAVE_LIBBTPARSE )
  if( NOT HAVE_LIBBTPARSE )
    tde_message_fatal( "libbtparse is required, but was not found on your system" )
  endif( NOT HAVE_LIBBTPARSE )
  set( BTPARSE_LIBRARIES btparse )
else( )
  set( BTPARSE_LIBRARIES btparse-static )
endif( WITH_LIBBTPARSE )

if( WITH_SAX )
  set( SAX_SUPPORT 1 CACHE INTERNAL "" )
endif( WITH_SAX )


if( BUILD_AMAZON_SUPPORT )
  set( AMAZON_SUPPORT 1 CACHE INTERNAL "" )
endif( BUILD_AMAZON_SUPPORT )

if( BUILD_IMDB_SUPPORT )
  set( IMDB_SUPPORT 1 CACHE INTERNAL "" )
endif( BUILD_IMDB_SUPPORT )

if( BUILD_CDTEXT_SUPPORT )
  set( USE_CDTEXT 1 CACHE INTERNAL "" )
endif( BUILD_CDTEXT_SUPPORT )

if( BUILD_OOO_SUPPORT )
  # FIXME - add configure checks for LibreOffice/OpenOffice.org
  #set( WITH_OOO 1 CACHE INTERNAL "" )
  tde_message_fatal( "CMake build with LibreOffice/OpenOffice.org support is not yet complete" )
endif( BUILD_OOO_SUPPORT )

if( BUILD_EXEMPI_SUPPORT )
  pkg_search_module( EXEMPI exempi-2.0>=1.99.0 )
  if( NOT EXEMPI_FOUND )
    tde_message_fatal( "exempi at least 1.99.0 is required, but not found on your system" )
  else( )
    set( HAVE_EXEMPI 1 CACHE INTERNAL "" )
  endif( )
endif( BUILD_EXEMPI_SUPPORT )

if( BUILD_POPPLER_SUPPORT )
  pkg_search_module( POPPLER poppler-tqt>=0.5 )
  if( NOT POPPLER_FOUND )
    tde_message_fatal( "poppler-tqt at least 0.5 is required, but not found on your system" )
  else( )
    set( HAVE_POPPLER 1 CACHE INTERNAL "" )
  endif( )
endif( BUILD_POPPLER_SUPPORT )

if( BUILD_WEBCAM_SUPPORT )
  check_include_file( "libv4l1-videodev.h" HAVE_LIBV4L1_VIDEODEV_H )
  if( HAVE_LIBV4L1_VIDEODEV_H )
    set( ENABLE_WEBCAM 1 CACHE INTERNAL "" )
    set( VIDEODEV_HEADER "libv4l1-videodev.h" CACHE INTERNAL "" )
  else( )
    check_include_file( "linux/videodev.h" HAVE_VIDEODEV_H )
    if( HAVE_VIDEODEV_H )
      set( ENABLE_WEBCAM 1 CACHE INTERNAL "" )
      set( VIDEODEV_HEADER "linux/videodev.h" CACHE INTERNAL "" )
    else( )
      tde_message_fatal( "libv4l1-videodev.h or linux/videodev.h is required, but not found on your system" )
    endif( )
  endif( )
  set( WEBCAM_LIBRARIES barcode-static )
endif( BUILD_WEBCAM_SUPPORT )


##### translations ##############################

if( BUILD_TRANSLATIONS )
  include( FindGettext )
  if( GETTEXT_FOUND )
    set( MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT_EXECUTABLE}
         CACHE FILEPATH "path to msgfmt executable" )
  endif( GETTEXT_FOUND )

  if( NOT MSGFMT_EXECUTABLE )
    tde_message_fatal( "msgfmt is required but was not found on your system." )
  endif( NOT MSGFMT_EXECUTABLE )
endif( BUILD_TRANSLATIONS )