diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-05-09 16:04:00 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-05-09 16:04:00 +0000 |
commit | 9c0e19a3be2288db79e2502e5fa450c3e20a668d (patch) | |
tree | ca97ce615e037a533304fc4660dcf372ca3b9cd6 /pd/src | |
parent | ef50dd62804d54af7da18d8bd8413c0dccd729b8 (diff) |
This commit was generated by cvs2svn to compensate for changes in r610,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=611
Diffstat (limited to 'pd/src')
71 files changed, 10475 insertions, 3325 deletions
diff --git a/pd/src/configure b/pd/src/configure index aa179b0c..30c377dd 100755 --- a/pd/src/configure +++ b/pd/src/configure @@ -1,36 +1,310 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.53. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -# Defaults: -ac_help= +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +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 +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; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +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 + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + 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" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + 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 + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-alsa compile ALSA support" -ac_help="$ac_help - --enable-old-alsa ALSA 0.5x support" -ac_help="$ac_help - --enable-rme compile RME support" -ac_help="$ac_help - --enable-debug debugging support" -ac_help="$ac_help - --with-x use the X Window System" +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="d_arithmetic.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -39,10 +313,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -56,17 +335,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -74,59 +345,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -135,95 +406,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -232,19 +455,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -258,26 +481,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -294,7 +517,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -304,7 +527,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -315,58 +538,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -377,99 +599,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -exec 5>./config.log -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=d_arithmetic.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -479,13 +712,378 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-alsa disable ALSA + --enable-jack jack audio server + --enable-debug debugging support + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-x use the X Window System + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +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_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +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. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -496,39 +1094,99 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -549,241 +1207,649 @@ fi -# Check whether --enable-alsa or --disable-alsa was given. -if test "${enable_alsa+set}" = set; then - enableval="$enable_alsa" - alsa="yes" -fi -# Check whether --enable-old-alsa or --disable-old-alsa was given. -if test "${enable_old_alsa+set}" = set; then - enableval="$enable_old_alsa" - alsa="old" -fi -# Check whether --enable-rme or --disable-rme was given. -if test "${enable_rme+set}" = set; then - enableval="$enable_rme" - rme="yes" -fi +# Check whether --enable-alsa or --disable-alsa was given. +if test "${enable_alsa+set}" = set; then + enableval="$enable_alsa" + alsa="no" +fi; +# Check whether --enable-jack or --disable-jack was given. +if test "${enable_jack+set}" = set; then + enableval="$enable_jack" + jack="yes" +fi; # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" USE_OPT_CFLAGS="NO" else USE_OPT_CFLAGS="YES" +fi; + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - -# Extract the first word of "gcc", so it can be a program name with args. +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:583: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else - echo "$ac_t""no" 1>&6 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:613: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # 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 "$ac_dir/$ac_word" "$@" + set dummy "$as_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:664: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:696: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext << EOF +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;} + { (exit 1); exit 1; }; } -#line 707 "configure" +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# 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. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# 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 + 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;; + 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;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (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 + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:738: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:743: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +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. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# 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 + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - ac_cv_prog_gcc=no -fi + { { 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;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - GCC= + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +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); }; 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_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;} + { (exit 1); exit 1; }; } fi -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:771: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +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_g=yes else - ac_cv_prog_cc_g=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -797,6 +1863,128 @@ else CFLAGS= fi fi +# 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 +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +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 + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "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 () +{ +exit (42); + ; + return 0; +} +_ACEOF +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 + : +else + echo "$as_me: failed program was:" >&5 +cat 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" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +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 + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do @@ -808,14 +1996,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -824,286 +2018,555 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:833: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:886: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftestmake <<\EOF + cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="${MAKE}"' -EOF +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:913: checking how to run the C preprocessor" >&5 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +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. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 928 "configure" + # 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> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + 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 + 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 : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 945 "configure" + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : +#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 + 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 - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 962 "configure" + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +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. + # 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> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + 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 + 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 : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp + # Broken: fails on valid input. +continue fi -rm -f conftest* -fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "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 + 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 -rm -f conftest* - ac_cv_prog_CPP="$CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi - CPP="$ac_cv_prog_CPP" +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - ac_cv_prog_CPP="$CPP" + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$CPP" 1>&6 + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:994: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 - cat > conftest.$ac_ext <<EOF -#line 999 "configure" + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" - -int main() { - -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; +#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]; } -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; +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; } -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; +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 -; return 0; } -EOF -if { (eval echo configure:1048: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +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 + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +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_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1069: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +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 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1074 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +_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 + 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 ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err 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 <<EOF -#line 1099 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <string.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1112,16 +2575,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1117 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <stdlib.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1130,186 +2593,351 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <<EOF -#line 1138 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#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') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (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 : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +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 + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1173: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +done + + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1178 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } #endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +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_type_pid_t=yes else - rm -rf conftest* - ac_cv_type_pid_t=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_pid_t=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define pid_t int -EOF +_ACEOF fi -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1206: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1211 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> +$ac_includes_default +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } #endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +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_type_size_t=yes else - rm -rf conftest* - ac_cv_type_size_t=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define size_t unsigned -EOF +_ACEOF fi -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1239: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1244 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> #include <time.h> -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +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_header_time=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_time=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 -EOF +_ACEOF fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1275: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1280 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +_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 + 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 ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err 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 <<EOF -#line 1305 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <string.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1318,16 +2946,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1323 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <stdlib.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1336,144 +2964,245 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <<EOF -#line 1344 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#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') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (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 : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -for ac_hdr in fcntl.h limits.h malloc.h sys/ioctl.h sys/time.h unistd.h bstring.h + + + + + + + +for ac_header in fcntl.h limits.h malloc.h sys/ioctl.h sys/time.h unistd.h bstring.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1382: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1387 "configure" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +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" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +$ac_includes_default +#include <$ac_header> +_ACEOF +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_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +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" +#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 + 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 -rm -f conftest* +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { 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;};; + 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;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi + done -if test $ac_cv_prog_gcc = yes; then - echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1421: checking whether ${CC-cc} needs -traditional" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" - cat > conftest.$ac_ext <<EOF -#line 1427 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_prog_gcc_traditional=yes else - rm -rf conftest* ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then - cat > conftest.$ac_ext <<EOF -#line 1445 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi - -echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1467: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1472 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -1481,456 +3210,597 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -int main() { +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ int i; -; return 0; } -EOF -if { (eval echo configure:1489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +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_type_signal=void else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_signal=int fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <<EOF +cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal -EOF +_ACEOF -echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1508: checking for vprintf" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1513 "configure" + +for ac_func in vprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vprintf(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vprintf(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_vprintf) || defined (__stub___vprintf) +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -vprintf(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vprintf=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vprintf=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VPRINTF 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -if test "$ac_cv_func_vprintf" != yes; then -echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1560: checking for _doprnt" >&5 -if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1565 "configure" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt(); below. */ + which can conflict with char _doprnt (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char _doprnt (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub__doprnt) || defined (__stub____doprnt) choke me #else -_doprnt(); +f = _doprnt; #endif -; return 0; } -EOF -if { (eval echo configure:1588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func__doprnt=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func__doprnt=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_func__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func__doprnt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 -EOF +_ACEOF -else - echo "$ac_t""no" 1>&6 fi fi +done + + + + + for ac_func in gettimeofday select socket strerror do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1615: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1620 "configure" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:1643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:1670: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1678 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:1689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then PDLIB="$PDLIB -ldl" else - echo "$ac_t""no" 1>&6 -echo "dynamic link support required" || exit 1 + echo "dynamic link support required" || exit 1 fi -echo $ac_n "checking for sin in -lffm""... $ac_c" 1>&6 -echo "configure:1712: checking for sin in -lffm" >&5 -ac_lib_var=`echo ffm'_'sin | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for sin in -lffm" >&5 +echo $ECHO_N "checking for sin in -lffm... $ECHO_C" >&6 +if test "${ac_cv_lib_ffm_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lffm $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1720 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sin(); - -int main() { -sin() -; return 0; } -EOF -if { (eval echo configure:1731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char sin (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +sin (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_ffm_sin=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ffm_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ffm_sin" >&5 +echo "${ECHO_T}$ac_cv_lib_ffm_sin" >&6 +if test $ac_cv_lib_ffm_sin = yes; then PDLIB="$PDLIB -lffm" -else - echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6 -echo "configure:1753: checking for sin in -lm" >&5 -ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for sin in -lm" >&5 +echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_sin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1761 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sin(); - -int main() { -sin() -; return 0; } -EOF -if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char sin (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +sin (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_m_sin=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_m_sin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5 +echo "${ECHO_T}$ac_cv_lib_m_sin" >&6 +if test $ac_cv_lib_m_sin = yes; then PDLIB="$PDLIB -lm" else - echo "$ac_t""no" 1>&6 -echo "math library required" || exit 1 + echo "math library required" || exit 1 fi -echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1795: checking for pthread_create in -lpthread" >&5 -ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1803 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char pthread_create(); - -int main() { -pthread_create() -; return 0; } -EOF -if { (eval echo configure:1814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_pthread_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pthread_pthread_create=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 +if test $ac_cv_lib_pthread_pthread_create = yes; then PDLIB="$PDLIB -lpthread" else - echo "$ac_t""no" 1>&6 -echo "pthreads required" || exit 1 + echo "pthreads required" || exit 1 fi -if test "$alsa" = yes; then - echo $ac_n "checking for snd_pcm_info in -lasound""... $ac_c" 1>&6 -echo "configure:1838: checking for snd_pcm_info in -lasound" >&5 -ac_lib_var=`echo asound'_'snd_pcm_info | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "$alsa" != no; then + echo "$as_me:$LINENO: checking for snd_pcm_info in -lasound" >&5 +echo $ECHO_N "checking for snd_pcm_info in -lasound... $ECHO_C" >&6 +if test "${ac_cv_lib_asound_snd_pcm_info+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1846 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char snd_pcm_info(); - -int main() { -snd_pcm_info() -; return 0; } -EOF -if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + builtin and then its argument prototype would still apply. */ +char snd_pcm_info (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +snd_pcm_info (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_asound_snd_pcm_info=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_asound_snd_pcm_info=no fi -rm -f conftest* -LIBS="$ac_save_LIBS" - +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - PDLIB="$PDLIB -lasound" +echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_info" >&5 +echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_info" >&6 +if test $ac_cv_lib_asound_snd_pcm_info = yes; then + PDLIB="$PDLIB -lasound" ; alsa="yes" else - echo "$ac_t""no" 1>&6 -alsa="" + alsa="" fi -elif test "$alsa" = old; then - echo $ac_n "checking for snd_pcm_info in -lasound""... $ac_c" 1>&6 -echo "configure:1880: checking for snd_pcm_info in -lasound" >&5 -ac_lib_var=`echo asound'_'snd_pcm_info | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lasound $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1888 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char snd_pcm_info(); - -int main() { -snd_pcm_info() -; return 0; } -EOF -if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - PDLIB="$PDLIB -lasound" -else - echo "$ac_t""no" 1>&6 -alsa="" -fi - -fi +echo "$as_me:$LINENO: checking for X" >&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 -# If we find X, set shell vars x_includes and x_libraries to the -# paths, otherwise set no_x=yes. -# Uses ac_ vars as temps to allow command line to override cache and checks. -# --without-x overrides everything else, but does not touch the cache. -echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1927: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" - : -fi +fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. @@ -1940,193 +3810,180 @@ else # Both variables are already set. have_x=yes else -if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. -ac_x_includes=NO ac_x_libraries=NO -rm -fr conftestdir -if mkdir conftestdir; then - cd conftestdir +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. - cat > Imakefile <<'EOF' + cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' -EOF +_ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && - test -f $ac_im_libdir/libX11.$ac_extension; then + test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. - case "$ac_im_incroot" in + case $ac_im_incroot in /usr/include) ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac - case "$ac_im_usrlibdir" in + case $ac_im_usrlibdir in /usr/lib | /lib) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. - rm -fr conftestdir + rm -fr conftest.dir fi -if test "$ac_x_includes" = NO; then - # Guess where to find include files, by looking for this one X11 .h file. - test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h - +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. -cat > conftest.$ac_ext <<EOF -#line 1989 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <$x_direct_test_include> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* +#include <X11/Intrinsic.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 + 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 # We can compile using X headers with no special include directory. ac_x_includes= else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - # Look for the header file in a standard set of common directories. -# Check X11 before X11Rn because it is often a symlink to the current release. - for ac_dir in \ - /usr/X11/include \ - /usr/X11R6/include \ - /usr/X11R5/include \ - /usr/X11R4/include \ - \ - /usr/include/X11 \ - /usr/include/X11R6 \ - /usr/include/X11R5 \ - /usr/include/X11R4 \ - \ - /usr/local/X11/include \ - /usr/local/X11R6/include \ - /usr/local/X11R5/include \ - /usr/local/X11R4/include \ - \ - /usr/local/include/X11 \ - /usr/local/include/X11R6 \ - /usr/local/include/X11R5 \ - /usr/local/include/X11R4 \ - \ - /usr/X386/include \ - /usr/x386/include \ - /usr/XFree86/include/X11 \ - \ - /usr/include \ - /usr/local/include \ - /usr/unsupported/include \ - /usr/athena/include \ - /usr/local/x11r5/include \ - /usr/lpp/Xamples/include \ - \ - /usr/openwin/include \ - /usr/openwin/share/include \ - ; \ - do - if test -r "$ac_dir/$x_direct_test_include"; then - ac_x_includes=$ac_dir - break - fi - done + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done fi -rm -f conftest* -fi # $ac_x_includes = NO +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no -if test "$ac_x_libraries" = NO; then +if test "$ac_x_libraries" = no; then # Check for the libraries. - - test -z "$x_direct_test_library" && x_direct_test_library=Xt - test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc - # See if we find them without any special options. # Don't add to $LIBS permanently. - ac_save_LIBS="$LIBS" - LIBS="-l$x_direct_test_library $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2063 "configure" + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" - -int main() { -${x_direct_test_function}() -; return 0; } -EOF -if { (eval echo configure:2070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - LIBS="$ac_save_LIBS" +#include <X11/Intrinsic.h> +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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 + LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - LIBS="$ac_save_LIBS" -# First see if replacing the include by lib works. -# Check X11 before X11Rn because it is often a symlink to the current release. -for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ - /usr/X11/lib \ - /usr/X11R6/lib \ - /usr/X11R5/lib \ - /usr/X11R4/lib \ - \ - /usr/lib/X11 \ - /usr/lib/X11R6 \ - /usr/lib/X11R5 \ - /usr/lib/X11R4 \ - \ - /usr/local/X11/lib \ - /usr/local/X11R6/lib \ - /usr/local/X11R5/lib \ - /usr/local/X11R4/lib \ - \ - /usr/local/lib/X11 \ - /usr/local/lib/X11R6 \ - /usr/local/lib/X11R5 \ - /usr/local/lib/X11R4 \ - \ - /usr/X386/lib \ - /usr/x386/lib \ - /usr/XFree86/lib/X11 \ - \ - /usr/lib \ - /usr/local/lib \ - /usr/unsupported/lib \ - /usr/athena/lib \ - /usr/local/x11r5/lib \ - /usr/lpp/Xamples/lib \ - /lib/usr/lib/X11 \ - \ - /usr/openwin/lib \ - /usr/openwin/share/lib \ - ; \ + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do + # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do - if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi -rm -f conftest* -fi # $ac_x_libraries = NO +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no -if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else @@ -2135,12 +3992,14 @@ else ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi + fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then - echo "$ac_t""$have_x" 1>&6 + echo "$as_me:$LINENO: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -2149,605 +4008,587 @@ else # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 + echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi -echo $ac_n "checking for XCreateWindow in -lX11""... $ac_c" 1>&6 -echo "configure:2157: checking for XCreateWindow in -lX11" >&5 -ac_lib_var=`echo X11'_'XCreateWindow | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for XCreateWindow in -lX11" >&5 +echo $ECHO_N "checking for XCreateWindow in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XCreateWindow+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 -L$x_libraries $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2165 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XCreateWindow(); - -int main() { -XCreateWindow() -; return 0; } -EOF -if { (eval echo configure:2176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char XCreateWindow (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +XCreateWindow (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_X11_XCreateWindow=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XCreateWindow=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XCreateWindow" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XCreateWindow" >&6 +if test $ac_cv_lib_X11_XCreateWindow = yes; then LIBS="$LIBS -lX11 -L$x_libraries" else - echo "$ac_t""no" 1>&6 -echo "no X11 found" || exit 1 + echo "no X11 found" || exit 1 fi -ac_safe=`echo "tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl.h""... $ac_c" 1>&6 -echo "configure:2201: checking for tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2206 "configure" -#include "confdefs.h" -#include <tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* +if test "${ac_cv_header_tcl_h+set}" = set; then + echo "$as_me:$LINENO: checking for tcl.h" >&5 +echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6 +if test "${ac_cv_header_tcl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.1/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.1/tcl.h""... $ac_c" 1>&6 -echo "configure:2232: checking for tcl8.1/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 +echo "${ECHO_T}$ac_cv_header_tcl_h" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2237 "configure" + # Is the header compilable? +echo "$as_me:$LINENO: checking tcl.h usability" >&5 +echo $ECHO_N "checking tcl.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <tcl8.1/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.1" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.2/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.2/tcl.h""... $ac_c" 1>&6 -echo "configure:2263: checking for tcl8.2/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2268 "configure" -#include "confdefs.h" -#include <tcl8.2/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.2" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.3/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.3/tcl.h""... $ac_c" 1>&6 -echo "configure:2294: checking for tcl8.3/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2299 "configure" -#include "confdefs.h" -#include <tcl8.3/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.3" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.4/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.4/tcl.h""... $ac_c" 1>&6 -echo "configure:2325: checking for tcl8.4/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2330 "configure" -#include "confdefs.h" -#include <tcl8.4/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.4" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.5/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.5/tcl.h""... $ac_c" 1>&6 -echo "configure:2356: checking for tcl8.5/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2361 "configure" +$ac_includes_default +#include <tcl.h> +_ACEOF +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_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking tcl.h presence" >&5 +echo $ECHO_N "checking tcl.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -#include <tcl8.5/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.6/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.6/tcl.h""... $ac_c" 1>&6 -echo "configure:2387: checking for tcl8.6/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +#include <tcl.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 + 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 - cat > conftest.$ac_ext <<EOF -#line 2392 "configure" -#include "confdefs.h" -#include <tcl8.6/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cpp_err=yes fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5" -else - echo "$ac_t""no" 1>&6 -ac_safe=`echo "tcl8.7/tcl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for tcl8.7/tcl.h""... $ac_c" 1>&6 -echo "configure:2418: checking for tcl8.7/tcl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes else - cat > conftest.$ac_ext <<EOF -#line 2423 "configure" -#include "confdefs.h" -#include <tcl8.7/tcl.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5" + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: tcl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: tcl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: tcl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: tcl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for tcl.h" >&5 +echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6 +if test "${ac_cv_header_tcl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_tcl_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_tcl_h" >&5 +echo "${ECHO_T}$ac_cv_header_tcl_h" >&6 + +fi +if test $ac_cv_header_tcl_h = yes; then + : else - echo "$ac_t""no" 1>&6 -echo "no tcl/tk header found" || exit 1 -fi - -fi - -fi - + echo "no tcl/tk header found" || exit 1 fi -fi -fi -fi -fi - - -echo $ac_n "checking for main in -ltcl8.7""... $ac_c" 1>&6 -echo "configure:2466: checking for main in -ltcl8.7" >&5 -ac_lib_var=`echo tcl8.7'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for main in -ltcl8.7" >&5 +echo $ECHO_N "checking for main in -ltcl8.7... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_7_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.7 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2474 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.7 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_7_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_7_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_7_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_7_main" >&6 +if test $ac_cv_lib_tcl8_7_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_7 1 +_ACEOF LIBS="-ltcl8.7 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.6""... $ac_c" 1>&6 -echo "configure:2507: checking for main in -ltcl8.6" >&5 -ac_lib_var=`echo tcl8.6'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.6" >&5 +echo $ECHO_N "checking for main in -ltcl8.6... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_6_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.6 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2515 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.6 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_6_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_6_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_6_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_6_main" >&6 +if test $ac_cv_lib_tcl8_6_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_6 1 +_ACEOF LIBS="-ltcl8.6 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.5""... $ac_c" 1>&6 -echo "configure:2548: checking for main in -ltcl8.5" >&5 -ac_lib_var=`echo tcl8.5'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.5" >&5 +echo $ECHO_N "checking for main in -ltcl8.5... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_5_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.5 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2556 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.5 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_5_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_5_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_5_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_5_main" >&6 +if test $ac_cv_lib_tcl8_5_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_5 1 +_ACEOF LIBS="-ltcl8.5 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.4""... $ac_c" 1>&6 -echo "configure:2589: checking for main in -ltcl8.4" >&5 -ac_lib_var=`echo tcl8.4'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.4" >&5 +echo $ECHO_N "checking for main in -ltcl8.4... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_4_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.4 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2597 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.4 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_4_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_4_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_4_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_4_main" >&6 +if test $ac_cv_lib_tcl8_4_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_4 1 +_ACEOF LIBS="-ltcl8.4 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.3""... $ac_c" 1>&6 -echo "configure:2630: checking for main in -ltcl8.3" >&5 -ac_lib_var=`echo tcl8.3'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.3" >&5 +echo $ECHO_N "checking for main in -ltcl8.3... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_3_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.3 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2638 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.3 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_3_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_3_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_3_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_3_main" >&6 +if test $ac_cv_lib_tcl8_3_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_3 1 +_ACEOF LIBS="-ltcl8.3 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.2""... $ac_c" 1>&6 -echo "configure:2671: checking for main in -ltcl8.2" >&5 -ac_lib_var=`echo tcl8.2'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.2" >&5 +echo $ECHO_N "checking for main in -ltcl8.2... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_2_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.2 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2679 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.2 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_2_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_2_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_2_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_2_main" >&6 +if test $ac_cv_lib_tcl8_2_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_2 1 +_ACEOF LIBS="-ltcl8.2 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltcl8.0""... $ac_c" 1>&6 -echo "configure:2712: checking for main in -ltcl8.0" >&5 -ac_lib_var=`echo tcl8.0'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltcl8.0" >&5 +echo $ECHO_N "checking for main in -ltcl8.0... $ECHO_C" >&6 +if test "${ac_cv_lib_tcl8_0_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltcl8.0 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2720 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tcl8.0 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tcl8_0_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tcl8_0_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_0_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tcl8_0_main" >&6 +if test $ac_cv_lib_tcl8_0_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTCL8_0 1 +_ACEOF LIBS="-ltcl8.0 $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi @@ -2763,293 +4604,411 @@ fi fi -echo $ac_n "checking for main in -ltk8.7""... $ac_c" 1>&6 -echo "configure:2768: checking for main in -ltk8.7" >&5 -ac_lib_var=`echo tk8.7'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.7" >&5 +echo $ECHO_N "checking for main in -ltk8.7... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_7_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.7 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2776 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.7 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_7_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_7_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_7_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_7_main" >&6 +if test $ac_cv_lib_tk8_7_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_7 1 +_ACEOF LIBS="-ltk8.7 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.6""... $ac_c" 1>&6 -echo "configure:2809: checking for main in -ltk8.6" >&5 -ac_lib_var=`echo tk8.6'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.6" >&5 +echo $ECHO_N "checking for main in -ltk8.6... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_6_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.6 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2817 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.6 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_6_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_6_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_6_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_6_main" >&6 +if test $ac_cv_lib_tk8_6_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_6 1 +_ACEOF LIBS="-ltk8.6 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.5""... $ac_c" 1>&6 -echo "configure:2850: checking for main in -ltk8.5" >&5 -ac_lib_var=`echo tk8.5'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.5" >&5 +echo $ECHO_N "checking for main in -ltk8.5... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_5_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.5 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2858 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.5 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_5_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_5_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_5_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_5_main" >&6 +if test $ac_cv_lib_tk8_5_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_5 1 +_ACEOF LIBS="-ltk8.5 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.4""... $ac_c" 1>&6 -echo "configure:2891: checking for main in -ltk8.4" >&5 -ac_lib_var=`echo tk8.4'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.4" >&5 +echo $ECHO_N "checking for main in -ltk8.4... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_4_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.4 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2899 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.4 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_4_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_4_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_4_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_4_main" >&6 +if test $ac_cv_lib_tk8_4_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_4 1 +_ACEOF LIBS="-ltk8.4 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.3""... $ac_c" 1>&6 -echo "configure:2932: checking for main in -ltk8.3" >&5 -ac_lib_var=`echo tk8.3'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.3" >&5 +echo $ECHO_N "checking for main in -ltk8.3... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_3_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.3 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2940 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.3 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_3_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_3_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_3_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_3_main" >&6 +if test $ac_cv_lib_tk8_3_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_3 1 +_ACEOF LIBS="-ltk8.3 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.2""... $ac_c" 1>&6 -echo "configure:2973: checking for main in -ltk8.2" >&5 -ac_lib_var=`echo tk8.2'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.2" >&5 +echo $ECHO_N "checking for main in -ltk8.2... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_2_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.2 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2981 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.2 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_2_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_2_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_2_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_2_main" >&6 +if test $ac_cv_lib_tk8_2_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_2 1 +_ACEOF LIBS="-ltk8.2 $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for main in -ltk8.0""... $ac_c" 1>&6 -echo "configure:3014: checking for main in -ltk8.0" >&5 -ac_lib_var=`echo tk8.0'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for main in -ltk8.0" >&5 +echo $ECHO_N "checking for main in -ltk8.0... $ECHO_C" >&6 +if test "${ac_cv_lib_tk8_0_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ltk8.0 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 3022 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:3029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo tk8.0 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (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_lib_tk8_0_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_tk8_0_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_0_main" >&5 +echo "${ECHO_T}$ac_cv_lib_tk8_0_main" >&6 +if test $ac_cv_lib_tk8_0_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBTK8_0 1 +_ACEOF LIBS="-ltk8.0 $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi @@ -3066,24 +5025,29 @@ fi - -if test `uname -s` = FreeBSD; -then - LDFLAGS="-Wl,-export-dynamic" - EXT=pd_freebsd - MORECFLAGS=-DDL_OPEN - SYSSRC=s_freebsd.c - STRIPFLAG=-s - GUINAME="pd-gui" - OSNUMBER=0 -fi - if test `uname -s` = Linux; then LDFLAGS="-Wl,-export-dynamic" EXT=pd_linux - MORECFLAGS=-DDL_OPEN - SYSSRC=s_linux.c + MORECFLAGS="-DDL_OPEN -DUSEAPI_PORTAUDIO -DPA_USE_OSS -DPA_LITTLE_ENDIAN \ + -DUSEAPI_OSS \ + -I../portaudio/pa_common \ + -I../portaudio/pablio -I../portaudio/portmidi-macosx -Werror" + SYSSRC="s_midi_oss.c s_audio_pa.c s_audio_oss.c \ + ../portaudio/pa_common/pa_allocation.c \ + ../portaudio/pa_common/pa_converters.c \ + ../portaudio/pa_common/pa_cpuload.c \ + ../portaudio/pa_common/pa_dither.c \ + ../portaudio/pa_common/pa_front.c \ + ../portaudio/pa_common/pa_process.c \ + ../portaudio/pa_common/pa_skeleton.c \ + ../portaudio/pa_common/pa_stream.c \ + ../portaudio/pa_common/pa_trace.c \ + ../portaudio/pablio/pablio_pd.c \ + ../portaudio/pablio/ringbuffer_pd.c \ + ../portaudio/pa_unix/pa_unix_hostapis.c \ + ../portaudio/pa_unix/pa_unix_util.c \ + ../portaudio/pa_unix_oss/pa_unix_oss.c " STRIPFLAG=-s GUINAME="pd-gui" if test $USE_OPT_CFLAGS == "YES"; @@ -3095,6 +5059,7 @@ then OSNUMBER=0 fi + if test `uname -s` = IRIX64; then LDFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ @@ -3125,19 +5090,24 @@ then -framework AudioUnit -framework AudioToolbox \ -framework Carbon -framework CoreMIDI" EXT=pd_darwin - MORECFLAGS="-DMACOSX -I/usr/X11R6/include -I../portaudio/pa_common \ - -I../portaudio/pablio -I../portaudio/portmidi-macosx -Wno-error" - SYSSRC="s_mac.c s_portaudio.c ../portaudio/pa_common/pa_lib.c \ - ../portaudio/pa_common/pa_trace.c \ - ../portaudio/pa_common/pa_convert.c \ - ../portaudio/pablio/pablio_pd.c \ - ../portaudio/pablio/ringbuffer_pd.c \ - ../portaudio/pa_mac_core/pa_mac_core.c \ - ../portaudio/portmidi-macosx/pmdarwin.c \ - ../portaudio/portmidi-macosx/pmmacosx.c \ - ../portaudio/portmidi-macosx/pmutil.c \ - ../portaudio/portmidi-macosx/portmidi.c \ - ../portaudio/portmidi-macosx/ptdarwin.c " + MORECFLAGS="-DMACOSX -I/usr/X11R6/include \ + -I../portaudio_v18/pa_common \ + -I../portaudio_v18/pablio \ + -I../portmidi_osx \ + -Wno-error \ + -DUSEAPI_PORTAUDIO -DPA_BIG_ENDIAN" + SYSSRC="s_midi_pm.c s_audio_pa.c \ + ../portaudio_v18/pa_common/pa_lib.c \ + ../portaudio_v18/pa_common/pa_trace.c \ + ../portaudio_v18/pa_common/pa_convert.c \ + ../portaudio_v18/pablio/pablio_pd.c \ + ../portaudio_v18/pablio/ringbuffer_pd.c \ + ../portaudio_v18/pa_mac_core/pa_mac_core.c \ + ../portmidi_osx/pmdarwin.c \ + ../portmidi_osx/pmmacosx.c \ + ../portmidi_osx/pmutil.c \ + ../portmidi_osx/portmidi.c \ + ../portmidi_osx/ptdarwin.c " STRIPFLAG="" GUINAME="pdtcl" GUIFLAGS="-framework Tcl -framework Tk \ @@ -3154,281 +5124,836 @@ then EXTERNTARGET=pd_darwin fi -trap '' 1 2 15 -cat > confcache <<\EOF +ac_config_files="$ac_config_files makefile" +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +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 +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; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +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 + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + 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" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + 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 + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done done +;; + esac -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} -trap 'rm -fr `echo "makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@alsa@%$alsa%g -s%@rme@%$rme%g -s%@PDLIB@%$PDLIB%g -s%@DEFINES@%$DEFINES%g -s%@MORECFLAGS@%$MORECFLAGS%g -s%@EXT@%$EXT%g -s%@OPT_CFLAGS@%$OPT_CFLAGS%g -s%@USE_OPT_CFLAGS@%$USE_OPT_CFLAGS%g -s%@SYSSRC@%$SYSSRC%g -s%@STRIPFLAG@%$STRIPFLAG%g -s%@GUINAME@%$GUINAME%g -s%@GUIFLAGS@%$GUIFLAGS%g -s%@OSNUMBER@%$OSNUMBER%g -s%@EXTERNTARGET@%$EXTERNTARGET%g -s%@CC@%$CC%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CPP@%$CPP%g +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file + as_ln_s='ln -s' fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' fi -EOF +rm -f conf$$ conf$$.exe conf$$.file -cat >> $CONFIG_STATUS <<EOF +as_executable_p="test -f" -CONFIG_FILES=\${CONFIG_FILES-"makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.53, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + case $1 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 + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@alsa@,$alsa,;t t +s,@jack@,$jack,;t t +s,@PDLIB@,$PDLIB,;t t +s,@DEFINES@,$DEFINES,;t t +s,@MORECFLAGS@,$MORECFLAGS,;t t +s,@EXT@,$EXT,;t t +s,@OPT_CFLAGS@,$OPT_CFLAGS,;t t +s,@USE_OPT_CFLAGS@,$USE_OPT_CFLAGS,;t t +s,@SYSSRC@,$SYSSRC,;t t +s,@STRIPFLAG@,$STRIPFLAG,;t t +s,@GUINAME@,$GUINAME,;t t +s,@GUIFLAGS@,$GUIFLAGS,;t t +s,@OSNUMBER@,$OSNUMBER,;t t +s,@EXTERNTARGET@,$EXTERNTARGET,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CPP@,$CPP,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi +fi # test -n "$CONFIG_FILES" - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^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; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +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_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi -EOF -cat >> $CONFIG_STATUS <<EOF +done +_ACEOF -EOF -cat >> $CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<\_ACEOF -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || 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. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/pd/src/configure.in b/pd/src/configure.in index da70b29e..52d45609 100644 --- a/pd/src/configure.in +++ b/pd/src/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(d_arithmetic.c) AC_SUBST(alsa) -AC_SUBST(rme) +AC_SUBST(jack) AC_SUBST(PDLIB) AC_SUBST(DEFINES) AC_SUBST(MORECFLAGS) @@ -20,12 +20,10 @@ dnl other defaults dnl check for features -AC_ARG_ENABLE(alsa, [ --enable-alsa compile ALSA support], - alsa="yes") -AC_ARG_ENABLE(old-alsa,[ --enable-old-alsa ALSA 0.5x support], - alsa="old") -AC_ARG_ENABLE(rme, [ --enable-rme compile RME support], - rme="yes") +AC_ARG_ENABLE(alsa, [ --disable-alsa disable ALSA], + alsa="no") +AC_ARG_ENABLE(jack, [ --enable-jack jack audio server], + jack="yes") AC_ARG_ENABLE(debug, [ --enable-debug debugging support], USE_OPT_CFLAGS="NO", USE_OPT_CFLAGS="YES") @@ -70,10 +68,8 @@ AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread", echo "pthreads required" || exit 1) dnl This should be fixed so Pd can use ALSA shared libraries where appropriate. -if test "$alsa" = yes; then - AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound",alsa="") -elif test "$alsa" = old; then - AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound",alsa="") +if test "$alsa" != no; then + AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="") fi dnl Find paths to includes and libraries for X11 @@ -84,15 +80,7 @@ AC_CHECK_LIB(X11, XCreateWindow, LIBS="$LIBS -lX11 -L$x_libraries", dnl look for tcl 8.x... do I really have to go through all this!? -AC_CHECK_HEADER(tcl.h,, - AC_CHECK_HEADER(tcl8.1/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.1", - AC_CHECK_HEADER(tcl8.2/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.2", - AC_CHECK_HEADER(tcl8.3/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.3", - AC_CHECK_HEADER(tcl8.4/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.4", - AC_CHECK_HEADER(tcl8.5/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", - AC_CHECK_HEADER(tcl8.6/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", - AC_CHECK_HEADER(tcl8.7/tcl.h,GUIFLAGS="$GUIFLAGS -I /usr/include/tcl8.5", - echo "no tcl/tk header found" || exit 1)))))))) +AC_CHECK_HEADER(tcl.h,, echo "no tcl/tk header found" || exit 1) AC_CHECK_LIB(tcl8.7, main,, AC_CHECK_LIB(tcl8.6, main,, @@ -114,24 +102,29 @@ dnl Checking for tk.h or tkstep.h - not used at the moment dnl AC_CHECK_HEADER(tk.h,DEFINES="$DEFINES -DTKINC=\\\"tk.h\\\"") dnl AC_CHECK_HEADER(tkstep.h,DEFINES="$DEFINES -DTKINC=\\\"tkstep.h\\\"") - -if test `uname -s` = FreeBSD; -then - LDFLAGS="-Wl,-export-dynamic" - EXT=pd_freebsd - MORECFLAGS=-DDL_OPEN - SYSSRC=s_freebsd.c - STRIPFLAG=-s - GUINAME="pd-gui" - OSNUMBER=0 -fi - if test `uname -s` = Linux; then LDFLAGS="-Wl,-export-dynamic" EXT=pd_linux - MORECFLAGS=-DDL_OPEN - SYSSRC=s_linux.c + MORECFLAGS="-DDL_OPEN -DUSEAPI_PORTAUDIO -DPA_USE_OSS -DPA_LITTLE_ENDIAN \ + -DUSEAPI_OSS \ + -I../portaudio/pa_common \ + -I../portaudio/pablio -I../portaudio/portmidi-macosx -Werror" + SYSSRC="s_midi_oss.c s_audio_pa.c s_audio_oss.c \ + ../portaudio/pa_common/pa_allocation.c \ + ../portaudio/pa_common/pa_converters.c \ + ../portaudio/pa_common/pa_cpuload.c \ + ../portaudio/pa_common/pa_dither.c \ + ../portaudio/pa_common/pa_front.c \ + ../portaudio/pa_common/pa_process.c \ + ../portaudio/pa_common/pa_skeleton.c \ + ../portaudio/pa_common/pa_stream.c \ + ../portaudio/pa_common/pa_trace.c \ + ../portaudio/pablio/pablio_pd.c \ + ../portaudio/pablio/ringbuffer_pd.c \ + ../portaudio/pa_unix/pa_unix_hostapis.c \ + ../portaudio/pa_unix/pa_unix_util.c \ + ../portaudio/pa_unix_oss/pa_unix_oss.c " STRIPFLAG=-s GUINAME="pd-gui" if test $USE_OPT_CFLAGS == "YES"; @@ -143,6 +136,8 @@ then OSNUMBER=0 fi +dnl **** note -- SGI/IRIX code is broken here!!! *** + if test `uname -s` = IRIX64; then LDFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ @@ -173,19 +168,24 @@ then -framework AudioUnit -framework AudioToolbox \ -framework Carbon -framework CoreMIDI" EXT=pd_darwin - MORECFLAGS="-DMACOSX -I/usr/X11R6/include -I../portaudio/pa_common \ - -I../portaudio/pablio -I../portaudio/portmidi-macosx -Wno-error" - SYSSRC="s_mac.c s_portaudio.c ../portaudio/pa_common/pa_lib.c \ - ../portaudio/pa_common/pa_trace.c \ - ../portaudio/pa_common/pa_convert.c \ - ../portaudio/pablio/pablio_pd.c \ - ../portaudio/pablio/ringbuffer_pd.c \ - ../portaudio/pa_mac_core/pa_mac_core.c \ - ../portaudio/portmidi-macosx/pmdarwin.c \ - ../portaudio/portmidi-macosx/pmmacosx.c \ - ../portaudio/portmidi-macosx/pmutil.c \ - ../portaudio/portmidi-macosx/portmidi.c \ - ../portaudio/portmidi-macosx/ptdarwin.c " + MORECFLAGS="-DMACOSX -I/usr/X11R6/include \ + -I../portaudio_v18/pa_common \ + -I../portaudio_v18/pablio \ + -I../portmidi_osx \ + -Wno-error \ + -DUSEAPI_PORTAUDIO -DPA_BIG_ENDIAN" + SYSSRC="s_midi_pm.c s_audio_pa.c \ + ../portaudio_v18/pa_common/pa_lib.c \ + ../portaudio_v18/pa_common/pa_trace.c \ + ../portaudio_v18/pa_common/pa_convert.c \ + ../portaudio_v18/pablio/pablio_pd.c \ + ../portaudio_v18/pablio/ringbuffer_pd.c \ + ../portaudio_v18/pa_mac_core/pa_mac_core.c \ + ../portmidi_osx/pmdarwin.c \ + ../portmidi_osx/pmmacosx.c \ + ../portmidi_osx/pmutil.c \ + ../portmidi_osx/portmidi.c \ + ../portmidi_osx/ptdarwin.c " STRIPFLAG="" GUINAME="pdtcl" GUIFLAGS="-framework Tcl -framework Tk \ diff --git a/pd/src/d_array.c b/pd/src/d_array.c index e870b522..2a78e144 100644 --- a/pd/src/d_array.c +++ b/pd/src/d_array.c @@ -6,7 +6,7 @@ /* LATER make tabread4 and tabread~ */ -#include "m_imp.h" +#include "m_pd.h" /* ------------------------- tabwrite~ -------------------------- */ @@ -432,8 +432,8 @@ static t_int *tabread4_tilde_perform(t_int *w) post("fp = %lx, shit = %lx, b = %f", fp, buf->b_shit, b); */ cminusb = c-b; *out++ = b + frac * ( - cminusb - 0.5f * (frac-1.) * ( - (a - d + 3.0f * cminusb) * frac + (b - a - cminusb) + cminusb - 0.1666667f * (1.-frac) * ( + (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) ) ); } @@ -501,7 +501,7 @@ static void tabread4_tilde_setup(void) #define LOWOFFSET 1 /* word offset to find LSB */ #define int32 long /* a data type that has 32 bits */ #else -#ifdef NT +#ifdef MSW /* little-endian; most significant byte is at highest address */ #define HIOFFSET 1 #define LOWOFFSET 0 @@ -545,7 +545,7 @@ static void tabread4_tilde_setup(void) #endif /* MACOSX */ #endif /* __linux__ */ -#endif /* NT */ +#endif /* MSW */ #endif /* SGI */ union tabfudge @@ -616,8 +616,8 @@ static t_int *tabosc4_tilde_perform(t_int *w) d = addr[3]; cminusb = c-b; *out++ = b + frac * ( - cminusb - 0.5f * (frac-1.) * ( - (a - d + 3.0f * cminusb) * frac + (b - a - cminusb) + cminusb - 0.1666667f * (1.-frac) * ( + (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) ) ); } @@ -944,8 +944,8 @@ static void tabread4_float(t_tabread4 *x, t_float f) d = fp[2]; cminusb = c-b; outlet_float(x->x_obj.ob_outlet, b + frac * ( - cminusb - 0.5f * (frac-1.) * ( - (a - d + 3.0f * cminusb) * frac + (b - a - cminusb)))); + cminusb - 0.1666667f * (1.-frac) * ( + (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b)))); } } diff --git a/pd/src/d_ctl.c b/pd/src/d_ctl.c index 461703d2..a2f5cd76 100644 --- a/pd/src/d_ctl.c +++ b/pd/src/d_ctl.c @@ -2,15 +2,15 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -/* The sig~ and line~ routines; possibly fancier envelope generators to - come later. +/* sig~ and line~ control-to-signal converters; + snapshot~ signal-to-control converter. */ #include "m_pd.h" #include "math.h" /* -------------------------- sig~ ------------------------------ */ -static t_class *sig_class; +static t_class *sig_tilde_class; typedef struct _sig { @@ -18,16 +18,17 @@ typedef struct _sig float x_f; } t_sig; -static t_int *sig_perform(t_int *w) +static t_int *sig_tilde_perform(t_int *w) { t_float f = *(t_float *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); - while (n--) *out++ = f; + while (n--) + *out++ = f; return (w+4); } -static t_int *sig_perf8(t_int *w) +static t_int *sig_tilde_perf8(t_int *w) { t_float f = *(t_float *)(w[1]); t_float *out = (t_float *)(w[2]); @@ -50,39 +51,39 @@ static t_int *sig_perf8(t_int *w) void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n) { if (n&7) - dsp_add(sig_perform, 3, in, out, n); + dsp_add(sig_tilde_perform, 3, in, out, n); else - dsp_add(sig_perf8, 3, in, out, n); + dsp_add(sig_tilde_perf8, 3, in, out, n); } -static void sig_float(t_sig *x, t_float f) +static void sig_tilde_float(t_sig *x, t_float f) { x->x_f = f; } -static void sig_dsp(t_sig *x, t_signal **sp) +static void sig_tilde_dsp(t_sig *x, t_signal **sp) { - dsp_add(sig_perform, 3, &x->x_f, sp[0]->s_vec, sp[0]->s_n); + dsp_add(sig_tilde_perform, 3, &x->x_f, sp[0]->s_vec, sp[0]->s_n); } -static void *sig_new(t_floatarg f) +static void *sig_tilde_new(t_floatarg f) { - t_sig *x = (t_sig *)pd_new(sig_class); + t_sig *x = (t_sig *)pd_new(sig_tilde_class); x->x_f = f; outlet_new(&x->x_obj, gensym("signal")); return (x); } -static void sig_setup(void) +static void sig_tilde_setup(void) { - sig_class = class_new(gensym("sig~"), (t_newmethod)sig_new, 0, + sig_tilde_class = class_new(gensym("sig~"), (t_newmethod)sig_tilde_new, 0, sizeof(t_sig), 0, A_DEFFLOAT, 0); - class_addfloat(sig_class, (t_method)sig_float); - class_addmethod(sig_class, (t_method)sig_dsp, gensym("dsp"), 0); + class_addfloat(sig_tilde_class, (t_method)sig_tilde_float); + class_addmethod(sig_tilde_class, (t_method)sig_tilde_dsp, gensym("dsp"), 0); } /* -------------------------- line~ ------------------------------ */ -static t_class *line_class; +static t_class *line_tilde_class; typedef struct _line { @@ -92,14 +93,14 @@ typedef struct _line float x_biginc; float x_inc; float x_1overn; - float x_msectodsptick; + float x_dspticktomsec; float x_inletvalue; float x_inletwas; int x_ticksleft; int x_retarget; } t_line; -static t_int *line_perform(t_int *w) +static t_int *line_tilde_perform(t_int *w) { t_line *x = (t_line *)(w[1]); t_float *out = (t_float *)(w[2]); @@ -110,7 +111,7 @@ static t_int *line_perform(t_int *w) x->x_value = f = 0; if (x->x_retarget) { - int nticks = x->x_inletwas * x->x_msectodsptick; + int nticks = x->x_inletwas * x->x_dspticktomsec; if (!nticks) nticks = 1; x->x_ticksleft = nticks; x->x_biginc = (x->x_target - x->x_value)/(float)nticks; @@ -132,7 +133,7 @@ static t_int *line_perform(t_int *w) return (w+4); } -static void line_float(t_line *x, t_float f) +static void line_tilde_float(t_line *x, t_float f) { if (x->x_inletvalue <= 0) { @@ -148,22 +149,22 @@ static void line_float(t_line *x, t_float f) } } -static void line_stop(t_line *x) +static void line_tilde_stop(t_line *x) { x->x_target = x->x_value; x->x_ticksleft = x->x_retarget = 0; } -static void line_dsp(t_line *x, t_signal **sp) +static void line_tilde_dsp(t_line *x, t_signal **sp) { - dsp_add(line_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); + dsp_add(line_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); x->x_1overn = 1./sp[0]->s_n; - x->x_msectodsptick = sp[0]->s_sr / (1000 * sp[0]->s_n); + x->x_dspticktomsec = sp[0]->s_sr / (1000 * sp[0]->s_n); } -static void *line_new(void) +static void *line_tilde_new(void) { - t_line *x = (t_line *)pd_new(line_class); + t_line *x = (t_line *)pd_new(line_tilde_class); outlet_new(&x->x_obj, gensym("signal")); floatinlet_new(&x->x_obj, &x->x_inletvalue); x->x_ticksleft = x->x_retarget = 0; @@ -171,17 +172,200 @@ static void *line_new(void) return (x); } -static void line_setup(void) +static void line_tilde_setup(void) { - line_class = class_new(gensym("line~"), line_new, 0, + line_tilde_class = class_new(gensym("line~"), line_tilde_new, 0, sizeof(t_line), 0, 0); - class_addfloat(line_class, (t_method)line_float); - class_addmethod(line_class, (t_method)line_dsp, gensym("dsp"), 0); - class_addmethod(line_class, (t_method)line_stop, gensym("stop"), 0); + class_addfloat(line_tilde_class, (t_method)line_tilde_float); + class_addmethod(line_tilde_class, (t_method)line_tilde_dsp, + gensym("dsp"), 0); + class_addmethod(line_tilde_class, (t_method)line_tilde_stop, + gensym("stop"), 0); +} + +/* -------------------------- vline~ ------------------------------ */ +static t_class *vline_tilde_class; + +typedef struct _vseg +{ + double s_targettime; + double s_starttime; + float s_target; + struct _vseg *s_next; +} t_vseg; + +typedef struct _vline +{ + t_object x_obj; + double x_value; + double x_inc; + double x_referencetime; + double x_samppermsec; + double x_msecpersamp; + double x_targettime; + float x_target; + float x_inlet1; + float x_inlet2; + t_vseg *x_list; +} t_vline; + +static t_int *vline_tilde_perform(t_int *w) +{ + t_vline *x = (t_vline *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = (int)(w[3]), i; + double f = x->x_value; + double inc = x->x_inc; + double msecpersamp = x->x_msecpersamp; + double samppermsec = x->x_samppermsec; + double timenow = clock_gettimesince(x->x_referencetime) - n * msecpersamp; + t_vseg *s = x->x_list; + for (i = 0; i < n; i++) + { + double timenext = timenow + msecpersamp; + checknext: + if (s) + { + /* has starttime elapsed? If so update value and increment */ + if (s->s_starttime < timenext) + { + if (x->x_targettime <= timenext) + f = x->x_target, inc = 0; + /* if zero-length segment bash output value */ + if (s->s_targettime <= s->s_starttime) + { + f = s->s_target; + inc = 0; + } + else + { + double incpermsec = (s->s_target - f)/ + (s->s_targettime - s->s_starttime); + f = f + incpermsec * (timenext - s->s_starttime); + inc = incpermsec * msecpersamp; + } + x->x_inc = inc; + x->x_target = s->s_target; + x->x_targettime = s->s_targettime; + x->x_list = s->s_next; + t_freebytes(s, sizeof(*s)); + s = x->x_list; + goto checknext; + } + } + if (x->x_targettime <= timenext) + f = x->x_target, inc = 0; + *out++ = f; + f = f + inc; + timenow = timenext; + } + x->x_value = f; + return (w+4); +} + +static void vline_tilde_stop(t_vline *x) +{ + t_vseg *s1, *s2; + for (s1 = x->x_list; s1; s1 = s2) + s2 = s1->s_next, t_freebytes(s1, sizeof(*s1)); + x->x_list = 0; + x->x_inc = 0; + x->x_inlet1 = x->x_inlet2 = 0; +} + +static void vline_tilde_float(t_vline *x, t_float f) +{ + double timenow = clock_gettimesince(x->x_referencetime); + float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1); + float inlet2 = x->x_inlet2; + double starttime = timenow + inlet2; + t_vseg *s1, *s2, *deletefrom = 0, + *snew = (t_vseg *)t_getbytes(sizeof(*snew)); + if (PD_BADFLOAT(f)) + f = 0; + + /* negative delay input means stop and jump immediately to new value */ + if (inlet2 < 0) + { + vline_tilde_stop(x); + x->x_value = f; + return; + } + /* check if we supplant the first item in the list. We supplant + an item by having an earlier starttime, or an equal starttime unless + the equal one was instantaneous and the new one isn't (in which case + we'll do a jump-and-slide starting at that time.) */ + if (!x->x_list || x->x_list->s_starttime > starttime || + (x->x_list->s_starttime == starttime && + (x->x_list->s_targettime > x->x_list->s_starttime || inlet1 <= 0))) + { + deletefrom = x->x_list; + x->x_list = snew; + } + else + { + for (s1 = x->x_list; s2 = s1->s_next; s1 = s2) + { + if (s2->s_starttime > starttime || + (s2->s_starttime == starttime && + (s2->s_targettime > s2->s_starttime || inlet1 <= 0))) + { + deletefrom = s2; + s1->s_next = snew; + goto didit; + } + } + s1->s_next = snew; + deletefrom = 0; + didit: ; + } + while (deletefrom) + { + s1 = deletefrom->s_next; + t_freebytes(deletefrom, sizeof(*deletefrom)); + deletefrom = s1; + } + snew->s_next = 0; + snew->s_target = f; + snew->s_starttime = starttime; + snew->s_targettime = starttime + inlet1; + x->x_inlet1 = x->x_inlet2 = 0; +} + +static void vline_tilde_dsp(t_vline *x, t_signal **sp) +{ + dsp_add(vline_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); + x->x_samppermsec = ((double)(sp[0]->s_sr)) / 1000; + x->x_msecpersamp = ((double)1000) / sp[0]->s_sr; +} + +static void *vline_tilde_new(void) +{ + t_vline *x = (t_vline *)pd_new(vline_tilde_class); + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_inlet1); + floatinlet_new(&x->x_obj, &x->x_inlet2); + x->x_inlet1 = x->x_inlet2 = 0; + x->x_value = x->x_inc = 0; + x->x_referencetime = clock_getlogicaltime(); + x->x_list = 0; + x->x_samppermsec = 0; + return (x); +} + +static void vline_tilde_setup(void) +{ + vline_tilde_class = class_new(gensym("vline~"), vline_tilde_new, + (t_method)vline_tilde_stop, sizeof(t_vline), 0, 0); + class_addfloat(vline_tilde_class, (t_method)vline_tilde_float); + class_addmethod(vline_tilde_class, (t_method)vline_tilde_dsp, + gensym("dsp"), 0); + class_addmethod(vline_tilde_class, (t_method)vline_tilde_stop, + gensym("stop"), 0); } /* -------------------------- snapshot~ ------------------------------ */ -static t_class *snapshot_class; +static t_class *snapshot_tilde_class; typedef struct _snapshot { @@ -190,16 +374,16 @@ typedef struct _snapshot float x_f; } t_snapshot; -static void *snapshot_new(void) +static void *snapshot_tilde_new(void) { - t_snapshot *x = (t_snapshot *)pd_new(snapshot_class); + t_snapshot *x = (t_snapshot *)pd_new(snapshot_tilde_class); x->x_value = 0; outlet_new(&x->x_obj, &s_float); x->x_f = 0; return (x); } -static t_int *snapshot_perform(t_int *w) +static t_int *snapshot_tilde_perform(t_int *w) { t_float *in = (t_float *)(w[1]); t_float *out = (t_float *)(w[2]); @@ -207,25 +391,120 @@ static t_int *snapshot_perform(t_int *w) return (w+3); } -static void snapshot_dsp(t_snapshot *x, t_signal **sp) +static void snapshot_tilde_dsp(t_snapshot *x, t_signal **sp) { - dsp_add(snapshot_perform, 2, sp[0]->s_vec + (sp[0]->s_n-1), &x->x_value); + dsp_add(snapshot_tilde_perform, 2, sp[0]->s_vec + (sp[0]->s_n-1), + &x->x_value); } -static void snapshot_bang(t_snapshot *x) +static void snapshot_tilde_bang(t_snapshot *x) { outlet_float(x->x_obj.ob_outlet, x->x_value); } -static void snapshot_setup(void) +static void snapshot_tilde_set(t_snapshot *x, t_floatarg f) { - snapshot_class = class_new(gensym("snapshot~"), snapshot_new, 0, + x->x_value = f; +} + +static void snapshot_tilde_setup(void) +{ + snapshot_tilde_class = class_new(gensym("snapshot~"), snapshot_tilde_new, 0, sizeof(t_snapshot), 0, 0); - CLASS_MAINSIGNALIN(snapshot_class, t_snapshot, x_f); - class_addmethod(snapshot_class, (t_method)snapshot_dsp, gensym("dsp"), 0); - class_addbang(snapshot_class, snapshot_bang); + CLASS_MAINSIGNALIN(snapshot_tilde_class, t_snapshot, x_f); + class_addmethod(snapshot_tilde_class, (t_method)snapshot_tilde_dsp, + gensym("dsp"), 0); + class_addmethod(snapshot_tilde_class, (t_method)snapshot_tilde_set, + gensym("set"), A_DEFFLOAT, 0); + class_addbang(snapshot_tilde_class, snapshot_tilde_bang); +} + +/* -------------------------- vsnapshot~ ------------------------------ */ +static t_class *vsnapshot_tilde_class; + +typedef struct _vsnapshot +{ + t_object x_obj; + int x_n; + int x_gotone; + t_sample *x_vec; + float x_f; + float x_sampspermsec; + double x_time; +} t_vsnapshot; + +static void *vsnapshot_tilde_new(void) +{ + t_vsnapshot *x = (t_vsnapshot *)pd_new(vsnapshot_tilde_class); + outlet_new(&x->x_obj, &s_float); + x->x_f = 0; + x->x_n = 0; + x->x_vec = 0; + x->x_gotone = 0; + return (x); } +static t_int *vsnapshot_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_vsnapshot *x = (t_vsnapshot *)(w[2]); + t_float *out = x->x_vec; + int n = x->x_n, i; + for (i = 0; i < n; i++) + out[i] = in[i]; + x->x_time = clock_getlogicaltime(); + x->x_gotone = 1; + return (w+3); +} + +static void vsnapshot_tilde_dsp(t_vsnapshot *x, t_signal **sp) +{ + int n = sp[0]->s_n; + if (n != x->x_n) + { + if (x->x_vec) + t_freebytes(x->x_vec, x->x_n * sizeof(t_sample)); + x->x_vec = (t_sample *)getbytes(n * sizeof(t_sample)); + x->x_gotone = 0; + x->x_n = n; + } + x->x_sampspermsec = sp[0]->s_sr / 1000; + dsp_add(vsnapshot_tilde_perform, 2, sp[0]->s_vec, x); +} + +static void vsnapshot_tilde_bang(t_vsnapshot *x) +{ + float val; + if (x->x_gotone) + { + int indx = clock_gettimesince(x->x_time) * x->x_sampspermsec; + if (indx < 0) + indx = 0; + else if (indx >= x->x_n) + indx = x->x_n - 1; + val = x->x_vec[indx]; + } + else val = 0; + outlet_float(x->x_obj.ob_outlet, val); +} + +static void vsnapshot_tilde_ff(t_vsnapshot *x) +{ + if (x->x_vec) + t_freebytes(x->x_vec, x->x_n * sizeof(t_sample)); +} + +static void vsnapshot_tilde_setup(void) +{ + vsnapshot_tilde_class = class_new(gensym("vsnapshot~"), + vsnapshot_tilde_new, (t_method)vsnapshot_tilde_ff, + sizeof(t_vsnapshot), 0, 0); + CLASS_MAINSIGNALIN(vsnapshot_tilde_class, t_vsnapshot, x_f); + class_addmethod(vsnapshot_tilde_class, (t_method)vsnapshot_tilde_dsp, gensym("dsp"), 0); + class_addbang(vsnapshot_tilde_class, vsnapshot_tilde_bang); +} + + /* ---------------- env~ - simple envelope follower. ----------------- */ #define MAXOVERLAP 10 @@ -246,10 +525,10 @@ typedef struct sigenv float x_f; } t_sigenv; -t_class *sigenv_class; -static void sigenv_tick(t_sigenv *x); +t_class *env_tilde_class; +static void env_tilde_tick(t_sigenv *x); -static void *sigenv_new(t_floatarg fnpoints, t_floatarg fperiod) +static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod) { int npoints = fnpoints; int period = fperiod; @@ -266,7 +545,7 @@ static void *sigenv_new(t_floatarg fnpoints, t_floatarg fperiod) error("env: couldn't allocate buffer"); return (0); } - x = (t_sigenv *)pd_new(sigenv_class); + x = (t_sigenv *)pd_new(env_tilde_class); x->x_buf = buf; x->x_npoints = npoints; x->x_phase = 0; @@ -275,13 +554,13 @@ static void *sigenv_new(t_floatarg fnpoints, t_floatarg fperiod) for (i = 0; i < npoints; i++) buf[i] = (1. - cos((2 * 3.14159 * i) / npoints))/npoints; for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0; - x->x_clock = clock_new(x, (t_method)sigenv_tick); + x->x_clock = clock_new(x, (t_method)env_tilde_tick); x->x_outlet = outlet_new(&x->x_obj, gensym("float")); x->x_f = 0; return (x); } -static t_int *sigenv_perform(t_int *w) +static t_int *env_tilde_perform(t_int *w) { t_sigenv *x = (t_sigenv *)(w[1]); t_float *in = (t_float *)(w[2]); @@ -319,33 +598,33 @@ static t_int *sigenv_perform(t_int *w) return (w+4); } -static void sigenv_dsp(t_sigenv *x, t_signal **sp) +static void env_tilde_dsp(t_sigenv *x, t_signal **sp) { if (x->x_period % sp[0]->s_n) x->x_realperiod = x->x_period + sp[0]->s_n - (x->x_period % sp[0]->s_n); else x->x_realperiod = x->x_period; - dsp_add(sigenv_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); - if (sp[0]->s_n > MAXVSTAKEN) bug("sigenv_dsp"); + dsp_add(env_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); + if (sp[0]->s_n > MAXVSTAKEN) bug("env_tilde_dsp"); } -static void sigenv_tick(t_sigenv *x) /* callback function for the clock */ +static void env_tilde_tick(t_sigenv *x) /* callback function for the clock */ { outlet_float(x->x_outlet, powtodb(x->x_result)); } -static void sigenv_ff(t_sigenv *x) /* cleanup on free */ +static void env_tilde_ff(t_sigenv *x) /* cleanup on free */ { clock_free(x->x_clock); freebytes(x->x_buf, (x->x_npoints + MAXVSTAKEN) * sizeof(float)); } -void sigenv_setup(void ) +void env_tilde_setup(void ) { - sigenv_class = class_new(gensym("env~"), (t_newmethod)sigenv_new, - (t_method)sigenv_ff, sizeof(t_sigenv), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - CLASS_MAINSIGNALIN(sigenv_class, t_sigenv, x_f); - class_addmethod(sigenv_class, (t_method)sigenv_dsp, gensym("dsp"), 0); + env_tilde_class = class_new(gensym("env~"), (t_newmethod)env_tilde_new, + (t_method)env_tilde_ff, sizeof(t_sigenv), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(env_tilde_class, t_sigenv, x_f); + class_addmethod(env_tilde_class, (t_method)env_tilde_dsp, gensym("dsp"), 0); } /* --------------------- threshold~ ----------------------------- */ @@ -487,10 +766,12 @@ static void threshold_tilde_setup( void) void d_ctl_setup(void) { - sig_setup(); - line_setup(); - snapshot_setup(); - sigenv_setup(); + sig_tilde_setup(); + line_tilde_setup(); + vline_tilde_setup(); + snapshot_tilde_setup(); + vsnapshot_tilde_setup(); + env_tilde_setup(); threshold_tilde_setup(); } diff --git a/pd/src/d_dac.c b/pd/src/d_dac.c index 620adba5..c090a214 100644 --- a/pd/src/d_dac.c +++ b/pd/src/d_dac.c @@ -5,7 +5,8 @@ /* The dac~ and adc~ routines. */ -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" /* ----------------------------- dac~ --------------------------- */ static t_class *dac_class; @@ -47,11 +48,11 @@ static void dac_dsp(t_dac *x, t_signal **sp) for (i = x->x_n, ip = x->x_vec, sp2 = sp; i--; ip++, sp2++) { int ch = *ip - 1; - if ((*sp2)->s_n != DACBLKSIZE) + if ((*sp2)->s_n != DEFDACBLKSIZE) error("dac~: bad vector size"); else if (ch >= 0 && ch < sys_get_outchannels()) - dsp_add(plus_perform, 4, sys_soundout + DACBLKSIZE*ch, - (*sp2)->s_vec, sys_soundout + DACBLKSIZE*ch, DACBLKSIZE); + dsp_add(plus_perform, 4, sys_soundout + DEFDACBLKSIZE*ch, + (*sp2)->s_vec, sys_soundout + DEFDACBLKSIZE*ch, DEFDACBLKSIZE); } } @@ -153,12 +154,12 @@ static void adc_dsp(t_adc *x, t_signal **sp) for (i = x->x_n, ip = x->x_vec, sp2 = sp; i--; ip++, sp2++) { int ch = *ip - 1; - if ((*sp2)->s_n != DACBLKSIZE) + if ((*sp2)->s_n != DEFDACBLKSIZE) error("adc~: bad vector size"); else if (ch >= 0 && ch < sys_get_inchannels()) - dsp_add_copy(sys_soundin + DACBLKSIZE*ch, - (*sp2)->s_vec, DACBLKSIZE); - else dsp_add_zero((*sp2)->s_vec, DACBLKSIZE); + dsp_add_copy(sys_soundin + DEFDACBLKSIZE*ch, + (*sp2)->s_vec, DEFDACBLKSIZE); + else dsp_add_zero((*sp2)->s_vec, DEFDACBLKSIZE); } } @@ -170,7 +171,7 @@ static void adc_free(t_adc *x) static void adc_setup(void) { adc_class = class_new(gensym("adc~"), (t_newmethod)adc_new, - (t_method)adc_free, sizeof(t_adc), 0, A_GIMME, 0); + (t_method)adc_free, sizeof(t_adc), CLASS_NOINLET, A_GIMME, 0); class_addmethod(adc_class, (t_method)adc_dsp, gensym("dsp"), A_CANT, 0); class_sethelpsymbol(adc_class, gensym("adc~_dac~")); } diff --git a/pd/src/d_delay.c b/pd/src/d_delay.c index edcf1235..1d4defcf 100644 --- a/pd/src/d_delay.c +++ b/pd/src/d_delay.c @@ -269,8 +269,8 @@ static t_int *sigvd_perform(t_int *w) a = bp[0]; cminusb = c-b; *out++ = b + frac * ( - cminusb - 0.5f * (frac-1.) * ( - (a - d + 3.0f * cminusb) * frac + (b - a - cminusb) + cminusb - 0.1666667f * (1.-frac) * ( + (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) ) ); } diff --git a/pd/src/d_fftroutine.c b/pd/src/d_fftroutine.c index 7f0d2523..1920aca5 100644 --- a/pd/src/d_fftroutine.c +++ b/pd/src/d_fftroutine.c @@ -88,7 +88,7 @@ #include <math.h> #include <stdlib.h> - /* the following is needed only to declare pd_fft() as exportable in NT */ + /* the following is needed only to declare pd_fft() as exportable in MSW */ #include "m_pd.h" /* some basic definitions */ diff --git a/pd/src/d_mayer_fft.c b/pd/src/d_mayer_fft.c index c221e33e..ea884018 100644 --- a/pd/src/d_mayer_fft.c +++ b/pd/src/d_mayer_fft.c @@ -48,7 +48,7 @@ * of work. -msp */ -#ifdef NT +#ifdef MSW #pragma warning( disable : 4305 ) /* uncast const double to float */ #pragma warning( disable : 4244 ) /* uncast double to float */ #pragma warning( disable : 4101 ) /* unused local variables */ diff --git a/pd/src/d_osc.c b/pd/src/d_osc.c index 27dceae9..a7990fc6 100644 --- a/pd/src/d_osc.c +++ b/pd/src/d_osc.c @@ -18,7 +18,7 @@ #define LOWOFFSET 1 /* word offset to find LSB */ #define int32 long /* a data type that has 32 bits */ #else -#ifdef NT +#ifdef MSW /* little-endian; most significant byte is at highest address */ #define HIOFFSET 1 #define LOWOFFSET 0 @@ -63,7 +63,7 @@ #endif /* MACOSX */ #endif /* __linux__ */ -#endif /* NT */ +#endif /* MSW */ #endif /* SGI */ union tabfudge diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c index 33de90b7..a55e4d27 100644 --- a/pd/src/d_soundfile.c +++ b/pd/src/d_soundfile.c @@ -17,7 +17,7 @@ for Windows if someone were willing to find a Pthreads package for it. */ #include <fcntl.h> #endif #include <pthread.h> -#ifdef NT +#ifdef MSW #include <io.h> #endif #include <stdio.h> @@ -69,7 +69,7 @@ typedef struct _wave char w_waveid[4]; /* wave chunk id 'WAVE' */ char w_fmtid[4]; /* format chunk id 'fmt ' */ uint32 w_fmtchunksize; /* format chunk size */ - uint16 w_fmttag; /* format tag, 1 for PCM */ + uint16 w_fmttag; /* format tag (WAV_INT etc) */ uint16 w_nchannels; /* number of channels */ uint32 w_samplespersec; /* sample rate in hz */ uint32 w_navgbytespersec; /* average bytes per second */ @@ -95,6 +95,9 @@ typedef struct _wavechunk /* ... and the last two items */ uint32 wc_size; /* length of data chunk */ } t_wavechunk; +#define WAV_INT 1 +#define WAV_FLOAT 3 + /* the AIFF header. I'm assuming AIFC is compatible but don't really know that. */ @@ -141,7 +144,7 @@ typedef struct _aiff #define OBUFSIZE MAXPDSTRING /* assume MAXPDSTRING is bigger than headers */ -#ifdef NT +#ifdef MSW #include <fcntl.h> #define BINCREATE _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY #else @@ -541,10 +544,15 @@ static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv, } else goto usage; } - /* only NextStep handles floating point samples */ + /* don't handle AIFF floating point samples */ if (bytespersamp == 4) - filetype = FORMAT_NEXT; - + { + if (filetype == FORMAT_AIFF) + { + pd_error(obj, "AIFF floating-point file format unavailable"); + goto usage; + } + } /* for WAVE force little endian; for nextstep use machine native */ if (filetype == FORMAT_WAVE) { @@ -647,7 +655,8 @@ static int create_soundfile(t_canvas *canvas, const char *filename, strncpy(wavehdr->w_waveid, "WAVE", 4); strncpy(wavehdr->w_fmtid, "fmt ", 4); wavehdr->w_fmtchunksize = swap4(16, swap); - wavehdr->w_fmttag = swap2(1, swap); + wavehdr->w_fmttag = + swap2((bytespersamp == 4 ? WAV_FLOAT : WAV_INT), swap); wavehdr->w_nchannels = swap2(nchannels, swap); wavehdr->w_samplespersec = swap4(44100, swap); wavehdr->w_navgbytespersec = swap4(44100 * nchannels * bytespersamp, swap); @@ -1191,7 +1200,7 @@ static void soundfiler_setup(void) /* READSF uses the Posix threads package; for the moment we're Linux only although this should be portable to the other platforms. -Each instance of readsf~ owns a "child" thread for doing the UNIX (NT?) file +Each instance of readsf~ owns a "child" thread for doing the UNIX (MSW?) file reading. The parent thread signals the child each time: (1) a file wants opening or closing; (2) we've eaten another 1/16 of the shared buffer (so that the @@ -1753,18 +1762,15 @@ static void readsf_free(t_readsf *x) void *threadrtn; pthread_mutex_lock(&x->x_mutex); x->x_requestcode = REQUEST_QUIT; - post("stopping readsf thread..."); sfread_cond_signal(&x->x_requestcondition); while (x->x_requestcode != REQUEST_NOTHING) { - post("signalling..."); sfread_cond_signal(&x->x_requestcondition); sfread_cond_wait(&x->x_answercondition, &x->x_mutex); } pthread_mutex_unlock(&x->x_mutex); if (pthread_join(x->x_childthread, &threadrtn)) error("readsf_free: join failed"); - post("... done."); pthread_cond_destroy(&x->x_requestcondition); pthread_cond_destroy(&x->x_answercondition); diff --git a/pd/src/d_ugen.c b/pd/src/d_ugen.c index 68e931e6..2bc99936 100644 --- a/pd/src/d_ugen.c +++ b/pd/src/d_ugen.c @@ -23,14 +23,11 @@ #include "m_pd.h" +#include "m_imp.h" #include <stdlib.h> #include <stdarg.h> extern t_class *vinlet_class, *voutlet_class, *canvas_class; -int obj_nsiginlets(t_object *x); -int obj_siginletindex(t_object *x, int m); -int obj_nsigoutlets(t_object *x); -int obj_sigoutletindex(t_object *x, int m); t_sample *obj_findsignalscalar(t_object *x, int m); static int ugen_loud; EXTERN_STRUCT _vinlet; diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 2cd4994a..97075684 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> @@ -770,19 +770,11 @@ void iemgui_delete(t_gobj *z, t_glist *glist) void iemgui_vis(t_gobj *z, t_glist *glist, int vis) { t_iemguidummy *x = (t_iemguidummy *)z; - t_rtext *y; - if(vis) - { - y = rtext_new_without_senditup(glist, (t_text *)z, glist->gl_editor->e_rtext); + if (vis) (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_NEW); - } else - { - y = glist_findrtext(glist, (t_text *)z); (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_ERASE); - rtext_free(y); - } } void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol) diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h index 5fab095d..77cf710d 100644 --- a/pd/src/g_all_guis.h +++ b/pd/src/g_all_guis.h @@ -46,7 +46,7 @@ #define IEM_GUI_MINSIZE 8 #define IEM_GUI_MAXSIZE 1000 #define IEM_SL_DEFAULTSIZE 128 -#define IEM_SL_MINSIZE 20 +#define IEM_SL_MINSIZE 2 #define IEM_FONT_MINSIZE 4 #define IEM_BNG_DEFAULTHOLDFLASHTIME 250 @@ -314,7 +314,6 @@ EXTERN void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol); EXTERN void iemgui_properties(t_iemgui *iemgui, t_symbol **srl); EXTERN int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv); -EXTERN t_rtext *rtext_new_without_senditup(t_glist *glist, t_text *who, t_rtext *next); EXTERN int canvas_getdollarzero(void); EXTERN void canvas_getargs(int *argcp, t_atom **argvp); diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 7a9fb3f7..2c2dfa8b 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -81,11 +81,20 @@ void array_resize(t_array *x, t_template *template, int n) } } +void word_free(t_word *wp, t_template *template); + void array_free(t_array *x) { + int i; + t_template *scalartemplate = template_findbyname(x->a_templatesym); /* we don't unset our gpointer here since it was never "set." */ /* gpointer_unset(&x->a_gp); */ gstub_cutoff(x->a_stub); + for (i = 0; i < x->a_n; i++) + { + t_word *wp = (t_word *)(x->a_vec + x->a_elemsize * i); + word_free(wp, scalartemplate); + } freebytes(x->a_vec, x->a_elemsize * x->a_n); freebytes(x, sizeof *x); } diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 399f45f4..07553972 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 1eba8ac5..be771aa0 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -7,7 +7,6 @@ to be different but are now unified except for some fossilized names.) */ /* changes by Thomas Musil IEM KUG Graz Austria 2001 */ -/* improvement: line-delete-protection, look for "protect" */ /* bug-fix: canvas_menuclose(): by Krzysztof Czaja */ /* bug-fix: table_new(): I reversed the y-bounds */ @@ -21,7 +20,9 @@ to be different but are now unified except for some fossilized names.) */ #include <stdlib.h> #include <stdio.h> +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include "g_canvas.h" #include <string.h> #include "g_all_guis.h" @@ -104,7 +105,8 @@ void canvas_updatewindowlist( void) /* find all root canvases */ for (x = canvas_list; x; x = x->gl_next) glist_doupdatewindowlist(x, sbuf); - strcat(sbuf, "}\n"); + /* next line updates the window menu state before -postcommand tries it */ + strcat(sbuf, "}\npdtk_fixwindowmenu\n"); sys_gui(sbuf); } @@ -681,18 +683,31 @@ static void editor_free(t_editor *x, t_glist *y) void canvas_create_editor(t_glist *x, int createit) { t_gobj *y; + t_object *ob; if (createit) { if (x->gl_editor) bug("canvas_create_editor"); - else x->gl_editor = editor_new(x); + else + { + x->gl_editor = editor_new(x); + for (y = x->gl_list; y; y = y->g_next) + if (ob = pd_checkobject(&y->g_pd)) + rtext_new(x, ob); + } } else { if (!x->gl_editor) bug("canvas_create_editor"); - else editor_free(x->gl_editor, x); - x->gl_editor = 0; + else + { + for (y = x->gl_list; y; y = y->g_next) + if (ob = pd_checkobject(&y->g_pd)) + rtext_free(glist_findrtext(x, ob)); + editor_free(x->gl_editor, x); + x->gl_editor = 0; + } } for (y = x->gl_list; y; y = y->g_next) if (pd_class(&y->g_pd) == canvas_class && @@ -712,7 +727,7 @@ void canvas_vis(t_canvas *x, t_floatarg f) /* test if we're already visible and toplevel */ if (glist_isvisible(x) && !x->gl_isgraph) { /* just put us in front */ -#ifdef NT +#ifdef MSW canvas_vis(x, 0); canvas_vis(x, 1); #else @@ -756,7 +771,7 @@ void canvas_vis(t_canvas *x, t_floatarg f) sys_vgui("destroy .x%x\n", x); for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++) ; - sys_vgui(".mbar.find.menu delete %d\n", i); + sys_vgui(".mbar.find delete %d\n", i); /* if we're a graph on our parent, and if the parent exists and is visible, show ourselves on parent. */ if (glist_isgraph(x) && x->gl_owner) @@ -819,7 +834,6 @@ void canvas_free(t_canvas *x) { t_gobj *y; int dspstate = canvas_suspend_dsp(); - canvas_noundo(x); if (canvas_editing == x) canvas_editing = 0; @@ -1019,7 +1033,7 @@ void canvas_loadbang(t_canvas *x) you gave it to open it; perhaps there's a 1-pixel border all around it or something. Anyway, we just add the 2 pixels back here: */ -#ifdef NT +#ifdef MSW #define HORIZBORDER 2 #define VERTBORDER 2 #else @@ -1199,10 +1213,6 @@ void ugen_connect(t_dspcontext *dc, t_object *x1, int outno, t_object *x2, int inno); void ugen_done_graph(t_dspcontext *dc); -int obj_issignaloutlet(t_object *x, int outno); -int obj_nsiginlets(t_object *x); -int obj_nsigoutlets(t_object *x); - /* schedule one canvas for DSP. This is called below for all "root" canvases, but is also called from the "dsp" method for sub- canvases, which are treated almost like any other tilde object. */ @@ -1328,10 +1338,10 @@ static void glist_redrawall(t_glist *gl) } /* public interface for above */ -void canvas_redrawallfortemplate(t_canvas *template) +void canvas_redrawallfortemplate(t_canvas *templatecanvas) { t_canvas *x; - if (!template->gl_imatemplate) return; + if (!templatecanvas->gl_imatemplate) return; /* find all root canvases */ for (x = canvas_list; x; x = x->gl_next) glist_redrawall(x); @@ -1373,10 +1383,10 @@ static void glist_zapall(t_glist *gl) } /* public interface for above */ -void canvas_zapallfortemplate(t_canvas *template) +void canvas_zapallfortemplate(t_canvas *templatecanvas) { t_canvas *x; - if (!template->gl_imatemplate) return; + if (!templatecanvas->gl_imatemplate) return; /* find all root canvases */ for (x = canvas_list; x; x = x->gl_next) glist_zapall(x); @@ -1511,5 +1521,4 @@ void g_canvas_setup(void) g_graph_setup(); g_editor_setup(); g_readwrite_setup(); - } diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index e4eecfc0..afaecbf5 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -33,6 +33,13 @@ glist has its own window, even if miniaturized. */ +/* NOTE: this file describes Pd implementation details which may change +in future releases. The public (stable) API is in m_pd.h. */ + +#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) +extern "C" { +#endif + /* --------------------- geometry ---------------------------- */ #define IOWIDTH 7 /* width of an inlet/outlet in pixels */ #define IOMIDDLE ((IOWIDTH-1)/2) @@ -190,9 +197,11 @@ typedef struct _dataslot t_symbol *ds_arraytemplate; /* filled in for arrays only */ } t_dataslot; + +/* T.Grill - changed t_pd member to t_pdobj to avoid name clashed */ typedef struct _template { - t_pd t_pd; /* header */ + t_pd t_pdobj; /* header */ struct _gtemplate *t_list; /* list of "struct"/gtemplate objects */ t_symbol *t_sym; /* name */ int t_n; /* number of dataslots (fields) */ @@ -280,27 +289,27 @@ doesn't work on array elements... LATER reconsider this */ /* bounding rectangle: */ typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *tmpl, float basex, float basey, int *x1, int *y1, int *x2, int *y2); /* displace it */ typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *tmpl, float basex, float basey, int dx, int dy); /* change color to show selection */ typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *tmpl, float basex, float basey, int state); /* change appearance to show activation/deactivation: */ typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *tmpl, float basex, float basey, int state); /* making visible or invisible */ typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *tmpl, float basex, float basey, int flag); /* field a mouse click */ typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist, - t_scalar *sc, t_template *template, float basex, float basey, + t_scalar *sc, t_template *tmpl, float basex, float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit); struct _parentwidgetbehavior @@ -411,10 +420,11 @@ EXTERN int text_shouldvis(t_text *x, t_glist *glist); #define RTEXT_DBL 3 #define RTEXT_SHIFT 4 -EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who, t_rtext *next, - int sendipup); -EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x); +EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who); EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who); +EXTERN void rtext_draw(t_rtext *x); +EXTERN void rtext_erase(t_rtext *x); +EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x); EXTERN int rtext_height(t_rtext *x); EXTERN void rtext_displace(t_rtext *x, int dx, int dy); EXTERN void rtext_select(t_rtext *x, int state); @@ -444,8 +454,8 @@ EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym); EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip); EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym); EXTERN void canvas_rmoutlet(t_canvas *x, t_outlet *op); -EXTERN void canvas_redrawallfortemplate(t_canvas *template); -EXTERN void canvas_zapallfortemplate(t_canvas *template); +EXTERN void canvas_redrawallfortemplate(t_canvas *tmpl); +EXTERN void canvas_zapallfortemplate(t_canvas *tmpl); EXTERN void canvas_setusedastemplate(t_canvas *x); EXTERN t_canvas *canvas_getcurrent(void); EXTERN void canvas_setcurrent(t_canvas *x); @@ -485,6 +495,17 @@ EXTERN void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, EXTERN void canvas_noundo(t_canvas *x); EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); +/* T.Grill - made public for dynamic object creation */ +/* in g_editor.c */ +EXTERN void canvas_connect(t_canvas *x, + t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno); +EXTERN void canvas_disconnect(t_canvas *x, + float index1, float outno, float index2, float inno); +EXTERN int canvas_isconnected (t_canvas *x, + t_text *ob1, int n1, t_text *ob2, int n2); +EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy); + + /* ---- functions on canvasses as objects --------------------- */ EXTERN void canvas_fattenforscalars(t_canvas *x, @@ -511,10 +532,10 @@ EXTERN int tscalar_click(t_tscalar *x, int xpix, int ypix, int shift, EXTERN t_template *garray_template(t_garray *x); /* -------------------- arrays --------------------- */ -EXTERN t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *template, +EXTERN t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *tmpl, t_floatarg f, t_floatarg saveit); EXTERN t_array *array_new(t_symbol *templatesym, t_gpointer *parent); -EXTERN void array_resize(t_array *x, t_template *template, int n); +EXTERN void array_resize(t_array *x, t_template *tmpl, int n); EXTERN void array_free(t_array *x); /* --------------------- gpointers and stubs ---------------- */ @@ -523,8 +544,8 @@ EXTERN void gstub_cutoff(t_gstub *gs); EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x); /* --------------------- scalars ------------------------- */ -EXTERN void word_init(t_word *wp, t_template *template, t_gpointer *gp); -EXTERN void word_restore(t_word *wp, t_template *template, +EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp); +EXTERN void word_restore(t_word *wp, t_template *tmpl, int argc, t_atom *argv); EXTERN t_scalar *scalar_new(t_glist *owner, t_symbol *templatesym); @@ -563,7 +584,7 @@ EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, EXTERN t_template *gtemplate_get(t_gtemplate *x); EXTERN t_template *template_findbyname(t_symbol *s); -EXTERN t_canvas *template_findcanvas(t_template *template); +EXTERN t_canvas *template_findcanvas(t_template *tmpl); EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp, int loud); @@ -581,3 +602,7 @@ EXTERN void guiconnect_notarget(t_guiconnect *x, double timedelay); /* ------------- IEMGUI routines used in other g_ files ---------------- */ EXTERN t_symbol *iemgui_raute2dollar(t_symbol *s); EXTERN t_symbol *iemgui_dollar2raute(t_symbol *s); + +#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) +} +#endif diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 470030e9..3612d61f 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -4,13 +4,18 @@ #include <stdlib.h> #include <stdio.h> +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include "g_canvas.h" #include <string.h> void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem); +void open_via_helppath(const char *name, const char *dir); +char *class_gethelpdir(t_class *c); + /* ------------------ forward declarations --------------- */ static void canvas_doclear(t_canvas *x); static void glist_setlastxy(t_glist *gl, int xval, int yval); @@ -297,10 +302,11 @@ void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, canvas_undo_buf = buf; canvas_undo_whatnext = UNDO_UNDO; canvas_undo_name = name; - if (x) + if (x && glist_isvisible(x) && glist_istoplevel(x)) /* enable undo in menu */ sys_vgui("pdtk_undomenu .x%x %s no\n", x, name); - else if (hadone) sys_vgui("pdtk_undomenu .x%x no no\n", x, name); + else if (hadone) + sys_vgui("pdtk_undomenu nobody no no\n"); } /* clear undo if it happens to be for the canvas x. @@ -322,7 +328,8 @@ static void canvas_undo(t_canvas *x) /* post("undo"); */ (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO); /* enable redo in menu */ - sys_vgui("pdtk_undomenu .x%x no %s\n", x, canvas_undo_name); + if (glist_isvisible(x) && glist_istoplevel(x)) + sys_vgui("pdtk_undomenu .x%x no %s\n", x, canvas_undo_name); canvas_undo_whatnext = UNDO_REDO; } } @@ -338,7 +345,8 @@ static void canvas_redo(t_canvas *x) /* post("redo"); */ (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO); /* enable undo in menu */ - sys_vgui("pdtk_undomenu .x%x %s no\n", x, canvas_undo_name); + if (glist_isvisible(x) && glist_istoplevel(x)) + sys_vgui("pdtk_undomenu .x%x %s no\n", x, canvas_undo_name); canvas_undo_whatnext = UNDO_UNDO; } } @@ -364,11 +372,8 @@ static void *canvas_undo_set_disconnect(t_canvas *x, return (buf); } -static void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, - t_floatarg fwhoin, t_floatarg finno); - -static void canvas_disconnect(t_canvas *x, - int index1, int outno, int index2, int inno) +void canvas_disconnect(t_canvas *x, + float index1, float outno, float index2, float inno) { t_linetraverser t; t_outconnect *oc; @@ -661,6 +666,55 @@ else if (action == UNDO_FREE) t_freebytes(buf, sizeof(*buf)); } + /* recursively check for abstractions to reload as result of a save. + Don't reload the one we just saved ("except") though. */ + /* LATER try to do the same trick for externs. */ +static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir, + t_gobj *except) +{ + t_gobj *g; + int i, nobj = glist_getindex(gl, 0); /* number of objects */ + for (g = gl->gl_list, i = 0; g && i < nobj; i++) + { + if (g != except && pd_class(&g->g_pd) == canvas_class && + canvas_isabstraction((t_canvas *)g) && + ((t_canvas *)g)->gl_name == name && + canvas_getdir((t_canvas *)g) == dir) + { + /* we're going to remake the object, so "g" will go stale. + Get its index here, and afterward restore g. Also, the + replacement will be at teh end of the list, so we don't + do g = g->g_next in this case. */ + int j = glist_getindex(gl, g); + if (!gl->gl_havewindow) + canvas_vis(glist_getcanvas(gl), 1); + glist_noselect(gl); + glist_select(gl, g); + canvas_setundo(gl, canvas_undo_cut, + canvas_undo_set_cut(gl, UCUT_CLEAR), "clear"); + canvas_doclear(gl); + canvas_undo(gl); + glist_noselect(gl); + g = glist_nth(gl, j); + } + else + { + if (g != except && pd_class(&g->g_pd) == canvas_class) + glist_doreload((t_canvas *)g, name, dir, except); + g = g->g_next; + } + } +} + + /* call canvas_doreload on everyone */ +void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except) +{ + t_canvas *x; + /* find all root canvases */ + for (x = canvas_list; x; x = x->gl_next) + glist_doreload(x, name, dir, except); +} + /* ------------------------ event handling ------------------------ */ #define CURSOR_RUNMODE_NOTHING 0 @@ -672,7 +726,7 @@ else if (action == UNDO_FREE) #define CURSOR_EDITMODE_DISCONNECT 6 static char *cursorlist[] = { -#ifdef NT +#ifdef MSW "right_ptr", /* CURSOR_RUNMODE_NOTHING */ #else "left_ptr", /* CURSOR_RUNMODE_NOTHING */ @@ -866,13 +920,26 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) } else /* help */ { - char *s = class_gethelpname(pd_class(&y->g_pd)); - strcpy(pathbuf, sys_libdir->s_name); - strcat(pathbuf, "/doc/5.reference"); - strcpy(namebuf, s); - if (strcmp(namebuf + strlen(namebuf) - 3, ".pd")) + char *dir; + if (pd_class(&y->g_pd) == canvas_class && + canvas_isabstraction((t_canvas *)y)) + { + t_object *ob = (t_object *)y; + int ac = binbuf_getnatom(ob->te_binbuf); + t_atom *av = binbuf_getvec(ob->te_binbuf); + if (ac < 1) + return; + atom_string(av, namebuf, MAXPDSTRING); + dir = canvas_getdir((t_canvas *)y)->s_name; + } + else + { + strcpy(namebuf, class_gethelpname(pd_class(&y->g_pd))); + dir = class_gethelpdir(pd_class(&y->g_pd)); + } + if (strcmp(namebuf + strlen(namebuf) - 3, ".pd")) strcat(namebuf, ".pd"); - glob_evalfile(0, gensym(namebuf), gensym(pathbuf)); + open_via_helppath(namebuf, dir); return; } } @@ -905,15 +972,6 @@ static int canvas_upx, canvas_upy; #define DCLICKINTERVAL 0.25 #endif - /* figure out of the outlet is a "signal" outlet. "nout" is the - index of the outlet, counting from zero. */ -int obj_sigoutletindex(t_object *x, int m); -static int canvas_issigoutlet(t_object *ob, int nout) -{ - int ret = obj_sigoutletindex(ob, nout); - return (obj_sigoutletindex(ob, nout) >= 0); -} - /* mouse click */ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, int mod, int doit) @@ -1025,7 +1083,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { if (doit) { - int issignal = canvas_issigoutlet(ob, closest); + int issignal = obj_issignaloutlet(ob, closest); x->gl_editor->e_onmotion = MA_CONNECT; x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; @@ -1126,7 +1184,7 @@ void canvas_mousedown(t_canvas *x, t_floatarg xpos, t_floatarg ypos, canvas_doclick(x, xpos, ypos, which, mod, 1); } -static int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, +int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_text *ob2, int n2) { t_linetraverser t; @@ -1193,6 +1251,14 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); return; } + if (obj_issignaloutlet(ob1, closest1) && + !obj_issignalinlet(ob2, closest2)) + { + if (doit) + error("can't connect signal outlet to control inlet"); + canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); + return; + } if (doit) { oc = obj_connect(ob1, closest1, ob2, closest2); @@ -1207,7 +1273,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), lx1, ly1, lx2, ly2, - (canvas_issigoutlet(ob1, closest1) ? 2 : 1), oc); + (obj_issignaloutlet(ob1, closest1) ? 2 : 1), oc); canvas_setundo(x, canvas_undo_connect, canvas_undo_set_connect(x, canvas_getindex(x, &ob1->ob_g), closest1, @@ -1221,11 +1287,23 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); } -void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit) +void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) +{ + t_gobj *y; + for (y = x->gl_list; y; y = y->g_next) + { + int x1, y1, x2, y2; + gobj_getrect(y, x, &x1, &y1, &x2, &y2); + if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2 + && !glist_isselected(x, y)) + glist_select(x, y); + } +} + +static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit) { if (doit) { - t_gobj *y; int lox, loy, hix, hiy; if (x->gl_editor->e_xwas < xpos) lox = x->gl_editor->e_xwas, hix = xpos; @@ -1233,14 +1311,7 @@ void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit) if (x->gl_editor->e_ywas < ypos) loy = x->gl_editor->e_ywas, hiy = ypos; else hiy = x->gl_editor->e_ywas, loy = ypos; - for (y = x->gl_list; y; y = y->g_next) - { - int x1, y1, x2, y2; - gobj_getrect(y, x, &x1, &y1, &x2, &y2); - if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2 - && !glist_isselected(x, y)) - glist_select(x, y); - } + canvas_selectinrect(x, lox, loy, hix, hiy); sys_vgui(".x%x.c delete x\n", x); x->gl_editor->e_onmotion = 0; } @@ -1312,7 +1383,7 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy) void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) { static t_symbol *keynumsym, *keyupsym, *keynamesym; - float keynum, fflag; + int keynum, fflag; t_symbol *gotkeysym; int down, shift; @@ -1325,7 +1396,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) return; } canvas_undo_already_set_move = 0; - down = (atom_getfloat(av) != 0); /* nonzero if it's a key down */ shift = (atom_getfloat(av+2) != 0); /* nonzero if shift-ed */ if (av[1].a_type == A_SYMBOL) @@ -1345,7 +1415,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) return; } if (keynum == '\r') keynum = '\n'; - /* post("key %c", keynum); */ if (av[1].a_type == A_SYMBOL && !strcmp(av[1].a_w.w_symbol->s_name, "Return")) keynum = '\n'; @@ -1355,10 +1424,20 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) keyupsym = gensym("#keyup"); keynamesym = gensym("#keyname"); } +#ifdef MACOSX + if (keynum == 30) + keynum = 0, gotkeysym = gensym("Up"); + else if (keynum == 31) + keynum = 0, gotkeysym = gensym("Down"); + else if (keynum == 28) + keynum = 0, gotkeysym = gensym("Left"); + else if (keynum == 29) + keynum = 0, gotkeysym = gensym("Right"); +#endif if (keynumsym->s_thing && down) - pd_float(keynumsym->s_thing, keynum); + pd_float(keynumsym->s_thing, (float)keynum); if (keyupsym->s_thing && !down) - pd_float(keyupsym->s_thing, keynum); + pd_float(keyupsym->s_thing, (float)keynum); if (keynamesym->s_thing) { t_atom at[2]; @@ -1373,7 +1452,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) (* x->gl_editor->e_keyfn) - (x->gl_editor->e_grab, keynum); + (x->gl_editor->e_grab, (float)keynum); /* if a text editor is open send it on */ else if (x->gl_editor->e_textedfor) { @@ -1383,8 +1462,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) canvas_undo_set_cut(x, UCUT_TEXT), "typing"); } rtext_key(x->gl_editor->e_textedfor, - (int)keynum, - (av[1].a_type == A_SYMBOL ? av[1].a_w.w_symbol : &s_)); + (int)keynum, gotkeysym); if (x->gl_editor->e_textdirty) canvas_dirty(x, 1); } @@ -1475,50 +1553,6 @@ void canvas_print(t_canvas *x, t_symbol *s) else sys_vgui(".x%x.c postscript -file x.ps\n", x); } - -#if 0 /* LATER fix this to re-load abstractions when the patch changes. - The best way to do this is probably to rewrite "stowconnections" - so that it can operate either on the selection as now or on - another replacement criterion. Could do the same trick for - externs if we wish. */ - /* recursively check for abstractions to reload as result of a save. */ -static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir) -{ - t_gobj *g; - for (g = gl->gl_list; g; g = g->g_next) - { - if (pd_class(&g->g_pd) == canvas_class && - canvas_isabstraction(&g->g_pd) && - ((t_canvas *)g)->gl_name == name && - ((t_canvas *)g)->gl_env->ce_dir == dir) - { - ..... - glist_noselect(gl); - canvas_vis(glist_getcanvas(gl), 1); - canvas_editmode(glist_getcanvas(gl), 1.); - glist_select(gl, g); - return (1); - } - else if (pd_class(&g->g_pd) == graph_class) - glist_doreload((t_glist *)g, name, dir); - else if (pd_class(&g->g_pd) == canvas_class) - glist_doreload(&((t_canvas *)g), - name, dir); - } - } - return (0); -} - -static void canvas_reload(t_symbol *name, t_symbol *dir) -{ - t_canvas *x; - /* find all root canvases */ - for (x = canvas_list; x; x = x->gl_next) - glist_doreload(x, name, dir); -} - -#endif /* 0 -- also uncomment call to canvas_reload below */ - void canvas_menuclose(t_canvas *x, t_floatarg force) { if (x->gl_owner) @@ -1568,7 +1602,7 @@ static int canvas_dofind(t_canvas *x, int *myindex1p) glist_noselect(x); if (glist_isvisible(x)) { -#ifdef NT +#ifdef MSW /* For windows canvas_vis() does something special so here we explicitly invis the window and proceed as in the "invis" @@ -1951,7 +1985,7 @@ static void canvas_selectall(t_canvas *x) } } -static void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, +void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, t_floatarg fwhoin, t_floatarg finno) { int whoout = fwhoout, outno = foutno, whoin = fwhoin, inno = finno; @@ -1972,7 +2006,7 @@ static void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, { sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), 0, 0, 0, 0, - (canvas_issigoutlet(objsrc, outno) ? 2 : 1),oc); + (obj_issignaloutlet(objsrc, outno) ? 2 : 1),oc); canvas_fixlinesfor(x, objsrc); } return; @@ -2104,7 +2138,6 @@ static void canvas_texteditor(t_canvas *x) } - void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av) { /* canvas_editing can be zero; canvas_key checks for that */ @@ -2116,12 +2149,14 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) int yesplease = fyesplease; if (yesplease && x->gl_edit) return; - if (x->gl_edit = !x->gl_edit) + x->gl_edit = !x->gl_edit; + if (x->gl_edit && glist_isvisible(x) && glist_istoplevel(x)) canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); else { glist_noselect(x); - canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); + if (glist_isvisible(x) && glist_istoplevel(x)) + canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); } sys_vgui("pdtk_canvas_editval .x%x %d\n", glist_getcanvas(x), x->gl_edit); @@ -2250,6 +2285,8 @@ void g_editor_setup(void) class_addmethod(canvas_class, (t_method)canvas_connect, gensym("connect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(canvas_class, (t_method)canvas_disconnect, + gensym("disconnect"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); /* -------------- copy buffer ------------------ */ copy_binbuf = binbuf_new(); } diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index b893d42d..9bf998f8 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -25,6 +25,7 @@ static void graph_getrect(t_gobj *z, t_glist *glist, void glist_add(t_glist *x, t_gobj *y) { + t_object *ob; y->g_next = 0; if (!x->gl_list) x->gl_list = y; else @@ -33,6 +34,8 @@ void glist_add(t_glist *x, t_gobj *y) for (y2 = x->gl_list; y2->g_next; y2 = y2->g_next); y2->g_next = y; } + if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) + rtext_new(x, ob); if (glist_isvisible(x)) gobj_vis(y, x, 1); if (class_isdrawcommand(y->g_pd)) @@ -53,14 +56,14 @@ int canvas_setdeleting(t_canvas *x, int flag) void glist_delete(t_glist *x, t_gobj *y) { t_gobj *g; + t_object *ob; t_gotfn chkdsp = zgetfn(&y->g_pd, gensym("dsp")); t_canvas *canvas = glist_getcanvas(x); int drawcommand = class_isdrawcommand(y->g_pd); int wasdeleting; wasdeleting = canvas_setdeleting(canvas, 1); - /* LATER decide whether all visible glists must have an editor? */ - if (glist_isvisible(canvas) && x->gl_editor) + if (x->gl_editor) { if (x->gl_editor->e_grab == y) x->gl_editor->e_grab = 0; if (glist_isselected(x, y)) glist_deselect(x, y); @@ -88,7 +91,10 @@ void glist_delete(t_glist *x, t_gobj *y) } } gobj_delete(y, x); - if (glist_isvisible(canvas)) gobj_vis(y, x, 0); + if (glist_isvisible(canvas)) + gobj_vis(y, x, 0); + if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) + rtext_new(x, ob); if (x->gl_list == y) x->gl_list = y->g_next; else for (g = x->gl_list; g; g = g->g_next) if (g->g_next == y) @@ -640,14 +646,12 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) text_widgetbehavior.w_visfn(gr, parent_glist, vis); return; } - - if (vis) - rtext_new(parent_glist, &x->gl_obj, - parent_glist->gl_editor->e_rtext, - canvas_showtext(x)); + + if (vis && canvas_showtext(x)) + rtext_draw(glist_findrtext(parent_glist, &x->gl_obj)); graph_getrect(gr, parent_glist, &x1, &y1, &x2, &y2); if (!vis) - rtext_free(glist_findrtext(parent_glist, &x->gl_obj)); + rtext_erase(glist_findrtext(parent_glist, &x->gl_obj)); sprintf(tag, "graph%x", (int)x); if (vis) diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c index 9f0db2cc..1d1b4c6d 100644 --- a/pd/src/g_hdial.c +++ b/pd/src/g_hdial.c @@ -12,13 +12,13 @@ put out a "float" as in sliders, toggles, etc. */ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> @@ -357,7 +357,12 @@ static void hradio_bang(t_hradio *x) if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - else outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + else + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); + } } static void hradio_fout(t_hradio *x, t_floatarg f) @@ -393,6 +398,8 @@ static void hradio_fout(t_hradio *x, t_floatarg f) else { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; } diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c index 5b08a9bb..ed805f4b 100644 --- a/pd/src/g_hslider.c +++ b/pd/src/g_hslider.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index 726b6770..6af4e269 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index b8f962bc..abf19e44 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -8,13 +8,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c index 40755bb0..ddf11670 100644 --- a/pd/src/g_readwrite.c +++ b/pd/src/g_readwrite.c @@ -10,7 +10,7 @@ scalars into a file and reload them; also, support is included here for #include <stdlib.h> #include <stdio.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include <string.h> @@ -662,6 +662,8 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething) } } +void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except); + /* save a "root" canvas to a file; cf. canvas_saveto() which saves the body (and which is called recursively.) */ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir) @@ -677,9 +679,7 @@ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir) canvas_rename(x, filename, dir); post("saved to: %s/%s", dir->s_name, filename->s_name); canvas_dirty(x, 0); -#if 0 /* not yet written */ - canvas_reload(filename, dir); -#endif + canvas_reload(filename, dir, &x->gl_gobj); } binbuf_free(b); } diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 4b48dcc0..ee894b7e 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -10,7 +10,8 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" #include "g_canvas.h" #include "t_tk.h" @@ -23,9 +24,6 @@ #define SEND_UPDATE 2 #define SEND_CHECK 0 -static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, - int *indexp); - struct _rtext { char *x_buf; @@ -43,7 +41,7 @@ struct _rtext struct _rtext *x_next; }; -t_rtext *rtext_new(t_glist *glist, t_text *who, t_rtext *next, int senditup) +t_rtext *rtext_new(t_glist *glist, t_text *who) { t_rtext *x = (t_rtext *)getbytes(sizeof *x); int w = 0, h = 0, indx; @@ -57,24 +55,13 @@ t_rtext *rtext_new(t_glist *glist, t_text *who, t_rtext *next, int senditup) glist->gl_editor->e_rtext = x; sprintf(x->x_tag, ".x%x.t%x", (t_int)glist_getcanvas(x->x_glist), (t_int)x); - if (senditup) - rtext_senditup(x, SEND_FIRST, &w, &h, &indx); return (x); } -/* iemlib version (now incorporated into rtext_new() via the "senditup" arg) */ - -t_rtext *rtext_new_without_senditup(t_glist *glist, t_text *who, t_rtext *next) -{ - return (rtext_new(glist, who, next, 0)); -} - static t_rtext *rtext_entered; void rtext_free(t_rtext *x) { - sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->x_glist), - x->x_tag); if (x->x_glist->gl_editor->e_textedfor == x) x->x_glist->gl_editor->e_textedfor = 0; if (x->x_glist->gl_editor->e_rtext == x) @@ -339,6 +326,17 @@ int rtext_height(t_rtext *x) return (h); } +void rtext_draw(t_rtext *x) +{ + int w = 0, h = 0, indx; + rtext_senditup(x, SEND_FIRST, &w, &h, &indx); +} + +void rtext_erase(t_rtext *x) +{ + sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->x_glist), x->x_tag); +} + void rtext_displace(t_rtext *x, int dx, int dy) { sys_vgui(".x%x.c move %s %d %d\n", glist_getcanvas(x->x_glist), diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 362fb108..d24564e4 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -85,6 +85,19 @@ void word_restore(t_word *wp, t_template *template, post("warning: word_restore: extra arguments"); } +void word_free(t_word *wp, t_template *template) +{ + int i; + t_dataslot *dt; + for (dt = template->t_vec, i = 0; i < template->t_n; i++, dt++) + { + if (dt->ds_type == DT_ARRAY) + array_free(wp[i].w_array); + else if (dt->ds_type == DT_LIST) + canvas_free(wp[i].w_list); + } +} + /* make a new scalar and add to the glist. We create a "gp" here which will be used for array items to point back here. This gp doesn't do reference counting or "validation" updates though; the parent won't go away @@ -350,13 +363,7 @@ static void scalar_free(t_scalar *x) error("scalar: couldn't find template %s", templatesym->s_name); return; } - for (dt = template->t_vec, i = 0; i < template->t_n; i++, dt++) - { - if (dt->ds_type == DT_ARRAY) - array_free(x->sc_vec[i].w_array); - else if (dt->ds_type == DT_LIST) - canvas_free(x->sc_vec[i].w_list); - } + word_free(x->sc_vec, template); gfxstub_deleteforkey(x); /* the "size" field in the class is zero, so Pd doesn't try to free us automatically (see pd_free()) */ diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 8dc897a3..67c35413 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -6,7 +6,8 @@ #include <string.h> #include <stdio.h> -#include "m_imp.h" /* for sys_hostfontsize */ +#include "m_pd.h" +#include "s_stuff.h" /* for sys_hostfontsize */ #include "g_canvas.h" /* @@ -15,6 +16,9 @@ template. Templates describe objects of type "array" (g_array.c) and "scalar" (g_scalar.c). */ +/* T.Grill - changed the _template.t_pd member to t_pdobj to avoid name clashes +with the t_pd type */ + /* the structure of a "struct" object (also the obsolete "gtemplate" you get when using the name "template" in a box.) */ @@ -122,7 +126,7 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv) if (templatesym->s_name) { x->t_sym = templatesym; - pd_bind(&x->t_pd, x->t_sym); + pd_bind(&x->t_pdobj, x->t_sym); } else x->t_sym = templatesym; return (x); @@ -496,11 +500,11 @@ static void *template_usetemplate(void *dummy, t_symbol *s, { /* conform everyone to the new template */ template_conform(x, y); - pd_free(&x->t_pd); + pd_free(&x->t_pdobj); template_new(templatesym, argc, argv); } } - pd_free(&y->t_pd); + pd_free(&y->t_pdobj); } /* otherwise, just make one. */ else template_new(templatesym, argc, argv); @@ -511,7 +515,7 @@ static void *template_usetemplate(void *dummy, t_symbol *s, void template_free(t_template *x) { if (*x->t_sym->s_name) - pd_unbind(&x->t_pd, x->t_sym); + pd_unbind(&x->t_pdobj, x->t_sym); t_freebytes(x->t_vec, x->t_n * sizeof(*x->t_vec)); } @@ -572,10 +576,10 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) { /* conform everyone to the new template */ template_conform(t, y); - pd_free(&t->t_pd); + pd_free(&t->t_pdobj); t = template_new(sym, argc, argv); } - pd_free(&y->t_pd); + pd_free(&y->t_pdobj); t->t_list = x; } } @@ -630,8 +634,8 @@ static void gtemplate_free(t_gtemplate *x) first-on-list and replace teh existing template with it. */ t_template *z = template_new(&s_, x->x_argc, x->x_argv); template_conform(t, z); - pd_free(&t->t_pd); - pd_free(&z->t_pd); + pd_free(&t->t_pdobj); + pd_free(&z->t_pdobj); z = template_new(x->x_sym, x->x_argc, x->x_argv); z->t_list = x->x_next; } @@ -1668,7 +1672,7 @@ void g_template_setup(void) { template_setup(); gtemplate_setup(); - template_float.t_pd = template_class; + template_float.t_pdobj = template_class; curve_setup(); plot_setup(); drawnumber_setup(); diff --git a/pd/src/g_text.c b/pd/src/g_text.c index b502446b..13619493 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -7,7 +7,9 @@ /* all changes are labeled with iemlib */ #include <stdlib.h> +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include "t_tk.h" #include "g_canvas.h" #include <stdio.h> @@ -921,8 +923,9 @@ static void text_select(t_gobj *z, t_glist *glist, int state) t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); rtext_select(y, state); - sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, - rtext_gettag(y), (state? "blue" : "black")); + if (glist_isvisible(glist) && text_shouldvis(x, glist)) + sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, + rtext_gettag(y), (state? "blue" : "black")); } static void text_activate(t_gobj *z, t_glist *glist, int state) @@ -954,20 +957,22 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis) { if (text_shouldvis(x, glist)) { - t_rtext *y = rtext_new(glist, x, glist->gl_editor->e_rtext, 1); + t_rtext *y = glist_findrtext(glist, x); if (x->te_type == T_ATOM) glist_retext(glist, x); text_drawborder(x, glist, rtext_gettag(y), rtext_width(y), rtext_height(y), 1); + rtext_draw(y); } - else rtext_new(glist, x, glist->gl_editor->e_rtext, 0); } else { t_rtext *y = glist_findrtext(glist, x); if (text_shouldvis(x, glist)) + { text_eraseborder(x, glist, rtext_gettag(y)); - rtext_free(y); + rtext_erase(y); + } } } diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index a119e242..9f5f5c3c 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c index 4974227a..6424944a 100644 --- a/pd/src/g_vdial.c +++ b/pd/src/g_vdial.c @@ -11,7 +11,7 @@ put out a "float" as in sliders, toggles, etc. */ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" @@ -356,7 +356,12 @@ static void vradio_bang(t_vradio *x) if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } - else outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + else + { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); + } } static void vradio_fout(t_vradio *x, t_floatarg f) @@ -393,6 +398,8 @@ static void vradio_fout(t_vradio *x, t_floatarg f) else { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); + if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; } diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c index 81960d48..a7780135 100644 --- a/pd/src/g_vslider.c +++ b/pd/src/g_vslider.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index 95b976dd..f538eda7 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -10,13 +10,13 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include "m_imp.h" +#include "m_pd.h" #include "g_canvas.h" #include "t_tk.h" #include "g_all_guis.h" #include <math.h> -#ifdef NT +#ifdef MSW #include <io.h> #else #include <unistd.h> diff --git a/pd/src/m_atom.c b/pd/src/m_atom.c index c9c4c284..7e30c82f 100644 --- a/pd/src/m_atom.c +++ b/pd/src/m_atom.c @@ -2,7 +2,7 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -#include "m_imp.h" +#include "m_pd.h" #include <stdio.h> #include <string.h> diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index fab30baf..c40e5dff 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -16,7 +16,7 @@ #ifdef UNIX #include <unistd.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #endif #include <fcntl.h> @@ -599,7 +599,7 @@ broken: static int binbuf_doopen(char *s, int mode) { char namebuf[MAXPDSTRING]; -#ifdef NT +#ifdef MSW mode |= O_BINARY; #endif sys_bashfilename(s, namebuf); @@ -903,14 +903,13 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) else if (!strcmp(second, "button")) { binbuf_addv(newb, "ssffs;", - gensym("#X"), gensym("msg"), + gensym("#X"), gensym("obj"), atom_getfloatarg(2, natom, nextmess), atom_getfloatarg(3, natom, nextmess), - gensym("bang")); + gensym("bng")); nobj++; } - else if (!strcmp(second, "slider") || !strcmp(second, "number") - || !strcmp(second, "flonum") || !strcmp(second, "toggle")) + else if (!strcmp(second, "number") || !strcmp(second, "flonum")) { binbuf_addv(newb, "ssff;", gensym("#X"), gensym("floatatom"), @@ -918,6 +917,33 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) atom_getfloatarg(3, natom, nextmess)); nobj++; } + else if (!strcmp(second, "slider")) + { + binbuf_addv(newb, "ssffsffffffsssfffffffff;", + gensym("#X"), gensym("obj"), + atom_getfloatarg(2, natom, nextmess), + atom_getfloatarg(3, natom, nextmess), + gensym("vsl"), + atom_getfloatarg(4, natom, nextmess), + atom_getfloatarg(5, natom, nextmess), + atom_getfloatarg(7, natom, nextmess), + atom_getfloatarg(7, natom, nextmess) + + (atom_getfloatarg(5, natom, nextmess) - 1) + * atom_getfloatarg(6, natom, nextmess), + 0., 0., + gensym("empty"), gensym("empty"), gensym("empty"), + 0., -8., 0., 8., -262144., -1., -1., 0., 1.); + nobj++; + } + else if (!strcmp(second, "toggle")) + { + binbuf_addv(newb, "ssffs;", + gensym("#X"), gensym("obj"), + atom_getfloatarg(2, natom, nextmess), + atom_getfloatarg(3, natom, nextmess), + gensym("tgl")); + nobj++; + } else if (!strcmp(second, "inlet")) { binbuf_addv(newb, "ssffs;", @@ -1014,6 +1040,30 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) atom_getfloatarg(2, natom, nextmess), atom_getfloatarg(3, natom, nextmess), 15., 1.); + else if (classname == gensym("bng")) + binbuf_addv(newb, "ssffff;", gensym("#P"), + gensym("button"), + atom_getfloatarg(2, natom, nextmess), + atom_getfloatarg(3, natom, nextmess), + atom_getfloatarg(5, natom, nextmess), 0.); + else if (classname == gensym("tgl")) + binbuf_addv(newb, "ssffff;", gensym("#P"), + gensym("toggle"), + atom_getfloatarg(2, natom, nextmess), + atom_getfloatarg(3, natom, nextmess), + atom_getfloatarg(5, natom, nextmess), 0.); + else if (classname == gensym("vsl")) + binbuf_addv(newb, "ssffffff;", gensym("#P"), + gensym("slider"), + atom_getfloatarg(2, natom, nextmess), + atom_getfloatarg(3, natom, nextmess), + atom_getfloatarg(5, natom, nextmess), + atom_getfloatarg(6, natom, nextmess), + (atom_getfloatarg(8, natom, nextmess) - + atom_getfloatarg(7, natom, nextmess)) / + (atom_getfloatarg(6, natom, nextmess) == 1? 1 : + atom_getfloatarg(6, natom, nextmess) - 1), + atom_getfloatarg(7, natom, nextmess)); else { SETSYMBOL(outmess, gensym("#P")); @@ -1069,7 +1119,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) } if (!maxtopd) binbuf_addv(newb, "ss;", gensym("#P"), gensym("pop")); -#if 1 +#if 0 binbuf_write(newb, "import-result.pd", "/tmp", 0); #endif return (newb); diff --git a/pd/src/m_class.c b/pd/src/m_class.c index 9d6329d6..b13db89d 100644 --- a/pd/src/m_class.c +++ b/pd/src/m_class.c @@ -3,12 +3,14 @@ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ #define PD_CLASS_DEF +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include <stdlib.h> #ifdef UNIX #include <unistd.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #endif @@ -21,6 +23,8 @@ static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv); t_pd pd_objectmaker; /* factory for creating "object" boxes */ t_pd pd_canvasmaker; /* factory for creating canvases */ +static t_symbol *class_extern_dir = &s_; + static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv) { pd_error(x, "%s: no method for '%s'", (*x)->c_name->s_name, s->s_name); @@ -200,6 +204,7 @@ t_class *class_new(t_symbol *s, t_newmethod newmethod, t_method freemethod, c->c_gobj = (typeflag >= CLASS_GOBJ); c->c_drawcommand = 0; c->c_floatsignalin = 0; + c->c_externdir = class_extern_dir; #if 0 post("class: %s", c->c_name->s_name); #endif @@ -402,6 +407,17 @@ void class_domainsignalin(t_class *c, int onset) c->c_floatsignalin = onset; } +void class_set_extern_dir(t_symbol *s) +{ + class_extern_dir = s; +} + +char *class_gethelpdir(t_class *c) +{ + return (c->c_externdir->s_name); +} + + /* ---------------- the symbol table ------------------------ */ #define HASHSIZE 1024 @@ -534,6 +550,13 @@ void mess_init(void) t_pd *newest; +/* This is externally available, but note that it might later disappear; the +whole "newest" thing is a hack which needs to be redesigned. */ +t_pd *pd_newest(void) +{ + return (newest); +} + /* horribly, we need prototypes for each of the artificial function calls in typedmess(), to keep the compiler quiet. */ typedef t_pd *(*t_newgimme)(t_symbol *s, int argc, t_atom *argv); diff --git a/pd/src/m_conf.c b/pd/src/m_conf.c index e2ba1689..d529ecd6 100644 --- a/pd/src/m_conf.c +++ b/pd/src/m_conf.c @@ -5,7 +5,7 @@ /* changes by Thomas Musil IEM KUG Graz Austria 2001 */ /* all changes are labeled with iemlib */ -#include "m_imp.h" +#include "m_pd.h" void g_array_setup(void); void g_canvas_setup(void); diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index 3be209d6..eb240068 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -2,6 +2,7 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#include "m_pd.h" #include "m_imp.h" static t_class *pdclass; @@ -19,47 +20,17 @@ void glob_audiostatus(void *dummy); void glob_finderror(t_pd *dummy); void glob_ping(t_pd *dummy); -#if 0 /* this doesn't work for OSS or for ALSA... discouraged... */ - -#ifdef UNIX -#include <unistd.h> -#endif - -void glob_restart_audio(t_pd *dummy) -{ - int inchans = sys_get_inchannels(); - int outchans = sys_get_outchannels(); - post("1"); - sys_close_audio(); - post("2"); -#ifdef UNIX - sleep(2); -#endif - post("3"); - sys_open_audio(1, 0, 1, 0, /* IOhannes */ - 1, &inchans, 1, &outchans, sys_dacsr); - post("4"); -} -#endif - void alsa_resync( void); -#ifdef ALSA01 -void glob_restart_alsa(t_pd *dummy) -{ - alsa_resync(); -} -#endif - -#ifdef NT +#ifdef MSW void glob_audio(void *dummy, t_floatarg adc, t_floatarg dac); #endif /* a method you add for debugging printout */ void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv); -#if 0 +#if 1 void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv) { *(int *)1 = 3; @@ -108,14 +79,6 @@ void glob_init(void) #ifdef UNIX class_addmethod(pdclass, (t_method)glob_ping, gensym("ping"), 0); #endif -#ifdef NT - class_addmethod(pdclass, (t_method)glob_audio, gensym("audio"), - A_DEFFLOAT, A_DEFFLOAT, 0); -#endif -#ifdef ALSA01 - class_addmethod(pdclass, (t_method)glob_restart_alsa, - gensym("restart-audio"), 0); -#endif class_addanything(pdclass, max_default); pd_bind(&pdclass, gensym("pd")); } diff --git a/pd/src/m_imp.h b/pd/src/m_imp.h index 7a6bd69e..b95f5d0e 100644 --- a/pd/src/m_imp.h +++ b/pd/src/m_imp.h @@ -5,7 +5,8 @@ /* This file contains function prototypes and data types used to implement Pd, but not shared with Pd objects. */ -#include "m_pd.h" +/* NOTE: this file describes Pd implementation details which may change +in future releases. The public (stable) API is in m_pd.h. */ /* LATER consider whether to use 'char' for method arg types to save space */ @@ -30,6 +31,7 @@ struct _class { t_symbol *c_name; /* name (mostly for error reporting) */ t_symbol *c_helpname; /* name of help file */ + t_symbol *c_externdir; /* directory extern was loaded from */ size_t c_size; /* size of an instance */ t_methodentry *c_methods; /* methods other than bang, etc below */ int c_nmethod; /* number of methods */ @@ -49,162 +51,6 @@ struct _class char c_drawcommand; /* a drawing command for a template */ }; -/* s_file.c */ -typedef struct _namelist -{ - struct _namelist *nl_next; - char *nl_string; -} t_namelist; - -t_namelist *namelist_append(t_namelist *listwas, const char *s); -void namelist_free(t_namelist *listwas); - -extern int sys_debuglevel; -extern int sys_verbose; - -#define DEBUG_MESSUP 1 /* messages up from pd to pd-gui */ -#define DEBUG_MESSDOWN 2 /* messages down from pd-gui to pd */ - -extern int sys_noloadbang; -extern int sys_nogui; -extern char *sys_guicmd; - -/* in s_main.c */ -EXTERN int sys_nearestfontsize(int fontsize); -EXTERN int sys_hostfontsize(int fontsize); - -extern int sys_defaultfont; -extern t_symbol *sys_libdir; /* library directory for auxilliary files */ -/* s_loader.c */ -int sys_load_lib(char *dirname, char *filename); - -/* s_unix.c */ -EXTERN void sys_microsleep(int microsec); - -/* s_sgi.c, s_nt.c, s_linux.c each implement the same API for audio -and MIDI I/O as follows: */ - -#define DACBLKSIZE 64 - -#define SENDDACS_NO 0 /* return values for sys_send_dacs() */ -#define SENDDACS_YES 1 -#define SENDDACS_SLEPT 2 - -#define API_OSS 0 /* API choices */ -#define API_ALSA 1 -#define API_RME 2 -#define API_MMIO 3 -#define API_PORTAUDIO 4 - - - /* MIDI input and output */ -#define MAXMIDIINDEV 16 /* max. number of input ports */ -#define MAXMIDIOUTDEV 16 /* max. number of output ports */ -extern int sys_nmidiin; -extern int sys_nmidiout; -extern int sys_midiindevlist[]; -extern int sys_midioutdevlist[]; - -EXTERN void sys_putmidimess(int portno, int a, int b, int c); -EXTERN void sys_putmidibyte(int portno, int a); -EXTERN void sys_poll_midi(void); -EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime); -EXTERN void sys_midibytein(int portno, int byte); - -extern int sys_hipriority; /* real-time flag, true if priority boosted */ -extern t_sample *sys_soundout; -extern t_sample *sys_soundin; -extern float sys_dacsr; -extern int sys_schedadvance; -extern int sys_sleepgrain; -EXTERN void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, - int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, - int srate); /* IOhannes */ - -EXTERN void sys_close_audio(void); - -EXTERN void sys_open_midi(int nmidiin, int *midiinvec, - int nmidiout, int *midioutvec); -EXTERN void sys_close_midi(void); - -EXTERN int sys_send_dacs(void); -EXTERN void sys_reportidle(void); -EXTERN void sys_set_priority(int higher); -EXTERN void sys_audiobuf(int nbufs); -EXTERN void sys_getmeters(float *inmax, float *outmax); -EXTERN void sys_listdevs(void); -EXTERN void sys_setblocksize(int n); - - /* for NT and Linux, there are additional bits of fluff as follows. */ -#ifdef NT -EXTERN void nt_soundindev(int which); -EXTERN void nt_soundoutdev(int which); -EXTERN void nt_midiindev(int which); -EXTERN void nt_midioutdev(int which); -EXTERN void nt_noresync( void); -EXTERN void nt_set_sound_api(int which); -#endif - -#ifdef __linux__ - /* the following definitions allow you to switch at run time - between audio APIs in Linux and later in NT. */ -void linux_set_sound_api(int which); - -void linux_setfrags(int n); -void linux_streammode( void); -void linux_32bit( void); -void rme_soundindev(int which); -void rme_soundoutdev(int which); -void linux_alsa_queue_size(int size); -#ifdef ALSA99 /* old fashioned ALSA */ -void linux_alsa_devno(int devno); -#else -void linux_alsa_devname(char *devname); -#endif -#endif /* __linux__ */ - -/* portaudio, used in Windows and Mac versions... */ - -int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, - t_sample *soundout, int framesperbuf, int nbuffers, - int indeviceno, int outdeviceno); -void pa_close_audio(void); -int pa_send_dacs(void); -void pa_reportidle(void); -void pa_listdevs(void); - -/* m_sched.c */ -EXTERN void sys_log_error(int type); -#define ERR_NOTHING 0 -#define ERR_ADCSLEPT 1 -#define ERR_DACSLEPT 2 -#define ERR_RESYNC 3 -#define ERR_DATALATE 4 - -/* s_inter.c */ - -EXTERN void sys_bail(int exitcode); -EXTERN int sys_pollgui(void); - -EXTERN_STRUCT _socketreceiver; -#define t_socketreceiver struct _socketreceiver - -typedef void (*t_socketnotifier)(void *x); -typedef void (*t_socketreceivefn)(void *x, t_binbuf *b); - -EXTERN t_socketreceiver *socketreceiver_new(void *owner, - t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp); -EXTERN void socketreceiver_read(t_socketreceiver *x, int fd); -EXTERN void sys_sockerror(char *s); -EXTERN void sys_closesocket(int fd); - -typedef void (*t_fdpollfn)(void *ptr, int fd); -EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); -EXTERN void sys_rmpollfn(int fd); -#ifdef UNIX -void sys_setalarm(int microsec); -void sys_setvirtualalarm( void); -#endif /* m_obj.c */ EXTERN int obj_noutlets(t_object *x); @@ -218,6 +64,13 @@ EXTERN t_outconnect *obj_connect(t_object *source, int outno, EXTERN void obj_disconnect(t_object *source, int outno, t_object *sink, int inno); EXTERN void outlet_setstacklim(void); +EXTERN int obj_issignalinlet(t_object *x, int m); +EXTERN int obj_issignaloutlet(t_object *x, int m); +EXTERN int obj_nsiginlets(t_object *x); +EXTERN int obj_nsigoutlets(t_object *x); +EXTERN int obj_siginletindex(t_object *x, int m); +EXTERN int obj_sigoutletindex(t_object *x, int m); + /* misc */ EXTERN void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir); EXTERN void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv); diff --git a/pd/src/m_memory.c b/pd/src/m_memory.c index cb94e4b1..bb5d79c6 100644 --- a/pd/src/m_memory.c +++ b/pd/src/m_memory.c @@ -4,6 +4,7 @@ #include <stdlib.h> #include <string.h> +#include "m_pd.h" #include "m_imp.h" /* #define LOUD */ diff --git a/pd/src/m_obj.c b/pd/src/m_obj.c index 6e3e1c19..e1f0f54a 100644 --- a/pd/src/m_obj.c +++ b/pd/src/m_obj.c @@ -6,6 +6,7 @@ can interconnect via inlets and outlets; also, the (terse) generic behavior for "gobjs" appears at the end of this file. */ +#include "m_pd.h" #include "m_imp.h" union inletunion @@ -609,6 +610,20 @@ int obj_siginletindex(t_object *x, int m) return (-1); } +int obj_issignalinlet(t_object *x, int m) +{ + t_inlet *i; + if (x->ob_pd->c_firstin) + { + if (!m) + return (x->ob_pd->c_firstin && x->ob_pd->c_floatsignalin); + else m--; + } + for (i = x->ob_inlet; i && m; i = i->i_next, m--) + ; + return (i && (i->i_symfrom == &s_signal)); +} + int obj_nsigoutlets(t_object *x) { int n; diff --git a/pd/src/m_pd.c b/pd/src/m_pd.c index 713d65ad..8192c7e4 100644 --- a/pd/src/m_pd.c +++ b/pd/src/m_pd.c @@ -3,6 +3,7 @@ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ #include <stdlib.h> +#include "m_pd.h" #include "m_imp.h" /* FIXME no out-of-memory testing yet! */ diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index 5e8b20bb..b5f7f037 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -2,21 +2,31 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifndef __m_pd_h_ + #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) extern "C" { #endif -#define PD_VERSION 0.36 +#define PD_VERSION 0.37 /* oops, don't use this... */ */ +#define PD_MAJOR_VERSION 0 /* ... use these two instead. */ +#define PD_MINOR_VERSION 37 + +/* old name for "MSW" flag -- we have to take it for the sake of many old +"nmakefiles" for externs, which will define NT and not MSW */ +#if defined(NT) && !defined(MSW) +#define MSW +#endif -#ifdef NT +#ifdef MSW // #pragma warning( disable : 4091 ) #pragma warning( disable : 4305 ) /* uncast const double to float */ #pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */ #pragma warning( disable : 4101 ) /* unused automatic variables */ -#endif /* NT */ +#endif /* MSW */ - /* the external storage class is "extern" in UNIX; in NT it's ugly. */ -#ifdef NT + /* the external storage class is "extern" in UNIX; in MSW it's ugly. */ +#ifdef MSW #ifdef PD_INTERNAL #define EXTERN __declspec(dllexport) extern #else @@ -24,7 +34,7 @@ extern "C" { #endif /* PD_INTERNAL */ #else #define EXTERN extern -#endif /* NT */ +#endif /* MSW */ /* and depending on the compiler, hidden data structures are declared differently: */ @@ -227,7 +237,8 @@ EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...); #define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c))) #define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d))) #define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e))) -void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); +EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); +EXTERN t_pd *pd_newest(void); /* --------------- memory management -------------------- */ EXTERN void *getbytes(size_t nbytes); @@ -443,7 +454,7 @@ EXTERN void sys_bashfilename(const char *from, char *to); EXTERN void sys_unbashfilename(const char *from, char *to); EXTERN int open_via_path(const char *name, const char *ext, const char *dir, char *dirresult, char **nameresult, unsigned int size, int bin); -EXTERN int sys_geteventno(void); +EXTERN int sched_geteventno(void); EXTERN double sys_getrealtime(void); /* --------------- signals ----------------------------------- */ @@ -600,3 +611,6 @@ test this just now. */ #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) } #endif + +#define __m_pd_h_ +#endif /* __m_pd_h_ */ diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c index 514e6f8b..b4a5dc3b 100644 --- a/pd/src/m_sched.c +++ b/pd/src/m_sched.c @@ -4,7 +4,9 @@ /* scheduling stuff */ +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" /* LATER consider making this variable. It's now the LCM of all sample rates we expect to see: 32000, 44100, 48000, 88200, 96000. */ @@ -12,9 +14,10 @@ static int sys_quit; static double sys_time; +static double sys_time_per_msec = TIMEUNITPERSEC / 1000.; static double sys_time_per_dsp_tick; -static double sys_time_per_msec; +int sys_schedblocksize = DEFDACBLKSIZE; int sys_usecsincelastsleep(void); int sys_sleepgrain; @@ -192,9 +195,6 @@ static int oss_resyncphase = 0; static int oss_nresync = 0; static t_resync oss_resync[NRESYNC]; -#ifdef __linux__ -void linux_audiostatus(void); -#endif static char *(oss_errornames[]) = { "unknown", @@ -207,9 +207,6 @@ static char *(oss_errornames[]) = { void glob_audiostatus(void) { int dev, nresync, nresyncphase, i; -#ifdef __linux__ - linux_audiostatus(); -#endif nresync = (oss_nresync >= NRESYNC ? NRESYNC : oss_nresync); nresyncphase = oss_resyncphase - 1; post("audio I/O error history:"); @@ -225,7 +222,7 @@ void glob_audiostatus(void) post("%9.2f\t%s", (sched_diddsp - oss_resync[nresyncphase].r_ntick) - * ((double)DACBLKSIZE) / sys_dacsr, + * ((double)sys_schedblocksize) / sys_dacsr, oss_errornames[errtype]); nresyncphase--; } @@ -247,7 +244,7 @@ void sys_log_error(int type) sched_diored = 1; } sched_dioredtime = - sched_diddsp + (int)(sys_dacsr /(double)DACBLKSIZE); + sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); } static int sched_lastinclip, sched_lastoutclip, @@ -268,7 +265,7 @@ static void sched_pollformeters( void) glob_ping(0); /* ping every 2 seconds */ sched_nextpingtime = sched_diddsp + - 2 * (int)(sys_dacsr /(double)DACBLKSIZE); + 2 * (int)(sys_dacsr /(double)sys_schedblocksize); } #endif @@ -303,7 +300,7 @@ static void sched_pollformeters( void) sched_lastoutdb = outdb; } sched_nextmeterpolltime = - sched_diddsp + (int)(sys_dacsr /(double)DACBLKSIZE); + sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); } void glob_meters(void *dummy, float f) @@ -315,7 +312,7 @@ void glob_meters(void *dummy, float f) -1; } -#if 1 +#if 0 void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv) { if (argc) sys_clearhist(); @@ -331,9 +328,7 @@ static int m_nodacs = 0; void m_schedsetsr( void) { sys_time_per_dsp_tick = - (TIMEUNITPERSEC) * ((double)DACBLKSIZE) / sys_dacsr; - sys_time_per_msec = - TIMEUNITPERSEC / 1000.; + (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; } /* @@ -357,6 +352,8 @@ int m_scheduler(int nodacs) int lasttimeforward = SENDDACS_YES; int idlecount = 0; double lastdactime = 0; + sys_time_per_dsp_tick = (TIMEUNITPERSEC) * + ((double)sys_schedblocksize) / sys_dacsr; sys_clearhist(); m_nodacs = nodacs; if (sys_sleepgrain < 1000) @@ -376,7 +373,7 @@ int m_scheduler(int nodacs) if (elapsed > next) { timeforward = SENDDACS_YES; - next += (double)DACBLKSIZE / sys_dacsr; + next += (double)sys_schedblocksize / sys_dacsr; } else timeforward = SENDDACS_NO; } diff --git a/pd/src/makefile.in b/pd/src/makefile.in index f9204e78..3f5b24d2 100644 --- a/pd/src/makefile.in +++ b/pd/src/makefile.in @@ -1,7 +1,3 @@ -# -# -# - VPATH = ../obj:./ OBJ_DIR = ../obj BIN_DIR = ../bin @@ -20,10 +16,6 @@ MANDIR = @mandir@ SOUND_ALSA = @alsa@ -# RME compilation - -SOUND_RME = @rme@ - DEFINES = @DEFINES@ MORECFLAGS = @MORECFLAGS@ @@ -47,22 +39,13 @@ CFLAGS = $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(MORECFLAGS) # ALSA non-shared, move the # sign below. ifeq (${SOUND_ALSA},yes) -CFLAGS += -DALSA01 -#LIB += /usr/lib/libasound.a -#LIB += -lasound +CFLAGS += -DPA_USE_ALSA -DUSEAPI_ALSA +SYSSRC += s_audio_alsa.c \ + ../portaudio/pa_linux_alsa/callback_thread.c \ + ../portaudio/pa_linux_alsa/pa_linux_alsa.c \ + ../portaudio/pa_linux_alsa/blocking_calls.c endif -ifeq (${SOUND_ALSA},old) -CFLAGS += -DALSA99 -#LIB += /usr/lib/libasound.a -#LIB += -lasound -endif - -ifeq (${SOUND_RME},yes) -CFLAGS += -DRME_HAMMERFALL -endif - - # Which system SYSTEM = $(shell uname -m) @@ -80,7 +63,7 @@ endif # the sources -SYSSRC = @SYSSRC@ +SYSSRC += @SYSSRC@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \ @@ -88,8 +71,8 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \ m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \ m_conf.c m_glob.c m_sched.c \ - s_main.c s_inter.c s_unix.c s_file.c s_print.c \ - s_loader.c s_path.c s_entry.c \ + s_main.c s_inter.c s_file.c s_print.c \ + s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \ d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \ d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \ d_delay.c d_resample.c \ diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt index 4a301882..9105d734 100644 --- a/pd/src/makefile.nt +++ b/pd/src/makefile.nt @@ -1,4 +1,4 @@ -# Makefile for portaudio ASIO driver version of PD +# Makefile for PD on MSW all: pd gui ..\bin\pd.tk ..\bin\pdsend.exe ..\bin\pdreceive.exe @@ -14,10 +14,11 @@ LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \ $(LDIR)\wsock32.lib $(LDIR)\winmm.lib ..\bin\pthreadVC.lib GLIB = $(LIB) ..\lib\tcl83.lib ..\lib\tk83.lib -CFLAGS = /nologo /W3 /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox +CFLAGS = /nologo /W3 /DMSW /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox \ + -DPA_LITTLE_ENDIAN -DUSEAPI_MMIO -DUSEAPI_PORTAUDIO LFLAGS = /nologo -SYSSRC = s_nt.c s_portaudio.c +SYSSRC = s_audio_pa.c s_audio_mmio.c s_midi_pm.c SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \ @@ -25,8 +26,8 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \ m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \ m_conf.c m_glob.c m_sched.c \ - s_main.c s_inter.c s_unix.c s_file.c s_print.c \ - s_loader.c s_path.c s_entry.c \ + s_main.c s_inter.c s_file.c s_print.c \ + s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \ d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \ d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \ d_delay.c d_resample.c \ @@ -36,24 +37,63 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ PADIR = ..\portaudio INCPA = -I$(PADIR) -I$(PADIR)\pa_common -I$(PADIR)\pablio -I..\lib\asio -SRCPA = $(PADIR)/pa_common/pa_lib.c $(PADIR)/pa_common/pa_trace.c \ - $(PADIR)/pablio/pablio_pd.c $(PADIR)/pablio/ringbuffer_pd.c -SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp +SRCPA = \ + $(PADIR)/pa_common/pa_allocation.c \ + $(PADIR)/pa_common/pa_converters.c \ + $(PADIR)/pa_common/pa_cpuload.c \ + $(PADIR)/pa_common/pa_dither.c \ + $(PADIR)/pa_common/pa_front.c \ + $(PADIR)/pa_common/pa_process.c \ + $(PADIR)/pa_common/pa_skeleton.c \ + $(PADIR)/pa_common/pa_stream.c \ + $(PADIR)/pa_common/pa_trace.c \ + $(PADIR)/pablio/pablio_pd.c \ + $(PADIR)/pablio/ringbuffer_pd.c \ + $(PADIR)/pa_win/pa_win_hostapis.c \ + $(PADIR)/pa_win/pa_win_util.c \ + $(PADIR)/pa_win/pa_x86_plain_converters.c \ + $(PADIR)/pa_win_wmme/pa_win_wmme.c + +# $(PADIR)/pa_win_ds/dsound_wrapper.c \ +# $(PADIR)/pa_win_ds/pa_dsound.c \ +# $(PADIR)/pa_win_ds/pa_win_ds.c \ + +PAOBJ = \ + pa_allocation.obj pa_converters.obj pa_cpuload.obj pa_dither.obj pa_front.obj \ + pa_process.obj pa_skeleton.obj pa_stream.obj pa_trace.obj pablio_pd.obj \ + ringbuffer_pd.obj pa_win_hostapis.obj pa_win_util.obj \ + pa_x86_plain_converters.obj \ + pa_win_wmme.obj pa_asio.obj \ + +# dsound_wrapper.obj pa_dsound.obj pa_win_ds.obj + -ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib $(LDIR)\comdlg32.lib \ +SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp +ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib \ + $(LDIR)\comdlg32.lib \ $(LDIR)\advapi32.lib $(LDIR)\shell32.lib $(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \ $(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib +PMDIR = ..\portmidi +INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime +SRCPM = \ + $(PMDIR)/pm_common/portmidi.c \ + $(PMDIR)/pm_common/pmutil.c \ + $(PMDIR)/pm_win/pmwin.c \ + $(PMDIR)/pm_win/pmwinmm.c \ + $(PMDIR)/porttime/porttime.c \ + $(PMDIR)/porttime/ptwinmm.c \ -PAOBJ = pa_lib.obj pa_trace.obj pablio_pd.obj ringbuffer_pd.obj pa_asio.obj -OBJC = $(SRC:.c=.obj) $(PAOBJ) +PMOBJ = portmidi.obj pmutil.obj pmwin.obj pmwinmm.obj porttime.obj ptwinmm.obj + +OBJC = $(SRC:.c=.obj) $(PAOBJ) $(PMOBJ) GSRC = t_main.c t_tkcmd.c GOBJ = $(GSRC:.c=.obj) .PHONY: pd gui -ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) /D_WINDOWS +ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) $(INCPM) /D_WINDOWS /DPA_NO_DS .c.obj: cl /c $(ALLCF) /Tc$*.c @@ -84,18 +124,60 @@ gui: ..\bin\pdtcl.dll link $(LFLAGS) /out:..\bin\pdreceive.exe /INCREMENTAL:NO u_pdreceive.obj \ $(LIB) -# explicit rules to compile portaudio sources: -pa_lib.obj: $(PADIR)\pa_common\pa_lib.c - cl /c $(ALLCF) $(PADIR)\pa_common\pa_lib.c +# explicit rules to compile portaudio and portmidi sources: +pa_allocation.obj: $(PADIR)\pa_common\pa_allocation.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_allocation.c +pa_converters.obj: $(PADIR)\pa_common\pa_converters.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_converters.c +pa_cpuload.obj: $(PADIR)\pa_common\pa_cpuload.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_cpuload.c +pa_dither.obj: $(PADIR)\pa_common\pa_dither.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_dither.c +pa_front.obj: $(PADIR)\pa_common\pa_front.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_front.c +pa_process.obj: $(PADIR)\pa_common\pa_process.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_process.c +pa_skeleton.obj: $(PADIR)\pa_common\pa_skeleton.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_skeleton.c +pa_stream.obj: $(PADIR)\pa_common\pa_stream.c + cl /c $(ALLCF) $(PADIR)\pa_common\pa_stream.c pa_trace.obj: $(PADIR)\pa_common\pa_trace.c cl /c $(ALLCF) $(PADIR)\pa_common\pa_trace.c pablio_pd.obj: $(PADIR)\pablio\pablio_pd.c cl /c $(ALLCF) $(PADIR)\pablio\pablio_pd.c ringbuffer_pd.obj: $(PADIR)\pablio\ringbuffer_pd.c cl /c $(ALLCF) $(PADIR)\pablio\ringbuffer_pd.c +pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c + cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c +pa_win_util.obj: $(PADIR)\pa_win\pa_win_util.c + cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_util.c +pa_x86_plain_converters.obj: $(PADIR)\pa_win\pa_x86_plain_converters.c + cl /c $(ALLCF) $(PADIR)\pa_win\pa_x86_plain_converters.c +dsound_wrapper.obj: $(PADIR)\pa_win_ds\dsound_wrapper.c + cl /c $(ALLCF) $(PADIR)\pa_win_ds\dsound_wrapper.c +pa_dsound.obj: $(PADIR)\pa_win_ds\pa_dsound.c + cl /c $(ALLCF) $(PADIR)\pa_win_ds\pa_dsound.c +pa_win_ds.obj: $(PADIR)\pa_win_ds\pa_win_ds.c + cl /c $(ALLCF) $(PADIR)\pa_win_ds\pa_win_ds.c +pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c + cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c + pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp +portmidi.obj: $(PMDIR)\pm_common\portmidi.c + cl /c $(ALLCF) $(PMDIR)\pm_common\portmidi.c +pmutil.obj: $(PMDIR)\pm_common\pmutil.c + cl /c $(ALLCF) $(PMDIR)\pm_common\pmutil.c +pmwin.obj: $(PMDIR)\pm_win\pmwin.c + cl /c $(ALLCF) $(PMDIR)\pm_win\pmwin.c +pmwinmm.obj: $(PMDIR)\pm_win\pmwinmm.c + cl /c $(ALLCF) $(PMDIR)\pm_win\pmwinmm.c +porttime.obj: $(PMDIR)\porttime\porttime.c + cl /c $(ALLCF) $(PMDIR)\porttime\porttime.c +ptwinmm.obj: $(PMDIR)\porttime\ptwinmm.c + cl /c $(ALLCF) $(PMDIR)\porttime\ptwinmm.c + # the following should also clean up "bin" but it doesn't because "bin" holds # precious stuff from elsewhere. clean: diff --git a/pd/src/notes.txt b/pd/src/notes.txt index 1f0937e8..0f95929d 100644 --- a/pd/src/notes.txt +++ b/pd/src/notes.txt @@ -1,18 +1,29 @@ -done for 0.36: +vline object +arrow keys in text objs for mac ---------------- dolist -------------------- - -pddp doc +vline~ help window +writesf help window, support 32 bit wav files, and fix sample rate writing +check that latency is actually set (esp. in windows) +windows escape from control-C +dialogs for a/d/a, midi, path +ALSA deglitch back in +bug: resizing grow-upward patches leaves line traces around + +suspend/resume graphics updates +scheduler to handle callbacks scheduler to do DSP computations even if no audio hook to scheduler to let others get called for DSP I/O figure out how to avoid "dac freeze" if nosound - +new: mline~, msnapshot~, abs~ +flags to defeat adding specified classes from libraries +incorporate pddp doc try again to fix the font scene addcomma message to message pasting should look at current mouse location +open/save panel to take messages to init directory problems: -messages & comments don't come up with text activated? arrays of non-existent templates crash don't draw in/outlets on gui objects in graphs Alsa degradation after several hours running on soundblaster @@ -20,7 +31,6 @@ font size should depend on subpatch/abstraction moving a bang toward top of window creates problem figure out O_NDELAY for linux audio? missed Thomas's multi-dialog trick??? -fix iemguis not to bash symbol names check what happens when going back and forth between graph-on-parent deal with spaces in iemgui labels and send/receive names get rid of messages causing renaming; try to prevent patches closing themselves. @@ -47,6 +57,7 @@ scalar hook to catch the mouse protect against "plots" going away while you drag on them features: +command line flag to defeat loading objects signal inlets with initialized values... Pd to open html help on windows/mac flag to hide array names @@ -56,14 +67,11 @@ if there's just one array, don't do stringent hit check. netsend separate thread netreceive (and netsend?) message to set port number delete-in-rectangle message to Pds -"regular" numbers/symbols to do send/receive thing ala IEMGUI make selecting text grab keyboard focus think about x and y scale preservation when changing between graph and object show outlines of objects even when graph is "open" make graph labels persistent and add to dialog array click protection (Krzysztof's suggestion) -Pd support for jack audio system: http://home.t-online.de/home/pdq808/jack-patch -offer audiooutdev 1,3 feature on Windows Alsa in data late should carefuly reset DAC/ADC fill&empty pointers increase MIDIQSIZE to at least 1024 in s_unix.c add nonblock to linux open calls instead of using alarm diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c new file mode 100644 index 00000000..ca5e34c6 --- /dev/null +++ b/pd/src/s_audio.c @@ -0,0 +1,410 @@ +/* Copyright (c) 2003, Miller Puckette and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* machine-independent (well, mostly!) audio layer. Stores and recalls + audio settings from argparse routine and from dialog window. +*/ + + +#include "m_pd.h" +#include "s_stuff.h" +#include <stdio.h> +#ifdef UNIX +#include <unistd.h> +#include <sys/time.h> +#include <sys/resource.h> +#endif +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#define SYS_DEFAULTCH 2 +#define SYS_MAXCH 100 +#define SYS_DEFAULTSRATE 44100 +typedef long t_pa_sample; +#define SYS_SAMPLEWIDTH sizeof(t_pa_sample) +#define SYS_BYTESPERCHAN (DEFDACBLKSIZE * SYS_SAMPLEWIDTH) +#define SYS_XFERSAMPS (SYS_DEFAULTCH*DEFDACBLKSIZE) +#define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS) +#define MAXAUDIODEV 4 + +int sys_inchannels; +int sys_outchannels; +int sys_advance_samples; /* scheduler advance in samples */ +int sys_blocksize = 256; /* audio I/O block size in sample frames */ +int sys_audioapi = API_DEFAULT; + +static int sys_meters; /* true if we're metering */ +static float sys_inmax; /* max input amplitude */ +static float sys_outmax; /* max output amplitude */ + + /* exported variables */ +#ifdef MSW +#define DEFAULTADVANCE 70000 +#else +#define DEFAULTADVANCE 50000 +#endif +int sys_schedadvance = DEFAULTADVANCE; /* scheduler advance in microseconds */ +float sys_dacsr; +int sys_hipriority = 0; +t_sample *sys_soundout; +t_sample *sys_soundin; + + /* set channels and sample rate. */ + +static void sys_setchsr(int chin, int chout, int sr) +{ + int nblk; + int inbytes = chin * (DEFDACBLKSIZE*sizeof(float)); + int outbytes = chout * (DEFDACBLKSIZE*sizeof(float)); + + sys_inchannels = chin; + sys_outchannels = chout; + sys_dacsr = sr; + sys_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.); + if (sys_advance_samples < 3 * DEFDACBLKSIZE) + sys_advance_samples = 3 * DEFDACBLKSIZE; + + if (sys_soundin) + free(sys_soundin); + sys_soundin = (t_float *)malloc(inbytes); + memset(sys_soundin, 0, inbytes); + + if (sys_soundout) + free(sys_soundout); + sys_soundout = (t_float *)malloc(outbytes); + memset(sys_soundout, 0, outbytes); + + if (sys_verbose) + post("input channels = %d, output channels = %d", + sys_inchannels, sys_outchannels); +} + +/* ----------------------- public routines ----------------------- */ + +#if 0 +void sys_open_audio(int naudioindev, int *audioindev, int nchindev, + int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, + int *choutdev, int rate) /* IOhannes */ +{ + int inchans= + (nchindev > 0 ? chindev[0] : (nchindev == 0 ? 0 : SYS_DEFAULTCH)); + int outchans= + (nchoutdev > 0 ? choutdev[0] : (nchoutdev == 0 ? 0 : SYS_DEFAULTCH)); + int soundindev = (naudioindev <= 0 ? -1 : (audioindev[0]-1)); + int soundoutdev = (naudiooutdev <= 0 ? -1 : (audiooutdev[0]-1)); + int sounddev = (inchans > 0 ? soundindev : soundoutdev); + if (naudioindev > 1 || nchindev > 1 || naudiooutdev > 1 || nchoutdev > 1) + post("sorry, only one portaudio device can be open at once.\n"); + /* post("nindev %d, noutdev %d", naudioindev, naudiooutdev); + post("soundindev %d, soundoutdev %d", soundindev, soundoutdev); */ + if (sys_verbose) + post("channels in %d, out %d", inchans, outchans); + if (rate < 1) + rate = SYS_DEFAULTSRATE; + sys_setchsr(inchans, outchans, rate); + pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout, + sys_blocksize, sys_advance_samples/sys_blocksize, + soundindev, soundoutdev); +} +#endif + +void sys_open_audio(int naudioindev, int *audioindev, int nchindev, + int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, + int *choutdev, int rate) /* IOhannes */ +{ + int i, *ip; + int defaultchannels = SYS_DEFAULTCH; + int inchans, outchans; + if (rate < 1) + rate = SYS_DEFAULTSRATE; + + if (naudioindev == -1) + { /* not set */ + if (nchindev == -1) + { + nchindev=1; + chindev[0] = defaultchannels; + naudioindev = 1; + audioindev[0] = DEFAULTAUDIODEV; + } + else + { + for (i = 0; i < MAXAUDIODEV; i++) + audioindev[i] = i+1; + naudioindev = nchindev; + } + } + else + { + if (nchindev == -1) + { + nchindev = naudioindev; + for (i = 0; i < naudioindev; i++) + chindev[i] = defaultchannels; + } + else if (nchindev > naudioindev) + { + for (i = naudioindev; i < nchindev; i++) + { + if (i == 0) + audioindev[0] = DEFAULTAUDIODEV; + else audioindev[i] = audioindev[i-1] + 1; + } + naudioindev = nchindev; + } + else if (nchindev < naudioindev) + { + for (i = nchindev; i < naudioindev; i++) + { + if (i == 0) + chindev[0] = defaultchannels; + else chindev[i] = chindev[i-1]; + } + naudioindev = nchindev; + } + } + + if (naudiooutdev == -1) + { /* not set */ + if (nchoutdev == -1) + { + nchoutdev=1; + choutdev[0]=defaultchannels; + naudiooutdev=1; + audiooutdev[0] = DEFAULTAUDIODEV; + } + else + { + for (i = 0; i < MAXAUDIODEV; i++) + audiooutdev[i] = i+1; + naudiooutdev = nchoutdev; + } + } + else + { + if (nchoutdev == -1) + { + nchoutdev = naudiooutdev; + for (i = 0; i < naudiooutdev; i++) + choutdev[i] = defaultchannels; + } + else if (nchoutdev > naudiooutdev) + { + for (i = naudiooutdev; i < nchoutdev; i++) + { + if (i == 0) + audiooutdev[0] = DEFAULTAUDIODEV; + else audiooutdev[i] = audiooutdev[i-1] + 1; + } + naudiooutdev = nchoutdev; + } + else if (nchoutdev < naudiooutdev) + { + for (i = nchoutdev; i < naudiooutdev; i++) + { + if (i == 0) + choutdev[0] = defaultchannels; + else choutdev[i] = choutdev[i-1]; + } + naudiooutdev = nchoutdev; + } + } + for (i = inchans = 0; i < naudioindev; i++) + inchans += chindev[i]; + for (i = outchans = 0; i < naudiooutdev; i++) + outchans += choutdev[i]; + + sys_setchsr(inchans, outchans, rate); +#ifdef USEAPI_OSS + if (sys_audioapi == API_OSS) + oss_open_audio(naudioindev, audioindev, nchindev, chindev, + naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); + else +#endif +#ifdef USEAPI_ALSA + /* for alsa, the "device numbers" are ignored; they are sent + straight to the alsa code via linux_alsa_devname(). Only one + device is supported for each of input, output. */ + if (sys_audioapi == API_ALSA) + alsa_open_audio((naudioindev > 0 ? chindev[0] : 0), + (naudiooutdev > 0 ? choutdev[0] : 0), rate); + else +#endif +#ifdef USEAPI_PORTAUDIO + if (sys_audioapi == API_PORTAUDIO) + pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout, + sys_blocksize, sys_advance_samples/sys_blocksize, + (naudiooutdev > 0 ? audioindev[0] : 0), + (naudiooutdev > 0 ? audiooutdev[0] : 0)); + else +#endif +#ifdef USEAPI_MMIO + if (sys_audioapi == API_MMIO) + mmio_open_audio(naudioindev, audioindev, nchindev, chindev, + naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); + else +#endif + post("unknown audio API specified"); +} + +void sys_close_audio(void) +{ + +#ifdef USEAPI_PORTAUDIO + if (sys_audioapi == API_PORTAUDIO) + pa_close_audio(); + else +#endif +#ifdef USEAPI_OSS + if (sys_audioapi == API_OSS) + oss_close_audio(); + else +#endif +#ifdef USEAPI_ALSA + if (sys_audioapi == API_ALSA) + alsa_close_audio(); + else +#ifdef USEAPI_MMIO + if (sys_audioapi == API_MMIO) + mmio_close_audio(); + else +#endif +#endif + post("unknown API"); + +} + +int sys_send_dacs(void) +{ + if (sys_meters) + { + int i, n; + float maxsamp; + for (i = 0, n = sys_inchannels * DEFDACBLKSIZE, maxsamp = sys_inmax; + i < n; i++) + { + float f = sys_soundin[i]; + if (f > maxsamp) maxsamp = f; + else if (-f > maxsamp) maxsamp = -f; + } + sys_inmax = maxsamp; + for (i = 0, n = sys_outchannels * DEFDACBLKSIZE, maxsamp = sys_outmax; + i < n; i++) + { + float f = sys_soundout[i]; + if (f > maxsamp) maxsamp = f; + else if (-f > maxsamp) maxsamp = -f; + } + sys_outmax = maxsamp; + } + +#ifdef USEAPI_PORTAUDIO + if (sys_audioapi == API_PORTAUDIO) + return (pa_send_dacs()); + else +#endif +#ifdef USEAPI_OSS + if (sys_audioapi == API_OSS) + return (oss_send_dacs()); + else +#endif +#ifdef USEAPI_ALSA + if (sys_audioapi == API_ALSA) + return (alsa_send_dacs()); + else +#endif +#ifdef USEAPI_MMIO + if (sys_audioapi == API_MMIO) + return (mmio_send_dacs()); + else +#endif + post("unknown API"); + return (0); +} + +float sys_getsr(void) +{ + return (sys_dacsr); +} + +int sys_get_outchannels(void) +{ + return (sys_outchannels); +} + +int sys_get_inchannels(void) +{ + return (sys_inchannels); +} + +void sys_audiobuf(int n) +{ + /* set the size, in milliseconds, of the audio FIFO */ + if (n < 5) n = 5; + else if (n > 5000) n = 5000; + sys_schedadvance = n * 1000; +} + +void sys_getmeters(float *inmax, float *outmax) +{ + if (inmax) + { + sys_meters = 1; + *inmax = sys_inmax; + *outmax = sys_outmax; + } + else + sys_meters = 0; + sys_inmax = sys_outmax = 0; +} + +void sys_reportidle(void) +{ +} + +void sys_listdevs(void ) +{ +#ifdef USEAPI_PORTAUDIO + if (sys_audioapi == API_PORTAUDIO) + pa_listdevs(); + else +#endif +#ifdef USEAPI_OSS + if (sys_audioapi == API_OSS) + oss_listdevs(); + else +#endif +#ifdef USEAPI_MMIO + if (sys_audioapi == API_MMIO) + mmio_listdevs(); + else +#endif +#ifdef USEAPI_ALSA + if (sys_audioapi == API_ALSA) + alsa_listdevs(); + else +#endif + post("unknown API"); + + sys_listmididevs(); +} + +void sys_setblocksize(int n) +{ + if (n < 1) + n = 1; + if (n != (1 << ilog2(n))) + post("warning: adjusting blocksize to power of 2: %d", + (n = (1 << ilog2(n)))); + sys_blocksize = n; +} + +void sys_set_sound_api(int which) +{ + sys_audioapi = which; + if (sys_verbose) + post("sys_audioapi %d", sys_audioapi); +} + diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c new file mode 100644 index 00000000..0fa3d791 --- /dev/null +++ b/pd/src/s_audio_alsa.c @@ -0,0 +1,630 @@ +/* Copyright (c) 1997-2003 Guenter Geiger, Miller Puckette, Larry Troxler, +* Winfried Ritsch, Karl MacMillan, and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* this file inputs and outputs audio using the ALSA API available on linux. */ + +#include <alsa/asoundlib.h> + +#include "m_pd.h" +#include "s_stuff.h" +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <sched.h> +#include <sys/mman.h> + +typedef int16_t t_alsa_sample16; +typedef int32_t t_alsa_sample32; +#define ALSA_SAMPLEWIDTH_16 sizeof(t_alsa_sample16) +#define ALSA_SAMPLEWIDTH_32 sizeof(t_alsa_sample32) +#define ALSA_XFERSIZE16 (signed int)(sizeof(t_alsa_sample16) * DEFDACBLKSIZE) +#define ALSA_XFERSIZE32 (signed int)(sizeof(t_alsa_sample32) * DEFDACBLKSIZE) +#define ALSA_MAXDEV 1 +#define ALSA_JITTER 1024 +#define ALSA_EXTRABUFFER 2048 +#define ALSA_DEFFRAGSIZE 64 +#define ALSA_DEFNFRAG 12 + +#ifndef INT32_MAX +#define INT32_MAX 0x7fffffff +#endif + +typedef struct _alsa_dev +{ + snd_pcm_t *inhandle; + snd_pcm_t *outhandle; +} t_alsa_dev; + +t_alsa_dev alsa_device; +static short *alsa_buf; +static int alsa_samplewidth; +static snd_pcm_status_t* in_status; +static snd_pcm_status_t* out_status; + +static int alsa_mode; + +/* Defines */ +#define DEBUG(x) x +#define DEBUG2(x) {x;} + +static char alsa_devname[512] = "hw:0,0"; +static int alsa_use_plugin = 0; + + /* don't assume we can turn all 31 bits when doing float-to-fix; + otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */ +#define FMAX 0x7ffff000 +#define CLIP32(x) (((x)>FMAX)?FMAX:((x) < -FMAX)?-FMAX:(x)) + + /* ugly Alsa-specific flags */ +void linux_alsa_devname(char *devname) +{ + strncpy(alsa_devname, devname, 511); +} + +void linux_alsa_use_plugin(int t) +{ + if (t == 1) + alsa_use_plugin = 1; + else + alsa_use_plugin = 0; +} + +/* support for ALSA pcmv2 api by Karl MacMillan<karlmac@peabody.jhu.edu> */ + +static void check_error(int err, const char *why) +{ + if (err < 0) + fprintf(stderr, "%s: %s\n", why, snd_strerror(err)); +} + +int alsa_open_audio(int wantinchans, int wantoutchans, int srate) +{ + int err, inchans = 0, outchans = 0, subunitdir; + char devname[512]; + snd_pcm_hw_params_t* hw_params; + snd_pcm_sw_params_t* sw_params; + snd_output_t* out; + int frag_size = (sys_blocksize ? sys_blocksize : ALSA_DEFFRAGSIZE); + int nfrags, i; + short* tmp_buf; + unsigned int tmp_uint; + + nfrags = sys_schedadvance * (float)srate / (1e6 * frag_size); + + if (sys_verbose) + post("audio buffer set to %d", (int)(0.001 * sys_schedadvance)); + if (wantinchans) + { + err = snd_pcm_open(&alsa_device.inhandle, alsa_devname, + SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK); + + check_error(err, "snd_pcm_open (input)"); + if (err < 0) + inchans = 0; + else + { + inchans = wantinchans; + snd_pcm_nonblock(alsa_device.inhandle, 1); + } + } + if (wantoutchans) + { + err = snd_pcm_open(&alsa_device.outhandle, alsa_devname, + SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); + + check_error(err, "snd_pcm_open (output)"); + if (err < 0) + outchans = 0; + else + { + outchans = wantoutchans; + snd_pcm_nonblock(alsa_device.outhandle, 1); + } + } + if (inchans) + { + if (sys_verbose) + post("opening sound input..."); + err = snd_pcm_hw_params_malloc(&hw_params); + check_error(err, "snd_pcm_hw_params_malloc (input)"); + + // get the default params + err = snd_pcm_hw_params_any(alsa_device.inhandle, hw_params); + check_error(err, "snd_pcm_hw_params_any (input)"); + // set interleaved access - FIXME deal with other access types + err = snd_pcm_hw_params_set_access(alsa_device.inhandle, hw_params, + SND_PCM_ACCESS_RW_INTERLEAVED); + check_error(err, "snd_pcm_hw_params_set_access (input)"); + // Try to set 32 bit format first + err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params, + SND_PCM_FORMAT_S32); + if (err < 0) + { + /* fprintf(stderr, + "PD-ALSA: 32 bit format not available - using 16\n"); */ + err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params, + SND_PCM_FORMAT_S16); + check_error(err, "snd_pcm_hw_params_set_format (input)"); + alsa_samplewidth = 2; + } + else + { + alsa_samplewidth = 4; + } + post("Sample width set to %d bytes", alsa_samplewidth); + // set the subformat + err = snd_pcm_hw_params_set_subformat(alsa_device.inhandle, hw_params, + SND_PCM_SUBFORMAT_STD); + check_error(err, "snd_pcm_hw_params_set_subformat (input)"); + // set the number of channels + tmp_uint = inchans; + err = snd_pcm_hw_params_set_channels_min(alsa_device.inhandle, + hw_params, &tmp_uint); + check_error(err, "snd_pcm_hw_params_set_channels (input)"); + if (tmp_uint != (unsigned)inchans) + post("ALSA: set input channels to %d", tmp_uint); + inchans = tmp_uint; + // set the sampling rate + err = snd_pcm_hw_params_set_rate_min(alsa_device.inhandle, hw_params, + &srate, 0); + check_error(err, "snd_pcm_hw_params_set_rate_min (input)"); +#if 0 + err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir); + post("input sample rate %d", err); +#endif + // set the period - ie frag size + // post("fragsize a %d", frag_size); + + /* LATER try this to get a recommended period size... + right now, it trips an assertion failure in ALSA lib */ +#if 0 + post("input period was %d, min %d, max %d\n", + snd_pcm_hw_params_get_period_size(hw_params, 0), + snd_pcm_hw_params_get_period_size_min(hw_params, 0), + snd_pcm_hw_params_get_period_size_max(hw_params, 0)); +#endif + err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle, + hw_params, + (snd_pcm_uframes_t) + frag_size, 0); + check_error(err, "snd_pcm_hw_params_set_period_size_near (input)"); + // post("fragsize b %d", frag_size); + // set the number of periods - ie numfrags + // post("nfrags a %d", nfrags); + err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle, + hw_params, nfrags, 0); + check_error(err, "snd_pcm_hw_params_set_periods_near (input)"); + // set the buffer size + err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle, + hw_params, nfrags * frag_size); + check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)"); + + err = snd_pcm_hw_params(alsa_device.inhandle, hw_params); + check_error(err, "snd_pcm_hw_params (input)"); + + snd_pcm_hw_params_free(hw_params); + + err = snd_pcm_sw_params_malloc(&sw_params); + check_error(err, "snd_pcm_sw_params_malloc (input)"); + err = snd_pcm_sw_params_current(alsa_device.inhandle, sw_params); + check_error(err, "snd_pcm_sw_params_current (input)"); +#if 1 + err = snd_pcm_sw_params_set_start_mode(alsa_device.inhandle, sw_params, + SND_PCM_START_EXPLICIT); + check_error(err, "snd_pcm_sw_params_set_start_mode (input)"); + err = snd_pcm_sw_params_set_xrun_mode(alsa_device.inhandle, sw_params, + SND_PCM_XRUN_NONE); + check_error(err, "snd_pcm_sw_params_set_xrun_mode (input)"); +#else + err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle, + sw_params, nfrags * frag_size); + check_error(err, "snd_pcm_sw_params_set_start_threshold (input)"); + err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle, + sw_params, 1); + check_error(err, "snd_pcm_sw_params_set_stop_threshold (input)"); +#endif + + err = snd_pcm_sw_params_set_avail_min(alsa_device.inhandle, sw_params, + frag_size); + check_error(err, "snd_pcm_sw_params_set_avail_min (input)"); + err = snd_pcm_sw_params(alsa_device.inhandle, sw_params); + check_error(err, "snd_pcm_sw_params (input)"); + + snd_pcm_sw_params_free(sw_params); + + snd_output_stdio_attach(&out, stderr, 0); +#if 0 + if (sys_verbose) + { + snd_pcm_dump_hw_setup(alsa_device.inhandle, out); + snd_pcm_dump_sw_setup(alsa_device.inhandle, out); + } +#endif + } + + if (outchans) + { + int foo; + if (sys_verbose) + post("opening sound output..."); + err = snd_pcm_hw_params_malloc(&hw_params); + check_error(err, "snd_pcm_sw_params (output)"); + + // get the default params + err = snd_pcm_hw_params_any(alsa_device.outhandle, hw_params); + check_error(err, "snd_pcm_hw_params_any (output)"); + // set interleaved access - FIXME deal with other access types + err = snd_pcm_hw_params_set_access(alsa_device.outhandle, hw_params, + SND_PCM_ACCESS_RW_INTERLEAVED); + check_error(err, "snd_pcm_hw_params_set_access (output)"); + // Try to set 32 bit format first + err = snd_pcm_hw_params_set_format(alsa_device.outhandle, hw_params, + SND_PCM_FORMAT_S32); + if (err < 0) + { + err = snd_pcm_hw_params_set_format(alsa_device.outhandle, + hw_params,SND_PCM_FORMAT_S16); + check_error(err, "snd_pcm_hw_params_set_format (output)"); + /* fprintf(stderr, + "PD-ALSA: 32 bit format not available - using 16\n"); */ + alsa_samplewidth = 2; + } + else + { + alsa_samplewidth = 4; + } + // set the subformat + err = snd_pcm_hw_params_set_subformat(alsa_device.outhandle, hw_params, + SND_PCM_SUBFORMAT_STD); + check_error(err, "snd_pcm_hw_params_set_subformat (output)"); + // set the number of channels + tmp_uint = outchans; + err = snd_pcm_hw_params_set_channels_min(alsa_device.outhandle, + hw_params, &tmp_uint); + check_error(err, "snd_pcm_hw_params_set_channels (output)"); + if (tmp_uint != (unsigned)outchans) + post("alsa: set output channels to %d", tmp_uint); + outchans = tmp_uint; + // set the sampling rate + err = snd_pcm_hw_params_set_rate_min(alsa_device.outhandle, hw_params, + &srate, 0); + check_error(err, "snd_pcm_hw_params_set_rate_min (output)"); +#if 0 + err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir); + post("output sample rate %d", err); +#endif + // set the period - ie frag size +#if 0 + post("output period was %d, min %d, max %d\n", + snd_pcm_hw_params_get_period_size(hw_params, 0), + snd_pcm_hw_params_get_period_size_min(hw_params, 0), + snd_pcm_hw_params_get_period_size_max(hw_params, 0)); +#endif + // post("fragsize c %d", frag_size); + err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle, + hw_params, + (snd_pcm_uframes_t) + frag_size, 0); + // post("fragsize d %d", frag_size); + check_error(err, "snd_pcm_hw_params_set_period_size_near (output)"); + // set the number of periods - ie numfrags + err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle, + hw_params, nfrags, 0); + check_error(err, "snd_pcm_hw_params_set_periods_near (output)"); + // set the buffer size + err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle, + hw_params, nfrags * frag_size); + + check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)"); + + err = snd_pcm_hw_params(alsa_device.outhandle, hw_params); + check_error(err, "snd_pcm_hw_params (output)"); + + snd_pcm_hw_params_free(hw_params); + + err = snd_pcm_sw_params_malloc(&sw_params); + check_error(err, "snd_pcm_sw_params_malloc (output)"); + err = snd_pcm_sw_params_current(alsa_device.outhandle, sw_params); + check_error(err, "snd_pcm_sw_params_current (output)"); +#if 1 + err = snd_pcm_sw_params_set_start_mode(alsa_device.outhandle, + sw_params, + SND_PCM_START_EXPLICIT); + check_error(err, "snd_pcm_sw_params_set_start_mode (output)"); + err = snd_pcm_sw_params_set_xrun_mode(alsa_device.outhandle, sw_params, + SND_PCM_XRUN_NONE); + check_error(err, "snd_pcm_sw_params_set_xrun_mode (output)"); +#else + err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle, + sw_params, nfrags * frag_size); + check_error(err, "snd_pcm_sw_params_set_start_threshold (output)"); + err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle, + sw_params, 1); + check_error(err, "snd_pcm_sw_params_set_stop_threshold (output)"); +#endif + + err = snd_pcm_sw_params_set_avail_min(alsa_device.outhandle, sw_params, + frag_size); + check_error(err, "snd_pcm_sw_params_set_avail_min (output)"); + err = snd_pcm_sw_params(alsa_device.outhandle, sw_params); + check_error(err, "snd_pcm_sw_params (output)"); + + snd_pcm_sw_params_free(sw_params); + + snd_output_stdio_attach(&out, stderr, 0); +#if 0 + if (sys_verbose) + { + snd_pcm_dump_hw_setup(alsa_device.outhandle, out); + snd_pcm_dump_sw_setup(alsa_device.outhandle, out); + } +#endif + } + + if (inchans) + snd_pcm_prepare(alsa_device.inhandle); + if (outchans) + snd_pcm_prepare(alsa_device.outhandle); + + // if duplex we can link the channels so they start together + if (inchans && outchans) + snd_pcm_link(alsa_device.inhandle, alsa_device.outhandle); + + // set up the buffer + if (outchans > inchans) + alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, + DEFDACBLKSIZE * outchans); + else + alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, + DEFDACBLKSIZE * inchans); + // fill the buffer with silence + if (outchans) + { + i = nfrags + 1; + while (i--) + snd_pcm_writei(alsa_device.outhandle, alsa_buf, frag_size); + } + + // set up the status variables + err = snd_pcm_status_malloc(&in_status); + check_error(err, "snd_pcm_status_malloc"); + err = snd_pcm_status_malloc(&out_status); + check_error(err, "snd_pcm_status_malloc"); + + // start the device +#if 1 + if (outchans) + { + err = snd_pcm_start(alsa_device.outhandle); + check_error(err, "snd_pcm_start"); + } + else if (inchans) + { + err = snd_pcm_start(alsa_device.inhandle); + check_error(err, "snd_pcm_start"); + } +#endif + + return 0; +} + +void alsa_close_audio(void) +{ + int err; + if (sys_inchannels) + { + err = snd_pcm_close(alsa_device.inhandle); + check_error(err, "snd_pcm_close (input)"); + } + if (sys_outchannels) + { + err = snd_pcm_close(alsa_device.outhandle); + check_error(err, "snd_pcm_close (output)"); + } +} + +// #define DEBUG_ALSA_XFER + +int alsa_send_dacs(void) +{ + static int16_t *sp; + static int xferno = 0; + static int callno = 0; + static double timenow; + double timelast; + t_sample *fp, *fp1, *fp2; + int i, j, k, err, devno = 0; + int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0; + int result; + int inchannels = sys_inchannels; + int outchannels = sys_outchannels; + unsigned int intransfersize = DEFDACBLKSIZE; + unsigned int outtransfersize = DEFDACBLKSIZE; + + // get the status + if (!inchannels && !outchannels) + { + return SENDDACS_NO; + } + + timelast = timenow; + timenow = sys_getrealtime(); + +#ifdef DEBUG_ALSA_XFER + if (timenow - timelast > 0.050) + fprintf(stderr, "(%d)", + (int)(1000 * (timenow - timelast))), fflush(stderr); +#endif + + callno++; + + if (inchannels) + { + snd_pcm_status(alsa_device.inhandle, in_status); + if (snd_pcm_status_get_avail(in_status) < intransfersize) + return SENDDACS_NO; + } + if (outchannels) + { + snd_pcm_status(alsa_device.outhandle, out_status); + if (snd_pcm_status_get_avail(out_status) < outtransfersize) + return SENDDACS_NO; + } + + /* do output */ + if (outchannels) + { + fp = sys_soundout; + if (alsa_samplewidth == 4) + { + for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE) + { + for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; + j += outchannels, fp2++) + { + float s1 = *fp2 * INT32_MAX; + ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1); + } + } + } + else + { + for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE) + { + for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; + j += outchannels, fp2++) + { + int s = *fp2 * 32767.; + if (s > 32767) + s = 32767; + else if (s < -32767) + s = -32767; + ((t_alsa_sample16 *)alsa_buf)[j] = s; + } + } + } + + result = snd_pcm_writei(alsa_device.outhandle, alsa_buf, + outtransfersize); + if (result != (int)outtransfersize) + { + #ifdef DEBUG_ALSA_XFER + if (result >= 0 || errno == EAGAIN) + fprintf(stderr, "ALSA: write returned %d of %d\n", + result, outtransfersize); + else fprintf(stderr, "ALSA: write: %s\n", + snd_strerror(errno)); + fprintf(stderr, + "inputcount %d, outputcount %d, outbufsize %d\n", + inputcount, outputcount, + (ALSA_EXTRABUFFER + sys_advance_samples) + * alsa_samplewidth * outchannels); + #endif + sys_log_error(ERR_DACSLEPT); + return (SENDDACS_NO); + } + + /* zero out the output buffer */ + memset(sys_soundout, 0, DEFDACBLKSIZE * sizeof(*sys_soundout) * + sys_outchannels); + if (sys_getrealtime() - timenow > 0.002) + { + #ifdef DEBUG_ALSA_XFER + fprintf(stderr, "output %d took %d msec\n", + callno, (int)(1000 * (timenow - timelast))), fflush(stderr); + #endif + timenow = sys_getrealtime(); + sys_log_error(ERR_DACSLEPT); + } + } + /* do input */ + if (sys_inchannels) + { + result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, intransfersize); + if (result < (int)intransfersize) + { +#ifdef DEBUG_ALSA_XFER + if (result < 0) + fprintf(stderr, + "snd_pcm_read %d %d: %s\n", + callno, xferno, snd_strerror(errno)); + else fprintf(stderr, + "snd_pcm_read %d %d returned only %d\n", + callno, xferno, result); + fprintf(stderr, + "inputcount %d, outputcount %d, inbufsize %d\n", + inputcount, outputcount, + (ALSA_EXTRABUFFER + sys_advance_samples) + * alsa_samplewidth * inchannels); +#endif + sys_log_error(ERR_ADCSLEPT); + return (SENDDACS_NO); + } + fp = sys_soundin; + if (alsa_samplewidth == 4) + { + for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE) + { + for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; + j += inchannels, fp2++) + *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j] + * (1./ INT32_MAX); + } + } + else + { + for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE) + { + for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += inchannels, + fp2++) + *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j] + * 3.051850e-05; + } + } + } + xferno++; + if (sys_getrealtime() - timenow > 0.002) + { +#ifdef DEBUG_ALSA_XFER + fprintf(stderr, "routine took %d msec\n", + (int)(1000 * (sys_getrealtime() - timenow))); +#endif + sys_log_error(ERR_ADCSLEPT); + } + return SENDDACS_YES; +} + +void alsa_resync( void) +{ + int i, result; + if (sys_audioapi != API_ALSA) + { + error("restart-audio: implemented for ALSA only."); + return; + } + memset(alsa_buf, 0, + sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * sys_outchannels); + for (i = 0; i < 1000000; i++) + { + result = snd_pcm_writei(alsa_device.outhandle, alsa_buf, + DEFDACBLKSIZE); + if (result != (int)DEFDACBLKSIZE) + break; + } + post("%d written", i); +} + +void alsa_listdevs( void) +{ + post("device listing not implemented in ALSA yet\n"); +} + diff --git a/pd/src/s_audio_mmio.c b/pd/src/s_audio_mmio.c new file mode 100644 index 00000000..d0657be4 --- /dev/null +++ b/pd/src/s_audio_mmio.c @@ -0,0 +1,758 @@ +/* Copyright (c) 1997-1999 Miller Puckette. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* modified 2/98 by Winfried Ritsch to deal with up to 4 synchronized +"wave" devices, which is how ADAT boards appear to the WAVE API. */ + +#include "m_pd.h" +#include "s_stuff.h" +#include <stdio.h> + +#include <windows.h> + +#include <MMSYSTEM.H> + +/* ------------------------- audio -------------------------- */ + +static void nt_close_midiin(void); +static void nt_noresync( void); + +static void postflags(void); + +#define NAPORTS 16 /* wini hack for multiple ADDA devices */ +#define CHANNELS_PER_DEVICE 2 +#define DEFAULTCHANS 2 +#define DEFAULTSRATE 44100 +#define SAMPSIZE 2 + +#define REALDACBLKSIZE (4 * DEFDACBLKSIZE) /* larger underlying bufsize */ + +#define MAXBUFFER 100 /* number of buffers in use at maximum advance */ +#define DEFBUFFER 30 /* default is about 30x6 = 180 msec! */ +static int nt_naudiobuffer = DEFBUFFER; + +float sys_dacsr = DEFAULTSRATE; + +static int nt_whichapi = API_MMIO; +static int nt_meters; /* true if we're metering */ +static float nt_inmax; /* max input amplitude */ +static float nt_outmax; /* max output amplitude */ +static int nt_nwavein, nt_nwaveout; /* number of WAVE devices in and out */ + +typedef struct _sbuf +{ + HANDLE hData; + HPSTR lpData; // pointer to waveform data memory + HANDLE hWaveHdr; + WAVEHDR *lpWaveHdr; // pointer to header structure +} t_sbuf; + +t_sbuf ntsnd_outvec[NAPORTS][MAXBUFFER]; /* circular buffer array */ +HWAVEOUT ntsnd_outdev[NAPORTS]; /* output device */ +static int ntsnd_outphase[NAPORTS]; /* index of next buffer to send */ + +t_sbuf ntsnd_invec[NAPORTS][MAXBUFFER]; /* circular buffer array */ +HWAVEIN ntsnd_indev[NAPORTS]; /* input device */ +static int ntsnd_inphase[NAPORTS]; /* index of next buffer to read */ + +static void nt_waveinerror(char *s, int err) +{ + char t[256]; + waveInGetErrorText(err, t, 256); + fprintf(stderr, s, t); +} + +static void nt_waveouterror(char *s, int err) +{ + char t[256]; + waveOutGetErrorText(err, t, 256); + fprintf(stderr, s, t); +} + +static void wave_prep(t_sbuf *bp) +{ + WAVEHDR *wh; + short *sp; + int i; + /* + * Allocate and lock memory for the waveform data. The memory + * for waveform data must be globally allocated with + * GMEM_MOVEABLE and GMEM_SHARE flags. + */ + + if (!(bp->hData = + GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, + (DWORD) (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE)))) + printf("alloc 1 failed\n"); + + if (!(bp->lpData = + (HPSTR) GlobalLock(bp->hData))) + printf("lock 1 failed\n"); + + /* Allocate and lock memory for the header. */ + + if (!(bp->hWaveHdr = + GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (DWORD) sizeof(WAVEHDR)))) + printf("alloc 2 failed\n"); + + if (!(wh = bp->lpWaveHdr = + (WAVEHDR *) GlobalLock(bp->hWaveHdr))) + printf("lock 2 failed\n"); + + for (i = CHANNELS_PER_DEVICE * REALDACBLKSIZE, + sp = (short *)bp->lpData; i--; ) + *sp++ = 0; + + wh->lpData = bp->lpData; + wh->dwBufferLength = (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE); + wh->dwFlags = 0; + wh->dwLoops = 0L; + wh->lpNext = 0; + wh->reserved = 0; +} + +static int nt_inalloc[NAPORTS], nt_outalloc[NAPORTS]; +static UINT nt_whichdac = WAVE_MAPPER, nt_whichadc = WAVE_MAPPER; + +int mmio_do_open_audio(void) +{ + PCMWAVEFORMAT form; + int i; + UINT mmresult; + int nad, nda; + + if (sys_verbose) + post("%d devices in, %d devices out", + nt_nwavein, nt_nwaveout); + + form.wf.wFormatTag = WAVE_FORMAT_PCM; + form.wf.nChannels = CHANNELS_PER_DEVICE; + form.wf.nSamplesPerSec = sys_dacsr; + form.wf.nAvgBytesPerSec = sys_dacsr * (CHANNELS_PER_DEVICE * SAMPSIZE); + form.wf.nBlockAlign = CHANNELS_PER_DEVICE * SAMPSIZE; + form.wBitsPerSample = 8 * SAMPSIZE; + + if (nt_nwavein <= 1 && nt_nwaveout <= 1) + nt_noresync(); + for (nad=0; nad < nt_nwavein; nad++) + { + /* Open waveform device(s), sucessively numbered, for input */ + + mmresult = waveInOpen(&ntsnd_indev[nad], nt_whichadc+nad, + (WAVEFORMATEX *)(&form), 0L, 0L, CALLBACK_NULL); + + if (sys_verbose) + printf("opened adc device %d with return %d\n", + nt_whichadc+nad,mmresult); + + if (mmresult != MMSYSERR_NOERROR) + { + nt_waveinerror("waveInOpen: %s\n", mmresult); + nt_nwavein = nad; /* nt_nwavein = 0 wini */ + } + else + { + if (!nt_inalloc[nad]) + { + for (i = 0; i < nt_naudiobuffer; i++) + wave_prep(&ntsnd_invec[nad][i]); + nt_inalloc[nad] = 1; + } + for (i = 0; i < nt_naudiobuffer; i++) + { + mmresult = waveInPrepareHeader(ntsnd_indev[nad], + ntsnd_invec[nad][i].lpWaveHdr, sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveinerror("waveinprepareheader: %s\n", mmresult); + mmresult = waveInAddBuffer(ntsnd_indev[nad], + ntsnd_invec[nad][i].lpWaveHdr, sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveinerror("waveInAddBuffer: %s\n", mmresult); + } + } + } + /* quickly start them all together */ + for(nad=0; nad < nt_nwavein; nad++) + waveInStart(ntsnd_indev[nad]); + + for(nda=0; nda < nt_nwaveout; nda++) + { + + /* Open a waveform device for output in sucessiv device numbering*/ + mmresult = waveOutOpen(&ntsnd_outdev[nda], nt_whichdac + nda, + (WAVEFORMATEX *)(&form), 0L, 0L, CALLBACK_NULL); + + if (sys_verbose) + fprintf(stderr,"opened dac device %d, with return %d\n", + nt_whichdac +nda, mmresult); + + if (mmresult != MMSYSERR_NOERROR) + { + fprintf(stderr,"Wave out open device %d + %d\n",nt_whichdac,nda); + nt_waveouterror("waveOutOpen device: %s\n", mmresult); + nt_nwaveout = nda; + } + else + { + if (!(nt_outalloc[nda])) + { + for (i = 0; i < nt_naudiobuffer; i++) + { + wave_prep(&ntsnd_outvec[nda][i]); + /* set DONE flag as if we had queued them */ + ntsnd_outvec[nda][i].lpWaveHdr->dwFlags = WHDR_DONE; + } + nt_outalloc[nda] = 1; + } + } + } + + return (0); +} + +void mmio_close_audio( void) +{ + int errcode; + int nda, nad; + if (sys_verbose) + post("closing audio..."); + + for (nda=0; nda < nt_nwaveout; nda++) /*if (nt_nwaveout) wini */ + { + errcode = waveOutReset(ntsnd_outdev[nda]); + if (errcode != MMSYSERR_NOERROR) + printf("error resetting output %d: %d\n", nda, errcode); + errcode = waveOutClose(ntsnd_outdev[nda]); + if (errcode != MMSYSERR_NOERROR) + printf("error closing output %d: %d\n",nda , errcode); + } + nt_nwaveout = 0; + + for(nad=0; nad < nt_nwavein;nad++) /* if (nt_nwavein) wini */ + { + errcode = waveInReset(ntsnd_indev[nad]); + if (errcode != MMSYSERR_NOERROR) + printf("error resetting input: %d\n", errcode); + errcode = waveInClose(ntsnd_indev[nad]); + if (errcode != MMSYSERR_NOERROR) + printf("error closing input: %d\n", errcode); + } + nt_nwavein = 0; +} + + +#define ADCJITTER 10 /* We tolerate X buffers of jitter by default */ +#define DACJITTER 10 + +static int nt_adcjitterbufsallowed = ADCJITTER; +static int nt_dacjitterbufsallowed = DACJITTER; + + /* ------------- MIDI time stamping from audio clock ------------ */ + +#ifdef MIDI_TIMESTAMP + +static double nt_hibuftime; +static double initsystime = -1; + + /* call this whenever we reset audio */ +static void nt_resetmidisync(void) +{ + initsystime = clock_getsystime(); + nt_hibuftime = sys_getrealtime(); +} + + /* call this whenever we're idled waiting for audio to be ready. + The routine maintains a high and low water point for the difference + between real and DAC time. */ + +static void nt_midisync(void) +{ + double jittersec, diff; + + if (initsystime == -1) nt_resetmidisync(); + jittersec = (nt_dacjitterbufsallowed > nt_adcjitterbufsallowed ? + nt_dacjitterbufsallowed : nt_adcjitterbufsallowed) + * REALDACBLKSIZE / sys_getsr(); + diff = sys_getrealtime() - 0.001 * clock_gettimesince(initsystime); + if (diff > nt_hibuftime) nt_hibuftime = diff; + if (diff < nt_hibuftime - jittersec) + { + post("jitter excess %d %f", dac, diff); + nt_resetmidisync(); + } +} + +static double nt_midigettimefor(LARGE_INTEGER timestamp) +{ + /* this is broken now... used to work when "timestamp" was derived from + QueryPerformanceCounter() instead of the gates approved + timeGetSystemTime() call in the MIDI callback routine below. */ + return (nt_tixtotime(timestamp) - nt_hibuftime); +} +#endif /* MIDI_TIMESTAMP */ + + +static int nt_fill = 0; +#define WRAPFWD(x) ((x) >= nt_naudiobuffer ? (x) - nt_naudiobuffer: (x)) +#define WRAPBACK(x) ((x) < 0 ? (x) + nt_naudiobuffer: (x)) +#define MAXRESYNC 500 + +#if 0 /* this is used for debugging */ +static void nt_printaudiostatus(void) +{ + int nad, nda; + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0; + int firstphasedone = -1, firstphasebusy = -1; + for (count = 0; count < nt_naudiobuffer; count++) + { + int donethis = + (ntsnd_invec[nad][phase2].lpWaveHdr->dwFlags & WHDR_DONE); + int donenext = + (ntsnd_invec[nad][phase3].lpWaveHdr->dwFlags & WHDR_DONE); + if (donethis && !donenext) + { + if (firstphasebusy >= 0) goto multipleadc; + firstphasebusy = count; + } + if (!donethis && donenext) + { + if (firstphasedone >= 0) goto multipleadc; + firstphasedone = count; + } + phase2 = phase3; + phase3 = WRAPFWD(phase2 + 1); + } + post("nad %d phase %d busy %d done %d", nad, phase, firstphasebusy, + firstphasedone); + continue; + multipleadc: + startpost("nad %d phase %d: oops:", nad, phase); + for (count = 0; count < nt_naudiobuffer; count++) + { + char buf[80]; + sprintf(buf, " %d", + (ntsnd_invec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE)); + poststring(buf); + } + endpost(); + } + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nad]; + int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0; + int firstphasedone = -1, firstphasebusy = -1; + for (count = 0; count < nt_naudiobuffer; count++) + { + int donethis = + (ntsnd_outvec[nda][phase2].lpWaveHdr->dwFlags & WHDR_DONE); + int donenext = + (ntsnd_outvec[nda][phase3].lpWaveHdr->dwFlags & WHDR_DONE); + if (donethis && !donenext) + { + if (firstphasebusy >= 0) goto multipledac; + firstphasebusy = count; + } + if (!donethis && donenext) + { + if (firstphasedone >= 0) goto multipledac; + firstphasedone = count; + } + phase2 = phase3; + phase3 = WRAPFWD(phase2 + 1); + } + if (firstphasebusy < 0) post("nda %d phase %d all %d", + nda, phase, (ntsnd_outvec[nad][0].lpWaveHdr->dwFlags & WHDR_DONE)); + else post("nda %d phase %d busy %d done %d", nda, phase, firstphasebusy, + firstphasedone); + continue; + multipledac: + startpost("nda %d phase %d: oops:", nda, phase); + for (count = 0; count < nt_naudiobuffer; count++) + { + char buf[80]; + sprintf(buf, " %d", + (ntsnd_outvec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE)); + poststring(buf); + } + endpost(); + } +} +#endif /* 0 */ + +/* this is a hack to avoid ever resyncing audio pointers in case for whatever +reason the sync testing below gives false positives. */ + +static int nt_resync_cancelled; + +static void nt_noresync( void) +{ + nt_resync_cancelled = 1; +} + +static void nt_resyncaudio(void) +{ + UINT mmresult; + int nad, nda, count; + if (nt_resync_cancelled) + return; + /* for each open input device, eat all buffers which are marked + ready. The next one will thus be "busy". */ + post("resyncing audio"); + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + for (count = 0; count < MAXRESYNC; count++) + { + WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr; + if (!(inwavehdr->dwFlags & WHDR_DONE)) break; + if (inwavehdr->dwFlags & WHDR_PREPARED) + waveInUnprepareHeader(ntsnd_indev[nad], + inwavehdr, sizeof(WAVEHDR)); + inwavehdr->dwFlags = 0L; + waveInPrepareHeader(ntsnd_indev[nad], inwavehdr, sizeof(WAVEHDR)); + mmresult = waveInAddBuffer(ntsnd_indev[nad], inwavehdr, + sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveinerror("waveInAddBuffer: %s\n", mmresult); + ntsnd_inphase[nad] = phase = WRAPFWD(phase + 1); + } + if (count == MAXRESYNC) post("resync error 1"); + } + /* Each output buffer which is "ready" is filled with zeros and + queued. */ + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + for (count = 0; count < MAXRESYNC; count++) + { + WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr; + if (!(outwavehdr->dwFlags & WHDR_DONE)) break; + if (outwavehdr->dwFlags & WHDR_PREPARED) + waveOutUnprepareHeader(ntsnd_outdev[nda], + outwavehdr, sizeof(WAVEHDR)); + outwavehdr->dwFlags = 0L; + memset((char *)(ntsnd_outvec[nda][phase].lpData), + 0, (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE)); + waveOutPrepareHeader(ntsnd_outdev[nda], outwavehdr, + sizeof(WAVEHDR)); + mmresult = waveOutWrite(ntsnd_outdev[nda], outwavehdr, + sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveouterror("waveOutAddBuffer: %s\n", mmresult); + ntsnd_outphase[nda] = phase = WRAPFWD(phase + 1); + } + if (count == MAXRESYNC) post("resync error 2"); + } + +#ifdef MIDI_TIMESTAMP + nt_resetmidisync(); +#endif + +} + +#define LATE 0 +#define RESYNC 1 +#define NOTHING 2 +static int nt_errorcount; +static int nt_resynccount; +static double nt_nextreporttime = -1; + +void nt_logerror(int which) +{ +#if 0 + post("error %d %d", count, which); + if (which < NOTHING) nt_errorcount++; + if (which == RESYNC) nt_resynccount++; + if (sys_getrealtime() > nt_nextreporttime) + { + post("%d audio I/O error%s", nt_errorcount, + (nt_errorcount > 1 ? "s" : "")); + if (nt_resynccount) post("DAC/ADC sync error"); + nt_errorcount = nt_resynccount = 0; + nt_nextreporttime = sys_getrealtime() - 5; + } +#endif +} + +/* system buffer with t_sample types for one tick */ +t_sample *sys_soundout; +t_sample *sys_soundin; +float sys_dacsr; + +int mmio_send_dacs(void) +{ + HMMIO hmmio; + UINT mmresult; + HANDLE hFormat; + int i, j; + short *sp1, *sp2; + float *fp1, *fp2; + int nextfill, doxfer = 0; + int nda, nad; + if (!nt_nwavein && !nt_nwaveout) return (0); + + + if (nt_meters) + { + int i, n; + float maxsamp; + for (i = 0, n = 2 * nt_nwavein * DEFDACBLKSIZE, maxsamp = nt_inmax; + i < n; i++) + { + float f = sys_soundin[i]; + if (f > maxsamp) maxsamp = f; + else if (-f > maxsamp) maxsamp = -f; + } + nt_inmax = maxsamp; + for (i = 0, n = 2 * nt_nwaveout * DEFDACBLKSIZE, maxsamp = nt_outmax; + i < n; i++) + { + float f = sys_soundout[i]; + if (f > maxsamp) maxsamp = f; + else if (-f > maxsamp) maxsamp = -f; + } + nt_outmax = maxsamp; + } + + /* the "fill pointer" nt_fill controls where in the next + I/O buffers we will write and/or read. If it's zero, we + first check whether the buffers are marked "done". */ + + if (!nt_fill) + { + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr; + if (!(inwavehdr->dwFlags & WHDR_DONE)) goto idle; + } + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + WAVEHDR *outwavehdr = + ntsnd_outvec[nda][phase].lpWaveHdr; + if (!(outwavehdr->dwFlags & WHDR_DONE)) goto idle; + } + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + WAVEHDR *inwavehdr = + ntsnd_invec[nad][phase].lpWaveHdr; + if (inwavehdr->dwFlags & WHDR_PREPARED) + waveInUnprepareHeader(ntsnd_indev[nad], + inwavehdr, sizeof(WAVEHDR)); + } + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr; + if (outwavehdr->dwFlags & WHDR_PREPARED) + waveOutUnprepareHeader(ntsnd_outdev[nda], + outwavehdr, sizeof(WAVEHDR)); + } + } + + /* Convert audio output to fixed-point and put it in the output + buffer. */ + for (nda = 0, fp1 = sys_soundout; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + + for (i = 0, sp1 = (short *)(ntsnd_outvec[nda][phase].lpData) + + CHANNELS_PER_DEVICE * nt_fill; + i < 2; i++, fp1 += DEFDACBLKSIZE, sp1++) + { + for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE; + j++, fp2++, sp2 += CHANNELS_PER_DEVICE) + { + int x1 = 32767.f * *fp2; + if (x1 > 32767) x1 = 32767; + else if (x1 < -32767) x1 = -32767; + *sp2 = x1; + } + } + } + memset(sys_soundout, 0, + (DEFDACBLKSIZE *sizeof(t_sample)*CHANNELS_PER_DEVICE)*nt_nwaveout); + + /* vice versa for the input buffer */ + + for (nad = 0, fp1 = sys_soundin; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + + for (i = 0, sp1 = (short *)(ntsnd_invec[nad][phase].lpData) + + CHANNELS_PER_DEVICE * nt_fill; + i < 2; i++, fp1 += DEFDACBLKSIZE, sp1++) + { + for (j = 0, fp2 = fp1, sp2 = sp1; j < DEFDACBLKSIZE; + j++, fp2++, sp2 += CHANNELS_PER_DEVICE) + { + *fp2 = ((float)(1./32767.)) * (float)(*sp2); + } + } + } + + nt_fill = nt_fill + DEFDACBLKSIZE; + if (nt_fill == REALDACBLKSIZE) + { + nt_fill = 0; + + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + HWAVEIN device = ntsnd_indev[nad]; + WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr; + waveInPrepareHeader(device, inwavehdr, sizeof(WAVEHDR)); + mmresult = waveInAddBuffer(device, inwavehdr, sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveinerror("waveInAddBuffer: %s\n", mmresult); + ntsnd_inphase[nad] = WRAPFWD(phase + 1); + } + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + HWAVEOUT device = ntsnd_outdev[nda]; + WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr; + waveOutPrepareHeader(device, outwavehdr, sizeof(WAVEHDR)); + mmresult = waveOutWrite(device, outwavehdr, sizeof(WAVEHDR)); + if (mmresult != MMSYSERR_NOERROR) + nt_waveouterror("waveOutWrite: %s\n", mmresult); + ntsnd_outphase[nda] = WRAPFWD(phase + 1); + } + + /* check for DAC underflow or ADC overflow. */ + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = WRAPBACK(ntsnd_inphase[nad] - 2); + WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr; + if (inwavehdr->dwFlags & WHDR_DONE) goto late; + } + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = WRAPBACK(ntsnd_outphase[nda] - 2); + WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr; + if (outwavehdr->dwFlags & WHDR_DONE) goto late; + } + } + return (1); + +late: + + nt_logerror(LATE); + nt_resyncaudio(); + return (1); + +idle: + + /* If more than nt_adcjitterbufsallowed ADC buffers are ready + on any input device, resynchronize */ + + for (nad = 0; nad < nt_nwavein; nad++) + { + int phase = ntsnd_inphase[nad]; + WAVEHDR *inwavehdr = + ntsnd_invec[nad] + [WRAPFWD(phase + nt_adcjitterbufsallowed)].lpWaveHdr; + if (inwavehdr->dwFlags & WHDR_DONE) + { + nt_resyncaudio(); + return (0); + } + } + + /* test dac sync the same way */ + for (nda = 0; nda < nt_nwaveout; nda++) + { + int phase = ntsnd_outphase[nda]; + WAVEHDR *outwavehdr = + ntsnd_outvec[nda] + [WRAPFWD(phase + nt_dacjitterbufsallowed)].lpWaveHdr; + if (outwavehdr->dwFlags & WHDR_DONE) + { + nt_resyncaudio(); + return (0); + } + } +#ifdef MIDI_TIMESTAMP + nt_midisync(); +#endif + return (0); +} + +/* ------------------- public routines -------------------------- */ + +void mmio_open_audio(int naudioindev, int *audioindev, + int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, + int nchoutdev, int *choutdev, int rate) /* IOhannes */ +{ + int nbuf; + + nbuf = sys_advance_samples/REALDACBLKSIZE; + if (nbuf >= MAXBUFFER) + { + fprintf(stderr, "pd: audio buffering maxed out to %d\n", + (int)(MAXBUFFER * ((REALDACBLKSIZE * 1000.)/44100.))); + nbuf = MAXBUFFER; + } + else if (nbuf < 4) nbuf = 4; + fprintf(stderr, "%d audio buffers\n", nbuf); + nt_naudiobuffer = nbuf; + if (nt_adcjitterbufsallowed > nbuf - 2) + nt_adcjitterbufsallowed = nbuf - 2; + if (nt_dacjitterbufsallowed > nbuf - 2) + nt_dacjitterbufsallowed = nbuf - 2; + + nt_nwavein = sys_inchannels / 2; + nt_nwaveout = sys_outchannels / 2; + nt_whichadc = (naudioindev < 1 ? + (nt_nwavein > 1 ? WAVE_MAPPER : -1) : + (audioindev[0] == DEFAULTAUDIODEV ? WAVE_MAPPER : + audioindev[0] - 1)); + nt_whichdac = (naudiooutdev < 1 ? + (nt_nwaveout > 1 ? WAVE_MAPPER : -1) : + (audiooutdev[0] == DEFAULTAUDIODEV ? WAVE_MAPPER : + audiooutdev[0] - 1)); + if (naudiooutdev > 1 || naudioindev > 1) + post("separate audio device choice not supported; using sequential devices."); + mmio_do_open_audio(); +} + + +void mmio_reportidle(void) +{ +} + + +/* list the audio and MIDI device names */ +void mmio_listdevs(void) +{ + UINT wRtn, ndevices; + unsigned int i; + + ndevices = waveInGetNumDevs(); + for (i = 0; i < ndevices; i++) + { + WAVEINCAPS wicap; + wRtn = waveInGetDevCaps(i, (LPWAVEINCAPS) &wicap, + sizeof(wicap)); + if (wRtn) nt_waveinerror("waveInGetDevCaps: %s\n", wRtn); + else fprintf(stderr, + "audio input device #%d: %s\n", i+1, wicap.szPname); + } + + ndevices = waveOutGetNumDevs(); + for (i = 0; i < ndevices; i++) + { + WAVEOUTCAPS wocap; + wRtn = waveOutGetDevCaps(i, (LPWAVEOUTCAPS) &wocap, + sizeof(wocap)); + if (wRtn) nt_waveouterror("waveOutGetDevCaps: %s\n", wRtn); + else fprintf(stderr, + "audio output device #%d: %s\n", i+1, wocap.szPname); + } +} diff --git a/pd/src/s_audio_oss.c b/pd/src/s_audio_oss.c new file mode 100644 index 00000000..382e6a75 --- /dev/null +++ b/pd/src/s_audio_oss.c @@ -0,0 +1,772 @@ +/* Copyright (c) 1997-2003 Guenter Geiger, Miller Puckette, Larry Troxler, +* Winfried Ritsch, Karl MacMillan, and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* this file inputs and outputs audio using the OSS API available on linux. */ + +#include <linux/soundcard.h> + +#include "m_pd.h" +#include "s_stuff.h" +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <sched.h> +#include <sys/mman.h> + + +/* Defines */ +#define DEBUG(x) x +#define DEBUG2(x) {x;} + +#define OSS_MAXCHPERDEV 32 /* max channels per OSS device */ +#define OSS_MAXDEV 4 /* maximum number of input or output devices */ +#define OSS_DEFFRAGSIZE 256 /* default log fragment size (frames) */ +#define OSS_DEFAUDIOBUF 40000 /* default audiobuffer, microseconds */ +#define OSS_DEFAULTCH 2 +#define RME_DEFAULTCH 8 /* need this even if RME undefined */ +typedef int16_t t_oss_int16; +typedef int32_t t_oss_int32; +#define OSS_MAXSAMPLEWIDTH sizeof(t_oss_int32) +#define OSS_BYTESPERCHAN(width) (DEFDACBLKSIZE * (width)) +#define OSS_XFERSAMPS(chans) (DEFDACBLKSIZE* (chans)) +#define OSS_XFERSIZE(chans, width) (DEFDACBLKSIZE * (chans) * (width)) + +/* GLOBALS */ +static int linux_meters; /* true if we're metering */ +static float linux_inmax; /* max input amplitude */ +static float linux_outmax; /* max output amplitude */ +static int linux_fragsize = 0; /* for block mode; block size (sample frames) */ + +/* our device handles */ + +typedef struct _oss_dev +{ + int d_fd; + unsigned int d_space; /* bytes available for writing/reading */ + int d_bufsize; /* total buffer size in blocks for this device */ + int d_dropcount; /* # of buffers to drop for resync (output only) */ + unsigned int d_nchannels; /* number of channels for this device */ + unsigned int d_bytespersamp; /* bytes per sample (2 for 16 bit, 4 for 32) */ +} t_oss_dev; + +static t_oss_dev linux_dacs[OSS_MAXDEV]; +static t_oss_dev linux_adcs[OSS_MAXDEV]; +static int linux_noutdevs = 0; +static int linux_nindevs = 0; + + /* exported variables */ +float sys_dacsr; +t_sample *sys_soundout; +t_sample *sys_soundin; + + /* OSS-specific private variables */ +static int oss_blockmode = 1; /* flag to use "blockmode" */ +static int oss_32bit = 0; /* allow 23 bit transfers in OSS */ +static char ossdsp[] = "/dev/dsp%d"; + + /* don't assume we can turn all 31 bits when doing float-to-fix; + otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */ +#define FMAX 0x7ffff000 +#define CLIP32(x) (((x)>FMAX)?FMAX:((x) < -FMAX)?-FMAX:(x)) + + +/* ------------- private routines for all APIS ------------------- */ + +static void linux_flush_all_underflows_to_zero(void) +{ +/* + TODO: Implement similar thing for linux (GGeiger) + + One day we will figure this out, I hope, because it + costs CPU time dearly on Intel - LT + */ + /* union fpc_csr f; + f.fc_word = get_fpc_csr(); + f.fc_struct.flush = 1; + set_fpc_csr(f.fc_word); + */ +} + + +void oss_set32bit( void) +{ + oss_32bit = 1; +} + + +typedef struct _multidev { + int fd; + int channels; + int format; +} t_multidev; + +int oss_reset(int fd) { + int err; + if ((err = ioctl(fd,SNDCTL_DSP_RESET)) < 0) + error("OSS: Could not reset"); + return err; +} + + /* The AFMT_S32_BLOCKED format is not defined in standard linux kernels + but is proposed by Guenter Geiger to support extending OSS to handle + 32 bit sample. This is user in Geiger's OSS driver for RME Hammerfall. + I'm not clear why this isn't called AFMT_S32_[SLN]E... */ + +#ifndef AFMT_S32_BLOCKED +#define AFMT_S32_BLOCKED 0x0000400 +#endif + +void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize) +{ /* IOhannes */ + int orig, param, nblk, fd = dev->d_fd, wantformat; + int nchannels = dev->d_nchannels; + int advwas = sys_schedadvance; + + audio_buf_info ainfo; + + /* IOhannes : + * pd is very likely to crash if different formats are used on + multiple soundcards + */ + + /* set resolution - first try 4 byte samples */ + if (oss_32bit && (ioctl(fd,SNDCTL_DSP_GETFMTS,¶m) >= 0) && + (param & AFMT_S32_BLOCKED)) + { + wantformat = AFMT_S32_BLOCKED; + dev->d_bytespersamp = 4; + } + else + { + wantformat = AFMT_S16_NE; + dev->d_bytespersamp = 2; + } + param = wantformat; + + if (sys_verbose) + post("bytes per sample = %d", dev->d_bytespersamp); + if (ioctl(fd, SNDCTL_DSP_SETFMT, ¶m) == -1) + fprintf(stderr,"OSS: Could not set DSP format\n"); + else if (wantformat != param) + fprintf(stderr,"OSS: DSP format: wanted %d, got %d\n", + wantformat, param); + + /* sample rate */ + orig = param = srate; + if (ioctl(fd, SNDCTL_DSP_SPEED, ¶m) == -1) + fprintf(stderr,"OSS: Could not set sampling rate for device\n"); + else if( orig != param ) + fprintf(stderr,"OSS: sampling rate: wanted %d, got %d\n", + orig, param ); + + if (oss_blockmode && !skipblocksize) + { + int fragbytes, logfragsize, nfragment; + /* setting fragment count and size. */ + if (!linux_fragsize) + { + linux_fragsize = OSS_DEFFRAGSIZE; + while (linux_fragsize > DEFDACBLKSIZE + && linux_fragsize * 4 > sys_advance_samples) + linux_fragsize = linux_fragsize/2; + } + /* post("adv_samples %d", sys_advance_samples); */ + nfragment = (sys_schedadvance * (44100. * 1.e-6)) / linux_fragsize; + + fragbytes = linux_fragsize * (dev->d_bytespersamp * nchannels); + logfragsize = ilog2(fragbytes); + + if (fragbytes != (1 << logfragsize)) + post("warning: OSS takes only power of 2 blocksize; using %d", + (1 << logfragsize)/(dev->d_bytespersamp * nchannels)); + if (sys_verbose) + post("setting nfrags = %d, fragsize %d\n", nfragment, fragbytes); + + param = orig = (nfragment<<16) + logfragsize; + if (ioctl(fd,SNDCTL_DSP_SETFRAGMENT, ¶m) == -1) + error("OSS: Could not set or read fragment size\n"); + if (param != orig) + { + nfragment = ((param >> 16) & 0xffff); + logfragsize = (param & 0xffff); + post("warning: actual fragments %d, blocksize %d", + nfragment, (1 << logfragsize)); + } + if (sys_verbose) + post("audiobuffer set to %d msec", (int)(0.001 * sys_schedadvance)); + } + + if (dac) + { + /* use "free space" to learn the buffer size. Normally you + should set this to your own desired value; but this seems not + to be implemented uniformly across different sound cards. LATER + we should figure out what to do if the requested scheduler advance + is greater than this buffer size; for now, we just print something + out. */ + + int defect; + if (ioctl(fd, SOUND_PCM_GETOSPACE,&ainfo) < 0) + fprintf(stderr,"OSS: ioctl on output device failed"); + dev->d_bufsize = ainfo.bytes; + + defect = sys_advance_samples * (dev->d_bytespersamp * nchannels) + - dev->d_bufsize - OSS_XFERSIZE(nchannels, dev->d_bytespersamp); + if (defect > 0) + { + if (sys_verbose || defect > (dev->d_bufsize >> 2)) + fprintf(stderr, + "OSS: requested audio buffer size %d limited to %d\n", + sys_advance_samples * (dev->d_bytespersamp * nchannels), + dev->d_bufsize); + sys_advance_samples = + (dev->d_bufsize - OSS_XFERSAMPS(nchannels)) / + (dev->d_bytespersamp *nchannels); + } + } +} + +static int oss_setchannels(int fd, int wantchannels, char *devname) +{ /* IOhannes */ + int param = wantchannels; + + while (param>1) { + int save = param; + if (ioctl(fd, SNDCTL_DSP_CHANNELS, ¶m) == -1) { + error("OSS: SNDCTL_DSP_CHANNELS failed %s",devname); + } else { + if (param == save) return (param); + } + param=save-1; + } + + return (0); +} + +#define O_AUDIOFLAG 0 /* O_NDELAY */ + +int oss_open_audio(int nindev, int *indev, int nchin, int *chin, + int noutdev, int *outdev, int nchout, int *chout, int rate) +{ /* IOhannes */ + int capabilities = 0; + int inchannels = 0, outchannels = 0; + char devname[20]; + int n, i, fd; + char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; + int num_devs = 0; + int wantmore=0; + int spread = 0; + audio_buf_info ainfo; + + linux_nindevs = linux_noutdevs = 0; + + + /* mark input devices unopened */ + for (i = 0; i < OSS_MAXDEV; i++) + linux_adcs[i].d_fd = -1; + + /* open output devices */ + wantmore=0; + if (noutdev < 0 || nindev < 0) + bug("linux_open_audio"); + + for (n = 0; n < noutdev; n++) + { + int gotchans, j, inindex = -1; + int thisdevice = (outdev[n] >= 0 ? outdev[n] : n-1); + int wantchannels = (nchout>n) ? chout[n] : wantmore; + fd = -1; + if (!wantchannels) + goto end_out_loop; + + if (thisdevice > 1) + sprintf(devname, "/dev/dsp%d", thisdevice-1); + else sprintf(devname, "/dev/dsp"); + + /* search for input request for same device. Succeed only + if the number of channels matches. */ + for (j = 0; j < nindev; j++) + if (indev[j] == thisdevice && chin[j] == wantchannels) + inindex = j; + + /* if the same device is requested for input and output, + try to open it read/write */ + if (inindex >= 0) + { + sys_setalarm(1000000); + if ((fd = open(devname, O_RDWR | O_AUDIOFLAG)) == -1) + { + post("%s (read/write): %s", devname, strerror(errno)); + post("(now will try write-only...)"); + } + else + { + if (sys_verbose) + post("opened %s for reading and writing\n", devname); + linux_adcs[inindex].d_fd = fd; + } + } + /* if that didn't happen or if it failed, try write-only */ + if (fd == -1) + { + sys_setalarm(1000000); + if ((fd = open(devname, O_WRONLY | O_AUDIOFLAG)) == -1) + { + post("%s (writeonly): %s", + devname, strerror(errno)); + break; + } + if (sys_verbose) + post("opened %s for writing only\n", devname); + } + if (ioctl(fd, SNDCTL_DSP_GETCAPS, &capabilities) == -1) + error("OSS: SNDCTL_DSP_GETCAPS failed %s", devname); + + gotchans = oss_setchannels(fd, + (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels, + devname); + + if (sys_verbose) + post("opened audio output on %s; got %d channels", + devname, gotchans); + + if (gotchans < 2) + { + /* can't even do stereo? just give up. */ + close(fd); + } + else + { + linux_dacs[linux_noutdevs].d_nchannels = gotchans; + linux_dacs[linux_noutdevs].d_fd = fd; + oss_configure(linux_dacs+linux_noutdevs, rate, 1, 0); + + linux_noutdevs++; + outchannels += gotchans; + if (inindex >= 0) + { + linux_adcs[inindex].d_nchannels = gotchans; + chin[inindex] = gotchans; + } + } + /* LATER think about spreading large numbers of channels over + various dsp's and vice-versa */ + wantmore = wantchannels - gotchans; + end_out_loop: ; + } + + /* open input devices */ + wantmore = 0; + for (n = 0; n < nindev; n++) + { + int gotchans=0; + int thisdevice = (indev[n] >= 0 ? indev[n] : n-1); + int wantchannels = (nchin>n)?chin[n]:wantmore; + int alreadyopened = 0; + if (!wantchannels) + goto end_in_loop; + + if (thisdevice > 1) + sprintf(devname, "/dev/dsp%d", thisdevice - 1); + else sprintf(devname, "/dev/dsp"); + + sys_setalarm(1000000); + + /* perhaps it's already open from the above? */ + if (linux_dacs[n].d_fd >= 0) + { + fd = linux_dacs[n].d_fd; + alreadyopened = 1; + } + else + { + /* otherwise try to open it here. */ + if ((fd = open(devname, O_RDONLY | O_AUDIOFLAG)) == -1) + { + post("%s (readonly): %s", devname, strerror(errno)); + goto end_in_loop; + } + if (sys_verbose) + post("opened %s for reading only\n", devname); + } + linux_adcs[linux_nindevs].d_fd = fd; + gotchans = oss_setchannels(fd, + (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels, + devname); + if (sys_verbose) + post("opened audio input device %s; got %d channels", + devname, gotchans); + + if (gotchans < 1) + { + close(fd); + goto end_in_loop; + } + + linux_adcs[linux_nindevs].d_nchannels = gotchans; + + oss_configure(linux_adcs+linux_nindevs, rate, 0, alreadyopened); + + inchannels += gotchans; + linux_nindevs++; + + wantmore = wantchannels-gotchans; + /* LATER think about spreading large numbers of channels over + various dsp's and vice-versa */ + end_in_loop: ; + } + + /* We have to do a read to start the engine. This is + necessary because sys_send_dacs waits until the input + buffer is filled and only reads on a filled buffer. + This is good, because it's a way to make sure that we + will not block. But I wonder why we only have to read + from one of the devices and not all of them??? */ + + if (linux_nindevs) + { + if (sys_verbose) + fprintf(stderr,("OSS: issuing first ADC 'read' ... ")); + read(linux_adcs[0].d_fd, buf, + linux_adcs[0].d_bytespersamp * + linux_adcs[0].d_nchannels * DEFDACBLKSIZE); + if (sys_verbose) + fprintf(stderr, "...done.\n"); + } + sys_setalarm(0); + return (0); +} + +void oss_close_audio( void) +{ + int i; + for (i=0;i<linux_nindevs;i++) + close(linux_adcs[i].d_fd); + + for (i=0;i<linux_noutdevs;i++) + close(linux_dacs[i].d_fd); + + linux_nindevs = linux_noutdevs = 0; +} + +static int linux_dacs_write(int fd,void* buf,long bytes) +{ + return write(fd, buf, bytes); +} + +static int linux_adcs_read(int fd,void* buf,long bytes) +{ + return read(fd, buf, bytes); +} + + /* query audio devices for "available" data size. */ +static void oss_calcspace(void) +{ + int dev; + audio_buf_info ainfo; + for (dev=0; dev < linux_noutdevs; dev++) + { + if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0) + fprintf(stderr,"OSS: ioctl on output device %d failed",dev); + linux_dacs[dev].d_space = ainfo.bytes; + } + + for (dev = 0; dev < linux_nindevs; dev++) + { + if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0) + fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", + dev, linux_adcs[dev].d_fd); + linux_adcs[dev].d_space = ainfo.bytes; + } +} + +void linux_audiostatus(void) +{ + int dev; + if (!oss_blockmode) + { + oss_calcspace(); + for (dev=0; dev < linux_noutdevs; dev++) + fprintf(stderr, "dac %d space %d\n", dev, linux_dacs[dev].d_space); + + for (dev = 0; dev < linux_nindevs; dev++) + fprintf(stderr, "adc %d space %d\n", dev, linux_adcs[dev].d_space); + + } +} + +/* this call resyncs audio output and input which will cause discontinuities +in audio output and/or input. */ + +static void oss_doresync( void) +{ + int dev, zeroed = 0, wantsize; + char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; + audio_buf_info ainfo; + + /* 1. if any input devices are ahead (have more than 1 buffer stored), + drop one or more buffers worth */ + for (dev = 0; dev < linux_nindevs; dev++) + { + if (linux_adcs[dev].d_space == 0) + { + linux_adcs_read(linux_adcs[dev].d_fd, buf, + OSS_XFERSIZE(linux_adcs[dev].d_nchannels, + linux_adcs[dev].d_bytespersamp)); + } + else while (linux_adcs[dev].d_space > + OSS_XFERSIZE(linux_adcs[dev].d_nchannels, + linux_adcs[dev].d_bytespersamp)) + { + linux_adcs_read(linux_adcs[dev].d_fd, buf, + OSS_XFERSIZE(linux_adcs[dev].d_nchannels, + linux_adcs[dev].d_bytespersamp)); + if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE, &ainfo) < 0) + { + fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed", + dev, linux_adcs[dev].d_fd); + break; + } + linux_adcs[dev].d_space = ainfo.bytes; + } + } + + /* 2. if any output devices are behind, feed them zeros to catch them + up */ + for (dev = 0; dev < linux_noutdevs; dev++) + { + while (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize - + sys_advance_samples * (linux_dacs[dev].d_nchannels * + linux_dacs[dev].d_bytespersamp)) + { + if (!zeroed) + { + unsigned int i; + for (i = 0; i < OSS_XFERSAMPS(linux_dacs[dev].d_nchannels); + i++) + buf[i] = 0; + zeroed = 1; + } + linux_dacs_write(linux_dacs[dev].d_fd, buf, + OSS_XFERSIZE(linux_dacs[dev].d_nchannels, + linux_dacs[dev].d_bytespersamp)); + if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0) + { + fprintf(stderr, "OSS: ioctl on output device %d, fd %d failed", + dev, linux_dacs[dev].d_fd); + break; + } + linux_dacs[dev].d_space = ainfo.bytes; + } + } + /* 3. if any DAC devices are too far ahead, plan to drop the + number of frames which will let the others catch up. */ + for (dev = 0; dev < linux_noutdevs; dev++) + { + if (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize - + (sys_advance_samples - 1) * linux_dacs[dev].d_nchannels * + linux_dacs[dev].d_bytespersamp) + { + linux_dacs[dev].d_dropcount = sys_advance_samples - 1 - + (linux_dacs[dev].d_space - linux_dacs[dev].d_bufsize) / + (linux_dacs[dev].d_nchannels * + linux_dacs[dev].d_bytespersamp) ; + } + else linux_dacs[dev].d_dropcount = 0; + } +} + +int oss_send_dacs(void) +{ + float *fp1, *fp2; + long fill; + int i, j, dev, rtnval = SENDDACS_YES; + char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; + t_oss_int16 *sp; + t_oss_int32 *lp; + /* the maximum number of samples we should have in the ADC buffer */ + int idle = 0; + int thischan; + double timeref, timenow; + + if (!linux_nindevs && !linux_noutdevs) + return (SENDDACS_NO); + + if (!oss_blockmode) + { + /* determine whether we're idle. This is true if either (1) + some input device has less than one buffer to read or (2) some + output device has fewer than (sys_advance_samples) blocks buffered + already. */ + oss_calcspace(); + + for (dev=0; dev < linux_noutdevs; dev++) + if (linux_dacs[dev].d_dropcount || + (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space > + sys_advance_samples * linux_dacs[dev].d_bytespersamp * + linux_dacs[dev].d_nchannels)) + idle = 1; + for (dev=0; dev < linux_nindevs; dev++) + if (linux_adcs[dev].d_space < + OSS_XFERSIZE(linux_adcs[dev].d_nchannels, + linux_adcs[dev].d_bytespersamp)) + idle = 1; + } + + if (idle && !oss_blockmode) + { + /* sometimes---rarely---when the ADC available-byte-count is + zero, it's genuine, but usually it's because we're so + late that the ADC has overrun its entire kernel buffer. We + distinguish between the two by waiting 2 msec and asking again. + There should be an error flag we could check instead; look for this + someday... */ + for (dev = 0;dev < linux_nindevs; dev++) + if (linux_adcs[dev].d_space == 0) + { + audio_buf_info ainfo; + sys_microsleep(2000); + oss_calcspace(); + if (linux_adcs[dev].d_space != 0) continue; + + /* here's the bad case. Give up and resync. */ + sys_log_error(ERR_DATALATE); + oss_doresync(); + return (SENDDACS_NO); + } + /* check for slippage between devices, either because + data got lost in the driver from a previous late condition, or + because the devices aren't synced. When we're idle, no + input device should have more than one buffer readable and + no output device should have less than sys_advance_samples-1 + */ + + for (dev=0; dev < linux_noutdevs; dev++) + if (!linux_dacs[dev].d_dropcount && + (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space < + (sys_advance_samples - 2) * + (linux_dacs[dev].d_bytespersamp * + linux_dacs[dev].d_nchannels))) + goto badsync; + for (dev=0; dev < linux_nindevs; dev++) + if (linux_adcs[dev].d_space > 3 * + OSS_XFERSIZE(linux_adcs[dev].d_nchannels, + linux_adcs[dev].d_bytespersamp)) + goto badsync; + + /* return zero to tell the scheduler we're idle. */ + return (SENDDACS_NO); + badsync: + sys_log_error(ERR_RESYNC); + oss_doresync(); + return (SENDDACS_NO); + + } + + /* do output */ + + timeref = sys_getrealtime(); + for (dev=0, thischan = 0; dev < linux_noutdevs; dev++) + { + int nchannels = linux_dacs[dev].d_nchannels; + if (linux_dacs[dev].d_dropcount) + linux_dacs[dev].d_dropcount--; + else + { + if (linux_dacs[dev].d_bytespersamp == 4) + { + for (i = DEFDACBLKSIZE * nchannels, fp1 = sys_soundout + + DEFDACBLKSIZE*thischan, + lp = (t_oss_int32 *)buf; i--; fp1++, lp++) + { + float f = *fp1 * 2147483648.; + *lp = (f >= 2147483647. ? 2147483647. : + (f < -2147483648. ? -2147483648. : f)); + } + } + else + { + for (i = DEFDACBLKSIZE, fp1 = sys_soundout + + DEFDACBLKSIZE*thischan, + sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) + { + for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += DEFDACBLKSIZE) + { + int s = *fp2 * 32767.; + if (s > 32767) s = 32767; + else if (s < -32767) s = -32767; + sp[j] = s; + } + } + } + linux_dacs_write(linux_dacs[dev].d_fd, buf, + OSS_XFERSIZE(nchannels, linux_dacs[dev].d_bytespersamp)); + if ((timenow = sys_getrealtime()) - timeref > 0.002) + { + if (!oss_blockmode) + sys_log_error(ERR_DACSLEPT); + else rtnval = SENDDACS_SLEPT; + } + timeref = timenow; + } + thischan += nchannels; + } + memset(sys_soundout, 0, + sys_outchannels * (sizeof(float) * DEFDACBLKSIZE)); + + /* do input */ + + for (dev = 0, thischan = 0; dev < linux_nindevs; dev++) + { + int nchannels = linux_adcs[dev].d_nchannels; + linux_adcs_read(linux_adcs[dev].d_fd, buf, + OSS_XFERSIZE(nchannels, linux_adcs[dev].d_bytespersamp)); + + if ((timenow = sys_getrealtime()) - timeref > 0.002) + { + if (!oss_blockmode) + sys_log_error(ERR_ADCSLEPT); + else + rtnval = SENDDACS_SLEPT; + } + timeref = timenow; + + if (linux_adcs[dev].d_bytespersamp == 4) + { + for (i = DEFDACBLKSIZE*nchannels, + fp1 = sys_soundin + thischan*DEFDACBLKSIZE, + lp = (t_oss_int32 *)buf; i--; fp1++, lp++) + { + *fp1 = ((float)(*lp))*(float)(1./2147483648.); + } + } + else + { + for (i = DEFDACBLKSIZE,fp1 = sys_soundin + thischan*DEFDACBLKSIZE, + sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels) + { + for (j=0;j<sys_inchannels;j++) + fp1[j*DEFDACBLKSIZE] = (float)sp[j]*(float)3.051850e-05; + } + } + thischan += nchannels; + } + if (thischan != sys_inchannels) + bug("inchannels"); + return (rtnval); +} + +void oss_listdevs( void) +{ + post("device listing not implemented in OSS yet\n"); +} + diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c new file mode 100644 index 00000000..253b33cd --- /dev/null +++ b/pd/src/s_audio_pa.c @@ -0,0 +1,186 @@ +/* Copyright (c) 2001 Miller Puckette and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* this file calls Ross Bencina's and Phil Burk's Portaudio package. It's + the main way in for Mac OS and, with Michael Casey's help, also into + ASIO in Windows. */ + + +#include "m_pd.h" +#include "s_stuff.h" +#include <stdio.h> +#include <stdlib.h> +#include "portaudio.h" +#include "pablio_pd.h" + +#ifdef MACOSX +#define Pa_GetDefaultInputDevice Pa_GetDefaultInputDeviceID +#define Pa_GetDefaultOutputDevice Pa_GetDefaultOutputDeviceID +#endif + + /* public interface declared in m_imp.h */ + + /* implementation */ +static PABLIO_Stream *pa_stream; +static int pa_inchans, pa_outchans; +static float *pa_soundin, *pa_soundout; + +#define MAX_PA_CHANS 32 +#define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DEFDACBLKSIZE + +int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, + t_sample *soundout, int framesperbuf, int nbuffers, + int indeviceno, int outdeviceno) +{ + PaError err; + static int initialized; + + if (!initialized) + { + /* Initialize PortAudio */ + int err = Pa_Initialize(); + if ( err != paNoError ) + { + fprintf( stderr, + "Error number %d occured initializing portaudio\n", + err); + fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); + return (1); + } + initialized = 1; + } + /* post("in %d out %d rate %d device %d", inchans, outchans, rate, deviceno); */ + if (inchans != 0 && outchans != 0 && inchans != outchans) + error("portaudio: number of input and output channels must match"); + if (sys_verbose) + post("portaudio: opening for %d channels in, %d out", + inchans, outchans); + if (inchans > MAX_PA_CHANS) + { + post("input channels reduced to maximum %d", MAX_PA_CHANS); + inchans = MAX_PA_CHANS; + } + if (outchans > MAX_PA_CHANS) + { + post("output channels reduced to maximum %d", MAX_PA_CHANS); + outchans = MAX_PA_CHANS; + } + if (indeviceno < 0) + indeviceno = Pa_GetDefaultInputDevice(); + if (outdeviceno < 0) + outdeviceno = Pa_GetDefaultOutputDevice(); + + fprintf(stderr, "input device %d, output device %d\n", + indeviceno, outdeviceno); + if (inchans && outchans) + err = OpenAudioStream( &pa_stream, rate, paFloat32, + PABLIO_READ_WRITE, inchans, framesperbuf, nbuffers, + indeviceno, outdeviceno); + else if (inchans) + err = OpenAudioStream( &pa_stream, rate, paFloat32, + PABLIO_READ, inchans, framesperbuf, nbuffers, + indeviceno, outdeviceno); + else if (outchans) + err = OpenAudioStream( &pa_stream, rate, paFloat32, + PABLIO_WRITE, outchans, framesperbuf, nbuffers, + indeviceno, outdeviceno); + else err = 0; + if ( err != paNoError ) + { + fprintf( stderr, "Error number %d occured opening portaudio stream\n", + err); + fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); + Pa_Terminate(); + return (1); + } + else if (sys_verbose) + post("... opened OK."); + pa_inchans = inchans; + pa_outchans = outchans; + pa_soundin = soundin; + pa_soundout = soundout; + return (0); +} + +void pa_close_audio( void) +{ + if (pa_inchans || pa_outchans) + CloseAudioStream( pa_stream ); + pa_inchans = pa_outchans = 0; +} + +int pa_send_dacs(void) +{ + float samples[MAX_SAMPLES_PER_FRAME], *fp1, *fp2; + int i, j; + double timebefore; + + timebefore = sys_getrealtime(); + if (pa_inchans) + { + ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE); + for (j = 0, fp1 = pa_soundin; j < pa_inchans; j++, fp1 += DEFDACBLKSIZE) + for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++, + fp2 += pa_inchans) + { + fp1[i] = *fp2; + } + } + if (pa_outchans) + { + for (j = 0, fp1 = pa_soundout; j < pa_outchans; j++, + fp1 += DEFDACBLKSIZE) + for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++, + fp2 += pa_outchans) + { + *fp2 = fp1[i]; + fp1[i] = 0; + } + WriteAudioStream(pa_stream, samples, DEFDACBLKSIZE); + } + + if (sys_getrealtime() > timebefore + 0.002) + return (SENDDACS_SLEPT); + else return (SENDDACS_YES); +} + + +void pa_listdevs(void) /* lifted from pa_devs.c in portaudio */ +{ + int i,j; + int numDevices; + const PaDeviceInfo *pdi; + PaError err; + Pa_Initialize(); + numDevices = Pa_CountDevices(); + if( numDevices < 0 ) + { + fprintf(stderr, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices ); + err = numDevices; + goto error; + } + fprintf(stderr, "Audio Devices:\n"); + for( i=0; i<numDevices; i++ ) + { + pdi = Pa_GetDeviceInfo( i ); + fprintf(stderr, "device %d:", i+1 ); + fprintf(stderr, " %s;", pdi->name ); + fprintf(stderr, "%d inputs, ", pdi->maxInputChannels ); + fprintf(stderr, "%d outputs", pdi->maxOutputChannels ); + if ( i == Pa_GetDefaultInputDevice() ) + fprintf(stderr, " (Default Input)"); + if ( i == Pa_GetDefaultOutputDevice() ) + fprintf(stderr, " (Default Output)"); + fprintf(stderr, "\n"); + } + + fprintf(stderr, "\n"); + return; + +error: + fprintf( stderr, "An error occured while using the portaudio stream\n" ); + fprintf( stderr, "Error number: %d\n", err ); + fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); + +} diff --git a/pd/src/s_entry.c b/pd/src/s_entry.c index 354512e5..ad1e28fa 100644 --- a/pd/src/s_entry.c +++ b/pd/src/s_entry.c @@ -1,10 +1,51 @@ -/* In NT, this is all there is to pd; the rest sits in a "pdlib" dll so +/* In MSW, this is all there is to pd; the rest sits in a "pdlib" dll so that externs can link back to functions defined in pd. */ +#include <stdio.h> int sys_main(int argc, char **argv); + /* WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler( + ULONG FirstHandler, + PVECTORED_EXCEPTION_HANDLER VectoredHandler ); */ + +#ifdef MSW +#if 0 +#incldue "winbase.h" + +LONG NTAPI VectoredExceptionHandler(void *PEXCEPTION_POINTERS) +{ + fprintf(stderr, "caught exception\n"); + return(EXCEPTION_CONTINUE_SEARCH); +} + + +int main(int argc, char **argv) +{ + printf("Pd entry point\n"); + AddVectoredExceptionHandler( + ULONG FirstHandler, + PVECTORED_EXCEPTION_HANDLER VectoredHandler ); + + +#endif + +#if 1 +int main(int argc, char **argv) +{ + __try + { + sys_main(argc, argv); + } + __finally + { + printf("caught an exception; stopping\n"); + } +} +#endif +#else /* not MSW */ int main(int argc, char **argv) { return (sys_main(argc, argv)); } +#endif diff --git a/pd/src/s_file.c b/pd/src/s_file.c index 32d2fcaa..27825d59 100644 --- a/pd/src/s_file.c +++ b/pd/src/s_file.c @@ -6,7 +6,8 @@ * this file contains file-handling routines. */ -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" #include <sys/types.h> #include <sys/stat.h> @@ -29,7 +30,7 @@ void sys_bashfilename(const char *from, char *to) char c; while (c = *from++) { -#ifdef NT +#ifdef MSW if (c == '/') c = '\\'; #endif *to++ = c; @@ -44,7 +45,7 @@ void sys_unbashfilename(const char *from, char *to) char c; while (c = *from++) { -#ifdef NT +#ifdef MSW if (c == '\\') c = '/'; #endif *to++ = c; diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c index eed90b38..004820f6 100644 --- a/pd/src/s_inter.c +++ b/pd/src/s_inter.c @@ -2,8 +2,11 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -/* Pd side of the Pd/Pd-gui interface. */ +/* Pd side of the Pd/Pd-gui interface. Also, some system interface routines +that didn't really belong anywhere. */ +#include "m_pd.h" +#include "s_stuff.h" #include "m_imp.h" #ifdef UNIX #include <unistd.h> @@ -13,11 +16,12 @@ #include <netdb.h> #include <stdlib.h> #include <sys/time.h> +#include <sys/mman.h> #endif #ifdef HAVE_BSTRING_H #include <bstring.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #include <fcntl.h> #include <process.h> @@ -35,10 +39,14 @@ typedef int pid_t; #ifdef MACOSX #include <sys/types.h> #include <sys/stat.h> +#include <pthread.h> #else #include <stdlib.h> #endif +#define DEBUG_MESSUP 1 /* messages up from pd to pd-gui */ +#define DEBUG_MESSDOWN 2 /* messages down from pd-gui to pd */ + extern char pd_version[]; typedef struct _fdpoll @@ -70,9 +78,58 @@ static t_binbuf *inbinbuf; static t_socketreceiver *sys_socketreceiver; extern int sys_addhist(int phase); +#ifdef MSW +static LARGE_INTEGER nt_inittime; +static double nt_freq = 0; + +static void sys_initntclock(void) +{ + LARGE_INTEGER f1; + LARGE_INTEGER now; + QueryPerformanceCounter(&now); + if (!QueryPerformanceFrequency(&f1)) + { + fprintf(stderr, "pd: QueryPerformanceFrequency failed\n"); + f1.QuadPart = 1; + } + nt_freq = f1.QuadPart; + nt_inittime = now; +} + +#if 0 + /* this is a version you can call if you did the QueryPerformanceCounter + call yourself. Necessary for time tagging incoming MIDI at interrupt + level, for instance; but we're not doing that just now. */ + +double nt_tixtotime(LARGE_INTEGER *dumbass) +{ + if (nt_freq == 0) sys_initntclock(); + return (((double)(dumbass->QuadPart - nt_inittime.QuadPart)) / nt_freq); +} +#endif +#endif /* MSW */ + +double sys_getrealtime(void) /* get "real time" in seconds */ +{ +#ifdef UNIX + static struct timeval then; + struct timeval now; + gettimeofday(&now, 0); + if (then.tv_sec == 0 && then.tv_usec == 0) then = now; + return ((now.tv_sec - then.tv_sec) + + (1./1000000.) * (now.tv_usec - then.tv_usec)); +#endif +#ifdef MSW + LARGE_INTEGER now; + QueryPerformanceCounter(&now); + if (nt_freq == 0) sys_initntclock(); + return (((double)(now.QuadPart - nt_inittime.QuadPart)) / nt_freq); +#endif +} + void sys_sockerror(char *s) { -#ifdef NT +#ifdef MSW int err = WSAGetLastError(); if (err == 10054) return; else if (err == 10044) @@ -320,7 +377,7 @@ void sys_closesocket(int fd) #ifdef UNIX close(fd); #endif -#ifdef NT +#ifdef MSW closesocket(fd); #endif } @@ -431,6 +488,34 @@ void sys_setalarm(int microsec) #endif +#ifdef __linux + +#if defined(_POSIX_PRIORITY_SCHEDULING) || defined(_POSIX_MEMLOCK) +#include <sched.h> +#endif + +void sys_set_priority(int higher) +{ +#ifdef _POSIX_PRIORITY_SCHEDULING + struct sched_param par; + int p1 ,p2, p3; + p1 = sched_get_priority_min(SCHED_FIFO); + p2 = sched_get_priority_max(SCHED_FIFO); + p3 = (higher ? p2 - 1 : p2 - 3); + par.sched_priority = p3; + if (sched_setscheduler(0,SCHED_FIFO,&par) != -1) + fprintf(stderr, "priority %d scheduling enabled.\n", p3); +#endif + +#ifdef _POSIX_MEMLOCK + if (mlockall(MCL_FUTURE) != -1) + fprintf(stderr, "memory locking enabled.\n"); +#endif + +} + +#endif /* __linux */ + static int sys_watchfd; void glob_ping(t_pd *dummy) @@ -456,7 +541,7 @@ int sys_startgui(const char *guidir) int len = sizeof(server); int ntry = 0, portno = FIRSTPORTNUM; int xsock = -1; -#ifdef NT +#ifdef MSW short version = MAKEWORD(2, 0); WSADATA nobby; #endif @@ -485,7 +570,7 @@ int sys_startgui(const char *guidir) signal(SIGSTKFLT, sys_exithandler); #endif #endif -#ifdef NT +#ifdef MSW if (WSAStartup(version, &nobby)) sys_sockerror("WSAstartup"); #endif @@ -495,7 +580,7 @@ int sys_startgui(const char *guidir) skip starting the GUI up. */ t_atom zz[19]; int i; -#ifdef NT +#ifdef MSW if (GetCurrentDirectory(MAXPDSTRING, cmdbuf) == 0) strcpy(cmdbuf, "."); #endif @@ -511,12 +596,16 @@ int sys_startgui(const char *guidir) } else { -#ifdef NT +#ifdef MSW char scriptbuf[MAXPDSTRING+30], wishbuf[MAXPDSTRING+30], portbuf[80]; int spawnret; #endif +#ifdef MSW + char intarg; +#else int intarg; +#endif /* create a socket */ xsock = socket(AF_INET, SOCK_STREAM, 0); @@ -546,7 +635,7 @@ int sys_startgui(const char *guidir) /* name the socket */ while (bind(xsock, (struct sockaddr *)&server, sizeof(server)) < 0) { -#ifdef NT +#ifdef MSW int err = WSAGetLastError(); #endif #ifdef UNIX @@ -638,8 +727,8 @@ int sys_startgui(const char *guidir) } #endif /* UNIX */ -#ifdef NT - /* in NT land "guipath" is unused; we just do everything from +#ifdef MSW + /* in MSW land "guipath" is unused; we just do everything from the libdir. */ fprintf(stderr, "%s\n", sys_libdir->s_name); @@ -662,10 +751,10 @@ int sys_startgui(const char *guidir) exit(1); } -#endif /* NT */ +#endif /* MSW */ } -#ifdef UNIX +#ifdef __linux__ /* now that we've spun off the child process we can promote our process's priority, if we happen to be root. */ if (sys_hipriority) @@ -733,12 +822,24 @@ int sys_startgui(const char *guidir) } seteuid(getuid()); /* lose setuid priveliges */ -#endif /* UNIX */ +#endif /* __linux__ */ -#ifdef NT +#ifdef MSW if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) fprintf(stderr, "pd: couldn't set high priority class\n"); #endif +#ifdef MACOSX + { + struct sched_param param; + int policy = SCHED_RR; + int err; + param.sched_priority = 80; // adjust 0 : 100 + + err = pthread_setschedparam(pthread_self(), policy, ¶m); + if (err) + post("warning: high priority scheduling failed\n"); + } +#endif /* MACOSX */ if (!sys_nogui) { @@ -786,8 +887,13 @@ void sys_bail(int n) if (!reentered) { reentered = 1; +#ifndef __linux /* sys_close_audio() hangs if you're in a signal? */ + fprintf(stderr, "closing audio...\n"); sys_close_audio(); + fprintf(stderr, "closing MIDI...\n"); sys_close_midi(); + fprintf(stderr, "... done.\n"); +#endif } _exit(n); } diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c index 4c0ef972..c210206c 100644 --- a/pd/src/s_loader.c +++ b/pd/src/s_loader.c @@ -9,7 +9,7 @@ #include <stdlib.h> #include <unistd.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #include <windows.h> #endif @@ -17,7 +17,8 @@ #include <mach-o/dyld.h> #endif #include <string.h> -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" #include <stdio.h> typedef void (*t_xxx)(void); @@ -39,96 +40,118 @@ static char sys_dllextent[] = #ifdef MACOSX ".pd_darwin"; #endif -#ifdef NT +#ifdef MSW ".dll"; #endif +void class_set_extern_dir(t_symbol *s); int sys_load_lib(char *dirname, char *classname) { char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING], - *nameptr, *lastdot; + classname2[MAXPDSTRING], *nameptr, *lastdot; void *dlobj; - t_xxx makeout; + t_xxx makeout = NULL; int fd; -#ifdef NT +#ifdef MSW HINSTANCE ntdll; #endif #if 0 fprintf(stderr, "lib %s %s\n", dirname, classname); #endif + /* try looking in the path for (classname).(sys_dllextent) ... */ if ((fd = open_via_path(dirname, classname, sys_dllextent, dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) { - return (0); + /* next try (classname)/(classname).(sys_dllextent) ... */ + strncpy(classname2, classname, MAXPDSTRING); + filename[MAXPDSTRING-2] = 0; + strcat(classname2, "/"); + strncat(classname2, classname, MAXPDSTRING-strlen(classname2)); + filename[MAXPDSTRING-1] = 0; + if ((fd = open_via_path(dirname, classname2, sys_dllextent, + dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) + { + return (0); + } } - else - { - close(fd); - /* refabricate the pathname */ - strcpy(filename, dirbuf); - strcat(filename, "/"); - strcat(filename, nameptr); - /* extract the setup function name */ - if (lastdot = strrchr(nameptr, '.')) - *lastdot = 0; + + + close(fd); + class_set_extern_dir(gensym(dirbuf)); + + /* refabricate the pathname */ + strncpy(filename, dirbuf, MAXPDSTRING); + filename[MAXPDSTRING-2] = 0; + strcat(filename, "/"); + strncat(filename, nameptr, MAXPDSTRING-strlen(filename)); + filename[MAXPDSTRING-1] = 0; + /* extract the setup function name */ + if (lastdot = strrchr(nameptr, '.')) + *lastdot = 0; #ifdef MACOSX - strcpy(symname, "_"); - strcat(symname, nameptr); + strcpy(symname, "_"); + strcat(symname, nameptr); #else - strcpy(symname, nameptr); + strcpy(symname, nameptr); #endif - /* if the last character is a tilde, replace with "_tilde" */ - if (symname[strlen(symname) - 1] == '~') - strcpy(symname + (strlen(symname) - 1), "_tilde"); - /* and append _setup to form the C setup function name */ - strcat(symname, "_setup"); + /* if the last character is a tilde, replace with "_tilde" */ + if (symname[strlen(symname) - 1] == '~') + strcpy(symname + (strlen(symname) - 1), "_tilde"); + /* and append _setup to form the C setup function name */ + strcat(symname, "_setup"); #ifdef DL_OPEN - dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); - if (!dlobj) - { - post("%s: %s", filename, dlerror()); - return (0); - } - makeout = (t_xxx)dlsym(dlobj, symname); -#endif -#ifdef NT - sys_bashfilename(filename, filename); - ntdll = LoadLibrary(filename); - if (!ntdll) - { - post("%s: couldn't load", filename); - return (0); - } - makeout = (t_xxx)GetProcAddress(ntdll, symname); + dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); + if (!dlobj) + { + post("%s: %s", filename, dlerror()); + class_set_extern_dir(&s_); + return (0); + } + makeout = (t_xxx)dlsym(dlobj, symname); +#endif +#ifdef MSW + sys_bashfilename(filename, filename); + ntdll = LoadLibrary(filename); + if (!ntdll) + { + post("%s: couldn't load", filename); + class_set_extern_dir(&s_); + return (0); + } + makeout = (t_xxx)GetProcAddress(ntdll, symname); #endif #ifdef MACOSX + { + NSObjectFileImage image; + void *ret; + NSSymbol s; + if ( NSCreateObjectFileImageFromFile( filename, &image) != NSObjectFileImageSuccess ) { - NSObjectFileImage image; - void *ret; - NSSymbol s; - if ( NSCreateObjectFileImageFromFile( filename, &image) != NSObjectFileImageSuccess ) - { - post("%s: couldn't load", filename); - return 0; - } - ret = NSLinkModule( image, filename, NSLINKMODULE_OPTION_BINDNOW); - - s = NSLookupSymbolInModule(ret, symname); - - if (s) - makeout = (t_xxx)NSAddressOfSymbol( s); - else makeout = 0; + post("%s: couldn't load", filename); + class_set_extern_dir(&s_); + return 0; } -#endif + ret = NSLinkModule( image, filename, + NSLINKMODULE_OPTION_BINDNOW + NSLINKMODULE_OPTION_PRIVATE); + + s = NSLookupSymbolInModule(ret, symname); + + if (s) + makeout = (t_xxx)NSAddressOfSymbol( s); + else makeout = 0; } +#endif + if (!makeout) { post("load_object: Symbol \"%s\" not found", symname); + class_set_extern_dir(&s_); return 0; } (*makeout)(); + class_set_extern_dir(&s_); return (1); } diff --git a/pd/src/s_main.c b/pd/src/s_main.c index fdf36772..f969f27e 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -7,11 +7,13 @@ * 1311:forum::für::umläute:2001 */ -char pd_version[] = "Pd version 0.36-0\n"; +char pd_version[] = "Pd version 0.37 TEST 4\n"; char pd_compiletime[] = __TIME__; char pd_compiledate[] = __DATE__; +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include <sys/types.h> #include <sys/stat.h> #include <limits.h> @@ -23,7 +25,7 @@ char pd_compiledate[] = __DATE__; #ifdef UNIX #include <unistd.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #include <windows.h> #include <winbase.h> @@ -36,6 +38,7 @@ int sys_startgui(const char *guipath); int sys_rcfile(void); int m_scheduler(int nodacs); void m_schedsetsr( void); +void sys_addhelppath(char *p); int sys_debuglevel; int sys_verbose; @@ -50,16 +53,13 @@ static t_namelist *sys_messagelist; static int sys_version; int sys_nmidiout = 1; -#ifdef NT +#ifdef MSW int sys_nmidiin = 0; -#define DEFMIDIOUTDEV 0 /* For output, in NT, default to "midi_mapper" */ #else int sys_nmidiin = 1; -#define DEFMIDIOUTDEV 1 /* in other OSes, default to first MIDI device */ #endif -#define DEFMIDIINDEV 1 /* for NT this isn't used since sys_nmidiin is 0. */ -int sys_midiindevlist[MAXMIDIINDEV] = {DEFMIDIINDEV}; -int sys_midioutdevlist[MAXMIDIOUTDEV] = {DEFMIDIOUTDEV}; +int sys_midiindevlist[MAXMIDIINDEV] = {DEFMIDIDEV}; +int sys_midioutdevlist[MAXMIDIOUTDEV] = {DEFMIDIDEV}; typedef struct _fontinfo { @@ -80,7 +80,7 @@ static t_fontinfo sys_fontlist[] = { #define NFONT (sizeof(sys_fontlist)/sizeof(*sys_fontlist)) /* here are the actual font size structs on msp's systems: -NT: +MSW: font 8 5 9 8 5 11 font 10 7 13 10 6 13 font 12 9 16 14 8 16 @@ -127,7 +127,7 @@ int sys_fontheight(int fontsize) } int sys_defaultfont; -#ifdef NT +#ifdef MSW #define DEFAULTFONT 12 #else #define DEFAULTFONT 10 @@ -228,6 +228,7 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv) } static void sys_addextrapath(void); +static void sys_addreferencepath(void); /* this is called from main() in s_entry.c */ int sys_main(int argc, char **argv) @@ -237,11 +238,12 @@ int sys_main(int argc, char **argv) #endif pd_init(); /* start the message system */ sys_findprogdir(argv[0]); /* set sys_progname, guipath */ -#ifdef __linux__ +#ifdef UNIX sys_rcfile(); /* parse the startup file */ #endif if (sys_argparse(argc, argv)) return (1); /* parse cmd line */ sys_addextrapath(); + sys_addreferencepath(); if (sys_verbose || sys_version) fprintf(stderr, "%scompiled %s %s\n", pd_version, pd_compiletime, pd_compiledate); if (sys_version) /* if we were just asked our version, exit here. */ @@ -265,13 +267,11 @@ static char *(usagemessage[]) = { "usage: pd [-flags] [file]...\n", "\naudio configuration flags:\n", "-r <n> -- specify sample rate\n", -#if defined(__linux__) || defined(NT) -"-inchannels ... -- number of audio in channels (by device, like \"2\" or \"16,8\")\n", -"-outchannels ... -- number of audio out channels (by device)\n", -#else -"-inchannels <n> -- number of audio input channels\n", -"-outchannels <n> -- number of audio output channels\n", -#endif +"-audioindev ... -- audio in devices; e.g., \"1,3\" for first and third\n", +"-audiooutdev ... -- audio out devices (same)\n", +"-audiodev ... -- specify input and output together\n", +"-inchannels ... -- audio input channels (by device, like \"2\" or \"16,8\")\n", +"-outchannels ... -- number of audio out channels (same)\n", "-channels ... -- specify both input and output channels\n", "-audiobuf <n> -- specify size of audio buffer in msec\n", "-blocksize <n> -- specify audio I/O block size in sample frames\n", @@ -279,37 +279,30 @@ static char *(usagemessage[]) = { "-nodac -- suppress audio output\n", "-noadc -- suppress audio input\n", "-noaudio -- suppress audio input and output (-nosound is synonym) \n", -"-listdev -- list audio and MIDI devices\n", +"-listdev -- list audio and MIDI devices\n", -#ifdef __linux__ -"-frags <n> -- specify number of audio fragments (defeats audiobuf)\n", -"-fragsize <n> -- specify log of fragment size ('blocksize' is better...)\n", -"-stream -- use stream mode audio (e.g., for es1370 audio cards)\n", -"-32bit -- allow 32 bit OSS audio transfers (for RME Hammerfall)\n", +#ifdef USEAPI_OSS +"-oss -- use OSS audio API\n", +"-32bit ----- allow 32 bit OSS audio (for RME Hammerfall)\n", #endif -#ifdef ALSA99 -"-alsa -- use ALSA audio drivers\n", -"-alsadev <n> -- specify ALSA I/O device number (counting from 1)\n", +#ifdef USEAPI_ALSA +"-alsa -- use ALSA audio API\n", +"-alsadev <n> ----- ALSA device # (count from 1) or name: default hw:0,0\n", #endif -#ifdef ALSA01 -"-alsa -- use ALSA audio drivers\n", -"-alsadev <n> -- ALSA device # (counting from 1) or name: default hw:0,0\n", +#ifdef USEAPI_PORTAUDIO +#ifdef MSW +"-pa -- use Portaudio API (for ASIO)\n", +#else +"-pa -- use Portaudio API\n", #endif - -#ifdef RME_HAMMERFALL -"-rme -- use Ritsch's RME 9652 audio driver\n", #endif -"-audioindev ... -- sound in device list; e.g., \"2,1\" for second and first\n", -"-audiooutdev ... -- sound out device list, same as above \n", -"-audiodev ... -- specify both -audioindev and -audiooutdev together\n", - -#ifdef NT -"-resync -- resynchronize audio (default if more than 2 channels)\n", -"-noresync -- never resynchronize audio I/O (default for stereo)\n", -"-asio -- use ASIO audio driver (and not the 'MMIO' default)\n", + +#ifdef USEAPI_MMIO +"-mmio -- use MMIO audio API\n", #endif +" (default audio API for this platform: ", API_DEFSTRING, ")\n\n", "\nMIDI configuration flags:\n", "-midiindev ... -- midi in device list; e.g., \"1,3\" for first and third\n", @@ -319,8 +312,9 @@ static char *(usagemessage[]) = { "-nomidiout -- suppress MIDI output\n", "-nomidi -- suppress MIDI input and output\n", -"\ngeneral flags:\n", +"\nother flags:\n", "-path <path> -- add to file search path\n", +"-helppath <path> -- add to help file search path\n", "-open <file> -- open file(s) on startup\n", "-lib <file> -- load object library(s)\n", "-font <n> -- specify default font size in points\n", @@ -331,7 +325,7 @@ static char *(usagemessage[]) = { "-nogui -- suppress starting the GUI\n", "-guicmd \"cmd...\" -- substitute another GUI program (e.g., rsh)\n", "-send \"msg...\" -- send a message at startup (after patches are loaded)\n", -#ifdef UNIX +#ifdef __linux__ "-rt or -realtime -- use real-time priority (needs root privilege)\n", #endif }; @@ -359,18 +353,18 @@ static void sys_parsedevlist(int *np, int *vecp, int max, char *str) static int sys_getmultidevchannels(int n, int *devlist) { - int sum = 0; - if (n<0)return(-1); - if (n==0)return 0; - while(n--)sum+=*devlist++; - return sum; + int sum = 0; + if (n<0)return(-1); + if (n==0)return 0; + while(n--)sum+=*devlist++; + return sum; } /* this routine tries to figure out where to find the auxilliary files Pd will need to run. This is either done by looking at the command line invokation for Pd, or if htat fails, by consulting the variable - INSTALL_PREFIX. In NT, we don't try to use INSTALL_PREFIX. */ + INSTALL_PREFIX. In MSW, we don't try to use INSTALL_PREFIX. */ void sys_findprogdir(char *progname) { char sbuf[MAXPDSTRING], sbuf2[MAXPDSTRING], *sp; @@ -380,11 +374,11 @@ void sys_findprogdir(char *progname) #endif /* find out by what string Pd was invoked; put answer in "sbuf". */ -#ifdef NT +#ifdef MSW GetModuleFileName(NULL, sbuf2, sizeof(sbuf2)); sbuf2[MAXPDSTRING-1] = 0; sys_unbashfilename(sbuf2, sbuf); -#endif /* NT */ +#endif /* MSW */ #ifdef UNIX strncpy(sbuf, progname, MAXPDSTRING); sbuf[MAXPDSTRING-1] = 0; @@ -424,7 +418,7 @@ void sys_findprogdir(char *progname) .../lib/pd/bin/pd-gui .../lib/pd/doc To decide which, we stat .../lib/pd; if that exists, we assume it's - the complicated layout. In NT, it's the "simple" layout, but + the complicated layout. In MSW, it's the "simple" layout, but the gui program is straight wish80: .../bin/pd .../bin/wish80.exe @@ -455,18 +449,15 @@ void sys_findprogdir(char *progname) sys_guidir = gensym(sbuf); } #endif -#ifdef NT +#ifdef MSW sys_libdir = gensym(sbuf2); - sys_guidir = &s_; /* in NT the guipath just depends on the libdir */ + sys_guidir = &s_; /* in MSW the guipath just depends on the libdir */ #endif } int sys_argparse(int argc, char **argv) { char sbuf[MAXPDSTRING]; -#ifdef NT - int resync = -1; -#endif argc--; argv++; while ((argc > 0) && **argv == '-') { @@ -526,26 +517,72 @@ int sys_argparse(int argc, char **argv) argc -= 2; argv += 2; } else if (!strcmp(*argv, "-nodac")) - { /* IOhannes */ - sys_nsoundout=0; - sys_nchout = 0; - outchannels =0; - argc--; argv++; + { /* IOhannes */ + sys_nsoundout=0; + sys_nchout = 0; + outchannels =0; + argc--; argv++; } else if (!strcmp(*argv, "-noadc")) - { /* IOhannes */ - sys_nsoundin=0; - sys_nchin = 0; - inchannels =0; - argc--; argv++; + { /* IOhannes */ + sys_nsoundin=0; + sys_nchin = 0; + inchannels =0; + argc--; argv++; } else if (!strcmp(*argv, "-nosound") || !strcmp(*argv, "-noaudio")) - { /* IOhannes */ - sys_nsoundin=sys_nsoundout = 0; - sys_nchin = sys_nchout = 0; - inchannels =outchannels =0; - argc--; argv++; + { /* IOhannes */ + sys_nsoundin=sys_nsoundout = 0; + sys_nchin = sys_nchout = 0; + inchannels =outchannels =0; + argc--; argv++; } +#ifdef USEAPI_OSS + else if (!strcmp(*argv, "-oss")) + { + sys_set_sound_api(API_OSS); + argc--; argv++; + } + else if (!strcmp(*argv, "-32bit")) + { + sys_set_sound_api(API_OSS); + oss_set32bit(); + argc--; argv++; + } +#endif +#ifdef USEAPI_ALSA + else if (!strcmp(*argv, "-alsa")) + { + sys_set_sound_api(API_ALSA); + argc--; argv++; + } + else if (!strcmp(*argv, "-alsadev")) + { + if (argv[1][0] >= '1' && argv[1][0] <= '9') + { + char buf[80]; + sprintf(buf, "hw:%d,0", atoi(argv[1]) - 1); + linux_alsa_devname(buf); + } + else linux_alsa_devname(argv[1]); + sys_set_sound_api(API_ALSA); + argc -= 2; argv +=2; + } +#endif +#ifdef USEAPI_PORTAUDIO + else if (!strcmp(*argv, "-pa") || !strcmp(*argv, "-portaudio")) + { + sys_set_sound_api(API_PORTAUDIO); + argc--; argv++; + } +#endif +#ifdef USEAPI_MMIO + else if (!strcmp(*argv, "-mmio")) + { + sys_set_sound_api(API_MMIO); + argc--; argv++; + } +#endif else if (!strcmp(*argv, "-nomidiin")) { sys_nmidiin = 0; @@ -592,6 +629,11 @@ int sys_argparse(int argc, char **argv) sys_addpath(argv[1]); argc -= 2; argv += 2; } + else if (!strcmp(*argv, "-helppath")) + { + sys_addhelppath(argv[1]); + argc -= 2; argv += 2; + } else if (!strcmp(*argv, "-open") && argc > 1) { sys_openlist = namelist_append(sys_openlist, argv[1]); @@ -650,80 +692,12 @@ int sys_argparse(int argc, char **argv) argc--; argv++; } #ifdef UNIX - else if (!strcmp(*argv, "-rt")) - { - sys_hipriority = 1; - argc--; argv++; - } - else if (!strcmp(*argv, "-realtime")) + else if (!strcmp(*argv, "-rt") || !strcmp(*argv, "-realtime")) { sys_hipriority = 1; argc--; argv++; } #endif -#ifdef __linux__ - else if (!strcmp(*argv, "-frags")) - { - linux_setfrags(atoi(argv[1])); - argc -= 2; argv += 2; - } - else if (!strcmp(*argv, "-fragsize")) - { - post("pd: -fragsize argument is obsolete; use '-blocksize %d'\n", - (1 << atoi(argv[1]))); - sys_setblocksize(1 << atoi(argv[1])); - argc -= 2; argv += 2; - } - else if (!strcmp(*argv, "-stream")) - { - linux_streammode(); - argc--; argv++; - } - else if (!strcmp(*argv, "-32bit")) - { - linux_32bit(); - argc--; argv++; - } -#ifdef ALSA01 - else if (!strcmp(*argv, "-alsa")) - { - linux_set_sound_api(API_ALSA); - argc--; argv++; - } - else if (!strcmp(*argv, "-alsadev")) - { - if (argv[1][0] >= '1' && argv[1][0] <= '9') - { - char buf[80]; - sprintf(buf, "hw:%d,0", atoi(argv[1]) - 1); - linux_alsa_devname(buf); - } - else linux_alsa_devname(argv[1]); - linux_set_sound_api(API_ALSA); - argc -= 2; argv +=2; - } -#endif -#ifdef ALSA99 - else if (!strcmp(*argv, "-alsa")) - { - linux_set_sound_api(API_ALSA); - argc--; argv++; - } - else if (!strcmp(*argv, "-alsadev")) - { - linux_alsa_devno(atoi(argv[1])); - linux_set_sound_api(API_ALSA); - argc -= 2; argv +=2; - } -#endif -#ifdef RME_HAMMERFALL - else if (!strcmp(*argv, "-rme")) - { - linux_set_sound_api(API_RME); - argc--; argv++; - } -#endif -#endif else if (!strcmp(*argv, "-soundindev") || !strcmp(*argv, "-audioindev")) { /* IOhannes */ @@ -752,24 +726,6 @@ int sys_argparse(int argc, char **argv) goto usage; argc -= 2; argv += 2; } -#ifdef NT - else if (!strcmp(*argv, "-asio")) - { - nt_set_sound_api(API_PORTAUDIO); - argc--; argv++; - } - else if (!strcmp(*argv, "-noresync")) - { - resync = 0; - argc--; argv++; - } - else if (!strcmp(*argv, "-resync")) - { - resync = 1; - argc--; argv++; - } - -#endif /* NT */ else { unsigned int i; @@ -779,25 +735,17 @@ int sys_argparse(int argc, char **argv) return (1); } } -#ifdef NT - /* resynchronization is on by default for mulltichannel, otherwise - off. */ - if (resync == -1) - resync = (inchannels > 2 || outchannels > 2); - if (!resync) - nt_noresync(); -#endif - if (!sys_defaultfont) sys_defaultfont = DEFAULTFONT; + if (!sys_defaultfont) + sys_defaultfont = DEFAULTFONT; for (; argc > 0; argc--, argv++) sys_openlist = namelist_append(sys_openlist, *argv); - return (0); } int sys_getblksize(void) { - return (DACBLKSIZE); + return (DEFDACBLKSIZE); } static void sys_addextrapath(void) @@ -810,3 +758,12 @@ static void sys_addextrapath(void) sys_addpath(sbuf); } +static void sys_addreferencepath(void) +{ + char sbuf[MAXPDSTRING]; + /* add "doc/5.reference" library to helppath */ + strncpy(sbuf, sys_libdir->s_name, MAXPDSTRING-30); + sbuf[MAXPDSTRING-30] = 0; + strcat(sbuf, "/doc/5.reference"); + sys_addhelppath(sbuf); +} diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c new file mode 100644 index 00000000..2bba9a45 --- /dev/null +++ b/pd/src/s_midi.c @@ -0,0 +1,405 @@ +/* Copyright (c) 1997-1999 Miller Puckette and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Clock functions (which should move, but where?) and MIDI queueing */ + +#include "m_pd.h" +#include "s_stuff.h" +#include "m_imp.h" +#ifdef UNIX +#include <unistd.h> +#include <sys/time.h> +#ifdef HAVE_BSTRING_H +#include <bstring.h> +#endif +#endif +#ifdef MSW +#include <winsock.h> +#include <sys/types.h> +#include <sys/timeb.h> +#include <wtypes.h> +#endif +#include <string.h> +#include <stdio.h> +#include <signal.h> + +typedef struct _midiqelem +{ + double q_time; + int q_portno; + unsigned char q_onebyte; + unsigned char q_byte1; + unsigned char q_byte2; + unsigned char q_byte3; +} t_midiqelem; + +#define MIDIQSIZE 1024 + +t_midiqelem midi_outqueue[MIDIQSIZE]; +int midi_outhead, midi_outtail; +t_midiqelem midi_inqueue[MIDIQSIZE]; +int midi_inhead, midi_intail; +static double sys_midiinittime; + + /* this is our current estimate for at what "system" real time the + current logical time's output should occur. */ +static double sys_dactimeminusrealtime; + /* same for input, should be schduler advance earlier. */ +static double sys_adctimeminusrealtime; + +static double sys_newdactimeminusrealtime = -1e20; +static double sys_newadctimeminusrealtime = -1e20; +static double sys_whenupdate; + +void sys_initmidiqueue( void) +{ + sys_midiinittime = clock_getlogicaltime(); + sys_dactimeminusrealtime = sys_adctimeminusrealtime = 0; +} + + /* this is called from the OS dependent code from time to time when we + think we know the delay (outbuftime) in seconds, at which the last-output + audio sample will go out the door. */ +void sys_setmiditimediff(double inbuftime, double outbuftime) +{ + double dactimeminusrealtime = + .001 * clock_gettimesince(sys_midiinittime) + - outbuftime - sys_getrealtime(); + double adctimeminusrealtime = + .001 * clock_gettimesince(sys_midiinittime) + + inbuftime - sys_getrealtime(); + if (dactimeminusrealtime > sys_newdactimeminusrealtime) + sys_newdactimeminusrealtime = dactimeminusrealtime; + if (adctimeminusrealtime > sys_newadctimeminusrealtime) + sys_newadctimeminusrealtime = adctimeminusrealtime; + if (sys_getrealtime() > sys_whenupdate) + { + sys_dactimeminusrealtime = sys_newdactimeminusrealtime; + sys_adctimeminusrealtime = sys_newadctimeminusrealtime; + sys_newdactimeminusrealtime = -1e20; + sys_newadctimeminusrealtime = -1e20; + sys_whenupdate = sys_getrealtime() + 1; + } +} + + /* return the logical time of the DAC sample we believe is currently + going out, based on how much "system time" has elapsed since the + last time sys_setmiditimediff got called. */ +static double sys_getmidioutrealtime( void) +{ + return (sys_getrealtime() + sys_dactimeminusrealtime); +} + +static double sys_getmidiinrealtime( void) +{ + return (sys_getrealtime() + sys_adctimeminusrealtime); +} + +static void sys_putnext( void) +{ + int portno = midi_outqueue[midi_outtail].q_portno; + if (midi_outqueue[midi_outtail].q_onebyte) + sys_putmidibyte(portno, midi_outqueue[midi_outtail].q_byte1); + else sys_putmidimess(portno, midi_outqueue[midi_outtail].q_byte1, + midi_outqueue[midi_outtail].q_byte2, + midi_outqueue[midi_outtail].q_byte3); + midi_outtail = (midi_outtail + 1 == MIDIQSIZE ? 0 : midi_outtail + 1); +} + +/* #define TEST_DEJITTER */ + +void sys_pollmidioutqueue( void) +{ +#ifdef TEST_DEJITTER + static int db = 0; +#endif + double midirealtime = sys_getmidioutrealtime(); +#ifdef TEST_DEJITTER + if (midi_outhead == midi_outtail) + db = 0; +#endif + while (midi_outhead != midi_outtail) + { +#ifdef TEST_DEJITTER + if (!db) + { + post("out: del %f, midiRT %f logicaltime %f, RT %f dacminusRT %f", + (midi_outqueue[midi_outtail].q_time - midirealtime), + midirealtime, .001 * clock_gettimesince(sys_midiinittime), + sys_getrealtime(), sys_dactimeminusrealtime); + db = 1; + } +#endif + if (midi_outqueue[midi_outtail].q_time <= midirealtime) + sys_putnext(); + else break; + } +} + +static void sys_queuemidimess(int portno, int onebyte, int a, int b, int c) +{ + t_midiqelem *midiqelem; + int newhead = midi_outhead +1; + if (newhead == MIDIQSIZE) + newhead = 0; + /* if FIFO is full flush an element to make room */ + if (newhead == midi_outtail) + sys_putnext(); + midi_outqueue[midi_outhead].q_portno = portno; + midi_outqueue[midi_outhead].q_onebyte = onebyte; + midi_outqueue[midi_outhead].q_byte1 = a; + midi_outqueue[midi_outhead].q_byte2 = b; + midi_outqueue[midi_outhead].q_byte3 = c; + midi_outqueue[midi_outhead].q_time = + .001 * clock_gettimesince(sys_midiinittime); + midi_outhead = newhead; + sys_pollmidioutqueue(); +} + +#define MIDI_NOTEON 144 +#define MIDI_POLYAFTERTOUCH 160 +#define MIDI_CONTROLCHANGE 176 +#define MIDI_PROGRAMCHANGE 192 +#define MIDI_AFTERTOUCH 208 +#define MIDI_PITCHBEND 224 + +void outmidi_noteon(int portno, int channel, int pitch, int velo) +{ + if (pitch < 0) pitch = 0; + else if (pitch > 127) pitch = 127; + if (velo < 0) velo = 0; + else if (velo > 127) velo = 127; + sys_queuemidimess(portno, 0, MIDI_NOTEON + (channel & 0xf), pitch, velo); +} + +void outmidi_controlchange(int portno, int channel, int ctl, int value) +{ + if (ctl < 0) ctl = 0; + else if (ctl > 127) ctl = 127; + if (value < 0) value = 0; + else if (value > 127) value = 127; + sys_queuemidimess(portno, 0, MIDI_CONTROLCHANGE + (channel & 0xf), + ctl, value); +} + +void outmidi_programchange(int portno, int channel, int value) +{ + if (value < 0) value = 0; + else if (value > 127) value = 127; + sys_queuemidimess(portno, 0, + MIDI_PROGRAMCHANGE + (channel & 0xf), value, 0); +} + +void outmidi_pitchbend(int portno, int channel, int value) +{ + if (value < 0) value = 0; + else if (value > 16383) value = 16383; + sys_queuemidimess(portno, 0, MIDI_PITCHBEND + (channel & 0xf), + (value & 127), ((value>>7) & 127)); +} + +void outmidi_aftertouch(int portno, int channel, int value) +{ + if (value < 0) value = 0; + else if (value > 127) value = 127; + sys_queuemidimess(portno, 0, MIDI_AFTERTOUCH + (channel & 0xf), value, 0); +} + +void outmidi_polyaftertouch(int portno, int channel, int pitch, int value) +{ + if (pitch < 0) pitch = 0; + else if (pitch > 127) pitch = 127; + if (value < 0) value = 0; + else if (value > 127) value = 127; + sys_queuemidimess(portno, 0, MIDI_POLYAFTERTOUCH + (channel & 0xf), + pitch, value); +} + +void outmidi_mclk(int portno) +{ + sys_queuemidimess(portno, 1, 0xf8, 0,0); +} + +/* ------------------------- MIDI input queue handling ------------------ */ +typedef struct midiparser +{ + int mp_status; + int mp_sysex; + int mp_gotbyte1; + int mp_byte1; +} t_midiparser; + +#define MIDINOTEOFF 0x80 +#define MIDINOTEON 0x90 +#define MIDIPOLYTOUCH 0xa0 +#define MIDICONTROLCHANGE 0xb0 +#define MIDIPROGRAMCHANGE 0xc0 +#define MIDICHANNELTOUCH 0xd0 +#define MIDIPITCHBEND 0xe0 + /* functions in x_midi.c */ +void inmidi_realtimein(int portno, int cmd); +void inmidi_byte(int portno, int byte); +void inmidi_sysex(int portno, int byte); +void inmidi_noteon(int portno, int channel, int pitch, int velo); +void inmidi_controlchange(int portno, int channel, int ctlnumber, int value); +void inmidi_programchange(int portno, int channel, int value); +void inmidi_pitchbend(int portno, int channel, int value); +void inmidi_aftertouch(int portno, int channel, int value); +void inmidi_polyaftertouch(int portno, int channel, int pitch, int value); + +static void sys_dispatchnextmidiin( void) +{ + static t_midiparser parser[MAXMIDIINDEV], *parserp; + int portno = midi_inqueue[midi_intail].q_portno, + byte = midi_inqueue[midi_intail].q_byte1; + if (!midi_inqueue[midi_intail].q_onebyte) + bug("sys_dispatchnextmidiin"); + if (portno < 0 || portno >= MAXMIDIINDEV) + bug("sys_dispatchnextmidiin 2"); + parserp = parser + portno; + outlet_setstacklim(); + + if (byte >= 0xf8) + inmidi_realtimein(portno, byte); + else + { + inmidi_byte(portno, byte); + if (byte < 0xf0) + { + if (byte & 0x80) + { + parserp->mp_status = byte; + parserp->mp_gotbyte1 = 0; + } + else + { + int cmd = (parserp->mp_status & 0xf0); + int chan = (parserp->mp_status & 0xf); + int byte1 = parserp->mp_byte1, gotbyte1 = parserp->mp_gotbyte1; + switch (cmd) + { + case MIDINOTEOFF: + if (gotbyte1) + inmidi_noteon(portno, chan, byte1, 0), + parserp->mp_gotbyte1 = 0; + else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1; + break; + case MIDINOTEON: + if (gotbyte1) + inmidi_noteon(portno, chan, byte1, byte), + parserp->mp_gotbyte1 = 0; + else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1; + break; + case MIDIPOLYTOUCH: + if (gotbyte1) + inmidi_polyaftertouch(portno, chan, byte1, byte), + parserp->mp_gotbyte1 = 0; + else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1; + break; + case MIDICONTROLCHANGE: + if (gotbyte1) + inmidi_controlchange(portno, chan, byte1, byte), + parserp->mp_gotbyte1 = 0; + else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1; + break; + case MIDIPROGRAMCHANGE: + inmidi_programchange(portno, chan, byte); + break; + case MIDICHANNELTOUCH: + inmidi_aftertouch(portno, chan, byte); + break; + case MIDIPITCHBEND: + if (gotbyte1) + inmidi_pitchbend(portno, chan, ((byte << 7) + byte1)), + parserp->mp_gotbyte1 = 0; + else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1; + break; + } + } + } + } + midi_intail = (midi_intail + 1 == MIDIQSIZE ? 0 : midi_intail + 1); +} + +void sys_pollmidiinqueue( void) +{ +#ifdef TEST_DEJITTER + static int db = 0; +#endif + double logicaltime = .001 * clock_gettimesince(sys_midiinittime); +#ifdef TEST_DEJITTER + if (midi_inhead == midi_intail) + db = 0; +#endif + while (midi_inhead != midi_intail) + { +#ifdef TEST_DEJITTER + if (!db) + { + post("in del %f, logicaltime %f, RT %f adcminusRT %f", + (midi_inqueue[midi_intail].q_time - logicaltime), + logicaltime, sys_getrealtime(), sys_adctimeminusrealtime); + db = 1; + } +#endif +#if 0 + if (midi_inqueue[midi_intail].q_time <= logicaltime - 0.007) + post("late %f", + 1000 * (logicaltime - midi_inqueue[midi_intail].q_time)); +#endif + if (midi_inqueue[midi_intail].q_time <= logicaltime) + { +#if 0 + post("diff %f", + 1000* (logicaltime - midi_inqueue[midi_intail].q_time)); +#endif + sys_dispatchnextmidiin(); + } + else break; + } +} + + /* this should be called from the system dependent MIDI code when a byte + comes in, as a result of our calling sys_poll_midi. We stick it on a + timetag queue and dispatch it at the appropriate logical time. */ + + +void sys_midibytein(int portno, int byte) +{ + static int warned = 0; + t_midiqelem *midiqelem; + int newhead = midi_inhead +1; + if (newhead == MIDIQSIZE) + newhead = 0; + /* if FIFO is full flush an element to make room */ + if (newhead == midi_intail) + { + if (!warned) + { + post("warning: MIDI timing FIFO overflowed"); + warned = 1; + } + sys_dispatchnextmidiin(); + } + midi_inqueue[midi_inhead].q_portno = portno; + midi_inqueue[midi_inhead].q_onebyte = 1; + midi_inqueue[midi_inhead].q_byte1 = byte; + midi_inqueue[midi_inhead].q_time = sys_getmidiinrealtime(); + midi_inhead = newhead; + sys_pollmidiinqueue(); +} + +void sys_pollmidiqueue( void) +{ +#if 0 + static double lasttime; + double newtime = sys_getrealtime(); + if (newtime - lasttime > 0.007) + post("delay %d", (int)(1000 * (newtime - lasttime))); + lasttime = newtime; +#endif + sys_poll_midi(); /* OS dependent poll for MIDI input */ + sys_pollmidioutqueue(); + sys_pollmidiinqueue(); +} diff --git a/pd/src/s_midi_oss.c b/pd/src/s_midi_oss.c new file mode 100644 index 00000000..9233f09a --- /dev/null +++ b/pd/src/s_midi_oss.c @@ -0,0 +1,269 @@ +/* Copyright (c) 1997-1999 Guenter Geiger, Miller Puckette, Larry Troxler, +* Winfried Ritsch, Karl MacMillan, and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* MIDI I/O for Linux using OSS */ + +#include <stdio.h> +#ifdef UNIX +#include <unistd.h> +#endif +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include "m_pd.h" +#include "s_stuff.h" + +static int oss_nmidiin; +static int oss_midiinfd[MAXMIDIINDEV]; +static int oss_nmidiout; +static int oss_midioutfd[MAXMIDIOUTDEV]; + +static void oss_midiout(int fd, int n) +{ + char b = n; + if ((write(fd, (char *) &b, 1)) != 1) + perror("midi write"); +} + +#define O_MIDIFLAG O_NDELAY + +void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec) +{ + int i; + for (i = 0; i < nmidiout; i++) + oss_midioutfd[i] = -1; + for (i = 0, oss_nmidiin = 0; i < nmidiin; i++) + { + int fd = -1, j, outdevindex = -1; + char namebuf[80]; + int devno = midiinvec[i]; + + for (j = 0; j < nmidiout; j++) + if (midioutvec[j] == midiinvec[i]) + outdevindex = j; + + /* try to open the device for read/write. */ + if (devno == 1 && fd < 0 && outdevindex >= 0) + { + sys_setalarm(1000000); + fd = open("/dev/midi", O_RDWR | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, + "device 1: tried /dev/midi READ/WRITE; returned %d\n", fd); + if (outdevindex >= 0 && fd >= 0) + oss_midioutfd[outdevindex] = fd; + } + if (fd < 0 && outdevindex >= 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%2.2d", devno-1); + fd = open(namebuf, O_RDWR | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, + "device %d: tried %s READ/WRITE; returned %d\n", + devno, namebuf, fd); + if (outdevindex >= 0 && fd >= 0) + oss_midioutfd[outdevindex] = fd; + } + if (fd < 0 && outdevindex >= 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%d", devno-1); + fd = open(namebuf, O_RDWR | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n", + devno, namebuf, fd); + if (outdevindex >= 0 && fd >= 0) + oss_midioutfd[outdevindex] = fd; + } + if (devno == 1 && fd < 0) + { + sys_setalarm(1000000); + fd = open("/dev/midi", O_RDONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, + "device 1: tried /dev/midi READONLY; returned %d\n", fd); + } + if (fd < 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%2.2d", devno-1); + fd = open(namebuf, O_RDONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, "device %d: tried %s READONLY; returned %d\n", + devno, namebuf, fd); + } + if (fd < 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%d", devno-1); + fd = open(namebuf, O_RDONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, "device %d: tried %s READONLY; returned %d\n", + devno, namebuf, fd); + } + if (fd >= 0) + oss_midiinfd[oss_nmidiin++] = fd; + else post("couldn't open MIDI input device %d", devno); + } + for (i = 0, oss_nmidiout = 0; i < nmidiout; i++) + { + int fd = oss_midioutfd[i]; + char namebuf[80]; + int devno = midioutvec[i]; + if (devno == 1 && fd < 0) + { + sys_setalarm(1000000); + fd = open("/dev/midi", O_WRONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, + "device 1: tried /dev/midi WRITEONLY; returned %d\n", fd); + } + if (fd < 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%2.2d", devno-1); + fd = open(namebuf, O_WRONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n", + devno, namebuf, fd); + } + if (fd < 0) + { + sys_setalarm(1000000); + sprintf(namebuf, "/dev/midi%d", devno-1); + fd = open(namebuf, O_WRONLY | O_MIDIFLAG); + if (sys_verbose) + fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n", + devno, namebuf, fd); + } + if (fd >= 0) + oss_midioutfd[oss_nmidiout++] = fd; + else post("couldn't open MIDI output device %d", devno); + } + + if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose) + post("opened %d MIDI input device(s) and %d MIDI output device(s).", + oss_nmidiin, oss_nmidiout); +} + +#define md_msglen(x) (((x)<0xC0)?2:((x)<0xE0)?1:((x)<0xF0)?2:\ + ((x)==0xF2)?2:((x)<0xF4)?1:0) + +void sys_putmidimess(int portno, int a, int b, int c) +{ + if (portno >= 0 && portno < oss_nmidiout) + { + switch (md_msglen(a)) + { + case 2: + oss_midiout(oss_midioutfd[portno],a); + oss_midiout(oss_midioutfd[portno],b); + oss_midiout(oss_midioutfd[portno],c); + return; + case 1: + oss_midiout(oss_midioutfd[portno],a); + oss_midiout(oss_midioutfd[portno],b); + return; + case 0: + oss_midiout(oss_midioutfd[portno],a); + return; + }; + } +} + +void sys_putmidibyte(int portno, int byte) +{ + if (portno >= 0 && portno < oss_nmidiout) + oss_midiout(oss_midioutfd[portno], byte); +} + +#if 0 /* this is the "select" version which doesn't work with OSS + driver for emu10k1 (it doesn't implement select.) */ +void sys_poll_midi(void) +{ + int i, throttle = 100; + struct timeval timout; + int did = 1, maxfd = 0; + while (did) + { + fd_set readset, writeset, exceptset; + did = 0; + if (throttle-- < 0) + break; + timout.tv_sec = 0; + timout.tv_usec = 0; + + FD_ZERO(&writeset); + FD_ZERO(&readset); + FD_ZERO(&exceptset); + for (i = 0; i < oss_nmidiin; i++) + { + if (oss_midiinfd[i] > maxfd) + maxfd = oss_midiinfd[i]; + FD_SET(oss_midiinfd[i], &readset); + } + select(maxfd+1, &readset, &writeset, &exceptset, &timout); + for (i = 0; i < oss_nmidiin; i++) + if (FD_ISSET(oss_midiinfd[i], &readset)) + { + char c; + int ret = read(oss_midiinfd[i], &c, 1); + if (ret <= 0) + fprintf(stderr, "Midi read error\n"); + else sys_midibytein(i, (c & 0xff)); + did = 1; + } + } +} +#else + + /* this version uses the asynchronous "read()" ... */ +void sys_poll_midi(void) +{ + int i, throttle = 100; + struct timeval timout; + int did = 1, maxfd = 0; + while (did) + { + fd_set readset, writeset, exceptset; + did = 0; + if (throttle-- < 0) + break; + for (i = 0; i < oss_nmidiin; i++) + { + char c; + int ret = read(oss_midiinfd[i], &c, 1); + if (ret < 0) + { + if (errno != EAGAIN) + perror("MIDI"); + } + else if (ret != 0) + { + sys_midibytein(i, (c & 0xff)); + did = 1; + } + } + } +} +#endif + +void sys_close_midi() +{ + int i; + for (i = 0; i < oss_nmidiin; i++) + close(oss_midiinfd[i]); + for (i = 0; i < oss_nmidiout; i++) + close(oss_midioutfd[i]); + oss_nmidiin = oss_nmidiout = 0; +} + +void sys_listmididevs(void) +{ + /* LATER figure out how to detect MIDI devs */ +} diff --git a/pd/src/s_midi_pm.c b/pd/src/s_midi_pm.c new file mode 100644 index 00000000..afd8ad1a --- /dev/null +++ b/pd/src/s_midi_pm.c @@ -0,0 +1,166 @@ +/* Copyright (c) 1997-2003 Guenter Geiger, Miller Puckette, Larry Troxler, +* Winfried Ritsch, Karl MacMillan, and others. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + + this file calls portmidi to do MIDI I/O for MSW and Mac OSX. + +*/ + +#include "m_pd.h" +#include "s_stuff.h" +#include <stdio.h> +#ifdef UNIX +#include <unistd.h> +#include <sys/time.h> +#include <sys/resource.h> +#endif +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "portaudio.h" +#include "portmidi.h" +#include "porttime.h" +#include "pminternal.h" + +static PmStream *mac_midiindevlist[MAXMIDIINDEV]; +static PmStream *mac_midioutdevlist[MAXMIDIOUTDEV]; +static int mac_nmidiindev; +static int mac_nmidioutdev; + +void sys_open_midi(int nmidiin, int *midiinvec, + int nmidiout, int *midioutvec) +{ + int i = 0; + int n = 0; + PmError err; + + Pt_Start(1, 0, 0); /* start a timer with millisecond accuracy */ + mac_nmidiindev = 0; + + /* protect the unwary from having MIDI inputs open; they're + bad news if you close Pd's terminal window. see sys_nmidiin + in s_main.c too. */ +#ifdef MSW + if (nmidiin) + { + post( + "midi input enabled; warning, don't close the DOS window directly!"); + } + else post("not using MIDI input (use 'pd -midiindev 1' to override)"); +#endif + + for (i = 0; i < nmidiin; i++) + { + if (midiinvec[i] == DEFMIDIDEV) + midiinvec[i] = Pm_GetDefaultInputDeviceID(); + err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev], midiinvec[i], + NULL, 100, NULL, NULL, NULL); + if (err) + post("could not open midi input device number %d: %s", + midiinvec[i], Pm_GetErrorText(err)); + else + { + if (sys_verbose) + post("Midi Input opened.\n"); + mac_nmidiindev++; + } + } + + mac_nmidioutdev = 0; + for (i = 0; i < nmidiout; i++) + { + if (midioutvec[i] == DEFMIDIDEV) + midioutvec[i] = Pm_GetDefaultOutputDeviceID(); + err = Pm_OpenOutput(&mac_midioutdevlist[mac_nmidioutdev], midioutvec[i], + NULL, 0, NULL, NULL, 0); + if (err) + post("could not open midi output device number %d: %s", + midioutvec[i], Pm_GetErrorText(err)); + else + { + if (sys_verbose) + post("Midi Output opened.\n"); + mac_nmidioutdev++; + } + } +} + +void sys_close_midi( void) +{ + int i; + for (i = 0; i < mac_nmidiindev; i++) + Pm_Close(mac_midiindevlist[mac_nmidiindev]); + mac_nmidiindev = 0; + for (i = 0; i < mac_nmidioutdev; i++) + Pm_Close(mac_midioutdevlist[mac_nmidioutdev]); + mac_nmidioutdev = 0; +} + +void sys_putmidimess(int portno, int a, int b, int c) +{ + PmEvent buffer; + fprintf(stderr, "put 1 msg %d %d\n", portno, mac_nmidioutdev); + if (portno >= 0 && portno < mac_nmidioutdev) + { + buffer.message = Pm_Message(a, b, c); + buffer.timestamp = 0; + fprintf(stderr, "put msg\n"); + Pm_Write(mac_midioutdevlist[portno], &buffer, 1); + } +} + +void sys_putmidibyte(int portno, int byte) +{ + post("sorry, no byte-by-byte MIDI output implemented in MAC OSX"); +} + +void sys_poll_midi(void) +{ + int i, nmess; + PmEvent buffer; + for (i = 0; i < mac_nmidiindev; i++) + { + int nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1); + if (nmess > 0) + { + int status = Pm_MessageStatus(buffer.message); + int data1 = Pm_MessageData1(buffer.message); + int data2 = Pm_MessageData2(buffer.message); + int msgtype = (status >> 4) - 8; + switch (msgtype) + { + case 0: + case 1: + case 2: + case 3: + case 6: + sys_midibytein(i, status); + sys_midibytein(i, data1); + sys_midibytein(i, data2); + break; + case 4: + case 5: + sys_midibytein(i, status); + sys_midibytein(i, data1); + break; + case 7: + sys_midibytein(i, status); + break; + } + } + } +} + +void sys_listmididevs(void) /* lifted from pa_devs.c in portaudio */ +{ + int i,j; + for (i = 0; i < Pm_CountDevices(); i++) + { + const PmDeviceInfo *info = Pm_GetDeviceInfo(i); + printf("%d: %s, %s", i, info->interf, info->name); + if (info->input) printf(" (input)"); + if (info->output) printf(" (output)"); + printf("\n"); + } +} diff --git a/pd/src/s_midi_sgi.c b/pd/src/s_midi_sgi.c new file mode 100644 index 00000000..7e58dbe3 --- /dev/null +++ b/pd/src/s_midi_sgi.c @@ -0,0 +1,188 @@ +/* Copyright (c) 1997-1999 Miller Puckette. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "s_stuff.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#ifdef HAVE_BSTRING_H +#include <bstring.h> +#endif +#include <sys/types.h> +#include <sys/time.h> + +#include <dmedia/audio.h> +#include <sys/fpu.h> +#include <dmedia/midi.h> +int mdInit(void); /* prototype was messed up in midi.h */ +/* #include "sys/select.h" */ + + + /* + set the special "flush zero" but (FS, bit 24) in the + Control Status Register of the FPU of R4k and beyond + so that the result of any underflowing operation will + be clamped to zero, and no exception of any kind will + be generated on the CPU. + + thanks to cpirazzi@cp.esd.sgi.com (Chris Pirazzi). + */ + +static void sgi_flush_all_underflows_to_zero(void) +{ + union fpc_csr f; + f.fc_word = get_fpc_csr(); + f.fc_struct.flush = 1; + set_fpc_csr(f.fc_word); +} + +#define NPORT 2 + +static MDport sgi_inport[NPORT]; +static MDport sgi_outport[NPORT]; + +void sgi_open_midi(int midiin, int midiout) +{ + int i; + int sgi_nports = mdInit(); + if (sgi_nports < 0) sgi_nports = 0; + else if (sgi_nports > NPORT) sgi_nports = NPORT; + if (sys_verbose) + { + if (!sgi_nports) + { + post("no serial ports are configured for MIDI;"); + post("if you want to use MIDI, try exiting Pd, typing"); + post("'startmidi -d /dev/ttyd2' to a shell, and restarting Pd."); + } + else if (sgi_nports == 1) + post("Found one MIDI port on %s", mdGetName(0)); + else if (sgi_nports == 2) + post("Found MIDI ports on %s and %s", + mdGetName(0), mdGetName(1)); + } + if (midiin) + { + for (i = 0; i < sgi_nports; i++) + { + if (!(sgi_inport[i] = mdOpenInPort(mdGetName(i)))) + error("MIDI input port %d: open failed", i+1);; + } + } + if (midiout) + { + for (i = 0; i < sgi_nports; i++) + { + if (!(sgi_outport[i] = mdOpenOutPort(mdGetName(i)))) + error("MIDI output port %d: open failed", i+1);; + } + } + return; +} + +void sys_putmidimess(int portno, int a, int b, int c) +{ + MDevent mdv; + if (portno >= NPORT || portno < 0 || !sgi_outport[portno]) return; + mdv.msg[0] = a; + mdv.msg[1] = b; + mdv.msg[2] = c; + mdv.msg[3] = 0; + mdv.sysexmsg = 0; + mdv.stamp = 0; + mdv.msglen = 0; + if (mdSend(sgi_outport[portno], &mdv, 1) < 0) + error("MIDI output error\n"); + post("msg out %d %d %d", a, b, c); +} + +void sys_putmidibyte(int portno, int foo) +{ + error("MIDI raw byte output not available on SGI"); +} + +void inmidi_noteon(int portno, int channel, int pitch, int velo); +void inmidi_controlchange(int portno, int channel, int ctlnumber, int value); +void inmidi_programchange(int portno, int channel, int value); +void inmidi_pitchbend(int portno, int channel, int value); +void inmidi_aftertouch(int portno, int channel, int value); +void inmidi_polyaftertouch(int portno, int channel, int pitch, int value); + +void sys_poll_midi(void) +{ + int i; + MDport *mp; + for (i = 0, mp = sgi_inport; i < NPORT; i++, mp++) + { + int ret, status, b1, b2, nfds; + MDevent mdv; + fd_set inports; + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + if (!*mp) continue; + FD_ZERO(&inports); + FD_SET(mdGetFd(*mp), &inports); + + if (select(mdGetFd(*mp)+1 , &inports, 0, 0, &timeout) < 0) + perror("midi select"); + if (FD_ISSET(mdGetFd(*mp),&inports)) + { + if (mdReceive(*mp, &mdv, 1) < 0) + error("failure receiving message\n"); + else if (mdv.msg[0] == MD_SYSEX) mdFree(mdv.sysexmsg); + + else + { + int status = mdv.msg[0]; + int channel = (status & 0xf) + 1; + int b1 = mdv.msg[1]; + int b2 = mdv.msg[2]; + switch(status & 0xf0) + { + case MD_NOTEOFF: + inmidi_noteon(i, channel, b1, 0); + break; + case MD_NOTEON: + inmidi_noteon(i, channel, b1, b2); + break; + case MD_POLYKEYPRESSURE: + inmidi_polyaftertouch(i, channel, b1, b2); + break; + case MD_CONTROLCHANGE: + inmidi_controlchange(i, channel, b1, b2); + break; + case MD_PITCHBENDCHANGE: + inmidi_pitchbend(i, channel, ((b2 << 7) + b1)); + break; + case MD_PROGRAMCHANGE: + inmidi_programchange(i, channel, b1); + break; + case MD_CHANNELPRESSURE: + inmidi_aftertouch(i, channel, b1); + break; + } + } + } + } +} + +void sys_open_midi(int nmidiin, int *midiinvec, + int nmidiout, int *midioutvec) +{ + sgi_open_midi(nmidiin!=0, nmidiout!=0); +} + + +void sys_close_midi( void) +{ + /* ??? */ +} + +void sys_set_priority(int foo) +{ + fprintf(stderr, + "warning: priority boosting in IRIX not implemented yet\n"); +} diff --git a/pd/src/s_path.c b/pd/src/s_path.c index a61956f1..58d33db7 100644 --- a/pd/src/s_path.c +++ b/pd/src/s_path.c @@ -19,16 +19,18 @@ void readsf_banana( void); /* debugging */ #include <unistd.h> #include <sys/stat.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #endif #include <string.h> +#include "m_pd.h" #include "m_imp.h" +#include "s_stuff.h" #include <stdio.h> #include <fcntl.h> -static t_namelist *pd_path; +static t_namelist *pd_path, *pd_helppath; /* Utility functions */ @@ -51,7 +53,7 @@ static const char* strtokcpy(char *to, const char *from, int delim) /* add a colon-separated list of names to a namelist */ -#ifdef NT +#ifdef MSW #define SEPARATOR ';' #else #define SEPARATOR ':' @@ -110,15 +112,20 @@ void sys_addpath(const char *p) pd_path = namelist_append(pd_path, p); } -#ifdef NT -#define NTOPENFLAG (bin ? _O_BINARY : _O_TEXT) +void sys_addhelppath(const char *p) +{ + pd_helppath = namelist_append(pd_helppath, p); +} + +#ifdef MSW +#define MSWOPENFLAG(bin) (bin ? _O_BINARY : _O_TEXT) #else -#define NTOPENFLAG 0 +#define MSWOPENFLAG(bin) 0 #endif /* search for a file in a specified directory, then along the globally defined search path, using ext as filename extension. Exception: -if the 'name' starts with a slash or a letter, colon, and slash in NT, +if the 'name' starts with a slash or a letter, colon, and slash in MSW, there is no search and instead we just try to open the file literally. The fd is returned, the directory ends up in the "dirresult" which must be at least "size" bytes. "nameresult" is set to point to the filename, which @@ -132,7 +139,7 @@ int open_via_path(const char *dir, const char *name, const char* ext, char listbuf[MAXPDSTRING]; if (name[0] == '/' -#ifdef NT +#ifdef MSW || (name[1] == ':' && name[2] == '/') #endif ) @@ -149,6 +156,7 @@ int open_via_path(const char *dir, const char *name, const char* ext, listbuf[MAXPDSTRING-1] = 0; sys_unbashfilename(listbuf, listbuf); } + for (nl = &thislist; nl; nl = nl->nl_next) { if (strlen(nl->nl_string) + strlen(name) + strlen(ext) + 4 > @@ -163,7 +171,7 @@ int open_via_path(const char *dir, const char *name, const char* ext, DEBUG(post("looking for %s",dirresult)); /* see if we can open the file for reading */ - if ((fd=open(dirresult,O_RDONLY | NTOPENFLAG)) >= 0) + if ((fd=open(dirresult,O_RDONLY | MSWOPENFLAG(bin))) >= 0) { /* in UNIX, further check that it's not a directory */ #ifdef UNIX @@ -204,9 +212,77 @@ int open_via_path(const char *dir, const char *name, const char* ext, return (-1); } -/* Startup file reading for linux */ + /* LATER make this use open_via_path above. */ +void open_via_helppath(const char *name, const char *dir) +{ + t_namelist *nl, thislist, *listp; + int fd = -1; + char dirresult[MAXPDSTRING], realdir[MAXPDSTRING], dirbuf2[MAXPDSTRING], + realname[MAXPDSTRING]; + + /* if directory is supplied, put it at head of search list. */ + if (*dir) + { + thislist.nl_string = dirbuf2; + thislist.nl_next = pd_helppath; + strncpy(dirbuf2, dir, MAXPDSTRING); + dirbuf2[MAXPDSTRING-1] = 0; + sys_unbashfilename(dirbuf2, dirbuf2); + listp = &thislist; + } + else listp = pd_helppath; + strcpy(realname, "help-"); + strncat(realname, name, MAXPDSTRING-5); + realname[MAXPDSTRING-1] = 0; + for (nl = listp; nl; nl = nl->nl_next) + { + strcpy(dirresult, nl->nl_string); + strcpy(realdir,dirresult); + if (*dirresult && dirresult[strlen(dirresult)-1] != '/') + strcat(dirresult, "/"); + strcat(dirresult, realname); + sys_bashfilename(dirresult, dirresult); -#ifdef __linux__ + DEBUG(post("looking for %s",dirresult)); + /* see if we can open the file for reading */ + if ((fd=open(dirresult,O_RDONLY | MSWOPENFLAG(0))) >= 0) + { + /* in UNIX, further check that it's not a directory */ +#ifdef UNIX + struct stat statbuf; + int ok = ((fstat(fd, &statbuf) >= 0) && + !S_ISDIR(statbuf.st_mode)); + if (!ok) + { + if (sys_verbose) post("tried %s; stat failed or directory", + dirresult); + close (fd); + fd = -1; + } + else +#endif + { + char *slash; + if (sys_verbose) post("tried %s and succeeded", dirresult); + sys_unbashfilename(dirresult, dirresult); + close (fd); + glob_evalfile(0, gensym((char*)realname), gensym(realdir)); + return; + } + } + else + { + if (sys_verbose) post("tried %s and failed", dirresult); + } + } + post("sorry, couldn't find help for \"%s\"", name); + return; +} + + +/* Startup file reading for linux and MACOSX */ + +#ifdef UNIX #define STARTUPNAME ".pdrc" #define NUMARGS 1000 @@ -274,6 +350,6 @@ int sys_rcfile(void) } return (0); } -#endif /* __linux__ */ +#endif /* UNIX */ diff --git a/pd/src/s_stuff.h b/pd/src/s_stuff.h new file mode 100644 index 00000000..c8ac47f8 --- /dev/null +++ b/pd/src/s_stuff.h @@ -0,0 +1,179 @@ +/* Copyright (c) 1997-1999 Miller Puckette. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Audio and MIDI I/O, and other scheduling and system stuff. */ + +/* NOTE: this file describes Pd implementation details which may change +in future releases. The public (stable) API is in m_pd.h. */ + +/* in s_file.c */ +typedef struct _namelist +{ + struct _namelist *nl_next; + char *nl_string; +} t_namelist; + +t_namelist *namelist_append(t_namelist *listwas, const char *s); +void namelist_free(t_namelist *listwas); + +/* s_main.c */ +extern int sys_debuglevel; +extern int sys_verbose; +extern int sys_noloadbang; +extern int sys_nogui; +extern char *sys_guicmd; + +EXTERN int sys_nearestfontsize(int fontsize); +EXTERN int sys_hostfontsize(int fontsize); + +extern int sys_defaultfont; +extern t_symbol *sys_libdir; /* library directory for auxilliary files */ + +/* s_loader.c */ +int sys_load_lib(char *dirname, char *filename); + +/* s_audio.c */ + +#define SENDDACS_NO 0 /* return values for sys_send_dacs() */ +#define SENDDACS_YES 1 +#define SENDDACS_SLEPT 2 + +#define DEFDACBLKSIZE 64 +extern int sys_schedblocksize; /* audio block size for scheduler */ +extern int sys_hipriority; /* real-time flag, true if priority boosted */ +extern t_sample *sys_soundout; +extern t_sample *sys_soundin; +extern int sys_inchannels; +extern int sys_outchannels; +extern int sys_advance_samples; /* scheduler advance in samples */ +extern int sys_blocksize; /* audio I/O block size in sample frames */ +extern float sys_dacsr; +extern int sys_schedadvance; +extern int sys_sleepgrain; +void sys_open_audio(int naudioindev, int *audioindev, + int nchindev, int *chindev, + int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, + int srate); /* IOhannes */ +void sys_close_audio(void); + +void sys_open_midi(int nmidiin, int *midiinvec, + int nmidiout, int *midioutvec); +void sys_close_midi(void); + +int sys_send_dacs(void); +void sys_reportidle(void); +void sys_set_priority(int higher); +void sys_audiobuf(int nbufs); +void sys_getmeters(float *inmax, float *outmax); +void sys_listdevs(void); +void sys_setblocksize(int n); + +/* s_midi.c */ +#define MAXMIDIINDEV 16 /* max. number of input ports */ +#define MAXMIDIOUTDEV 16 /* max. number of output ports */ +extern int sys_nmidiin; +extern int sys_nmidiout; +extern int sys_midiindevlist[]; +extern int sys_midioutdevlist[]; + +EXTERN void sys_putmidimess(int portno, int a, int b, int c); +EXTERN void sys_putmidibyte(int portno, int a); +EXTERN void sys_poll_midi(void); +EXTERN void sys_setmiditimediff(double inbuftime, double outbuftime); +EXTERN void sys_midibytein(int portno, int byte); + +/* m_sched.c */ +EXTERN void sys_log_error(int type); +#define ERR_NOTHING 0 +#define ERR_ADCSLEPT 1 +#define ERR_DACSLEPT 2 +#define ERR_RESYNC 3 +#define ERR_DATALATE 4 + +/* s_inter.c */ + +EXTERN void sys_microsleep(int microsec); + +EXTERN void sys_bail(int exitcode); +EXTERN int sys_pollgui(void); + +EXTERN_STRUCT _socketreceiver; +#define t_socketreceiver struct _socketreceiver + +typedef void (*t_socketnotifier)(void *x); +typedef void (*t_socketreceivefn)(void *x, t_binbuf *b); + +EXTERN t_socketreceiver *socketreceiver_new(void *owner, + t_socketnotifier notifier, t_socketreceivefn socketreceivefn, int udp); +EXTERN void socketreceiver_read(t_socketreceiver *x, int fd); +EXTERN void sys_sockerror(char *s); +EXTERN void sys_closesocket(int fd); + +typedef void (*t_fdpollfn)(void *ptr, int fd); +EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); +EXTERN void sys_rmpollfn(int fd); +#ifdef UNIX +void sys_setalarm(int microsec); +void sys_setvirtualalarm( void); +#endif + +#define API_ALSA 1 +#define API_OSS 2 +#define API_MMIO 3 +#define API_PORTAUDIO 4 + +#ifdef __linux__ +#define API_DEFAULT API_OSS +#define API_DEFSTRING "OSS" +#endif +#ifdef MSW +#define API_DEFAULT API_MMIO +#define API_DEFSTRING "MMIO" +#endif +#ifdef MACOSX +#define API_DEFAULT API_PORTAUDIO +#define API_DEFSTRING "portaudio" +#endif +#define DEFAULTAUDIODEV -1 + +#define DEFMIDIDEV -1 + +int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin, + t_sample *soundout, int framesperbuf, int nbuffers, + int indeviceno, int outdeviceno); +void pa_close_audio(void); +int pa_send_dacs(void); +void sys_reportidle(void); +void pa_listdevs(void); + +int oss_open_audio(int naudioindev, int *audioindev, int nchindev, + int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, + int *choutdev, int rate); /* IOhannes */ +void oss_close_audio(void); +int oss_send_dacs(void); +void oss_reportidle(void); +void oss_listdevs(void); + +int alsa_open_audio(int wantinchans, int wantoutchans, int srate); +void alsa_close_audio(void); +int alsa_send_dacs(void); +void alsa_reportidle(void); +void alsa_listdevs(void); + +void mmio_open_audio(int naudioindev, int *audioindev, + int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, + int nchoutdev, int *choutdev, int rate); +void mmio_close_audio( void); +void mmio_reportidle(void); +int mmio_send_dacs(void); +void mmio_listdevs(void); + +void sys_listmididevs(void); +void sys_set_sound_api(int whichapi); +extern int sys_audioapi; + +/* API dependent audio flags and settings */ +void oss_set32bit( void); +void linux_alsa_devname(char *devname); + diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c index a862beda..ff12a284 100644 --- a/pd/src/t_tkcmd.c +++ b/pd/src/t_tkcmd.c @@ -23,17 +23,17 @@ #include <sys/time.h> #include <errno.h> #endif -#ifdef NT +#ifdef MSW #include <winsock.h> #include <io.h> #endif -#ifdef NT +#ifdef MSW #pragma warning( disable : 4305 ) /* uncast const double to float */ #pragma warning( disable : 4244 ) /* uncast double to float */ #pragma warning( disable : 4101 ) /* unused local variables */ #endif -#ifdef NT +#ifdef MSW #include "tk.h" #endif @@ -66,7 +66,7 @@ void pdgui_sethost(char *name) static void pdgui_sockerror(char *s) { -#ifdef NT +#ifdef MSW int err = WSAGetLastError(); #endif #ifdef UNIX @@ -173,7 +173,7 @@ void pdgui_setupsocket(void) #else int retry = 1; #endif -#ifdef NT +#ifdef MSW short version = MAKEWORD(2, 0); WSADATA nobby; @@ -345,16 +345,16 @@ void pdgui_startup(Tcl_Interp *interp) /* add our own TK commands */ - Tcl_CreateCommand(interp, "pd", pdCmd, (ClientData)NULL, + Tcl_CreateCommand(interp, "pd", (Tcl_CmdProc*)pdCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #ifndef UNIX - Tcl_CreateCommand(interp, "pd_pollsocket", pd_pollsocketCmd, + Tcl_CreateCommand(interp, "pd_pollsocket",(Tcl_CmdProc*) pd_pollsocketCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); #endif pdgui_setupsocket(); /* read in the startup file */ -#if !defined(NT) && !defined(MACOSX) +#if !defined(MSW) && !defined(MACOSX) pdgui_evalfile("pd.tk"); #endif } diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index 9af14282..b879843a 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -14,19 +14,26 @@ set pd_nt 0 # # all this changes are labeled with #######iemlib########## +# Tearoff is set to true by default: +set pd_tearoff 1 + if {$pd_nt == 1} { global pd_guidir + global pd_tearoff set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]] regsub -all \\\\ $pd_gui2 / pd_gui3 set pd_guidir $pd_gui3/.. load $pd_guidir/bin/pdtcl + set pd_tearoff 1 } if {$pd_nt == 2} { global pd_guidir + global pd_tearoff set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]] set pd_guidir $pd_gui2/.. load $pd_guidir/bin/pdtcl + set pd_tearoff 0 } # it's unfortunate but we seem to have to turn off global bindings @@ -40,22 +47,27 @@ bind Text <Control-s> {} # puts stderr [bind all] ################## set up main window ######################### -frame .mbar -relief raised -bd 2 -canvas .dummy -height 1c -width 1c +menu .mbar +canvas .dummy -height 2p -width 9c + frame .controls -pack .mbar .controls .dummy -side top -fill x -menubutton .mbar.file -text File -menu .mbar.file.menu -menubutton .mbar.find -text Find -menu .mbar.find.menu -menubutton .mbar.windows -text Windows -menu .mbar.windows.menu -menubutton .mbar.audio -text Audio -menu .mbar.audio.menu -menubutton .mbar.help -text Help -menu .mbar.help.menu -pack .mbar.file .mbar.find .mbar.windows .mbar.audio -side left -pack .mbar.help -side right -menu .mbar.file.menu -menu .mbar.find.menu -menu .mbar.windows.menu -postcommand [concat pdtk_fixwindowmenu] -menu .mbar.audio.menu -menu .mbar.help.menu +pack .controls .dummy -side top -fill x +menu .mbar.file -tearoff $pd_tearoff +.mbar add cascade -label "File" -menu .mbar.file +menu .mbar.find -tearoff $pd_tearoff +.mbar add cascade -label "Find" -menu .mbar.find +menu .mbar.windows -postcommand [concat pdtk_fixwindowmenu] -tearoff $pd_tearoff +menu .mbar.audio -tearoff $pd_tearoff +if {$pd_nt != 2} { + .mbar add cascade -label "Windows" -menu .mbar.windows + .mbar add cascade -label "Audio" -menu .mbar.audio +} else { +# Perhaps this is silly, but Mac HIG want "Window Help" as the last menus + .mbar add cascade -label "Audio" -menu .mbar.audio + .mbar add cascade -label "Window" -menu .mbar.windows +} +menu .mbar.help -tearoff $pd_tearoff +.mbar add cascade -label "Help" -menu .mbar.help set ctrls_audio_on 0 set ctrls_meter_on 0 @@ -75,28 +87,34 @@ checkbutton .controls.switches.meterbutton -text {peak meters} \ pack .controls.switches.meterbutton .controls.switches.audiobutton -side left -frame .controls.in -label .controls.in.label -text IN -entry .controls.in.level -textvariable ctrls_inlevel -width 3 -button .controls.in.clip -text {CLIP} -state disabled -pack .controls.in.label .controls.in.level .controls.in.clip -side top - -frame .controls.out -label .controls.out.label -text OUT -entry .controls.out.level -textvariable ctrls_outlevel -width 3 -button .controls.out.clip -text {CLIP} -state disabled -pack .controls.out.label .controls.out.level .controls.out.clip -side top +frame .controls.inout +frame .controls.inout.in +label .controls.inout.in.label -text IN +entry .controls.inout.in.level -textvariable ctrls_inlevel -width 3 +button .controls.inout.in.clip -text {CLIP} -state disabled +pack .controls.inout.in.label .controls.inout.in.level \ + .controls.inout.in.clip -side top -pady 2 + +frame .controls.inout.out +label .controls.inout.out.label -text OUT +entry .controls.inout.out.level -textvariable ctrls_outlevel -width 3 +button .controls.inout.out.clip -text {CLIP} -state disabled +pack .controls.inout.out.label .controls.inout.out.level \ + .controls.inout.out.clip -side top -pady 2 button .controls.dio -text "DIO\nerrors" \ -command {pd [concat pd audiostatus \;]} -pack .controls.switches -side bottom -pack .controls.in .controls.out -side left -pack .controls.dio -side right +pack .controls.switches -side bottom -pady 12 +pack .controls.inout.in .controls.inout.out -side left -padx 6 +pack .controls.inout -side left -padx 14 +pack .controls.dio -side right -padx 20 bind . <Control-Key> {pdtk_pd_ctrlkey %W %K 0} bind . <Control-Shift-Key> {pdtk_pd_ctrlkey %W %K 1} +wm title . "Pd" +. configure -menu .mbar -width 200 -height 150 ############### set up global variables ################################ @@ -136,13 +154,33 @@ set menu_windowlist {} proc pdtk_fixwindowmenu {} { global menu_windowlist - .mbar.windows.menu delete 0 end + .mbar.windows delete 0 end foreach i $menu_windowlist { - .mbar.windows.menu add command -label [lindex $i 0] \ + .mbar.windows add command -label [lindex $i 0] \ -command [concat menu_domenuwindow [lindex $i 1]] + menu_fixwindowmenu [lindex $i 1] + } +} + +####### Odd little function to make better Mac accelerators ##### + +proc accel_munge {acc} { + global pd_nt + + if {$pd_nt == 2} { + if [string is upper [string index $acc end]] { + return [format "%s%s" "Shift+" \ + [string toupper [string map {Ctrl Meta} $acc] end]] + } else { + return [string toupper [string map {Ctrl Meta} $acc] end] + } + } else { + return $acc } } + + ############### the "New" menu command ######################## proc menu_new {} { global untitled_number @@ -248,6 +286,10 @@ proc menu_documentation {} { exec sh -c \ [format "mozilla file:%s || netscape file:%s &\n" \ $filename $filename] + } elseif {$pd_nt == 2} { + puts stderr [format "open %s" $filename] + exec sh -c \ + [format "open %s" $filename] } else { tk_messageBox -message \ {sorry -- can't open htm files yet; open this manually} \ @@ -278,33 +320,35 @@ proc menu_doc_open {subdir basename} { } #################### the "File" menu for the Pd window ############## -.mbar.file.menu add command -label New -command {menu_new} \ - -accelerator "Ctrl+n" -.mbar.file.menu add command -label Open -command {menu_open} \ - -accelerator "Ctrl+o" -.mbar.file.menu add command -label Message -command {menu_send} \ - -accelerator "Ctrl+m" -.mbar.file.menu add separator -.mbar.file.menu add command -label Quit -command {menu_quit} \ - -accelerator "Ctrl+q" + +.mbar.file add command -label New -command {menu_new} \ + -accelerator [accel_munge "Ctrl+n"] +.mbar.file add command -label Open -command {menu_open} \ + -accelerator [accel_munge "Ctrl+o"] +.mbar.file add separator +.mbar.file add command -label Message -command {menu_send} \ + -accelerator [accel_munge "Ctrl+m"] +.mbar.file add separator +.mbar.file add command -label Quit -command {menu_quit} \ + -accelerator [accel_munge "Ctrl+q"] #################### the "Find" menu for the Pd window ############## -.mbar.find.menu add command -label {last error?} -command {menu_finderror} +.mbar.find add command -label {last error?} -command {menu_finderror} #################### the "Audio" menu for the Pd window ############## -.mbar.audio.menu add command -label On -accelerator "Ctrl+/" \ +.mbar.audio add command -label On -accelerator [accel_munge "Ctrl+/"] \ -command {menu_audio 1} -.mbar.audio.menu add command -label Off -accelerator "Ctrl+." \ +.mbar.audio add command -label Off -accelerator [accel_munge "Ctrl+."] \ -command {menu_audio 0} #################### the "Help" menu for the Pd window ############## -.mbar.help.menu add command -label {About Pd} \ +.mbar.help add command -label {About Pd} \ -command {menu_doc_open doc/1.manual 1.introduction.txt} -.mbar.help.menu add command -label {Test Audio and MIDI} \ +.mbar.help add command -label {Test Audio and MIDI} \ -command {menu_doc_open doc/7.stuff/tools testtone.pd} -.mbar.help.menu add command -label {Load Meter} \ +.mbar.help add command -label {Load Meter} \ -command {menu_doc_open doc/7.stuff/tools load-meter.pd} -.mbar.help.menu add command -label {Pure Documentation...} \ +.mbar.help add command -label {Pure Documentation...} \ -command {menu_documentation} ########### functions for menu functions on document windows ######## @@ -320,7 +364,13 @@ proc menu_saveas {name} { } proc menu_print {name} { - $name.c postscript -file x.ps + set filename [tk_getSaveFile -initialfile pd.ps \ + -defaultextension .ps \ + -filetypes { {{postscript} {.ps}} }] + + if {$filename != ""} { + $name.c postscript -file $filename + } } proc menu_close {name} { @@ -456,15 +506,16 @@ proc menu_fixeditmenu {name} { global pd_undocanvas # puts stderr [concat menu_fixeditmenu $name $pd_undocanvas $pd_undoaction] if {$name == $pd_undocanvas && $pd_undoaction != "no"} { - $name.m.edit.m entryconfigure "Undo*" -state normal \ + $name.m.edit entryconfigure "Undo*" -state normal \ -label [concat "Undo " $pd_undoaction] } else { - $name.m.edit.m entryconfigure "Undo*" -state disabled -label "Undo" + $name.m.edit entryconfigure "Undo*" -state disabled -label "Undo" } if {$name == $pd_undocanvas && $pd_redoaction != "no"} { - $name.m.edit.m entryconfigure "Redo" -state normal + $name.m.edit entryconfigure "Redo*" -state normal\ + -label [concat "Redo " $pd_redoaction] } else { - $name.m.edit.m entryconfigure "Redo" -state disabled + $name.m.edit entryconfigure "Redo*" -state disabled } } @@ -477,6 +528,10 @@ proc pdtk_undomenu {name undoaction redoaction} { set pd_undocanvas $name set pd_undoaction $undoaction set pd_redoaction $redoaction + if {$name != "nobody"} { +# unpleasant way of avoiding a more unpleasant bug situation --atl 2002.11.25 + menu_fixeditmenu $name + } } proc menu_windowparent {name} { @@ -497,10 +552,15 @@ proc menu_domenuwindow {i} { proc menu_fixwindowmenu {name} { global menu_windowlist - $name.m.windows.m add command - $name.m.windows.m delete 4 end + global pd_tearoff + $name.m.windows add command + if $pd_tearoff { + $name.m.windows delete 4 end + } else { + $name.m.windows delete 3 end + } foreach i $menu_windowlist { - $name.m.windows.m add command -label [lindex $i 0] \ + $name.m.windows add command -label [lindex $i 0] \ -command [concat menu_domenuwindow [lindex $i 1]] } } @@ -564,9 +624,10 @@ proc menu_findobject {canvas} { ############# pdtk_canvas_new -- create a new canvas ############### proc pdtk_canvas_new {name width height geometry editable} { global pd_opendir - - toplevel $name - frame $name.m -relief raised -bd 2 + global pd_tearoff + global pd_nt + + toplevel $name -menu $name.m # puts stderr [concat geometry: $geometry] wm geometry $name $geometry canvas $name.c -width $width -height $height -background white \ @@ -578,7 +639,6 @@ proc pdtk_canvas_new {name width height geometry editable} { scrollbar $name.scrollhort -command "$name.c xview" \ -orient horizontal - pack $name.m -side top -fill x pack $name.scrollhort -side bottom -fill x pack $name.scrollvert -side right -fill y pack $name.c -side left -expand 1 -fill both @@ -586,209 +646,222 @@ proc pdtk_canvas_new {name width height geometry editable} { wm geometry $name $geometry # the file menu - menubutton $name.m.file -text File -menu $name.m.file.m - pack $name.m.file -side left - menu $name.m.file.m - - $name.m.file.m add command -label New -command {menu_new} \ - -accelerator "Ctrl+n" + menu $name.m + menu $name.m.file -tearoff $pd_tearoff + $name.m add cascade -label File -menu $name.m.file - $name.m.file.m add command -label Open -command {menu_open} \ - -accelerator "Ctrl+o" + $name.m.file add command -label New -command {menu_new} \ + -accelerator [accel_munge "Ctrl+n"] - $name.m.file.m add command -label Message -command {menu_send} \ - -accelerator "Ctrl+m" + $name.m.file add command -label Open -command {menu_open} \ + -accelerator [accel_munge "Ctrl+o"] - $name.m.file.m add separator - $name.m.file.m add command -label Save -command [concat menu_save $name] \ - -accelerator "Ctrl+s" + $name.m.file add separator + $name.m.file add command -label Message -command {menu_send} \ + -accelerator [accel_munge "Ctrl+m"] - $name.m.file.m add command -label Close \ + $name.m.file add separator + $name.m.file add command -label Close \ -command [concat menu_close $name] \ - -accelerator "Ctrl+w" + -accelerator [accel_munge "Ctrl+w"] + + $name.m.file add command -label Save -command [concat menu_save $name] \ + -accelerator [accel_munge "Ctrl+s"] - $name.m.file.m add command -label "Save as..." \ + $name.m.file add command -label "Save as..." \ -command [concat menu_saveas $name] \ - -accelerator "Ctrl+S" + -accelerator [accel_munge "Ctrl+S"] - $name.m.file.m add command -label Print -command [concat menu_print $name] \ - -accelerator "Ctrl+p" + $name.m.file add command -label Print -command [concat menu_print $name] \ + -accelerator [accel_munge "Ctrl+p"] - $name.m.file.m add separator + $name.m.file add separator - $name.m.file.m add command -label Quit -command {menu_quit} \ - -accelerator "Ctrl+q" + $name.m.file add command -label Quit -command {menu_quit} \ + -accelerator [accel_munge "Ctrl+q"] # the edit menu - menubutton $name.m.edit -text Edit -menu $name.m.edit.m - pack $name.m.edit -side left - menu $name.m.edit.m -postcommand [concat menu_fixeditmenu $name] + menu $name.m.edit -postcommand [concat menu_fixeditmenu $name] -tearoff $pd_tearoff + $name.m add cascade -label Edit -menu $name.m.edit - $name.m.edit.m add command -label Undo -command [concat menu_undo $name] \ - -accelerator "Ctrl+z" + $name.m.edit add command -label Undo -command [concat menu_undo $name] \ + -accelerator [accel_munge "Ctrl+z"] - $name.m.edit.m add command -label Redo -command [concat menu_redo $name] \ - -accelerator "Ctrl+Z" + $name.m.edit add command -label Redo -command [concat menu_redo $name] \ + -accelerator [accel_munge "Ctrl+Z"] - $name.m.edit.m add separator + $name.m.edit add separator - $name.m.edit.m add command -label Cut -command [concat menu_cut $name] \ - -accelerator "Ctrl+x" + $name.m.edit add command -label Cut -command [concat menu_cut $name] \ + -accelerator [accel_munge "Ctrl+x"] - $name.m.edit.m add command -label Copy -command [concat menu_copy $name] \ - -accelerator "Ctrl+c" + $name.m.edit add command -label Copy -command [concat menu_copy $name] \ + -accelerator [accel_munge "Ctrl+c"] - $name.m.edit.m add command -label Paste \ + $name.m.edit add command -label Paste \ -command [concat menu_paste $name] \ - -accelerator "Ctrl+v" + -accelerator [accel_munge "Ctrl+v"] - $name.m.edit.m add command -label Duplicate \ + $name.m.edit add command -label Duplicate \ -command [concat menu_duplicate $name] \ - -accelerator "Ctrl+d" + -accelerator [accel_munge "Ctrl+d"] - $name.m.edit.m add command -label {Select all} \ + $name.m.edit add command -label {Select all} \ -command [concat menu_selectall $name] \ - -accelerator "Ctrl+a" + -accelerator [accel_munge "Ctrl+a"] - $name.m.edit.m add command -label {Text Editor} \ + $name.m.edit add separator + + $name.m.edit add command -label {Text Editor} \ -command [concat menu_texteditor $name] \ - -accelerator "Ctrl+t" + -accelerator [accel_munge "Ctrl+t"] - $name.m.edit.m add command -label Font \ + $name.m.edit add command -label Font \ -command [concat menu_font $name] - $name.m.edit.m add command -label {Tidy Up} \ + $name.m.edit add command -label {Tidy Up} \ -command [concat menu_tidyup $name] - $name.m.edit.m add separator + $name.m.edit add separator ############iemlib################## # instead of "red = #BC3C60" we take "grey85", so there is no difference, # if widget is selected or not. - $name.m.edit.m add checkbutton -label "Edit mode" \ + $name.m.edit add checkbutton -label "Edit mode" \ -indicatoron true -selectcolor grey85 \ -command [concat menu_editmode $name] \ - -accelerator "Ctrl+e" + -accelerator [accel_munge "Ctrl+e"] if { $editable == 0 } { - $name.m.edit.m entryconfigure "Edit mode" -indicatoron false } + $name.m.edit entryconfigure "Edit mode" -indicatoron false } ############iemlib################## # the put menu - menubutton $name.m.put -text Put -menu $name.m.put.m - pack $name.m.put -side left - menu $name.m.put.m + menu $name.m.put -tearoff $pd_tearoff + $name.m add cascade -label Put -menu $name.m.put - $name.m.put.m add command -label Object \ + $name.m.put add command -label Object \ -command [concat menu_object $name 0] \ - -accelerator "Ctrl+1" + -accelerator [accel_munge "Ctrl+1"] - $name.m.put.m add command -label Message \ + $name.m.put add command -label Message \ -command [concat menu_message $name 0] \ - -accelerator "Ctrl+2" + -accelerator [accel_munge "Ctrl+2"] - $name.m.put.m add command -label Number \ + $name.m.put add command -label Number \ -command [concat menu_floatatom $name 0] \ - -accelerator "Ctrl+3" + -accelerator [accel_munge "Ctrl+3"] - $name.m.put.m add command -label Symbol \ + $name.m.put add command -label Symbol \ -command [concat menu_symbolatom $name 0] \ - -accelerator "Ctrl+4" + -accelerator [accel_munge "Ctrl+4"] - $name.m.put.m add command -label Comment \ + $name.m.put add command -label Comment \ -command [concat menu_comment $name 0] \ - -accelerator "Ctrl+5" + -accelerator [accel_munge "Ctrl+5"] + + $name.m.put add separator ############iemlib################## - $name.m.put.m add command -label Bang \ + $name.m.put add command -label Bang \ -command [concat menu_bng $name 0] \ - -accelerator "Alt+b" + -accelerator [accel_munge "Alt+b"] - $name.m.put.m add command -label Toggle \ + $name.m.put add command -label Toggle \ -command [concat menu_toggle $name 0] \ - -accelerator "Alt+t" + -accelerator [accel_munge "Alt+t"] - $name.m.put.m add command -label Number2 \ + $name.m.put add command -label Number2 \ -command [concat menu_numbox $name 0] \ - -accelerator "Alt+n" + -accelerator [accel_munge "Alt+n"] - $name.m.put.m add command -label Vslider \ + $name.m.put add command -label Vslider \ -command [concat menu_vslider $name 0] \ - -accelerator "Alt+v" + -accelerator [accel_munge "Alt+v"] - $name.m.put.m add command -label Hslider \ + $name.m.put add command -label Hslider \ -command [concat menu_hslider $name 0] \ - -accelerator "Alt+h" + -accelerator [accel_munge "Alt+h"] - $name.m.put.m add command -label Vradio \ + $name.m.put add command -label Vradio \ -command [concat menu_vradio $name 0] \ - -accelerator "Alt+d" + -accelerator [accel_munge "Alt+d"] - $name.m.put.m add command -label Hradio \ + $name.m.put add command -label Hradio \ -command [concat menu_hradio $name 0] \ - -accelerator "Alt+i" + -accelerator [accel_munge "Alt+i"] - $name.m.put.m add command -label VU \ + $name.m.put add command -label VU \ -command [concat menu_vumeter $name 0] \ - -accelerator "Alt+u" + -accelerator [accel_munge "Alt+u"] - $name.m.put.m add command -label Canvas \ + $name.m.put add command -label Canvas \ -command [concat menu_mycnv $name 0] \ - -accelerator "Alt+c" + -accelerator [accel_munge "Alt+c"] ############iemlib################## - $name.m.put.m add command -label Graph \ + $name.m.put add separator + + $name.m.put add command -label Graph \ -command [concat menu_graph $name] - $name.m.put.m add command -label Array \ + $name.m.put add command -label Array \ -command [concat menu_array $name] # the find menu - menubutton $name.m.find -text Find -menu $name.m.find.m - pack $name.m.find -side left - menu $name.m.find.m - $name.m.find.m add command -label {Find...} -accelerator "Ctrl+f" \ + menu $name.m.find -tearoff $pd_tearoff + $name.m add cascade -label Find -menu $name.m.find + + $name.m.find add command -label {Find...} \ + -accelerator [accel_munge "Ctrl+f"] \ -command [concat menu_findobject $name] - $name.m.find.m add command -label {Find Again} -accelerator "Ctrl+g" \ + $name.m.find add command -label {Find Again} \ + -accelerator [accel_munge "Ctrl+g"] \ -command [concat menu_findagain $name] - $name.m.find.m add command -label {Find last error} \ + $name.m.find add command -label {Find last error} \ -command [concat menu_finderror] # the window menu - menubutton $name.m.windows -text Windows -menu $name.m.windows.m - pack $name.m.windows -side left - menu $name.m.windows.m -postcommand [concat menu_fixwindowmenu $name] - $name.m.windows.m add command -label {parent window}\ + menu $name.m.windows -postcommand [concat menu_fixwindowmenu $name] \ + -tearoff $pd_tearoff + + $name.m.windows add command -label {parent window}\ -command [concat menu_windowparent $name] - $name.m.windows.m add command -label {Pd window} -command menu_pop_pd - $name.m.windows.m add separator + $name.m.windows add command -label {Pd window} -command menu_pop_pd + $name.m.windows add separator # the audio menu - menubutton $name.m.audio -text Audio -menu $name.m.audio.m - pack $name.m.audio -side left - menu $name.m.audio.m - $name.m.audio.m add command -label On -accelerator "Ctrl+/" \ + menu $name.m.audio -tearoff $pd_tearoff + + $name.m.audio add command -label On -accelerator [accel_munge "Ctrl+/"] \ -command {menu_audio 1} - $name.m.audio.m add command -label Off -accelerator "Ctrl+." \ + $name.m.audio add command -label Off -accelerator [accel_munge "Ctrl+."] \ -command {menu_audio 0} + if {$pd_nt != 2} { + $name.m add cascade -label Windows -menu $name.m.windows + $name.m add cascade -label Audio -menu $name.m.audio + } else { + $name.m add cascade -label Audio -menu $name.m.audio + $name.m add cascade -label Window -menu $name.m.windows + } + # the help menu - menubutton $name.m.help -text Help -menu $name.m.help.m - pack $name.m.help -side right - menu $name.m.help.m - $name.m.help.m add command -label {Getting Started} \ + menu $name.m.help -tearoff $pd_tearoff + $name.m add cascade -label Help -menu $name.m.help + $name.m.help add command -label {Getting Started} \ -command {menu_doc_open doc/1.manual 1.introduction.txt} - $name.m.help.m add command -label {Test Audio and MIDI} \ + $name.m.help add command -label {Test Audio and MIDI} \ -command {menu_doc_open doc/7.stuff/tools testtone.pd} - $name.m.help.m add command -label {Load Meter} \ + $name.m.help add command -label {Load Meter} \ -command {menu_doc_open doc/7.stuff/tools load-meter.pd} - $name.m.help.m add command -label {Pure Documentation} \ + $name.m.help add command -label {Pure Documentation} \ -command {menu_documentation} # the popup menu @@ -813,13 +886,20 @@ proc pdtk_canvas_new {name width height geometry editable} { bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0} bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1} - bind $name.c <Control-Button> {pdtk_canvas_click %W %x %y %b 2} bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3} bind $name.c <Alt-Button> {pdtk_canvas_click %W %x %y %b 4} bind $name.c <Alt-Shift-Button> {pdtk_canvas_click %W %x %y %b 5} bind $name.c <Alt-Control-Button> {pdtk_canvas_click %W %x %y %b 6} bind $name.c <Alt-Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 7} - bind $name.c <Button-3> {pdtk_canvas_click %W %x %y %b 8} + global pd_nt + if {$pd_nt == 2} { + bind $name.c <Button-2> {pdtk_canvas_click %W %x %y %b 8} + bind $name.c <Control-Button> {pdtk_canvas_click %W %x %y %b 8} + } else { + bind $name.c <Button-3> {pdtk_canvas_click %W %x %y %b 8} + bind $name.c <Control-Button> {pdtk_canvas_click %W %x %y %b 2} + } +# change mac to right-click, not middle click -atl 2002.09.02 bind $name.c <ButtonRelease> {pdtk_canvas_mouseup %W %x %y %b} bind $name.c <Control-Key> {pdtk_canvas_ctrlkey %W %K 0} @@ -2460,9 +2540,9 @@ proc pdtk_data_dialog {name stuff} { #####################iemlib####################### proc pdtk_canvas_editval {name value} { if { $value } { - $name.m.edit.m entryconfigure "Edit mode" -indicatoron true + $name.m.edit entryconfigure "Edit mode" -indicatoron true } else { - $name.m.edit.m entryconfigure "Edit mode" -indicatoron false + $name.m.edit entryconfigure "Edit mode" -indicatoron false } } #####################iemlib####################### @@ -2551,15 +2631,15 @@ proc pdtk_pd_meters {indb outdb inclip outclip} { global ctrls_inlevel ctrls_outlevel set ctrls_inlevel $indb if {$inclip == 1} { - .controls.in.clip configure -background red + .controls.inout.in.clip configure -background red } else { - .controls.in.clip configure -background grey + .controls.inout.in.clip configure -background grey } set ctrls_outlevel $outdb if {$outclip == 1} { - .controls.out.clip configure -background red + .controls.inout.out.clip configure -background red } else { - .controls.out.clip configure -background grey + .controls.inout.out.clip configure -background grey } } diff --git a/pd/src/u_pdreceive.c b/pd/src/u_pdreceive.c index c01be01c..ad71f506 100644 --- a/pd/src/u_pdreceive.c +++ b/pd/src/u_pdreceive.c @@ -47,7 +47,7 @@ int main(int argc, char **argv) int portno; struct sockaddr_in server; int nretry = 10; -#ifdef NT +#ifdef MSW short version = MAKEWORD(2, 0); WSADATA nobby; #endif @@ -62,7 +62,7 @@ int main(int argc, char **argv) else goto usage; } else protocol = SOCK_STREAM; -#ifdef NT +#ifdef MSW if (WSAStartup(version, &nobby)) sockerror("WSAstartup"); #endif sockfd = socket(AF_INET, protocol, 0); @@ -77,7 +77,7 @@ int main(int argc, char **argv) #ifdef IRIX /* this seems to work only in IRIX but is unnecessary in - Linux. Not sure what NT needs in place of this. */ + Linux. Not sure what MSW needs in place of this. */ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, 0, 0) < 0) post("setsockopt failed\n"); #endif @@ -299,7 +299,7 @@ static void dopoll(void) static void sockerror(char *s) { -#ifdef NT +#ifdef MSW int err = WSAGetLastError(); if (err == 10054) return; else if (err == 10044) @@ -319,7 +319,7 @@ static void x_closesocket(int fd) #ifdef UNIX close(fd); #endif -#ifdef NT +#ifdef MSW closesocket(fd); #endif } diff --git a/pd/src/u_pdsend.c b/pd/src/u_pdsend.c index 896c5646..de9488b0 100644 --- a/pd/src/u_pdsend.c +++ b/pd/src/u_pdsend.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) struct hostent *hp; char *hostname; int nretry = 10; -#ifdef NT +#ifdef MSW short version = MAKEWORD(2, 0); WSADATA nobby; #endif @@ -49,7 +49,7 @@ int main(int argc, char **argv) else goto usage; } else protocol = SOCK_STREAM; -#ifdef NT +#ifdef MSW if (WSAStartup(version, &nobby)) sockerror("WSAstartup"); #endif @@ -131,7 +131,7 @@ usage: void sockerror(char *s) { -#ifdef NT +#ifdef MSW int err = WSAGetLastError(); if (err == 10054) return; else if (err == 10044) @@ -151,7 +151,7 @@ void x_closesocket(int fd) #ifdef UNIX close(fd); #endif -#ifdef NT +#ifdef MSW closesocket(fd); #endif } diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c index f975f542..b7a94a2d 100644 --- a/pd/src/x_arithmetic.c +++ b/pd/src/x_arithmetic.c @@ -10,8 +10,8 @@ inputs to int and their outputs back to float. */ #include <math.h> -/* NT and OSX don't appear to have single-precision ANSI math */ -#if defined(NT) || defined(MACOSX) +/* MSW and OSX don't appear to have single-precision ANSI math */ +#if defined(MSW) || defined(MACOSX) #define sinf sin #define cosf cos #define atanf atan @@ -636,7 +636,7 @@ static void *exp_new(void) static void exp_float(t_object *x, t_float f) { float g; -#ifdef NT +#ifdef MSW char buf[10]; #endif if (f > MAXLOG) f = MAXLOG; @@ -665,7 +665,6 @@ static t_class *clip_class; typedef struct _clip { t_object x_ob; - t_outlet *x_out2; float x_f1; float x_f2; } t_clip; @@ -676,7 +675,6 @@ static void *clip_new(t_floatarg f1, t_floatarg f2) floatinlet_new(&x->x_ob, &x->x_f1); floatinlet_new(&x->x_ob, &x->x_f2); outlet_new(&x->x_ob, &s_float); - x->x_out2 = outlet_new(&x->x_ob, &s_float); x->x_f1 = f1; x->x_f2 = f2; return (x); diff --git a/pd/src/x_midi.c b/pd/src/x_midi.c index f7d6529f..7eac1108 100644 --- a/pd/src/x_midi.c +++ b/pd/src/x_midi.c @@ -611,8 +611,8 @@ static void *midirealtimein_new( void) x->x_outlet1 = outlet_new(&x->x_obj, &s_float); x->x_outlet2 = outlet_new(&x->x_obj, &s_float); pd_bind(&x->x_obj.ob_pd, midirealtimein_sym); -#ifndef NT - pd_error(x, "midirealtimein: works under NT only"); +#ifndef MSW + pd_error(x, "midirealtimein: works under MSW only"); #endif return (x); } diff --git a/pd/src/x_misc.c b/pd/src/x_misc.c index 8ba5191f..cd9771b0 100644 --- a/pd/src/x_misc.c +++ b/pd/src/x_misc.c @@ -4,7 +4,8 @@ /* misc. */ -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" #include <math.h> #include <stdio.h> #include <string.h> @@ -14,7 +15,7 @@ #include <sys/times.h> #include <sys/param.h> #endif -#ifdef NT +#ifdef MSW #include <wtypes.h> #include <time.h> #endif @@ -140,7 +141,7 @@ static void namecanvas_setup(void) sizeof(t_namecanvas), CLASS_NOINLET, A_DEFSYM, 0); } -/* ---------------serial ports (NT only -- hack) ------------------------- */ +/* ---------------serial ports (MSW only -- hack) ------------------------- */ #define MAXSERIAL 100 static t_class *serial_class; @@ -192,7 +193,7 @@ typedef struct _cputime #ifdef UNIX struct tms x_setcputime; #endif -#ifdef NT +#ifdef MSW LARGE_INTEGER x_kerneltime; LARGE_INTEGER x_usertime; int x_warned; @@ -204,7 +205,7 @@ static void cputime_bang(t_cputime *x) #ifdef UNIX times(&x->x_setcputime); #endif -#ifdef NT +#ifdef MSW FILETIME ignorethis, ignorethat; BOOL retval; retval = GetProcessTimes(GetCurrentProcess(), &ignorethis, &ignorethat, @@ -231,7 +232,7 @@ static void cputime_bang2(t_cputime *x) x->x_setcputime.tms_utime - x->x_setcputime.tms_stime) / HZ; outlet_float(x->x_obj.ob_outlet, elapsedcpu); #endif -#ifdef NT +#ifdef MSW float elapsedcpu; FILETIME ignorethis, ignorethat; LARGE_INTEGER usertime, kerneltime; @@ -254,7 +255,7 @@ static void *cputime_new(void) outlet_new(&x->x_obj, gensym("float")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("bang"), gensym("bang2")); -#ifdef NT +#ifdef MSW x->x_warned = 0; #endif cputime_bang(x); diff --git a/pd/src/x_net.c b/pd/src/x_net.c index d14538e7..416b5bc6 100644 --- a/pd/src/x_net.c +++ b/pd/src/x_net.c @@ -4,7 +4,8 @@ /* network */ -#include "m_imp.h" +#include "m_pd.h" +#include "s_stuff.h" #include <sys/types.h> #include <string.h> diff --git a/pd/src/x_qlist.c b/pd/src/x_qlist.c index 922cfe12..7dbec5e7 100644 --- a/pd/src/x_qlist.c +++ b/pd/src/x_qlist.c @@ -7,7 +7,7 @@ #ifdef UNIX #include <unistd.h> #endif -#ifdef NT +#ifdef MSW #include <io.h> #endif |