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
|
###########################################
# #
# (C) 2010 Serghei Amelian #
# serghei (DOT) amelian (AT) gmail.com #
# #
# 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( )
##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY )
find_package( Threads )
##### check for include files
check_include_file( "stdio.h" HAVE_STDIO_H )
check_include_file( "stdlib.h" HAVE_STDLIB_H )
check_include_file( "string.h" HAVE_STRING_H )
check_include_file( "strings.h" HAVE_STRINGS_H )
check_include_file( "ctype.h" HAVE_CTYPE_H )
check_include_file( "malloc.h" HAVE_MALLOC_H )
check_include_file( "memory.h" HAVE_MEMORY_H )
check_include_file( "dlfcn.h" HAVE_DLFCN_H )
check_include_file( "sys/select.h" HAVE_SYS_SELECT_H )
check_include_file( "csl/csl.h" HAVE_LIBCSL )
check_include_file( "libaudioio.h" HAVE_LIBAUDIOIO )
check_include_file( "mas/mas.h" HAVE_LIBMAS )
check_include_file( "pthread.h" HAVE_LIBPTHREAD )
check_include_file( "sys/time.h" HAVE_SYS_TIME_H )
check_include_files( "sys/time.h;time.h" TIME_WITH_SYS_TIME )
check_include_file( "sys/soundcard.h" HAVE_SYS_SOUNDCARD_H )
check_include_files( "sys/soundcard.h;soundcard.h" HAVE_SOUNDCARD_H )
##### check for system library dl
set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
if( NOT HAVE_LIBDL )
unset( DL_LIBRARIES )
check_function_exists( dlopen HAVE_DLOPEN )
if( HAVE_DLOPEN )
set( HAVE_LIBDL 1 )
endif( HAVE_DLOPEN )
endif( NOT HAVE_LIBDL )
##### check for functions #######################
set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
set( CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARIES} )
check_function_exists( dlerror HAVE_DLERROR )
check_function_exists( strcmp HAVE_STRCMP )
check_function_exists( strchr HAVE_STRCHR )
check_function_exists( index HAVE_INDEX )
check_function_exists( strrchr HAVE_STRRCHR )
check_function_exists( rindex HAVE_RINDEX )
check_function_exists( memcpy HAVE_MEMCPY )
check_function_exists( bcopy HAVE_BCOPY )
set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
unset( bak_CMAKE_REQUIRED_LIBRARIES )
check_prototype_definition( ioctl "int ioctl(int d, int request, ...)" "-1" "unistd.h;sys/ioctl.h" HAVE_IOCTL_INT_INT_DOTS )
check_prototype_definition( ioctl "int ioctl(int d, unsigned long request, ...)" "-1" "unistd.h;sys/ioctl.h" HAVE_IOCTL_INT_ULONG_DOTS )
##### check for audiofile
set( HAVE_LIBAUDIOFILE 0 )
if( WITH_AUDIOFILE )
pkg_search_module( AUDIOFILE audiofile )
if( AUDIOFILE_FOUND )
set( HAVE_LIBAUDIOFILE 1 )
else()
tde_message_fatal( "audiofile (wav) support has been requested, but was not found" )
endif()
endif( WITH_AUDIOFILE )
##### check for alsa
set( HAVE_LIBASOUND2 0 )
if( WITH_ALSA )
pkg_search_module( ALSA alsa )
if( ALSA_FOUND ) # there is support only for ALSA 1.x
set( HAVE_LIBASOUND2 1 )
set( ALSA_PCM_OLD_SW_PARAMS_API 1 ) # where is It neded?
set( ALSA_PCM_OLD_HW_PARAMS_API 1 ) # where is It neded?
check_include_file( "alsa/asoundlib.h" HAVE_ALSA_ASOUNDLIB_H )
if( NOT HAVE_ALSA_ASOUNDLIB_H )
check_include_file( "sys/asoundlib.h" HAVE_SYS_ASOUNDLIB_H )
endif()
set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
set( CMAKE_REQUIRED_LIBRARIES ${ALSA_LIBRARIES} )
check_function_exists( snd_pcm_resume HAVE_SND_PCM_RESUME )
set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
unset( bak_CMAKE_REQUIRED_LIBRARIES )
else()
tde_message_fatal( "ALSA support has been requested, but was not found" )
endif()
endif( WITH_ALSA )
##### check for esound
set( HAVE_LIBESD 0 )
if( WITH_ESOUND )
pkg_search_module( ESOUND esound )
if( ESOUND_FOUND )
set( HAVE_LIBESD 1 )
else()
tde_message_fatal( "ESOUND support has been requested, but was not found" )
endif()
endif( WITH_ESOUND )
##### check for JACK
set( HAVE_LIBJACK 0 )
if( WITH_JACK )
pkg_search_module( LIBJACK jack )
if( LIBJACK_FOUND )
set( HAVE_LIBJACK 1 )
else()
tde_message_fatal( "JACK support has been requested, but was not found" )
endif( LIBJACK_FOUND )
endif( WITH_JACK )
##### check for Network Audio System
if( WITH_NAS )
find_path( NAS_HEADER "audio/audiolib.h" )
find_library( NAS_LIBRARY audio )
if( NAS_HEADER AND NAS_LIBRARY )
set( HAVE_LIBAUDIONAS 1 )
set( NAS_INCLUDE_DIR "${NAS_HEADER}" )
set( NAS_LIBRARIES ${NAS_LIBRARY} )
message( STATUS "Looking for Nas - found" )
else()
tde_message_fatal( "Nas support has been requested, but was not found" )
endif()
endif( WITH_NAS )
##### check for Open Sound System
if( WITH_OSS OR WITH_TOSS )
find_path( OSS_HEADER "sys/soundcard.h"
NO_DEFAULT_PATH
HINTS /usr/lib/oss/include
/usr/lib64/oss/include
)
find_library( OSS_LIBRARY OSSlib
NO_DEFAULT_PATH
HINTS /usr/lib/oss/lib
/usr/lib64/oss/lib
)
if( OSS_HEADER AND OSS_LIBRARY )
set( OSS_INCLUDE_DIR "${OSS_HEADER}" )
set( OSS_LIBRARIES "${OSS_LIBRARY}" )
else()
tde_message_fatal( "OSS support has been requested, but was not found" )
endif()
endif( WITH_OSS OR WITH_TOSS )
##### check for SNDIO ###########################
set( HAVE_LIBSNDIO 0 )
if( WITH_SNDIO )
check_include_file( "sndio.h" HAVE_SNDIO_H )
if( HAVE_SNDIO_H )
set( HAVE_LIBSNDIO 1 )
set( LIBSNDIO_LIBRARIES "sndio" )
else( HAVE_SNDIO_H )
tde_message_fatal( "SNDIO support is requested, but `sndio.h` was not found" )
endif( HAVE_SNDIO_H )
endif( WITH_SNDIO )
##### check for glib/gthread
pkg_search_module( GLIB2 glib-2.0 )
if( GLIB2_FOUND )
pkg_search_module( GTHREAD2 gthread-2.0 )
if( NOT GTHREAD2_FOUND )
tde_message_fatal( "gthread-2.0 is required, but was not found on your system" )
endif()
else()
tde_message_fatal( "glib-2.0 is required, but was not found on your system" )
endif( GLIB2_FOUND )
##### check for ogg/vorbis
set( GSL_HAVE_OGGVORBIS 0 )
if( WITH_VORBIS )
pkg_search_module( VORBIS vorbis )
if( VORBIS_FOUND )
pkg_search_module( LIBOGG ogg )
if( NOT LIBOGG_FOUND )
tde_message_fatal( "Ogg/Vorbis support has been requested, but Ogg was not found" )
endif()
pkg_search_module( LIBVORBISENC vorbisenc )
pkg_search_module( VORBISFILE vorbisfile )
if( VORBISFILE_FOUND )
set( GSL_HAVE_OGGVORBIS 1 )
set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
set( CMAKE_REQUIRED_LIBRARIES ${VORBISFILE_LIBRARIES} )
check_c_source_compiles("
#include <vorbis/vorbisfile.h>
int main()
{
ov_read_float(0,0,0);
return 0;
}" GSL_HAVE_OGGVORBIS_RC3
)
if( NOT GSL_HAVE_OGGVORBIS_RC3 )
set( GSL_HAVE_OGGVORBIS_RC3 0 )
endif()
set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
else()
tde_message_fatal( "Ogg/Vorbis support has been requested, but `libvorbisfile` was not found" )
endif()
else()
tde_message_fatal( "Ogg/Vorbis support has been requested, but `libvorbis` was not found" )
endif()
endif( WITH_VORBIS )
##### check for libmad
set( GSL_HAVE_LIBMAD 0 )
if( WITH_MAD )
pkg_search_module( MAD mad )
if( MAD_FOUND )
set( GSL_HAVE_LIBMAD 1 )
else()
find_library( MAD_LIBRARIES NAMES mad )
find_path( MAD_INCLUDE_DIRS mad.h )
if( NOT MAD_LIBRARIES )
tde_message_fatal( "Mad support has been requested, but `libmad` was not found" )
endif()
endif()
endif( WITH_MAD )
##### check for some type sizes #################
include( CheckTypeSize )
check_type_size( pthread_mutex_t GSL_SIZEOF_PTH_MUTEX_T )
check_type_size( pthread_cond_t GSL_SIZEOF_PTH_COND_T )
check_type_size( intmax_t GSL_SIZEOF_STD_INTMAX_T )
set( bak_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} )
check_c_source_compiles(
"#define _XOPEN_SOURCE 500
#include <pthread.h>
int main()
{
int (*attr_settype) (pthread_mutexattr_t *__attr, int __kind) = pthread_mutexattr_settype;
int val = PTHREAD_MUTEX_RECURSIVE; attr_settype = 0; val = 0;
return 0;
}"
GSL_HAVE_MUTEXATTR_SETTYPE )
if( NOT GSL_HAVE_MUTEXATTR_SETTYPE )
set( GSL_HAVE_MUTEXATTR_SETTYPE 0 )
endif( NOT GSL_HAVE_MUTEXATTR_SETTYPE )
set( CMAKE_REQUIRED_LIBRARIES ${bak_CMAKE_REQUIRED_LIBRARIES} )
set( GSL_USE_GSL_GLIB 1 )
set( GSL_USE_ARTS_THREADS 1 )
##### check for sse on x86 cpus
if( ${CMAKE_ARCHITECTURE} MATCHES "i.86" )
check_c_source_compiles("
int main()
{
__asm__(\"movups %xmm0, (%esp)\");
return 0;
}" HAVE_X86_SSE
)
endif( ${CMAKE_ARCHITECTURE} MATCHES "i.86" )
|