From 23c292688f8edca3dea9ea433a2a80e6ec6def31 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Wed, 5 Nov 2003 00:09:08 +0000
Subject: [PATCH] Add detection of compiler bug.

---
 src/template/unixware | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/template/unixware b/src/template/unixware
index 1b420c81c43..f682a16675e 100644
--- a/src/template/unixware
+++ b/src/template/unixware
@@ -1,10 +1,26 @@
 if test "$GCC" = yes; then
   THREAD_CPPFLAGS="-pthread"
 else
-# the -Kno_host is temporary for a bug in the compiler.  See -hackers
-# discussion on 7-8/Aug/2003.
-# when the 7.1.3UP3 or later compiler is out, we can do a version check.
-  CFLAGS="-O -Kinline,no_host"
+  # The -Kno_host is for a bug in the compiler.  See -hackers
+  # discussion on 7-8/Aug/2003.
+  cat >conftest.c <<__EOF__
+extern char *strcpy(char *, const char *);
+
+static void f(char *p, int n){
+        strcpy(p+n,"");
+}
+void g(void){
+        f(0, 0);
+}
+__EOF__
+
+  if $CC -c -Kinline conftest.c >conftest.err 2>&1; then
+    CFLAGS="-O -Kinline"
+  else
+    CFLAGS="-O -Kinline,no_host"
+  fi
+  rm -f conftest.*
+
   THREAD_CPPFLAGS="-K pthread"
 fi
 
-- 
GitLab