Hi.

I'm one of the Debian package maintainers for cyrus-imapd. We received a
report at http://bugs.debian.org/388242 that cyrus-imapd fails to build
on the kfreebsd port of Debian. Problem seems to be that sys/exec.h
exports PS_STRINGS, but that this macro is only usable while compiling
the kernel. To be more precise, it exports

#define PS_STRINGS      (USRSTACK - sizeof(struct ps_strings))

But USRSTACK is only defined for kernel builds. He (Petr Salinger)
initially proposed to use:

==========================================================
--- cyrus-imapd-2.2-2.2.13/configure.in
+++ cyrus-imapd-2.2-2.2.13/configure.in
@@ -300,7 +284,7 @@
        AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_TRY_CPP([
 #include <machine/vmparam.h>
 #include <sys/exec.h>
-#ifndef PS_STRINGS
+#if !defined(PS_STRINGS) || defined (__GLIBC__)
 #include </nonexistent>
 #endif],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no))
        if test $cyrus_cv_sys_psstrings = yes; then
==========================================================

to fix it, but I objected since the test for __GLIBC__ to be defined
seemed too broad. After this objection, Petr proposed to use this
snippet instead of the above patch to test wether PS_STRINGS should be used:

==========================================================
if test "$spt_type" = ""; then
         AC_MSG_CHECKING(for PS_STRINGS)
         AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_COMPILE_IFELSE([
#include <machine/vmparam.h>
#include <sys/exec.h>
void *p = PS_STRINGS;
],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no))
         if test $cyrus_cv_sys_psstrings = yes; then
                 spt_type=SPT_PSSTRINGS
         fi
         AC_MSG_RESULT($cyrus_cv_sys_psstrings)
fi
==========================================================

This seems to work fine on Linux and as Petr proposed this, I think he
also tested it on GNU/kFreeBSD (i.e. a FreeBSD with GNU userspace
instead of the normal portage system). I have no way to check this on
other systems.

Comments?
Suggestions for other ways to fix it?

I attached the patch I applied to configure.in.

Regards,
Sven

PS: Please keep [EMAIL PROTECTED] Cc'ed
PPS: I would have sent this to the andrew bugzilla, but I'm still unable
to create an account there.
diff -urNad cyrus-imapd-2.2.13/configure.in 
/tmp/dpep.6LRag9/cyrus-imapd-2.2.13/configure.in
--- cyrus-imapd-2.2.13/configure.in     2006-09-25 20:13:04.000000000 +0200
+++ /tmp/dpep.6LRag9/cyrus-imapd-2.2.13/configure.in    2006-09-25 
20:13:06.102258297 +0200
@@ -297,16 +297,15 @@
 fi
 if test "$spt_type" = ""; then
        AC_MSG_CHECKING(for PS_STRINGS)
-       AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_TRY_CPP([
+AC_CACHE_VAL(cyrus_cv_sys_psstrings, AC_COMPILE_IFELSE([
 #include <machine/vmparam.h>
 #include <sys/exec.h>
-#ifndef PS_STRINGS
-#include </nonexistent>
-#endif],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no))
-       if test $cyrus_cv_sys_psstrings = yes; then
-               spt_type=SPT_PSSTRINGS
-       fi
-       AC_MSG_RESULT($cyrus_cv_sys_psstrings)
+void *p = PS_STRINGS;
+],cyrus_cv_sys_psstrings=yes,cyrus_cv_sys_psstrings=no))
+         if test $cyrus_cv_sys_psstrings = yes; then
+                 spt_type=SPT_PSSTRINGS
+         fi
+         AC_MSG_RESULT($cyrus_cv_sys_psstrings)
 fi
 if test "$spt_type" = ""; then
        AC_MSG_CHECKING(for SCO)

Reply via email to