From a8b728e9ed18ef1c4a29c40c23209f0c18979470 Mon Sep 17 00:00:00 2001 From: Diane Bruce Date: Fri, 11 Aug 2006 00:00:23 +0000 Subject: [PATCH] - new portaudio-v19 tries to use alsa if available, but does not make a static library including alsa definitions. A binary linked against a portaudio-v19 library using alsa also has to link against -alsa, this is inconvenient to say the least. I do not consider this the best "fix", the portaudio.a may not be referencing any alsa libs at all, even if it is present; but this should get Harry going. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@260 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- configure | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | 8 +++++- 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6f4baf9f7..c0634f3f4 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for wsjt 5.9.2. # -# $Id: configure.ac 258 2006-08-10 21:49:40Z va3db $ +# $Id: configure.ac 259 2006-08-10 22:22:33Z va3db $ # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -976,7 +976,7 @@ Copyright (C) 2003 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 258 2006-08-10 21:49:40Z va3db $ +$Id: configure.ac 259 2006-08-10 22:22:33Z va3db $ _ACEOF exit 0 fi @@ -2500,7 +2500,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$OLD_CFLAGS" -CPPFLAGS="-Iportaudio-v19/include -I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}" +CPPFLAGS="-Iportaudio-v19/include -I/usr/local/include -I/usr/include/alsa -I/usr/local/include/alsa ${CPPFLAGS}" LDFLAGS="-L/usr/local/lib ${LDFLAGS}" LIBS=" -lpthread ${LIBS}" @@ -4890,6 +4890,76 @@ else RTLIBS="" fi +echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5 +echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6 +if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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_open (); +int +main () +{ +snd_pcm_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_asound_snd_pcm_open=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 +echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6 +if test $ac_cv_lib_asound_snd_pcm_open = yes; then + ASOUNDLIBS="-lasound" +else + ASOUNDLIBS="" +fi + echo "$as_me:$LINENO: checking for int64_t" >&5 echo $ECHO_N "checking for int64_t... $ECHO_C" >&6 @@ -6771,6 +6841,7 @@ FC="${FC}" + if test "$alsa" != yes -a "$oss" != yes -a \ "$portaudio" != yes; then if test $HAS_PORTAUDIO_H -eq 1; then @@ -6814,6 +6885,7 @@ _ACEOF NEEDPORTAUDIO="portaudio-v19/lib/.libs/libportaudio.a" LIBS="${LIBS} ${RTLIBS} -lsamplerate ./portaudio-v19/lib/.libs/libportaudio.a" + LIBS="${LIBS} ${ASOUNDLIBS}" else NEEDPORTAUDIO="" diff --git a/configure.ac b/configure.ac index 202bcf9f7..f30e34d9d 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ dnl Make sure autoconf doesn't interfere with cflags -jmallett CFLAGS="$OLD_CFLAGS" dnl Lets guess at some likely places for extra libs/includes XXX -db -CPPFLAGS="-Iportaudio-v19/include -I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}" +CPPFLAGS="-Iportaudio-v19/include -I/usr/local/include -I/usr/include/alsa -I/usr/local/include/alsa ${CPPFLAGS}" LDFLAGS="-L/usr/local/lib ${LDFLAGS}" LIBS=" -lpthread ${LIBS}" @@ -136,6 +136,7 @@ if test "$gcc_cv_header_string" = "yes"; then fi AC_CHECK_LIB(rt, clock_gettime, [RTLIBS="-lrt"], [RTLIBS=""]) +AC_CHECK_LIB(asound, snd_pcm_open, [ASOUNDLIBS="-lasound"], [ASOUNDLIBS=""]) AC_CHECK_SIZEOF(int64_t) AC_CHECK_SIZEOF(long long) @@ -284,6 +285,7 @@ AC_SUBST(FC, "${FC}") dnl set defaults dnl ============ + if test "$alsa" != yes -a "$oss" != yes -a \ "$portaudio" != yes; then if test $HAS_PORTAUDIO_H -eq 1; then @@ -310,7 +312,11 @@ if test "$portaudio" = yes; then AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.]) AC_SUBST(AUDIO, "a2d.f90 jtaudio.c resample.c start_portaudio.c") AC_SUBST(NEEDPORTAUDIO, "portaudio-v19/lib/.libs/libportaudio.a") +dnl +dnl new portaudio-v19 on linux will be referencing alsa. +dnl LIBS="${LIBS} ${RTLIBS} -lsamplerate ./portaudio-v19/lib/.libs/libportaudio.a" + LIBS="${LIBS} ${ASOUNDLIBS}" else AC_SUBST(NEEDPORTAUDIO, "") fi