]> git.sesse.net Git - vlc/blobdiff - configure.ac
Enable compilation warnings on C++
[vlc] / configure.ac
index 710b88949498659fec8a4c35031f3631bdaf7163..c1a7b63d8dcb143a24e49fd3bcc074219025ecaf 100644 (file)
@@ -57,7 +57,11 @@ dnl Check for tools
 dnl
 AC_PROG_CC_C99
 AC_USE_SYSTEM_EXTENSIONS
-AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to '2' to get glibc warnings.])
+AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
+AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
+AC_DEFINE([_REENTRANT],, [Define to expose reentrant functions.])
+AC_DEFINE([_THREAD_SAFE],, [Same as _REENTANT for some other OSes.])
+AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
 
 AM_PROG_CC_C_O
 AC_PROG_CXX
@@ -547,7 +551,7 @@ need_libc=false
 
 dnl Check for usual libc functions
 AC_CHECK_FUNCS([daemon fcntl fdopendir fstatvfs fork getenv getpwuid_r gettimeofday isatty lstat memalign mmap openat pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp uselocale])
-AC_REPLACE_FUNCS([asprintf atof atoll dirfd getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
+AC_REPLACE_FUNCS([asprintf atof atoll dirfd flockfile getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])
@@ -660,7 +664,7 @@ AC_CHECK_LIB(m,cos,[
   VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger],[-lm])
 ])
 AC_CHECK_LIB(m,pow,[
-  VLC_ADD_LIBS([avcodec avformat access_avio swscale postproc ffmpegaltivec i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realvideo qt4],[-lm])
+  VLC_ADD_LIBS([avcodec avformat access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realvideo qt4],[-lm])
 ])
 AC_CHECK_LIB(m,sqrt,[
   VLC_ADD_LIBS([compressor headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball],[-lm])
@@ -687,21 +691,6 @@ AC_CHECK_LIB(m,lrintf, [
 dnl Check for dynamic plugins
 ac_cv_have_plugins=no
 
-# HP-UX style
-if test "${ac_cv_have_plugins}" = "no"; then
-  AC_CHECK_HEADERS(dl.h)
-  ac_cv_my_have_shl_load=no
-  AC_CHECK_FUNC(shl_load,
-   [ac_cv_my_have_shl_load=yes,
-    AC_CHECK_LIB(dld, shl_load,
-     [ac_cv_my_have_shl_load=yes
-      VLC_ADD_LIBS([libvlccore],[-ldld])])])
-  if test "${ac_cv_my_have_shl_load}" = "yes"; then
-    AC_DEFINE(HAVE_DL_SHL_LOAD, 1, [Define if you have the shl_load API])
-    ac_cv_have_plugins=yes
-  fi
-fi
-
 # Win32 style
 if test "${ac_cv_have_plugins}" = "no"; then
   if test "${SYS}" = "mingw32" ; then
@@ -973,6 +962,9 @@ dnl
 
 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
 RDC_PROG_CC_FLAGS([-pipe])
+AC_LANG_PUSH([C++])
+RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
+AC_LANG_POP([C++])
 
 dnl
 dnl  Debugging mode
@@ -1032,6 +1024,23 @@ AS_IF([test "${enable_coverage}" != "no"], [
   LDFLAGS_save="${LDFLAGS}"
 ])
 
+AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
+  AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
+                 [ac_cv_c_visibility_hidden], [
+    CFLAGS="${CFLAGS_save} -ffast-math"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
+      ac_cv_c_visibility_hidden=yes
+    ], [
+      ac_cv_c_visibility_hidden=no
+    ])
+  ])
+  AS_IF([test "${ac_cv_c_visibility_hidden}" != "no"], [
+    CFLAGS="${CFLAGS} -fvisibility=hidden"
+    CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
+    OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
+  ])
+])
+
 VLC_SAVE_FLAGS
 
 dnl
@@ -1290,7 +1299,6 @@ AS_IF([test "${enable_mmx}" != "no"], [
   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
     AC_DEFINE(HAVE_MMX_INTRINSICS, 1,
               [Define to 1 if MMX intrinsics are available.])
-    MMX_CFLAGS="-mmmx"
   ])
 
   AC_CACHE_CHECK([if $CC groks MMX inline assembly],
@@ -1315,7 +1323,6 @@ AS_IF([test "${enable_mmx}" != "no"], [
     have_mmxext="yes"
   ])
 ])
-AC_SUBST(MMX_CFLAGS)
 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
 
@@ -1326,7 +1333,7 @@ AC_ARG_ENABLE(sse,
   [AS_HELP_STRING([--disable-sse],
     [disable SSE (1-4) optimizations (default auto)])],, [
   case "${host_cpu}" in
-    i686|x86_64)
+    i?86|x86_64)
       enable_sse=yes
       ;;
     *)
@@ -1358,7 +1365,6 @@ AS_IF([test "${enable_sse}" != "no"], [
   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1,
               [Define to 1 if SSE2 intrinsics are available.])
-    SSE2_CFLAGS="-msse2"
   ])
 
   AC_CACHE_CHECK([if $CC groks SSE inline assembly],
@@ -1431,7 +1437,6 @@ AS_IF([test "${enable_sse}" != "no"], [
     AC_DEFINE(CAN_COMPILE_SSE4A, 1,
               [Define to 1 if SSE4A inline assembly is available.]) ])
 ])
-AC_SUBST(SSE2_CFLAGS)
 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
 
 have_3dnow="no"
@@ -1499,8 +1504,6 @@ AS_IF([test "${enable_altivec}" = "yes"], [
     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
               [Define to 1 if AltiVec inline assembly is available.])
     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
-      VLC_ADD_CFLAGS([idctaltivec],[${ac_cv_altivec_inline}])
-      VLC_ADD_CFLAGS([motionaltivec],[${ac_cv_altivec_inline}])
       VLC_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
       VLC_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
@@ -1565,7 +1568,6 @@ dnl - Others: test should fail
     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1,
               [Define to 1 if C AltiVec extensions are available.])
     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
-    VLC_ADD_CFLAGS([idctaltivec motionaltivec],[${ac_cv_c_altivec}])
     VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
     have_altivec="yes"
   ])
@@ -1577,7 +1579,7 @@ dnl - Others: test should fail
      LDFLAGS="${LDFLAGS_save}"
     ])
   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
-    VLC_ADD_LDFLAGS([libvlccore idctaltivec motionaltivec memcpyaltivec],[-Wl,-framework,vecLib])
+    VLC_ADD_LDFLAGS([libvlccore memcpyaltivec],[-Wl,-framework,vecLib])
   ])
 ])
 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
@@ -1989,7 +1991,7 @@ fi
 dnl
 dnl  Blu-ray Disc Support with libbluray
 dnl
-PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2 ], (libbluray for Blu-ray disc support ) )
+PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2 libxml-2.0 >= 2.6 ], (libbluray for Blu-ray disc support ) )
 
 dnl
 dnl  OpenCV wrapper and example filters
@@ -2189,14 +2191,9 @@ fi
 dnl
 dnl  libdvbpsi check for ts mux/demux
 dnl
-PKG_WITH_MODULES([DVBPSI], [libdvbpsi],
-    VLC_ADD_PLUGIN([ts])
-    VLC_ADD_LIBS([ts],[-ldvbpsi])
-if test "${enable_sout}" != "no"; then
-    VLC_ADD_PLUGIN([mux_ts])
-    VLC_ADD_LIBS([mux_ts],[-ldvbpsi])
-fi
-)
+have_dvbpsi="no"
+PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
+AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
 
 dnl
 dnl  Screen capture module
@@ -3250,51 +3247,51 @@ dnl
 dnl  freetype module
 dnl
 AC_ARG_ENABLE(freetype,
-  [  --enable-freetype       freetype support (default enabled)])
+  [  --enable-freetype       freetype support   (default auto)])
 AC_ARG_ENABLE(fribidi,
-  [  --enable-fribidi        fribidi support (default enabled)])
+  [  --enable-fribidi        fribidi support    (default auto)])
 AC_ARG_ENABLE(fontconfig,
-  [  --enable-fontconfig     fontconfig support (default enabled)])
+  [  --enable-fontconfig     fontconfig support (default auto)])
+
 if test "${enable_freetype}" != "no"; then
-   PKG_CHECK_MODULES(FREETYPE, freetype2,[
-      VLC_ADD_PLUGIN([freetype])
+   PKG_CHECK_MODULES(FREETYPE, freetype2, [
       have_freetype=yes
+      VLC_ADD_PLUGIN([freetype])
       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
       if test "${SYS}" = "mingw32"; then
         VLC_ADD_LIBS([freetype],[-liconv -lz])
       fi
       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
 
+      AC_CHECK_HEADERS(Carbon/Carbon.h,
+                       [VLC_ADD_LDFLAGS([freetype],[-Wl,-framework,Carbon])])
+
+      dnl fontconfig support
       if test "${SYS}" != "mingw32"; then
           if test "${enable_fontconfig}" != "no"; then
-            AC_CHECK_HEADERS(fontconfig/fontconfig.h,
-              [VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
-               VLC_ADD_LIBS([freetype],[-lfontconfig])])
-            AC_CHECK_HEADERS(Carbon/Carbon.h,
-              [VLC_ADD_LDFLAGS([freetype],[-Wl,-framework,Carbon])])
+            AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
+              VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
+              VLC_ADD_LIBS([freetype],[-lfontconfig])
+            ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
           fi
       else
           VLC_ADD_LIBS([freetype],[-lgdi32])
       fi
 
       dnl fribidi support
-      if test "${enable_fribidi}" != "no"
-      then
+      if test "${enable_fribidi}" != "no"; then
         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
-        ])
+        ],[AC_MSG_WARN([library fribidi not found. Bidirectional support will be disabled in freetype])])
       fi
 
   ],[
   have_freetype=no
-  AS_IF([ test "${enable_freetype}" =  "yes"],[
-    AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
-from http://www.freetype.org/, or configure with --disable-freetype. Have a nice day.
-      ])
+  AS_IF([ test "${enable_freetype}" = "yes"],[
+    AC_MSG_ERROR([Freetype2 package cannot be detected. Install Freetype2 development or configure with --disable-freetype.])
     ])
   ])
-
 fi
 
 dnl
@@ -3778,6 +3775,7 @@ then
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,Carbon])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,CoreServices])
   VLC_ADD_LDFLAGS([macosx minimal_macosx],            [-Wl,-framework,AGL])
+  VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,QTKit])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,IOKit])
   VLC_ADD_LDFLAGS([macosx],                           [-F${CONTRIB_DIR}/Sparkle -Wl,-framework,Sparkle])
   VLC_ADD_OBJCFLAGS([macosx],                         [-F${CONTRIB_DIR}/Sparkle])