cmake: Include stdint.h when searching postprocess.h.
[vlc.git] / extras / buildsystem / cmake / include / config.cmake
1 include( CheckIncludeFile )
2 include (CheckTypeSize)
3 include (CheckCSourceCompiles)
4 include (CheckSymbolExists)
5 include (CheckLibraryExists)
6
7 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_include_files.cmake )
8 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_functions_exist.cmake )
9 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_add_compile_flag.cmake )
10 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_type.cmake )
11 include( ${CMAKE_SOURCE_DIR}/cmake/pkg_check_modules.cmake )
12
13 ###########################################################
14 # VERSION
15 ###########################################################
16
17 set(VLC_VERSION_MAJOR 0)
18 set(VLC_VERSION_MINOR 9)
19 set(VLC_VERSION_PATCH 0)
20 set(VLC_VERSION_EXTRA "-svn")
21
22 set(PACKAGE "vlc")
23 set(PACKAGE_STRING "vlc")
24 set(VERSION_MESSAGE "vlc-${VLC_VERSION_MAJOR}.${VLC_VERSION_MINOR}.${VLC_VERSION_PATCH}${VLC_VERSION_EXTRA}")
25 set(COPYRIGHT_MESSAGE "Copyright © the VideoLAN team")
26 set(COPYRIGHT_YEARS "2001-2008")
27
28 ###########################################################
29 # Options
30 ###########################################################
31
32 OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
33 OPTION( ENABLE_VLM             "Enable vlm" ON )
34 OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
35 OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
36 OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" ON )
37
38 IF (NOT CMAKE_BUILD_TYPE)
39     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING  "build type determining compiler flags" FORCE )
40 endif(NOT CMAKE_BUILD_TYPE )
41
42 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
43     set(DEBUG ON)
44     set(NDEBUG ON)
45 endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
46
47 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
48 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
49
50 ###########################################################
51 # Headers checks
52 ###########################################################
53
54 vlc_check_include_files (malloc.h stdbool.h locale.h)
55 vlc_check_include_files (stddef.h stdlib.h sys/stat.h)
56 vlc_check_include_files (stdio.h stdint.h inttypes.h)
57 vlc_check_include_files (signal.h unistd.h dirent.h)
58 vlc_check_include_files (netinet/in.h netinet/udplite.h)
59 vlc_check_include_files (arpa/inet.h net/if.h)
60 vlc_check_include_files (netdb.h fcntl.h sys/time.h poll.h)
61 vlc_check_include_files (errno.h time.h alloca.h)
62 vlc_check_include_files (limits.h)
63
64 vlc_check_include_files (string.h strings.h getopt.h)
65
66 vlc_check_include_files (dlfcn.h dl.h)
67
68 vlc_check_include_files (kernel/OS.h)
69 vlc_check_include_files (memory.h)
70 vlc_check_include_files (mach-o/dyld.h)
71
72 vlc_check_include_files (pthread.h)
73
74 find_package (Threads)
75
76 ###########################################################
77 # Functions/structures checks
78 ###########################################################
79 set(CMAKE_REQUIRED_LIBRARIES c)
80 set(CMAKE_EXTRA_INCLUDE_FILES string.h)
81 vlc_check_functions_exist(strcpy strcasecmp)
82 vlc_check_functions_exist(strcasestr strdup)
83 vlc_check_functions_exist(strndup stricmp strnicmp)
84 vlc_check_functions_exist(atof strtoll atoll lldiv)
85 vlc_check_functions_exist(strlcpy stristr strnlen strsep)
86 vlc_check_functions_exist(strtod strtof strtol stroul)
87 vlc_check_functions_exist(stroull)
88 set(CMAKE_EXTRA_INCLUDE_FILES)
89
90 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
91 vlc_check_functions_exist(vasprintf)
92 set(CMAKE_EXTRA_INCLUDE_FILES)
93
94 set(CMAKE_EXTRA_INCLUDE_FILES libc.h)
95 vlc_check_functions_exist(fork)
96 set(CMAKE_EXTRA_INCLUDE_FILES)
97
98 set(CMAKE_EXTRA_INCLUDE_FILES stdlib.h)
99 vlc_check_functions_exist(putenv getenv setenv)
100 vlc_check_functions_exist(putenv getenv setenv)
101 set(CMAKE_EXTRA_INCLUDE_FILES)
102
103 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
104 vlc_check_functions_exist(snprintf asprintf)
105 vlc_check_functions_exist(putenv getenv setenv)
106 set(CMAKE_EXTRA_INCLUDE_FILES)
107
108 set(CMAKE_EXTRA_INCLUDE_FILES unistd.h)
109 vlc_check_functions_exist(isatty getcwd getuid)
110 set(CMAKE_EXTRA_INCLUDE_FILES)
111
112 set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
113 vlc_check_functions_exist(lstat fstat stat)
114 set(CMAKE_EXTRA_INCLUDE_FILES)
115
116 set(CMAKE_REQUIRED_LIBRARIES)
117
118 check_library_exists(poll poll "" HAVE_POLL)
119
120 check_c_source_compiles(
121 "#include <langinfo.h>
122 int main() { char* cs = nl_langinfo(CODESET); }"
123 HAVE_LANGINFO_CODESET)
124
125 vlc_check_type("struct addrinfo" "sys/socket.h;netdb.h")
126 if(HAVE_STRUCT_ADDRINFO)
127   set(HAVE_ADDRINFO ON)
128 endif(HAVE_STRUCT_ADDRINFO)
129 vlc_check_type("struct timespec" "time.h")
130
131 check_c_source_compiles (
132 "#include <stdint.h> \n #ifdef UINTMAX \n #error no uintmax
133  #endif
134  int main() { return 0;}" HAVE_STDINT_H_WITH_UINTMAX)
135
136 check_symbol_exists(ntohl "sys/param.h"  NTOHL_IN_SYS_PARAM_H)
137 check_symbol_exists(scandir "dirent.h"   HAVE_SCANDIR)
138 check_symbol_exists(scandir "dirent.h"   HAVE_SCANDIR)
139 check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)
140 check_symbol_exists(alloca "alloca.h"    HAVE_ALLOCA)
141
142 check_symbol_exists(va_copy "stdarg.h"   HAVE_VACOPY)
143 check_symbol_exists(__va_copy "stdarg.h" HAVE___VA_COPY)
144
145
146 check_symbol_exists(getnameinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETNAMEINFO)
147 check_symbol_exists(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
148 if(NOT HAVE_GETADDRINFO)
149     check_library_exists(getaddrinfo nsl "" HAVE_GETADDRINFO)
150 endif(NOT HAVE_GETADDRINFO)
151
152 vlc_check_functions_exist(iconv)
153 if(NOT HAVE_ICONV)
154     set(LIBICONV "iconv")
155     check_library_exists(iconv iconv "" HAVE_ICONV)
156 endif(NOT HAVE_ICONV)
157 set(CMAKE_REQUIRED_LIBRARIES ${LIBICONV})
158 CHECK_C_SOURCE_COMPILES(" #include <iconv.h>
159  int main() { return iconv(0, (char **)0, 0, (char**)0, 0); }" ICONV_NO_CONST)
160 if( ICONV_NO_CONST )
161   set( ICONV_CONST "const" )
162 else( ICONV_NO_CONST )
163   set( ICONV_CONST " ")
164 endif( ICONV_NO_CONST )
165 set(CMAKE_REQUIRED_LIBRARIES)
166
167 check_library_exists(rt clock_nanosleep "" HAVE_CLOCK_NANOSLEEP)
168 if (HAVE_CLOCK_NANOSLEEP)
169     set(LIBRT "rt")
170 endif (HAVE_CLOCK_NANOSLEEP)
171
172 check_library_exists(m pow "" HAVE_LIBM)
173 if (HAVE_LIBM)
174     set (LIBM "m")
175 endif (HAVE_LIBM)
176
177 check_symbol_exists(connect "sys/types.h;sys/socket.h" HAVE_CONNECT)
178 if(NOT HAVE_CONNECT)
179     check_library_exists(connect socket HAVE_CONNECT)
180     if(NOT HAVE_CONNECT)
181         vlc_module_add_link_libraries(libvlc connect)
182         vlc_module_add_link_libraries(cdda   connect)
183         vlc_module_add_link_libraries(cddax  connect)
184     endif(NOT HAVE_CONNECT)
185 endif(NOT HAVE_CONNECT)
186
187 ###########################################################
188 # Other check
189 ###########################################################
190 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_test_inline.cmake )
191
192 ###########################################################
193 # Platform check
194 ###########################################################
195 if(APPLE)
196     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
197
198     if(ENABLE_NO_SYMBOL_CHECK)
199         set(DYNAMIC_LOOKUP "-undefined dynamic_lookup")
200     else(ENABLE_NO_SYMBOL_CHECK)
201         set(DYNAMIC_LOOKUP)
202     endif(ENABLE_NO_SYMBOL_CHECK)
203     set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
204      "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} ${DYNAMIC_LOOKUP}")
205     set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
206      "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} ${DYNAMIC_LOOKUP}")
207
208     set(SYS_DARWIN 1)
209     add_definitions(-std=gnu99) # Hack for obj-c files to be compiled with gnu99
210     vlc_enable_modules(macosx minimal_macosx access_eyetv quartztext)
211
212     vlc_check_include_files (ApplicationServices/ApplicationServices.h)
213     vlc_check_include_files (Carbon/Carbon.h)
214     vlc_check_include_files (CoreAudio/CoreAudio.h)
215
216    # check_symbol_exists (CFLocaleCopyCurrent "CoreFoundation/CoreFoundation.h" "" HAVE_CFLOCALECOPYCURRENT)
217    # check_symbol_exists (CFPreferencesCopyAppValue "CoreFoundation/CoreFoundation.h" "" HAVE_CFPREFERENCESCOPYAPPVALUE)
218
219     vlc_find_frameworks(Cocoa Carbon OpenGL AGL IOKit Quicktime
220                         WebKit QuartzCore Foundation ApplicationServices)
221     vlc_module_add_link_libraries(macosx
222         ${Cocoa_FRAMEWORKS}
223         ${IOKit_FRAMEWORKS}
224         ${OpenGL_FRAMEWORKS}
225         ${AGL_FRAMEWORKS}
226         ${Quicktime_FRAMEWORKS}
227         ${WebKit_FRAMEWORKS})
228     vlc_module_add_link_libraries(minimal_macosx
229         ${Cocoa_FRAMEWORKS}
230         ${Carbon_FRAMEWORKS}
231         ${OpenGL_FRAMEWORKS}
232         ${AGL_FRAMEWORKS})
233     vlc_module_add_link_libraries(access_eyetv
234         ${Foundation_FRAMEWORKS})
235     vlc_module_add_link_libraries(opengllayer
236          ${Cocoa_FRAMEWORKS}
237          ${QuartzCore_FRAMEWORKS}
238          ${OpenGL_FRAMEWORKS} )
239     vlc_module_add_link_libraries(quartztext
240          ${Carbon_FRAMEWORKS}
241          ${ApplicationServices_FRAMEWORKS} )
242     vlc_module_add_link_libraries(mp4
243          ${IOKit_FRAMEWORKS} )
244
245     add_executable(VLC MACOSX_BUNDLE src/vlc.c)
246     target_link_libraries(VLC libvlc)
247     set( MacOS ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS )
248     add_custom_command(
249         TARGET VLC
250         POST_BUILD
251         COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
252         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/modules/gui/macosx
253         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx
254         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
255         COMMAND for i in AUTHORS COPYING THANKS\;do cp ${CMAKE_CURRENT_SOURCE_DIR}/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp\; done
256         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
257         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
258         COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/Resources ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents
259         COMMAND find -d ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources -type d -name \\.svn -exec rm -rf {} "\;"
260         COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale ${MacOS}/share
261         COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${MacOS}/share
262         COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/modules ${MacOS}/modules
263         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\" "\;"
264         COMMAND ln -sf VLC ${MacOS}/clivlc #useless?
265         COMMAND printf "APPLVLC#" > ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/PkgInfo
266     )
267     set( MacOS )
268
269 endif(APPLE)
270
271 ###########################################################
272 # info
273 ###########################################################
274
275 macro(command_to_configvar command var)
276  execute_process(
277   COMMAND sh -c "${command}"
278   OUTPUT_VARIABLE ${var}
279   OUTPUT_STRIP_TRAILING_WHITESPACE)
280  string( REPLACE "\n" "\\n" ${var} ${${var}})
281 endmacro(command_to_configvar)
282
283 command_to_configvar( "whoami" VLC_COMPILE_BY )
284 command_to_configvar( "hostname" VLC_COMPILE_HOST )
285 command_to_configvar( "hostname" VLC_COMPILE_DOMAIN )
286 command_to_configvar( "${CMAKE_C_COMPILER} --version" VLC_COMPILER )
287 # FIXME: WTF? this is not the configure line!
288 command_to_configvar( "${CMAKE_C_COMPILER} --version" CONFIGURE_LINE )
289 set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
290
291
292 ###########################################################
293 # Modules: Following are all listed in options
294 ###########################################################
295
296 # This module will be enabled but user could disabled it
297 vlc_enable_modules(dummy logger memcpy)
298 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)
299 vlc_enable_modules(cvdsub svcdsub spudec subsdec subsusf t140 dvbsub cc mpeg_audio lpcm a52 dts cinepak flac)
300 vlc_enable_modules(deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise grain extract sharpen seamcarving)
301 vlc_enable_modules(converter_fixed mono)
302 vlc_enable_modules(trivial_resampler ugly_resampler)
303 vlc_enable_modules(trivial_channel_mixer trivial_mixer)
304 vlc_enable_modules(playlist export nsc xtag)
305 vlc_enable_modules(i420_rgb grey_yuv rawvideo blend scale image logo magnify puzzle colorthres)
306 vlc_enable_modules(wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv smf)
307 vlc_enable_modules(access_directory access_file access_udp access_tcp)
308 vlc_enable_modules(access_http access_mms access_ftp)
309 vlc_enable_modules(access_filter_bandwidth)
310 vlc_enable_modules(packetizer_mpegvideo packetizer_h264)
311 vlc_enable_modules(packetizer_mpeg4video packetizer_mpeg4audio)
312 vlc_enable_modules(packetizer_vc1)
313 vlc_enable_modules(spatializer)
314
315 if(NOT mingwce)
316    set(enabled ON)
317 endif(NOT mingwce)
318 vlc_register_modules(${enabled} access_fake access_filter_timeshift access_filter_record access_filter_dump)
319 vlc_register_modules(${enabled} gestures rc telnet hotkeys showintf marq podcast shout sap fake folder)
320 vlc_register_modules(${enabled} rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur)
321 vlc_register_modules(${enabled} i420_yuy2 i422_yuy2 i420_ymga i422_i420 yuy2_i422 yuy2_i420 chroma_chain)
322 vlc_register_modules(${enabled} aout_file linear_resampler bandlimited_resampler)
323 vlc_register_modules(${enabled} float32_mixer spdif_mixer simple_channel_mixer)
324 vlc_register_modules(${enabled} dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq)
325 vlc_register_modules(${enabled} converter_float a52tospdif dtstospdif audio_format)
326 set(enabled)
327
328 if(NOT WIN32)
329    vlc_enable_modules(screensaver)
330 endif(NOT WIN32)
331
332 # Following modules will be disabled but listed in options
333
334 vlc_disable_modules(asf)
335
336 # This module is disabled because the CMakeList.txt which
337 # is generated isn't correct. We'll put that back
338 # when cmake will be accepted as default build system
339 vlc_disable_modules(motion)
340
341 ###########################################################
342 # libraries
343 ###########################################################
344 OPTION( ENABLE_CONTRIB "Attempt to use VLC contrib system to get the third-party libraries" ON )
345 if(ENABLE_CONTRIB)
346   set( CONTRIB_INCLUDE ${CMAKE_SOURCE_DIR}/extras/contrib/include)
347   set( CONTRIB_LIB ${CMAKE_SOURCE_DIR}/extras/contrib/lib)
348   set( CONTRIB_PROGRAM ${CMAKE_SOURCE_DIR}/extras/contrib/bin)
349   set( CMAKE_LIBRARY_PATH ${CONTRIB_LIB} ${CMAKE_LIBRARY_PATH} )
350   set( CMAKE_PROGRAM_PATH ${CONTRIB_PROGRAM} ${CMAKE_PROGRAM_PATH} )
351   set( CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${CONTRIB_LIB}" )
352   set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
353   set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
354   set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
355   set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
356   set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
357   add_definitions(-I${CONTRIB_INCLUDE})
358 endif(ENABLE_CONTRIB)
359
360 set(CMAKE_REQUIRED_INCLUDES ${CONTRIB_INCLUDE})
361
362 #fixme: use find_package(cddb 0.9.5)
363 pkg_check_modules(LIBCDDB libcddb>=0.9.5)
364 if(${LIBCDDB_FOUND})
365   vlc_module_add_link_libraries(cdda ${LIBCDDB_LIBRARIES})
366   vlc_add_module_compile_flag(cdda ${LIBCDDB_CFLAGS} )
367 endif(${LIBCDDB_FOUND})
368
369 find_package(Dlopen)
370 set(HAVE_DL_DLOPEN ${Dlopen_FOUND})
371
372 find_package(FFmpeg)
373 if(FFmpeg_FOUND)
374   vlc_check_include_files (ffmpeg/avcodec.h)
375   vlc_check_include_files (ffmpeg/avutil.h)
376   vlc_check_include_files (ffmpeg/swscale.h)
377   check_include_files ("stdint.h;postproc/postprocess.h" HAVE_POSTPROC_POSTPROCESS_H)
378   vlc_enable_modules(ffmpeg)
379   vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS} )
380   vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
381 endif(FFmpeg_FOUND)
382
383 find_package(Lua)
384 if(Lua_FOUND)
385   set(HAVE_LUA TRUE)
386   vlc_enable_modules(lua)
387   vlc_check_include_files (lua.h lualib.h)
388   vlc_add_module_compile_flag(lua ${Lua_CFLAGS} )
389   vlc_module_add_link_libraries(lua ${Lua_LIBRARIES})
390 endif(Lua_FOUND)
391
392 find_package(Qt4)
393 if(QT4_FOUND)
394   set(HAVE_QT4 TRUE)
395   include_directories(${QT_INCLUDES})
396   vlc_check_include_files (qt.h)
397   vlc_enable_modules(qt4)
398   vlc_add_module_compile_flag(qt4 ${QT_CFLAGS} )
399   vlc_module_add_link_libraries(qt4 ${QT_LIBRARIES})
400   # Define our own qt4_wrap_ui macro to match wanted behaviour
401   MACRO (VLC_QT4_WRAP_UI outfiles )
402     FOREACH (it ${ARGN})
403      string(REPLACE ".ui" ".h" outfile "${it}")
404       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
405       SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
406       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
407         COMMAND mkdir -p `dirname ${outfile}`
408         COMMAND ${QT_UIC_EXECUTABLE}
409         ARGS -o ${outfile} ${infile}
410         MAIN_DEPENDENCY ${infile})
411       SET(${outfiles} ${${outfiles}} ${outfile})
412     ENDFOREACH (it)
413
414   ENDMACRO (VLC_QT4_WRAP_UI)
415
416 endif(QT4_FOUND)
417
418 find_package(OpenGL)
419 if(OPENGL_FOUND)
420   vlc_enable_modules(opengl)
421   vlc_check_include_files (gl/gl.h)
422   vlc_check_include_files (gl/glu.h)
423   vlc_check_include_files (gl/glx.h)
424   vlc_add_module_compile_flag(opengl ${OPENGL_CFLAGS})
425   vlc_module_add_link_libraries(opengl ${OPENGL_LIBRARIES})
426 endif(OPENGL_FOUND)
427
428 set(CMAKE_REQUIRED_INCLUDES)
429
430 ###########################################################
431 # Final configuration
432 ###########################################################
433 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
434