dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 288636 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r288636 | tilghman | 2010-09-23 22:20:24 -0500 (Thu, 23 Sep 2010) | 2 lines
  
  Solaris compatibility fixes
........


git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@288637 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2010-09-24 03:36:01 +00:00
parent fcca2ea91a
commit a9697cb0f7
7 changed files with 101 additions and 14 deletions

View File

@ -113,7 +113,11 @@ static int pgsql_log(struct ast_cdr *cdr)
if (PQstatus(conn) != CONNECTION_BAD) {
connected = 1;
if (PQsetClientEncoding(conn, encoding)) {
#ifdef HAVE_PGSQL_pg_encoding_to_char
ast_log(LOG_WARNING, "Failed to set encoding to '%s'. Encoding set to default '%s'\n", encoding, pg_encoding_to_char(PQclientEncoding(conn)));
#else
ast_log(LOG_WARNING, "Failed to set encoding to '%s'. Encoding set to default.\n", encoding);
#endif
}
} else {
pgerror = PQerrorMessage(conn);
@ -489,7 +493,11 @@ static int config_module(int reload)
ast_debug(1, "Successfully connected to PostgreSQL database.\n");
connected = 1;
if (PQsetClientEncoding(conn, encoding)) {
#ifdef HAVE_PGSQL_pg_encoding_to_char
ast_log(LOG_WARNING, "Failed to set encoding to '%s'. Encoding set to default '%s'\n", encoding, pg_encoding_to_char(PQclientEncoding(conn)));
#else
ast_log(LOG_WARNING, "Failed to set encoding to '%s'. Encoding set to default.\n", encoding);
#endif
}
version = PQserverVersion(conn);

61
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 284593 .
# From configure.ac Revision: 285930 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.6.2.
#
@ -32065,6 +32065,65 @@ _ACEOF
fi
{ echo "$as_me:$LINENO: checking for pg_encoding_to_char within Postgres headers" >&5
echo $ECHO_N "checking for pg_encoding_to_char within Postgres headers... $ECHO_C" >&6; }
old_CFLAGS=${CFLAGS}
CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
old_LDFLAGS=${LDFLAGS}
LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <libpq-fe.h>
int
main ()
{
const char *foo = pg_encoding_to_char(1)
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<_ACEOF
#define HAVE_PGSQL_pg_encoding_to_char 1
_ACEOF
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=${old_CFLAGS}
LDFLAGS=${old_LDFLAGS}
if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
PGSQL_INCLUDE="-I${PGSQL_includedir}"

View File

@ -1532,6 +1532,19 @@ if test "${PG_CONFIG}" != No; then
AC_CHECK_LIB([pq], [PQescapeStringConn], AC_DEFINE_UNQUOTED([HAVE_PGSQL], 1,
[Define to indicate the PostgreSQL library]), [], -L${PGSQL_libdir} -lz)
AC_MSG_CHECKING(for pg_encoding_to_char within Postgres headers)
old_CFLAGS=${CFLAGS}
CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
old_LDFLAGS=${LDFLAGS}
LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libpq-fe.h>],
[const char *foo = pg_encoding_to_char(1)])],
[AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([HAVE_PGSQL_pg_encoding_to_char], 1, [Define to indicate presence of the pg_encoding_to_char API.])],
[AC_MSG_RESULT(no)])
CFLAGS=${old_CFLAGS}
LDFLAGS=${old_LDFLAGS}
if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
PGSQL_INCLUDE="-I${PGSQL_includedir}"

View File

@ -469,6 +469,9 @@
/* Define to indicate the PostgreSQL library */
#undef HAVE_PGSQL
/* Define to indicate presence of the pg_encoding_to_char API. */
#undef HAVE_PGSQL_pg_encoding_to_char
/* Define to 1 if your system defines IP_PKTINFO. */
#undef HAVE_PKTINFO

View File

@ -1747,19 +1747,6 @@ static inline int ast_fdisset(struct pollfd *pfds, int fd, int maximum, int *sta
return 0;
}
#ifndef HAVE_TIMERSUB
static inline void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff)
{
tvdiff->tv_sec = tvend->tv_sec - tvstart->tv_sec;
tvdiff->tv_usec = tvend->tv_usec - tvstart->tv_usec;
if (tvdiff->tv_usec < 0) {
tvdiff->tv_sec --;
tvdiff->tv_usec += 1000000;
}
}
#endif
/*! \brief Retrieves the current T38 state of a channel */
static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
{

View File

@ -113,6 +113,10 @@ int unsetenv(const char *name);
int __attribute__((format(printf, 2, 0))) vasprintf(char **strp, const char *fmt, va_list ap);
#endif
#ifndef HAVE_TIMERSUB
void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif

View File

@ -163,6 +163,19 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
}
#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
#ifndef HAVE_TIMERSUB
void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff)
{
tvdiff->tv_sec = tvend->tv_sec - tvstart->tv_sec;
tvdiff->tv_usec = tvend->tv_usec - tvstart->tv_usec;
if (tvdiff->tv_usec < 0) {
tvdiff->tv_sec --;
tvdiff->tv_usec += 1000000;
}
}
#endif
/*
* Based on Code from bsd-asprintf from OpenSSH
* Copyright (c) 2004 Darren Tucker.