kenton@google.com | a8923cd | 2009-05-01 21:53:10 +0000 | [diff] [blame] | 1 | dnl Check for the presence of the Sun Studio compiler. |
| 2 | dnl If Sun Studio compiler is found, set appropriate flags. |
| 3 | dnl Additionally, Sun Studio doesn't default to 64-bit by itself, |
| 4 | dnl nor does it automatically look in standard Solaris places for |
| 5 | dnl 64-bit libs, so we must add those options and paths to the search |
| 6 | dnl paths. |
| 7 | |
| 8 | dnl TODO(kenton): This is pretty hacky. It sets CXXFLAGS, which the autoconf |
| 9 | dnl docs say should never be overridden except by the user. It also isn't |
| 10 | dnl cross-compile safe. We should fix these problems, but since I don't have |
| 11 | dnl Sun CC at my disposal for testing, someone else will have to do it. |
| 12 | |
| 13 | AC_DEFUN([ACX_CHECK_SUNCC],[ |
| 14 | |
kenton@google.com | a518346 | 2009-05-28 00:48:15 +0000 | [diff] [blame] | 15 | AC_LANG_PUSH([C++]) |
| 16 | AC_CHECK_DECL([__SUNPRO_CC], [SUNCC="yes"], [SUNCC="no"]) |
kenton@google.com | a518346 | 2009-05-28 00:48:15 +0000 | [diff] [blame] | 17 | AC_LANG_POP() |
kenton@google.com | 6be265a | 2009-08-06 20:47:45 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | AC_ARG_ENABLE([64bit-solaris], |
| 21 | [AS_HELP_STRING([--disable-64bit-solaris], |
| 22 | [Build 64 bit binary on Solaris @<:@default=on@:>@])], |
| 23 | [ac_enable_64bit="$enableval"], |
| 24 | [ac_enable_64bit="yes"]) |
| 25 | |
| 26 | AS_IF([test "$SUNCC" = "yes" -a "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ |
| 27 | dnl Sun Studio has a crashing bug with -xO4 in some cases. Keep this |
| 28 | dnl at -xO3 until a proper test to detect those crashes can be done. |
kenton@google.com | bf06bb2 | 2009-12-23 22:02:18 +0000 | [diff] [blame] | 29 | CXXFLAGS="-g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef ${CXXFLAGS}" |
kenton@google.com | 6be265a | 2009-08-06 20:47:45 +0000 | [diff] [blame] | 30 | ]) |
| 31 | |
| 32 | case $host_os in |
| 33 | *solaris*) |
| 34 | AC_CHECK_PROGS(ISAINFO, [isainfo], [no]) |
| 35 | AS_IF([test "x$ISAINFO" != "xno"], |
| 36 | [isainfo_b=`${ISAINFO} -b`], |
| 37 | [isainfo_b="x"]) |
| 38 | |
| 39 | AS_IF([test "$isainfo_b" != "x"],[ |
| 40 | |
| 41 | isainfo_k=`${ISAINFO} -k` |
| 42 | |
| 43 | AS_IF([test "x$ac_enable_64bit" = "xyes"],[ |
| 44 | |
William Orr | 2d7786c | 2014-09-19 22:04:23 -0700 | [diff] [blame] | 45 | AC_DEFINE([SOLARIS_64BIT_ENABLED], [1], [64bit enabled]) |
kenton@google.com | 6be265a | 2009-08-06 20:47:45 +0000 | [diff] [blame] | 46 | AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[ |
| 47 | dnl The user hasn't overridden the default libdir, so we'll |
| 48 | dnl the dir suffix to match solaris 32/64-bit policy |
| 49 | libdir="${libdir}/${isainfo_k}" |
| 50 | ]) |
| 51 | |
| 52 | dnl This should just be set in CPPFLAGS and in LDFLAGS, but libtool |
| 53 | dnl does the wrong thing if you don't put it into CXXFLAGS. sigh. |
kenton@google.com | 45258ff | 2009-12-23 22:12:22 +0000 | [diff] [blame] | 54 | dnl (It also needs it in CFLAGS, or it does a different wrong thing!) |
kenton@google.com | 6be265a | 2009-08-06 20:47:45 +0000 | [diff] [blame] | 55 | AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ |
| 56 | CXXFLAGS="${CXXFLAGS} -m64" |
| 57 | ac_cv_env_CXXFLAGS_set=set |
| 58 | ac_cv_env_CXXFLAGS_value='-m64' |
| 59 | ]) |
| 60 | |
kenton@google.com | 45258ff | 2009-12-23 22:12:22 +0000 | [diff] [blame] | 61 | AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],[ |
| 62 | CFLAGS="${CFLAGS} -m64" |
| 63 | ac_cv_env_CFLAGS_set=set |
| 64 | ac_cv_env_CFLAGS_value='-m64' |
| 65 | ]) |
| 66 | |
kenton@google.com | 6be265a | 2009-08-06 20:47:45 +0000 | [diff] [blame] | 67 | AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" ],[ |
| 68 | CXXFLAGS="-xmemalign=8s ${CXXFLAGS}" |
| 69 | ]) |
| 70 | ]) |
| 71 | ]) |
| 72 | ;; |
| 73 | esac |
| 74 | |
kenton@google.com | a8923cd | 2009-05-01 21:53:10 +0000 | [diff] [blame] | 75 | ]) |