Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: identifying osx in a conditional compile statement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: identifying osx in a conditional compile statement



Well, seems I can't help from adding my 2 cents either...

18 jul 2008 kl. 18.59 skrev Peter O'Gorman:

Terry Lambert wrote:

Even finding an operational linkage symbol in a library is a far cry
from knowing that it behaves a particular way; for example, setpgrp() on
a POSIX compliant system doesn't take parameters, while on a legacy
BSD-derived system, it takes two parameters. Your linkage test is not
going to tell you that.

No, but a proper compile test will.

Except on Linux, even compile tests are enough. Since the C library is a separate project from the kernel, the syscall mapping is not perfect. A syscall might exist in glibc, but not in the kernel, or vice versa. This bit me back when epoll was new, because systems had it in glibc but not the kernel. The only way to test that in autoconf is to actually running the code and check for ENOSYS, which is bad, since it breaks cross compiling.


But even then there's bugs to be considered, a kqueue implementation might be depending on support in the underlying drivers, and even if it works on a socket, it might not on a device node, etc. (A very real issue for me right now.) These cases are almost impossible to test for automatically, yet they have to be worked around if you want your app running on systems that have them.

That being said, I think it's very limiting to constrain oneself to what's only in POSIX. kqueue/epoll is an example of such a feature. It's very useful, but not standard. It can be appropriate to check for which of these features are available before starting the compile, as long as manual override is possible. Or does anyone have a good way to check if either kqueue or epoll is available during compiling?

autoconf has other problems too. It gives a guise of being easy to use, but in reality it's quite complex. But that's really a separate discussion...

In conclusion, while ./configure && make can be nice to get a program that (hopefully) works for the same machine as the compiling is done on, in almost every other situation I've found manual configuration to be better. Runtime configuration if possible, but compile time if not.
--
Pelle Johansson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >identifying osx in a conditional compile statement (From: Travis Siegel <email@hidden>)
 >Re: identifying osx in a conditional compile statement (From: Yuji Yamano <email@hidden>)
 >Re: identifying osx in a conditional compile statement (From: Terry Lambert <email@hidden>)
 >Re: identifying osx in a conditional compile statement (From: Peter O'Gorman <email@hidden>)
 >Re: identifying osx in a conditional compile statement (From: Terry Lambert <email@hidden>)
 >Re: identifying osx in a conditional compile statement (From: Peter O'Gorman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.