summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-01-08 12:32:05 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-01-09 14:59:28 -0800
commit90f065e873a354b9b2a55707ebbba64b5748b47d (patch)
tree1d29b5b4b05faed655c553abaedc92542c787b9f
parentbb3630b9f1d07a953ad5d2cfd28fb266dc6f95e1 (diff)
downloadgnulib-90f065e873a354b9b2a55707ebbba64b5748b47d.tar.gz
stdlib: port to Solaris 2.6
Also, the code worked on Solaris 7 through 9 only by accident. Problem reported by Tom G. Christensen in <http://lists.gnu.org/archive/html/bug-gnulib/2013-01/msg00059.html>. * lib/stdlib.in.h: If __need_system_stdlib_h is defined, simply include the system stdlib.h. * lib/getopt.in.h (__need_system_stdlib_h): * lib/pthread.in.h (__need_system_stdlib_h): * lib/unistd.in.h (__need_system_stdlib_h) [!__GLIBC__]: Define when including <stdlib.h>, to avoid problems at least for the pthread case on Solaris 2.6 and 7. These .h files can get by with the system stdlib.h.
-rw-r--r--ChangeLog15
-rw-r--r--lib/getopt.in.h2
-rw-r--r--lib/pthread.in.h5
-rw-r--r--lib/stdlib.in.h5
-rw-r--r--lib/unistd.in.h2
5 files changed, 26 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 573fc13cf2..3b34c93005 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2013-01-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ stdlib: port to Solaris 2.6
+ Also, the code worked on Solaris 7 through 9 only by accident.
+ Problem reported by Tom G. Christensen in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2013-01/msg00059.html>.
+ * lib/stdlib.in.h: If __need_system_stdlib_h is defined,
+ simply include the system stdlib.h.
+ * lib/getopt.in.h (__need_system_stdlib_h):
+ * lib/pthread.in.h (__need_system_stdlib_h):
+ * lib/unistd.in.h (__need_system_stdlib_h) [!__GLIBC__]:
+ Define when including <stdlib.h>, to avoid problems at least for
+ the pthread case on Solaris 2.6 and 7. These .h files can get by
+ with the system stdlib.h.
+
2013-01-06 Paul Eggert <eggert@cs.ucla.edu>
doc: update main copyright year
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 490994f860..d9c7d8144a 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -49,7 +49,9 @@
linkers. */
#if defined __GETOPT_PREFIX && !defined __need_getopt
# if !@HAVE_GETOPT_H@
+# define __need_system_stdlib_h
# include <stdlib.h>
+# undef __need_system_stdlib_h
# include <stdio.h>
# include <unistd.h>
# endif
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index 1a4f1fc587..7fcfb0b3b6 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -32,8 +32,11 @@
#ifndef _@GUARD_PREFIX@_PTHREAD_H_
#define _@GUARD_PREFIX@_PTHREAD_H_
-#include <errno.h>
+#define __need_system_stdlib_h
#include <stdlib.h>
+#undef __need_system_stdlib_h
+
+#include <errno.h>
#include <sched.h>
#include <sys/types.h>
#include <time.h>
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 3b3b4b1bd4..422ad714c3 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -20,8 +20,9 @@
#endif
@PRAGMA_COLUMNS@
-#if defined __need_malloc_and_calloc
-/* Special invocation convention inside glibc header files. */
+#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
+/* Special invocation conventions inside some gnulib header files,
+ and inside some glibc header files, respectively. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index bc259dbb78..373bf916de 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -79,7 +79,9 @@
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
/* But avoid namespace pollution on glibc systems. */
#ifndef __GLIBC__
+# define __need_system_stdlib_h
# include <stdlib.h>
+# undef __need_system_stdlib_h
#endif
/* Native Windows platforms declare chdir, getcwd, rmdir in