BSD >= 199306

View: New views
6 Messages — Rating Filter:   Alert me  

BSD >= 199306

by Magnus Holmgren-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all. I maintain a package (prayer) that doesn't use autotools and instead
detects BSD with:

#include <sys/param.h>
#if (defined(BSD) && BSD >= 199306)

Googling around, this seems pretty standard and recommended procedure, but
apparently it doesn't work on Debian GNU/*BSD. So how should I do?

Please CC me when replying.

--
Magnus Holmgren        holmgren@...
Debian Developer


signature.asc (196 bytes) Download Attachment

Re: BSD >= 199306

by Petr Salinger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi all. I maintain a package (prayer) that doesn't use autotools and instead
> detects BSD with:
>
> #include <sys/param.h>
> #if (defined(BSD) && BSD >= 199306)
>
> Googling around, this seems pretty standard and recommended procedure, but
> apparently it doesn't work on Debian GNU/*BSD. So how should I do?

It depends on what you really want to test.
The kernel variant (FreeBSD) is signaled by __FreeBSD_kernel__
and libc variant (glibc) by __GLIBC__.

You can take a look at http://io.debian.net/ssh.html
and test directly on GNU/kFreeBSD whether your package is dependent on
kernel or libc environment. In the worst case, it would be a mixture :-(

Petr


--
To UNSUBSCRIBE, email to debian-bsd-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Parent Message unknown Re: BSD >= 199306

by Pedro Giffuni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(oops I forgot to CC the Debian list just for information purposes)

> Hi all. I maintain a package (prayer) that doesn't use autotools and
> instead detects BSD with:
>
> #include <sys/param.h>
> #if (defined(BSD) && BSD >= 199306)

This code actually has its origin in section 12.4 of FreeBSD's Porters Handbook:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-versions.html

For kernel features it might be OK, but this was not really meant for dealing with libc's other than the base BSD libc.

Pedro.



      Hai un indirizzo email difficile da ricordare?
Scegli quello che hai sempre desiderato su Yahoo! Mail
http://it.docs.yahoo.com/nuovo_indirizzo.html


--
To UNSUBSCRIBE, email to debian-bsd-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: BSD >= 199306

by Magnus Holmgren-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On onsdagen den 25 juni 2008, Petr Salinger wrote:

> > Hi all. I maintain a package (prayer) that doesn't use autotools and
> > instead detects BSD with:
> >
> > #include <sys/param.h>
> > #if (defined(BSD) && BSD >= 199306)
> >
> > Googling around, this seems pretty standard and recommended procedure,
> > but apparently it doesn't work on Debian GNU/*BSD. So how should I do?
>
> It depends on what you really want to test.
> The kernel variant (FreeBSD) is signaled by __FreeBSD_kernel__
> and libc variant (glibc) by __GLIBC__.
What about OpenBSD?

--
Magnus Holmgren        holmgren@...
Debian Developer       (Not subscribed to this list)


signature.asc (196 bytes) Download Attachment

Re: BSD >= 199306

by Thorsten Glaser-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Magnus Holmgren dixit:

>What about OpenBSD?

OpenBSD only defines __OpenBSD__ in gcc, therefore you can use
#if defined(__OpenBSD__) && !defined(__MirBSD__) to test (as
MirBSD defines both __OpenBSD__ and __MirBSD__ in gcc and pcc).

There’s also <sys/param.h> which has OpenBSD in OpenBSD but not
in MirBSD, and MirBSD only in the latter.

Note that MidnightBSD currently defines exactly the same things
as FreeBSD (in gcc), but will _add_ a __MidnightBSD__ macro soo-
nish (and already does that in pcc), but keep the FBSD ones too.

You probably want to add … && !defined(__GLIBC__) to the test
mentioned above then.

//mirabilos
--
Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font. -- Rob Pike in "Notes on Programming in C"


--
To UNSUBSCRIBE, email to debian-bsd-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: BSD >= 199306

by Petr Salinger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> It depends on what you really want to test.
>> The kernel variant (FreeBSD) is signaled by __FreeBSD_kernel__
>> and libc variant (glibc) by __GLIBC__.
>
> What about OpenBSD?

I have just looked into source of prayer,

the main difference between linux and bsd are

1) os_limit_vm(), os_prctl_set_dumpable()
    they are no-op on BSD, so it is easy to guard them via __linux__

2) os_run_pty()
    on linux, there are available two variants - bsd one and sysv one.
    once again, it is easy to guard sysv one by __linux__

The difference between linux and solaris is also small,
on solaris is different locking and there is only one variant
for os_run_pty(), the sysv one.

The remaining differences are slightly different include files,
nonexistent socklen_t and ipv6 support on solaris.

IMHO, it would be much better to merge all three files
into one and use sensible defaults,
i.e.

   * IPV6 is supported
   * socklen_t is supported
   * os_limit_vm() and os_prctl_set_dumpable() are no-op by default
   * use BSD PTY
   * flock() does exist

and create exception for the above based on __linux__, __svr4__
and SOLARIS macros.


Petr


--
To UNSUBSCRIBE, email to debian-bsd-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...

LightInTheBox - Buy quality products at wholesale price