Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Oct 2014 14:38:02 -0400
From:      George Mitchell <george+freebsd@m5p.com>
To:        freebsd ports <freebsd-ports@freebsd.org>
Subject:   Python 2.7 and semaphores
Message-ID:  <544BEE0A.2070402@m5p.com>

next in thread | raw e-mail | index | archive | help
In the process of building and trying textproc/meld, I discovered that
the lang/python27 configure process concludes, erroneously, that FreeBSD
does not support working Posix semaphores.  In particular, this program
from the configure script was alleged to fail, according to config.log:

#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <semaphore.h>
#include <sys/stat.h>

int main(void) {
   sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
   if (a == SEM_FAILED) {
     perror("sem_open");
     return 1;
   }
   sem_close(a);
   sem_unlink("/autoconf");
   return 0;
}

But when I compiled and ran the program by hand, it worked perfectly.

Then, poking around in lang/python27/Makefile, I found these two lines:

SEM_CONFIGURE_ENV=      ac_cv_posix_semaphores_enabled=yes
SEM_CONFIGURE_ENV_OFF=  ac_cv_posix_semaphores_enabled=no

I could not explain why these settings should have any effect on the
configure and build process, but muttering my most superstitious
imprecations under my breath I changed "...=no" to "...=yes" in the
second line and re-installed Python.  Lo and behold, configure now
admitted that Posix semaphores worked, and I could run meld.  (Why
meld needs working semaphores is beyond me, but I'll worry about that
another day.)

Can anyone explain to me how those lines affect the configure process?
And does either line belong in the Makefile at this point?    -- George



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?544BEE0A.2070402>