Operating System - Linux
1753425 Members
5274 Online
108793 Solutions
New Discussion юеВ

Distinguishing the bundled and optional C compilers

 
SOLVED
Go to solution
Steven Schweda
Honored Contributor

Distinguishing the bundled and optional C compilers

I'm working on the C compiler identification
section of a "configure" script.

On all systems, I can use the __hpux macro to
identify HP-UX.

On old PA-RISC systems, I can use __HP_cc to
distinguish between the bundled and optional C
compilers.

On IA64 systems, __HP_cc is defined even with
the bundled C compiler.

Is there a reliable macro I can use for this on
IA64, or do I need to start scanning stderr for
"(Bundled)" when I try to use some exotic
feature (in the code or on the command line)?


For example:

dy # uname -a
HP-UX dy B.11.11 U 9000/785 2012616114 unlimited-user license

dy # cat cct.c
#include

main()
{
#ifdef __hpux
printf( " __hpux\n");
#endif /* def __hpux */

#ifdef __HP_cc
printf( " __HP_cc\n");
#endif /* def __HP_cc */
}

dy # cc -o cct cct.c

dy # ./cct
__hpux
dy #


dyi # uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license

dyi # cc -o cct cct.c

dyi # ./cct
__hpux
__HP_cc
dyi #
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: Distinguishing the bundled and optional C compilers

It's very simple, the bundled C compiler is in /usr/ccs/bin/cc_bundled.
The fully functional compiler is in /opt/aCC/bin/cc on IPF and /opt/ansic/bin/cc on PA.

>Is there a reliable macro I can use for this on IA64, or do I need to start scanning stderr for "(Bundled)" when I try to use some exotic feature

Since you aren't suppose to be using the bundled C compiler, there is no easy way to tell the difference. So other than maintaining a list of values for __HP_cc, you'll have to look for "(Bundled)".

>On old PA-RISC systems, I can use __HP_cc

This probably won't work on 11.31.
Steven Schweda
Honored Contributor

Re: Distinguishing the bundled and optional C compilers

> [...] you aren't suppose[d] to be using the
> bundled C compiler [...]

Who supposes that? Someone who knows me not
well?

> >On old PA-RISC systems, I can use __HP_cc

> This probably won't work on 11.31.

Sure enough. Well, fine. I'll just look for
"(Bundled)" then. Thanks.
Steven Schweda
Honored Contributor

Re: Distinguishing the bundled and optional C compilers

.