Bug #23294 Detection of sem_xxx functions on NetBSD broken and DragonflyBSD misc patches
Submitted: 14 Oct 2006 17:22 Modified: 9 Jun 2007 17:57
Reporter: Juan RP Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.26 OS:Other (NetBSD, DragonFlyBSD)
Assigned to: Chad MILLER CPU Architecture:Any
Tags: Contribution, netbsd, sem_xxx

[14 Oct 2006 17:22] Juan RP
Description:
Detection of sem_xxx functions on NetBSD is broken, because the functions are not available on libposix4 as Solaris, we have them in librt.

The patch also contains patches to detect correctly features in the DragonFlyBSD Operating System.

The following patch is used on the NetBSD packages collection for some time now,
it would be nice if you can apply it for the next version.

Thanks.

How to repeat:
cd pkgsrc/databases/mysql5-client && make configure

Suggested fix:
--- configure.in.orig   2006-10-14 18:56:35.000000000 +0200
+++ configure.in        2006-10-14 18:58:41.000000000 +0200
@@ -475,7 +475,7 @@
   FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
 else
   case $SYSTEM_TYPE in
-    *freebsd*)
+    *freebsd*|*dragonfly*)
       FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
       ;;
     *darwin*)
@@ -752,6 +752,8 @@
 
 # For sem_xxx functions on Solaris 2.6
 AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
+# For sem_xxx functions on NetBSD
+AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(rt, sem_init))
 MYSQL_CHECK_ZLIB_WITH_COMPRESS
 
 # For large pages support
@@ -1077,7 +1079,7 @@
       MAX_C_OPTIMIZE="-O"
     fi
     ;;
-  *freebsd*)
+  *freebsd*|*dragonfly*)
     AC_MSG_WARN([Adding fix for interrupted reads])
     OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
     if test "$OSVERSION" -gt "480100" && \
[18 Oct 2006 16:17] Valeriy Kravchuk
Thank you for a patch.
[12 Dec 2006 14:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/16832

ChangeSet@1.2326, 2006-12-12 09:43:12-05:00, cmiller@zippy.cornsilk.net +1 -0
  Bug#23294: Detection of sem_xxx functions on NetBSD broken and DragonflyBSD \
  	misc patches
  
  Patch from community member Juan RP.  "dragonfly" os name should be synonymous
  with netbsd and sem_* functions may also be found in librt.
[20 Apr 2007 20:55] Kent Boortz
Part of the patch is obsolete, there is no use of "sem_init",
but just removing the test would break the build on some
platforms, as "posix4" is needed to define sched_yield().
The current configure line is

 # For the sched_yield() function on Solaris                                                                              
 AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield))

So question is if this test is enough for NetBSD/DragonFly?
[8 May 2007 13:16] Chad MILLER
The answer is no, sched_yield is in the libc on FBSD.  Re-adding the check inside librt.
[8 May 2007 13:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26297

ChangeSet@1.2477, 2007-05-08 09:18:51-04:00, cmiller@zippy.cornsilk.net +1 -0
  Bug #23294: Detection of sem_xxx functions on NetBSD broken and \
  	DragonflyBSD misc patches
  
  Add the original intended test, since our current test for sched_yield
  is insufficient to copy.
[8 May 2007 13:46] Chad MILLER
Queued to mysql-5.1-maint (for 5.1 enterprise) and to mysql-5.0-comeng (for community).
[8 May 2007 22:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26337

ChangeSet@1.2478, 2007-05-08 18:19:36-04:00, cmiller@zippy.cornsilk.net +1 -0
  Bug #23294: Detection of sem_xxx functions on NetBSD broken and \
  	DragonflyBSD misc patches
  
  The bug reporter anticipated a problem, instead of experiencing one.
  
  IRC conversation:
  <xtraeme> sem_init is defined in librt on NetBSD
  	solaris uses libposix4 iirc
  	that's why I sent a patch
  <chadmiller> xtraeme: Agreed.  But, AFAICT, mysql doesn't use 
  	sem_init() anywhere.  Thus my confusion.
  <xtraeme> I didn't verify that, but I saw that sem_init wasn't detected 
  	correctly...
  	why are you checking for sem_init if it's unused then? :-)
  <chadmiller> xtraeme: In recent autoconf scripts, we change it to test 
  	for sched_yield() .
  <xtraeme> that's ok then
  	sched_yield is in libc
  	feel free to close the bug report then :-)
[22 May 2007 17:01] Bugs System
Pushed into 5.1.19-beta
[9 Jun 2007 17:57] Paul DuBois
No changelog entry needed.
[16 Jun 2007 4:50] Bugs System
Pushed into 5.0.44
[16 Jun 2007 4:51] Bugs System
Pushed into 5.1.20-beta