summaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
blob: d8fe7e169da9b804e489e4e661d0efbb470ead5e (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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
###########################################
#                                         #
#  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)

tde_setup_largefiles( )


##### check for gcc visibility support

if( WITH_GCC_VISIBILITY )
  tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY )


##### check for lcms #####

if( WITH_LCMS )
  pkg_search_module( LCMS lcms )
  if( NOT LCMS_FOUND )
    tde_message_fatal( "lcms was requested but was not found on your system" )
  endif()
endif( )


##### check for math libc #####

find_library( MATH_LIBC m )
if( NOT MATH_LIBC )
  tde_message_fatal( "libm is required but not found on your system" )
endif( )


##### check for zlib #####

pkg_search_module( ZLIB zlib )
if( NOT ZLIB_FOUND )
  tde_message_fatal( "zlib is required but not found on your system" )
endif( )


##### checks for dicom codec #####

if( BUILD_DICOM )
  ## check for medcon
  find_program( DICOM_COMMAND NAMES medcon )
  if( NOT DICOM_COMMAND )
    tde_message_fatal( "dicom codec was requested but medcon not found on your system" )
  endif( )
endif( )


##### checks for djvu codec #####

if( BUILD_DJVU )
  ## check for ddjvu
  find_program( DJVU_COMMAND NAMES ddjvu )
  if( NOT DJVU_COMMAND )
    tde_message_fatal( "djvu codec was requested but ddjvu not found on your system" )
  endif( )
endif( )


##### checks for dxf codec #####

if( BUILD_DXF )
  ## check for vec2web
  find_program( DXF_COMMAND NAMES vec2web )
  if( NOT DXF_COMMAND )
    tde_message_fatal( "dxf codec was requested but vec2web not found on your system" )
  endif( )
endif( )


##### checks for eps codec #####

if( BUILD_EPS )
  find_program( EPS_COMMAND NAMES gs )
  if( NOT EPS_COMMAND )
    tde_message_fatal( "eps codec was requested but gs not found on your system" )
  endif( )
endif( )


##### checks for fig codec #####

if( BUILD_FIG )
  ## check for fig2dev
  find_program( FIG2DEV_COMMAND NAMES fig2dev )
  if( NOT FIG2DEV_COMMAND )
    tde_message_fatal( "fig codec was requested but fig2dev not found on your system" )
  endif( )
endif( )


##### checks for gif codec #####

if( BUILD_GIF )
  find_package( GIF )
  if( NOT GIF_FOUND )
    tde_message_fatal( "libgif was requested but not found on your system." )
  endif( )
endif( )


##### checks for iff codec #####

if( BUILD_IFF )
  find_program( IFFTOPPM_COMMAND NAMES ilbmtoppm)
  if( NOT IFFTOPPM_COMMAND )
    tde_message_fatal( "iff codec was requested but ilbmtoppm not found on your system." )
  endif( )
endif( )


##### check for jpeg codec #####

if( BUILD_JPEG OR WITH_JPEG )
  find_package( JPEG )
  if( NOT JPEG_FOUND )
    tde_message_fatal( "libjpeg was requested but not found on your system" )
  endif()
endif()


##### checks for jpeg2000 codec #####

if( BUILD_JPEG2000 )
  find_package( Jasper )
  if( NOT JASPER_FOUND )
    tde_message_fatal( "libjasper was requested but not found on your system." )
  endif( )
  check_include_file( stdint.h HAVE_STDINT_H )
endif( )


##### check for leaf codec #####

if( BUILD_LEAF )
  find_program( LEAFTOPPM_COMMAND NAMES leaftoppm )
  if( NOT LEAFTOPPM_COMMAND )
    tde_message_fatal( "leaf codec was requested but leaftoppm not found on your system." )
  endif( )
endif( )


##### check for mac codec #####

if ( BUILD_MAC )
  find_program( MACPTOPPM_COMMAND NAMES macptopbm )
  if( NOT MACPTOPPM_COMMAND )
    tde_message_fatal( "mac codec was requested but macptopbm not found on your system." )
  endif( )
endif( )


##### checks for mng codec #####

if( BUILD_MNG )
  find_file( HAVE_LIBMNG_H "libmng.h" )
  if( NOT HAVE_LIBMNG_H )
    tde_message_fatal( "libmng was requested but not found on your system." )
  endif( )
  set( MNG_LIBRARY mng )
endif( )


##### check for neotoppm codec #####

if( BUILD_NEO )
  find_program( NEOTOPPM_COMMAND NAMES neotoppm )
  if( NOT NEOTOPPM_COMMAND )
    tde_message_fatal( "neo codec was requested but neotoppm not found on your system." )
  endif( )
endif( )


##### checks for openexr codec #####

if( BUILD_OPENEXR )
  pkg_search_module( OPENEXR OpenEXR )
  if( NOT OPENEXR_FOUND )
    tde_message_fatal( "libopenexr was requested but not found on your system." )
  endif( )
endif( )


##### check for pi1toppm codec #####

if( BUILD_PI1 )
  find_program( PI1TOPPM_COMMAND NAMES pi1toppm )
  if( NOT PI1TOPPM_COMMAND )
    tde_message_fatal( "pi1 codec was requested but pi1toppm not found on your system." )
  endif( )
endif( )


##### check for pi3toppm codec #####

if( BUILD_PI3 )
  find_program( PI3TOPPM_COMMAND NAMES pi3topbm )
  if( NOT PI3TOPPM_COMMAND )
    tde_message_fatal( "pi3 codec was requested but pi3topbm not found on your system." )
  endif( )
endif( )


##### check for picttoppm codec #####

if( BUILD_PICT )
  find_program( PICTTOPPM_COMMAND NAMES picttoppm )
  if( NOT PICTTOPPM_COMMAND )
    tde_message_fatal( "pict codec was requested but picttoppm not found on your system." )
  endif( )
endif( )


##### checks for svg codec #####

if( BUILD_SVG )
  find_program( RSVG_COMMAND NAMES "rsvg-convert" )
  if( NOT RSVG_COMMAND )
    tde_message_fatal( "svg codec was requested but rsvg-convert not found on your system" )
  endif( )
endif( )


##### checks for tiff codec #####

if( BUILD_TIFF )
  find_package( TIFF )
  if( NOT TIFF_FOUND )
    tde_message_fatal( "libtiff was requested but not found on your system" )
  endif( )
endif( )


##### checks for ttf codec #####

if( BUILD_TTF )
  pkg_search_module( FREETYPE freetype2 )
  if( NOT FREETYPE_FOUND )
    tde_message_fatal( "ttf codec was requested but freetype2 not found on your system." )
  endif( )
endif( )


##### check for utah codec #####

if( BUILD_UTAH )
  find_program( UTAHTOPPM_COMMAND NAMES rletopnm)
  if( NOT UTAHTOPPM_COMMAND )
    tde_message_fatal( "utah codec was requested but rletopnm not found on your system." )
  endif( )
endif( )


##### checks for wmf codec #####

if( BUILD_WMF )
  pkg_search_module( WMF libwmf )
  if( NOT WMF_FOUND )
    find_program( WMF_CONFIG_EXECUTABLE NAMES "libwmf-config" )

    if( WMF_CONFIG_EXECUTABLE )
      execute_process(
        COMMAND ${WMF_CONFIG_EXECUTABLE} --libs
        OUTPUT_VARIABLE WMF_LDFLAGS
        ERROR_VARIABLE WMF_LDFLAGS
        OUTPUT_STRIP_TRAILING_WHITESPACE
        ERROR_STRIP_TRAILING_WHITESPACE
      )
      set( WMF_LIBRARIES "" )
      set( WMF_LIBRARY_DIRS "" )
      string( REPLACE " " ";" WMF_LDFLAGS ${WMF_LDFLAGS} )
      foreach( _ldflag IN LISTS WMF_LDFLAGS )
        if( _ldflag MATCHES "^-L" )
          string( REGEX REPLACE "^-L" "" _libdir "${_ldflag}" )
          list( APPEND WMF_LIBRARY_DIRS ${_libdir} )
        endif()
        if( _ldflag MATCHES "^-l" )
          string( REGEX REPLACE "^-l" "" _lib "${_ldflag}" )
          list( APPEND WMF_LIBRARIES ${_lib} )
        endif()
      endforeach()

      execute_process(
        COMMAND ${WMF_CONFIG_EXECUTABLE} --cflags
        OUTPUT_VARIABLE WMF_CFLAGS
        ERROR_VARIABLE WMF_CFLAGS
        OUTPUT_STRIP_TRAILING_WHITESPACE
        ERROR_STRIP_TRAILING_WHITESPACE
      )
      set( WMF_INCLUDE_DIRS "" )
      string( REPLACE " " ";" WMF_CFLAGS ${WMF_CFLAGS} )
      foreach( _cflag IN LISTS WMF_CFLAGS )
        if( _cflag MATCHES "^-I" )
          string( REGEX REPLACE "^-I" "" _incdir "${_cflag}" )
          list( APPEND WMF_INCLUDE_DIRS ${_incdir} )
        endif()
      endforeach()

      set( WMF_FOUND 1 CACHE BOOL "WMF library found" FORCE )
      set( WMF_LIBRARIES "${WMF_LIBRARIES}" CACHE INTERNAL "WMF link libraries" )
      set( WMF_INCLUDE_DIRS "${WMF_INCLUDE_DIRS}" CACHE INTERNAL "WMF include directories" )
    endif( )
  endif( )
  if( NOT WMF_FOUND )
    tde_message_fatal( "libwmf was requested but not found on your system." )
  endif( )
endif( )


##### checks for xcf codec #####

if( BUILD_XCF )
  check_include_file( "inttypes.h" HAVE_INTTYPES_H )
  check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
  check_include_file( "arpa/inet.h" HAVE_ARPA_INET_H )
  check_include_file( "getopt.h" HAVE_GETOPT_H )
  check_function_exists( "getopt_long" HAVE_GETOPT_LONG )
  check_function_exists( "mmap" HAVE_MMAP )
  check_function_exists( "strcasecmp" HAVE_STRCASECMP )

  check_include_file( "iconv.h" HAVE_ICONV_H )
  if( NOT HAVE_ICONV_H )
    tde_message_fatal( "xcf codec was requested but iconv header not found on your system" )
  endif( )

  message( STATUS "Check for standalone libiconv" )
  find_library( HAVE_LIBICONV iconv )
  if( HAVE_LIBICONV )
    set( ICONV_LIBRARIES iconv )
    message( STATUS "Check for standalone libiconv - found" )
  else( )
    set( ICONV_LIBRARIES "" )
   message( STATUS "Check for standalone libiconv - not found" )
  endif( )

  tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARIES}" )
  check_function_exists( "iconv_open" HAVE_ICONV )
  tde_restore( CMAKE_REQUIRED_LIBRARIES )
  if( NOT HAVE_ICONV )
    tde_message_fatal( "xcf codec was requested but iconv library not found on your system" )
  endif()
endif( )


##### check for xim codec #####

if( BUILD_XIM )
  find_program( XIMTOPPM_COMMAND NAMES ximtoppm )
  if( NOT XIMTOPPM_COMMAND )
    tde_message_fatal( "xim codec was requested but ximtoppm not found on your system." )
  endif( )
endif( )


##### checks for xwd codec #####

if( BUILD_XWD )
  find_file( HAVE_XWDFILE_H "XWDFile.h" PATH_SUFFIXES "X11" )
  if( NOT HAVE_XWDFILE_H )
    tde_message_fatal( "xwd codec was requested but X11/XWDFile.h not found on your system" )
  endif( )
endif( )