|
Packit |
33f14e |
# clock_time.m4 serial 10
|
|
Packit |
33f14e |
dnl Copyright (C) 2002-2006, 2009-2017 Free Software Foundation, Inc.
|
|
Packit |
33f14e |
dnl This file is free software; the Free Software Foundation
|
|
Packit |
33f14e |
dnl gives unlimited permission to copy and/or distribute it,
|
|
Packit |
33f14e |
dnl with or without modifications, as long as this notice is preserved.
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
|
|
Packit |
33f14e |
# For a program named, say foo, you should add a line like the following
|
|
Packit |
33f14e |
# in the corresponding Makefile.am file:
|
|
Packit |
33f14e |
# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
AC_DEFUN([gl_CLOCK_TIME],
|
|
Packit |
33f14e |
[
|
|
Packit |
33f14e |
dnl Persuade glibc and Solaris <time.h> to declare these functions.
|
|
Packit |
33f14e |
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
|
|
Packit |
33f14e |
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
|
|
Packit |
33f14e |
# programs in the package would end up linked with that potentially-shared
|
|
Packit |
33f14e |
# library, inducing unnecessary run-time overhead.
|
|
Packit |
33f14e |
LIB_CLOCK_GETTIME=
|
|
Packit |
33f14e |
AC_SUBST([LIB_CLOCK_GETTIME])
|
|
Packit |
33f14e |
gl_saved_libs=$LIBS
|
|
Packit |
33f14e |
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
|
|
Packit |
33f14e |
[test "$ac_cv_search_clock_gettime" = "none required" ||
|
|
Packit |
33f14e |
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
|
|
Packit |
33f14e |
AC_CHECK_FUNCS([clock_gettime clock_settime])
|
|
Packit |
33f14e |
LIBS=$gl_saved_libs
|
|
Packit |
33f14e |
])
|