Merged revisions 76566 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r76566 | mark.dickinson | 2009-11-28 12:48:43 +0000 (Sat, 28 Nov 2009) | 18 lines

  Merged revisions 76432,76558 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r76432 | mark.dickinson | 2009-11-20 19:30:22 +0000 (Fri, 20 Nov 2009) | 5 lines

    Issue #7272:  Add configure test to detect whether sem_open works
    properly, and use this to skip test_multiprocessing on platforms
    where sem_open raises a signal.  This should fix some FreeBSD buildbot
    failures for test_multiprocessing.
  ........
    r76558 | mark.dickinson | 2009-11-28 10:44:20 +0000 (Sat, 28 Nov 2009) | 4 lines

    Issue #7272, continued:  don't re-use existing HAVE_BROKEN_POSIX_SEMAPHORES
    to indicate that semaphores aren't available;  define a new variable
    POSIX_SEMAPHORES_NOT_ENABLED instead.
  ........
................
diff --git a/configure.in b/configure.in
index 1d024cd..09714d5 100644
--- a/configure.in
+++ b/configure.in
@@ -3338,6 +3338,40 @@
 
 LIBS=$LIBS_SAVE
 
+# For multiprocessing module, check that sem_open
+# actually works.  For FreeBSD versions <= 7.2,
+# the kernel module that provides POSIX semaphores
+# isn't loaded by default, so an attempt to call
+# sem_open results in a 'Signal 12' error.
+AC_MSG_CHECKING(whether POSIX semaphores are enabled)
+AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
+AC_TRY_RUN([
+#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);
+  return 0;
+}
+], ac_cv_posix_semaphores_enabled=yes,
+   ac_cv_posix_semaphores_enabled=no,
+   ac_cv_posix_semaphores_enabled=yes)
+)
+AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
+if test $ac_cv_posix_semaphores_enabled = no
+then
+  AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
+            [Define if POSIX semaphores aren't enabled on your system])
+fi
+
 # Multiprocessing check for broken sem_getvalue
 AC_MSG_CHECKING(for broken sem_getvalue)
 AC_TRY_RUN([