Skip to content
Snippets Groups Projects
Commit 569d1b82 authored by jpbl's avatar jpbl
Browse files

better handling of missing readline library

parent cfb609f6
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ AM_INIT_AUTOMAKE(sflphone, $VERSION)
AC_PROG_LIBTOOL
dnl check for portaudio
LP_SETUP_PORTAUDIO
PORTAUDIO_SETUP
dnl check for osip2
LP_CHECK_OSIP2
......
AC_DEFUN([LP_SETUP_PORTAUDIO],[
# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
# [ACTION-IF-YES], [ACTION-IF-NO])
# ----------------------------------------------------------
# David Shaw <dshaw@jabberwocky.com> Jun-21-2005
# Jean-Philippe Barrette-LaPierre Jan-17-2005
# <jean-philippe.barrette-lapierre@savoirfairelinux.com>
#
# *GREATLY inspired from libcurl.m4 (curl.haxx.se)
#
# Checks for portaudio. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-portaudio or --without-portaudio.
# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the
# minimum version of portaudio to accept. Pass the version as a regular
# version number like 0.19.0. If not supplied, any version is
# accepted. ACTION-IF-YES is a list of shell commands to run if
# libcurl was successfully found and passed the various tests.
# ACTION-IF-NO is a list of shell commands that are run otherwise.
# Note that using --without-portaudio does run ACTION-IF-NO.
#
# This macro defines HAVE_PORTAUDIO if a working libcurl setup is found,
# and sets @PORTAUDIO@ and @PORTAUDIO_CPPFLAGS@ to the necessary values.
# Other useful defines are PORTAUDIO_FEATURE_xxx where xxx are the
# various features supported by portaudio. xxx are capitalized.
# See the list of AH_TEMPLATEs at the top of the macro for the
# complete list of possible defines. Shell variables
# $portaudio_feature_xxx is also defined to 'yes' for those
# features that were found. Note that xxx keep the same capitalization
# as in the portaudio-config list (e.g. it's "OSS" and not "oss").
#
# Users may override the detected values by doing something like:
# PORTAUDIO="-lportaudio" PORTAUDIO_CPPFLAGS="-I/usr/myinclude" ./configure
#
# For the sake of sanity, this macro assumes that any portaudio that is
# found is after version 0.19.0, the first version that included the
# portaudio-config script. Note that it is very important for people
# packaging binary versions of portaudio to include this script!
# Without portaudio-config, we can only guess what protocols are available.
AC_DEFUN([PORTAUDIO_CHECK_CONFIG],
[
AH_TEMPLATE([LIBCURL_FEATURE_OSS],[Defined if portaudio supports OSS])
AH_TEMPLATE([LIBCURL_FEATURE_ALSA],[Defined if libcurl supports ALSA])
AC_ARG_WITH(portaudio,
AC_HELP_STRING([--with-portaudio=DIR],[look for the portaudio library in DIR]),
[_portaudio_with=$withval],[_portaudio_with=ifelse([$1],,[yes],[$1])])
if test "$_portaudio_with" != "no" ; then
AC_PROG_AWK
_portaudio_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
_portaudio_try_link=yes
if test -d "$_portaudio_with" ; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
AC_PATH_PROG([_portaudio_config],[portaudio-config])
if test x$_portaudio_config != "x" ; then
AC_CACHE_CHECK([for the version of portaudio],
[portaudio_cv_lib_portaudio_version],
[portaudio_cv_lib_portaudio_version=`$_portaudio_config --version | $AWK '{print $[]2}'`])
_portaudio_version=`echo $portaudio_cv_lib_portaudio_version | $_portaudio_version_parse`
_portaudio_wanted=`echo ifelse([$2],,[0],[$2]) | $_portaudio_version_parse`
if test $_portaudio_wanted -gt 0 ; then
AC_CACHE_CHECK([for portaudio >= version $2],
[portaudio_cv_lib_version_ok],
[
if test $_portaudio_version -ge $_portaudio_wanted ; then
portaudio_cv_lib_version_ok=yes
else
portaudio_cv_lib_version_ok=no
fi
])
fi
if test $_portaudio_wanted -eq 0 || test x$portaudio_cv_lib_version_ok = xyes ; then
if test x"$PORTAUDIO_CPPFLAGS" = "x" ; then
PORTAUDIO_CPPFLAGS=`$_portaudio_config --cflags`
fi
if test x"$PORTAUDIO" = "x" ; then
PORTAUDIO=`$_portaudio_config --libs`
# This is so silly, but Apple actually has a bug in their
# portaudio-config script. Fixed in Tiger, but there are still
# lots of Panther installs around.
case "${host}" in
powerpc-apple-darwin7*)
PORTAUDIO=`echo $PORTAUDIO | sed -e 's|-arch i386||g'`
;;
esac
fi
# All portaudio-config scripts support --feature
_portaudio_features=`$_portaudio_config --feature`
else
_portaudio_try_link=no
fi
unset _portaudio_wanted
fi
if test $_portaudio_try_link = yes ; then
# we didn't find portaudio-config, so let's see if the user-supplied
# link line (or failing that, "-lportaudio") is enough.
PORTAUDIO=${PORTAUDIO-"-lportaudio"}
AC_CACHE_CHECK([whether portaudio is usable],
[portaudio_cv_lib_portaudio_usable],
[
_portaudio_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $PORTAUDIO_CPPFLAGS"
_portaudio_save_libs=$LIBS
LIBS="$LIBS $PORTAUDIO"
AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <portaudio.h>],[
/* Try and use a few common options to force a failure if we are
missing symbols or can't link. */
Pa_Initialize();
]),portaudio_cv_lib_portaudio_usable=yes,portaudio_cv_lib_portaudio_usable=no)
CPPFLAGS=$_portaudio_save_cppflags
LIBS=$_portaudio_save_libs
unset _portaudio_save_cppflags
unset _portaudio_save_libs
])
if test $portaudio_cv_lib_portaudio_usable = yes ; then
# Does curl_free() exist in this version of portaudio?
# If not, fake it with free()
AC_DEFINE(HAVE_PORTAUDIO,1,
[Define to 1 if you have a functional portaudio library.])
AC_SUBST(PORTAUDIO_CPPFLAGS)
AC_SUBST(PORTAUDIO)
for _portaudio_feature in $_portaudio_features ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(portaudio_feature_$_portaudio_feature),[1])
eval AS_TR_SH(portaudio_feature_$_portaudio_feature)=yes
done
if test "x$_portaudio_protocols" = "x" ; then
# We don't have --protocols, so just assume that all
# protocols are available
_portaudio_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
if test x$portaudio_feature_SSL = xyes ; then
_portaudio_protocols="$_portaudio_protocols HTTPS"
# FTPS wasn't standards-compliant until version
# 7.11.0
if test $_portaudio_version -ge 461568; then
_portaudio_protocols="$_portaudio_protocols FTPS"
fi
fi
fi
for _portaudio_protocol in $_portaudio_protocols ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(portaudio_protocol_$_portaudio_protocol),[1])
eval AS_TR_SH(portaudio_protocol_$_portaudio_protocol)=yes
done
fi
fi
unset _portaudio_try_link
unset _portaudio_version_parse
unset _portaudio_config
unset _portaudio_feature
unset _portaudio_features
unset _portaudio_protocol
unset _portaudio_protocols
unset _portaudio_version
fi
if test x$_portaudio_with = xno || test x$portaudio_cv_lib_portaudio_usable != xyes ; then
# This is the IF-NO path
ifelse([$4],,:,[$4])
else
# This is the IF-YES path
ifelse([$3],,:,[$3])
fi
unset _portaudio_with
])dnl
#This macro is used when you compile portaudio.
AC_DEFUN([PORTAUDIO_SETUP],[
AC_REQUIRE([AC_CANONICAL_HOST])
CFLAGS_save=$CFLAGS
......@@ -130,15 +326,13 @@ AM_CONDITIONAL(ENABLE_ALSA, test x$compile_with_alsa = xyes)
PORTAUDIO_CFLAGS=$CFLAGS
PORTAUDIO_LIBS=$LIBS
PORTAUDIO_CXXFLAGS=$CXXFLAGS
CFLAGS=$CFLAGS_save
LIBS=$LIBS_save
CXXFLAGS=$CXXFLAGS_save
AC_SUBST(PORTAUDIO_CFLAGS)
AC_SUBST(PORTAUDIO_CXXFLAGS)
AC_SUBST(PORTAUDIO_LIBS)
AC_SUBST(PORTAUDIO)
AC_SUBST(ASIODIR)
])
......
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "display.h"
#include "setup.h"
#include "sflphone.h"
#define IBUFSIZE 512
static char ibuf[IBUFSIZE + 1];
char *
read_input (const char *string) {
printf("%s", string);
return fgets(ibuf, IBUFSIZE, stdin);
}
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
#else
#define readline read_input
#endif
int
setup_first (void) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment