- Fix configure to use aclocal.m4 here as well.

- Clean up casting in arguments.
- Use <portaudio.h> not "portaudio.h"



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@1230 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2009-05-17 01:28:03 +00:00
parent 52a315dc8e
commit 007a6e70b8
4 changed files with 655 additions and 1096 deletions

221
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,221 @@
dnl {{{ ax_check_gfortran
AC_DEFUN([AX_CHECK_GFORTRAN],[
AC_ARG_ENABLE(g95,
AC_HELP_STRING([--enable-g95],[Use G95 compiler if available.]),
[g95=$enableval], [g95=no])
AC_ARG_ENABLE(gfortran,
AC_HELP_STRING([--enable-gfortran],[Use gfortran compiler if available.]),
[gfortran=$enableval], [gfortran=no])
dnl
dnl Pick up FC from the environment if present
dnl I'll add a test to confirm this is a gfortran later -db
dnl
FCV=""
if test -n $[{FC}] ; then
gfortran_name_part=`echo $[{FC}] | cut -c 1-8`
if test $[{gfortran_name_part}] = "gfortran" ; then
gfortran_name=$[{FC}]
FC_LIB_PATH=`$[{FC}] -print-file-name=`
g95=no
gfortran=yes
FFLAGS="$[{FFLAGS_GFORTRAN}]"
FCV="gnu95"
else
unset $[{FC}]
fi
fi
dnl
dnl Note regarding the apparent silliness with FCV.
dnl The FCV value for g95 might be system dependent, this is
dnl still to be fully explored. If not, then the FCV_G95
dnl stuff can go away. -db
dnl
AC_MSG_CHECKING([uname -s])
case `uname -s` in
CYGWIN*)
AC_MSG_RESULT(Cygwin)
CYGWIN=yes
;;
SunOS*)
AC_MSG_RESULT(SunOS or Solaris)
AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
;;
dnl
dnl Pick up current gfortran from ports infrastructure for fbsd
dnl
FreeBSD*)
if test -z $[{gfortran_name}] ; then
gfortran_name=`grep FC: /usr/ports/Mk/bsd.gcc.mk | head -1 |awk '{print $[2]}'`
fi
FCV_G95="g95"
;;
*)
FCV_G95="g95"
AC_MSG_RESULT(no)
;;
esac
dnl
dnl look for gfortran if nothing else was given
dnl
if test -z $[gfortran_name] ; then
gfortran_name="gfortran"
fi
AC_PATH_PROG(G95, g95)
AC_PATH_PROG(GFORTRAN, $[{gfortran_name}])
if test ! -z $[{GFORTRAN}] ; then
echo "*** gfortran compiler found at $[{GFORTRAN}]"
if test "$[{gfortran}]" = yes; then
FC_LIB_PATH=`$[{GFORTRAN}] -print-file-name=`
FC=`basename $[{GFORTRAN}]`
g95=no
FFLAGS="$[{FFLAGS_GFORTRAN}]"
FCV="gnu95"
fi
else
echo "*** No gfortran compiler found"
fi
if test ! -z $[{G95}] ; then
echo "*** g95 compiler found at $[{G95}]"
if test "$[{g95}]" = yes; then
FC_LIB_PATH=`$[{G95}] -print-file-name=`
FC=`basename $[{G95}]`
gfortran=no
FFLAGS="$[{FFLAGS_G95}]"
FCV=$[{FCV_G95}]
fi
else
echo "*** No g95 compiler found"
fi
dnl
dnl if FC is not set by now, pick a compiler for user
dnl
if test -z $[{FC}] ; then
if test ! -z $[{GFORTRAN}] ; then
if test "$[{g95}]" = yes; then
echo "You enabled g95, but no g95 compiler found, defaulting to gfortran instead"
fi
FC_LIB_PATH=`$[{GFORTRAN}] -print-file-name=`
FC=`basename $[{GFORTRAN}]`
g95=no
gfortran=yes
FFLAGS="$[{FFLAGS_GFORTRAN}]"
FCV="gnu95"
elif test ! -z $G95 ; then
if test "$[{gfortran}]" = yes; then
echo "You enabled gfortran, but no gfortran compiler found, defaulting to g95 instead"
fi
FC_LIB_PATH=`$[{G95}] -print-file-name=`
FC=`basename $[{G95}]`
g95=yes
gfortran=no
FFLAGS="$[{FFLAGS_G95}]"
FCV=$[{FCV_G95}]
fi
fi
AC_DEFINE_UNQUOTED(FC_LIB_PATH, "${FC_LIB_PATH}", [Path to fortran libs.])
AC_SUBST(FC_LIB_PATH, "${FC_LIB_PATH}")
AC_DEFINE_UNQUOTED(FC, "${FC}", [Fortran compiler.])
AC_SUBST(FC, "${FC}")
AC_SUBST(FCV, "${FCV}")
AC_SUBST(PREFIX, "${prefix}")
dnl =========================================
dnl pick gfortran or g95
])dnl }}}
dnl {{{ ax_check_portaudio
AC_DEFUN([AX_CHECK_PORTAUDIO],[
HAS_PORTAUDIO_H=0
HAS_PORTAUDIO_LIB=0
HAS_PORTAUDIO=0
AC_MSG_CHECKING([for a v19 portaudio ])
portaudio_lib_dir="/usr/lib"
portaudio_include_dir="/usr/include"
AC_ARG_WITH([portaudio-include-dir],
AC_HELP_STRING([--with-portaudio-include-dir=<path>],
[path to portaudio include files]),
[portaudio_include_dir=$with_portaudio_include_dir])
AC_ARG_WITH([portaudio-lib-dir],
AC_HELP_STRING([--with-portaudio-lib-dir=<path>],
[path to portaudio lib files]),
[portaudio_lib_dir=$with_portaudio_lib_dir])
if test -e $[{portaudio_include_dir}]/portaudio.h; then
HAS_PORTAUDIO_H=1
fi
if test -e $[{portaudio_lib_dir}]/libportaudio.so \
-o -e $[{portaudio_lib_dir}]/libportaudio.a;then
HAS_PORTAUDIO_LIB=1
fi
if test $[{HAS_PORTAUDIO_H}] -eq 1 -a $[{HAS_PORTAUDIO_LIB}] -eq 1; then
LDFLAGS="-L$[{portaudio_lib_dir}] $[{LDFLAGS}]"
LIBS="$[{LIBS}] -lportaudio"
CPPFLAGS="-I$[{portaudio_include_dir}] $[{CPPFLAGS}]"
AC_CHECK_LIB(portaudio, Pa_GetVersion, \
[HAS_PORTAUDIO_VERSION=1], [HAS_PORTAUDIO_VERSION=0])
if test $[{HAS_PORTAUDIO_VERSION}] -eq 0; then
AC_MSG_RESULT([This is likely portaudio v18; you need portaudio v19])
else
HAS_PORTAUDIO=1
fi
else
AC_MSG_RESULT([portaudio not found trying FreeBSD paths ])
portaudio_lib_dir="/usr/local/lib/portaudio2"
portaudio_include_dir="/usr/local/include/portaudio2"
dnl
dnl Try again to make sure portaudio dirs are valid
dnl
AC_MSG_CHECKING([for a v19 portaudio in FreeBSD paths.])
HAS_PORTAUDIO_H=0
HAS_PORTAUDIO_LIB=0
if test -e $[{portaudio_include_dir}]/portaudio.h; then
HAS_PORTAUDIO_H=1
fi
if test -e $[{portaudio_lib_dir}]/libportaudio.so \
-o -e $[{portaudio_lib_dir}]/libportaudio.a;then
HAS_PORTAUDIO_LIB=1
fi
if test $[{HAS_PORTAUDIO_H}] -eq 1 -a $[{HAS_PORTAUDIO_LIB}] -eq 1; then
AC_MSG_RESULT([found portaudio in FreeBSD paths, double checking it is v19 ])
LDFLAGS="-L$[{portaudio_lib_dir}] $[{LDFLAGS}]"
LIBS="$[{LIBS}] -lportaudio"
CPPFLAGS="-I$[{portaudio_include_dir}] $[{CPPFLAGS}]"
AC_CHECK_LIB(portaudio, Pa_GetVersion, \
[HAS_PORTAUDIO_VERSION=1], [HAS_PORTAUDIO_VERSION=0])
if test $[{HAS_PORTAUDIO_VERSION}] -eq 0; then
AC_MSG_RESULT([How did you end up with a portaudio v18 here?])
else
AC_MSG_RESULT([found v19])
HAS_PORTAUDIO=1
HAS_PORTAUDIO_H=1
fi
fi
fi
])dnl }}}

1319
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -25,67 +25,13 @@ dnl Lets guess at some likely places for extra libs/includes XXX -db
CPPFLAGS="-I/usr/local/include ${CPPFLAGS}"
LDFLAGS="-L/usr/local/lib ${LDFLAGS}"
LIBS=" -lpthread ${LIBS}"
FCV=""
FFLAGS_GFORTRAN="${FFLAGS} -fno-range-check -ffixed-line-length-none\
-Wall -fbounds-check -fno-second-underscore -fPIC"
FFLAGS_G95="${FFLAGS} -Wall -Wno-precision-loss -fbounds-check -fno-second-underscore -fPIC"
#-Wall -Wno-precision-loss -fbounds-check -fno-second-underscore -fPIC
dnl
dnl Pick up FC from the environment if present
dnl I'll add a test to confirm this is a gfortran later -db
dnl
if test -n ${FC} ; then
gfortran=${FC}
fi
AC_MSG_CHECKING([uname -s])
case `uname -s` in
CYGWIN*)
AC_MSG_RESULT(Cygwin)
CYGWIN=yes
;;
SunOS*)
AC_MSG_RESULT(SunOS or Solaris)
AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
;;
dnl
dnl Pick up current gfortran from ports infrastructure for fbsd
dnl
FreeBSD*)
if test -z ${gfortran} ; then
gfortran=`grep FC: /usr/ports/Mk/bsd.gcc.mk | head -1 |awk '{print $2}'`
fi
FCV_G95="g95"
;;
*)
FCV_G95="g95"
AC_MSG_RESULT(no)
;;
esac
dnl
dnl look for gfortran if nothing else was given
dnl
if test -z $gfortran ; then
gfortran="gfortran"
fi
if test "$ac_cv_c_compiler_gnu" = yes; then
AC_MSG_CHECKING(if $CC is Apple GCC)
if expr "`$CC -v 2>&1 | tail -1`" : ".*Apple" >/dev/null; then
AppleGCC=yes
else
AppleGCC=no
fi
AC_MSG_RESULT($AppleGCC)
CFLAGS="$CFLAGS -Wall -O0"
fi
AX_CHECK_GFORTRAN
AX_CHECK_PORTAUDIO
dnl If we support -g, use it!
if test "$ac_cv_prog_cc_g" = yes; then
@ -115,8 +61,6 @@ AC_PATH_PROG(LD, ld)
AC_PATH_PROG(TEST, [test], [test])
AC_PATH_PROG(PYTHON, python)
AC_PATH_PROG(F2PY, f2py)
AC_PATH_PROG(G95, g95)
AC_PATH_PROG(GFORTRAN, ${gfortran})
AC_MSG_CHECKING([OS])
OS=`uname`
AC_SUBST(OS, "${OS}")
@ -134,10 +78,6 @@ AC_HEADER_TIME
AC_CHECK_HEADER([fftw3.h], [HAS_FFTW3_H=1], [HAS_FFTW3_H=0])
AC_CHECK_HEADER([samplerate.h], [HAS_SAMPLERATE_H=1], [HAS_SAMPLERATE_H=0])
HAS_PORTAUDIO_H=0
HAS_PORTAUDIO_LIB=0
HAS_PORTAUDIO=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],
gcc_cv_header_string,
@ -189,70 +129,6 @@ dnl a custom prefix with a trailing slash
prefix=`echo ${ac_default_prefix} | sed 's/\/$//'`
fi
dnl pick gfortran or g95
dnl ====================
AC_ARG_ENABLE(g95,
AC_HELP_STRING([--enable-g95],[Use G95 compiler if available.]),
[g95=$enableval], [g95=no])
AC_ARG_ENABLE(gfortran,
AC_HELP_STRING([--enable-gfortran],[Use gfortran compiler if available.]),
[gfortran=$enableval], [gfortran=no])
dnl now set conf.h,, CPPFLAGS and CFLAGS flags as needed
dnl ====================================================
if test "$g95" = yes; then
FC_LIB_PATH=${G95_LIB_PATH}
FC=${G95}
gfortran=no
elif test "$gfortran" = yes; then
FC_LIB_PATH=${GFORTRAN_LIB_PATH}
FC=${GFORTRAN}
g95=no
fi
if test -z $FC ; then
if test ! -z $GFORTRAN ; then
FC_LIB_PATH=${GFORTRAN_LIB_PATH}
FC=${GFORTRAN}
gfortran=yes
elif test ! -z $G95 ; then
FC_LIB_PATH=${G95_LIB_PATH}
FC=${G95}
g95=yes
fi
fi
dnl
dnl if FC is not set by now, pick a compiler for user
dnl
if test -z $FC ; then
if test ! -z $GFORTRAN ; then
if test "$g95" = yes; then
echo "You enabled g95, but no g95 compiler found, defaulting to gfortran instead"
fi
FC_LIB_PATH=`${GFORTRAN} -print-file-name=`
FC=`basename ${GFORTRAN}`
g95=no
gfortran=yes
FFLAGS="${FFLAGS} -fno-range-check -ffixed-line-length-none"
FCV="gnu95"
elif test ! -z $G95 ; then
if test "$gfortran" = yes; then
echo "You enabled gfortran, but no gfortran compiler found, defaulting to g95 instead"
fi
FC_LIB_PATH=`${G95} -print-file-name=`
FC=`basename ${G95}`
g95=yes
gfortran=no
FFLAGS="${FFLAGS} -ftrace=full -cpp"
FCV="g95"
fi
fi
AC_DEFINE_UNQUOTED(FC_LIB_PATH, "${FC_LIB_PATH}", [Path to fortran libs.])
AC_SUBST(FC_LIB_PATH, "${FC_LIB_PATH}")
AC_DEFINE_UNQUOTED(FC, "${FC}", [Fortran compiler.])
@ -260,82 +136,6 @@ AC_SUBST(FC, "${FC}")
AC_SUBST(FCV, "${FCV}")
AC_SUBST(PREFIX, "${prefix}")
dnl set defaults
dnl ============
AC_MSG_CHECKING([for a v19 portaudio ])
portaudio_lib_dir="/usr/lib"
portaudio_include_dir="/usr/include"
AC_ARG_WITH([portaudio-include-dir],
AC_HELP_STRING([--with-portaudio-include-dir=<path>],
[path to portaudio include files]),
[portaudio_include_dir=$with_portaudio_include_dir])
AC_ARG_WITH([portaudio-lib-dir],
AC_HELP_STRING([--with-portaudio-lib-dir=<path>],
[path to portaudio lib files]),
[portaudio_lib_dir=$with_portaudio_lib_dir])
if test -e ${portaudio_include_dir}/portaudio.h; then
HAS_PORTAUDIO_H=1
fi
if test -e ${portaudio_lib_dir}/libportaudio.so \
-o -e ${portaudio_lib_dir}/libportaudio.a;then
HAS_PORTAUDIO_LIB=1
fi
if test $HAS_PORTAUDIO_H -eq 1 -a $HAS_PORTAUDIO_LIB -eq 1; then
LDFLAGS="-L${portaudio_lib_dir} ${LDFLAGS}"
LIBS="${LIBS} -lportaudio"
CPPFLAGS="-I${portaudio_include_dir} ${CPPFLAGS}"
AC_CHECK_LIB(portaudio, Pa_GetVersion, \
[HAS_PORTAUDIO_VERSION=1], [HAS_PORTAUDIO_VERSION=0])
if test $HAS_PORTAUDIO_VERSION -eq 0; then
AC_MSG_RESULT([This is likely portaudio v18; you need portaudio v19])
else
HAS_PORTAUDIO=1
fi
else
AC_MSG_RESULT([portaudio not found trying FreeBSD paths ])
portaudio_lib_dir="/usr/local/lib/portaudio2"
portaudio_include_dir="/usr/local/include/portaudio2"
dnl
dnl Try again to make sure portaudio dirs are valid
dnl
AC_MSG_CHECKING([for a v19 portaudio in FreeBSD paths.])
HAS_PORTAUDIO_H=0
HAS_PORTAUDIO_LIB=0
if test -e ${portaudio_include_dir}/portaudio.h; then
HAS_PORTAUDIO_H=1
fi
if test -e ${portaudio_lib_dir}/libportaudio.so \
-o -e ${portaudio_lib_dir}/libportaudio.a;then
HAS_PORTAUDIO_LIB=1
fi
if test $HAS_PORTAUDIO_H -eq 1 -a $HAS_PORTAUDIO_LIB -eq 1; then
AC_MSG_RESULT([found portaudio in FreeBSD paths, double checking it is v19 ])
LDFLAGS="-L${portaudio_lib_dir} ${LDFLAGS}"
LIBS="${LIBS} -lportaudio"
CPPFLAGS="-I${portaudio_include_dir} ${CPPFLAGS}"
AC_CHECK_LIB(portaudio, Pa_GetVersion, \
[HAS_PORTAUDIO_VERSION=1], [HAS_PORTAUDIO_VERSION=0])
if test $HAS_PORTAUDIO_VERSION -eq 0; then
AC_MSG_RESULT([How did you end up with a portaudio v18 here?])
else
AC_MSG_RESULT([found v19])
HAS_PORTAUDIO=1
HAS_PORTAUDIO_H=1
fi
fi
fi
dnl sanity tests.
dnl =============
@ -401,6 +201,7 @@ AC_SUBST(CPPFLAGS, "${CPPFLAGS}")
AC_SUBST(LDFLAGS, "${LDFLAGS}")
AC_SUBST(LIBS, "${LIBS}")
AC_SUBST(CFLAGS)
AC_SUBST(FFLAGS)
AC_OUTPUT
dnl AC_CONFIG_FILES(Makefile)

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include "portaudio.h"
#include <portaudio.h>
#include <string.h>
void fivehz_();
@ -183,8 +183,8 @@ int jtaudio_(int *ndevin, int *ndevout, short y1[], short y2[],
dnfs, //Sample rate
2048, //Frames per buffer
paNoFlag,
SoundOut, //Callback routine
&data); //address of data structure
(PaStreamCallback *)SoundOut, //Callback routine
(void *)&data); //address of data structure
if(err2a) {
printf("Error opening Audio stream for output.\n");
printf("%s\n",Pa_GetErrorText(err2a));