From 4f4753832ece907ee68fd4136fc0137966c74608 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 7 Jul 2002 20:28:25 +0000
Subject: [PATCH] Move CXX platform-specific stuff into template files.

---
 configure             | 12 ++++++------
 configure.in          | 14 +++++++-------
 src/template/freebsd  |  2 +-
 src/template/osf      |  1 +
 src/template/unixware |  1 +
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index 19c0cd9fafb..7a96295d1de 100755
--- a/configure
+++ b/configure
@@ -1916,6 +1916,10 @@ echo "$as_me: error: argument required for --with-CC option" >&2;}
 fi;
 
 
+# Set here so it can be over-ridden in the template file
+GCC_CXXFLAGS="-O2"
+VENDOR_CXXFLAGS=""
+
 case $template in
   aix) pgac_cc_list="gcc xlc";;
  irix) pgac_cc_list="cc";; # no gcc
@@ -4043,13 +4047,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
   if test "$ac_env_CXXFLAGS" != set; then
     if test "$GXX" = yes; then
-      CXXFLAGS=-O2
+      CXXFLAGS="$GCC_CXXFLAGS"
     else
-      case $template in
-	osf)		CXXFLAGS='-O4 -Olimit 2000' ;;
-        unixware)	CXXFLAGS='-O' ;;
-	*)		CXXFLAGS= ;;
-      esac
+      CXXFLAGS="$VENDOR_CXXFLAGS"
     fi
   fi
   if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
diff --git a/configure.in b/configure.in
index 0accbce5086..479c300cd8d 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $Header: /cvsroot/pgsql/configure.in,v 1.186 2002/05/28 16:57:53 petere Exp $
+dnl $Header: /cvsroot/pgsql/configure.in,v 1.187 2002/07/07 20:28:24 momjian Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -243,6 +243,10 @@ AC_SUBST(enable_debug)
 # variable.
 PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
 
+# Set here so it can be over-ridden in the template file
+GCC_CXXFLAGS="-O2"
+VENDOR_CXXFLAGS=""
+
 case $template in
   aix) pgac_cc_list="gcc xlc";;
  irix) pgac_cc_list="cc";; # no gcc
@@ -593,13 +597,9 @@ PGAC_ARG_OPTARG(with, CXX, [  --with-CXX              build C++ modules (libpq++
   AC_PROG_CXX
   if test "$ac_env_CXXFLAGS" != set; then
     if test "$GXX" = yes; then
-      CXXFLAGS=-O2
+      CXXFLAGS="$GCC_CXXFLAGS"
     else
-      case $template in
-	osf)		CXXFLAGS='-O4 -Olimit 2000' ;;
-        unixware)	CXXFLAGS='-O' ;;
-	*)		CXXFLAGS= ;;
-      esac
+      CXXFLAGS="$VENDOR_CXXFLAGS"
     fi
   fi
   if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
diff --git a/src/template/freebsd b/src/template/freebsd
index 1e8095a5d6a..c44e3602061 100644
--- a/src/template/freebsd
+++ b/src/template/freebsd
@@ -2,5 +2,5 @@ CFLAGS='-pipe'
 
 case $host_cpu in
   alpha*)   CFLAGS="$CFLAGS -O";;
-            CXXFLAGS="$CXXFLAGS -O"
+            GCC_CXXFLAGS="-O"
 esac
diff --git a/src/template/osf b/src/template/osf
index 938120f73a1..c38cbec8b59 100644
--- a/src/template/osf
+++ b/src/template/osf
@@ -6,3 +6,4 @@ else
   CFLAGS='-O4 -Olimit 2000'
   CCC=cxx
 fi
+VENDOR_CXXFLAGS='-O4 -Olimit 2000'
diff --git a/src/template/unixware b/src/template/unixware
index 3dc45073c6f..df54dc5f355 100644
--- a/src/template/unixware
+++ b/src/template/unixware
@@ -3,3 +3,4 @@ if test "$GCC" = yes; then
 else
   CFLAGS='-O -K inline'
 fi
+VENDOR_CXXFLAGS="-O"
-- 
GitLab