NetBSD-Users archive

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

Re: NetBSD macros

Am 14.12.2009 um 18:38 schrieb Sad Clouds:

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.

You don't have to learn much to use autoconf, but you have to understand the philosophie of autoconf and how checks are done.

It would be naive to think that by simply running autoconf all your problems
would be solved.

Exactly, they're only solved by autoconf if you do it right.

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.

And this is where you're wrong: autoconf *DOES* allow you to make it possible to make your app portable, even to systems you never even tried. If you checked all the functions you use correctly, it will just work. In fact, I often had success stories from strange systems on strange CPUs for software that had a well-written - and nobody ever thought about these systems, but nevertheless did the necessary checks. It's wrong to assume you just need to check those things that are different between the OSes you're targetting. You also need to check for what they have in common and if it behaves like you expect!

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.

I know software that has been developed for BSD/Linux/Solaris and runs on AIX or HP-UX because it was well-written.

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.

You *DO* know that this will qucikly get 100 times longer than any file, right? Because if you only list all NetBSD versions for a single feature, an autoconf check is already shorter - AND more accurate. What if someone uses an older compiler with a newer libc? The compiler won't know that it's running on a newer libc where newer features are available. autoconf will.


Home | Main Index | Thread Index | Old Index