On Fri, Jan 3, 2020 at 1:46 AM Graham Leggett <minf...@sharp.fm> wrote:
>
> On 02 Jan 2020, at 16:16, Yann Ylavic <ylavic....@gmail.com> wrote:
>
> >> It looks like, in the generated "apr.h",
> >> APR_USE_PROC_PTHREAD_SERIALIZE is set but not
> >> APR_HAS_PROC_PTHREAD_SERIALIZE?
> >
> > This possibly has to do with "/dev/zero" detection from:
> >
> > APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
> >             func:pthread_mutexattr_setpshared dnl
> >             file:/dev/zero,
> >             hasprocpthreadser="1", hasprocpthreadser="0")
> >
> > I'm not sure it can work for cross-compilation, does forcing it with
> > "./configure ... ac_cv_file__dev_zero=yes ..." help?
>
> Working backwards, I tried the ac_cv_file__dev_zero=yes, and it made no 
> difference in this case.

Hmm OK, probably overridden by AC_CHECK_FILE(/dev/zero)...

>
> Right at the bottom, we have:
>
> hasprocpthreadser=‘0'
>
> which means (if I’m reading this correctly) APR_HAS_PROC_PTHREAD_SERIALIZE is 
> not set.

Right, and that's because AC_CHECK_FILE() does not work when cross-compiling.

>
> Looking at the PTHREAD matches in apr.h:
>
> #define APR_USE_PROC_PTHREAD_SERIALIZE    1
> #define APR_HAS_PROC_PTHREAD_SERIALIZE    0

Inconsistent :/

I can think of two ways to fix it:
1. don't check for /dev/zero for PROC_PTHREAD capability,
2. don't try to use PROC_PTHREAD by default when cross compiling.

We could do #1 if all unixes had /dev/zero, which I'm not sure of.

With #2, the default when cross compiling on linux-like target would
probably be SYSVSEM, but forcing with "./configure
apr_lock_method=USE_PROC_PTHREAD_SERIALIZE ..." is still possible.
Does not look insane or too much to ask, to me...

So attached patch is #2, better ideas?

Regards,
Yann.
Index: configure.in
===================================================================
--- configure.in	(revision 1872185)
+++ configure.in	(working copy)
@@ -2376,8 +2376,8 @@ APR_IFALLYES(func:semget func:semctl func:semop de
 APR_IFALLYES(header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc, 
             APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores])) 
 # pthread mutex both pshared and robust[_np] is the best default
-case "$apr_cv_mutex_robust_shared" in
-"yes"|"np")
+case "$hasprocpthreadser:$apr_cv_mutex_robust_shared" in
+"1:yes" | "1:np")
     APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread pshared mutex]) 
     ;;
 *)
@@ -2396,21 +2396,27 @@ procpthreadser="0"
 fcntlser="0"
 case $ac_decision in
     USE_FLOCK_SERIALIZE )
+        hasflockser="1"
         flockser="1"
         ;;
     USE_FCNTL_SERIALIZE )
+        hasfcntlser="1"
         fcntlser="1"
         ;;
     USE_SYSVSEM_SERIALIZE )
+        hassysvser="1"
         sysvser="1"
         ;;
     USE_POSIXSEM_SERIALIZE )
+        hasposixser="1"
         posixser="1"
         ;;
     USE_PROC_PTHREAD_SERIALIZE )
+        hasprocpthreadser="1"
         procpthreadser="1"
         ;;
     USE_BEOSSEM )
+        hasbeossem="1"
         beossem="1"
         ;;
 esac

Reply via email to