- check correct HAS_ASOUNDLIB_H flag in start_threads.c

- look for alsa/asoundlib.h and set HAS_ASOUNDLIB_H if present
- also rework Makefile to pass proper flags

This should be it for alsa and portaudio.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@70 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2006-01-09 21:30:35 +00:00
parent 1f1abc09d3
commit 8a708402af
6 changed files with 34 additions and 126 deletions

View File

@ -12,7 +12,7 @@ G95=@G95@
COMPILER=@G95_LIB_PATH@
LDFLAGS += -L${COMPILER}
LIBS = -lpthread -lg2c
LDFLAGS += -lpthread -lg2c
PYTHON ?= @PYTHON@
RM ?= @RM@
@ -58,7 +58,7 @@ wsjt6: Audio.so #wsjt.spec
Audio.so: $(OBJS2C)
${PYTHON} ${F2PY_PY} -c --verbose --opt="-O -cpp -D${OS} \
-fno-second-underscore" $(OBJS2C) -m Audio \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} ${LIBS} \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \
only: $(F2PYONLY) \
: $(SRCS2F90) \
$(SRCS2F77) \

View File

@ -46,8 +46,8 @@
/* Define if you have /usr/include/sys/param.h */
#undef HAVE_SYS_PARAM_H
/* Define if you have alsasound.h */
#undef HAS_ALSASOUND_H
/* Define if you have asoundlib.h */
#undef HAS_ASOUNDLIB_H
/* Define if you want to use ALSA */
#undef USE_ALSA

114
configure vendored
View File

@ -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 64 2006-01-08 18:19:01Z va3db $
# $Id: configure.ac 69 2006-01-09 19:18:03Z 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 64 2006-01-08 18:19:01Z va3db $
$Id: configure.ac 69 2006-01-09 19:18:03Z va3db $
_ACEOF
exit 0
fi
@ -3869,114 +3869,6 @@ else
fi
if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6
if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking sys/asoundlib.h usability" >&5
echo $ECHO_N "checking sys/asoundlib.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
$ac_includes_default
#include <sys/asoundlib.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 sys/asoundlib.h presence" >&5
echo $ECHO_N "checking sys/asoundlib.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <sys/asoundlib.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
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: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
no:yes )
{ echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: sys/asoundlib.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&2;};;
esac
echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6
if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_sys_asoundlib_h=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6
fi
if test $ac_cv_header_sys_asoundlib_h = yes; then
HAS_ASOUNDLIB_H=1
else
HAS_ASOUNDLIB_H=0
fi
if test "${ac_cv_header_portaudio_h+set}" = set; then
echo "$as_me:$LINENO: checking for portaudio.h" >&5
echo $ECHO_N "checking for portaudio.h... $ECHO_C" >&6
@ -5722,7 +5614,7 @@ _ACEOF
AUDIO="start_threads.c"
LDFLAGS="-Lpthreads ${LDFLAGS}"
LDFLAGS="${LDFLAGS} -lpthreads -lasound"
fi
if test "$oss" = yes; then

View File

@ -101,7 +101,6 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h stdint.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h libgen.h sys/wait.h wait.h ])
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([sys/asoundlib.h], [HAS_ASOUNDLIB_H=1], [HAS_ASOUNDLIB_H=0])
AC_CHECK_HEADER([portaudio.h], [HAS_PORTAUDIO_H=1], [HAS_PORTAUDIO_H=0])
dnl See whether we can include both string.h and strings.h.
@ -221,7 +220,7 @@ AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
if test "$alsa" = yes; then
AC_DEFINE(USE_ALSA, 1, [Define if you want ALSA used.])
AC_SUBST(AUDIO, "start_threads.c")
LDFLAGS="-Lpthreads ${LDFLAGS}"
LDFLAGS="${LDFLAGS} -lpthreads -lasound"
fi
if test "$oss" = yes; then

View File

@ -1,7 +1,5 @@
#ifdef Win32
#include <stdio.h>
#include "portaudio.h"
#include <portaudio.h>
// Definition of structure pointing to the audio data
typedef struct
@ -37,7 +35,27 @@ typedef struct _SYSTEMTIME
short Millisecond;
} SYSTEMTIME;
#ifdef Win32
extern void __stdcall GetSystemTime(SYSTEMTIME *st);
#else
#include <sys/time.h>
#include <time.h>
void GetSystemTime(SYSTEMTIME *st){
struct timeval tmptimeofday;
struct tm tmptmtime;
gettimeofday(&tmptimeofday,NULL);
gmtime_r(&tmptimeofday.tv_sec,&tmptmtime);
st->Year = (short)tmptmtime.tm_year;
st->Month = (short)tmptmtime.tm_year;
st->DayOfWeek = (short)tmptmtime.tm_wday;
st->Day = (short)tmptmtime.tm_mday;
st->Hour = (short)tmptmtime.tm_hour;
st->Minute = (short)tmptmtime.tm_min;
st->Second = (short)tmptmtime.tm_sec;
st->Millisecond = (short)(tmptimeofday.tv_usec/1000);
}
#endif
// Input callback routine:
static int SoundIn( void *inputBuffer, void *outputBuffer,
@ -346,4 +364,3 @@ int padevsub_(int *numdev, int *ndefin, int *ndefout,
return err;
}
#endif

View File

@ -6,18 +6,18 @@
/*
* XXX This should have been caught in the sanity tests in configure --db
*/
#if defined(USE_ALSA) && !defined(HAS_ALSASOUND_H)
#if defined(USE_ALSA) && !defined(HAS_ASOUNDLIB_H)
#error "You must have alsa support to use alsa"
#endif
#if defined(USE_ALSA) && defined(HAS_ALSASOUND_H)
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H)
#include <alsa/asoundlib.h>
#endif
#include <inttypes.h>
#include <time.h>
#if defined(USE_ALSA) && defined(HAS_ALSASOUND_H)
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H)
#if 1
#define ALSA_LOG
@ -519,7 +519,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
int iarg1 = 1,iarg2 = 2;
//int32_t rate=11025;
int32_t rate=*nfsample;
#if defined(USE_ALSA) && defined(HAS_ALSASOUND_H)
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H)
alsa_driver_capture.app_buffer_y1 = y1;
alsa_driver_capture.app_buffer_y2 = y2;
alsa_driver_capture.app_buffer_offset = iwrite;
@ -539,7 +539,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
#endif
printf("start threads called\n");
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);
#if defined(USE_ALSA) && defined(HAS_ALSASOUND_H)
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H)
/* Open audio card. */
ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK);
ao_alsa_open(&alsa_driver_capture, &rate, SND_PCM_STREAM_CAPTURE);