2024-05-11 20:16:48 +00:00
|
|
|
# timer_time.m4
|
|
|
|
# serial 6
|
2024-01-02 02:30:05 +00:00
|
|
|
dnl Copyright (C) 2011-2024 Free Software Foundation, Inc.
|
2012-09-27 01:06:23 +00:00
|
|
|
dnl This file is free software; the Free Software Foundation
|
|
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
|
2023-01-07 23:08:45 +00:00
|
|
|
# Check for timer_settime, and set TIMER_TIME_LIB.
|
2012-09-27 01:06:23 +00:00
|
|
|
|
|
|
|
AC_DEFUN([gl_TIMER_TIME],
|
|
|
|
[
|
|
|
|
dnl Based on clock_time.m4. See details there.
|
|
|
|
|
|
|
|
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
2014-05-29 15:05:06 +00:00
|
|
|
|
|
|
|
dnl Test whether the gnulib module 'threadlib' is in use.
|
|
|
|
dnl Some packages like Emacs use --avoid=threadlib.
|
|
|
|
dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
|
|
|
|
dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
|
2019-12-06 23:16:15 +00:00
|
|
|
m4_ifdef([gl_][PTHREADLIB], [AC_REQUIRE([gl_][PTHREADLIB])])
|
2012-09-27 01:06:23 +00:00
|
|
|
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
AC_CHECK_DECL([timer_settime], [], [],
|
|
|
|
[[#include <time.h>
|
|
|
|
]])
|
2023-01-07 23:08:45 +00:00
|
|
|
TIMER_TIME_LIB=
|
|
|
|
AC_SUBST([TIMER_TIME_LIB])
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
AS_IF([test "$ac_cv_have_decl_timer_settime" = yes], [
|
|
|
|
gl_saved_libs=$LIBS
|
2012-09-27 01:06:23 +00:00
|
|
|
AC_SEARCH_LIBS([timer_settime], [rt posix4],
|
|
|
|
[test "$ac_cv_search_timer_settime" = "none required" ||
|
2023-01-07 23:08:45 +00:00
|
|
|
TIMER_TIME_LIB=$ac_cv_search_timer_settime])
|
2019-12-06 23:16:15 +00:00
|
|
|
m4_ifdef([gl_][PTHREADLIB],
|
2014-05-29 15:05:06 +00:00
|
|
|
[dnl GLIBC uses threads to emulate posix timers when kernel support
|
|
|
|
dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
|
|
|
|
dnl Now the pthread lib is linked automatically in the normal case,
|
|
|
|
dnl but when linking statically, it needs to be explicitly specified.
|
|
|
|
AC_EGREP_CPP([Thread],
|
|
|
|
[#include <features.h>
|
|
|
|
#ifdef __GNU_LIBRARY__
|
|
|
|
#if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
|
|
|
|
&& !(__UCLIBC__ && __HAS_NO_THREADS__)
|
|
|
|
Thread emulation available
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
],
|
2023-01-07 23:08:45 +00:00
|
|
|
[TIMER_TIME_LIB="$TIMER_TIME_LIB $LIBPMULTITHREAD"])])
|
2012-09-27 01:06:23 +00:00
|
|
|
AC_CHECK_FUNCS([timer_settime])
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
LIBS=$gl_saved_libs
|
|
|
|
])
|
2023-01-07 23:08:45 +00:00
|
|
|
dnl For backward compatibility.
|
|
|
|
LIB_TIMER_TIME="$TIMER_TIME_LIB"
|
|
|
|
AC_SUBST([LIB_TIMER_TIME])
|
2012-09-27 01:06:23 +00:00
|
|
|
])
|