summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2000-11-15 17:48:43 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2000-11-15 17:48:43 +0000
commitb9731eb8616acf48f5a4c73568432872e6c5e08e (patch)
treeb5c97ac7c5ceea018ac033ffa815122d55b17319
parent760845b183af7d4651258dc7bb2f52a2d0e9abcf (diff)
Check for the sched.h header and include it on gthread/gthread-posix.c if
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in: Check for the sched.h header and include it on gthread/gthread-posix.c if available. * gthread-posix.c: Include <sched.h> if available. * configure.in: Add -D_POSIX4_DRAFT_SOURCE to GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES, when searching for thread libs. Look for sched_* functions in -lrte as well. All of that is necessary on DG/UX. * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in various places to make it work more reliable, to make it accept macros instead of functions etc. * configure.in: Replace some NULL's for checks with 0 to make it work without stdio.h everywhere. * configure.in, gutils.c: changed the test for getpwuid_r to first test for a posix version and then for a non-posix version. No code change in gutils.c. Again this change deals better with getpwuid_r being a macro and not a function. Most of the above with kind help from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
-rw-r--r--ChangeLog24
-rw-r--r--ChangeLog.pre-2-024
-rw-r--r--ChangeLog.pre-2-1024
-rw-r--r--ChangeLog.pre-2-1224
-rw-r--r--ChangeLog.pre-2-224
-rw-r--r--ChangeLog.pre-2-424
-rw-r--r--ChangeLog.pre-2-624
-rw-r--r--ChangeLog.pre-2-824
-rw-r--r--configure.in96
-rw-r--r--glib/gutils.c10
-rw-r--r--gthread/ChangeLog4
-rw-r--r--gthread/gthread-posix.c3
-rw-r--r--gutils.c10
13 files changed, 263 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 1194389a5..2883d56f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 1194389a5..2883d56f7 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,27 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * configure.in: Check for the sched.h header and include it on
+ gthread/gthread-posix.c if available.
+
+ * configure.in: Add -D_POSIX4_DRAFT_SOURCE to
+ GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
+ to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
+ when searching for thread libs. Look for sched_* functions in
+ -lrte as well. All of that is necessary on DG/UX.
+
+ * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
+ various places to make it work more reliable, to make it accept
+ macros instead of functions etc.
+
+ * configure.in: Replace some NULL's for checks with 0 to make it
+ work without stdio.h everywhere.
+
+ * configure.in, gutils.c: changed the test for getpwuid_r to first
+ test for a posix version and then for a non-posix version. No code
+ change in gutils.c. Again this change deals better with getpwuid_r
+ being a macro and not a function. Most of the above with kind help
+ from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
+
2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef.
diff --git a/configure.in b/configure.in
index f3502dffe..356a606ff 100644
--- a/configure.in
+++ b/configure.in
@@ -312,7 +312,7 @@ AC_C_BIGENDIAN
# check for header files
AC_CHECK_HEADERS([float.h limits.h pwd.h sys/param.h sys/poll.h sys/select.h])
-AC_CHECK_HEADERS([sys/time.h sys/times.h unistd.h values.h stdint.h])
+AC_CHECK_HEADERS([sys/time.h sys/times.h unistd.h values.h stdint.h sched.h])
AC_MSG_CHECKING(whether make is GNU Make)
STRIP_BEGIN=
@@ -732,20 +732,20 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xsolaris; then
fi
if test "x$want_threads" = xyes || test "x$want_threads" = xposix \
|| test "x$want_threads" = xdce; then
- # -D_POSIX4A_DRAFT10_SOURCE is for DG/UX
+ # -D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE is for DG/UX
# -U_OSF_SOURCE is for Digital UNIX 4.0d
- GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE"
+ GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE"
glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
if test "x$have_threads" = xnone; then
- AC_EGREP_HEADER([(^|[^a-zA-Z_])pthread_attr_init[^a-zA-Z_]],
- pthread.h,
+ AC_TRY_COMPILE([#include <pthread.h>],
+ [pthread_attr_t attr; pthread_attr_init(&attr);],
have_threads=posix)
fi
if test "x$have_threads" = xnone; then
- AC_EGREP_HEADER([(^|[^a-zA-Z_])pthread_attr_create[^a-zA-Z_]],
- pthread.h,
- have_threads=dce)
+ AC_TRY_COMPILE([#include <pthread.h>],
+ [pthread_attr_t attr; pthread_attr_create(&attr);],
+ have_threads=posix)
fi
CPPFLAGS="$glib_save_CPPFLAGS"
fi
@@ -791,6 +791,8 @@ if test x"$have_threads" != xnone; then
G_THREAD_CFLAGS="$G_THREAD_CFLAGS -pthread"
fi
;;
+ *-dg-dgux*) # DG/UX
+ G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
esac
# if we are not finding the ctime_r function, then we probably are
@@ -799,9 +801,11 @@ if test x"$have_threads" != xnone; then
glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS"
- # Note: Digital UNIX 4.0d #defines ctime_r to _Pctime_r for gcc.
- AC_EGREP_HEADER([[^a-zA-Z_](_P)?ctime_r[^a-zA-Z_]], time.h, ,
- AC_MSG_WARN($FLAG_DOES_NOT_WORK))
+ AC_TRY_COMPILE([#include <time.h>],
+ [time_t t; char b[30]; ctime_r (&t, b);], ,
+ [AC_TRY_COMPILE([#include <time.h>],
+ [time_t t; char b[30]; ctime_r (&t, b, 30);], ,
+ AC_MSG_WARN($FLAG_DOES_NOT_WORK))])
CPPFLAGS="$glib_save_CPPFLAGS"
@@ -816,7 +820,9 @@ dnl ******************************
mutex_has_default=no
case $have_threads in
posix|dce)
- G_THREAD_LIBS=error
+ glib_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
+ G_THREAD_LIBS=error
glib_save_LIBS="$LIBS"
case $host in
*-sysv5uw7*) # UnixWare 7
@@ -836,7 +842,7 @@ case $have_threads in
IN=" in -l$thread_lib"
fi
if test x"$have_threads" = xposix; then
- defattr=NULL
+ defattr=0
else
defattr=pthread_attr_default
fi
@@ -850,7 +856,7 @@ case $have_threads in
main()
{ pthread_t t;
void *ret;
- pthread_create (&t, $defattr, func, NULL);
+ pthread_create (&t, $defattr, func, 0);
pthread_join (t, &ret);
exit (check_me != 42);
}],
@@ -862,7 +868,7 @@ case $have_threads in
if test "x$G_THREAD_LIBS" = xerror; then
AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
fi
- for thread_lib in "" rt; do
+ for thread_lib in "" rt rte; do
if test x"$thread_lib" = x; then
add_thread_lib=""
IN=""
@@ -901,6 +907,7 @@ case $have_threads in
have_threads="posix"
fi
AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
+ CPPFLAGS="$glib_save_CPPFLAGS"
;;
solaris)
G_THREAD_LIBS=error
@@ -946,33 +953,37 @@ if test x"$have_threads" != xnone; then
# LIBS="$LIBS $G_THREAD_LIBS"
AC_CHECK_FUNCS(localtime_r)
if test "$ac_cv_header_pwd_h" = "yes"; then
- AC_CACHE_CHECK([for getpwuid_r],ac_cv_func_getpwuid_r,
+ AC_CACHE_CHECK([for posix getpwuid_r],
+ ac_cv_func_posix_getpwuid_r,
[AC_TRY_RUN([#include <errno.h>
- int main () { char buffer[10000], *pointer;
- char getpwuid_r (long, void*, void*,
- int, void*);
- int error;
- errno = 0;
- error = getpwuid_r (0, &buffer, &buffer,
- sizeof (buffer), &pointer);
- return errno == ENOSYS || error == ENOSYS;}],
- [ac_cv_func_getpwuid_r=yes],
- [ac_cv_func_getpwuid_r=no])])
- if test "$ac_cv_func_getpwuid_r" = yes; then
- AC_DEFINE(HAVE_GETPWUID_R,1,[Have function getpwuid_r])
- fi
- if test "$ac_cv_func_getpwuid_r" = "yes"; then
- AC_MSG_CHECKING(whether getpwuid_r is posix like)
- # The signature for the POSIX version is:
- # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **)
- AC_TRY_COMPILE([#include <pwd.h>
- #include <sys/types.h>
- #include <stdlib.h>],
- [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
- [AC_DEFINE(HAVE_GETPWUID_R_POSIX,1,
- [Function getpwuid_r has the POSIX signature])
- AC_MSG_RESULT(yes)],
- [AC_MSG_RESULT(no)])
+ #include <pwd.h>
+ int main () { char buffer[10000];
+ struct passwd pwd, *pwptr = &pwd;
+ int error;
+ errno = 0;
+ error = getpwuid_r (0, &pwd, buffer,
+ sizeof (buffer), &pwptr);
+ return (error < 0 && errno == ENOSYS)
+ || error == ENOSYS; }],
+ [ac_cv_func_posix_getpwuid_r=yes],
+ [ac_cv_func_posix_getpwuid_r=no])])
+ if test "$ac_cv_func_posix_getpwuid_r" = yes; then
+ AC_DEFINE(HAVE_POSIX_GETPWUID_R,1,
+ [Have POSIX function getpwuid_r])
+ else
+ AC_CACHE_CHECK([for nonposix getpwuid_r],
+ ac_cv_func_nonposix_getpwuid_r,
+ [AC_TRY_COMPILE([#include <pwd.h>],
+ [char buffer[10000];
+ struct passwd pwd;
+ getpwuid_r (0, &pwd, buffer,
+ sizeof (buffer));],
+ [ac_cv_func_nonposix_getpwuid_r=yes],
+ [ac_cv_func_nonposix_getpwuid_r=no])])
+ if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then
+ AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1,
+ [Have non-POSIX function getpwuid_r])
+ fi
fi
fi
LIBS="$LIBS $G_THREAD_LIBS"
@@ -1042,7 +1053,8 @@ if test x"$have_threads" != xnone; then
LIBS="$glib_save_LIBS"
# now spit out all the warnings.
- if test "$ac_cv_func_getpwuid_r" != "yes"; then
+ if test "$ac_cv_func_posix_getpwuid_r" != "yes" &&
+ test "$ac_cv_func_nonposix_getpwuid_r" != "yes"; then
AC_MSG_WARN($FUNC_NO_GETPWUID_R)
fi
if test "$ac_cv_func_localtime_r" != "yes"; then
diff --git a/glib/gutils.c b/glib/gutils.c
index 8d1ac84c6..41fdb7ad7 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -715,7 +715,7 @@ g_get_any_init (void)
struct passwd *pw = NULL;
gpointer buffer = NULL;
-# ifdef HAVE_GETPWUID_R
+# if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
struct passwd pwd;
# ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */
@@ -731,10 +731,10 @@ g_get_any_init (void)
buffer = g_malloc (bufsize);
errno = 0;
-# ifdef HAVE_GETPWUID_R_POSIX
+# ifdef HAVE_POSIX_GETPWUID_R
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
error = error < 0 ? errno : error;
-# else /* !HAVE_GETPWUID_R_POSIX */
+# else /* HAVE_NONPOSIX_GETPWUID_R */
# ifdef _AIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
pw = error == 0 ? &pwd : NULL;
@@ -742,7 +742,7 @@ g_get_any_init (void)
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
error = pw ? 0 : errno;
# endif /* !_AIX */
-# endif /* !HAVE_GETPWUID_R_POSIX */
+# endif /* HAVE_NONPOSIX_GETPWUID_R */
if (!pw)
{
@@ -768,7 +768,7 @@ g_get_any_init (void)
}
}
while (!pw);
-# endif /* !HAVE_GETPWUID_R */
+# endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
if (!pw)
{
diff --git a/gthread/ChangeLog b/gthread/ChangeLog
index 6a240ba82..b37e8f800 100644
--- a/gthread/ChangeLog
+++ b/gthread/ChangeLog
@@ -1,3 +1,7 @@
+2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gthread-posix.c: Include <sched.h> if available.
+
2000-11-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-none.c: Add G_MUTEX_SIZE as needed for gthread-impl.c
diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c
index 599418cf5..c7f599208 100644
--- a/gthread/gthread-posix.c
+++ b/gthread/gthread-posix.c
@@ -40,6 +40,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
#define posix_check_err(err, name) G_STMT_START{ \
int error = (err); \
diff --git a/gutils.c b/gutils.c
index 8d1ac84c6..41fdb7ad7 100644
--- a/gutils.c
+++ b/gutils.c
@@ -715,7 +715,7 @@ g_get_any_init (void)
struct passwd *pw = NULL;
gpointer buffer = NULL;
-# ifdef HAVE_GETPWUID_R
+# if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
struct passwd pwd;
# ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */
@@ -731,10 +731,10 @@ g_get_any_init (void)
buffer = g_malloc (bufsize);
errno = 0;
-# ifdef HAVE_GETPWUID_R_POSIX
+# ifdef HAVE_POSIX_GETPWUID_R
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
error = error < 0 ? errno : error;
-# else /* !HAVE_GETPWUID_R_POSIX */
+# else /* HAVE_NONPOSIX_GETPWUID_R */
# ifdef _AIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
pw = error == 0 ? &pwd : NULL;
@@ -742,7 +742,7 @@ g_get_any_init (void)
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
error = pw ? 0 : errno;
# endif /* !_AIX */
-# endif /* !HAVE_GETPWUID_R_POSIX */
+# endif /* HAVE_NONPOSIX_GETPWUID_R */
if (!pw)
{
@@ -768,7 +768,7 @@ g_get_any_init (void)
}
}
while (!pw);
-# endif /* !HAVE_GETPWUID_R */
+# endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
if (!pw)
{