diff options
author | Matt Messier <mmessier@grapetv.org> | 2007-05-04 17:04:36 -0400 |
---|---|---|
committer | Matt Messier <mmessier@grapetv.org> | 2007-05-04 17:04:36 -0400 |
commit | c2b75ba4b4c9d61e44494e24e3eee22725eb493e (patch) | |
tree | a11055673397744fc742d0029e8598de868898c2 /m4 | |
parent | d190eb0b00bcf150586c2b1d499c0c781be19289 (diff) | |
download | xine-lib-c2b75ba4b4c9d61e44494e24e3eee22725eb493e.tar.gz xine-lib-c2b75ba4b4c9d61e44494e24e3eee22725eb493e.tar.bz2 |
Move a bunch of x11/xv related stuff out of configure.ac
Diffstat (limited to 'm4')
-rw-r--r-- | m4/Makefile.am | 1 | ||||
-rw-r--r-- | m4/x11.m4 | 54 | ||||
-rw-r--r-- | m4/xv.m4 | 202 |
3 files changed, 257 insertions, 0 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am index 10ac6f002..ca42405a5 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -31,5 +31,6 @@ EXTRA_DIST = \ summary.m4 \ xine.m4 \ _xine.m4 \ + x11.m4 \ xv.m4 \ vcd.m4 diff --git a/m4/x11.m4 b/m4/x11.m4 new file mode 100644 index 000000000..d8a951b19 --- /dev/null +++ b/m4/x11.m4 @@ -0,0 +1,54 @@ +dnl --------------------------------------------- +dnl Checks for X11 +dnl --------------------------------------------- + +AC_DEFUN([XINE_X11_SUPPORT], [ + if test "x$with_x" != "xno"; then + PKG_CHECK_MODULES([X], [x11 xext], , [ + AC_PATH_XTRA + + dnl Set xv_path if its not done already + dnl we do it here before rewriting X_LIBS + if test x$xv_path = x; then + xv_path=`echo $X_LIBS | sed -e 's/\-L\(.*\)/\1/'` + fi + + dnl ---------------------------------------------- + dnl Check for XShm support (required with X) + dnl ---------------------------------------------- + + if test "x$no_x" != "xyes"; then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_CHECK_HEADERS([X11/extensions/XShm.h], [true], + [AC_MSG_ERROR([XShm extension is required])]) + AC_CHECK_LIB([Xext], [main], [true], + [AC_MSG_ERROR([libXext is required])], [$X_LIBS]) + CPPFLAGS="$ac_save_CPPFLAGS" + X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXext" + fi + ]) + else + no_x="yes" + fi + + if test "x$no_x" != "xyes"; then + AC_DEFINE(HAVE_X11,1,[Define this if you have X11R6 installed]) + fi + AM_CONDITIONAL(HAVE_X11, [test "x$no_x" != "xyes"]) + + + dnl --------------------------------------------- + dnl Locate libraries needed for X health check + dnl --------------------------------------------- + +soname_script="/[[0-9]]$/! d; s%^.*/%% +t q +b +:q +q" + x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libX11.so"* "${x_libraries:-/usr/lib}/libX11.so"* 2>/dev/null | sed -e \"${soname_script}\"`" + AC_DEFINE_UNQUOTED([LIBX11_SO], "${x_lib_location:-libX11.so}", [The soname of libX11, needed for dlopen()]) + x_lib_location="`ls -1 "${x_libraries:-/usr/local/lib}/libXv.so"* "${x_libraries:-/usr/lib}/libXv.so"* 2>/dev/null | sed -e \"${soname_script}\"`" + AC_DEFINE_UNQUOTED([LIBXV_SO], "${x_lib_location:-libXv.so}", [The soname of libXv, needed for dlopen()]) +]) @@ -91,3 +91,205 @@ AC_DEFUN([AC_FIND_LIBXV], AC_TEST_LIBXV fi ]) + +dnl ---------------------------------------------- +dnl Check for Xv and XvMC support +dnl ---------------------------------------------- + +AC_DEFUN([XINE_XV_SUPPORT], [ + dnl With recent XFree86 or Xorg, dynamic linking is preferred! + dnl Only dynamic linking is possible when using libtool < 1.4.0 + + AC_ARG_WITH(xv-path, AS_HELP_STRING([--with-xv-path=path], [where libXv is installed]), + xv_path="$withval",) + + AC_ARG_ENABLE([static-xv], + AS_HELP_STRING([--enable-static-xv],[Enable this to force linking against libXv.a])) + + if test "x$enable_static_xv" = "xyes"; then + xv_prefer_shared="no" + else + xv_prefer_shared="yes" + fi + + if test "x$no_x" != "xyes"; then + PKG_CHECK_MODULES([XV], [xv], [ + ac_have_xv="yes" + AC_DEFINE([HAVE_XV], [1], [Define this if you have libXv installed]) + ], [AC_FIND_LIBXV]) + fi + AM_CONDITIONAL(HAVE_XV, test "x$ac_have_xv" = "xyes") + + + host_or_hostalias="$host" + if test "$host_or_hostalias" = ""; then + dnl user has called ./configure with a host parameter unknown to + dnl config.sub; the canonical "$host" is empty + dnl + dnl Try the following switch with user's original host_alias + dnl input instead. + dnl + host_or_hostalias="$host_alias" + fi + + case "$host_or_hostalias" in + hppa*) + if test "x$ac_have_xv_static" = "xyes"; then + echo "warning: hppa linker - disabling static libXv" + XV_LIBS="libXv.so" + fi + ;; + + ppc-*-linux* | powerpc-*) + ppc_arch="yes" + ;; + + *) + ;; + esac + AM_CONDITIONAL(PPC_ARCH, test "x$ppc_arch" = "xyes") + + dnl + dnl Check if we can enable the xxmc plugin. + dnl + + AC_ARG_ENABLE([xvmc], + AS_HELP_STRING([--disable-xvmc], [Disable XxMC and XvMC outplut plugins]) ) + + if test "x$no_x" = "x" && test "x$enable_xvmc" != "xno"; then + + AC_ARG_WITH(xxmc-path, AS_HELP_STRING([--with-xxmc-path=path], [where libXvMC libraries for the + xxmc plugin are installed. Defalts to the default X library path.]), + xxmc_path="$withval", xxmc_path="$x_libraries") + AC_ARG_WITH(xxmc-lib, AS_HELP_STRING([--with-xxmc-lib=XXXX], [The name of the XvMC library + libXXXX.so for the xxmc plugin.]),xxmc_stub="$withval", + xxmc_stub="XvMCW") + + saved_libs="$LIBS" + saved_CPPFLAGS="$CPPFLAGS" + if test "x$x_includes" != "x"; then + CPPFLAGS="$CPPFLAGS -I$x_includes" + fi + + XXMC_LIBS="-L$xxmc_path -l$xxmc_stub" + AC_MSG_CHECKING(whether to enable the xxmc plugin with vld extensions) + AC_MSG_RESULT() + dnl Check if vld "extended" XvMC is available + if test "x$xxmc_stub" == "xXvMCW" && test "x$ac_have_xv" == "xyes"; then + AC_CHECK_LIB($xxmc_stub, XvMCPutSlice, + ac_have_xxmc="yes", + [ac_have_xxmc="no" + AC_MSG_RESULT([*** Could not link with -l$xxmc_stub for vld extensions.])], + [-L$xxmc_path $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + if test "x$ac_have_xv" = "xyes"; then + AC_CHECK_LIB($xxmc_stub, XvMCPutSlice, + [ac_have_xxmc="yes" + XXMC_LIBS="$XXMC_LIBS -lXvMC"], + [ac_have_xxmc="no" + AC_MSG_RESULT([*** Could not link with -l$xxmc_stub -lXvMC for vld extensions.])], + [-L$xxmc_path -lXvMC $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + ac_have_xxmc="no", + fi + fi + + if test "x$ac_have_xxmc" = "xyes"; then + AC_CHECK_HEADERS(X11/extensions/vldXvMC.h, + [ac_have_vldxvmc_h="yes"], + ac_have_vldxvmc="no",) + if test "x$ac_have_vldxvmc_h" = "xyes"; then + AC_DEFINE([HAVE_VLDXVMC], [1], + [Define 1 if you have vldXvMC.h]) + fi + fi + dnl Try fallback to standard XvMC if vld failed + if test "x$ac_have_xxmc" = "xno"; then + if test "x$xxmc_stub" == "xXvMCW"; then + AC_CHECK_LIB($xxmc_stub, XvMCCreateContext, + ac_have_xxmc="yes", + [ac_have_xxmc="no" + AC_MSG_RESULT([*** Could not link with -l$xxmc_stub for standard XvMC.])], + [-L$xxmc_path $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + if test "x$ac_have_xv" = "xyes"; then + AC_CHECK_LIB($xxmc_stub, XvMCCreateContext, + [ac_have_xxmc="yes" + XXMC_LIBS="$XXMC_LIBS -lXvMC"], + [ac_have_xxmc="no" + AC_MSG_RESULT([*** Could not link with -lXvMC for standard XvMC.])], + [-L$xxmc_path -lXvMC $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + ac_have_xxmc="no", + fi + fi + fi + if test "x$ac_have_xxmc" = "xyes"; then + AC_CHECK_HEADERS(X11/extensions/XvMC.h,, + ac_have_xxmc="no",) + fi + if test "x$ac_have_xxmc" = "xyes"; then + AC_DEFINE(HAVE_XXMC,1,[Define this to compile the xxmc plugin.]) + if test "x$ac_have_vldxvmc_h" = "xyes"; then + AC_MSG_RESULT([*** Enabling xxmc plugin with vld extensions.]) + else + AC_MSG_RESULT([*** Enabling xxmc plugin for standard XvMC *only*.]) + fi + else + AC_MSG_RESULT([*** Disabling xxmc plugin due to above errors.]) + fi + LIBS="$saved_libs" + fi + AM_CONDITIONAL(HAVE_VLDXVMC, test "x$ac_have_vldxvmc_h" = "xyes") + AM_CONDITIONAL(HAVE_XXMC, test "x$ac_have_xxmc" = "xyes") + AC_SUBST(XXMC_LIBS) + + dnl + dnl Check if we can enable the xvmc plugin. + dnl + if test "x$no_x" = "x" && test "x$enable_xvmc" != "xno"; then + + AC_ARG_WITH(xvmc-path, AS_HELP_STRING([--with-xvmc-path=path], [where libXvMC libraries for the + xvmc plugin are installed. Defalts to the default X library path.]), + xvmc_path="$withval", xvmc_path="$x_libraries") + AC_ARG_WITH(xvmc-lib, AS_HELP_STRING([--with-xvmc-lib=XXXX], [The name of the XvMC library + libXXXX.so for the xvmc plugin.]),xvmc_stub="$withval", + xvmc_stub="XvMCW") + saved_libs="$LIBS" + XVMC_LIBS="-L$xvmc_path -l$xvmc_stub" + AC_MSG_CHECKING(whether to enable the xvmc plugin) + AC_MSG_RESULT() + if test "x$xvmc_stub" == "xXvMCW"; then + AC_CHECK_LIB($xvmc_stub, XvMCCreateContext, + ac_have_xvmc="yes", + [ac_have_xvmc="no" + AC_MSG_RESULT([*** Could not link with -l$xvmc_stub.])], + [-L$xvmc_path $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + if test "x$ac_have_xv" = "xyes"; then + AC_CHECK_LIB($xvmc_stub, XvMCCreateContext, + [ac_have_xvmc="yes" + XVMC_LIBS="$XVMC_LIBS -lXvMC"], + [ac_have_xvmc="no" + AC_MSG_RESULT([*** Could not link with -lXvMC.])], + [-L$xvmc_path -lXvMC $X_LIBS $X_PRE_LIBS $XV_LIBS -lXext $X_EXTRA_LIBS]) + else + ac_have_xvmc="no", + fi + fi + if test "x$ac_have_xvmc" = "xyes"; then + AC_CHECK_HEADERS(X11/extensions/XvMC.h,, + ac_have_xvmc="no",) + fi + if test "x$ac_have_xvmc" = "xyes"; then + AC_DEFINE(HAVE_XVMC,1,[Define this if you have an XvMC library and XvMC.h installed.]) + AC_MSG_RESULT([*** Enabling old xvmc plugin.]) + else + AC_MSG_RESULT([*** Disabling old xvmc plugin due to above errors.]) + fi + CPPFLAGS="$saved_CPPFLAGS" + LIBS="$saved_libs" + fi + AM_CONDITIONAL(HAVE_XVMC, test "x$ac_have_xvmc" = "xyes") + AC_SUBST(XVMC_LIBS) +]) |