Please find the updated patch. I have added this "+Olibmerrno" compile flag
check in configure/configure.in file.


OS
----
HP-UX B.11.31 U ia64

without patch
---------------
postgres=# select acos(2);
 acos
------
  NaN
(1 row)


with patch
-----------
postgres=# select acos(2);
ERROR:  input is out of range



On Tue, May 24, 2011 at 11:13 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:

> Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> writes:
> > So the default is indeed non-standard. But I wonder if we should use -Aa
> > instead?
>
> Probably not; at least on older HPUX versions, -Aa turns off access to
> assorted stuff that we do want, eg "long long".  "man cc" on my box
> saith
>
>     -Amode         Specify the compilation standard to be used by the
>                    compiler.  mode can be one of the following letters:
>
>                       c    (Default) Compile in a mode compatible with
>                            HP-UX releases prior to 7.0.  (See The C
>                            Programming Language, First Edition by
>                            Kernighan and Ritchie).  This option also
>                            defines the symbol _HPUX_SOURCE and allows the
>                            user to access macros and typedefs provided by
>                            the HPUX Operating System. The default
>                            compilation mode may change in future releases.
>
>                       a    Compile under ANSI mode (ANSI programming
>                            language C standard ISO 9899:1990).  When
>                            compiling under ANSI mode, the header files
>                            would define only those names (macros and
>                            typedefs) specified by the Standard. To access
>                            macros and typedefs that are not defined by the
>                            ANSI Standard but are provided by the HPUX
>                            Operating System, define the symbol
>                            _HPUX_SOURCE; or use the extension option
>                            described below.
>
>                       e    Extended ANSI mode.  Same as -Aa -D_HPUX_SOURCE
>                            +e.  This would define the names (macros and
>                            typedefs) provided by the HPUX Operating System
>                            and, in addition, allow the following
>                            extensions: $ characters in identifier names,
>                            sized enums, sized bit-fields, and 64-bit
>                            integral type long long.  Additional extensions
>                            may be added to this option in the future.
>
> The +e option is elsewhere stated to mean
>
>          +e                Enables HP value-added features while compiling
>                            in ANSI C mode, -Aa.  This option is ignored
>                            with -Ac because these features are already
>                            provided.  Features enabled:
>
>                                 o  Long pointers
>                                 o  Integral type specifiers can appear in
>                                    enum declarations.
>                                 o  The $ character can appear in
>                                    identifier names.
>                                 o  Missing parameters on intrinsic calls
>
> which isn't 100% consistent with what it says under -Ae, so maybe some
> additional experimentation is called for.  But anyway, autoconf appears
> to think that -Ae is preferable to the combination -Aa -D_HPUX_SOURCE
> (that choice is coming from autoconf not our own code); so I'm not
> optimistic that we can get more-standard behavior by overriding that.
>
>                        regards, tom lane
>



-- 
   Ibrar Ahmed
diff --git a/configure b/configure
index 3b23c46..d448534 100755
--- a/configure
+++ b/configure
@@ -4468,6 +4468,66 @@ if test x"$pgac_cv_prog_cc_cflags__qnoansialias" = x"yes"; then
   CFLAGS="$CFLAGS -qnoansialias"
 fi
 
+elif test "$PORTNAME" = "hpux"; then
+  # HP-UX libm functions on 'Integrity server' do not set errno by default,
+  # for errno setting, compile with the +Olibmerrno option.
+  { $as_echo "$as_me:$LINENO: checking whether $CC supports +Olibmerrno" >&5
+$as_echo_n "checking whether $CC supports +Olibmerrno... " >&6; }
+if test "${pgac_cv_prog_cc_cflags_pOlibmerrno+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  pgac_save_CFLAGS=$CFLAGS
+CFLAGS="$pgac_save_CFLAGS +Olibmerrno"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  pgac_cv_prog_cc_cflags_pOlibmerrno=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	pgac_cv_prog_cc_cflags_pOlibmerrno=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$pgac_save_CFLAGS"
+fi
+{ $as_echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_cflags_pOlibmerrno" >&5
+$as_echo "$pgac_cv_prog_cc_cflags_pOlibmerrno" >&6; }
+if test x"$pgac_cv_prog_cc_cflags_pOlibmerrno" = x"yes"; then
+  CFLAGS="$CFLAGS +Olibmerrno"
+fi
+
 fi
 
 # supply -g if --enable-debug
diff --git a/configure.in b/configure.in
index 76c1a88..0444f7f 100644
--- a/configure.in
+++ b/configure.in
@@ -445,6 +445,10 @@ elif test "$ICC" = yes; then
 elif test "$PORTNAME" = "aix"; then
   # AIX's xlc has to have strict aliasing turned off too
   PGAC_PROG_CC_CFLAGS_OPT([-qnoansialias])
+elif test "$PORTNAME" = "hpux"; then
+  # HP-UX libm functions on 'Integrity server' do not set errno by default,
+  # for errno setting, compile with the +Olibmerrno option.
+  PGAC_PROG_CC_CFLAGS_OPT([+Olibmerrno])
 fi
 
 # supply -g if --enable-debug
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to