Blame SOURCES/pth-2.0.7-linux3.patch

438a1a
To: bug-pth@gnu.org
438a1a
Subject: [PATCH] fix pth for makecontext-less glibc on Linux 3.x kernels
438a1a
Cc: pth-users@gnu.org
438a1a
438a1a
Attempting to build pth-2.0.7 on arm-linux-gnueabi, running a 3.x
438a1a
kernel, and with a glibc that doesn't yet have makecontext et al
438a1a
(glibc-2.14.1 in my case) results in the following during configure:
438a1a
438a1a
Machine Context Implementation:
438a1a
checking for ucontext.h... yes
438a1a
checking for makecontext... no
438a1a
checking for swapcontext... no
438a1a
checking for getcontext... no
438a1a
checking for setcontext... no
438a1a
checking for usable SVR4/SUSv2 makecontext(2)/swapcontext(2)... no
438a1a
checking for signal.h... (cached) yes
438a1a
checking for sigsetjmp... no
438a1a
checking for siglongjmp... yes
438a1a
checking for setjmp... yes
438a1a
checking for longjmp... yes
438a1a
checking for _setjmp... yes
438a1a
checking for _longjmp... yes
438a1a
checking for sigaltstack... yes
438a1a
checking for sigstack... yes
438a1a
checking for signal-mask aware setjmp(3)/longjmp(3)... yes: sjljlx
438a1a
checking for typedef stack_t... (cached) yes
438a1a
checking for direction of stack growth... down
438a1a
checking for makecontext... (cached) no
438a1a
checking for stack setup via makecontext... N.A.
438a1a
checking for sigaltstack... (cached) yes
438a1a
checking for typedef stack_t... (cached) yes
438a1a
checking for stack setup via sigaltstack... ok
438a1a
checking for sigstack... (cached) yes
438a1a
checking for stack setup via sigstack... guessed
438a1a
decision on mctx implementation... sjlj/sjljlx/none
438a1a
438a1a
Note the "sjljlx", that's bogus since sjljlx is a fallback for
438a1a
truly ancient systems; the correct choice is ssjlj.
438a1a
438a1a
Configure succeeds, but 'make' then results in:
438a1a
438a1a
./shtool scpp -o pth_p.h -t pth_p.h.in -Dcpp -Cintern -M '==#==' pth_compat.c pth_debug.c pth_syscall.c pth_errno.c pth_ring.c pth_mctx.c pth_uctx.c pth_clean.c pth_time.c pth_tcb.c pth_util.c pth_pqueue.c pth_event.c pth_sched.c pth_data.c pth_msg.c pth_cancel.c pth_sync.c pth_attr.c pth_lib.c pth_fork.c pth_high.c pth_ext.c pth_string.c pthread.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_debug.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_ring.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_pqueue.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_time.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_errno.c
438a1a
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_mctx.c
438a1a
pth_mctx.c: In function '__pth_mctx_set':
438a1a
pth_mctx.c:480:2: error: #error "Unsupported Linux (g)libc version and/or platform"
438a1a
make: *** [pth_mctx.lo] Error 1
438a1a
438a1a
This happens because there's a Linux kernel version check that
438a1a
unfortunately only recognises 2.x versions, so it classifies a
438a1a
3.x kernel as "braindead", which selects sjljlx and causes the
438a1a
breakage.
438a1a
438a1a
The fix is to expand the kernel version regexp in aclocal.m4 to
438a1a
also accept 3.x kernels; with that fix configure says:
438a1a
438a1a
checking for signal-mask aware setjmp(3)/longjmp(3)... yes: ssjlj
438a1a
checking for typedef stack_t... (cached) yes
438a1a
checking for direction of stack growth... down
438a1a
checking for makecontext... (cached) no
438a1a
checking for stack setup via makecontext... N.A.
438a1a
checking for sigaltstack... (cached) yes
438a1a
checking for typedef stack_t... (cached) yes
438a1a
checking for stack setup via sigaltstack... ok
438a1a
checking for sigstack... (cached) yes
438a1a
checking for stack setup via sigstack... guessed
438a1a
decision on mctx implementation... sjlj/ssjlj/sas
438a1a
438a1a
Both 'make' and 'make test' then succeed.
438a1a
438a1a
m68k-linux' glibc also lacks makecontext() et al, so it too is sensitive
438a1a
to the kernel version check.  For m68k there is some specific support
438a1a
in the sjljlx fallback code which appears to work, but with the fix
438a1a
m68k too gets to use sjlj/ssjlj/sas (which works fine btw).
438a1a
438a1a
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
438a1a
---
438a1a
--- pth-2.0.7/aclocal.m4.~1~	2006-06-08 19:54:01.000000000 +0200
438a1a
+++ pth-2.0.7/aclocal.m4	2012-05-30 18:44:42.000000000 +0200
438a1a
@@ -1074,7 +1074,7 @@ case $PLATFORM in
438a1a
         braindead=no
438a1a
         case "x`uname -r`" in
438a1a
 changequote(, )dnl
438a1a
-            x2.[23456789]* ) ;;
438a1a
+            x2.[23456789]* | x3.[0-9]* ) ;;
438a1a
 changequote([, ])
438a1a
             * ) braindead=yes ;;
438a1a
         esac
438a1a
--- pth-2.0.7/configure.~1~	2006-06-08 20:14:48.000000000 +0200
438a1a
+++ pth-2.0.7/configure	2012-05-30 18:45:03.000000000 +0200
438a1a
@@ -22512,7 +22512,7 @@ case $PLATFORM in
438a1a
     *-*-linux* )
438a1a
         braindead=no
438a1a
         case "x`uname -r`" in
438a1a
-            x2.[23456789]* ) ;;
438a1a
+            x2.[23456789]* | x3.[0-9]* ) ;;
438a1a
 
438a1a
             * ) braindead=yes ;;
438a1a
         esac