1 # euidaccess.m4 serial 7
2 dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_NONREENTRANT_EUIDACCESS],
9 AC_REQUIRE([gl_FUNC_EUIDACCESS])
10 AC_DEFINE([PREFER_NONREENTRANT_EUIDACCESS], 1,
11 [Define this if you prefer euidaccess to return the correct result
12 even if this would make it nonreentrant. Define this only if your
13 entire application is safe even if the uid or gid might temporarily
14 change. If your application uses signal handlers or threads it
15 is probably not safe.])
18 AC_DEFUN([gl_FUNC_EUIDACCESS],
20 dnl Persuade glibc <unistd.h> to declare euidaccess().
21 AC_REQUIRE([AC_GNU_SOURCE])
23 AC_CHECK_DECLS_ONCE([euidaccess])
24 AC_REPLACE_FUNCS(euidaccess)
25 if test $ac_cv_func_euidaccess = no; then
30 # Prerequisites of lib/euidaccess.c.
31 AC_DEFUN([gl_PREREQ_EUIDACCESS], [
32 AC_CHECK_HEADERS_ONCE(libgen.h)
33 AC_CHECK_DECLS_ONCE(setregid)
34 AC_REQUIRE([AC_FUNC_GETGROUPS])
36 # Solaris 9 needs -lgen to get the eaccess function.
37 # Save and restore LIBS so -lgen isn't added to it. Otherwise, *all*
38 # programs in the package would end up linked with that potentially-shared
39 # library, inducing unnecessary run-time overhead.
41 AC_SEARCH_LIBS(eaccess, [gen],
42 [test "$ac_cv_search_eaccess" = "none required" ||
43 LIB_EACCESS=$ac_cv_search_eaccess])
44 AC_SUBST([LIB_EACCESS])
45 AC_CHECK_FUNCS(eaccess)