[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NetBSD macros
On Monday 14 December 2009 16:55:33 Jonathan Schleifer wrote:
> System identifiers are NEVER a good way to control compiler-time
> configuration, _NEVER_! You want to know features, _NOT_ operating
> systems! The features can and _WILL_ change over time! Just doing
> #ifdef __NetBSD__ will horribly fail, as features were removed over
> time and others added. And once a new release comes out, you have to
> update your code. Good luck updating your code whenever there's a new
> release of any OS in the world that changes some feature!
I haven't used autoconf that much. I remember years ago I looked into and I
found it too complex and time consuming to understand. I know a lot of people
complain about autoconf for similar reasons. At the end of the day nobody
wants to spend a lot of time learning m4 and trying to figure out why autoconf
does this, but fails to do that, etc.
It would be naive to think that by simply running autoconf all your problems
would be solved. There are so many factors that affect how you structure your
code, when you try to support multiple operating systems. I doubt if autoconf
will will always be able to figure it out for you. It's up to you to read the
man pages and then make sure your code compiles and runs on those operating
systems you're trying to support.
For example, if you only support BSD, Linux and Solaris, then no matter how
much autoconf you use, you cannot give assurance to people running operating
systems like AIX or HP-UX that they will be able to compile your code without
any problems. It's one of those things that you have to do manually.
It's probably simpler just to look at operating system name and version number
and use #ifdef. There will be some differences, but the major APIs don't
chance that much.
Main Index |
Thread Index |