From owner-freebsd-ports Fri Feb 2 09:15:17 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA03058 for ports-outgoing; Fri, 2 Feb 1996 09:15:17 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [192.216.222.3]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA03029 Fri, 2 Feb 1996 09:15:11 -0800 (PST) Received: from rover.village.org (rover.village.org [204.144.255.49]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id JAA01100 ; Fri, 2 Feb 1996 09:14:52 -0800 Received: from localhost (localhost [127.0.0.1]) by rover.village.org (8.6.11/8.6.6) with SMTP id HAA24937; Fri, 2 Feb 1996 07:39:38 -0700 Message-Id: <199602021439.HAA24937@rover.village.org> To: Andreas Klemm Subject: Re: Another Pentium gcc patch, -D__FreeBSD__=2 -Dbsd4_4 Cc: hackers@FreeBSD.org, ports@FreeBSD.org In-reply-to: Your message of Thu, 01 Feb 1996 19:41:39 +0100 Date: Fri, 02 Feb 1996 07:39:37 -0700 From: Warner Losh Sender: owner-ports@FreeBSD.org Precedence: bulk : When I did the gcc port, cc failed to compile some sources, because : the correct typedef for us (FreeBSD) was only included, when bsd4_4 : would have beed defined. So I had to patch the sources, to add : : #if defined(bsd4_4) && defined(__FreeBSD__) : ^^^^^^^^^^^^^^^^^^^^^^^ : : I think the bsd4_4 definition should be included to make it easier : to compile stuff for 4.4 BSD. It seems to me, that it's for some : people common to test for bsd4_4. It would make it easier to : compile those sources and would decrease the amount of modifications/ : patches. The latest gcc don't have this problem. In fact, xm-freebsd.h defines HAVE_STRERROR so that bsd4_4 doesn't even get tested for builds for FreeBSD systems. bsd4_4 is defined by gcc *ONLY* on mips-dec-bsd, as far as I can tell. That's the only place in the entire gcc 2.7.2 sources where -Dbsd4_4 or #define bsd4_4 happens in the source. As it turns out, cpp is compiled on this one architecture to have bsd4_4 defined. NetBSD doesn't, FreeBSD doesn't, BSDi doesn't. Etc. gcc itself only uses bsd4_4 when HAVE_STRERROR isn't defined and it is building its own strerror. gcc didn't used to be like this, but it is as of the latest release. In fact, most versions of gcc that were wrong were easily fixed by adding #define HAVE_STRERROR to tm-freebsd.h and rebuilding. I recall once adding #define bsd4_4 to that file a long time ago before the HAVE_STRERROR code was in place. Since that was just once place to fix, rather than 6 or so in the sources. That's part of porting, I guess :-). If you want bsd4_4, then you can just as easily include: #ifdef HAVE_SYS_PARAMS #include #endif #ifdef BSD4_4 #define bsd4_4 #endif since params.h is the *STANDARD* bsd way of figuring out if you are running on a BSD system. To date, I have never needed __FreeBSD__ as a define. The BSD year/month version number has always proven to be suffcient for my needs. This includes porting kerberos, gcc and some other stuff that had old, icky defines before. I've ported about 500,000 lines of code to FreeBSD between work projects and software from the net, so this isn't a trivial amount of code. I'm not saying that __FreeBSD__ shouldn't be defined, but its use should be very rare... Ideally, however, you'd not need to ask the question "Am I running BSD 4.4" Instead, something like autoconfig should ask much smaller questions and then tell you what it found by defining HAVE_STRERROR, HAVE_BROKEN_SELECT, HAVE_PARALLEL_PRINTER_PORT_DONGLE, etc. Warner