mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05:00
Add library checking for clock_gettime() support
This commit is contained in:
parent
19479ea021
commit
b380dd030f
76
acinclude.m4
76
acinclude.m4
@ -1814,6 +1814,82 @@ AC_DEFUN([TYPE_IN_ADDR_T],
|
||||
]) dnl AC_CHECK_TYPE
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
dnl CURL_CHECK_LIBS_CLOCK_GETTIME
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for libraries needed for clock_gettime,
|
||||
dnl and prepended to LIBS any needed libraries.
|
||||
|
||||
AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME], [
|
||||
AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
|
||||
#
|
||||
AC_MSG_CHECKING([for clock_gettime in libraries])
|
||||
#
|
||||
curl_cv_save_LIBS="$LIBS"
|
||||
curl_cv_gclk_LIBS="unknown"
|
||||
#
|
||||
for x_xlibs in '' '-lrt' '-lposix4' ; do
|
||||
if test -z "$x_xlibs"; then
|
||||
LIBS="$curl_cv_save_LIBS"
|
||||
else
|
||||
LIBS="$x_xlibs $curl_cv_save_LIBS"
|
||||
fi
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
#undef inline
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
],[
|
||||
(void)clock_gettime(0, 0);
|
||||
])
|
||||
],[
|
||||
curl_cv_gclk_LIBS="$x_xlibs"
|
||||
break
|
||||
])
|
||||
done
|
||||
#
|
||||
LIBS="$curl_cv_save_LIBS"
|
||||
#
|
||||
case X-"$curl_cv_gclk_LIBS" in
|
||||
X-unknown)
|
||||
AC_MSG_RESULT([cannot find clock_gettime])
|
||||
ac_cv_func_clock_gettime="no"
|
||||
;;
|
||||
X-)
|
||||
AC_MSG_RESULT([no additional lib required])
|
||||
ac_cv_func_clock_gettime="yes"
|
||||
;;
|
||||
*)
|
||||
if test -z "$curl_cv_save_LIBS"; then
|
||||
LIBS="$curl_cv_gclk_LIBS"
|
||||
else
|
||||
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
|
||||
fi
|
||||
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
|
||||
ac_cv_func_clock_gettime="yes"
|
||||
;;
|
||||
esac
|
||||
#
|
||||
case "$ac_cv_func_clock_gettime" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME, 1,
|
||||
[Define to 1 if you have the clock_gettime function.])
|
||||
;;
|
||||
esac
|
||||
#
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
dnl ************************************************************
|
||||
dnl check for "localhost", if it doesn't exist, we can't do the
|
||||
dnl gethostbyname_r tests!
|
||||
|
@ -1283,6 +1283,81 @@ AC_DEFUN([TYPE_IN_ADDR_T],
|
||||
]) dnl AC_CHECK_TYPE
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
dnl CURL_CHECK_LIBS_CLOCK_GETTIME
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for libraries needed for clock_gettime,
|
||||
dnl and prepended to LIBS any needed libraries.
|
||||
|
||||
AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME], [
|
||||
AC_REQUIRE([AC_HEADER_TIME])dnl
|
||||
AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
|
||||
#
|
||||
AC_MSG_CHECKING([for clock_gettime in libraries])
|
||||
#
|
||||
curl_cv_save_LIBS="$LIBS"
|
||||
curl_cv_gclk_LIBS="unknown"
|
||||
#
|
||||
for x_xlibs in '' '-lrt' '-lposix4' ; do
|
||||
if test -z "$x_xlibs"; then
|
||||
LIBS="$curl_cv_save_LIBS"
|
||||
else
|
||||
LIBS="$x_xlibs $curl_cv_save_LIBS"
|
||||
fi
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
#undef inline
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
],[
|
||||
(void)clock_gettime(0, 0);
|
||||
])
|
||||
],[
|
||||
curl_cv_gclk_LIBS="$x_xlibs"
|
||||
break
|
||||
])
|
||||
done
|
||||
#
|
||||
LIBS="$curl_cv_save_LIBS"
|
||||
#
|
||||
case X-"$curl_cv_gclk_LIBS" in
|
||||
X-unknown)
|
||||
AC_MSG_RESULT([cannot find clock_gettime])
|
||||
ac_cv_func_clock_gettime="no"
|
||||
;;
|
||||
X-)
|
||||
AC_MSG_RESULT([no additional lib required])
|
||||
ac_cv_func_clock_gettime="yes"
|
||||
;;
|
||||
*)
|
||||
if test -z "$curl_cv_save_LIBS"; then
|
||||
LIBS="$curl_cv_gclk_LIBS"
|
||||
else
|
||||
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
|
||||
fi
|
||||
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
|
||||
ac_cv_func_clock_gettime="yes"
|
||||
;;
|
||||
esac
|
||||
#
|
||||
case "$ac_cv_func_clock_gettime" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME, 1,
|
||||
[Define to 1 if you have the clock_gettime function.])
|
||||
;;
|
||||
esac
|
||||
#
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl CURL_DETECT_ICC ([ACTION-IF-YES])
|
||||
|
@ -260,6 +260,11 @@ fi
|
||||
dnl socket lib?
|
||||
AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for libraries needed for function clock_gettime
|
||||
dnl **********************************************************************
|
||||
CURL_CHECK_LIBS_CLOCK_GETTIME
|
||||
|
||||
AC_MSG_CHECKING([whether to use libgcc])
|
||||
AC_ARG_ENABLE(libgcc,
|
||||
AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
|
||||
@ -644,7 +649,6 @@ AC_CHECK_MEMBER(struct addrinfo.ai_flags,
|
||||
|
||||
AC_CHECK_FUNCS( bitncmp \
|
||||
gettimeofday \
|
||||
clock_gettime \
|
||||
if_indextoname,
|
||||
dnl if found
|
||||
[],
|
||||
|
@ -567,6 +567,11 @@ fi
|
||||
dnl socket lib?
|
||||
AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for libraries needed for function clock_gettime
|
||||
dnl **********************************************************************
|
||||
CURL_CHECK_LIBS_CLOCK_GETTIME
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl The preceding library checks are all potentially useful for test
|
||||
dnl servers (for providing networking support). Save the list of required
|
||||
@ -1976,7 +1981,6 @@ AC_CHECK_FUNCS( strtoll \
|
||||
strcmpi \
|
||||
gethostbyaddr \
|
||||
gettimeofday \
|
||||
clock_gettime \
|
||||
inet_addr \
|
||||
inet_ntoa \
|
||||
inet_pton \
|
||||
|
Loading…
Reference in New Issue
Block a user