autoconf-262-support-20081020
[openafs.git] / src / cf / solaris-cc.m4
1 dnl
2 dnl $Id$
3 dnl 
4
5 dnl
6 dnl The Solaris compiler defines __SUNPRO_C as a hex number
7 dnl whose digits correspond to the digits in the compiler
8 dnl version. Thus compiler version 4.2.0 is 0x420.
9 dnl
10
11 AC_DEFUN([AC_SOLARIS_CC_GOOD], [
12 SOLARISCC="$CC"
13 save_CC="$CC"
14 if test "$CC" ; then
15   AC_CHECK_PROGS(SOLARISCC, "$CC" cc /opt/SUNWspro/bin/cc gcc)
16 else
17   AC_CHECK_PROGS(SOLARISCC, cc /opt/SUNWspro/bin/cc gcc)
18 fi
19 CC="$SOLARISCC"
20 AC_MSG_CHECKING(whether CC is a good enough Solaris cc)
21 AC_CACHE_VAL(ac_cv_solaris_cc_good,
22 [
23 SUNPROVERSION=0x400
24 AC_TRY_RUN(
25 [
26 int main(void) { return __SUNPRO_C < $SUNPROVERSION;}
27 ], 
28 ac_cv_solaris_cc_good=yes,
29 ac_cv_solaris_cc_good=no,
30 ac_cv_solaris_cc_good=no)
31 AC_MSG_RESULT($ac_cv_solaris_cc_good)])
32 if test "$ac_cv_solaris_cc_good" = "yes"; then
33   AC_CHECK_PROGS(CC, "$SOLARISCC")
34 else
35   CC="$save_CC"
36 fi
37 ])
38