diff --git a/bin/vlc.c b/bin/vlc.c index 3a15722d77..5220618e07 100644 --- a/bin/vlc.c +++ b/bin/vlc.c @@ -33,7 +33,9 @@ #include #include #include - +#ifdef HAVE_X11_XLIB_H +# include +#endif /* Explicit HACK */ extern void LocaleFree (const char *); @@ -82,6 +84,15 @@ int main( int i_argc, const char *ppsz_argv[] ) # endif #endif +#ifdef HAVE_X11_XLIB_H + /* Initialize Xlib thread support. */ + if (!XInitThreads ()) + { + fputs ("VLC requires a thread-safe Xlib. Sorry.\n", stderr); + return 1; + } +#endif + /* Synchronously intercepted POSIX signals. * * In a threaded program such as VLC, the only sane way to handle signals diff --git a/configure.ac b/configure.ac index 8e34d40162..568932b7c2 100644 --- a/configure.ac +++ b/configure.ac @@ -3964,6 +3964,9 @@ AC_ARG_ENABLE(x11, CPPFLAGS="${CPPFLAGS_save} ${X_CFLAGS}" AC_CHECK_HEADERS(X11/Xlib.h, [ + VLC_ADD_CPPFLAGS([vlc], [${X_CFLAGS}]) + VLC_ADD_LIBS([vlc], [${X_LIBS} ${X_PRE_LIBS} -lX11]) + VLC_ADD_PLUGIN([screen]) VLC_ADD_CPPFLAGS([screen],[${X_CFLAGS}]) VLC_ADD_LIBS([screen],[${X_LIBS} ${X_PRE_LIBS} -lX11])