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
|
#################################################
#
# (C) 2015 Slávek Banko
# slavek (DOT) banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# required stuff
tde_setup_architecture_flags( )
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
tde_setup_largefiles( )
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( )
##### check for system libraries ################
if( WITH_LIBLTDL )
# check libltdl
check_include_file( "ltdl.h" HAVE_LTDL_H )
if( HAVE_LTDL_H )
set( AKODE_LIBDL ltdl )
check_library_exists( ${AKODE_LIBDL} lt_dlopen "" HAVE_LIBLTDL )
endif( HAVE_LTDL_H)
if( NOT HAVE_LIBLTDL )
tde_message_fatal( "libltdl are required, but not found on your system" )
endif( NOT HAVE_LIBLTDL )
else( WITH_LIBLTDL )
# check libdl
set( AKODE_LIBDL dl )
check_library_exists( ${AKODE_LIBDL} dlopen /lib HAVE_LIBDL )
if( NOT HAVE_LIBDL )
unset( AKODE_LIBDL )
check_function_exists( dlopen HAVE_DLOPEN )
if( NOT HAVE_DLOPEN )
tde_message_fatal( "libdl are required, but not found on your system" )
endif( NOT HAVE_DLOPEN )
endif( NOT HAVE_LIBDL )
endif( WITH_LIBLTDL )
find_package( Threads )
check_include_file( "semaphore.h" HAVE_SEM )
check_library_exists( rt sem_init "" HAVE_LIBRT )
if( HAVE_LIBRT )
set( SEM_LIBRARIES rt )
endif( HAVE_LIBRT )
check_library_exists( c posix_madvise "" HAVE_POSIX_MADVISE )
check_library_exists( c posix_fadvise "" HAVE_POSIX_FADVISE )
check_library_exists( c madvise "" HAVE_MADVISE )
check_library_exists( c fadvise "" HAVE_FADVISE )
check_cxx_source_compiles( "
#include <sys/types.h>
#include <sys/mman.h>
int main() { ::madvise((char*)0,0, MADV_SEQUENTIAL); return 0; }"
HAVE_MADVISE_PROTOTYPE )
if( NOT HAVE_MADVISE_PROTOTYPE )
set( NEED_MADVISE_PROTOTYPE 1 )
endif( NOT HAVE_MADVISE_PROTOTYPE )
check_include_file( "getopt.h" HAVE_GETOPT_H )
check_library_exists( c getopt_long "" HAVE_GNU_GETOPT )
check_include_file( "stdint.h" HAVE_STDINT_H )
if( NOT HAVE_STDINT_H )
check_include_file( "inttypes.h" HAVE_INTTYPES_H )
endif( NOT HAVE_STDINT_H )
check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
##### check alsa support ########################
if( WITH_ALSA_SINK )
pkg_search_module( ALSA alsa>=0.90 )
if( NOT ALSA_FOUND )
tde_message_fatal( "alsa >= 0.90 are required, but not found on your system" )
endif( NOT ALSA_FOUND )
endif( WITH_ALSA_SINK )
##### check jack support ########################
if( WITH_JACK_SINK )
pkg_search_module( JACK jack>=0.90 )
if( NOT JACK_FOUND )
tde_message_fatal( "jack >= 0.90 are required, but not found on your system" )
endif( NOT JACK_FOUND )
endif( WITH_JACK_SINK )
##### check oss support #########################
if( WITH_OSS_SINK )
check_include_file( "soundcard.h" HAVE_SOUNDCARD_H )
if( NOT HAVE_SOUNDCARD_H )
check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
if( NOT HAVE_SYS_SOUNDCARD_H )
tde_message_fatal( "soundcard.h are required, but not found on your system" )
endif( NOT HAVE_SYS_SOUNDCARD_H )
endif( NOT HAVE_SOUNDCARD_H )
check_library_exists( ossaudio _oss_ioctl "" HAVE_OSSAUDIO )
if( HAVE_OSSAUDIO )
set( OSSAUDIO_LIBRARIES "-lossaudio" )
endif( HAVE_OSSAUDIO )
endif( WITH_OSS_SINK )
##### check pulse support #######################
if( WITH_PULSE_SINK )
pkg_search_module( PULSE libpulse-simple>=0.9.2 )
if( NOT PULSE_FOUND )
tde_message_fatal( "libpulse-simple >= 0.9.2 are required, but not found on your system" )
endif( NOT PULSE_FOUND )
endif( WITH_PULSE_SINK )
##### check sun support #########################
if( WITH_SUN_SINK )
check_include_file( "sys/audioio.h" HAVE_AUDIOIO_H )
if( NOT HAVE_AUDIOIO_H )
tde_message_fatal( "sun audioio are required, but not found on your system" )
endif( NOT HAVE_AUDIOIO_H )
endif( WITH_SUN_SINK )
##### check ffmpeg support ######################
if( WITH_FFMPEG_DECODER )
pkg_search_module( AVFORMAT libavformat>=50 )
if( NOT AVFORMAT_FOUND )
tde_message_fatal( "libavformat >= 50 are required, but not found on your system" )
endif( NOT AVFORMAT_FOUND )
pkg_search_module( AVCODEC libavcodec>=50 )
if( NOT AVCODEC_FOUND )
tde_message_fatal( "libavcodec >= 50 are required, but not found on your system" )
endif( NOT AVCODEC_FOUND )
pkg_search_module( AVUTIL libavutil>=50 )
if( NOT AVUTIL_FOUND )
tde_message_fatal( "libavutil >= 50 are required, but not found on your system" )
endif( NOT AVUTIL_FOUND )
message( STATUS "Looking for ffmpeg frame.h" )
find_file( AVFRAME_H NAMES frame.h avcodec.h
PATHS ${AVUTIL_INCLUDE_DIRS} ${AVCODEC_INCLUDE_DIRS}
PATH_SUFFIXES libavutil libavcodec
)
if( NOT AVFRAME_H )
tde_message_fatal( "FFMPEG header frame.h cannot be found!" )
endif()
message( STATUS "Looking for ffmpeg frame.h - found ${AVFRAME_H}" )
check_struct_has_member( AVFrame pkt_size ${AVFRAME_H} FFMPEG_AVFRAME_HAVE_PKT_SIZE )
check_struct_has_member( AVFrame channels ${AVFRAME_H} FFMPEG_AVFRAME_HAVE_CHANNELS )
set( HAVE_FFMPEG 1 )
endif( WITH_FFMPEG_DECODER )
##### check mad support #########################
if( WITH_MPEG_DECODER )
pkg_search_module( MAD mad )
if( NOT MAD_FOUND )
find_library( MAD_LIBRARIES NAMES mad )
find_path( MAD_INCLUDE_DIRS mad.h )
if( NOT MAD_LIBRARIES )
tde_message_fatal( "mad are required, but not found on your system" )
endif( NOT MAD_LIBRARIES )
endif( NOT MAD_FOUND )
endif( WITH_MPEG_DECODER )
##### check FLAC support ########################
if( WITH_XIPH_DECODER )
# check for FLAC module
pkg_search_module( FLAC flac>=1.1.3 )
if( FLAC_FOUND )
set( HAVE_LIBFLAC113 1 )
else( FLAC_FOUND )
# check for FLAC 1.1.3
check_include_file( "FLAC/metadata.h" HAVE_FLAC113_H )
if( HAVE_FLAC113_H )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES ogg )
check_library_exists( FLAC FLAC__stream_decoder_seek_absolute "" HAVE_LIBFLAC113 )
tde_restore( CMAKE_REQUIRED_LIBRARIES )
if( HAVE_LIBFLAC113 )
set( FLAC_LIBRARIES "-lFLAC -logg" )
endif( HAVE_LIBFLAC113 )
endif( HAVE_FLAC113_H )
# check for FLAC 1.1.1 or 1.1.2
if( NOT HAVE_LIBFLAC113 )
check_include_file( "FLAC/seekable_stream_decoder.h" HAVE_FLAC_H )
if( HAVE_FLAC_H )
check_library_exists( FLAC FLAC__seekable_stream_decoder_process_single "" HAVE_LIBFLAC )
if( HAVE_LIBFLAC )
set( FLAC_LIBRARIES "-lFLAC" )
endif( HAVE_LIBFLAC )
endif( HAVE_FLAC_H )
check_include_file( "OggFLAC/seekable_stream_decoder.h" HAVE_OGGFLAC_H )
if( HAVE_OGGFLAC_H )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES m OggFLAC FLAC )
check_library_exists( OggFLAC OggFLAC__seekable_stream_decoder_process_single "" HAVE_LIBOGGFLAC )
tde_restore( CMAKE_REQUIRED_LIBRARIES )
if( HAVE_LIBOGGFLAC )
set( OGGFLAC_LIBRARIES "-lOggFLAC" )
endif( HAVE_LIBOGGFLAC )
endif( HAVE_OGGFLAC_H )
endif( NOT HAVE_LIBFLAC113 )
endif( FLAC_FOUND )
if( NOT FLAC_LIBRARIES )
tde_message_fatal( "FLAC >= 1.1.1 are required, but not found on your system" )
endif( NOT FLAC_LIBRARIES )
endif( WITH_XIPH_DECODER )
##### check speex support #######################
if( WITH_XIPH_DECODER )
# check for speex module
pkg_search_module( SPEEX speex>=1.2 )
if( NOT SPEEX_FOUND )
# check for speex >= 1.1
pkg_search_module( SPEEX speex>=1.1 )
if( SPEEX_FOUND )
set( HAVE_SPEEX11 1 )
check_library_exists( speex speex_decode_int "" HAVE_SPEEX_DECODE_INT )
if( NOT HAVE_SPEEX_DECODE_INT )
set( BROKEN_SPEEX11 1 )
endif( )
else( )
pkg_search_module( SPEEX speex )
endif( )
endif( )
if( SPEEX_FOUND )
set( HAVE_SPEEX 1 )
if( NOT EXISTS ${SPEEX_INCLUDEDIR}/speex.h )
find_path( SPEEX_EXTRA_INCLUDEDIR "speex.h" ${SPEEX_INCLUDEDIR}/speex )
if( NOT SPEEX_EXTRA_INCLUDEDIR )
tde_message_fatal( "speex are required, but header not found on your system" )
endif( NOT SPEEX_EXTRA_INCLUDEDIR )
list( APPEND SPEEX_INCLUDE_DIRS "${SPEEX_EXTRA_INCLUDEDIR}" )
endif( NOT EXISTS ${SPEEX_INCLUDEDIR}/speex.h )
else( SPEEX_FOUND )
tde_message_fatal( "speex are required, but not found on your system" )
endif( SPEEX_FOUND )
endif( WITH_XIPH_DECODER )
##### check ogg/vorbis support ##################
if( WITH_XIPH_DECODER )
pkg_search_module( OGG ogg )
if( NOT OGG_FOUND )
tde_message_fatal( "ogg are required, but not found on your system" )
endif( NOT OGG_FOUND )
pkg_search_module( VORBIS vorbis )
if( NOT VORBIS_FOUND )
tde_message_fatal( "ogg/vorbis are required, but not found on your system" )
endif( NOT VORBIS_FOUND )
pkg_search_module( VORBISFILE vorbisfile )
if( NOT VORBISFILE_FOUND )
tde_message_fatal( "ogg/vorbisfile are required, but not found on your system" )
endif( NOT VORBISFILE_FOUND )
set( HAVE_OGG_VORBIS 1 )
endif( WITH_XIPH_DECODER )
##### check samplerate support ##################
if( WITH_SRC_RESAMPLER )
pkg_search_module( SAMPLERATE samplerate )
if( NOT SAMPLERATE_FOUND )
find_library( SAMPLERATE_LIBRARIES NAMES samplerate )
find_path( SAMPLERATE_INCLUDE_DIRS samplerate.h )
if( NOT SAMPLERATE_LIBRARIES )
tde_message_fatal( "samplerate are required, but not found on your system" )
endif( NOT SAMPLERATE_LIBRARIES )
endif( NOT SAMPLERATE_FOUND )
endif( WITH_SRC_RESAMPLER )
|