1 # euidaccess.m4 serial 4
2 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
9 AC_DEFUN([gl_FUNC_NONREENTRANT_EUIDACCESS],
11 AC_REQUIRE([gl_FUNC_EUIDACCESS])
12 AC_DEFINE([PREFER_NONREENTRANT_EUIDACCESS], 1,
13 [Define this if you prefer euidaccess to return the correct result
14 even if this would make it nonreentrant. Define this only if your
15 entire application is safe even if the uid or gid might temporarily
16 change. If your application uses signal handlers or threads it
17 is probably not safe.])
20 AC_DEFUN([gl_FUNC_EUIDACCESS],
22 dnl Persuade glibc <unistd.h> to declare euidaccess().
23 AC_REQUIRE([AC_GNU_SOURCE])
25 AC_CHECK_DECLS_ONCE([euidaccess])
26 AC_REPLACE_FUNCS(euidaccess)
27 if test $ac_cv_func_euidaccess = no; then
32 # Prerequisites of lib/euidaccess.c.
33 AC_DEFUN([gl_PREREQ_EUIDACCESS], [
34 AC_CHECK_HEADERS_ONCE(libgen.h)
35 AC_CHECK_DECLS_ONCE(setregid)
36 AC_REQUIRE([AC_FUNC_GETGROUPS])
37 AC_REQUIRE([AC_HEADER_STAT])
39 # Solaris 9 needs -lgen to get the eaccess function.
40 # Save and restore LIBS so -lgen isn't added to it. Otherwise, *all*
41 # programs in the package would end up linked with that potentially-shared
42 # library, inducing unnecessary run-time overhead.
44 AC_SEARCH_LIBS(eaccess, [gen],
45 [test "$ac_cv_search_eaccess" = "none required" ||
46 LIB_EACCESS=$ac_cv_search_eaccess])
48 AC_CHECK_FUNCS(eaccess)