DragonFly BSD
DragonFly submit List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] SDBM_File fails to build on some platforms due to use of 'extern int errno' (was: Re: patches for lang/perl5.8 dfport override)


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Sun, 22 May 2005 14:38:18 -0700

On Tue, 17 May 2005 08:08:53 +0200
Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx> wrote:

> On Mon, May 16, 2005 at 05:24:59PM -0700, Chris Pressey wrote:
> > Patches so that Perl5.8 can build.  I built it by putting these
> > patches into ports/lang/perl5.8/files.  The proper way to do it
> > would be to make a dfport override, but since no-one seems to know
> > why my previous attempt at making one of those doesn't work, this
> > activity is left as an exercise for the reader.  :)
> 
> [already in pkgsrc, I said I would move my work there :)]
> 
> Can you check whether the patch to util.c is really needed?

Hm, I guess it isn't.

> It's not build here. Also query the freebsd maintainer, it's a simple
> non-intrusive patch :)

OK, tobez@xxxxxxxxxxx and perlbug@xxxxxxxx cc'ed.

To re-iterate: the problem is that SDBM_File (part of Perl 5.8.6) fails
to build on some platforms (such as DragonFlyBSD) due to the obsolete
way it declares errno, as 'extern int errno'.  Errno is not guaranteed
to be defined this way under POSIX; '#include <errno.h>' is the
preferred way of obtaining an errno declaration.

The attached patch makes the appropriate substitution in the SDBM_File
source.

I'm not aware of any platforms on which '#include <errno.h>' is
insufficient; if there are such, the correct solution would be to probe
for this during the configure phase and conditionalize the compilation,
something like:

    #ifdef HAS_ERRNO_H
    #include <errno.h>
    #else
    extern int errno;
    #endif

Thanks,
-Chris

--- ext/SDBM_File/sdbm/sdbm.c.orig	2005-05-16 16:26:17.000000000 -0700
+++ ext/SDBM_File/sdbm/sdbm.c	2005-05-16 16:26:53.000000000 -0700
@@ -31,14 +31,7 @@
 # include <strings.h>
 #endif
 
-/*
- * externals
- */
-#ifndef WIN32
-#ifndef sun
-extern int errno;
-#endif
-#endif
+#include <errno.h>
 
 extern Malloc_t malloc proto((MEM_SIZE));
 extern Free_t free proto((Malloc_t));




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]