bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build errors on Solaris 2.6 & 7


From: Paul Eggert
Subject: Re: Build errors on Solaris 2.6 & 7
Date: Tue, 08 Jan 2013 12:33:27 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 01/08/13 11:37, Tom G. Christensen wrote:
> Removing #include <stdlib.h> from <pthread.h> makes allocator.c build.
> 
> This is probably not the right solution but atleast it gets me further.

Thanks for the diagnosis.  Does the following patch fix that
problem for you?  I hope it's closer to the "right" solution.

stdlib: port to Solaris 2.6 and 7
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.
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 490994f..d9c7d81 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -49,7 +49,9 @@
    linkers.  */
 #if defined __GETOPT_PREFIX && !defined __need_getopt
 # if address@hidden@
+#  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 1a4f1fc..7fcfb0b 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -32,8 +32,11 @@
 #ifndef address@hidden@_PTHREAD_H_
 #define address@hidden@_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 3b3b4b1..422ad71 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.  */

 address@hidden@ @NEXT_STDLIB_H@

diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index bc259db..373bf91 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]