]> git.sesse.net Git - vlc/commitdiff
* XVideo plugin courtesy of Shane Harper <shanegh@optusnet.com.au>
authorSam Hocevar <sam@videolan.org>
Sun, 1 Apr 2001 06:21:44 +0000 (06:21 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 1 Apr 2001 06:21:44 +0000 (06:21 +0000)
  * Makefile.in and configure.in fixes by Nilmoni Deb <ndeb@ece.cmu.edu>
  * A few syntax fixes in the plain X11 plugin

AUTHORS
Makefile.in
configure
configure.in
plugins/x11/vout_x11.c
plugins/x11/vout_xvideo.c [new file with mode: 0644]
plugins/x11/xvideo.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index d8690e14b76587946ed712482b7d2f2a3b1dd665..0e52cffb6759604c2b1009d3ec90d82f23903e3e 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,7 +16,7 @@ D: directory browsing code in modules.c
 N: Stéphane Borel
 E: stef@via.ecp.fr
 D: MPEG video decoder
-D: DVD input
+D: DVD input, IFO parsing, CSS decryption
 
 N: Arnaud de Bossoreille de Ribou
 E: bozo@via.ecp.fr
@@ -30,6 +30,10 @@ N: Renaud Dartus
 E: reno@via.ecp.fr
 D: AC3 decoder
 
+N: Nilmoni Deb
+E: ndeb@ece.cmu.edu
+D: Minor configure.in and Makefile.in fixes
+
 N: Colin Delacroix
 E: colin@zoy.org
 D: MacOS X sound support
@@ -55,6 +59,8 @@ D: Bug fixes
 N: Shane Harper
 E: shanegh@optusnet.com.au
 D: SDL plugin fixes and enhancements
+D: XVideo video output
+D: Gnome and Gtk+ interface enhancements
 
 N: Gaël Hendryckx
 E: jimmy@via.ecp.fr
index 8b95020fc2a6dd1fc31583d968c759f3c398449a..4b95240734baac78713ab0a529b0c643d0703a82 100644 (file)
@@ -28,10 +28,6 @@ libdir=@libdir@
 CC=@CC@
 SHELL=@SHELL@
 
-LIB_SDL=@LIB_SDL@
-LIB_GLIDE=@LIB_GLIDE@
-LIB_GGI=@LIB_GGI@
-
 #----------------- do not change anything below this line ----------------------
 
 ################################################################################
@@ -73,6 +69,7 @@ endif
 #
 # C headers directories
 #
+INCLUDE += @INCLUDE@
 INCLUDE += -Iinclude -I/usr/local/include
 
 #
@@ -423,7 +420,10 @@ PLUGIN_SDL =       plugins/sdl/sdl.o \
 PLUGIN_TS =    plugins/mpeg/ts.o \
                plugins/mpeg/input_ts.o
 
-PLUGIN_X11=    plugins/x11/x11.o \
+PLUGIN_XVIDEO =        plugins/x11/xvideo.o \
+               plugins/x11/vout_xvideo.o
+
+PLUGIN_X11 =   plugins/x11/x11.o \
                plugins/x11/vout_x11.o
 
 PLUGIN_YUV =   plugins/yuv/yuv.o \
@@ -464,6 +464,7 @@ STD_PLUGIN_OBJ = \
 
 NONSTD_PLUGIN_OBJ = \
                $(PLUGIN_X11) \
+               $(PLUGIN_XVIDEO) \
                $(PLUGIN_GLIDE) \
                $(PLUGIN_GTK) \
                $(PLUGIN_GNOME) \
@@ -607,6 +608,11 @@ $(STD_PLUGIN_OBJ): %.o: .dep/%.d
 $(STD_PLUGIN_OBJ): %.o: %.c
        $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
 
+$(PLUGIN_XVIDEO): %.o: Makefile.dep
+$(PLUGIN_XVIDEO): %.o: .dep/%.d
+$(PLUGIN_XVIDEO): %.o: %.c
+       $(CC) $(CFLAGS) $(PCFLAGS) -I/usr/X11R6/include -c -o $@ $<
+
 $(PLUGIN_X11): %.o: Makefile.dep
 $(PLUGIN_X11): %.o: .dep/%.d
 $(PLUGIN_X11): %.o: %.c
@@ -693,10 +699,10 @@ lib/fb.so: $(PLUGIN_FB)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
 
 lib/ggi.so: $(PLUGIN_GGI)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_GGI)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) @LIB_GGI@
 
 lib/glide.so: $(PLUGIN_GLIDE)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_GLIDE)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) @LIB_GLIDE@
 
 lib/gnome.so: $(PLUGIN_GNOME)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
@@ -750,7 +756,7 @@ lib/qt.so: $(PLUGIN_QT)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -lqt -L${QTDIR}/lib
 
 lib/sdl.so: $(PLUGIN_SDL)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_SDL)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) @LIB_SDL@
 
 lib/ts.so: $(PLUGIN_TS)
 ifeq ($(SYS),darwin)
@@ -759,6 +765,13 @@ else
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
 endif
 
+lib/xvideo.so: $(PLUGIN_XVIDEO)
+ifeq ($(SYS),nto-qnx)
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXv -lsocket
+else
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXv
+endif
+
 lib/x11.so: $(PLUGIN_X11)
 ifeq ($(SYS),nto-qnx)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lsocket
index 2a6bc061fc619f762ee5b44277c1c720226bfa64..31da30c7a75759e47cc224641ed76db4f86a8972 100755 (executable)
--- a/configure
+++ b/configure
@@ -57,6 +57,8 @@ ac_help="$ac_help
   --disable-gtk           Gtk+ support (default enabled)"
 ac_help="$ac_help
   --disable-x11           X11 support (default enabled)"
+ac_help="$ac_help
+  --enable-xvideo         XVideo interface support (default disabled)"
 ac_help="$ac_help
   --enable-alsa           Alsa sound drivers support (Only for linux) (default disabled)"
 
@@ -597,7 +599,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:601: checking host system type" >&5
+echo "configure:603: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -624,7 +626,7 @@ VLC_CODENAME=Urumov
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:628: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:630: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -654,7 +656,7 @@ if test -z "$CC"; then
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:658: checking for $ac_word" >&5
+echo "configure:660: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -684,7 +686,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:688: checking for $ac_word" >&5
+echo "configure:690: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -735,7 +737,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:739: checking for $ac_word" >&5
+echo "configure:741: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -767,7 +769,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:771: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:773: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -778,12 +780,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 782 "configure"
+#line 784 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -809,12 +811,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:813: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:818: checking whether we are using GNU C" >&5
+echo "configure:820: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -823,7 +825,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -842,7 +844,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:846: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:848: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -876,7 +878,7 @@ fi
 fi
 if test -z "$CPP"; then
   echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:880: checking how to run the C preprocessor" >&5
+echo "configure:882: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -891,13 +893,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 895 "configure"
+#line 897 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -908,13 +910,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 912 "configure"
+#line 914 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -925,13 +927,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 929 "configure"
+#line 931 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -969,7 +971,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:973: checking for a BSD compatible install" >&5
+echo "configure:975: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1023,12 +1025,12 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1027: checking for working const" >&5
+echo "configure:1029: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1032 "configure"
+#line 1034 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1077,7 +1079,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1098,14 +1100,14 @@ EOF
 fi
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1102: checking whether byte ordering is bigendian" >&5
+echo "configure:1104: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 1109 "configure"
+#line 1111 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1116,11 +1118,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:1120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 1124 "configure"
+#line 1126 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1131,7 +1133,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:1135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -1151,7 +1153,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 1155 "configure"
+#line 1157 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -1164,7 +1166,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -1191,12 +1193,12 @@ fi
 for ac_func in gettimeofday select strerror strtod strtol
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1195: checking for $ac_func" >&5
+echo "configure:1197: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1200 "configure"
+#line 1202 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1219,7 +1221,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1246,12 +1248,12 @@ done
 for ac_func in setenv putenv
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1250: checking for $ac_func" >&5
+echo "configure:1252: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1255 "configure"
+#line 1257 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1274,7 +1276,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1299,12 +1301,12 @@ fi
 done
 
 echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1303: checking for connect" >&5
+echo "configure:1305: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1308 "configure"
+#line 1310 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -1327,7 +1329,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -1345,7 +1347,7 @@ if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1349: checking for connect in -lsocket" >&5
+echo "configure:1351: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1353,7 +1355,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1357 "configure"
+#line 1359 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1364,7 +1366,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1394,12 +1396,12 @@ fi
 fi
 
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1398: checking for gethostbyname" >&5
+echo "configure:1400: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1403 "configure"
+#line 1405 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -1422,7 +1424,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -1440,7 +1442,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1444: checking for gethostbyname in -lnsl" >&5
+echo "configure:1446: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1448,7 +1450,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1452 "configure"
+#line 1454 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1459,7 +1461,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1489,12 +1491,12 @@ fi
 fi
 
 echo $ac_n "checking for nanosleep""... $ac_c" 1>&6
-echo "configure:1493: checking for nanosleep" >&5
+echo "configure:1495: checking for nanosleep" >&5
 if eval "test \"`echo '$''{'ac_cv_func_nanosleep'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1498 "configure"
+#line 1500 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char nanosleep(); below.  */
@@ -1517,7 +1519,7 @@ nanosleep();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_nanosleep=yes"
 else
@@ -1535,7 +1537,7 @@ if eval "test \"`echo '$ac_cv_func_'nanosleep`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for nanosleep in -lrt""... $ac_c" 1>&6
-echo "configure:1539: checking for nanosleep in -lrt" >&5
+echo "configure:1541: checking for nanosleep in -lrt" >&5
 ac_lib_var=`echo rt'_'nanosleep | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1543,7 +1545,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1547 "configure"
+#line 1549 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1554,7 +1556,7 @@ int main() {
 nanosleep()
 ; return 0; }
 EOF
-if { (eval echo configure:1558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1580,7 +1582,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6
-echo "configure:1584: checking for nanosleep in -lposix4" >&5
+echo "configure:1586: checking for nanosleep in -lposix4" >&5
 ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1588,7 +1590,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1592 "configure"
+#line 1594 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1599,7 +1601,7 @@ int main() {
 nanosleep()
 ; return 0; }
 EOF
-if { (eval echo configure:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1633,12 +1635,12 @@ fi
 for ac_func in usleep
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1637: checking for $ac_func" >&5
+echo "configure:1639: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1642 "configure"
+#line 1644 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1661,7 +1663,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1686,12 +1688,12 @@ fi
 done
 
 echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
-echo "configure:1690: checking for inet_aton" >&5
+echo "configure:1692: checking for inet_aton" >&5
 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1695 "configure"
+#line 1697 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char inet_aton(); below.  */
@@ -1714,7 +1716,7 @@ inet_aton();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_inet_aton=yes"
 else
@@ -1732,7 +1734,7 @@ if eval "test \"`echo '$ac_cv_func_'inet_aton`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
-echo "configure:1736: checking for inet_aton in -lresolv" >&5
+echo "configure:1738: checking for inet_aton in -lresolv" >&5
 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1740,7 +1742,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1744 "configure"
+#line 1746 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1751,7 +1753,7 @@ int main() {
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1783,12 +1785,12 @@ fi
 for ac_func in vasprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1787: checking for $ac_func" >&5
+echo "configure:1789: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1792 "configure"
+#line 1794 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1811,7 +1813,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1839,17 +1841,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1843: checking for $ac_hdr" >&5
+echo "configure:1845: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1848 "configure"
+#line 1850 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1878,12 +1880,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1882: checking for $ac_func" >&5
+echo "configure:1884: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1887 "configure"
+#line 1889 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1906,7 +1908,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1931,7 +1933,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1935: checking for working mmap" >&5
+echo "configure:1937: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1939,7 +1941,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1943 "configure"
+#line 1945 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2079,7 +2081,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -2102,12 +2104,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2106: checking return type of signal handlers" >&5
+echo "configure:2108: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2111 "configure"
+#line 2113 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2124,7 +2126,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2143,7 +2145,7 @@ EOF
 
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2147: checking for dlopen in -ldl" >&5
+echo "configure:2149: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2151,7 +2153,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2155 "configure"
+#line 2157 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2162,7 +2164,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2190,7 +2192,7 @@ else
 fi
 
 echo $ac_n "checking for optarg in -lgnugetopt""... $ac_c" 1>&6
-echo "configure:2194: checking for optarg in -lgnugetopt" >&5
+echo "configure:2196: checking for optarg in -lgnugetopt" >&5
 ac_lib_var=`echo gnugetopt'_'optarg | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2198,7 +2200,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgnugetopt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2202 "configure"
+#line 2204 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2209,7 +2211,7 @@ int main() {
 optarg()
 ; return 0; }
 EOF
-if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2237,7 +2239,7 @@ else
 fi
 
 echo $ac_n "checking for _ in -lbe""... $ac_c" 1>&6
-echo "configure:2241: checking for _ in -lbe" >&5
+echo "configure:2243: checking for _ in -lbe" >&5
 ac_lib_var=`echo be'_'_ | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2245,7 +2247,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbe  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2249 "configure"
+#line 2251 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2256,7 +2258,7 @@ int main() {
 _()
 ; return 0; }
 EOF
-if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2284,7 +2286,7 @@ else
 fi
 
 echo $ac_n "checking for _ in -lgame""... $ac_c" 1>&6
-echo "configure:2288: checking for _ in -lgame" >&5
+echo "configure:2290: checking for _ in -lgame" >&5
 ac_lib_var=`echo game'_'_ | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2292,7 +2294,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgame  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2296 "configure"
+#line 2298 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2303,7 +2305,7 @@ int main() {
 _()
 ; return 0; }
 EOF
-if { (eval echo configure:2307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2331,7 +2333,7 @@ else
 fi
 
 echo $ac_n "checking for _ in -lroot""... $ac_c" 1>&6
-echo "configure:2335: checking for _ in -lroot" >&5
+echo "configure:2337: checking for _ in -lroot" >&5
 ac_lib_var=`echo root'_'_ | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2339,7 +2341,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lroot  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2343 "configure"
+#line 2345 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2350,7 +2352,7 @@ int main() {
 _()
 ; return 0; }
 EOF
-if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2378,7 +2380,7 @@ else
 fi
 
 echo $ac_n "checking for powl in -lm""... $ac_c" 1>&6
-echo "configure:2382: checking for powl in -lm" >&5
+echo "configure:2384: checking for powl in -lm" >&5
 ac_lib_var=`echo m'_'powl | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2386,7 +2388,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
+#line 2392 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2397,7 +2399,7 @@ int main() {
 powl()
 ; return 0; }
 EOF
-if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2425,7 +2427,7 @@ else
 fi
 
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2429: checking for pthread_create in -lpthread" >&5
+echo "configure:2431: checking for pthread_create in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2433,7 +2435,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2437 "configure"
+#line 2439 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2444,7 +2446,7 @@ int main() {
 pthread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:2448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2472,7 +2474,7 @@ else
 fi
 
 echo $ac_n "checking for thread_create in -lthreads""... $ac_c" 1>&6
-echo "configure:2476: checking for thread_create in -lthreads" >&5
+echo "configure:2478: checking for thread_create in -lthreads" >&5
 ac_lib_var=`echo threads'_'thread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2480,7 +2482,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2484 "configure"
+#line 2486 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2491,7 +2493,7 @@ int main() {
 thread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2520,12 +2522,12 @@ fi
 
 
 echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
-echo "configure:2524: checking for getopt_long" >&5
+echo "configure:2526: checking for getopt_long" >&5
 if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2529 "configure"
+#line 2531 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char getopt_long(); below.  */
@@ -2548,7 +2550,7 @@ getopt_long();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_getopt_long=yes"
 else
@@ -2575,17 +2577,17 @@ for ac_hdr in stddef.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2579: checking for $ac_hdr" >&5
+echo "configure:2581: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2584 "configure"
+#line 2586 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2615,17 +2617,17 @@ for ac_hdr in getopt.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2619: checking for $ac_hdr" >&5
+echo "configure:2621: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2624 "configure"
+#line 2626 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2655,17 +2657,17 @@ for ac_hdr in sys/sockio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2659: checking for $ac_hdr" >&5
+echo "configure:2661: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
+#line 2666 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2695,17 +2697,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2699: checking for $ac_hdr" >&5
+echo "configure:2701: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2704 "configure"
+#line 2706 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2735,17 +2737,17 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2739: checking for $ac_hdr" >&5
+echo "configure:2741: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2744 "configure"
+#line 2746 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2775,17 +2777,17 @@ for ac_hdr in dlfcn.h image.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2779: checking for $ac_hdr" >&5
+echo "configure:2781: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2784 "configure"
+#line 2786 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2815,17 +2817,17 @@ for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2819: checking for $ac_hdr" >&5
+echo "configure:2821: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2824 "configure"
+#line 2826 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2855,17 +2857,17 @@ for ac_hdr in machine/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2859: checking for $ac_hdr" >&5
+echo "configure:2861: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2864 "configure"
+#line 2866 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2896,17 +2898,17 @@ for ac_hdr in cthreads.h pthread.h kernel/scheduler.h kernel/OS.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2900: checking for $ac_hdr" >&5
+echo "configure:2902: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2905 "configure"
+#line 2907 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2937,9 +2939,9 @@ save_CFLAGS=$CFLAGS
 
 CFLAGS="${CFLAGS} -Wall -Werror"
 echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6
-echo "configure:2941: checking for ntohl in sys/param.h" >&5
+echo "configure:2943: checking for ntohl in sys/param.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2943 "configure"
+#line 2945 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 void foo() { int meuh; ntohl(meuh); }
@@ -2947,7 +2949,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define NTOHL_IN_SYS_PARAM_H 1
@@ -2964,16 +2966,16 @@ rm -f conftest*
 
 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
 echo $ac_n "checking if \$CC accepts -rdynamic""... $ac_c" 1>&6
-echo "configure:2968: checking if \$CC accepts -rdynamic" >&5
+echo "configure:2970: checking if \$CC accepts -rdynamic" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2970 "configure"
+#line 2972 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   DYNAMIC_FLAG="-rdynamic"
  echo "$ac_t""yes" 1>&6
@@ -2988,9 +2990,9 @@ rm -f conftest*
 CFLAGS=$save_CFLAGS
 
 echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2992: checking for boolean_t in sys/types.h" >&5
+echo "configure:2994: checking for boolean_t in sys/types.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2994 "configure"
+#line 2996 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 void quux() { boolean_t foo; }
@@ -2998,7 +3000,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3004: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define BOOLEAN_T_IN_SYS_TYPES_H 1
@@ -3013,9 +3015,9 @@ else
 fi
 rm -f conftest*
 echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6
-echo "configure:3017: checking for boolean_t in pthread.h" >&5
+echo "configure:3019: checking for boolean_t in pthread.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 3019 "configure"
+#line 3021 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 void quux() { boolean_t foo; }
@@ -3023,7 +3025,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define BOOLEAN_T_IN_PTHREAD_H 1
@@ -3039,12 +3041,12 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3043: checking for working const" >&5
+echo "configure:3045: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3048 "configure"
+#line 3050 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3093,7 +3095,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3114,12 +3116,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3118: checking for ANSI C header files" >&5
+echo "configure:3120: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3123 "configure"
+#line 3125 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3127,7 +3129,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3133: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3144,7 +3146,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3148 "configure"
+#line 3150 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3162,7 +3164,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3166 "configure"
+#line 3168 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3183,7 +3185,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3187 "configure"
+#line 3189 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3194,7 +3196,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:3198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3218,12 +3220,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3222: checking for size_t" >&5
+echo "configure:3224: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3227 "configure"
+#line 3229 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3251,12 +3253,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3255: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3257: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3260 "configure"
+#line 3262 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3265,7 +3267,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3297,17 +3299,17 @@ for ac_hdr in sys/ioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3301: checking for $ac_hdr" >&5
+echo "configure:3303: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3306 "configure"
+#line 3308 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3332,17 +3334,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3336: checking for $ac_hdr" >&5
+echo "configure:3338: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3341 "configure"
+#line 3343 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3346: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3369,7 +3371,7 @@ fi
 done
 
    cat > conftest.$ac_ext <<EOF
-#line 3373 "configure"
+#line 3375 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -3497,17 +3499,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3501: checking for $ac_hdr" >&5
+echo "configure:3503: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3506 "configure"
+#line 3508 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3570,23 +3572,24 @@ if test "${with_sdl+set}" = set; then
       PLUGINS=${PLUGINS}"sdl ";
       if test "x$withval" != "xyes";
       then
-        LIB_SDL="L/usr/X11R6/lib -l"$withval
+        LIB_SDL="-L/usr/X11R6/lib -L"$withval"/lib -l"$withval
+        INCLUDE=${INCLUDE}" -I"$withval"/include"
       else
         for ac_hdr in SDL/SDL.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3580: checking for $ac_hdr" >&5
+echo "configure:3583: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3585 "configure"
+#line 3588 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3590: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3624,17 +3627,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3628: checking for $ac_hdr" >&5
+echo "configure:3631: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3633 "configure"
+#line 3636 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3720,23 +3723,29 @@ if test "${enable_x11+set}" = set; then
 fi
 
 if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
+# Check whether --enable-xvideo or --disable-xvideo was given.
+if test "${enable_xvideo+set}" = set; then
+  enableval="$enable_xvideo"
+  if test x$enable_xvideo = xyes; then PLUGINS=${PLUGINS}"xvideo "; fi
+fi
+
 
 # Check whether --enable-alsa or --disable-alsa was given.
 if test "${enable_alsa+set}" = set; then
   enableval="$enable_alsa"
   if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
-echo "configure:3730: checking for sys/asoundlib.h" >&5
+echo "configure:3739: checking for sys/asoundlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3735 "configure"
+#line 3744 "configure"
 #include "confdefs.h"
 #include <sys/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3740: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3753,7 +3762,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
-echo "configure:3757: checking for main in -lasound" >&5
+echo "configure:3766: checking for main in -lasound" >&5
 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3761,14 +3770,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3765 "configure"
+#line 3774 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3814,6 +3823,7 @@ fi
 
 
 
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -3965,6 +3975,7 @@ s%@SYS@%$SYS%g
 s%@ARCH@%$ARCH%g
 s%@PLUGINS@%$PLUGINS%g
 s%@ALIASES@%$ALIASES%g
+s%@INCLUDE@%$INCLUDE%g
 s%@DEBUG@%$DEBUG%g
 s%@STATS@%$STATS%g
 s%@OPTIMS@%$OPTIMS%g
index 45251e488c1f24e91311eaa3d4999ab5bcaa2dc6..e5702d9ba67d8a014dd6db2192bfc8c851e27383 100644 (file)
@@ -198,7 +198,8 @@ AC_ARG_WITH(sdl,
       PLUGINS=${PLUGINS}"sdl ";
       if test "x$withval" != "xyes";
       then
-        LIB_SDL="L/usr/X11R6/lib -l"$withval
+        LIB_SDL="-L/usr/X11R6/lib -L"$withval"/lib -l"$withval
+        INCLUDE=${INCLUDE}" -I"$withval"/include"
       else
         AC_CHECK_HEADERS(SDL/SDL.h, , [echo "Cannot find SDL headers !"; exit])
         LIB_SDL="-L/usr/X11R6/lib -lSDL"
@@ -245,6 +246,9 @@ fi
 AC_ARG_ENABLE(x11,
   [  --disable-x11           X11 support (default enabled)])
 if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
+AC_ARG_ENABLE(xvideo,
+  [  --enable-xvideo         XVideo interface support (default disabled)],
+  [if test x$enable_xvideo = xyes; then PLUGINS=${PLUGINS}"xvideo "; fi])
 
 AC_ARG_ENABLE(alsa,
   [  --enable-alsa           Alsa sound drivers support (Only for linux) (default disabled)],
@@ -258,6 +262,7 @@ AC_SUBST(SYS)
 AC_SUBST(ARCH)
 AC_SUBST(PLUGINS)
 AC_SUBST(ALIASES)
+AC_SUBST(INCLUDE)
 AC_SUBST(DEBUG)
 AC_SUBST(STATS)
 AC_SUBST(OPTIMS)
index 5ab0b4960d14e1d97cd78ddec06602d4a4c91917..c8230ebafda9bedd1b1b5db1accbda1f70e5e87e 100644 (file)
@@ -2,7 +2,7 @@
  * vout_x11.c: X11 video output display method
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_x11.c,v 1.16 2001/03/16 22:37:06 massiot Exp $
+ * $Id: vout_x11.c,v 1.17 2001/04/01 06:21:44 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -178,7 +178,7 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        intf_ErrMsg( "vout error: %s", strerror(ENOMEM) );
         return( 1 );
     }
 
@@ -188,7 +188,7 @@ static int vout_Create( vout_thread_t *p_vout )
 
     if( p_vout->p_sys->p_display == NULL )                          /* error */
     {
-        intf_ErrMsg("error: can't open display %s\n", psz_display );
+        intf_ErrMsg( "vout error: cannot open display %s", psz_display );
         free( p_vout->p_sys );
         return( 1 );
     }
@@ -198,7 +198,7 @@ static int vout_Create( vout_thread_t *p_vout )
      * but also command buttons, subtitles and other indicators */
     if( X11CreateWindow( p_vout ) )
     {
-        intf_ErrMsg("error: can't create interface window\n" );
+        intf_ErrMsg( "vout error: cannot create X11 window" );
         XCloseDisplay( p_vout->p_sys->p_display );
         free( p_vout->p_sys );
         return( 1 );
@@ -210,7 +210,7 @@ static int vout_Create( vout_thread_t *p_vout )
      * id is still valid. */
     if( X11InitDisplay( p_vout, psz_display ) )
     {
-        intf_ErrMsg("error: can't initialize X11 display" );
+        intf_ErrMsg( "vout error: cannot initialize X11 display" );
         XCloseDisplay( p_vout->p_sys->p_display );
         free( p_vout->p_sys );
         return( 1 );
@@ -259,7 +259,7 @@ static int vout_Init( vout_thread_t *p_vout )
         }
         if( i_err )                                      /* an error occured */
         {
-            intf_Msg("vout: XShm video extension unavailable" );
+            intf_Msg( "vout: XShm video extension unavailable" );
             p_vout->p_sys->b_shm = 0;
         }
     }
@@ -269,14 +269,14 @@ static int vout_Init( vout_thread_t *p_vout )
     {
         if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[0] ) )
         {
-            intf_ErrMsg("error: can't create images");
+            intf_ErrMsg( "vout error: cannot create images" );
             p_vout->p_sys->p_ximage[0] = NULL;
             p_vout->p_sys->p_ximage[1] = NULL;
             return( 1 );
         }
         if( X11CreateImage( p_vout, &p_vout->p_sys->p_ximage[1] ) )
         {
-            intf_ErrMsg("error: can't create images");
+            intf_ErrMsg( "vout error: cannot create images" );
             X11DestroyImage( p_vout->p_sys->p_ximage[0] );
             p_vout->p_sys->p_ximage[0] = NULL;
             p_vout->p_sys->p_ximage[1] = NULL;
@@ -494,7 +494,7 @@ static int vout_Manage( vout_thread_t *p_vout )
      */
     if( p_vout->i_changes & VOUT_SIZE_CHANGE )
     {
-        intf_DbgMsg("resizing window");
+        intf_DbgMsg( "vout info: resizing window" );
         p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
 
         /* Resize window */
@@ -507,7 +507,7 @@ static int vout_Manage( vout_thread_t *p_vout )
         /* Recreate XImages. If SysInit failed, the thread can't go on. */
         if( vout_Init( p_vout ) )
         {
-            intf_ErrMsg("error: can't resize display");
+            intf_ErrMsg( "vout error: cannot resize display" );
             return( 1 );
        }
 
@@ -515,7 +515,8 @@ static int vout_Manage( vout_thread_t *p_vout )
          * tables. This is needed since conversion buffer size may have
          * changed */
         p_vout->i_changes |= VOUT_YUV_CHANGE;
-        intf_Msg("vout: video display resized (%dx%d)", p_vout->i_width, p_vout->i_height);
+        intf_Msg( "vout: video display resized (%dx%d)",
+                  p_vout->i_width, p_vout->i_height);
     }
 
     return 0;
@@ -734,7 +735,7 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
                                  == True );
     if( !p_vout->p_sys->b_shm )
     {
-        intf_Msg("vout: XShm video extension is not available");
+        intf_Msg( "vout: XShm video extension is not available" );
     }
 
     /* Get screen depth */
@@ -753,7 +754,7 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
-            intf_ErrMsg("vout error: no PseudoColor visual available");
+            intf_ErrMsg( "vout error: no PseudoColor visual available" );
             return( 1 );
         }
         p_vout->i_bytes_per_pixel = 1;
@@ -772,7 +773,7 @@ static int X11InitDisplay( vout_thread_t *p_vout, char *psz_display )
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
-            intf_ErrMsg("vout error: no TrueColor visual available");
+            intf_ErrMsg( "vout error: no TrueColor visual available" );
             return( 1 );
         }
         p_vout->i_red_mask =        p_xvisual->red_mask;
@@ -822,7 +823,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
     pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
     if( !pb_data )                                                  /* error */
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        intf_ErrMsg( "vout error: %s", strerror(ENOMEM));
         return( 1 );
     }
 
@@ -877,7 +878,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
                          p_shm_info, p_vout->i_width, p_vout->i_height );
     if(! *pp_ximage )                                               /* error */
     {
-        intf_ErrMsg("error: XShmCreateImage() failed");
+        intf_ErrMsg( "vout error: XShmCreateImage() failed" );
         return( 1 );
     }
 
@@ -888,7 +889,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
                                  * (*pp_ximage)->height, IPC_CREAT | 0777);
     if( p_shm_info->shmid < 0)                                      /* error */
     {
-        intf_ErrMsg("error: can't allocate shared image data (%s)",
+        intf_ErrMsg( "vout error: cannot allocate shared image data (%s)",
                     strerror(errno));
         XDestroyImage( *pp_ximage );
         return( 1 );
@@ -898,7 +899,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
     p_shm_info->shmaddr = (*pp_ximage)->data = shmat(p_shm_info->shmid, 0, 0);
     if(! p_shm_info->shmaddr )
     {                                                               /* error */
-        intf_ErrMsg("error: can't attach shared memory (%s)",
+        intf_ErrMsg( "vout error: cannot attach shared memory (%s)",
                     strerror(errno));
         shmctl( p_shm_info->shmid, IPC_RMID, 0 );      /* free shared memory */
         XDestroyImage( *pp_ximage );
@@ -914,7 +915,7 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
     if( XShmAttach( p_vout->p_sys->p_display, p_shm_info )
          == False )                                                 /* error */
     {
-        intf_ErrMsg("error: can't attach shared memory to X11 server");
+        intf_ErrMsg( "vout error: cannot attach shared memory to X11 server" );
         shmdt( p_shm_info->shmaddr );   /* detach shared memory from process
                                          * and automatic free */
         XDestroyImage( *pp_ximage );
@@ -962,7 +963,7 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
 
     if( shmdt( p_shm_info->shmaddr ) )  /* detach shared memory from process */
     {                                   /* also automatic freeing...         */
-        intf_ErrMsg( "error: can't detach shared memory (%s)",
+        intf_ErrMsg( "error: cannot detach shared memory (%s)",
                      strerror(errno) );
     }
 }
@@ -1002,7 +1003,7 @@ void X11DisableScreenSaver( vout_thread_t *p_vout )
                      &p_vout->p_sys->i_ss_exposure );
 
     /* Disable screen saver */
-    intf_DbgMsg("intf: disabling screen saver");
+    intf_DbgMsg( "vout: disabling screen saver" );
     XSetScreenSaver( p_vout->p_sys->p_display, 0,
                      p_vout->p_sys->i_ss_interval,
                      p_vout->p_sys->i_ss_blanking,
diff --git a/plugins/x11/vout_xvideo.c b/plugins/x11/vout_xvideo.c
new file mode 100644 (file)
index 0000000..f52f96a
--- /dev/null
@@ -0,0 +1,909 @@
+/*****************************************************************************
+ * vout_xvideo.c: Xvideo video output display method
+ *****************************************************************************
+ * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
+ * $Id: vout_xvideo.c,v 1.1 2001/04/01 06:21:44 sam Exp $
+ *
+ * Authors: Shane Harper <shanegh@optusnet.com.au>
+ *          Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME xvideo
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#ifdef HAVE_MACHINE_PARAM_H
+/* BSD */
+#include <machine/param.h>
+#include <sys/types.h>                                     /* typedef ushort */
+#include <sys/ipc.h>
+#endif
+
+#include <sys/shm.h>                                   /* shmget(), shmctl() */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+#include "modules.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "interface.h"
+#include "intf_msg.h"
+
+#include "main.h"
+
+/*****************************************************************************
+ * vout_sys_t: video output X11 method descriptor
+ *****************************************************************************
+ * This structure is part of the video output thread descriptor.
+ * It describes the X11 specific properties of an output thread. X11 video
+ * output is performed through regular resizable windows. Windows can be
+ * dynamically resized to adapt to the size of the streams.
+ *****************************************************************************/
+typedef struct vout_sys_s
+{
+    /* User settings */
+#if 0
+    /* this plugin (currently) requires the SHM Ext... */
+    boolean_t           b_shm;               /* shared memory extension flag */
+#endif
+
+    /* Internal settings and properties */
+    Display *           p_display;                        /* display pointer */
+    int                 i_screen;                           /* screen number */
+    Window              window;                               /* root window */
+    GC                  gc;              /* graphic context instance handler */
+    int                 xv_port;
+
+    /* Display buffers and shared memory information */
+    /* Note: only 1 buffer (I don't know why the X11 plugin had 2.) */
+    XvImage *           p_xvimage;
+    XShmSegmentInfo     shm_info;       /* shared memory zone information */
+
+    /* X11 generic properties */
+    Atom                wm_protocols;
+    Atom                wm_delete_window;
+
+    int                 i_width;                     /* width of main window */
+    int                 i_height;                   /* height of main window */
+
+    /* Screen saver properties */
+    int                 i_ss_timeout;                             /* timeout */
+    int                 i_ss_interval;           /* interval between changes */
+    int                 i_ss_blanking;                      /* blanking mode */
+    int                 i_ss_exposure;                      /* exposure mode */
+
+    /* Mouse pointer properties */
+    boolean_t           b_mouse;         /* is the mouse pointer displayed ? */
+
+} vout_sys_t;
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int  vout_Probe     ( probedata_t * );
+static int  vout_Create    ( vout_thread_t * );
+static int  vout_Init      ( vout_thread_t * );
+static void vout_End       ( vout_thread_t * );
+static void vout_Destroy   ( vout_thread_t * );
+static int  vout_Manage    ( vout_thread_t * );
+static void vout_Display   ( vout_thread_t * );
+static void vout_SetPalette( vout_thread_t *, u16 *, u16 *, u16 *, u16 * );
+
+static int  XVideoCreateWindow       ( vout_thread_t * );
+static int  XVideoCreateShmImage     ( vout_thread_t *, XvImage **,
+                                       XShmSegmentInfo *p_shm_info );
+static void XVideoDestroyShmImage    ( vout_thread_t *, XvImage *,
+                                       XShmSegmentInfo * );
+static void XVideoTogglePointer      ( vout_thread_t * );
+static void XVideoEnableScreenSaver  ( vout_thread_t * );
+static void XVideoDisableScreenSaver ( vout_thread_t * );
+
+static int  XVideoCheckForXv         ( Display * );
+static void XVideoOutputCoords       ( const picture_t *, const boolean_t,
+                                       const int, const int,
+                                       int *, int *, int *, int * );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( vout_getfunctions )( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = vout_Probe;
+    p_function_list->functions.vout.pf_create     = vout_Create;
+    p_function_list->functions.vout.pf_init       = vout_Init;
+    p_function_list->functions.vout.pf_end        = vout_End;
+    p_function_list->functions.vout.pf_destroy    = vout_Destroy;
+    p_function_list->functions.vout.pf_manage     = vout_Manage;
+    p_function_list->functions.vout.pf_display    = vout_Display;
+    p_function_list->functions.vout.pf_setpalette = vout_SetPalette;
+}
+
+/*****************************************************************************
+ * vout_Probe: probe the video driver and return a score
+ *****************************************************************************
+ * This returns a score to the plugin manager so that it can select the best
+ * plugin.
+ *****************************************************************************/
+static int vout_Probe( probedata_t *p_data )
+{
+    if( TestMethod( VOUT_METHOD_VAR, "xvideo" ) )
+    {
+        return( 999 );
+    }
+
+    return( 90 );
+}
+
+/*****************************************************************************
+ * vout_Create: allocate XVideo video thread output method
+ *****************************************************************************
+ * This function allocate and initialize a X11 vout method. It uses some of the
+ * vout properties to choose the window size, and change them according to the
+ * actual properties of the display.
+ *****************************************************************************/
+static int vout_Create( vout_thread_t *p_vout )
+{
+    char *psz_display;
+
+    /* Allocate structure */
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
+    if( p_vout->p_sys == NULL )
+    {
+        intf_ErrMsg( "vout error: %s", strerror(ENOMEM) );
+        return( 1 );
+    }
+
+    /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
+    psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
+    p_vout->p_sys->p_display = XOpenDisplay( psz_display );
+
+    if( p_vout->p_sys->p_display == NULL )                          /* error */
+    {
+        intf_ErrMsg( "vout error: cannot open display %s", psz_display );
+        free( p_vout->p_sys );
+        return( 1 );
+    }
+    p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
+
+    if( !XVideoCheckForXv( p_vout->p_sys->p_display ) )
+    {
+        intf_ErrMsg( "vout error: no XVideo extension" );
+        XCloseDisplay( p_vout->p_sys->p_display );
+        free( p_vout->p_sys );
+        return( 1 );
+    }
+
+    /* Spawn base window - this window will include the video output window,
+     * but also command buttons, subtitles and other indicators */
+    if( XVideoCreateWindow( p_vout ) )
+    {
+        intf_ErrMsg( "vout error: cannot create XVideo window" );
+        XCloseDisplay( p_vout->p_sys->p_display );
+        free( p_vout->p_sys );
+        return( 1 );
+    }
+
+    p_vout->p_sys->b_mouse = 1;
+
+    /* Disable screen saver and return */
+    XVideoDisableScreenSaver( p_vout );
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Init: initialize XVideo video thread output method
+ *****************************************************************************
+ * This function create the XImages needed by the output thread. It is called
+ * at the beginning of the thread, but also each time the window is resized.
+ *****************************************************************************/
+static int vout_Init( vout_thread_t *p_vout )
+{
+    int i_err;
+
+#ifdef SYS_DARWIN1_3
+    /* FIXME : As of 2001-03-16, XFree4 for MacOS X does not support Xshm. */
+    p_vout->p_sys->b_shm = 0;
+#endif
+
+    /* Create XImages using XShm extension */
+    i_err = XVideoCreateShmImage( p_vout, &p_vout->p_sys->p_xvimage,
+                                  &p_vout->p_sys->shm_info );
+    if( i_err )
+    {
+        intf_Msg( "vout: XShm video extension unavailable" );
+        /* p_vout->p_sys->b_shm = 0; */
+    }
+    p_vout->b_need_render = 0; /* = 1 if not using Xv extension. */
+
+    /* Set bytes per line and initialize buffers */
+    p_vout->i_bytes_per_line =
+        (p_vout->p_sys->p_xvimage->data_size) /
+        (p_vout->p_sys->p_xvimage->height);
+
+    /* vout_SetBuffers( p_vout, p_vout->p_sys->p_xvimage[0]->data,
+     *                          p_vout->p_sys->p_xvimage[1]->data ); */
+    p_vout->p_buffer[0].i_pic_x =         0;
+    p_vout->p_buffer[0].i_pic_y =         0;
+    p_vout->p_buffer[0].i_pic_width =     0;
+    p_vout->p_buffer[0].i_pic_height =    0;
+
+    /* The first area covers all the screen */
+    p_vout->p_buffer[0].i_areas =           1;
+    p_vout->p_buffer[0].pi_area_begin[0] =  0;
+    p_vout->p_buffer[0].pi_area_end[0] =    p_vout->i_height - 1;
+
+    /* Set addresses */
+    p_vout->p_buffer[0].p_data = p_vout->p_sys->p_xvimage->data;
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_End: terminate XVideo video thread output method
+ *****************************************************************************
+ * Destroy the XVideo xImages created by vout_Init. It is called at the end of
+ * the thread, but also each time the window is resized.
+ *****************************************************************************/
+static void vout_End( vout_thread_t *p_vout )
+{
+    XVideoDestroyShmImage( p_vout, p_vout->p_sys->p_xvimage,
+                           &p_vout->p_sys->shm_info );
+}
+
+/*****************************************************************************
+ * vout_Destroy: destroy XVideo video thread output method
+ *****************************************************************************
+ * Terminate an output method created by vout_CreateOutputMethod
+ *****************************************************************************/
+static void vout_Destroy( vout_thread_t *p_vout )
+{
+    /* Enable screen saver */
+    XVideoEnableScreenSaver( p_vout );
+
+    /* Destroy window */
+    XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+    XFreeGC( p_vout->p_sys->p_display, p_vout->p_sys->gc );
+    XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
+
+    XCloseDisplay( p_vout->p_sys->p_display );
+
+    /* Destroy structure */
+    free( p_vout->p_sys );
+}
+
+/*****************************************************************************
+ * vout_Manage: handle X11 events
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It manages
+ * X11 events and allows window resizing. It returns a non null value on
+ * error.
+ *
+ * XXX  Should "factor-out" common code in this and the "same" fn in the x11
+ * XXX  plugin!
+ *****************************************************************************/
+static int vout_Manage( vout_thread_t *p_vout )
+{
+    XEvent      xevent;                                         /* X11 event */
+    boolean_t   b_resized;                        /* window has been resized */
+    char        i_key;                                    /* ISO Latin-1 key */
+
+    /* Handle X11 events: ConfigureNotify events are parsed to know if the
+     * output window's size changed, MapNotify and UnmapNotify to know if the
+     * window is mapped (and if the display is useful), and ClientMessages
+     * to intercept window destruction requests */
+    b_resized = 0;
+    while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                              StructureNotifyMask | KeyPressMask |
+                              ButtonPressMask | ButtonReleaseMask, &xevent )
+           == True )
+    {
+        /* ConfigureNotify event: prepare  */
+        if( (xevent.type == ConfigureNotify)
+            && ((xevent.xconfigure.width != p_vout->p_sys->i_width)
+                || (xevent.xconfigure.height != p_vout->p_sys->i_height)) )
+        {
+            /* Update dimensions */
+#if 0 XXX XXX
+            b_resized = 1;
+            p_vout->p_sys->i_width = xevent.xconfigure.width;
+            p_vout->p_sys->i_height = xevent.xconfigure.height;
+#endif XXX XXX
+        }
+        /* MapNotify event: change window status and disable screen saver */
+        else if( xevent.type == MapNotify)
+        {
+            if( (p_vout != NULL) && !p_vout->b_active )
+            {
+                XVideoDisableScreenSaver( p_vout );
+                p_vout->b_active = 1;
+            }
+        }
+        /* UnmapNotify event: change window status and enable screen saver */
+        else if( xevent.type == UnmapNotify )
+        {
+            if( (p_vout != NULL) && p_vout->b_active )
+            {
+                XVideoEnableScreenSaver( p_vout );
+                p_vout->b_active = 0;
+            }
+        }
+        /* Keyboard event */
+        else if( xevent.type == KeyPress )
+        {
+            if( XLookupString( &xevent.xkey, &i_key, 1, NULL, NULL ) )
+            {
+                /* FIXME: handle stuff here */
+                switch( i_key )
+                {
+                case 'q':
+                    /* FIXME: need locking ! */
+                    p_main->p_intf->b_die = 1;
+                    break;
+                }
+            }
+        }
+        /* Mouse click */
+        else if( xevent.type == ButtonPress )
+        {
+            switch( ((XButtonEvent *)&xevent)->button )
+            {
+                case Button1:
+                    /* in this part we will eventually manage
+                     * clicks for DVD navigation for instance */
+                    break;
+
+                case Button2:
+                    XVideoTogglePointer( p_vout );
+                    break;
+            }
+        }
+        /* Mouse release */
+        else if( xevent.type == ButtonRelease )
+        {
+            switch( ((XButtonEvent *)&xevent)->button )
+            {
+                case Button3:
+                    /* FIXME: need locking ! */
+                    p_main->p_intf->b_menu_change = 1;
+                    break;
+            }
+        }
+#ifdef DEBUG
+        /* Other event */
+        else
+        {
+            intf_DbgMsg( "%p -> unhandled event type %d received",
+                         p_vout, xevent.type );
+        }
+#endif
+    }
+
+    /* ClientMessage event - only WM_PROTOCOLS with WM_DELETE_WINDOW data
+     * are handled - according to the man pages, the format is always 32
+     * in this case */
+    while( XCheckTypedEvent( p_vout->p_sys->p_display,
+                             ClientMessage, &xevent ) )
+    {
+        if( (xevent.xclient.message_type == p_vout->p_sys->wm_protocols)
+            && (xevent.xclient.data.l[0] == p_vout->p_sys->wm_delete_window ) )
+        {
+            p_main->p_intf->b_die = 1;
+        }
+        else
+        {
+            intf_DbgMsg( "%p -> unhandled ClientMessage received", p_vout );
+        }
+    }
+
+    if( (p_vout->i_width  != p_vout->p_sys->i_width) ||
+             (p_vout->i_height != p_vout->p_sys->i_height) )
+    {
+        /* If video output size has changed, change interface window size */
+        intf_DbgMsg( "resizing output window" );
+        p_vout->p_sys->i_width =    p_vout->i_width;
+        p_vout->p_sys->i_height =   p_vout->i_height;
+        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       p_vout->p_sys->i_width, p_vout->p_sys->i_height );
+    }
+
+    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE))
+    {
+        /* FIXME: clear flags ?? */
+    }
+
+    /*
+     * Size change
+     */
+    if( p_vout->i_changes & VOUT_SIZE_CHANGE )
+    {
+        intf_DbgMsg( "vout: resizing window" );
+        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
+
+        /* Resize window */
+        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       p_vout->i_width, p_vout->i_height );
+
+        /* Destroy XImages to change their size */
+        vout_End( p_vout );
+
+        /* Recreate XImages. If SysInit failed, the thread cannot go on. */
+        if( vout_Init( p_vout ) )
+        {
+            intf_ErrMsg( "vout error: cannot resize display" );
+            return( 1 );
+       }
+
+        intf_Msg( "vout: video display resized (%dx%d)",
+                  p_vout->i_width, p_vout->i_height );
+    }
+
+    return 0;
+}
+
+
+/*****************************************************************************
+ * vout_Display: displays previously rendered output
+ *****************************************************************************
+ * This function send the currently rendered image to X11 server, wait until
+ * it is displayed and switch the two rendering buffer, preparing next frame.
+ *****************************************************************************/
+static void vout_Display( vout_thread_t *p_vout )
+{
+    boolean_t b_draw = 1;
+    const int i_size = p_vout->i_width * p_vout->i_height;
+
+    switch( p_vout->p_rendered_pic->i_type )
+    {
+    case YUV_422_PICTURE:
+        intf_ErrMsg( "vout error: YUV_422_PICTURE not (yet) supported" );
+        b_draw = 0;
+        break;
+
+    case YUV_444_PICTURE:
+        intf_ErrMsg( "vout error: YUV_444_PICTURE not (yet) supported" );
+        b_draw = 0;
+        break;
+
+    case YUV_420_PICTURE:
+        memcpy( p_vout->p_sys->p_xvimage->data,
+                p_vout->p_rendered_pic->p_y, i_size );
+        memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ),
+                p_vout->p_rendered_pic->p_v, i_size / 4 );
+        memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ) + ( i_size / 4 ),
+                p_vout->p_rendered_pic->p_u, i_size / 4 );
+        break;
+    }
+
+    if( b_draw )
+    {
+        int     i_dummy, i_src_width, i_src_height,
+                i_dest_width, i_dest_height, i_dest_x, i_dest_y;
+        Window  window;
+
+        /* Could use p_vout->p_sys->i_width and p_vout->p_sys->i_height
+         *instead of calling XGetGeometry? */
+        XGetGeometry( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                      &window, &i_dummy, &i_dummy,
+                      &i_src_width, &i_src_height, &i_dummy, &i_dummy );
+
+        XVideoOutputCoords( p_vout->p_rendered_pic, p_vout->b_scale,
+                            i_src_width, i_src_height, &i_dest_x, &i_dest_y,
+                            &i_dest_width, &i_dest_height);
+  
+        XvShmPutImage( p_vout->p_sys->p_display, p_vout->p_sys->xv_port,
+                       p_vout->p_sys->window, p_vout->p_sys->gc,
+                       p_vout->p_sys->p_xvimage,
+                       0 /*src_x*/, 0 /*src_y*/,
+                       p_vout->p_rendered_pic->i_width,
+                       p_vout->p_rendered_pic->i_height,
+                       i_dest_x, i_dest_y, i_dest_width, i_dest_height,
+                       True );
+    }
+}
+
+static void vout_SetPalette( p_vout_thread_t p_vout,
+                             u16 *red, u16 *green, u16 *blue, u16 *transp )
+{
+    return;
+}
+
+/* following functions are local */
+
+/*****************************************************************************
+ * XVideoCheckForXv: check for the XVideo extension
+ *****************************************************************************/
+static int XVideoCheckForXv( Display *dpy )
+{
+    unsigned int i;
+
+    switch( XvQueryExtension( dpy, &i, &i, &i, &i, &i ) )
+    {
+        case Success:
+            return( 1 );
+
+        case XvBadExtension:
+            intf_ErrMsg( "vout error: XvBadExtension" );
+            return( 0 );
+
+        case XvBadAlloc:
+            intf_ErrMsg( "vout error: XvBadAlloc" );
+            return( 0 );
+
+        default:
+            intf_ErrMsg( "vout error: XvQueryExtension failed" );
+            return( 0 );
+    }
+}
+
+/*****************************************************************************
+ * XVideoCreateWindow: open and set-up XVideo main window
+ *****************************************************************************/
+static int XVideoCreateWindow( vout_thread_t *p_vout )
+{
+    XSizeHints              xsize_hints;
+    XSetWindowAttributes    xwindow_attributes;
+    XGCValues               xgcvalues;
+    XEvent                  xevent;
+    boolean_t               b_expose;
+    boolean_t               b_configure_notify;
+    boolean_t               b_map_notify;
+
+    /* Set main window's size */
+    p_vout->p_sys->i_width =  main_GetIntVariable( VOUT_WIDTH_VAR,
+                                                   VOUT_WIDTH_DEFAULT );
+    p_vout->p_sys->i_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
+                                                   VOUT_HEIGHT_DEFAULT );
+
+    /* Prepare window manager hints and properties */
+    xsize_hints.base_width          = p_vout->p_sys->i_width;
+    xsize_hints.base_height         = p_vout->p_sys->i_height;
+    xsize_hints.flags               = PSize;
+    p_vout->p_sys->wm_protocols     = XInternAtom( p_vout->p_sys->p_display,
+                                                   "WM_PROTOCOLS", True );
+    p_vout->p_sys->wm_delete_window = XInternAtom( p_vout->p_sys->p_display,
+                                                   "WM_DELETE_WINDOW", True );
+
+    /* Prepare window attributes */
+    xwindow_attributes.backing_store = Always;       /* save the hidden part */
+    xwindow_attributes.background_pixel = WhitePixel( p_vout->p_sys->p_display,
+                                                      p_vout->p_sys->i_screen );
+
+    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
+
+    /* Create the window and set hints - the window must receive ConfigureNotify
+     * events, and, until it is displayed, Expose and MapNotify events. */
+    p_vout->p_sys->window =
+            XCreateWindow( p_vout->p_sys->p_display,
+                           DefaultRootWindow( p_vout->p_sys->p_display ),
+                           0, 0,
+                           p_vout->p_sys->i_width, p_vout->p_sys->i_height, 1,
+                           0, InputOutput, 0,
+                           CWBackingStore | CWBackPixel | CWEventMask,
+                           &xwindow_attributes );
+
+    /* Set window manager hints and properties: size hints, command,
+     * window's name, and accepted protocols */
+    XSetWMNormalHints( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                       &xsize_hints );
+    XSetCommand( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                 p_main->ppsz_argv, p_main->i_argc );
+    XStoreName( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                VOUT_TITLE " (XVideo output)" );
+
+    if( (p_vout->p_sys->wm_protocols == None)        /* use WM_DELETE_WINDOW */
+        || (p_vout->p_sys->wm_delete_window == None)
+        || !XSetWMProtocols( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                             &p_vout->p_sys->wm_delete_window, 1 ) )
+    {
+        /* WM_DELETE_WINDOW is not supported by window manager */
+        intf_Msg( "vout error: missing or bad window manager" );
+    }
+
+    /* Creation of a graphic context that doesn't generate a GraphicsExpose
+     * event when using functions like XCopyArea */
+    xgcvalues.graphics_exposures = False;
+    p_vout->p_sys->gc = XCreateGC( p_vout->p_sys->p_display,
+                                   p_vout->p_sys->window,
+                                   GCGraphicsExposures, &xgcvalues);
+
+    /* Send orders to server, and wait until window is displayed - three
+     * events must be received: a MapNotify event, an Expose event allowing
+     * drawing in the window, and a ConfigureNotify to get the window
+     * dimensions. Once those events have been received, only ConfigureNotify
+     * events need to be received. */
+    b_expose = 0;
+    b_configure_notify = 0;
+    b_map_notify = 0;
+    XMapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window);
+    do
+    {
+        XNextEvent( p_vout->p_sys->p_display, &xevent);
+        if( (xevent.type == Expose)
+            && (xevent.xexpose.window == p_vout->p_sys->window) )
+        {
+            b_expose = 1;
+        }
+        else if( (xevent.type == MapNotify)
+                 && (xevent.xmap.window == p_vout->p_sys->window) )
+        {
+            b_map_notify = 1;
+        }
+        else if( (xevent.type == ConfigureNotify)
+                 && (xevent.xconfigure.window == p_vout->p_sys->window) )
+        {
+            b_configure_notify = 1;
+            p_vout->p_sys->i_width = xevent.xconfigure.width;
+            p_vout->p_sys->i_height = xevent.xconfigure.height;
+        }
+    } while( !( b_expose && b_configure_notify && b_map_notify ) );
+
+    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
+                  StructureNotifyMask | KeyPressMask |
+                  ButtonPressMask | ButtonReleaseMask );
+
+    /* At this stage, the window is open, displayed, and ready to
+     * receive data */
+    return( 0 );
+}
+
+/*****************************************************************************
+ * XVideoCreateShmImage: create an XImage using shared memory extension
+ *****************************************************************************
+ * Prepare an XImage for DisplayX11ShmImage function.
+ * The order of the operations respects the recommandations of the mit-shm
+ * document by J.Corbet and K.Packard. Most of the parameters were copied from
+ * there.
+ *****************************************************************************/
+static int XVideoCreateShmImage( vout_thread_t *p_vout, XvImage **pp_xvimage,
+                                 XShmSegmentInfo *p_shm_info)
+{
+    int            i_adaptors;
+    XvAdaptorInfo *adaptor_info;
+
+    /* find xv_port... */
+    switch( XvQueryAdaptors( p_vout->p_sys->p_display,
+                             DefaultRootWindow( p_vout->p_sys->p_display ),
+                             &i_adaptors, &adaptor_info ) )
+    {
+        case Success:
+            break;
+
+        case XvBadExtension:
+            intf_ErrMsg( "vout error: XvBadExtension for XvQueryAdaptors" );
+            return( -1 );
+
+        case XvBadAlloc:
+            intf_ErrMsg( "vout error: XvBadAlloc for XvQueryAdaptors" );
+            return( -1 );
+
+        default:
+            intf_ErrMsg( "vout error: XvQueryAdaptors failed" );
+            return( -1 );
+    }
+
+    /* XXX is this right? */
+    p_vout->p_sys->xv_port = adaptor_info[ i_adaptors - 1 ].base_id;
+
+    #define GUID_YUV12_PLANAR 0x32315659
+
+    *pp_xvimage = XvShmCreateImage( p_vout->p_sys->p_display,
+                                    p_vout->p_sys->xv_port,
+                                    GUID_YUV12_PLANAR, 0,
+                                    p_vout->i_width, p_vout->i_height,
+                                    p_shm_info );
+
+    p_shm_info->shmid    = shmget( IPC_PRIVATE, (*pp_xvimage)->data_size,
+                                   IPC_CREAT | 0777 );
+    p_shm_info->shmaddr  = (*pp_xvimage)->data = shmat( p_shm_info->shmid,
+                                                        0, 0 );
+    p_shm_info->readOnly = False;
+
+    shmctl( p_shm_info->shmid, IPC_RMID, 0 ); /* XXX */
+
+    if( !XShmAttach(p_vout->p_sys->p_display, p_shm_info) )
+    {
+        intf_ErrMsg( "vout error: XShmAttach failed" );
+        return( -1 );
+    }
+
+    /* Send image to X server. This instruction is required, since having
+     * built a Shm XImage and not using it causes an error on XCloseDisplay */
+    XFlush( p_vout->p_sys->p_display );
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * XVideoDestroyShmImage
+ *****************************************************************************
+ * Destroy XImage AND associated data. Detach shared memory segment from
+ * server and process, then free it. If pointer is NULL, the image won't be
+ * destroyed (see vout_ManageOutputMethod())
+ *****************************************************************************/
+static void XVideoDestroyShmImage( vout_thread_t *p_vout, XvImage *p_xvimage,
+                                   XShmSegmentInfo *p_shm_info )
+{
+    /* If pointer is NULL, do nothing */
+    if( p_xvimage == NULL )
+    {
+        return;
+    }
+
+    XShmDetach( p_vout->p_sys->p_display, p_shm_info );/* detach from server */
+#if 0
+    XDestroyImage( p_ximage );
+#else
+/*    XvDestroyImage( p_xvimage ); XXX */
+#endif
+
+    if( shmdt( p_shm_info->shmaddr ) )  /* detach shared memory from process */
+    {                                   /* also automatic freeing...         */
+        intf_ErrMsg( "vout error: cannot detach shared memory (%s)",
+                     strerror(errno) );
+    }
+}
+
+/*****************************************************************************
+ * XVideoEnableScreenSaver: enable screen saver
+ *****************************************************************************
+ * This function enable the screen saver on a display after it had been
+ * disabled by XDisableScreenSaver. Both functions use a counter mechanism to
+ * know wether the screen saver can be activated or not: if n successive calls
+ * are made to XDisableScreenSaver, n successive calls to XEnableScreenSaver
+ * will be required before the screen saver could effectively be activated.
+ *****************************************************************************/
+void XVideoEnableScreenSaver( vout_thread_t *p_vout )
+{
+    intf_DbgMsg( "intf: enabling screen saver" );
+    XSetScreenSaver( p_vout->p_sys->p_display, p_vout->p_sys->i_ss_timeout,
+                     p_vout->p_sys->i_ss_interval,
+                     p_vout->p_sys->i_ss_blanking,
+                     p_vout->p_sys->i_ss_exposure );
+}
+
+/*****************************************************************************
+ * XVideoDisableScreenSaver: disable screen saver
+ *****************************************************************************
+ * See XEnableScreenSaver
+ *****************************************************************************/
+void XVideoDisableScreenSaver( vout_thread_t *p_vout )
+{
+    /* Save screen saver informations */
+    XGetScreenSaver( p_vout->p_sys->p_display, &p_vout->p_sys->i_ss_timeout,
+                     &p_vout->p_sys->i_ss_interval,
+                     &p_vout->p_sys->i_ss_blanking,
+                     &p_vout->p_sys->i_ss_exposure );
+
+    /* Disable screen saver */
+    intf_DbgMsg( "intf: disabling screen saver" );
+    XSetScreenSaver( p_vout->p_sys->p_display, 0,
+                     p_vout->p_sys->i_ss_interval,
+                     p_vout->p_sys->i_ss_blanking,
+                     p_vout->p_sys->i_ss_exposure );
+}
+
+/*****************************************************************************
+ * XVideoTogglePointer: hide or show the mouse pointer
+ *****************************************************************************
+ * This function hides the X pointer if it is visible by putting it at
+ * coordinates (32,32) and setting the pointer sprite to a blank one. To
+ * show it again, we disable the sprite and restore the original coordinates.
+ *****************************************************************************/
+void XVideoTogglePointer( vout_thread_t *p_vout )
+{
+    static Cursor cursor;
+    static boolean_t b_cursor = 0;
+
+    if( p_vout->p_sys->b_mouse )
+    {
+        p_vout->p_sys->b_mouse = 0;
+
+        if( !b_cursor )
+        {
+            XColor color;
+            Pixmap blank = XCreatePixmap( p_vout->p_sys->p_display,
+                               DefaultRootWindow(p_vout->p_sys->p_display),
+                               1, 1, 1 );
+
+            XParseColor( p_vout->p_sys->p_display,
+                         XCreateColormap( p_vout->p_sys->p_display,
+                                          DefaultRootWindow(
+                                                  p_vout->p_sys->p_display ),
+                                          DefaultVisual(
+                                                  p_vout->p_sys->p_display,
+                                                  p_vout->p_sys->i_screen ),
+                                          AllocNone ),
+                         "black", &color );
+
+            cursor = XCreatePixmapCursor( p_vout->p_sys->p_display,
+                           blank, blank, &color, &color, 1, 1 );
+
+            b_cursor = 1;
+        }
+        XDefineCursor( p_vout->p_sys->p_display,
+                       p_vout->p_sys->window, cursor );
+    }
+    else
+    {
+        p_vout->p_sys->b_mouse = 1;
+
+        XUndefineCursor( p_vout->p_sys->p_display, p_vout->p_sys->window );
+    }
+}
+
+/* This based on some code in SetBufferPicture... At the moment it's only
+ * used by the xvideo plugin, but others may want to use it. */
+static void XVideoOutputCoords( const picture_t *p_pic, const boolean_t scale,
+                                const int win_w, const int win_h,
+                                int *dx, int *dy, int *w, int *h)
+{
+    if( !scale )
+    {
+        *w = p_pic->i_width; *h = p_pic->i_height;
+    }
+    else
+    {
+        *w = win_w;
+        switch( p_pic->i_aspect_ratio )
+        {
+        case AR_3_4_PICTURE:        *h = win_w * 3 / 4;      break;
+        case AR_16_9_PICTURE:       *h = win_w * 9 / 16;     break;
+        case AR_221_1_PICTURE:      *h = win_w * 100 / 221;  break;
+        case AR_SQUARE_PICTURE:
+                default:            *h = win_w; break;
+        }
+
+        if( *h > win_h )
+        {
+            *h = win_h;
+            switch( p_pic->i_aspect_ratio )
+            {
+            case AR_3_4_PICTURE:    *w = win_h * 4 / 3;      break;
+            case AR_16_9_PICTURE:   *w = win_h * 16 / 9;     break;
+            case AR_221_1_PICTURE:  *w = win_h * 221 / 100;  break;
+            case AR_SQUARE_PICTURE:
+                    default:        *w = win_h; break;
+            }
+        }
+    }
+
+    /* Set picture position */
+    *dx = (win_w - *w) / 2;
+    *dy = (win_h - *h) / 2;
+}
+
diff --git a/plugins/x11/xvideo.c b/plugins/x11/xvideo.c
new file mode 100644 (file)
index 0000000..898ca3f
--- /dev/null
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * xvideo.c : Xvideo plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: xvideo.c,v 1.1 2001/04/01 06:21:44 sam Exp $
+ *
+ * Authors: Shane Harper <shanegh@optusnet.com.au>
+ *      
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME xvideo
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "modules.h"
+
+/*****************************************************************************
+ * Building configuration tree
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for xvideo module" )
+    ADD_COMMENT( "For now, the xvideo module cannot be configured" )
+MODULE_CONFIG_END
+
+/*****************************************************************************
+ * Capabilities defined in the other files.
+ ******************************************************************************/
+void _M( vout_getfunctions )( function_list_t * p_function_list );
+
+/*****************************************************************************
+ * InitModule: get the module structure and configuration.
+ *****************************************************************************
+ * We have to fill psz_name, psz_longname and psz_version. These variables
+ * will be strdup()ed later by the main application because the module can
+ * be unloaded later to save memory, and we want to be able to access this
+ * data even after the module has been unloaded.
+ *****************************************************************************/
+MODULE_INIT
+{
+    p_module->psz_name = MODULE_STRING;
+    p_module->psz_longname = "XVideo extension module";
+    p_module->psz_version = VERSION;
+
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_VOUT;
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * ActivateModule: set the module to an usable state.
+ *****************************************************************************
+ * This function fills the capability functions and the configuration
+ * structure. Once ActivateModule() has been called, the i_usage can
+ * be set to 0 and calls to NeedModule() be made to increment it. To unload
+ * the module, one has to wait until i_usage == 0 and call DeactivateModule().
+ *****************************************************************************/
+MODULE_ACTIVATE
+{
+    p_module->p_functions = malloc( sizeof( module_functions_t ) );
+    if( p_module->p_functions == NULL )
+    {
+        return( -1 );
+    }
+
+    _M( vout_getfunctions )( &p_module->p_functions->vout );
+
+    p_module->p_config = p_config;
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * DeactivateModule: make sure the module can be unloaded.
+ *****************************************************************************
+ * This function must only be called when i_usage == 0. If it successfully
+ * returns, i_usage can be set to -1 and the module unloaded. Be careful to
+ * lock usage_lock during the whole process.
+ *****************************************************************************/
+MODULE_DEACTIVATE
+{
+    free( p_module->p_functions );
+
+    return( 0 );
+}
+