]> granicus.if.org Git - php/commitdiff
MFH: Detect Sun C compiler and set default flags if it is used
authorDavid Soria Parra <dsp@php.net>
Thu, 6 Nov 2008 20:42:11 +0000 (20:42 +0000)
committerDavid Soria Parra <dsp@php.net>
Thu, 6 Nov 2008 20:42:11 +0000 (20:42 +0000)
NEWS
acinclude.m4
configure.in

diff --git a/NEWS b/NEWS
index b471092cfe0fcd753eddea5b8567c42927bfabd7..823b83e7150e172c5eac3b3fb913c34c05baf9a2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP                                                                        NEWS
 - Added concatenation option to bz2.decompress stream filter.
   (Keisial at gmail dot com, Greg)
 - Added support for using compressed connections with PDO_mysql. (Johannes)
+- Added default flags for suncc compiler. (David Soria Parra)
 
 - Deprecated define_syslog_variables(). (Kalle)
 
index bd63b6f65e2722494e34471b91070e8c734260d0..aac7ad554b2b997f2a46e81f174ed547a2806f12 100644 (file)
@@ -2766,6 +2766,22 @@ AC_DEFUN([PHP_DETECT_ICC],
   )
 ])
 
+dnl PHP_DETECT_SUNCC
+dnl Detect if the systems default compiler is suncc.
+dnl We also set some usefull CFLAGS if the user didn't set any
+AC_DEFUN([PHP_DETECT_SUNCC],[
+  SUNCC="no"
+  AC_MSG_CHECKING([for suncc])
+  AC_EGREP_CPP([^__SUNPRO_C], [__SUNPRO_C],
+    SUNCC="no"
+    AC_MSG_RESULT([no]),
+    SUNCC="yes"
+    test -n "$auto_cflags" && CFLAGS="-fsimple=2 -xnorunpath -xO4 -xalias_level=basic -xipo=1 -xlibmopt -xprefetch_level=1 -xprefetch=auto -xstrconst -xtarget=native -zlazyload"
+    GCC=""
+    AC_MSG_RESULT([yes])
+  )
+])
+
 dnl
 dnl PHP_CRYPT_R_STYLE
 dnl detect the style of crypt_r() is any is available
index ee4ad51499d9ab6d103e54984f1d2db1d65e5a00..1a3aada3f93bbbfc609e98c318e2954a1d35b928 100644 (file)
@@ -142,6 +142,7 @@ dnl -------------------------------------------------------------------------
 
 AC_PROG_CC
 PHP_DETECT_ICC
+PHP_DETECT_SUNCC
 AC_PROG_CC_C_O
 dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf
 dnl AC_PROG_CC_STDC
@@ -214,6 +215,10 @@ case $host_cpu in
       CFLAGS="$CFLAGS -ieee"
     fi
     ;;
+  sparc*)
+    if test "$SUNCC" = "yes"; then
+      CFLAGS="$CFLAGS -xmemalign=8s"
+    fi
 esac
 
 dnl activate some gcc specific optimizations for gcc >= 4
@@ -788,6 +793,15 @@ if test "$PHP_DEBUG" = "yes"; then
     CFLAGS="$CFLAGS -O0"
     CXXFLAGS="$CXXFLAGS -O0"
   fi
+  if test "$SUNCC" = "yes"; then
+    if -n "$auto_cflags"; then
+      CFLAGS="-g"
+      CXXFLAGS="-g"
+    else
+      CFLAGS="$CFLAGS -g"
+      CXXFLAGS="$CFLAGS -g"
+    fi
+  fi
 else
   PHP_DEBUG=0
   ZEND_DEBUG=no