diff --git a/configure b/configure index e817c5614..af01816fc 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for wsjt 0.9. # -# $Id: configure.ac 74 2006-01-10 04:30:03Z va3db $ +# $Id: configure.ac 75 2006-01-10 05:00:34Z va3db $ # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. @@ -924,7 +924,7 @@ Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -$Id: configure.ac 74 2006-01-10 04:30:03Z va3db $ +$Id: configure.ac 75 2006-01-10 05:00:34Z va3db $ _ACEOF exit 0 fi @@ -3977,6 +3977,114 @@ else fi +if test "${ac_cv_header_samplerate_h+set}" = set; then + echo "$as_me:$LINENO: checking for samplerate.h" >&5 +echo $ECHO_N "checking for samplerate.h... $ECHO_C" >&6 +if test "${ac_cv_header_samplerate_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_samplerate_h" >&5 +echo "${ECHO_T}$ac_cv_header_samplerate_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking samplerate.h usability" >&5 +echo $ECHO_N "checking samplerate.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include +_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 samplerate.h presence" >&5 +echo $ECHO_N "checking samplerate.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +_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_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&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: samplerate.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: samplerate.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: samplerate.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: samplerate.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: samplerate.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: samplerate.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: samplerate.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: samplerate.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: samplerate.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: samplerate.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for samplerate.h" >&5 +echo $ECHO_N "checking for samplerate.h... $ECHO_C" >&6 +if test "${ac_cv_header_samplerate_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_samplerate_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_samplerate_h" >&5 +echo "${ECHO_T}$ac_cv_header_samplerate_h" >&6 + +fi +if test $ac_cv_header_samplerate_h = yes; then + HAS_SAMPLERATE_H=1 +else + HAS_SAMPLERATE_H=0 +fi + + echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5 echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6 @@ -5661,6 +5769,27 @@ _ACEOF fi +if test $HAS_SAMPLERATE_H -eq 1; then + cat >>confdefs.h <<\_ACEOF +#define HAS_SAMPLERATE_H 1 +_ACEOF + +fi + + +if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then + if test $HAS_PORTAUDIO_H -eq 1; then + set portaudio = yes; + echo "$as_me:$LINENO: result: Using portaudio" >&5 +echo "${ECHO_T}Using portaudio" >&6 + elif test $HAS_ASOUNDLIB_H -eq 1; then + set alsa = yes; + echo "$as_me:$LINENO: result: Using alsa" >&5 +echo "${ECHO_T}Using alsa" >&6 + fi +fi + + if test "$alsa" = yes; then if test $HAS_ASOUNDLIB_H -eq 0; then { { echo "$as_me:$LINENO: error: You need asoundlib.h to use --enable-alsa" >&5 @@ -5681,16 +5810,24 @@ if test "$portaudio" = yes; then if test $HAS_PORTAUDIO_H -eq 0; then { { echo "$as_me:$LINENO: error: You need portaudio.h to use --enable-portaudio" >&5 echo "$as_me: error: You need portaudio.h to use --enable-portaudio" >&2;} + { (exit 1); exit 1; }; } + fi + if test $HAS_SAMPLERATE_H -eq 0; then + { { echo "$as_me:$LINENO: error: You need samplerate.h to use --enable-portaudio" >&5 +echo "$as_me: error: You need samplerate.h to use --enable-portaudio" >&2;} { (exit 1); exit 1; }; } fi fi + CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" + + 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 diff --git a/configure.ac b/configure.ac index fec6be215..182626409 100644 --- a/configure.ac +++ b/configure.ac @@ -102,6 +102,7 @@ AC_CHECK_HEADERS([inttypes.h stdint.h sys/resource.h sys/param.h errno.h sys/sys AC_CHECK_HEADER([sys/soundcard.h], [HAS_SOUNDCARD_H=1], [HAS_SOUNDCARD_H=0]) AC_CHECK_HEADER([alsa/asoundlib.h], [HAS_ASOUNDLIB_H=1], [HAS_ASOUNDLIB_H=0]) AC_CHECK_HEADER([portaudio.h], [HAS_PORTAUDIO_H=1], [HAS_PORTAUDIO_H=0]) +AC_CHECK_HEADER([samplerate.h], [HAS_SAMPLERATE_H=1], [HAS_SAMPLERATE_H=0]) dnl See whether we can include both string.h and strings.h. AC_CACHE_CHECK([whether string.h and strings.h may both be included], @@ -250,7 +251,24 @@ if test $HAS_PORTAUDIO_H -eq 1; then AC_DEFINE(HAS_PORTAUDIO_H, 1, ) fi +if test $HAS_SAMPLERATE_H -eq 1; then + AC_DEFINE(HAS_SAMPLERATE_H, 1, ) +fi + +dnl set defaults + +if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then + if test $HAS_PORTAUDIO_H -eq 1; then + set portaudio = yes; + AC_MSG_RESULT([Using portaudio]) + elif test $HAS_ASOUNDLIB_H -eq 1; then + set alsa = yes; + AC_MSG_RESULT([Using alsa]) + fi +fi + dnl sanity tests. + if test "$alsa" = yes; then if test $HAS_ASOUNDLIB_H -eq 0; then AC_MSG_ERROR([You need asoundlib.h to use --enable-alsa]) @@ -267,14 +285,21 @@ if test "$portaudio" = yes; then if test $HAS_PORTAUDIO_H -eq 0; then AC_MSG_ERROR([You need portaudio.h to use --enable-portaudio]) fi + if test $HAS_SAMPLERATE_H -eq 0; then + AC_MSG_ERROR([You need samplerate.h to use --enable-portaudio]) + fi fi + dnl AC_SUBST(CPPFLAGS, "${CPPFLAGS}") AC_SUBST(LDFLAGS, "${LDFLAGS}") AC_SUBST(CFLAGS) + + AC_OUTPUT +dnl do summary echo echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION" diff --git a/resample.c b/resample.c index b1feb83ee..f45d1eb2f 100644 --- a/resample.c +++ b/resample.c @@ -1,5 +1,5 @@ #include -#include "samplerate.h" +#include int resample_( float din[], float dout[], double *samfac, int *jz) {