]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 288636 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 24 Sep 2010 03:36:01 +0000 (03:36 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 24 Sep 2010 03:36:01 +0000 (03:36 +0000)
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: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@288637 65c4cc65-6c06-0410-ace0-fbb531ad65f3

cdr/cdr_pgsql.c
configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/channel.h
include/asterisk/compat.h
main/strcompat.c

index 21370944f6464beb1259d271bef0887e84b1008d..f469bc5206584f6924922021fbdc3a25787e2503 100644 (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);
 
index 210efb4ce6e1bf9d56297c77e1553df8573c3add..8eb6848861fbeffb3ce70cb099fc2b33f8eaf2b5 100755 (executable)
--- a/configure
+++ b/configure
@@ -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}"
index 0d18a4ac54c5c22aa780a0547404ab93f2597037..67ffe1ded0a138f1cab9f638bcbe322549022ba3 100644 (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}"
index c7252d34b3d18d37fc1dcbef839fe865d6c60729..69dc484906c8e2cf4184f740fe7d983ba0c30cbf 100644 (file)
 /* 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
 
index 9345a402d87103238690572d4c3c79d49477b0f9..88d1748c83fb67d91da04df432ad02779a223cb9 100644 (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)
 {
index 519c71e68671bf8da6c8cbc760c6b87e8b2f11f8..365df66a11e9c881a601d5e007b858c613850e5b 100644 (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
index a3f0e14975c840be5ced7e974baf5e8a9d2c6071..efd85c3bb560a976da36fa0eb3f81d86bfffc456 100644 (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.