Re: Substituting Checksum Algorithm (was: Enabling Checksums)

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Florian Pflug <fgp(at)phlo(dot)org>, Ants Aasma <ants(dot)aasma(at)eesti(dot)ee>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Greg Smith <greg(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Subject: Re: Substituting Checksum Algorithm (was: Enabling Checksums)
Date: 2013-04-26 22:20:50
Message-ID: 20130426222050.GA7327@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-04-26 12:57:09 -0700, Jeff Davis wrote:
> I updated the patch and split it into two parts (attached).

> The second patch adds the configure-time check for the right
> compilation flags, and uses them when compiling checksum.c. I
> called the new variable CFLAGS_EXTRA, for lack of a better idea,
> so feel free to come up with a new name. It doesn't check for, or
> use, -msse4.1, but that can be specified by the user by
> configuring with CFLAGS_EXTRA="-msse4.1".

CFLAGS_VECTORIZATION? EXTRA sounds to generic to me.

> --- a/config/c-compiler.m4
> +++ b/config/c-compiler.m4
> @@ -242,6 +242,30 @@ undefine([Ac_cachevar])dnl
>
>
>
> +# PGAC_PROG_CC_CFLAGS_EXTRA_OPT
> +# -----------------------
> +# Given a string, check if the compiler supports the string as a
> +# command-line option. If it does, add the string to CFLAGS_EXTRA.
> +AC_DEFUN([PGAC_PROG_CC_CFLAGS_EXTRA_OPT],
> +[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_cflags_extra_$1])])dnl
> +AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar],
> +[pgac_save_CFLAGS_EXTRA=$CFLAGS_EXTRA
> +CFLAGS_EXTRA="$pgac_save_CFLAGS_EXTRA $1"
> +ac_save_c_werror_flag=$ac_c_werror_flag
> +ac_c_werror_flag=yes
> +_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
> + [Ac_cachevar=yes],
> + [Ac_cachevar=no])
> +ac_c_werror_flag=$ac_save_c_werror_flag
> +CFLAGS_EXTRA="$pgac_save_CFLAGS_EXTRA"])
> +if test x"$Ac_cachevar" = x"yes"; then
> + CFLAGS_EXTRA="$CFLAGS_EXTRA $1"
> +fi
> +undefine([Ac_cachevar])dnl
> +])# PGAC_PROG_CC_CFLAGS_EXTRA_OPT

I think it would be better to have a PGAC_PROG_CC_VAR_OPT or so which
assigns the flag to some passed variable name. Then we can reuse it for
different vars and I have the feeling those will come. And having a
CFLAGS_VECTOR_OPT would just be stupid ;)

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2013-04-26 23:46:54 Re: [COMMITTERS] pgsql: Fix collation assignment for aggregates with ORDER BY.
Previous Message Jeff Janes 2013-04-26 22:09:44 pg_ctl non-idempotent behavior change