Hind Forsum
Hind Forsum

Reputation: 10497

How does "configure" script detect if my system support some header files or cpp feature?

I'm trying to compile google rpc(grpc) on my RHEL 5 box, the configure script checks and throws this error:

configure: error: sched_yield was not found on your system

I checked config.log file and found sth like this:

| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char sched_yield ();
| int
| main ()
| {
| return sched_yield ();
|   ;
|   return 0;
| }
configure:19729: result: no
configure:19736: error: in `/downloads/grpc/third_party/protobuf':
configure:19738: error: sched_yield was not found on your system

Well, it's correct, I did a manual test and is not found. No problem.

But, I just wish to know the principle behind "configure"!

Does "configure" try to generate some c/c++ source code and compile it, in order to see if some features are supported? As you know the "configure" script usually run very fast, much faster than calling a lot of gcc/g++ processes to try headers/features.

So how does "configure" achieve this header/feature "check"?

Upvotes: 0

Views: 353

Answers (1)

YSC
YSC

Reputation: 40060

Does "configure" try to generate some c/c++ source code and compile it, in order to see if some features are supported?

Yes.

As you know the "configure" script usually run very fast [...]

Not in my experience. configure is slowwwwww...

So how does "configure" achieve this header/feature "check"?

See Q #1.

Upvotes: 5

Related Questions