zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris
@ 2021-11-23  6:46 Claes Nästén
  2021-12-07 18:20 ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Claes Nästén @ 2021-11-23  6:46 UTC (permalink / raw)
  To: zsh-workers

Trying to compile zsh on Solaris 10 fails for me right after
configuration due to misleading information in config.h

The check for sigset_t fails, due to:

configure:8654: checking for sigset_t
configure:8673: gcc -c  -Wall -Wmissing-prototypes -O2  conftest.c >&5
In file included from /usr/include/sys/types.h:17,
                 from conftest.c:85:
/usr/pkg/gcc8/lib/gcc/sparc64-sun-solaris2.10/8.4.0/include-fixed/sys/feature_tee
sts.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open aa
pplications     and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^~~~~
conftest.c: In function 'main':
conftest.c:90:10: warning: unused variable 'tempsigset' [-Wunused-variable]
 sigset_t tempsigset;
          ^~~~~~~~~~
configure:8673: $? = 1

Looking at the git history it seems _POSIX_C_SOURCE is defined to ensure
configure works with systems using musl libc so the patch should not cause
any issues as it's Linux only.

Tried configuring on Solaris 11 as well and it still detects sigset_t.

diff --git a/configure.ac b/configure.ac
index 297a7482f..7494b3529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1135,7 +1135,9 @@ dnl Check for sigset_t.  Currently I'm looking in
 dnl <sys/types.h> and <signal.h>.  Others might need
 dnl to be added.
 AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_C_SOURCE 200809L
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef __sun
+  #define _POSIX_C_SOURCE 200809L
+#endif
 #include <sys/types.h>
 #include <signal.h>]], [[sigset_t tempsigset;]])],[zsh_cv_type_sigset_t=yes],[zsh_cv_type_sigset_t=no])])
 AH_TEMPLATE([sigset_t],



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris
  2021-11-23  6:46 [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris Claes Nästén
@ 2021-12-07 18:20 ` Oliver Kiddle
  2021-12-08  6:23   ` Claes Nästén
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2021-12-07 18:20 UTC (permalink / raw)
  To: Claes Nästén; +Cc: zsh-workers

On 23 Nov, Claes Nästén wrote:
> Trying to compile zsh on Solaris 10 fails for me right after
> configuration due to misleading information in config.h
>
> The check for sigset_t fails, due to:

Thank you for isolating the cause of this and for the clear report.

The definition of _POSIX_C_SOURCE was added in 28989 (April 2011) for
compatibility with musl libc.

I was thinking it'd be better to define it only for musl rather building
up a list of exceptions such as Solaris. Trying a zsh build on a recent
Alpine Linux system running within podman, it appears to return "yes"
for the sigset_t test both with and without the #define. Perhaps musl
has evolved for greater compatibility with glibc since 2011. I don't
think we should be too concerned about the potential for someone to still
be using old musl. Solaris 10, while quite a bit older than that if
you don't count updates, is still relevant.

patch -R wouldn't work with 28989 because it was using the old
AC_TRY_COMPILE macro at that time so I have attached a patch.

Oliver

diff --git a/configure.ac b/configure.ac
index 1af5a2854..8bba78c56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1135,8 +1135,7 @@ dnl Check for sigset_t.  Currently I'm looking in
 dnl <sys/types.h> and <signal.h>.  Others might need
 dnl to be added.
 AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_C_SOURCE 200809L
-#include <sys/types.h>
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 #include <signal.h>]], [[sigset_t tempsigset;]])],[zsh_cv_type_sigset_t=yes],[zsh_cv_type_sigset_t=no])])
 AH_TEMPLATE([sigset_t],
 [Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define])


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris
  2021-12-07 18:20 ` Oliver Kiddle
@ 2021-12-08  6:23   ` Claes Nästén
  0 siblings, 0 replies; 3+ messages in thread
From: Claes Nästén @ 2021-12-08  6:23 UTC (permalink / raw)
  To: zsh-workers

Excerpts from Oliver Kiddle's message of 2021-12-07 19:20:45 +0100:
> On 23 Nov, Claes Nästén wrote:
> > Trying to compile zsh on Solaris 10 fails for me right after
> > configuration due to misleading information in config.h
> >
> > The check for sigset_t fails, due to:
> 
> Thank you for isolating the cause of this and for the clear report.
> 
> The definition of _POSIX_C_SOURCE was added in 28989 (April 2011) for
> compatibility with musl libc.
> 
> I was thinking it'd be better to define it only for musl rather building
> up a list of exceptions such as Solaris. Trying a zsh build on a recent
> Alpine Linux system running within podman, it appears to return "yes"
> for the sigset_t test both with and without the #define. Perhaps musl
> has evolved for greater compatibility with glibc since 2011. I don't
> think we should be too concerned about the potential for someone to still
> be using old musl. Solaris 10, while quite a bit older than that if
> you don't count updates, is still relevant.
> 

Interesting, I would have thought musl wants to stay as compliant as
possible.

> 
> patch -R wouldn't work with 28989 because it was using the old
> AC_TRY_COMPILE macro at that time so I have attached a patch.
> 
> Oliver
> 

Great, works just as good as skipping on SunOS of course. :)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-08  6:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23  6:46 [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris Claes Nästén
2021-12-07 18:20 ` Oliver Kiddle
2021-12-08  6:23   ` Claes Nästén

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).