autoconf
[Top][All Lists]
Advanced

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

Detecting C compiler


From: Philip Willoughby
Subject: Detecting C compiler
Date: Mon, 1 Jul 2002 23:12:52 +0100 (BST)

Hi all,

I'm trying to write a pair of macros to enable strict ansi conformance mode
and all vaguely useful warnings for at least my target platforms:

* AIX with Visualage for C++ C compiler (xlc_r)
* Solaris with Sun's ANSI C compiler (cc)
* HP-UX with HP's C compiler (cc)
* Linux with GCC

I have used the feature of AC_PROG_CC which sets GCC to "yes" to check for
gcc, and when it comes to AIX I can just test if CC is xlc or xlc_r (I hope
-- this is untested).

The problem is what to do to differentiate between the Sun and HP cc's.

Any ideas are welcomed, as is any information (prefereably web addresses of
manuals) for other unix compilers (I'm afraid I can't bring myself to care
about windows)...

Ideas that have crossed my mind so far are:

* use `which' to detect the path to cc and grep that for clues.
* parse the output of `cc -h' and hope for clues
* get the user to tell me via --with-cc=[hp|sun|...]

I don't fancy which because there are no guarantees that the path will be
the same or even share any common elements across platforms/releases.

I don't want to parse `cc -h' because there is too much scope for change.

The final option is most reliable, but just plain ugly.

I haven't even considered looking at uname and relying on the kernel
architecture since that breaks the philosophy of autoconf.

Regards,

Philip Willoughby

Systems Programmer, Department of Computing, Imperial College, London, UK
--
echo address@hidden | tr "bizndfohces" "pwgd9ociaku"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]