]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use autoconf logic to determine whether the system has timersub or not. Do not blindl...
authorJoshua Colp <jcolp@digium.com>
Mon, 15 Dec 2008 17:43:59 +0000 (17:43 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 15 Dec 2008 17:43:59 +0000 (17:43 +0000)
(closes issue #13838)
Reported by: ano

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164343 65c4cc65-6c06-0410-ace0-fbb531ad65f3

configure
configure.ac
include/asterisk/autoconfig.h.in
include/asterisk/channel.h

index fc40eb4ab4185be9d7ee21801a5e51b9dfdd3333..fbcc9cff521b778eb07fab3b81f1dd378e533189 100755 (executable)
--- 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.
 #
 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
 
 
index 44fff243ecdea11b14b08fe39142fb73db941c0e..1db2519ec2f4e8acea3ad683a6e0165e5e2286bb 100644 (file)
@@ -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])
 
index 163d132df32b80a5e20cffc6740d89fa39b21fa2..b05c0ff32c548a275cde2c3e5ff7ae93bcbd534d 100644 (file)
 /* 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
 
index aa1ee2d07db1a0f74da307acdcafa1492164a890..05e44449ccc75b2ca492cc5d8413ef57fef67ebb 100644 (file)
@@ -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;