From 3326bccbe31c9a889bf0a0accd09bb9482bb5e8f Mon Sep 17 00:00:00 2001
From: card_captor <card_captor@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sun, 9 Mar 2008 13:41:23 +0000
Subject: [PATCH] Modified configure.in to use Sun's compiler correctly in
 Solaris/x86.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2477 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG    |  4 +++-
 sm5/configure.in | 15 +++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 70654a144..ab3e94b7b 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.659 2008/03/04 21:24:58 ballen4705 Exp $
+$Id: CHANGELOG,v 1.660 2008/03/09 13:41:23 card_captor Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -38,6 +38,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 SMARTMONTOOLS STABLE RELEASE 5.38 2008/03/04
 
+  [KS] Solaris/x86: modified configure.in for Sun's compiler.
+
   [BA] smartd.initd.in addition from Erwan Velu <erwan@seanodes.com>
 
   [BA] smartd fixes:
diff --git a/sm5/configure.in b/sm5/configure.in
index 688a78479..918660304 100644
--- a/sm5/configure.in
+++ b/sm5/configure.in
@@ -1,5 +1,5 @@
 #
-# $Id: configure.in,v 1.133 2008/03/04 22:28:25 ballen4705 Exp $
+# $Id: configure.in,v 1.134 2008/03/09 13:41:23 card_captor Exp $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
@@ -7,7 +7,7 @@ AC_INIT(smartmontools, 5.38, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.cpp)
 
 smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.133 2008/03/04 22:28:25 ballen4705 Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.134 2008/03/09 13:41:23 card_captor Exp $'`
 smartmontools_release_date=2008/03/04
 smartmontools_release_time="22:28:04 GMT"
 
@@ -106,6 +106,10 @@ AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C++ compiler supports __attribute_
 AC_MSG_CHECKING([whether C++ compiler supports __attribute__((packed))])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])],
                   [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#error "Sun's compiler cannot handle __attribute__((packed))!"
+#endif]])],
+                  [true], [gcc_have_attr_packed=no])
 AC_SUBST(gcc_have_attr_packed)
 if test "$gcc_have_attr_packed" = "yes"; then
   AC_DEFINE(HAVE_ATTR_PACKED)
@@ -212,12 +216,15 @@ if test "x$GCC" = "xyes"; then
 else
  dnl We are NOT using gcc, so enable host-specific compiler flags
  case "${host}" in
-	*-*-solaris*) 
-          dnl set CXXFLAGS for Solaris C++ compiler
+	sparc*-*-solaris*) 
+          dnl set CXXFLAGS for Solaris/SPARC C++ compiler
           if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
             dnl we have to tell the compilers about packed ATA structures
             CXXFLAGS="-xmemalign=1i $CXXFLAGS"
           fi
+ esac
+ case "${host}" in
+	*-*-solaris*) 
           if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
             dnl turn on optimization if user has not explicitly set its value
             CXXFLAGS="-xO2 $CXXFLAGS"
-- 
GitLab