]> git.sesse.net Git - vlc/blob - extras/buildsystem/cmake/include/config.cmake
cmake/config.cmake: Look for postproc/postprocess.h or libpostproc/postprocess.h.
[vlc] / extras / buildsystem / cmake / include / config.cmake
1 ###########################################################
2 # System Includes
3 ###########################################################
4 include( CheckIncludeFile )
5 include (CheckTypeSize)
6 include (CheckCSourceCompiles)
7 include (CheckSymbolExists)
8 include (CheckLibraryExists)
9
10 ###########################################################
11 # Options
12 ###########################################################
13 # Options moved before the custom macro includes because those macros need path values, if the ENABLE_CONTRIB
14 # has been set.
15
16 OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
17 OPTION( ENABLE_STREAM_OUT      "Enable stream output plugins" ON )
18 OPTION( ENABLE_VLM             "Enable vlm" ON )
19 OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
20 OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
21 OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" OFF )
22 OPTION( ENABLE_CONTRIB         "Attempt to use VLC contrib system to get the third-party libraries" ON )
23
24 if(ENABLE_CONTRIB)
25
26   set( CONTRIB_INCLUDE ${CMAKE_SOURCE_DIR}/extras/contrib/include)
27   set( CONTRIB_LIB ${CMAKE_SOURCE_DIR}/extras/contrib/lib)
28   set( CONTRIB_PROGRAM ${CMAKE_SOURCE_DIR}/extras/contrib/bin)
29   set( CMAKE_LIBRARY_PATH ${CONTRIB_LIB} ${CMAKE_LIBRARY_PATH} )
30   set( CMAKE_PROGRAM_PATH ${CONTRIB_PROGRAM} ${CMAKE_PROGRAM_PATH} )
31   set( CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${CONTRIB_LIB}" )
32   set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
33   set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
34   set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
35   set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
36   set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
37
38   # include extras/contrib/include in the header search pathes
39   include_directories(${CONTRIB_INCLUDE})
40   set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CONTRIB_INCLUDE} )
41   
42   # include the extras/contrib/bin to the search path, otherwise, when finding programs it will automatically
43   # default to system applications (e.g. we should favor the extras/contrib/bin/pkg-config over the system defined
44   # one).
45   if(WIN32)
46     set( ENV{PATH} "${CONTRIB_PROGRAM};$ENV{PATH}" )
47   else(WIN32)
48     set( ENV{PATH} "${CONTRIB_PROGRAM}:$ENV{PATH}" )
49   endif(WIN32)
50 endif(ENABLE_CONTRIB)
51
52 ###########################################################
53 # Custom Macro Includes
54 ###########################################################
55
56 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_include_files.cmake )
57 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_functions_exist.cmake )
58 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_add_compile_flag.cmake )
59 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_type.cmake )
60 include( ${CMAKE_SOURCE_DIR}/cmake/pkg_check_modules.cmake )
61
62 ###########################################################
63 # Versioning
64 ###########################################################
65
66 set(VLC_VERSION_MAJOR 0)
67 set(VLC_VERSION_MINOR 9)
68 set(VLC_VERSION_PATCH 0)
69 set(VLC_VERSION_EXTRA "-svn")
70 set(VLC_VERSION ${VLC_VERSION_MAJOR}.${VLC_VERSION_MINOR}.${VLC_VERSION_PATCH}${VLC_VERSION_EXTRA})
71
72 set(PACKAGE "vlc")
73 set(PACKAGE_VERSION "${VLC_VERSION}")
74 set(PACKAGE_STRING "vlc")
75 set(VERSION_MESSAGE "vlc-${VLC_VERSION}")
76 set(COPYRIGHT_MESSAGE "Copyright © the VideoLAN team")
77 set(COPYRIGHT_YEARS "2001-2008")
78 set(PACKAGE_VERSION_EXTRA "${VLC_VERSION_EXTRA}")
79 set(PACKAGE_VERSION_MAJOR "${VLC_VERSION_MAJOR}")
80 set(PACKAGE_VERSION_MINOR "${VLC_VERSION_MINOR}")
81 set(PACKAGE_VERSION_REVISION "${VLC_VERSION_PATCH}")
82
83 ###########################################################
84 # Preflight Checks
85 ###########################################################
86
87 IF (NOT CMAKE_BUILD_TYPE)
88     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING  "build type determining compiler flags" FORCE )
89 endif(NOT CMAKE_BUILD_TYPE )
90
91 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
92     set(DEBUG ON)
93     add_definitions(-DDEBUG=1)
94     set(NDEBUG OFF)
95 endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
96
97 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
98 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
99
100 ###########################################################
101 # Headers checks
102 ###########################################################
103
104 vlc_check_include_files (malloc.h stdbool.h locale.h)
105 vlc_check_include_files (stddef.h stdlib.h sys/stat.h)
106 vlc_check_include_files (stdio.h stdint.h inttypes.h)
107 vlc_check_include_files (signal.h unistd.h dirent.h)
108 vlc_check_include_files (netinet/in.h netinet/udplite.h)
109 vlc_check_include_files (arpa/inet.h net/if.h)
110 vlc_check_include_files (netdb.h fcntl.h sys/time.h poll.h)
111 vlc_check_include_files (errno.h time.h alloca.h)
112 vlc_check_include_files (limits.h)
113
114 vlc_check_include_files (string.h strings.h getopt.h)
115
116 vlc_check_include_files (dlfcn.h dl.h)
117
118 vlc_check_include_files (kernel/OS.h)
119 vlc_check_include_files (memory.h)
120 vlc_check_include_files (mach-o/dyld.h)
121
122 vlc_check_include_files (pthread.h)
123
124 find_package (Threads)
125
126 ###########################################################
127 # Functions/structures checks
128 ###########################################################
129
130 set(CMAKE_REQUIRED_LIBRARIES c)
131 set(CMAKE_EXTRA_INCLUDE_FILES string.h)
132 vlc_check_functions_exist(strcpy strcasecmp)
133 vlc_check_functions_exist(strcasestr strdup)
134 vlc_check_functions_exist(strndup stricmp strnicmp)
135 vlc_check_functions_exist(atof strtoll atoll lldiv)
136 vlc_check_functions_exist(strlcpy stristr strnlen strsep)
137 vlc_check_functions_exist(strtod strtof strtol stroul)
138 vlc_check_functions_exist(stroull)
139 set(CMAKE_EXTRA_INCLUDE_FILES)
140
141 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
142 vlc_check_functions_exist(vasprintf)
143 set(CMAKE_EXTRA_INCLUDE_FILES)
144
145 set(CMAKE_EXTRA_INCLUDE_FILES libc.h)
146 vlc_check_functions_exist(fork)
147 set(CMAKE_EXTRA_INCLUDE_FILES)
148
149 set(CMAKE_EXTRA_INCLUDE_FILES stdlib.h)
150 vlc_check_functions_exist(putenv getenv setenv)
151 vlc_check_functions_exist(putenv getenv setenv)
152 set(CMAKE_EXTRA_INCLUDE_FILES)
153
154 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
155 vlc_check_functions_exist(snprintf asprintf)
156 vlc_check_functions_exist(putenv getenv setenv)
157 set(CMAKE_EXTRA_INCLUDE_FILES)
158
159 set(CMAKE_EXTRA_INCLUDE_FILES unistd.h)
160 vlc_check_functions_exist(isatty getcwd getuid swab)
161 set(CMAKE_EXTRA_INCLUDE_FILES)
162
163 set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
164 vlc_check_functions_exist(lstat fstat stat)
165 set(CMAKE_EXTRA_INCLUDE_FILES)
166
167 set(CMAKE_EXTRA_INCLUDE_FILES arpa/inet.h)
168 vlc_check_functions_exist(inet_aton inet_ntop inet_pton)
169 set(CMAKE_EXTRA_INCLUDE_FILES)
170
171 set(CMAKE_EXTRA_INCLUDE_FILES sys/mman.h)
172 vlc_check_functions_exist(mmap)
173 set(CMAKE_EXTRA_INCLUDE_FILES)
174
175 set(CMAKE_REQUIRED_LIBRARIES)
176
177 check_library_exists(poll poll "" HAVE_POLL)
178
179 check_c_source_compiles(
180 "#include <langinfo.h>
181 int main() { char* cs = nl_langinfo(CODESET); }"
182 HAVE_LANGINFO_CODESET)
183
184 vlc_check_type("struct addrinfo" "sys/socket.h;netdb.h")
185 if(HAVE_STRUCT_ADDRINFO)
186   set(HAVE_ADDRINFO ON)
187 endif(HAVE_STRUCT_ADDRINFO)
188 vlc_check_type("struct timespec" "time.h")
189
190 check_c_source_compiles (
191 "#include <stdint.h> \n #ifdef UINTMAX \n #error no uintmax
192  #endif
193  int main() { return 0;}" HAVE_STDINT_H_WITH_UINTMAX)
194
195 check_symbol_exists(ntohl "sys/param.h"  NTOHL_IN_SYS_PARAM_H)
196 check_symbol_exists(scandir "dirent.h"   HAVE_SCANDIR)
197 check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)
198 check_symbol_exists(alloca "alloca.h"    HAVE_ALLOCA)
199
200 check_symbol_exists(va_copy "stdarg.h"   HAVE_VACOPY)
201 check_symbol_exists(__va_copy "stdarg.h" HAVE___VA_COPY)
202
203
204 check_symbol_exists(getnameinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETNAMEINFO)
205 check_symbol_exists(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
206 if(NOT HAVE_GETADDRINFO)
207     check_library_exists(getaddrinfo nsl "" HAVE_GETADDRINFO)
208 endif(NOT HAVE_GETADDRINFO)
209
210 vlc_check_functions_exist(iconv)
211 if(NOT HAVE_ICONV)
212     set(LIBICONV "iconv")
213     check_library_exists(iconv iconv "" HAVE_ICONV)
214 endif(NOT HAVE_ICONV)
215 set(CMAKE_REQUIRED_LIBRARIES ${LIBICONV})
216 CHECK_C_SOURCE_COMPILES(" #include <iconv.h>
217  int main() { return iconv(0, (char **)0, 0, (char**)0, 0); }" ICONV_NO_CONST)
218 if( ICONV_NO_CONST )
219   set( ICONV_CONST "const" )
220 else( ICONV_NO_CONST )
221   set( ICONV_CONST " ")
222 endif( ICONV_NO_CONST )
223 set(CMAKE_REQUIRED_LIBRARIES)
224
225 check_library_exists(rt clock_nanosleep "" HAVE_CLOCK_NANOSLEEP)
226 if (HAVE_CLOCK_NANOSLEEP)
227     set(LIBRT "rt")
228 endif (HAVE_CLOCK_NANOSLEEP)
229
230 check_library_exists(m pow "" HAVE_LIBM)
231 if (HAVE_LIBM)
232     set (LIBM "m")
233 endif (HAVE_LIBM)
234
235 check_symbol_exists(connect "sys/types.h;sys/socket.h" HAVE_CONNECT)
236 if(NOT HAVE_CONNECT)
237     check_library_exists(connect socket "" HAVE_CONNECT)
238     if(NOT HAVE_CONNECT)
239         vlc_module_add_link_libraries(libvlc connect)
240         vlc_module_add_link_libraries(cdda   connect)
241         vlc_module_add_link_libraries(cddax  connect)
242     endif(NOT HAVE_CONNECT)
243 endif(NOT HAVE_CONNECT)
244
245 ###########################################################
246 # Other check
247 ###########################################################
248
249 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_test_inline.cmake )
250
251 ###########################################################
252 # Platform check
253 ###########################################################
254
255 if(APPLE)
256     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
257
258     # Mac OS X (10.4 and 10.5)  can't poll a tty properly
259     # So we deactivate its uses
260     set(HAVE_POLL OFF)
261
262     if(ENABLE_NO_SYMBOL_CHECK)
263         set(DYNAMIC_LOOKUP "-undefined dynamic_lookup")
264     else(ENABLE_NO_SYMBOL_CHECK)
265         set(DYNAMIC_LOOKUP)
266     endif(ENABLE_NO_SYMBOL_CHECK)
267     set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
268      "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} ${DYNAMIC_LOOKUP}")
269     set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
270      "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} ${DYNAMIC_LOOKUP}")
271
272     # For pre-10.5
273     set( CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
274
275     set(SYS_DARWIN 1)
276     add_definitions(-std=gnu99) # Hack for obj-c files to be compiled with gnu99
277     vlc_enable_modules(macosx minimal_macosx opengllayer
278                        access_eyetv quartztext auhal)
279
280     # On Pre-10.5
281     vlc_module_add_link_flags (ffmpeg "-read_only_relocs warning")
282
283    # vlc_check_include_files (ApplicationServices/ApplicationServices.h)
284    # vlc_check_include_files (Carbon/Carbon.h)
285    # vlc_check_include_files (CoreAudio/CoreAudio.h)
286
287    # check_symbol_exists (CFLocaleCopyCurrent "CoreFoundation/CoreFoundation.h" "" HAVE_CFLOCALECOPYCURRENT)
288    # check_symbol_exists (CFPreferencesCopyAppValue "CoreFoundation/CoreFoundation.h" "" HAVE_CFPREFERENCESCOPYAPPVALUE)
289
290     vlc_find_frameworks(Cocoa Carbon OpenGL AGL IOKit Quicktime
291                         WebKit QuartzCore Foundation ApplicationServices
292                         CoreAudio AudioUnit AudioToolbox)
293     vlc_module_add_link_libraries(macosx
294         ${Cocoa_FRAMEWORKS}
295         ${IOKit_FRAMEWORKS}
296         ${OpenGL_FRAMEWORKS}
297         ${AGL_FRAMEWORKS}
298         ${Quicktime_FRAMEWORKS}
299         ${WebKit_FRAMEWORKS})
300     vlc_module_add_link_libraries(minimal_macosx
301         ${Cocoa_FRAMEWORKS}
302         ${Carbon_FRAMEWORKS}
303         ${OpenGL_FRAMEWORKS}
304         ${AGL_FRAMEWORKS})
305     vlc_module_add_link_libraries(access_eyetv
306         ${Foundation_FRAMEWORKS})
307     vlc_module_add_link_libraries(opengllayer
308          ${Cocoa_FRAMEWORKS}
309          ${QuartzCore_FRAMEWORKS}
310          ${OpenGL_FRAMEWORKS} )
311     vlc_module_add_link_libraries(quartztext
312          ${Carbon_FRAMEWORKS}
313          ${ApplicationServices_FRAMEWORKS} )
314     vlc_module_add_link_libraries(auhal
315          ${Carbon_FRAMEWORKS}
316          ${CoreAudio_FRAMEWORKS}
317          ${AudioUnit_FRAMEWORKS}
318          ${AudioToolbox_FRAMEWORKS} )
319     vlc_module_add_link_libraries(mp4 ${IOKit_FRAMEWORKS} )
320     vlc_module_add_link_libraries(mkv ${IOKit_FRAMEWORKS} )
321
322     add_executable(VLC MACOSX_BUNDLE src/vlc.c)
323     target_link_libraries(VLC libvlc)
324     set( MacOS ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS )
325     add_custom_command(
326         TARGET VLC
327         POST_BUILD
328         COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
329         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/modules/gui/macosx
330         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx
331         COMMAND for i in vlc.xcodeproj Resources README.MacOSX.rtf\; do cp -R ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx\; done
332         COMMAND for i in AUTHORS COPYING THANKS\;do cp ${CMAKE_CURRENT_SOURCE_DIR}/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp\; done
333         COMMAND for i in AppleRemote.h AppleRemote.m about.h about.m applescript.h applescript.m controls.h controls.m equalizer.h equalizer.m intf.h intf.m macosx.m misc.h misc.m open.h open.m output.h output.m playlist.h playlist.m playlistinfo.h playlistinfo.m prefs_widgets.h prefs_widgets.m prefs.h prefs.m vout.h voutqt.m voutgl.m wizard.h wizard.m extended.h extended.m bookmarks.h bookmarks.m sfilters.h sfilters.m update.h update.m interaction.h interaction.m embeddedwindow.h embeddedwindow.m fspanel.h fspanel.m vout.m\; do cp ${CMAKE_CURRENT_SOURCE_DIR}/modules/gui/macosx/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp/modules/gui/macosx\; done
334         COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx && xcodebuild -target vlc | grep -vE '^\([ \\t]|$$\)' && cd ../../../../ && cp ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents && cp -R ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Resources/English.lproj ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources
335         COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/Resources ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents
336         COMMAND find -d ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources -type d -name \\.svn -exec rm -rf {} "\;"
337         COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale ${MacOS}/share
338         COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${MacOS}/share
339         COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/modules ${MacOS}/modules
340         COMMAND find ${CMAKE_BINARY_DIR}/po -name *.gmo -exec sh -c \"mkdir -p ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES\; ln -s {} ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES/vlc.mo\" "\;"
341         COMMAND ln -sf VLC ${MacOS}/clivlc #useless?
342         COMMAND printf "APPLVLC#" > ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/PkgInfo
343         COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
344     )
345     set( MacOS )
346
347 endif(APPLE)
348
349 ###########################################################
350 # info
351 ###########################################################
352
353 macro(command_to_configvar command var)
354  execute_process(
355   COMMAND sh -c "${command}"
356   OUTPUT_VARIABLE ${var}
357   OUTPUT_STRIP_TRAILING_WHITESPACE)
358  string( REPLACE "\n" "\\n" ${var} "${${var}}")
359 endmacro(command_to_configvar)
360
361 command_to_configvar( "whoami" VLC_COMPILE_BY )
362 command_to_configvar( "hostname" VLC_COMPILE_HOST )
363 command_to_configvar( "hostname" VLC_COMPILE_DOMAIN )
364 command_to_configvar( "${CMAKE_C_COMPILER} --version" VLC_COMPILER )
365 # FIXME: WTF? this is not the configure line!
366 command_to_configvar( "${CMAKE_C_COMPILER} --version" CONFIGURE_LINE )
367 set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
368
369 ###########################################################
370 # Modules: Following are all listed in options
371 ###########################################################
372
373 # This module will be enabled but user could disabled it
374 vlc_enable_modules(dummy logger memcpy)
375 vlc_enable_modules(mpgv mpga m4v m4a h264 vc1 demux_cdg cdg ps pva avi mp4 rawdv rawvid nsv real aiff mjpeg demuxdump flacsys tta)
376 vlc_enable_modules(cvdsub svcdsub spudec subsdec subsusf t140 dvbsub cc mpeg_audio lpcm a52 dts cinepak flac)
377 vlc_enable_modules(deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise grain extract sharpen seamcarving)
378 vlc_enable_modules(converter_fixed mono)
379 vlc_enable_modules(trivial_resampler ugly_resampler)
380 vlc_enable_modules(trivial_channel_mixer trivial_mixer)
381 vlc_enable_modules(playlist export nsc xtag)
382 vlc_enable_modules(i420_rgb grey_yuv rawvideo blend scale image logo magnify puzzle colorthres)
383 vlc_enable_modules(wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv smf)
384 vlc_enable_modules(access_directory access_file access_udp access_tcp)
385 vlc_enable_modules(access_http access_mms access_ftp)
386 vlc_enable_modules(access_filter_bandwidth)
387 vlc_enable_modules(packetizer_mpegvideo packetizer_h264)
388 vlc_enable_modules(packetizer_mpeg4video packetizer_mpeg4audio)
389 vlc_enable_modules(packetizer_vc1)
390 vlc_enable_modules(spatializer)
391 vlc_enable_modules(asf)
392
393 set(enabled ${ENABLE_STREAM_OUT})
394 vlc_register_modules(${enabled} access_output_dummy access_output_udp access_output_file access_output_http)
395 vlc_register_modules(${enabled} mux_ps mux_avi mux_mp4 mux_asf mux_dummy mux_wav mux_mpjpeg)
396 vlc_register_modules(${enabled} packetizer_copy)
397
398 vlc_register_modules(${enabled} stream_out_dummy stream_out_standard stream_out_es stream_out_rtp stream_out_description vod_rtsp)
399 vlc_register_modules(${enabled} stream_out_duplicate stream_out_display stream_out_transcode stream_out_bridge stream_out_mosaic_bridge stream_out_autodel)
400 vlc_register_modules(${enabled} stream_out_gather)
401 # vlc_register_modules(${enabled} stream_out_transrate)
402 # vlc_register_modules(${enabled} rtcp)
403 vlc_register_modules(${enabled} profile_parser)
404
405 if(NOT mingwce)
406    set(enabled ON)
407 endif(NOT mingwce)
408 vlc_register_modules(${enabled} access_fake access_filter_timeshift access_filter_record access_filter_dump)
409 vlc_register_modules(${enabled} gestures rc telnet hotkeys showintf marq podcast shout sap fake folder)
410 vlc_register_modules(${enabled} rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur)
411 vlc_register_modules(${enabled} i420_yuy2 i422_yuy2 i420_ymga i422_i420 yuy2_i422 yuy2_i420 chroma_chain)
412 vlc_register_modules(${enabled} aout_file linear_resampler bandlimited_resampler)
413 vlc_register_modules(${enabled} float32_mixer spdif_mixer simple_channel_mixer)
414 vlc_register_modules(${enabled} dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq)
415 vlc_register_modules(${enabled} converter_float a52tospdif dtstospdif audio_format)
416 set(enabled)
417
418 if(NOT WIN32)
419    vlc_enable_modules(screensaver)
420 endif(NOT WIN32)
421
422 # This module is disabled because the CMakeList.txt which
423 # is generated isn't correct. We'll put that back
424 # when cmake will be accepted as default build system
425 vlc_disable_modules(motion)
426
427 ###########################################################
428 # libraries
429 ###########################################################
430
431 include_directories(${CONTRIB_INCLUDE})
432
433 #fixme: use find_package(cddb 0.9.5)
434 pkg_check_modules(LIBCDDB libcddb>=0.9.5)
435 if(${LIBCDDB_FOUND})
436   vlc_module_add_link_libraries(cdda ${LIBCDDB_LIBRARIES})
437   vlc_add_module_compile_flag(cdda ${LIBCDDB_CFLAGS} )
438 endif(${LIBCDDB_FOUND})
439
440 find_package(Dlopen)
441 set(HAVE_DL_DLOPEN ${Dlopen_FOUND})
442
443 # Advanced Linux Sound Architecture (ALSA)
444 pkg_check_modules(ALSA alsa>=1.0.0-rc4)
445 if (${ALSA_FOUND})
446   set (HAVE_ALSA_NEW_API "1")
447 else (${ALSA_FOUND})
448   pkg_check_modules(ALSA alsa)
449 endif (${ALSA_FOUND})
450
451 if (${ALSA_FOUND})
452   set (HAVE_ALSA "1")
453   vlc_enable_modules(alsa)
454   vlc_add_module_compile_flag(alsa ${ALSA_CFLAGS})
455   vlc_module_add_link_libraries(alsa ${ALSA_LIBRARIES})
456 endif (${ALSA_FOUND})
457
458 # Open Sound System (OSS)
459 # TODO
460
461 find_package(FFmpeg)
462 if(FFmpeg_FOUND)
463   string(REPLACE ";" " " FFmpeg_CFLAGS "${FFmpeg_CFLAGS}")
464   set( CMAKE_REQUIRED_FLAGS_saved ${CMAKE_REQUIRED_FLAGS} )
465   set( CMAKE_REQUIRED_FLAGS ${FFmpeg_CFLAGS} )
466
467   vlc_check_include_files (ffmpeg/avcodec.h libavcodec/avcodec.h)
468   vlc_check_include_files (ffmpeg/avutil.h libavutil/avutil.h)
469   vlc_check_include_files (ffmpeg/swscale.h libswscale/swscale.h)
470   vlc_check_include_files (postproc/postprocess.h libpostproc/postprocess.h)
471
472   vlc_enable_modules(ffmpeg)
473   vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS})
474   vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
475   
476   set( CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_saved} )
477   set( CMAKE_REQUIRED_FLAGS_saved )
478 endif(FFmpeg_FOUND)
479
480 find_package(Lua)
481 if(Lua_FOUND)
482   set(HAVE_LUA TRUE)
483   vlc_enable_modules(lua)
484   vlc_check_include_files (lua.h lualib.h)
485   vlc_add_module_compile_flag(lua ${Lua_CFLAGS} )
486   vlc_module_add_link_libraries(lua ${Lua_LIBRARIES})
487 endif(Lua_FOUND)
488
489 find_package(Qt4)
490 if(QT4_FOUND)
491   set(HAVE_QT4 TRUE)
492   include_directories(${QT_INCLUDES})
493   vlc_check_include_files (qt.h)
494   vlc_enable_modules(qt4)
495   vlc_add_module_compile_flag(qt4 ${QT_CFLAGS} )
496   vlc_module_add_link_libraries(qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
497
498   # Define our own qt4_wrap_ui macro to match wanted behaviour
499   MACRO (VLC_QT4_WRAP_UI outfiles )
500     FOREACH (it ${ARGN})
501      string(REPLACE ".ui" ".h" outfile "${it}")
502       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
503       SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
504       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
505         COMMAND mkdir -p `dirname ${outfile}`
506         COMMAND ${QT_UIC_EXECUTABLE}
507         ARGS -o ${outfile} ${infile}
508         MAIN_DEPENDENCY ${infile})
509       SET(${outfiles} ${${outfiles}} ${outfile})
510     ENDFOREACH (it)
511   ENDMACRO (VLC_QT4_WRAP_UI)
512
513   MACRO (VLC_QT4_GENERATE_MOC outfiles flags )
514     string(REGEX MATCHALL "[^\\ ]+" flags_list ${flags})
515     FOREACH (it ${ARGN})
516       string(REPLACE ".hpp" ".moc.cpp" outfile "${it}")
517       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
518       SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
519       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
520         COMMAND mkdir -p `dirname ${outfile}`
521         COMMAND ${QT_MOC_EXECUTABLE} 
522         ARGS ${flags_list}
523         ARGS -I ${CMAKE_BINARY_DIR}/include
524         ARGS -o ${outfile} ${infile}
525         MAIN_DEPENDENCY ${it}
526         )
527       SET(${outfiles} ${${outfiles}} ${outfile})
528     ENDFOREACH (it)
529   ENDMACRO (VLC_QT4_GENERATE_MOC)
530
531
532 endif(QT4_FOUND)
533
534 find_package(OpenGL)
535 if(OPENGL_FOUND)
536   vlc_enable_modules(opengl)
537   vlc_check_include_files (gl/gl.h)
538   vlc_check_include_files (gl/glu.h)
539   vlc_check_include_files (gl/glx.h)
540   vlc_add_module_compile_flag(opengl ${OPENGL_CFLAGS})
541   vlc_module_add_link_libraries(opengl ${OPENGL_LIBRARIES})
542 endif(OPENGL_FOUND)
543
544 find_package(Matroska 0.7.7)
545 if(Matroska_FOUND)
546   vlc_enable_modules(mkv)
547   vlc_check_include_files (matroska/KaxAttachments.h)
548   vlc_check_include_files (matroska/KaxVersion.h)
549   vlc_module_add_link_libraries(mkv ${Matroska_LIBRARIES})
550 endif(Matroska_FOUND)
551
552 find_package(Live555)
553 if(Live555_FOUND)
554   vlc_enable_modules(live555)
555   vlc_add_module_compile_flag(live555 ${Live555_CFLAGS})
556   vlc_module_add_link_libraries(live555 ${Live555_LIBRARIES})
557 endif(Live555_FOUND)
558
559 find_package(Curses)
560 if(CURSES_LIBRARIES)
561   vlc_enable_modules(ncurses)
562   vlc_module_add_link_libraries(ncurses ${CURSES_LIBRARIES})
563 endif(CURSES_LIBRARIES)
564
565 find_package(X11)
566 if(X11_FOUND)
567   vlc_enable_modules(x11 panoramix)
568   vlc_check_include_files (X11/Xlib.h)
569   vlc_module_add_link_libraries(x11       ${X11_LIBRARIES})
570   vlc_module_add_link_libraries(panoramix ${X11_LIBRARIES})
571 endif(X11_FOUND)
572
573 find_package(Mpeg2)
574 if(Mpeg2_FOUND)
575   vlc_enable_modules(libmpeg2)
576   check_include_files ("stdint.h;mpeg2dec/mpeg2.h" HAVE_MPEG2DEC_MPEG2_H)
577   vlc_module_add_link_libraries(libmpeg2 ${Mpeg2_LIBRARIES})
578 endif(Mpeg2_FOUND)
579
580 find_package(Dvbpsi)
581 if(Dvbpsi_FOUND)
582   vlc_register_modules(${ENABLE_STREAM_OUT} mux_ts)
583   vlc_enable_modules(ts)
584   check_include_files ("stdint.h;dvbpsi/dvbpsi.h;dvbpsi/demux.h;dvbpsi/descriptor.h;dvbpsi/pat.h;dvbpsi/pmt.h;dvbpsi/sdt.h;dvbpsi/dr.h" HAVE_DVBPSI_DR_H)
585   vlc_module_add_link_libraries(ts      ${Dvbpsi_LIBRARIES})
586   vlc_module_add_link_libraries(mux_ts  ${Dvbpsi_LIBRARIES})
587   vlc_module_add_link_libraries(dvb     ${Dvbpsi_LIBRARIES})
588 endif(Dvbpsi_FOUND)
589
590 set(CMAKE_REQUIRED_INCLUDES)
591
592 ###########################################################
593 # Final configuration
594 ###########################################################
595
596 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)