diff options
-rw-r--r-- | rawhid/Makefile.in | 4 | ||||
-rwxr-xr-x | rawhid/configure | 1124 | ||||
-rwxr-xr-x | rawhid/configure.ac | 8 | ||||
-rw-r--r-- | rawhid/olaf/fixed.rawjoystick.c | 252 | ||||
-rw-r--r-- | rawhid/olaf/rawjoystick-old.c | 254 | ||||
-rw-r--r-- | rawhid/olaf/rawjoystick.c | 252 | ||||
-rw-r--r-- | rawhid/rawmouse-help.pd | 107 | ||||
-rw-r--r-- | rawhid/rawmouse.c | 384 |
8 files changed, 1972 insertions, 413 deletions
diff --git a/rawhid/Makefile.in b/rawhid/Makefile.in index 4d2c969..8a136ae 100644 --- a/rawhid/Makefile.in +++ b/rawhid/Makefile.in @@ -35,12 +35,12 @@ distclean: clean -rm -Rf autom4te.cache autoscan.log configure.scan .c.o: - $(CC) -c -o $@ $(CFLAGS) -DPD $*.c + $(CC) -c -o $@ $(CFLAGS) $(INCLUDE) -DPD $*.c # cp $@ $*_stat.o .o.$(EXT): - $(CC) -o $@ $(PDCFLAGS) -DPD $*.o + $(CC) -o $@ $(PDCFLAGS) $(INCLUDE) -DPD $*.o install:: diff --git a/rawhid/configure b/rawhid/configure index a7f697b..ed39f77 100755 --- a/rawhid/configure +++ b/rawhid/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Revision. +# From configure.ac Revision: 1.1 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.53 for rawHID(e) 0.0. +# Generated by GNU Autoconf 2.57 for rawHID(e) 0.0. # # Report bugs to <hans@eds.org>. # @@ -11,14 +11,6 @@ # gives unlimited permission to copy, distribute and modify it. # # 2003 Hans-Christoph Steiner <hans@eds.org> GNU GPL 2.0 or higher - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - - ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -27,11 +19,13 @@ fi if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi -# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -39,34 +33,42 @@ else as_unset=false fi -(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && - { $as_unset LANG || test "${LANG+set}" != set; } || - { LANG=C; export LANG; } -(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && - { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || - { LC_ALL=C; export LC_ALL; } -(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && - { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || - { LC_TIME=C; export LC_TIME; } -(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && - { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || - { LC_CTYPE=C; export LC_CTYPE; } -(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && - { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || - { LANGUAGE=C; export LANGUAGE; } -(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && - { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || - { LC_COLLATE=C; export LC_COLLATE; } -(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && - { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || - { LC_NUMERIC=C; export LC_NUMERIC; } -(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && - { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || - { LC_MESSAGES=C; export LC_MESSAGES; } + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi # Name of the executable. -as_me=`(basename "$0") 2>/dev/null || +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -77,6 +79,7 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -87,15 +90,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -143,6 +146,8 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -215,6 +220,12 @@ else fi rm -f conf$$ conf$$.exe conf$$.file +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -231,7 +242,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } +$as_unset CDPATH # Name of the host. @@ -245,6 +256,7 @@ exec 6>&1 # Initializations. # ac_default_prefix=/usr/local +ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= @@ -301,6 +313,8 @@ ac_includes_default="\ # include <unistd.h> #endif" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS EXT INCLUDE LD LFLAGS STRIPFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. ac_init_help= @@ -724,6 +738,9 @@ if test ! -r $srcdir/$ac_unique_file; then { (exit 1); exit 1; }; } fi fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias @@ -875,7 +892,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -902,7 +919,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF rawHID(e) configure 0.0 -generated by GNU Autoconf 2.53 +generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. @@ -919,7 +936,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by rawHID(e) $as_me 0.0, which was -generated by GNU Autoconf 2.53. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -971,27 +988,54 @@ _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= +ac_configure_args0= +ac_configure_args1= ac_sep= -for ac_arg +ac_must_keep_next=false +for ac_pass in 1 2 do - case $ac_arg in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n ) continue ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - ac_sep=" " ;; - esac - # Get rid of the leading space. + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1002,6 +1046,7 @@ trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo + cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## @@ -1024,6 +1069,35 @@ _ASBOX esac; } echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## @@ -1031,7 +1105,7 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h + sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && @@ -1212,6 +1286,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -1416,9 +1491,7 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$as_dir/$ac_word" ${1+"$@"} - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi @@ -1523,8 +1596,10 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. @@ -1549,14 +1624,12 @@ ac_compiler=`set X $ac_compile; echo $2` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1566,7 +1639,7 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. @@ -1585,26 +1658,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; - ls a.out conftest 2>/dev/null; - ls a.* conftest.* 2>/dev/null`; do +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; - a.out ) # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool --akim. - export ac_cv_exeext - break;; - * ) break;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; esac done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 -echo "$as_me: error: C compiler cannot create executables" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi @@ -1631,9 +1717,11 @@ if test "$cross_compiling" != yes; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi @@ -1641,7 +1729,7 @@ fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -1661,9 +1749,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. -for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; @@ -1671,8 +1760,10 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1690,14 +1781,12 @@ if test "${ac_cv_objext+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1714,16 +1803,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1740,14 +1832,12 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1774,7 +1864,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -1794,14 +1885,12 @@ if test "${ac_cv_prog_cc_g+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1825,7 +1914,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -1847,6 +1937,102 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide @@ -1879,15 +2065,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> $ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1911,20 +2095,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 : else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -1948,7 +2131,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext conftest.$ac_ext done @@ -1961,7 +2145,8 @@ fi else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c @@ -2097,18 +2282,28 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2125,7 +2320,8 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -2135,13 +2331,17 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2159,7 +2359,8 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -2188,18 +2389,28 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2216,7 +2427,8 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -2226,13 +2438,17 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2250,7 +2466,8 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -2263,8 +2480,10 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -2275,6 +2494,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then @@ -2282,48 +2516,59 @@ if test "${ac_cv_header_stdc+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> +int +main () +{ + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <string.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -2336,12 +2581,16 @@ 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 <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -2357,13 +2606,18 @@ if test $ac_cv_header_stdc = yes; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) @@ -2396,11 +2650,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -2435,7 +2690,11 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> @@ -2455,7 +2714,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2490,7 +2750,11 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF @@ -2509,7 +2773,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2521,13 +2786,17 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2544,7 +2813,8 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -2557,14 +2827,32 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -2604,7 +2892,11 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF @@ -2623,7 +2915,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2635,13 +2928,17 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2658,7 +2955,8 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -2671,14 +2969,32 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -2718,7 +3034,11 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF @@ -2737,7 +3057,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2749,13 +3070,17 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err + grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2772,7 +3097,8 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -2785,14 +3111,32 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -2816,103 +3160,6 @@ done # Checks for typedefs, structures, and compiler characteristics. -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then @@ -2920,14 +3167,12 @@ if test "${ac_cv_c_const+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -2997,7 +3242,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3019,14 +3265,12 @@ if test "${ac_cv_type_size_t+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3053,7 +3297,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3079,14 +3324,12 @@ if test "${ac_cv_lib_error_at_line+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif int main () { @@ -3110,7 +3353,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_error_at_line=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_error_at_line=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3141,9 +3385,9 @@ then CFLAGS="-O2" DEFS="-DUNIX -DMACOSX" EXT=pd_darwin - INCLUDE="-I../../../pd/src -I. -I/usr/local/include" + INCLUDE="-I../../../pd/src -I. -I/sw/include" LD=cc - LFLAGS="-bundle -undefined suppress -flat_namespace" + LFLAGS="-bundle -bundle_loader ../../../pd/bin/pd -flat_namespace" STRIPFLAGS= fi @@ -3157,7 +3401,7 @@ then STRIPFLAGS= fi -ac_config_files="$ac_config_files Makefile" + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -3170,7 +3414,7 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overriden when +# `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. @@ -3205,7 +3449,7 @@ _ACEOF t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache -if cmp -s $cache_file confcache; then :; else +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file @@ -3267,6 +3511,21 @@ DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -3281,11 +3540,12 @@ cat >$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false +ac_cs_recheck=false +ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -3294,11 +3554,13 @@ cat >>$CONFIG_STATUS <<\_ACEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi -# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -3306,34 +3568,42 @@ else as_unset=false fi -(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && - { $as_unset LANG || test "${LANG+set}" != set; } || - { LANG=C; export LANG; } -(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && - { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || - { LC_ALL=C; export LC_ALL; } -(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && - { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || - { LC_TIME=C; export LC_TIME; } -(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && - { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || - { LC_CTYPE=C; export LC_CTYPE; } -(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && - { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || - { LANGUAGE=C; export LANGUAGE; } -(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && - { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || - { LC_COLLATE=C; export LC_COLLATE; } -(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && - { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || - { LC_NUMERIC=C; export LC_NUMERIC; } -(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && - { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || - { LC_MESSAGES=C; export LC_MESSAGES; } + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi # Name of the executable. -as_me=`(basename "$0") 2>/dev/null || +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -3344,6 +3614,7 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -3354,15 +3625,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -3411,6 +3682,8 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -3484,6 +3757,12 @@ else fi rm -f conf$$ conf$$.exe conf$$.file +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -3500,7 +3779,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } +$as_unset CDPATH exec 6>&1 @@ -3517,7 +3796,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by rawHID(e) $as_me 0.0, which was -generated by GNU Autoconf 2.53. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3557,6 +3836,7 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] @@ -3571,7 +3851,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ rawHID(e) config.status 0.0 -configured by $0, generated by GNU Autoconf 2.53, +configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -3592,25 +3872,25 @@ do --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - shift - set dummy "$ac_option" "$ac_optarg" ${1+"$@"} - shift + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift ;; - -*);; *) # This is not an option, so the user has probably given explicit # arguments. + ac_option=$1 ac_need_defaults=false;; esac - case $1 in + case $ac_option in # Handling of the options. _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" - exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; -_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) @@ -3625,13 +3905,16 @@ Try \`$0 --help' for more information." >&2;} --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) - shift - CONFIG_FILES="$CONFIG_FILES $1" + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) - shift - CONFIG_HEADERS="$CONFIG_HEADERS $1" + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 @@ -3646,6 +3929,20 @@ Try \`$0 --help' for more information." >&2;} shift done +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + _ACEOF @@ -3672,6 +3969,9 @@ if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { @@ -3680,17 +3980,17 @@ $debug || } # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} + { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/cs$$-$RANDOM + tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } @@ -3754,7 +4054,9 @@ s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF @@ -3825,25 +4127,30 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || - mkdir "$as_incr_dir" || - { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; } - ;; - esac -done; } + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } ac_builddir=. @@ -3873,7 +4180,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -3974,8 +4281,11 @@ ac_clean_files=$ac_clean_files_save # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. diff --git a/rawhid/configure.ac b/rawhid/configure.ac index f8a683a..9cf27b6 100755 --- a/rawhid/configure.ac +++ b/rawhid/configure.ac @@ -8,7 +8,7 @@ dnl the obligatory license AC_COPYRIGHT([2003 Hans-Christoph Steiner <hans@eds.org> GNU GPL 2.0 or higher]) dnl get cvs revision -AC_REVISION($Revision: 1.1 $) +AC_REVISION($Revision: 1.2 $) dnl check and make sure the source files are actually there AC_CONFIG_SRCDIR([rawjoystick.c]) @@ -40,7 +40,7 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE -LD=ld +#LD=ld dnl dnl OK, checks for machines are here now @@ -64,9 +64,9 @@ then CFLAGS="-O2" DEFS="-DUNIX -DMACOSX" EXT=pd_darwin - INCLUDE="-I../../../pd/src -I. -I/usr/local/include" + INCLUDE="-I../../../pd/src -I. -I/sw/include" LD=cc - LFLAGS="-bundle -undefined suppress -flat_namespace" + LFLAGS="-bundle -bundle_loader ../../../pd/bin/pd -flat_namespace" STRIPFLAGS= fi diff --git a/rawhid/olaf/fixed.rawjoystick.c b/rawhid/olaf/fixed.rawjoystick.c new file mode 100644 index 0000000..0aff216 --- /dev/null +++ b/rawhid/olaf/fixed.rawjoystick.c @@ -0,0 +1,252 @@ +/* Copyright 2003 Hans-Christoph Steiner <hans@eds.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+/*
+ * $Id: fixed.rawjoystick.c,v 1.1 2006-01-17 05:14:01 eighthave Exp $
+ */
+static char *version = "$Revision: 1.1 $";
+
+#include "SDL.h"
+#include "m_imp.h"
+
+//#define DEBUG(x)
+#define DEBUG(x) x
+
+#define RAWJOYSTICK_AXES 6
+#define RAWJOYSTICK_BUTTONS 9
+
+
+/*------------------------------------------------------------------------------
+ * CLASS DEF
+ */
+static t_class *rawjoystick_class;
+
+typedef struct _rawjoystick {
+ t_object x_obj;
+ SDL_Joystick *x_joystick;
+ t_int x_devnum;
+ int read_ok;
+ int started;
+ t_outlet *x_axis_out[RAWJOYSTICK_AXES];
+ t_outlet *x_button_num_out;
+ t_outlet *x_button_val_out;
+ t_clock *x_clock;
+ double x_delaytime;
+ int x_buttons;
+ int x_hats;
+ int x_axes;
+} t_rawjoystick;
+
+/*------------------------------------------------------------------------------
+ */
+
+static int rawjoystick_close(t_rawjoystick *x) {
+ DEBUG(post("rawjoystick_CLOSE"));
+
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ SDL_JoystickClose(x->x_joystick);
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+static int rawjoystick_open(t_rawjoystick *x) {
+ rawjoystick_close(x);
+
+ DEBUG(post("rawjoystick_OPEN"));
+
+ /* open device */
+ SDL_JoystickEventState(SDL_ENABLE);
+ x->x_joystick = SDL_JoystickOpen(x->x_devnum);
+
+ /* test if device open */
+ /* get name of device */
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ post ("Configuring %s",SDL_JoystickName(x->x_devnum));
+ }
+ else {
+ return 0;
+ }
+
+ x->x_axes = SDL_JoystickNumAxes(x->x_joystick);
+ x->x_hats = SDL_JoystickNumHats(x->x_joystick);
+ x->x_buttons = SDL_JoystickNumButtons(x->x_joystick);
+
+ post (" device has %i axes, %i hats, and %i buttons.\n",x->x_axes,x->x_hats,x->x_buttons);
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+ post ("This object is under development! The interface could change at anytime!");
+ post ("As I write cross-platform versions, the interface might have to change.");
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+
+ return 1;
+}
+
+static int rawjoystick_read(t_rawjoystick *x,int fd) {
+ SDL_Event event;
+
+ DEBUG(post("rawjoystick_READ"));
+
+ if ( ! SDL_JoystickOpened(x->x_devnum) ) {
+ return 0;
+ }
+
+ post("Joystick read: %s",SDL_JoystickName(x->x_devnum));
+
+ if ( SDL_PollEvent(&event) ) {
+ post("SDL_Event.type: %i",event.type);
+ post("SDL_JoyAxisEvent.value: %i",event.jaxis.value);
+ post("SDL_JoyButtonEvent.value: %i",event.jbutton.state);
+ switch (event.type) {
+ case SDL_JOYAXISMOTION:
+ outlet_float (x->x_axis_out[event.jaxis.axis], event.jaxis.value);
+ break;
+ case SDL_JOYHATMOTION:
+ break;
+ case SDL_JOYBUTTONDOWN:
+ outlet_float (x->x_button_val_out, 1);
+ outlet_float (x->x_button_num_out, event.jaxis.axis);
+ break;
+ case SDL_JOYBUTTONUP:
+ outlet_float (x->x_button_val_out, 0);
+ outlet_float (x->x_button_num_out, event.jaxis.axis);
+ break;
+ default:
+ DEBUG(post("Unhandled event."));
+ }
+ }
+ return 1;
+}
+
+/* Actions */
+
+static void rawjoystick_bang(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_bang"));
+}
+
+static void rawjoystick_float(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_float"));
+}
+
+// DONE
+void rawjoystick_start(t_rawjoystick* x)
+{
+ DEBUG(post("rawjoystick_START"));
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( ! x->started ) ) {
+ sys_addpollfn(x->x_devnum, (t_fdpollfn)rawjoystick_read, x);
+ x->started = 1;
+ }
+}
+
+
+// DONE
+void rawjoystick_stop(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_STOP");)
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( x->started ) ) {
+ sys_rmpollfn(x->x_devnum);
+ x->started = 0;
+ }
+}
+
+/* Misc setup functions */
+
+
+static void rawjoystick_free(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_free"));
+
+ rawjoystick_stop(x);
+
+ if ( SDL_JoystickOpened(x->x_devnum))
+ SDL_JoystickClose(x->x_joystick);
+
+ SDL_Quit();
+}
+
+static void *rawjoystick_new(t_float argument) {
+ int i,joystickNumber;
+ t_rawjoystick *x = (t_rawjoystick *)pd_new(rawjoystick_class);
+
+ DEBUG(post("rawjoystick_NEW"));
+ post("rawHID objects, %s", version);
+ post(" by Hans-Christoph Steiner <hans@eds.org>");
+
+ /* init vars */
+ x->x_devnum = 0;
+ x->read_ok = 1;
+ x->started = 0;
+
+ /* INIT SDL using joystick layer */
+ /* Note: Video is required to start Event Loop !! */
+ if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) == -1 ) {
+ post("Could not initialize SDL: %s.\n", SDL_GetError());
+ // exit(-1);
+ return (0); /* changed by olafmatt */
+ }
+
+ post("%i joysticks were found:", SDL_NumJoysticks() );
+
+ for( i=0; i < SDL_NumJoysticks(); i++ ) {
+ post(" %s", SDL_JoystickName(i));
+ }
+
+ joystickNumber = (int)argument;
+
+ if ( (joystickNumber >= 0) && (joystickNumber < SDL_NumJoysticks() ) )
+ x->x_devnum = joystickNumber;
+ else
+ post("Joystick %i does not exist!",joystickNumber);
+
+ /* create outlets for each axis */
+ for (i = 0; i < RAWJOYSTICK_AXES; i++)
+ x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
+
+ /* create outlets for buttons */
+ x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
+ x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
+
+ /* Open the device and save settings */
+
+ if ( ! rawjoystick_open(x) ) return x;
+
+ return (x);
+}
+
+
+void rawjoystick_setup(void)
+{
+ DEBUG(post("rawjoystick_setup");)
+ rawjoystick_class = class_new(gensym("rawjoystick"),
+ (t_newmethod)rawjoystick_new,
+ (t_method)rawjoystick_free,
+ sizeof(t_rawjoystick),0,A_DEFFLOAT,0);
+
+ /* add inlet datatype methods */
+ class_addfloat(rawjoystick_class,(t_method) rawjoystick_float);
+ class_addbang(rawjoystick_class,(t_method) rawjoystick_bang);
+
+ /* add inlet message methods */
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_open,gensym("open"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_close,gensym("close"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_start,gensym("start"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_stop,gensym("stop"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_read,gensym("read"),0);
+
+}
+
diff --git a/rawhid/olaf/rawjoystick-old.c b/rawhid/olaf/rawjoystick-old.c new file mode 100644 index 0000000..a92cd05 --- /dev/null +++ b/rawhid/olaf/rawjoystick-old.c @@ -0,0 +1,254 @@ +/* Copyright 2003 Hans-Christoph Steiner <hans@eds.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+/*
+ * $Id: rawjoystick-old.c,v 1.1 2006-01-17 05:14:01 eighthave Exp $
+ */
+static char *version = "$Revision: 1.1 $";
+
+#include <SDL/SDL.h>
+#include <m_pd.h>
+#include "m_imp.h"
+
+/* #define DEBUG(x) */
+#define DEBUG(x) x
+
+#define RAWJOYSTICK_AXES 6
+#define RAWJOYSTICK_BUTTONS 9
+
+
+/*------------------------------------------------------------------------------
+ * CLASS DEF
+ */
+static t_class *rawjoystick_class;
+
+typedef struct _rawjoystick {
+ t_object x_obj;
+ SDL_Joystick *x_joystick;
+ t_int x_devnum;
+ int read_ok;
+ int started;
+ t_outlet *x_axis_out[RAWJOYSTICK_AXES];
+ t_outlet *x_button_num_out;
+ t_outlet *x_button_val_out;
+ t_clock *x_clock;
+ double x_delaytime;
+ int x_buttons;
+ int x_hats;
+ int x_axes;
+} t_rawjoystick;
+
+/*------------------------------------------------------------------------------
+ */
+
+static int rawjoystick_close(t_rawjoystick *x) {
+ DEBUG(post("rawjoystick_CLOSE"));
+
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ SDL_JoystickClose(x->x_joystick);
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+static int rawjoystick_open(t_rawjoystick *x) {
+ rawjoystick_close(x);
+
+ DEBUG(post("rawjoystick_OPEN"));
+
+ /* open device */
+ SDL_JoystickEventState(SDL_ENABLE);
+ x->x_joystick = SDL_JoystickOpen(x->x_devnum);
+
+ /* test if device open */
+ /* get name of device */
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ post ("Configuring %s",SDL_JoystickName(x->x_devnum));
+ }
+ else {
+ return 0;
+ }
+
+ x->x_axes = SDL_JoystickNumAxes(x->x_joystick);
+ x->x_hats = SDL_JoystickNumHats(x->x_joystick);
+ x->x_buttons = SDL_JoystickNumButtons(x->x_joystick);
+
+ post (" device has %i axes, %i hats, and %i buttons.\n",x->x_axes,x->x_hats,x->x_buttons);
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+ post ("This object is under development! The interface could change at anytime!");
+ post ("As I write cross-platform versions, the interface might have to change.");
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+
+ return 1;
+}
+
+/* read the joystick, called through clock */
+static void *rawjoystick_read(t_rawjoystick *x) {
+ SDL_Event event;
+
+ DEBUG(post("rawjoystick_READ"));
+
+ if ( ! SDL_JoystickOpened(x->x_devnum) ) {
+ return 0;
+ }
+
+ post("Joystick read: %s",SDL_JoystickName(x->x_devnum));
+
+ if ( SDL_PollEvent(&event) ) {
+ DEBUG(post("SDL_Event.type: %i",event.type);)
+ DEBUG(post("SDL_JoyAxisEvent.value: %i",event.jaxis.value);)
+ DEBUG(post("SDL_JoyButtonEvent.value: %i",event.jbutton.state);)
+ switch (event.type) {
+ case SDL_JOYAXISMOTION:
+ outlet_float (x->x_axis_out[event.jaxis.axis], event.jaxis.value);
+ break;
+ case SDL_JOYHATMOTION:
+ break;
+ case SDL_JOYBUTTONDOWN:
+ outlet_float (x->x_button_val_out, 1);
+ outlet_float (x->x_button_num_out, event.jaxis.axis);
+ break;
+ case SDL_JOYBUTTONUP:
+ outlet_float (x->x_button_val_out, 0);
+ outlet_float (x->x_button_num_out, event.jaxis.axis);
+ break;
+ default:
+ DEBUG(post("Unhandled event."));
+ }
+ }
+ return 1;
+}
+
+/* Actions */
+
+static void rawjoystick_bang(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_bang"));
+}
+
+static void rawjoystick_float(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_float"));
+}
+
+void rawjoystick_start(t_rawjoystick* x)
+{
+ DEBUG(post("rawjoystick_START"));
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( ! x->started ) ) {
+ sys_addpollfn(x->x_devnum, (t_fdpollfn)rawjoystick_read, x);
+ x->started = 1;
+ }
+}
+
+
+void rawjoystick_stop(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_STOP");)
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( x->started ) ) {
+ sys_rmpollfn(x->x_devnum);
+ x->started = 0;
+ }
+}
+
+/* Misc setup functions */
+
+
+static void rawjoystick_free(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_free"));
+
+ rawjoystick_stop(x);
+
+ if ( SDL_JoystickOpened(x->x_devnum))
+ SDL_JoystickClose(x->x_joystick);
+
+ SDL_Quit();
+}
+
+static void *rawjoystick_new(t_float argument) {
+ int i,joystickNumber;
+ t_rawjoystick *x = (t_rawjoystick *)pd_new(rawjoystick_class);
+
+ DEBUG(post("rawjoystick_NEW"));
+ post("rawHID objects, %s", version);
+ post(" by Hans-Christoph Steiner <hans@eds.org>");
+
+ /* init vars */
+ x->x_devnum = 0;
+ x->read_ok = 1;
+ x->started = 0;
+
+ /* INIT SDL using joystick layer */
+ /* Note: Video is required to start Event Loop !! */
+ if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) == -1 ) {
+ post("Could not initialize SDL: %s.\n", SDL_GetError());
+ // exit(-1);
+ return (0); /* changed by olafmatt */
+ }
+
+ post("%i joysticks were found:", SDL_NumJoysticks() );
+
+ for( i=0; i < SDL_NumJoysticks(); i++ ) {
+ post(" %s", SDL_JoystickName(i));
+ }
+
+ joystickNumber = (int)argument;
+
+ if ( (joystickNumber >= 0) && (joystickNumber < SDL_NumJoysticks() ) )
+ x->x_devnum = joystickNumber;
+ else
+ post("Joystick %i does not exist!",joystickNumber);
+
+ /* create outlets for each axis */
+ for (i = 0; i < RAWJOYSTICK_AXES; i++)
+ x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
+
+ /* create outlets for buttons */
+ x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
+ x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
+
+ /* Open the device and save settings */
+ if ( ! rawjoystick_open(x) ) return x;
+
+ return (x);
+}
+
+
+void rawjoystick_setup(void)
+{
+ DEBUG(post("rawjoystick_setup");)
+ rawjoystick_class = class_new(gensym("rawjoystick"),
+ (t_newmethod)rawjoystick_new,
+ (t_method)rawjoystick_free,
+ sizeof(t_rawjoystick),0,A_DEFFLOAT,0);
+
+ /* add inlet datatype methods */
+ class_addfloat(rawjoystick_class,(t_method) rawjoystick_float);
+ class_addbang(rawjoystick_class,(t_method) rawjoystick_bang);
+
+ /* set the help file per MSP's 0.37 standard */
+ class_sethelpsymbol(rawjoystick_class, gensym("help-rawjoystick.pd") );
+
+ /* add inlet message methods */
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_open,gensym("open"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_close,gensym("close"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_start,gensym("start"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_stop,gensym("stop"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_read,gensym("read"),0);
+
+}
+
diff --git a/rawhid/olaf/rawjoystick.c b/rawhid/olaf/rawjoystick.c new file mode 100644 index 0000000..7dde30b --- /dev/null +++ b/rawhid/olaf/rawjoystick.c @@ -0,0 +1,252 @@ +/* Copyright 2003 Hans-Christoph Steiner <hans@eds.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+/*
+ * $Id: rawjoystick.c,v 1.1 2006-01-17 05:14:01 eighthave Exp $
+ */
+static char *version = "$Revision: 1.1 $";
+
+#include <SDL/SDL.h>
+#include <m_pd.h>
+#include "m_imp.h"
+
+/* #define DEBUG(x) */
+#define DEBUG(x) x
+
+#define RAWJOYSTICK_AXES 6
+#define RAWJOYSTICK_BUTTONS 9
+
+
+/*------------------------------------------------------------------------------
+ * CLASS DEF
+ */
+static t_class *rawjoystick_class;
+
+typedef struct _rawjoystick {
+ t_object x_obj;
+ SDL_Joystick *x_joystick;
+ t_int x_devnum;
+ int read_ok;
+ int started;
+ t_outlet *x_axis_out[RAWJOYSTICK_AXES];
+ t_outlet *x_button_num_out;
+ t_outlet *x_button_val_out;
+ t_clock *x_clock;
+ double x_delaytime;
+ int x_buttons;
+ int x_hats;
+ int x_axes;
+} t_rawjoystick;
+
+/*------------------------------------------------------------------------------
+ */
+
+static int rawjoystick_close(t_rawjoystick *x) {
+ DEBUG(post("rawjoystick_CLOSE"));
+
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ SDL_JoystickClose(x->x_joystick);
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+static int rawjoystick_open(t_rawjoystick *x) {
+ rawjoystick_close(x);
+
+ DEBUG(post("rawjoystick_OPEN"));
+
+ /* open device */
+ SDL_JoystickEventState(SDL_ENABLE);
+ x->x_joystick = SDL_JoystickOpen(x->x_devnum);
+
+ /* test if device open */
+ /* get name of device */
+ if ( SDL_JoystickOpened(x->x_devnum) ) {
+ post ("Configuring %s",SDL_JoystickName(x->x_devnum));
+ }
+ else {
+ return 0;
+ }
+
+ x->x_axes = SDL_JoystickNumAxes(x->x_joystick);
+ x->x_hats = SDL_JoystickNumHats(x->x_joystick);
+ x->x_buttons = SDL_JoystickNumButtons(x->x_joystick);
+
+ post (" device has %i axes, %i hats, and %i buttons.\n",x->x_axes,x->x_hats,x->x_buttons);
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+ post ("This object is under development! The interface could change at anytime!");
+ post ("As I write cross-platform versions, the interface might have to change.");
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+
+ return 1;
+}
+
+/* read the joystick, called through clock */
+static void *rawjoystick_read(t_rawjoystick *x) {
+ SDL_Event event;
+
+ DEBUG(post("rawjoystick_READ"));
+
+ if ( ! SDL_JoystickOpened(x->x_devnum) ) {
+ return 0;
+ }
+
+ DEBUG(post("Joystick read: %s",SDL_JoystickName(x->x_devnum)));
+
+ if ( SDL_PollEvent(&event) ) {
+ switch (event.type) {
+ case SDL_JOYAXISMOTION:
+ outlet_float (x->x_axis_out[event.jaxis.axis], (float)event.jaxis.value / 32767.0);
+ break;
+ case SDL_JOYHATMOTION:
+ break;
+ case SDL_JOYBUTTONDOWN:
+ outlet_float (x->x_button_val_out, 1);
+ outlet_float (x->x_button_num_out, (float)event.jbutton.button);
+ break;
+ case SDL_JOYBUTTONUP:
+ outlet_float (x->x_button_val_out, 0);
+ outlet_float (x->x_button_num_out, (float)event.jbutton.button);
+ break;
+ default:
+ DEBUG(post("Unhandled event."));
+ }
+ }
+ if(x->started)clock_delay(x->x_clock, x->x_delaytime);
+ return NULL;
+}
+
+/* Actions */
+
+static void rawjoystick_bang(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_bang"));
+}
+
+static void rawjoystick_float(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_float"));
+}
+
+// DONE
+void rawjoystick_start(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_START"));
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( ! x->started ) ) {
+ x->started = 1;
+ clock_delay(x->x_clock, 0);
+ }
+}
+
+
+// DONE
+void rawjoystick_stop(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_STOP");)
+
+ if ( ( SDL_JoystickOpened(x->x_devnum) ) && ( x->started ) ) {
+ x->started = 0;
+ clock_unset(x->x_clock);
+ }
+}
+
+/* Misc setup functions */
+
+
+static void rawjoystick_free(t_rawjoystick* x) {
+ DEBUG(post("rawjoystick_free"));
+
+ rawjoystick_stop(x);
+
+ if ( SDL_JoystickOpened(x->x_devnum))
+ SDL_JoystickClose(x->x_joystick);
+
+ SDL_Quit();
+ clock_free(x->x_clock);
+}
+
+static void *rawjoystick_new(t_float argument) {
+ int i,joystickNumber;
+ t_rawjoystick *x = (t_rawjoystick *)pd_new(rawjoystick_class);
+
+ DEBUG(post("rawjoystick_NEW"));
+ post("rawHID objects, %s", version);
+ post(" by Hans-Christoph Steiner <hans@eds.org>");
+
+ /* init vars */
+ x->x_devnum = 0;
+ x->read_ok = 1;
+ x->started = 0;
+ x->x_delaytime = 10;
+
+ x->x_clock = clock_new(x, (t_method)rawjoystick_read);
+
+ /* INIT SDL using joystick layer */
+ /* Note: Video is required to start Event Loop !! */
+ if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) == -1 ) {
+ post("Could not initialize SDL: %s.\n", SDL_GetError());
+ // exit(-1);
+ return (0); /* changed by olafmatt */
+ }
+
+ post("%i joysticks were found:", SDL_NumJoysticks() );
+
+ for( i=0; i < SDL_NumJoysticks(); i++ ) {
+ post(" %s", SDL_JoystickName(i));
+ }
+
+ joystickNumber = (int)argument;
+
+ if ( (joystickNumber >= 0) && (joystickNumber < SDL_NumJoysticks() ) )
+ x->x_devnum = joystickNumber;
+ else
+ post("Joystick %i does not exist!",joystickNumber);
+
+ /* create outlets for each axis */
+ for (i = 0; i < RAWJOYSTICK_AXES; i++)
+ x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
+
+ /* create outlets for buttons */
+ x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
+ x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
+
+ /* Open the device and save settings */
+if ( ! rawjoystick_open(x) ) return x;
+
+ return (x);
+}
+
+
+void rawjoystick_setup(void)
+{
+ DEBUG(post("rawjoystick_setup");)
+ rawjoystick_class = class_new(gensym("rawjoystick"),
+ (t_newmethod)rawjoystick_new,
+ (t_method)rawjoystick_free,
+ sizeof(t_rawjoystick),0,A_DEFFLOAT,0);
+
+ /* add inlet datatype methods */
+ class_addfloat(rawjoystick_class,(t_method) rawjoystick_float);
+ class_addbang(rawjoystick_class,(t_method) rawjoystick_bang);
+
+ /* add inlet message methods */
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_open,gensym("open"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_close,gensym("close"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_start,gensym("start"),0);
+ class_addmethod(rawjoystick_class,(t_method) rawjoystick_stop,gensym("stop"),0);
+}
+
diff --git a/rawhid/rawmouse-help.pd b/rawhid/rawmouse-help.pd new file mode 100644 index 0000000..fc12031 --- /dev/null +++ b/rawhid/rawmouse-help.pd @@ -0,0 +1,107 @@ +#N canvas 108 63 748 404 10; +#X msg 95 34 start; +#X msg 110 65 stop; +#X floatatom 226 177 2 0 0 3 button# - -; +#X floatatom 277 176 2 0 0 3 button_value - -; +#X floatatom 176 177 6 0 0 3 y-axis - -; +#X floatatom 128 177 6 0 0 3 x-axis - -; +#X obj 226 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 244 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 262 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 280 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 298 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 317 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 335 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 608 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 590 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 572 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 554 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 535 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 517 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 499 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 481 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 462 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 444 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 426 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 408 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 390 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 371 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 353 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +-1; +#X obj 247 213 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 181 44 read; +#X msg 262 54 close; +#X msg 263 27 open; +#X text 319 28 [rawjoystick]'s timer defaults to 5 ms. You can change +it with the [delay( message:; +#X msg 353 58 delay 20; +#X obj 226 239 pack f f; +#X obj 226 259 route 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 +19 20 21; +#X obj 648 306 bng 35 250 50 0 empty empty empty 0 -6 0 8 -162590 -1 +-1; +#X obj 192 143 rawmouse; +#X msg 353 86 absolute; +#X msg 353 107 relative; +#X connect 0 0 37 0; +#X connect 1 0 37 0; +#X connect 2 0 34 0; +#X connect 3 0 28 0; +#X connect 3 0 34 1; +#X connect 28 0 2 0; +#X connect 29 0 37 0; +#X connect 30 0 37 0; +#X connect 31 0 37 0; +#X connect 33 0 37 0; +#X connect 34 0 35 0; +#X connect 35 0 6 0; +#X connect 35 1 7 0; +#X connect 35 2 8 0; +#X connect 35 3 9 0; +#X connect 35 4 10 0; +#X connect 35 5 11 0; +#X connect 35 6 12 0; +#X connect 35 7 27 0; +#X connect 35 8 26 0; +#X connect 35 9 25 0; +#X connect 35 10 24 0; +#X connect 35 11 23 0; +#X connect 35 12 22 0; +#X connect 35 13 21 0; +#X connect 35 14 20 0; +#X connect 35 15 19 0; +#X connect 35 16 18 0; +#X connect 35 17 17 0; +#X connect 35 18 16 0; +#X connect 35 19 15 0; +#X connect 35 20 14 0; +#X connect 35 21 13 0; +#X connect 35 22 36 0; +#X connect 37 0 5 0; +#X connect 37 1 4 0; +#X connect 37 2 2 0; +#X connect 37 3 3 0; +#X connect 38 0 37 0; +#X connect 39 0 37 0; diff --git a/rawhid/rawmouse.c b/rawhid/rawmouse.c new file mode 100644 index 0000000..0719990 --- /dev/null +++ b/rawhid/rawmouse.c @@ -0,0 +1,384 @@ +/* Copyright 2003 Hans-Christoph Steiner <hans@eds.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * TODO
+ * -obj argument selects device# (event.button.which/event.motion.which)
+ *
+ * $Id $
+ */
+static char *version = "$Revision $";
+
+#include <SDL/SDL.h>
+#include <m_pd.h>
+#include "m_imp.h"
+
+#if PD_MINOR_VERSION >= 37
+#include "s_stuff.h"
+#endif
+
+/* #define DEBUG(x) */
+#define DEBUG(x) x
+
+#define RAWMOUSE_AXES 2
+#define RAWMOUSE_BUTTONS 9
+
+#define RAWMOUSE_XAXIS 0
+#define RAWMOUSE_YAXIS 1
+
+/*------------------------------------------------------------------------------
+ * SDL FUNCTIONS
+ */
+
+/* Is the cursor visible? */
+static int visible = 1;
+
+void HotKey_ToggleFullScreen(void)
+{
+ SDL_Surface *screen;
+
+ screen = SDL_GetVideoSurface();
+ if ( SDL_WM_ToggleFullScreen(screen) ) {
+ printf("Toggled fullscreen mode - now %s\n",
+ (screen->flags&SDL_FULLSCREEN) ? "fullscreen" : "windowed");
+ } else {
+ printf("Unable to toggle fullscreen mode\n");
+ }
+}
+
+void HotKey_ToggleGrab(void)
+{
+ SDL_GrabMode mode;
+
+ printf("Ctrl-G: toggling input grab!\n");
+ mode = SDL_WM_GrabInput(SDL_GRAB_QUERY);
+ if ( mode == SDL_GRAB_ON ) {
+ printf("Grab was on\n");
+ } else {
+ printf("Grab was off\n");
+ }
+ mode = SDL_WM_GrabInput(mode ? SDL_GRAB_OFF : SDL_GRAB_ON);
+ if ( mode == SDL_GRAB_ON ) {
+ printf("Grab is now on\n");
+ } else {
+ printf("Grab is now off\n");
+ }
+}
+
+void HotKey_Iconify(void)
+{
+ printf("Ctrl-Z: iconifying window!\n");
+ SDL_WM_IconifyWindow();
+}
+
+void HotKey_Quit(void)
+{
+ SDL_Event event;
+
+ printf("Posting internal quit request\n");
+ event.type = SDL_USEREVENT;
+ SDL_PushEvent(&event);
+}
+
+int FilterEvents(const SDL_Event *event)
+{
+ static int reallyquit = 0;
+
+ switch (event->type) {
+
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEBUTTONUP:
+ /* We want to toggle visibility on buttonpress */
+ if ( event->button.state == SDL_PRESSED ) {
+ visible = !visible;
+ SDL_ShowCursor(visible);
+ }
+ printf("Mouse button %d has been %s\n",
+ event->button.button,
+ (event->button.state == SDL_PRESSED) ?
+ "pressed" : "released");
+ return(0);
+
+ /* Show relative mouse motion */
+ case SDL_MOUSEMOTION:
+#if 1
+ printf("Mouse relative motion: {%d,%d}\n",
+ event->motion.xrel, event->motion.yrel);
+#endif
+ return(0);
+
+ case SDL_KEYDOWN:
+ if ( event->key.keysym.sym == SDLK_ESCAPE ) {
+ HotKey_Quit();
+ }
+ if ( (event->key.keysym.sym == SDLK_g) &&
+ (event->key.keysym.mod & KMOD_CTRL) ) {
+ HotKey_ToggleGrab();
+ }
+ if ( (event->key.keysym.sym == SDLK_z) &&
+ (event->key.keysym.mod & KMOD_CTRL) ) {
+ HotKey_Iconify();
+ }
+ if ( (event->key.keysym.sym == SDLK_RETURN) &&
+ (event->key.keysym.mod & KMOD_ALT) ) {
+ HotKey_ToggleFullScreen();
+ }
+ return(0);
+
+ /* Pass the video resize event through .. */
+ case SDL_VIDEORESIZE:
+ return(1);
+
+ /* This is important! Queue it if we want to quit. */
+ case SDL_QUIT:
+ if ( ! reallyquit ) {
+ reallyquit = 1;
+ printf("Quit requested\n");
+ return(0);
+ }
+ printf("Quit demanded\n");
+ return(1);
+
+ /* This will never happen because events queued directly
+ to the event queue are not filtered.
+ */
+ case SDL_USEREVENT:
+ return(1);
+
+ /* Drop all other events */
+ default:
+ return(0);
+ }
+}
+
+
+
+/*------------------------------------------------------------------------------
+ * CLASS DEF
+ */
+static t_class *rawmouse_class;
+
+typedef struct _rawmouse {
+ t_object x_obj;
+ SDL_Cursor *x_mouse;
+ int read_ok;
+ int started;
+ int relative;
+ t_outlet *x_axis_out[RAWMOUSE_AXES];
+ t_outlet *x_button_num_out;
+ t_outlet *x_button_val_out;
+ t_clock *x_clock;
+ double x_delaytime;
+ int x_buttons;
+ int x_axes;
+} t_rawmouse;
+
+/*------------------------------------------------------------------------------
+ */
+
+static int rawmouse_close(t_rawmouse *x) {
+ DEBUG(post("rawmouse_CLOSE"));
+
+}
+
+static int rawmouse_open(t_rawmouse *x) {
+ rawmouse_close(x);
+
+ DEBUG(post("rawmouse_OPEN"));
+
+ post (" device has %i axes and %i buttons.\n",x->x_axes,x->x_buttons);
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+ post ("This object is under development! The interface could change at anytime!");
+ post ("As I write cross-platform versions, the interface might have to change.");
+ post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING");
+
+ return 1;
+}
+
+void rawmouse_start(t_rawmouse* x)
+{
+ DEBUG(post("rawmouse_START"));
+
+ post("started: %f",x->started);
+ if ( ! x->started ) {
+/* SDL_ShowCursor(0); */
+ SDL_WM_GrabInput(SDL_GRAB_ON);
+
+ clock_delay(x->x_clock, 0);
+
+ x->started = 1;
+ }
+}
+
+
+void rawmouse_stop(t_rawmouse* x) {
+ DEBUG(post("rawmouse_STOP");)
+
+ if ( x->started ) {
+/* SDL_ShowCursor(1); */
+ SDL_WM_GrabInput(SDL_GRAB_OFF);
+
+ clock_unset(x->x_clock);
+ x->started = 0;
+ }
+}
+
+static int rawmouse_read(t_rawmouse *x,int fd) {
+ SDL_Event event;
+
+ DEBUG(post("rawmouse_READ"));
+
+ while (SDL_PollEvent(&event)) {
+ post("event type: %s", event.type);
+ switch (event.type) {
+ case SDL_KEYDOWN:
+ post("SDL_KEYDOWN");
+ if ( event.key.keysym.sym == SDLK_ESCAPE )
+ rawmouse_stop(x);
+ break;
+/* case SDL_MOUSEMOTION: */
+/* if (x->relative) { */
+/* outlet_float (x->x_axis_out[RAWMOUSE_XAXIS], event.motion.xrel); */
+/* outlet_float (x->x_axis_out[RAWMOUSE_YAXIS], event.motion.yrel); */
+/* } else { */
+/* outlet_float (x->x_axis_out[RAWMOUSE_XAXIS], event.motion.xrel); */
+/* outlet_float (x->x_axis_out[RAWMOUSE_YAXIS], event.motion.yrel); */
+/* } */
+/* break; */
+/* case SDL_MOUSEBUTTONDOWN: */
+/* outlet_float (x->x_button_val_out, 1); */
+/* outlet_float (x->x_button_num_out, event.button.button); */
+/* break; */
+/* case SDL_MOUSEBUTTONUP: */
+/* outlet_float (x->x_button_val_out, 0); */
+/* outlet_float (x->x_button_num_out, event.button.button); */
+/* break; */
+ default:
+ DEBUG(post("Unhandled event."));
+ }
+ }
+
+ if (x->started)
+ clock_delay(x->x_clock, x->x_delaytime);
+
+ return NULL;
+}
+
+/* Actions */
+
+static void rawmouse_bang(t_rawmouse* x) {
+ DEBUG(post("rawmouse_bang"));
+}
+
+static void rawmouse_float(t_rawmouse* x) {
+ DEBUG(post("rawmouse_float"));
+}
+
+void rawmouse_delay(t_rawmouse* x, t_float f) {
+ DEBUG(post("rawmouse_DELAY %f",f);)
+
+ x->x_delaytime = f;
+}
+void rawmouse_absolute(t_rawmouse* x) {
+ DEBUG(post("rawmouse_ABSOLUTE"));
+
+ x->relative = 0;
+}
+void rawmouse_relative(t_rawmouse* x) {
+ DEBUG(post("rawmouse_RELATIVE"));
+
+ x->relative = 1;
+}
+
+
+/* SETUP FUNCTIONS */
+
+static void rawmouse_free(t_rawmouse* x) {
+ DEBUG(post("rawmouse_free"));
+
+ rawmouse_stop(x);
+
+ SDL_Quit();
+
+ clock_free(x->x_clock);
+}
+
+static void *rawmouse_new(t_float argument) {
+ int i;
+ t_rawmouse *x = (t_rawmouse *)pd_new(rawmouse_class);
+
+ DEBUG(post("rawmouse_NEW"));
+ post("rawHID(e) rawmouse %s, <hans@eds.org>", version);
+
+ /* init vars */
+ x->read_ok = 1;
+ x->started = 0;
+ x->relative = 1;
+
+ x->x_delaytime = 5;
+
+ x->x_clock = clock_new(x, (t_method)rawmouse_read);
+
+ /* Note: Video is required to start Event Loop !! */
+ if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+ post("Could not initialize SDL: %s\n", SDL_GetError());
+ // exit(-1);
+ return (0); /* changed by olafmatt */
+ }
+ atexit(SDL_Quit);
+
+ SDL_WM_SetCaption(title, "rawmouse");
+
+ /* create outlets for each axis */
+ for (i = 0; i < RAWMOUSE_AXES; i++)
+ x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float);
+
+ /* create outlets for buttons */
+ x->x_button_num_out = outlet_new(&x->x_obj, &s_float);
+ x->x_button_val_out = outlet_new(&x->x_obj, &s_float);
+
+ /* Open the device and save settings */
+ if ( ! rawmouse_open(x) ) return x;
+
+ return (x);
+}
+
+
+void rawmouse_setup(void) {
+ DEBUG(post("rawmouse_setup");)
+ rawmouse_class = class_new(gensym("rawmouse"),
+ (t_newmethod)rawmouse_new,
+ (t_method)rawmouse_free,
+ sizeof(t_rawmouse),0,A_DEFFLOAT,0);
+
+ /* add inlet datatype methods */
+ class_addfloat(rawmouse_class,(t_method) rawmouse_float);
+ class_addbang(rawmouse_class,(t_method) rawmouse_bang);
+
+ /* add inlet message methods */
+ class_addmethod(rawmouse_class,(t_method) rawmouse_open,gensym("open"),0);
+ class_addmethod(rawmouse_class,(t_method) rawmouse_close,gensym("close"),0);
+
+ class_addmethod(rawmouse_class,(t_method) rawmouse_start,gensym("start"),0);
+ class_addmethod(rawmouse_class,(t_method) rawmouse_stop,gensym("stop"),0);
+
+ class_addmethod(rawmouse_class,(t_method) rawmouse_read,gensym("read"),0);
+
+ class_addmethod(rawmouse_class,(t_method) rawmouse_delay,gensym("delay"),A_FLOAT,0);
+
+ class_addmethod(rawmouse_class,(t_method) rawmouse_absolute,gensym("absolute"),0);
+ class_addmethod(rawmouse_class,(t_method) rawmouse_relative,gensym("relative"),0);
+}
+
|