aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-15 17:43:59 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-15 17:43:59 +0000
commit0b321028e4e0939ea8c4d39fa53bc34b19bc14c8 (patch)
tree492f084565e42c52b051a74dee2907d20cf5dde9
parentb9f2b5a4aa961a7389a42e56b74dae5f293bb2dd (diff)
Use autoconf logic to determine whether the system has timersub or not. Do not blindly assume Solaris does not.
(closes issue #13838) Reported by: ano git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@164343 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xconfigure64
-rw-r--r--configure.ac9
-rw-r--r--include/asterisk/autoconfig.h.in3
-rw-r--r--include/asterisk/channel.h2
4 files changed, 72 insertions, 6 deletions
diff --git a/configure b/configure
index fc40eb4ab..fbcc9cff5 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 159025 .
+# From configure.ac Revision: 159808 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.4.
#
@@ -14572,6 +14572,60 @@ fi
done
+{ echo "$as_me:$LINENO: checking for timersub in time.h" >&5
+echo $ECHO_N "checking for timersub in time.h... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/time.h>
+int
+main ()
+{
+struct timeval *zombies; timersub(zombies, zombies, zombies);
+ ;
+ 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_TIMERSUB 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
+
# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
{ echo "$as_me:$LINENO: checking for library containing gethostbyname_r" >&5
echo $ECHO_N "checking for library containing gethostbyname_r... $ECHO_C" >&6; }
@@ -15378,9 +15432,9 @@ if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/nu
echo "${ECHO_T}yes" >&6; }
AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
else
- { echo "$as_me:$LINENO: result: no" >&5
+ { echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
- AST_DECLARATION_AFTER_STATEMENT=
+ AST_DECLARATION_AFTER_STATEMENT=
fi
@@ -15404,9 +15458,9 @@ if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>
echo "${ECHO_T}yes" >&6; }
AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
else
- { echo "$as_me:$LINENO: result: no" >&5
+ { echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
- AST_NO_STRICT_OVERFLOW=
+ AST_NO_STRICT_OVERFLOW=
fi
diff --git a/configure.ac b/configure.ac
index 44fff243e..1db2519ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,6 +267,15 @@ AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm])
+AC_MSG_CHECKING(for timersub in time.h)
+AC_LINK_IFELSE(
+ AC_LANG_PROGRAM([#include <sys/time.h>],
+ [struct timeval *zombies; timersub(zombies, zombies, zombies);]),
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_TIMERSUB], 1, [Define to 1 if your system has timersub in time.h]),
+ AC_MSG_RESULT(no)
+)
+
# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 163d132df..b05c0ff32 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -498,6 +498,9 @@
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
+/* Define to 1 if your system has timersub in time.h */
+#undef HAVE_TIMERSUB
+
/* Define to indicate the ${TINFO_DESCRIP} library */
#undef HAVE_TINFO
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index aa1ee2d07..05e44449c 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -1315,7 +1315,7 @@ static inline int ast_fdisset(struct pollfd *pfds, int fd, int max, int *start)
return 0;
}
-#ifdef SOLARIS
+#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;