]> git.sesse.net Git - vlc/blobdiff - extras/buildsystem/cmake/include/config.cmake
Remove duplicated checks
[vlc] / extras / buildsystem / cmake / include / config.cmake
index 3e8f30a2eebcf71f23b9ce8c3da58885c1efa294..9ed60fe3ff4d1fa501672f715941a50a61595f39 100644 (file)
@@ -3,7 +3,6 @@ include (CheckTypeSize)
 include (CheckCSourceCompiles)
 include (CheckSymbolExists)
 include (CheckLibraryExists)
-include (FindThreads)
 
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_include_files.cmake )
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_functions_exist.cmake )
@@ -33,12 +32,18 @@ set(COPYRIGHT_YEARS "2001-2008")
 OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
 OPTION( ENABLE_VLM             "Enable vlm" ON )
 OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
+OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
 OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" ON )
 
 IF (NOT CMAKE_BUILD_TYPE)
-    SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING  "build type determining compiler flags" FORCE )
+    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING  "build type determining compiler flags" FORCE )
 endif(NOT CMAKE_BUILD_TYPE )
 
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+    set(DEBUG ON)
+    set(NDEBUG OFF)
+endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+
 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
 
@@ -53,24 +58,33 @@ vlc_check_include_files (signal.h unistd.h dirent.h)
 vlc_check_include_files (netinet/in.h netinet/udplite.h)
 vlc_check_include_files (arpa/inet.h net/if.h)
 vlc_check_include_files (netdb.h fcntl.h sys/time.h poll.h)
-vlc_check_include_files (errno.h time.h)
+vlc_check_include_files (errno.h time.h alloca.h)
+vlc_check_include_files (limits.h)
+
+vlc_check_include_files (string.h strings.h getopt.h)
 
 vlc_check_include_files (dlfcn.h dl.h)
 
 vlc_check_include_files (kernel/OS.h)
+vlc_check_include_files (memory.h)
 vlc_check_include_files (mach-o/dyld.h)
 
+vlc_check_include_files (pthread.h)
+
+find_package (Threads)
 
 ###########################################################
 # Functions/structures checks
 ###########################################################
-
+set(CMAKE_REQUIRED_LIBRARIES c)
 set(CMAKE_EXTRA_INCLUDE_FILES string.h)
 vlc_check_functions_exist(strcpy strcasecmp)
 vlc_check_functions_exist(strcasestr strdup)
 vlc_check_functions_exist(strndup stricmp strnicmp)
 vlc_check_functions_exist(atof strtoll atoll lldiv)
-vlc_check_functions_exist(strlcpy)
+vlc_check_functions_exist(strlcpy stristr strnlen strsep)
+vlc_check_functions_exist(strtod strtof strtol stroul)
+vlc_check_functions_exist(stroull)
 set(CMAKE_EXTRA_INCLUDE_FILES)
 
 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
@@ -81,6 +95,32 @@ set(CMAKE_EXTRA_INCLUDE_FILES libc.h)
 vlc_check_functions_exist(fork)
 set(CMAKE_EXTRA_INCLUDE_FILES)
 
+set(CMAKE_EXTRA_INCLUDE_FILES stdlib.h)
+vlc_check_functions_exist(putenv getenv setenv)
+vlc_check_functions_exist(putenv getenv setenv)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
+vlc_check_functions_exist(snprintf asprintf)
+vlc_check_functions_exist(putenv getenv setenv)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_EXTRA_INCLUDE_FILES unistd.h)
+vlc_check_functions_exist(isatty getcwd getuid)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
+vlc_check_functions_exist(lstat fstat stat)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_EXTRA_INCLUDE_FILES arpa/inet.h)
+vlc_check_functions_exist(inet_aton inet_ntop inet_pton)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_REQUIRED_LIBRARIES)
+
+check_library_exists(poll poll "" HAVE_POLL)
+
 check_c_source_compiles(
 "#include <langinfo.h>
 int main() { char* cs = nl_langinfo(CODESET); }"
@@ -97,10 +137,14 @@ check_c_source_compiles (
  #endif
  int main() { return 0;}" HAVE_STDINT_H_WITH_UINTMAX)
 
-check_symbol_exists(ntohl "sys/param.h" NTOHL_IN_SYS_PARAM_H)
-check_symbol_exists(scandir "dirent.h" HAVE_SCANDIR)
-check_symbol_exists(scandir "dirent.h" HAVE_SCANDIR)
+check_symbol_exists(ntohl "sys/param.h"  NTOHL_IN_SYS_PARAM_H)
+check_symbol_exists(scandir "dirent.h"   HAVE_SCANDIR)
 check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)
+check_symbol_exists(alloca "alloca.h"    HAVE_ALLOCA)
+
+check_symbol_exists(va_copy "stdarg.h"   HAVE_VACOPY)
+check_symbol_exists(__va_copy "stdarg.h" HAVE___VA_COPY)
+
 
 check_symbol_exists(getnameinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETNAMEINFO)
 check_symbol_exists(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
@@ -133,6 +177,16 @@ if (HAVE_LIBM)
     set (LIBM "m")
 endif (HAVE_LIBM)
 
+check_symbol_exists(connect "sys/types.h;sys/socket.h" HAVE_CONNECT)
+if(NOT HAVE_CONNECT)
+    check_library_exists(connect socket HAVE_CONNECT)
+    if(NOT HAVE_CONNECT)
+        vlc_module_add_link_libraries(libvlc connect)
+        vlc_module_add_link_libraries(cdda   connect)
+        vlc_module_add_link_libraries(cddax  connect)
+    endif(NOT HAVE_CONNECT)
+endif(NOT HAVE_CONNECT)
+
 ###########################################################
 # Other check
 ###########################################################
@@ -145,17 +199,32 @@ if(APPLE)
     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
 
     if(ENABLE_NO_SYMBOL_CHECK)
-        set(DYNAMIC_LOOKUP "-undefined dynamic_lookup" CACHE INTERNAL STRING)
+        set(DYNAMIC_LOOKUP "-undefined dynamic_lookup")
+    else(ENABLE_NO_SYMBOL_CHECK)
+        set(DYNAMIC_LOOKUP)
     endif(ENABLE_NO_SYMBOL_CHECK)
     set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
      "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} ${DYNAMIC_LOOKUP}")
     set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
      "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} ${DYNAMIC_LOOKUP}")
 
+    # For pre-10.5
+    set( CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
+
     set(SYS_DARWIN 1)
     add_definitions(-std=gnu99) # Hack for obj-c files to be compiled with gnu99
     vlc_enable_modules(macosx minimal_macosx access_eyetv quartztext)
 
+    # On Pre-10.5
+    vlc_module_add_link_flags (ffmpeg "-read_only_relocs warning")
+
+    vlc_check_include_files (ApplicationServices/ApplicationServices.h)
+    vlc_check_include_files (Carbon/Carbon.h)
+    vlc_check_include_files (CoreAudio/CoreAudio.h)
+
+   # check_symbol_exists (CFLocaleCopyCurrent "CoreFoundation/CoreFoundation.h" "" HAVE_CFLOCALECOPYCURRENT)
+   # check_symbol_exists (CFPreferencesCopyAppValue "CoreFoundation/CoreFoundation.h" "" HAVE_CFPREFERENCESCOPYAPPVALUE)
+
     vlc_find_frameworks(Cocoa Carbon OpenGL AGL IOKit Quicktime
                         WebKit QuartzCore Foundation ApplicationServices)
     vlc_module_add_link_libraries(macosx
@@ -179,8 +248,8 @@ if(APPLE)
     vlc_module_add_link_libraries(quartztext
          ${Carbon_FRAMEWORKS}
          ${ApplicationServices_FRAMEWORKS} )
-    vlc_module_add_link_libraries(mp4
-         ${IOKit_FRAMEWORKS} )
+    vlc_module_add_link_libraries(mp4 ${IOKit_FRAMEWORKS} )
+    vlc_module_add_link_libraries(mkv ${IOKit_FRAMEWORKS} )
 
     add_executable(VLC MACOSX_BUNDLE src/vlc.c)
     target_link_libraries(VLC libvlc)
@@ -309,12 +378,30 @@ endif(${LIBCDDB_FOUND})
 find_package(Dlopen)
 set(HAVE_DL_DLOPEN ${Dlopen_FOUND})
 
+# Advanced Linux Sound Architecture (ALSA)
+pkg_check_modules(ALSA alsa>=1.0.0-rc4)
+if (${ALSA_FOUND})
+  set (HAVE_ALSA_NEW_API "1")
+else (${ALSA_FOUND})
+  pkg_check_modules(ALSA alsa)
+endif (${ALSA_FOUND})
+
+if (${ALSA_FOUND})
+  set (HAVE_ALSA "1")
+  vlc_enable_modules(alsa)
+  vlc_add_module_compile_flag(alsa ${ALSA_CFLAGS})
+  vlc_module_add_link_libraries(alsa ${ALSA_LIBRARIES})
+endif (${ALSA_FOUND})
+
+# Open Sound System (OSS)
+# TODO
+
 find_package(FFmpeg)
 if(FFmpeg_FOUND)
-  set(CMAKE_EXTRA_INCLUDE_FILES stdint.h)
   vlc_check_include_files (ffmpeg/avcodec.h)
-  vlc_check_include_files (postproc/postprocess.h)
-  set(CMAKE_EXTRA_INCLUDE_FILES)
+  vlc_check_include_files (ffmpeg/avutil.h)
+  vlc_check_include_files (ffmpeg/swscale.h)
+  check_include_files ("stdint.h;postproc/postprocess.h" HAVE_POSTPROC_POSTPROCESS_H)
   vlc_enable_modules(ffmpeg)
   vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS} )
   vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
@@ -324,10 +411,55 @@ find_package(Lua)
 if(Lua_FOUND)
   set(HAVE_LUA TRUE)
   vlc_enable_modules(lua)
+  vlc_check_include_files (lua.h lualib.h)
   vlc_add_module_compile_flag(lua ${Lua_CFLAGS} )
   vlc_module_add_link_libraries(lua ${Lua_LIBRARIES})
 endif(Lua_FOUND)
 
+find_package(Qt4)
+if(QT4_FOUND)
+  set(HAVE_QT4 TRUE)
+  include_directories(${QT_INCLUDES})
+  vlc_check_include_files (qt.h)
+  vlc_enable_modules(qt4)
+  vlc_add_module_compile_flag(qt4 ${QT_CFLAGS} )
+  vlc_module_add_link_libraries(qt4 ${QT_LIBRARIES})
+
+  # Define our own qt4_wrap_ui macro to match wanted behaviour
+  MACRO (VLC_QT4_WRAP_UI outfiles )
+    FOREACH (it ${ARGN})
+     string(REPLACE ".ui" ".h" outfile "${it}")
+      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND mkdir -p `dirname ${outfile}`
+        COMMAND ${QT_UIC_EXECUTABLE}
+        ARGS -o ${outfile} ${infile}
+        MAIN_DEPENDENCY ${infile})
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH (it)
+  ENDMACRO (VLC_QT4_WRAP_UI)
+
+endif(QT4_FOUND)
+
+find_package(OpenGL)
+if(OPENGL_FOUND)
+  vlc_enable_modules(opengl)
+  vlc_check_include_files (gl/gl.h)
+  vlc_check_include_files (gl/glu.h)
+  vlc_check_include_files (gl/glx.h)
+  vlc_add_module_compile_flag(opengl ${OPENGL_CFLAGS})
+  vlc_module_add_link_libraries(opengl ${OPENGL_LIBRARIES})
+endif(OPENGL_FOUND)
+
+find_package(Matroska 0.7.7)
+if(Matroska_FOUND)
+  vlc_enable_modules(mkv)
+  vlc_check_include_files (matroska/KaxAttachments.h)
+  vlc_check_include_files (matroska/KaxVersion.h)
+  vlc_module_add_link_libraries(mkv ${Matroska_LIBRARIES})
+endif(Matroska_FOUND)
+
 set(CMAKE_REQUIRED_INCLUDES)
 
 ###########################################################