From f7bae20d675786790725f77ddc3486f7c5a047ea Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 2 Dec 2004 18:11:40 +0000
Subject: [PATCH] Don't bother adding to cflags/cppflags, just set them because
 configure handles that, and make solaris debug use no optimization.

---
 src/template/aix      | 4 ++--
 src/template/freebsd  | 2 +-
 src/template/hpux     | 4 ++--
 src/template/linux    | 2 +-
 src/template/osf      | 2 +-
 src/template/solaris  | 5 ++++-
 src/template/univel   | 2 +-
 src/template/unixware | 4 ++--
 8 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/template/aix b/src/template/aix
index 96641125bb4..48f1110f3e8 100644
--- a/src/template/aix
+++ b/src/template/aix
@@ -1,10 +1,10 @@
 if test "$GCC" != yes ; then
   case $host_os in
     aix3.2.5 | aix4.1*)
-      CFLAGS="$CFLAGS -O -qmaxmem=16384 -qsrcmsg"
+      CFLAGS="-O -qmaxmem=16384 -qsrcmsg"
       ;;
     *)
-      CFLAGS="$CFLAGS -O2 -qmaxmem=16384 -qsrcmsg -qlonglong"
+      CFLAGS="-O2 -qmaxmem=16384 -qsrcmsg -qlonglong"
       ;;
   esac
 fi
diff --git a/src/template/freebsd b/src/template/freebsd
index 48fc9dfa34c..718359e07c6 100644
--- a/src/template/freebsd
+++ b/src/template/freebsd
@@ -1,3 +1,3 @@
 case $host_cpu in
-  alpha*)   CFLAGS="$CFLAGS -O";;  # alpha has problems with -O2
+  alpha*)   CFLAGS="-O";;  # alpha has problems with -O2
 esac
diff --git a/src/template/hpux b/src/template/hpux
index f8b6197f80c..775c55a9353 100644
--- a/src/template/hpux
+++ b/src/template/hpux
@@ -1,8 +1,8 @@
-CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
+CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
 
 if test "$GCC" != yes ; then
   CC="$CC -Ae"
-  CFLAGS="$CFLAGS +O2"
+  CFLAGS="+O2"
 fi
 
 # Pick right test-and-set (TAS) code.  We need out-of-line assembler
diff --git a/src/template/linux b/src/template/linux
index ecb7ba4baba..dfb391ea542 100644
--- a/src/template/linux
+++ b/src/template/linux
@@ -1,2 +1,2 @@
 # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
-CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+CPPFLAGS="-D_GNU_SOURCE"
diff --git a/src/template/osf b/src/template/osf
index fbe4ab03ebe..e845cfecea8 100644
--- a/src/template/osf
+++ b/src/template/osf
@@ -1,4 +1,4 @@
 if test "$GCC" != yes ; then
   CC="$CC -std"
-  CFLAGS="$CFLAGS -O -ieee"
+  CFLAGS="-O -ieee"
 fi
diff --git a/src/template/solaris b/src/template/solaris
index 93f3cd730da..e6ee10f560b 100644
--- a/src/template/solaris
+++ b/src/template/solaris
@@ -1,6 +1,9 @@
 if test "$GCC" != yes ; then
   CC="$CC -Xa"			# relaxed ISO C mode
-  CFLAGS="$CFLAGS -O -v"		# -v is like gcc -Wall
+  CFLAGS="-v"			# -v is like gcc -Wall
+  if test "$enable_debug" != yes; then
+    CFLAGS="$CFLAGS -O"		# any optimization breaks debug
+  fi
 fi
 
 # Pick right test-and-set (TAS) code.  We need out-of-line assembler
diff --git a/src/template/univel b/src/template/univel
index 12d11496735..30980fee0a5 100644
--- a/src/template/univel
+++ b/src/template/univel
@@ -1,2 +1,2 @@
-CFLAGS="$CFLAGS -v -O -K i486,host,inline,loop_unroll -Dsvr4"
+CFLAGS="-v -O -K i486,host,inline,loop_unroll -Dsvr4"
 LIBS="-lc89"
diff --git a/src/template/unixware b/src/template/unixware
index a4125af2d9a..499eb9c3497 100644
--- a/src/template/unixware
+++ b/src/template/unixware
@@ -13,9 +13,9 @@ void g(void){
 __EOF__
 
   if $CC -c -O -Kinline conftest.c >conftest.err 2>&1; then
-    CFLAGS="$CFLAGS -O -Kinline"
+    CFLAGS="-O -Kinline"
   else
-    CFLAGS="$CFLAGS -O -Kinline,no_host"
+    CFLAGS="-O -Kinline,no_host"
   fi
   rm -f conftest.*
 
-- 
GitLab