blob: a41b9cef276dceed6928109b96a5d68b94ca8f5f [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 1999-2005 Open Source Telecom Corporation.
2dnl Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
16dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dnl
18dnl As a special exception to the GNU General Public License, if you
19dnl distribute this file as part of a program that contains a configuration
20dnl script generated by Autoconf, you may include it under the same
21dnl distribution terms that you use for the rest of that program.
22
23AC_DEFUN([OST_LIB_REENTRANT],[
24 reentrant_lib=${ost_cv_thread_library}
25 if test -z "$reentrant_lib" ; then
26 reentrant_lib=c_r
27 fi
28 if test "c" = "$reentrant_lib" ; then
29 reentrant_lib=c_r
30 fi
31 if test "none" = "$reentrant_lib" ; then
32 reentrant_lib=c_r
33 fi
34
35 AC_CHECK_FUNCS(setenv)
36 AC_CHECK_LIB($reentrant_lib, localtime_r,[
37 AC_DEFINE(HAVE_STRTOK_R, [1], [reentrant strtok])
38 AC_DEFINE(HAVE_LOCALTIME_R, [1], [reentrant localtime])],[
39 AC_CHECK_LIB(c, strtok_r, AC_DEFINE(HAVE_STRTOK_R))
40 AC_CHECK_LIB(c, localtime_r, AC_DEFINE(HAVE_LOCALTIME_R))
41 ])
42 AC_CHECK_LIB($reentrant_lib, readdir_r,[
43 AC_DEFINE(HAVE_READDIR_R, [1], [reentrant readdir])],[
44 AC_CHECK_LIB(c, readdir_r, AC_DEFINE(HAVE_READDIR_R, [1]))
45 ])
46 AC_CHECK_LIB($reentrant_lib, strerror_r,[
47 AC_DEFINE(HAVE_STRERROR_R, [1], [reentrant strerror])],[
48 AC_CHECK_LIB(c, strerror_r, AC_DEFINE(HAVE_STRERROR_R, [1]))
49 ])
50 AC_CHECK_LIB($reentrant_lib, getpwuid_r,[
51 AC_DEFINE(HAVE_GETPWUID_R, [1], [reentrant getuid])
52 AC_DEFINE(HAVE_GETPWNAM_R, [1], [reentrant getnam])],[
53 AC_CHECK_LIB(c, getpwuid_r, AC_DEFINE(HAVE_GETPWUID_R))
54 AC_CHECK_LIB(c, getpwnam_r, AC_DEFINE(HAVE_GETPWNAM_R))
55 ])
56 AC_CHECK_LIB($reentrant_lib, getgrnam_r,[
57 AC_DEFINE(HAVE_GETGRNAM_R, [1], [reentrant getgrnam])],[
58 AC_CHECK_LIB(c, getgrnam_r, AC_DEFINE(HAVE_GETGRNAM_R))
59 ])
60 AH_BOTTOM([
61
62#ifndef HAVE_STRERROR_R
63#define strerror_r(e, b, l) b = ::strerror(e)
64#endif
65
66#ifndef HAVE_GETPWUID_R
67#define getpwuid_r(uid, rec, buf, size, ptr) ptr = ::getpwuid(uid)
68#define getpwnam_r(name, rec, buf, size, ptr) ptr = ::getpwnam(name)
69#endif
70
71 ])
72])
73