1997-02-04 03:53:45 -05:00
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
2025-06-29 22:28:10 -04:00
# Generated by GNU Autoconf 2.69 for PostgreSQL 19devel.
2002-03-29 12:32:55 -05:00
#
2019-01-19 13:06:35 -05:00
# Report bugs to <pgsql-bugs@lists.postgresql.org>.
1997-02-04 03:53:45 -05:00
#
2013-12-18 20:53:23 -05:00
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
1997-02-04 03:53:45 -05:00
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
2002-03-29 12:32:55 -05:00
#
2026-01-01 13:24:10 -05:00
# Copyright (c) 1996-2026, PostgreSQL Global Development Group
2013-12-18 20:53:23 -05:00
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
2002-03-29 12:32:55 -05:00
2008-02-17 11:36:43 -05:00
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
2013-12-18 20:53:23 -05:00
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
2002-03-29 12:32:55 -05:00
emulate sh
NULLCMD=:
2009-07-02 14:55:40 -04:00
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
2005-07-01 14:17:31 -04:00
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
2008-02-17 11:36:43 -05:00
setopt NO_GLOB_SUBST
else
2013-12-18 20:53:23 -05:00
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
2008-02-17 11:36:43 -05:00
esac
fi
2009-07-02 14:55:40 -04:00
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
2013-12-18 20:53:23 -05:00
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
2009-07-02 14:55:40 -04:00
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
2008-02-17 11:36:43 -05:00
else
2009-07-02 14:55:40 -04:00
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
2013-12-18 20:53:23 -05:00
case $arg in #(
2009-07-02 14:55:40 -04:00
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
2008-02-17 11:36:43 -05:00
fi
2009-07-02 14:55:40 -04:00
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
2002-03-29 12:32:55 -05:00
fi
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
2013-12-18 20:53:23 -05:00
as_myself=
case $0 in #((
2008-02-17 11:36:43 -05:00
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
2009-07-02 14:55:40 -04:00
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
2013-12-18 20:53:23 -05:00
exit 1
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
2008-02-17 11:36:43 -05:00
done
2005-07-01 14:17:31 -04:00
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
2009-07-02 14:55:40 -04:00
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
2019-01-19 13:06:35 -05:00
$0: pgsql-bugs@lists.postgresql.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
2013-12-18 20:53:23 -05:00
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
2008-02-17 11:36:43 -05:00
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
2005-07-01 14:17:31 -04:00
as_expr=expr
else
as_expr=false
fi
2008-02-17 11:36:43 -05:00
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
2005-07-01 14:17:31 -04:00
as_basename=basename
else
as_basename=false
fi
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
2002-03-29 12:32:55 -05:00
2008-02-17 11:36:43 -05:00
as_me=`$as_basename -- "$0" ||
2002-03-29 12:32:55 -05:00
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
2008-02-17 11:36:43 -05:00
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
2009-07-02 14:55:40 -04:00
$as_echo X/"$0" |
2008-02-17 11:36:43 -05:00
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
2006-08-23 08:01:53 -04:00
2013-12-18 20:53:23 -05:00
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
2006-08-23 08:01:53 -04:00
2007-11-15 23:29:45 -05:00
2013-12-18 20:53:23 -05:00
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
2007-11-15 23:29:45 -05:00
2013-12-18 20:53:23 -05:00
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
2008-02-17 11:36:43 -05:00
}
2007-11-15 23:29:45 -05:00
2013-12-18 20:53:23 -05:00
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
2008-02-17 11:36:43 -05:00
else
2013-12-18 20:53:23 -05:00
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
2008-02-17 11:36:43 -05:00
else
2013-12-18 20:53:23 -05:00
test -d ./-p && rmdir ./-p
as_mkdir_p=false
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
as_test_x='test -x'
as_executable_p=as_fn_executable_p
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
2002-03-29 12:32:55 -05:00
# Identity of this package.
PACKAGE_NAME='PostgreSQL'
PACKAGE_TARNAME='postgresql'
2025-06-29 22:28:10 -04:00
PACKAGE_VERSION='19devel'
PACKAGE_STRING='PostgreSQL 19devel'
2019-01-19 13:06:35 -05:00
PACKAGE_BUGREPORT='pgsql-bugs@lists.postgresql.org'
2020-02-28 02:54:49 -05:00
PACKAGE_URL='https://www.postgresql.org/'
2002-03-29 12:32:55 -05:00
ac_unique_file="src/backend/access/common/heaptuple.c"
1997-04-09 04:55:32 -04:00
ac_default_prefix=/usr/local/pgsql
2002-03-29 12:32:55 -05:00
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
2008-02-17 11:36:43 -05:00
#ifdef HAVE_SYS_TYPES_H
2002-03-29 12:32:55 -05:00
# include <sys/types.h>
#endif
2008-02-17 11:36:43 -05:00
#ifdef HAVE_SYS_STAT_H
2002-03-29 12:32:55 -05:00
# include <sys/stat.h>
#endif
2008-02-17 11:36:43 -05:00
#ifdef STDC_HEADERS
2002-03-29 12:32:55 -05:00
# include <stdlib.h>
# include <stddef.h>
#else
2008-02-17 11:36:43 -05:00
# ifdef HAVE_STDLIB_H
2002-03-29 12:32:55 -05:00
# include <stdlib.h>
# endif
#endif
2008-02-17 11:36:43 -05:00
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
2002-03-29 12:32:55 -05:00
# include <memory.h>
# endif
# include <string.h>
#endif
2008-02-17 11:36:43 -05:00
#ifdef HAVE_STRINGS_H
2002-03-29 12:32:55 -05:00
# include <strings.h>
#endif
2008-02-17 11:36:43 -05:00
#ifdef HAVE_INTTYPES_H
2002-03-29 12:32:55 -05:00
# include <inttypes.h>
#endif
2008-02-17 11:36:43 -05:00
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
2002-03-29 12:32:55 -05:00
# include <unistd.h>
#endif"
2009-07-02 14:55:40 -04:00
ac_subst_vars='LTLIBOBJS
2008-02-17 11:36:43 -05:00
vpath_build
2018-11-02 18:54:00 -04:00
PG_SYSROOT
2015-07-02 17:24:36 -04:00
PG_VERSION_NUM
2022-12-06 21:55:28 -05:00
LDFLAGS_EX_BE
2014-04-14 21:33:46 -04:00
PROVE
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
DBTOEPUB
2017-04-06 22:03:52 -04:00
FOP
2009-08-04 18:04:37 -04:00
XSLTPROC
2017-11-23 09:39:47 -05:00
XMLLINT
2009-07-02 14:55:40 -04:00
TCL_SHARED_BUILD
TCL_LIB_SPEC
TCL_LIBS
TCL_INCLUDE_SPEC
TCL_CONFIG_SH
TCLSH
XGETTEXT
MSGMERGE
2013-09-11 14:34:28 -04:00
MSGFMT_FLAGS
2009-07-02 14:55:40 -04:00
MSGFMT
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
PG_CRC32C_OBJS
2022-12-01 21:46:55 -05:00
CFLAGS_CRC
2015-07-08 17:05:45 -04:00
LIBOBJS
2022-10-20 15:01:05 -04:00
OPENSSL
2022-02-18 13:40:31 -05:00
ZSTD
2022-02-13 20:40:34 -05:00
LZ4
2015-07-08 17:05:45 -04:00
UUID_LIBS
2009-07-02 14:55:40 -04:00
LDAP_LIBS_BE
LDAP_LIBS_FE
2021-02-01 05:19:44 -05:00
with_ssl
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
LIBCURL_LDLIBS
2009-07-02 14:55:40 -04:00
PTHREAD_CFLAGS
PTHREAD_LIBS
2015-07-08 13:36:06 -04:00
PTHREAD_CC
ax_pthread_config
2019-07-01 18:46:24 -04:00
EGREP
GREP
2018-11-19 15:05:33 -05:00
SED
2009-07-02 14:55:40 -04:00
ZIC
python_additional_libs
python_libspec
python_libdir
python_includespec
python_version
2009-12-15 17:59:55 -05:00
python_majorversion
2009-07-02 14:55:40 -04:00
PYTHON
perl_embed_ldflags
PL/Perl portability fix: absorb relevant -D switches from Perl.
The Perl documentation is very clear that stuff calling libperl should
be built with the compiler switches shown by Perl's $Config{ccflags}.
We'd been ignoring that up to now, and mostly getting away with it,
but recent Perl versions contain ABI compatibility cross-checks that
fail on some builds because of this omission. In particular the
sizeof(PerlInterpreter) can come out different due to some fields being
added or removed; which means we have a live ABI hazard that we'd better
fix rather than continuing to sweep it under the rug.
However, it still seems like a bad idea to just absorb $Config{ccflags}
verbatim. In some environments Perl was built with a different compiler
that doesn't even use the same switch syntax. -D switch syntax is pretty
universal though, and absorbing Perl's -D switches really ought to be
enough to fix the problem.
Furthermore, Perl likes to inject stuff like -D_LARGEFILE_SOURCE and
-D_FILE_OFFSET_BITS=64 into $Config{ccflags}, which affect libc ABIs on
platforms where they're relevant. Adopting those seems dangerous too.
It's unclear whether a build wherein Perl and Postgres have different ideas
of sizeof(off_t) etc would work, or whether anyone would care about making
it work. But it's dead certain that having different stdio ABIs in
core Postgres and PL/Perl will not work; we've seen that movie before.
Therefore, let's also ignore -D switches for symbols beginning with
underscore. The symbols that we actually need to import should be the ones
mentioned in perl.h's PL_bincompat_options stanza, and none of those start
with underscore, so this seems likely to work. (If it turns out not to
work everywhere, we could consider intersecting the symbols mentioned in
PL_bincompat_options with the -D switches. But that will be much more
complicated, so let's try this way first.)
This will need to be back-patched, but first let's see what the
buildfarm makes of it.
Ashutosh Sharma, some adjustments by me
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-07-28 14:25:28 -04:00
perl_embed_ccflags
Still further rethinking of build changes for macOS Mojave.
To avoid the sorts of problems complained of by Jakob Egger, it'd be
best if configure didn't emit any references to the sysroot path at all.
In the case of PL/Tcl, we can do that just by keeping our hands off the
TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to
substitute -iwithsysroot for -I in the compile commands, which is easily
handled if we change to using a configure output variable that includes
the switch not only the directory name. Since PL/Tcl and PL/Python
already do it like that, this seems like good consistency cleanup anyway.
Hence, this replaces the advice given to Perl-related extensions in commit
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should
just write "$(perl_includespec)". (The old way continues to work, but not
on recent macOS.)
It's still the case that configure needs to be aware of the sysroot
path internally, but that's cleaner than what we had before.
As before, back-patch to all supported versions.
Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
2018-10-18 14:55:23 -04:00
perl_includespec
2009-07-02 14:55:40 -04:00
perl_useshrplib
perl_privlibexp
perl_archlibexp
PERL
FLEXFLAGS
FLEX
BISONFLAGS
BISON
2025-12-08 20:39:08 -05:00
NM
2009-08-26 18:24:44 -04:00
MKDIR_P
2009-07-02 14:55:40 -04:00
LN_S
TAR
2012-06-28 13:05:36 -04:00
install_bin
2012-06-27 06:40:51 -04:00
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
2009-07-02 14:55:40 -04:00
WINDRES
AR
STRIP_SHARED_LIB
STRIP_STATIC_LIB
STRIP
LDFLAGS_SL
2010-07-05 14:54:38 -04:00
LDFLAGS_EX
2022-02-18 13:40:31 -05:00
ZSTD_LIBS
ZSTD_CFLAGS
with_zstd
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
LZ4_LIBS
LZ4_CFLAGS
with_lz4
2009-07-02 14:55:40 -04:00
with_zlib
with_system_tzdata
with_libxslt
2020-03-17 12:09:26 -04:00
XML2_LIBS
XML2_CFLAGS
2009-07-02 14:55:40 -04:00
XML2_CONFIG
2020-03-17 12:09:26 -04:00
with_libxml
2025-04-07 16:51:49 -04:00
LIBNUMA_LIBS
LIBNUMA_CFLAGS
with_libnuma
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
LIBCURL_LDFLAGS
LIBCURL_CPPFLAGS
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
LIBCURL_LIBS
LIBCURL_CFLAGS
with_libcurl
2014-05-27 19:42:08 -04:00
with_uuid
2025-03-18 14:40:05 -04:00
LIBURING_LIBS
LIBURING_CFLAGS
with_liburing
2020-01-02 15:02:21 -05:00
with_readline
2015-11-17 06:46:17 -05:00
with_systemd
2011-01-23 20:44:48 -05:00
with_selinux
2018-03-03 01:29:51 -05:00
with_ldap
2018-03-05 14:42:11 -05:00
with_krb_srvnam
2009-07-02 14:55:40 -04:00
krb_srvtab
2018-03-05 14:42:11 -05:00
with_gssapi
2009-07-02 14:55:40 -04:00
with_python
with_perl
with_tcl
2017-03-23 15:25:34 -04:00
ICU_LIBS
ICU_CFLAGS
with_icu
2009-07-02 14:55:40 -04:00
autodepend
2020-03-17 12:09:26 -04:00
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
2022-03-25 03:44:31 -04:00
DLSUFFIX
2009-07-02 14:55:40 -04:00
GCC
CPP
2019-10-21 12:32:35 -04:00
CFLAGS_SL
2018-03-20 20:26:25 -04:00
BITCODE_CXXFLAGS
BITCODE_CFLAGS
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
2022-07-17 20:49:51 -04:00
CXXFLAGS_SL_MODULE
CFLAGS_SL_MODULE
2020-09-06 21:28:16 -04:00
CFLAGS_VECTORIZE
CFLAGS_UNROLL_LOOPS
2024-08-03 05:42:37 -04:00
PERMIT_MISSING_VARIABLE_DECLARATIONS
Change floating-point output format for improved performance.
Previously, floating-point output was done by rounding to a specific
decimal precision; by default, to 6 or 15 decimal digits (losing
information) or as requested using extra_float_digits. Drivers that
wanted exact float values, and applications like pg_dump that must
preserve values exactly, set extra_float_digits=3 (or sometimes 2 for
historical reasons, though this isn't enough for float4).
Unfortunately, decimal rounded output is slow enough to become a
noticable bottleneck when dealing with large result sets or COPY of
large tables when many floating-point values are involved.
Floating-point output can be done much faster when the output is not
rounded to a specific decimal length, but rather is chosen as the
shortest decimal representation that is closer to the original float
value than to any other value representable in the same precision. The
recently published Ryu algorithm by Ulf Adams is both relatively
simple and remarkably fast.
Accordingly, change float4out/float8out to output shortest decimal
representations if extra_float_digits is greater than 0, and make that
the new default. Applications that need rounded output can set
extra_float_digits back to 0 or below, and take the resulting
performance hit.
We make one concession to portability for systems with buggy
floating-point input: we do not output decimal values that fall
exactly halfway between adjacent representable binary values (which
would rely on the reader doing round-to-nearest-even correctly). This
is known to be a problem at least for VS2013 on Windows.
Our version of the Ryu code originates from
https://github.com/ulfjack/ryu/ at commit c9c3fb1979, but with the
following (significant) modifications:
- Output format is changed to use fixed-point notation for small
exponents, as printf would, and also to use lowercase 'e', a
minimum of 2 exponent digits, and a mandatory sign on the exponent,
to keep the formatting as close as possible to previous output.
- The output of exact midpoint values is disabled as noted above.
- The integer fast-path code is changed somewhat (since we have
fixed-point output and the upstream did not).
- Our project style has been largely applied to the code with the
exception of C99 declaration-after-statement, which has been
retained as an exception to our present policy.
- Most of upstream's debugging and conditionals are removed, and we
use our own configure tests to determine things like uint128
availability.
Changing the float output format obviously affects a number of
regression tests. This patch uses an explicit setting of
extra_float_digits=0 for test output that is not expected to be
exactly reproducible (e.g. due to numerical instability or differing
algorithms for transcendental functions).
Conversions from floats to numeric are unchanged by this patch. These
may appear in index expressions and it is not yet clear whether any
change should be made, so that can be left for another day.
This patch assumes that the only supported floating point format is
now IEEE format, and the documentation is updated to reflect that.
Code by me, adapting the work of Ulf Adams and other contributors.
References:
https://dl.acm.org/citation.cfm?id=3192369
Reviewed-by: Tom Lane, Andres Freund, Donald Dong
Discussion: https://postgr.es/m/87r2el1bx6.fsf@news-spur.riddles.org.uk
2019-02-13 10:20:33 -05:00
PERMIT_DECLARATION_AFTER_STATEMENT
2018-03-20 20:26:25 -04:00
LLVM_BINPATH
LLVM_CXXFLAGS
LLVM_CFLAGS
LLVM_CPPFLAGS
LLVM_LIBS
CLANG
LLVM_CONFIG
AWK
with_llvm
2026-01-20 10:24:57 -05:00
have_cxx
2018-03-20 18:41:15 -04:00
ac_ct_CXX
CXXFLAGS
CXX
2009-07-02 14:55:40 -04:00
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
Add backend support for injection points
Injection points are a new facility that makes possible for developers
to run custom code in pre-defined code paths. Its goal is to provide
ways to design and run advanced tests, for cases like:
- Race conditions, where processes need to do actions in a controlled
ordered manner.
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force
recovery, etc.
- Arbitrary sleeps.
This implements some basics, and there are plans to extend it more in
the future depending on what's required. Hence, this commit adds a set
of routines in the backend that allows developers to attach, detach and
run injection points:
- A code path calling an injection point can be declared with the macro
INJECTION_POINT(name).
- InjectionPointAttach() and InjectionPointDetach() to respectively
attach and detach a callback to/from an injection point. An injection
point name is registered in a shmem hash table with a library name and a
function name, which will be used to load the callback attached to an
injection point when its code path is run.
Injection point names are just strings, so as an injection point can be
declared and run by out-of-core extensions and modules, with callbacks
defined in external libraries.
This facility is hidden behind a dedicated switch for ./configure and
meson, disabled by default.
Note that backends use a local cache to store callbacks already loaded,
cleaning up their cache if a callback has found to be removed on a
best-effort basis. This could be refined further but any tests but what
we have here was fine with the tests I've written while implementing
these backend APIs.
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip
Kumar, Amul Sul, Nazir Bilal Yavuz
Discussion: https://postgr.es/m/ZTiV8tn_MIb_H2rE@paquier.xyz
2024-01-21 20:15:50 -05:00
enable_injection_points
2024-11-04 07:09:38 -05:00
PG_TEST_EXTRA
2014-11-02 09:14:36 -05:00
enable_tap_tests
2009-07-02 14:55:40 -04:00
enable_dtrace
DTRACEFLAGS
DTRACE
enable_coverage
GENHTML
LCOV
GCOV
enable_debug
enable_rpath
default_port
WANTED_LANGUAGES
enable_nls
PORTNAME
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
PG_MAJORVERSION
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
2013-12-18 20:53:23 -05:00
PACKAGE_URL
2009-07-02 14:55:40 -04:00
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
2005-07-01 14:17:31 -04:00
ac_subst_files=''
2009-07-02 14:55:40 -04:00
ac_user_opts='
enable_option_checking
2013-12-12 21:53:21 -05:00
with_extra_version
2009-07-02 14:55:40 -04:00
with_template
with_includes
with_libraries
with_libs
enable_integer_datetimes
enable_nls
with_pgport
enable_rpath
enable_debug
enable_profiling
enable_coverage
enable_dtrace
2014-11-02 09:14:36 -05:00
enable_tap_tests
Add backend support for injection points
Injection points are a new facility that makes possible for developers
to run custom code in pre-defined code paths. Its goal is to provide
ways to design and run advanced tests, for cases like:
- Race conditions, where processes need to do actions in a controlled
ordered manner.
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force
recovery, etc.
- Arbitrary sleeps.
This implements some basics, and there are plans to extend it more in
the future depending on what's required. Hence, this commit adds a set
of routines in the backend that allows developers to attach, detach and
run injection points:
- A code path calling an injection point can be declared with the macro
INJECTION_POINT(name).
- InjectionPointAttach() and InjectionPointDetach() to respectively
attach and detach a callback to/from an injection point. An injection
point name is registered in a shmem hash table with a library name and a
function name, which will be used to load the callback attached to an
injection point when its code path is run.
Injection point names are just strings, so as an injection point can be
declared and run by out-of-core extensions and modules, with callbacks
defined in external libraries.
This facility is hidden behind a dedicated switch for ./configure and
meson, disabled by default.
Note that backends use a local cache to store callbacks already loaded,
cleaning up their cache if a callback has found to be removed on a
best-effort basis. This could be refined further but any tests but what
we have here was fine with the tests I've written while implementing
these backend APIs.
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip
Kumar, Amul Sul, Nazir Bilal Yavuz
Discussion: https://postgr.es/m/ZTiV8tn_MIb_H2rE@paquier.xyz
2024-01-21 20:15:50 -05:00
enable_injection_points
2009-07-02 14:55:40 -04:00
with_blocksize
with_segsize
2022-12-07 22:32:59 -05:00
with_segsize_blocks
2009-07-02 14:55:40 -04:00
with_wal_blocksize
2018-03-20 20:26:25 -04:00
with_llvm
2009-07-02 14:55:40 -04:00
enable_depend
enable_cassert
2017-03-23 15:25:34 -04:00
with_icu
2009-07-02 14:55:40 -04:00
with_tcl
with_tclconfig
with_perl
with_python
with_gssapi
with_krb_srvnam
with_pam
2016-04-08 13:51:54 -04:00
with_bsd_auth
2009-07-02 14:55:40 -04:00
with_ldap
with_bonjour
2011-01-23 20:44:48 -05:00
with_selinux
2015-11-17 06:46:17 -05:00
with_systemd
2009-07-02 14:55:40 -04:00
with_readline
with_libedit_preferred
2025-03-18 14:40:05 -04:00
with_liburing
2014-05-27 19:42:08 -04:00
with_uuid
2009-07-02 14:55:40 -04:00
with_ossp_uuid
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
with_libcurl
2025-04-07 16:51:49 -04:00
with_libnuma
2009-07-02 14:55:40 -04:00
with_libxml
with_libxslt
with_system_tzdata
with_zlib
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
with_lz4
2022-02-18 13:40:31 -05:00
with_zstd
2021-02-01 05:19:44 -05:00
with_ssl
with_openssl
2010-01-16 14:50:26 -05:00
enable_largefile
2009-07-02 14:55:40 -04:00
'
2008-02-17 11:36:43 -05:00
ac_precious_vars='build_alias
host_alias
target_alias
2024-11-04 07:09:38 -05:00
PG_TEST_EXTRA
2008-02-17 11:36:43 -05:00
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
2018-03-20 18:41:15 -04:00
CXX
CXXFLAGS
CCC
2018-03-20 20:26:25 -04:00
LLVM_CONFIG
CLANG
2008-02-17 11:36:43 -05:00
CPP
2017-03-23 15:25:34 -04:00
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
ICU_CFLAGS
ICU_LIBS
2025-03-18 14:40:05 -04:00
LIBURING_CFLAGS
LIBURING_LIBS
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
LIBCURL_CFLAGS
LIBCURL_LIBS
2025-04-07 16:51:49 -04:00
LIBNUMA_CFLAGS
LIBNUMA_LIBS
2019-01-18 02:29:42 -05:00
XML2_CONFIG
2020-03-17 12:09:26 -04:00
XML2_CFLAGS
XML2_LIBS
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
LZ4_CFLAGS
LZ4_LIBS
2022-02-18 13:40:31 -05:00
ZSTD_CFLAGS
ZSTD_LIBS
2010-07-05 14:54:38 -04:00
LDFLAGS_EX
2019-01-18 02:29:42 -05:00
LDFLAGS_SL
PERL
PYTHON
MSGFMT
TCLSH'
2008-02-17 11:36:43 -05:00
1997-02-04 03:53:45 -05:00
# Initialize some variables set by options.
2002-03-29 12:32:55 -05:00
ac_init_help=
ac_init_version=false
2009-07-02 14:55:40 -04:00
ac_unrecognized_opts=
ac_unrecognized_sep=
1997-02-04 03:53:45 -05:00
# The variables have the same names as the options, with
# dashes changed to underlines.
2002-03-29 12:32:55 -05:00
cache_file=/dev/null
1997-02-04 03:53:45 -05:00
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
2002-03-29 12:32:55 -05:00
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
2008-02-17 11:36:43 -05:00
# (The list follows the same order as the GNU Coding Standards.)
1997-02-04 03:53:45 -05:00
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
2008-02-17 11:36:43 -05:00
datarootdir='${prefix}/share'
datadir='${datarootdir}'
1997-02-04 03:53:45 -05:00
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
2008-02-17 11:36:43 -05:00
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
1997-02-04 03:53:45 -05:00
ac_prev=
2008-02-17 11:36:43 -05:00
ac_dashdash=
1997-02-04 03:53:45 -05:00
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
2008-02-17 11:36:43 -05:00
eval $ac_prev=\$ac_option
1997-02-04 03:53:45 -05:00
ac_prev=
continue
fi
2008-02-17 11:36:43 -05:00
case $ac_option in
2013-12-18 20:53:23 -05:00
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
2008-02-17 11:36:43 -05:00
esac
1997-02-04 03:53:45 -05:00
# Accept the important Cygnus configure options, so we can diagnose typos.
2008-02-17 11:36:43 -05:00
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
1997-02-04 03:53:45 -05:00
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
2002-03-29 12:32:55 -05:00
bindir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-build | --build | --buil | --bui | --bu)
2002-03-29 12:32:55 -05:00
ac_prev=build_alias ;;
1997-02-04 03:53:45 -05:00
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
2002-03-29 12:32:55 -05:00
build_alias=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
2002-03-29 12:32:55 -05:00
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
-datadir | --datadir | --datadi | --datad)
1997-02-04 03:53:45 -05:00
ac_prev=datadir ;;
2008-02-17 11:36:43 -05:00
-datadir=* | --datadir=* | --datadi=* | --datad=*)
2002-03-29 12:32:55 -05:00
datadir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-disable-* | --disable-*)
2009-07-02 14:55:40 -04:00
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
1997-02-04 03:53:45 -05:00
# Reject names that are not valid shell variable names.
2009-07-02 14:55:40 -04:00
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2013-12-18 20:53:23 -05:00
as_fn_error $? "invalid feature name: $ac_useropt"
2009-07-02 14:55:40 -04:00
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
2008-02-17 11:36:43 -05:00
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-enable-* | --enable-*)
2009-07-02 14:55:40 -04:00
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
1997-02-04 03:53:45 -05:00
# Reject names that are not valid shell variable names.
2009-07-02 14:55:40 -04:00
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2013-12-18 20:53:23 -05:00
as_fn_error $? "invalid feature name: $ac_useropt"
2009-07-02 14:55:40 -04:00
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
2002-03-29 12:32:55 -05:00
exec_prefix=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
2002-03-29 12:32:55 -05:00
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
1997-02-04 03:53:45 -05:00
-host | --host | --hos | --ho)
2002-03-29 12:32:55 -05:00
ac_prev=host_alias ;;
1997-02-04 03:53:45 -05:00
-host=* | --host=* | --hos=* | --ho=*)
2002-03-29 12:32:55 -05:00
host_alias=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
2002-03-29 12:32:55 -05:00
includedir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2003-11-24 09:52:58 -05:00
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
2002-03-29 12:32:55 -05:00
libdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
2002-03-29 12:32:55 -05:00
libexecdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-localstatedir | --localstatedir | --localstatedi | --localstated \
2008-02-17 11:36:43 -05:00
| --localstate | --localstat | --localsta | --localst | --locals)
1997-02-04 03:53:45 -05:00
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
2008-02-17 11:36:43 -05:00
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
2002-03-29 12:32:55 -05:00
localstatedir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
2002-03-29 12:32:55 -05:00
mandir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
2002-03-29 12:32:55 -05:00
| --no-cr | --no-c | -n)
1997-02-04 03:53:45 -05:00
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
2002-03-29 12:32:55 -05:00
oldincludedir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
2002-03-29 12:32:55 -05:00
prefix=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
2002-03-29 12:32:55 -05:00
program_prefix=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
2002-03-29 12:32:55 -05:00
program_suffix=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
2002-03-29 12:32:55 -05:00
program_transform_name=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
2002-03-29 12:32:55 -05:00
sbindir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
2002-03-29 12:32:55 -05:00
sharedstatedir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
2002-03-29 12:32:55 -05:00
site=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
2002-03-29 12:32:55 -05:00
srcdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
2002-03-29 12:32:55 -05:00
sysconfdir=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-target | --target | --targe | --targ | --tar | --ta | --t)
2002-03-29 12:32:55 -05:00
ac_prev=target_alias ;;
1997-02-04 03:53:45 -05:00
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
2002-03-29 12:32:55 -05:00
target_alias=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
2002-03-29 12:32:55 -05:00
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
1997-02-04 03:53:45 -05:00
-with-* | --with-*)
2009-07-02 14:55:40 -04:00
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
1997-02-04 03:53:45 -05:00
# Reject names that are not valid shell variable names.
2009-07-02 14:55:40 -04:00
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2013-12-18 20:53:23 -05:00
as_fn_error $? "invalid package name: $ac_useropt"
2009-07-02 14:55:40 -04:00
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-without-* | --without-*)
2009-07-02 14:55:40 -04:00
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
1997-02-04 03:53:45 -05:00
# Reject names that are not valid shell variable names.
2009-07-02 14:55:40 -04:00
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
2013-12-18 20:53:23 -05:00
as_fn_error $? "invalid package name: $ac_useropt"
2009-07-02 14:55:40 -04:00
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
1997-02-04 03:53:45 -05:00
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
2002-03-29 12:32:55 -05:00
x_includes=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
2002-03-29 12:32:55 -05:00
x_libraries=$ac_optarg ;;
1997-02-04 03:53:45 -05:00
2013-12-18 20:53:23 -05:00
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
1997-02-04 03:53:45 -05:00
;;
2002-03-29 12:32:55 -05:00
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
2013-12-18 20:53:23 -05:00
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
2008-02-17 11:36:43 -05:00
eval $ac_envvar=\$ac_optarg
2002-03-29 12:32:55 -05:00
export $ac_envvar ;;
1997-02-04 03:53:45 -05:00
*)
2002-03-29 12:32:55 -05:00
# FIXME: should be removed in autoconf 3.0.
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
2002-03-29 12:32:55 -05:00
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
2013-12-18 20:53:23 -05:00
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
1997-02-04 03:53:45 -05:00
;;
esac
done
if test -n "$ac_prev"; then
2002-03-29 12:32:55 -05:00
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
2013-12-18 20:53:23 -05:00
as_fn_error $? "missing argument to $ac_option"
1997-02-04 03:53:45 -05:00
fi
2009-07-02 14:55:40 -04:00
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
2013-12-18 20:53:23 -05:00
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
2009-07-02 14:55:40 -04:00
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
2008-02-17 11:36:43 -05:00
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
2006-08-23 08:59:18 -04:00
do
2008-02-17 11:36:43 -05:00
eval ac_val=\$$ac_var
2009-07-02 14:55:40 -04:00
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
2006-08-23 08:59:18 -04:00
case $ac_val in
2008-02-17 11:36:43 -05:00
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
1997-02-04 03:53:45 -05:00
esac
2013-12-18 20:53:23 -05:00
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
1997-02-04 03:53:45 -05:00
done
2002-03-29 12:32:55 -05:00
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
1997-02-04 03:53:45 -05:00
2002-03-29 12:32:55 -05:00
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "working directory cannot be determined"
2008-02-17 11:36:43 -05:00
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "pwd does not report name of working directory"
2008-02-17 11:36:43 -05:00
# Find the source files, if location was not specified.
1997-02-04 03:53:45 -05:00
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
2008-02-17 11:36:43 -05:00
# Try the directory containing this script, then the parent directory.
2009-07-02 14:55:40 -04:00
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
2008-02-17 11:36:43 -05:00
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
1997-02-04 03:53:45 -05:00
srcdir=$ac_confdir
2008-02-17 11:36:43 -05:00
if test ! -r "$srcdir/$ac_unique_file"; then
1997-02-04 03:53:45 -05:00
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
2008-02-17 11:36:43 -05:00
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
2013-12-18 20:53:23 -05:00
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
1997-02-04 03:53:45 -05:00
fi
2008-02-17 11:36:43 -05:00
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
2013-12-18 20:53:23 -05:00
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
2008-02-17 11:36:43 -05:00
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
2002-03-29 12:32:55 -05:00
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
2025-06-29 22:28:10 -04:00
\`configure' configures PostgreSQL 19devel to adapt to many kinds of systems.
2002-03-29 12:32:55 -05:00
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
2013-12-18 20:53:23 -05:00
-q, --quiet, --silent do not print \`checking ...' messages
2002-03-29 12:32:55 -05:00
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
2009-07-02 14:55:40 -04:00
[$ac_default_prefix]
2002-03-29 12:32:55 -05:00
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
2009-07-02 14:55:40 -04:00
[PREFIX]
2002-03-29 12:32:55 -05:00
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
2009-07-02 14:55:40 -04:00
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/postgresql]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
2002-03-29 12:32:55 -05:00
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
2025-06-29 22:28:10 -04:00
short | recursive ) echo "Configuration of PostgreSQL 19devel:";;
2002-03-29 12:32:55 -05:00
esac
cat <<\_ACEOF
Optional Features:
2009-07-02 14:55:40 -04:00
--disable-option-checking ignore unrecognized --enable/--with options
2002-03-29 12:32:55 -05:00
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
2008-10-29 05:27:24 -04:00
--disable-integer-datetimes
2017-02-23 11:40:12 -05:00
obsolete option, no longer supported
2008-10-29 05:27:24 -04:00
--enable-nls[=LANGUAGES]
enable Native Language Support
--disable-rpath do not embed shared library search path in
executables
2002-03-29 12:32:55 -05:00
--enable-debug build with debugging symbols (-g)
2007-02-21 10:12:39 -05:00
--enable-profiling build with profiling enabled
2008-09-05 08:11:18 -04:00
--enable-coverage build with coverage testing instrumentation
2006-07-24 12:32:45 -04:00
--enable-dtrace build with DTrace support
2014-11-02 09:14:36 -05:00
--enable-tap-tests enable TAP tests (requires Perl and IPC::Run)
Add backend support for injection points
Injection points are a new facility that makes possible for developers
to run custom code in pre-defined code paths. Its goal is to provide
ways to design and run advanced tests, for cases like:
- Race conditions, where processes need to do actions in a controlled
ordered manner.
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force
recovery, etc.
- Arbitrary sleeps.
This implements some basics, and there are plans to extend it more in
the future depending on what's required. Hence, this commit adds a set
of routines in the backend that allows developers to attach, detach and
run injection points:
- A code path calling an injection point can be declared with the macro
INJECTION_POINT(name).
- InjectionPointAttach() and InjectionPointDetach() to respectively
attach and detach a callback to/from an injection point. An injection
point name is registered in a shmem hash table with a library name and a
function name, which will be used to load the callback attached to an
injection point when its code path is run.
Injection point names are just strings, so as an injection point can be
declared and run by out-of-core extensions and modules, with callbacks
defined in external libraries.
This facility is hidden behind a dedicated switch for ./configure and
meson, disabled by default.
Note that backends use a local cache to store callbacks already loaded,
cleaning up their cache if a callback has found to be removed on a
best-effort basis. This could be refined further but any tests but what
we have here was fine with the tests I've written while implementing
these backend APIs.
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip
Kumar, Amul Sul, Nazir Bilal Yavuz
Discussion: https://postgr.es/m/ZTiV8tn_MIb_H2rE@paquier.xyz
2024-01-21 20:15:50 -05:00
--enable-injection-points
enable injection points (for testing)
2002-03-29 12:32:55 -05:00
--enable-depend turn on automatic dependency tracking
--enable-cassert enable assertion checks (for debugging)
2010-01-16 14:50:26 -05:00
--disable-largefile omit support for large files
2002-03-29 12:32:55 -05:00
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
2013-12-12 21:53:21 -05:00
--with-extra-version=STRING
append STRING to version
2008-10-29 05:27:24 -04:00
--with-template=NAME override operating system template
2002-03-29 12:32:55 -05:00
--with-includes=DIRS look for additional header files in DIRS
--with-libraries=DIRS look for additional libraries in DIRS
--with-libs=DIRS alternative spelling of --with-libraries
2008-05-01 21:08:27 -04:00
--with-pgport=PORTNUM set default port number [5432]
2008-10-29 05:27:24 -04:00
--with-blocksize=BLOCKSIZE
set table block size in kB [8]
2008-05-02 15:52:37 -04:00
--with-segsize=SEGSIZE set table segment size in GB [1]
2022-12-07 22:32:59 -05:00
--with-segsize-blocks=SEGSIZE_BLOCKS
set table segment size in blocks [0]
2008-10-29 05:27:24 -04:00
--with-wal-blocksize=BLOCKSIZE
set WAL block size in kB [8]
2018-03-20 20:26:25 -04:00
--with-llvm build with LLVM based JIT support
2023-04-18 16:20:11 -04:00
--without-icu build without ICU support
2004-09-30 22:00:44 -04:00
--with-tcl build Tcl modules (PL/Tcl)
2004-04-19 20:33:53 -04:00
--with-tclconfig=DIR tclConfig.sh is in DIR
2002-09-04 18:54:18 -04:00
--with-perl build Perl modules (PL/Perl)
2003-09-01 19:01:49 -04:00
--with-python build Python modules (PL/Python)
2007-07-10 09:14:22 -04:00
--with-gssapi build with GSSAPI support
2014-01-15 11:24:01 -05:00
--with-krb-srvnam=NAME default service principal name in Kerberos (GSSAPI)
2008-10-29 05:27:24 -04:00
[postgres]
2002-03-29 12:32:55 -05:00
--with-pam build with PAM support
2016-04-08 13:51:54 -04:00
--with-bsd-auth build with BSD Authentication support
2006-03-06 12:41:44 -05:00
--with-ldap build with LDAP support
2005-05-14 20:26:19 -04:00
--with-bonjour build with Bonjour support
2011-01-23 20:44:48 -05:00
--with-selinux build with SELinux support
2015-11-17 06:46:17 -05:00
--with-systemd build with systemd support
2006-10-01 19:47:16 -04:00
--without-readline do not use GNU Readline nor BSD Libedit for editing
2008-10-29 05:27:24 -04:00
--with-libedit-preferred
prefer BSD Libedit over GNU Readline
2025-03-18 14:40:05 -04:00
--with-liburing build with io_uring support, for asynchronous I/O
2014-05-27 19:42:08 -04:00
--with-uuid=LIB build contrib/uuid-ossp using LIB (bsd,e2fs,ossp)
--with-ossp-uuid obsolete spelling of --with-uuid=ossp
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
--with-libcurl build with libcurl support
2025-04-07 16:51:49 -04:00
--with-libnuma build with libnuma support
2006-12-21 11:05:16 -05:00
--with-libxml build with XML support
2008-01-24 01:23:33 -05:00
--with-libxslt use XSLT support when building contrib/xml2
2008-10-29 05:27:24 -04:00
--with-system-tzdata=DIR
use system time zone data in DIR
2002-04-10 18:47:09 -04:00
--without-zlib do not use Zlib
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
--with-lz4 build with LZ4 support
2022-02-18 13:40:31 -05:00
--with-zstd build with ZSTD support
2021-02-01 05:19:44 -05:00
--with-ssl=LIB use LIB for SSL/TLS support (openssl)
--with-openssl obsolete spelling of --with-ssl=openssl
2002-03-29 12:32:55 -05:00
Some influential environment variables:
2024-11-04 07:09:38 -05:00
PG_TEST_EXTRA
enable selected extra tests (overridden at runtime by
PG_TEST_EXTRA environment variable)
2002-03-29 12:32:55 -05:00
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
2008-02-17 11:36:43 -05:00
LIBS libraries to pass to the linker, e.g. -l<library>
2013-12-18 20:53:23 -05:00
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
2008-02-17 11:36:43 -05:00
you have headers in a nonstandard directory <include dir>
2018-03-20 18:41:15 -04:00
CXX C++ compiler command
CXXFLAGS C++ compiler flags
2018-03-20 20:26:25 -04:00
LLVM_CONFIG path to llvm-config command
CLANG path to clang compiler to generate bitcode
2002-03-29 12:32:55 -05:00
CPP C preprocessor
2017-03-23 15:25:34 -04:00
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
ICU_LIBS linker flags for ICU, overriding pkg-config
2025-03-18 14:40:05 -04:00
LIBURING_CFLAGS
C compiler flags for LIBURING, overriding pkg-config
LIBURING_LIBS
linker flags for LIBURING, overriding pkg-config
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
LIBCURL_CFLAGS
C compiler flags for LIBCURL, overriding pkg-config
LIBCURL_LIBS
linker flags for LIBCURL, overriding pkg-config
2025-04-07 16:51:49 -04:00
LIBNUMA_CFLAGS
C compiler flags for LIBNUMA, overriding pkg-config
LIBNUMA_LIBS
linker flags for LIBNUMA, overriding pkg-config
2019-01-18 02:29:42 -05:00
XML2_CONFIG path to xml2-config utility
2020-03-17 12:09:26 -04:00
XML2_CFLAGS C compiler flags for XML2, overriding pkg-config
XML2_LIBS linker flags for XML2, overriding pkg-config
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
LZ4_CFLAGS C compiler flags for LZ4, overriding pkg-config
LZ4_LIBS linker flags for LZ4, overriding pkg-config
2022-02-18 13:40:31 -05:00
ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
ZSTD_LIBS linker flags for ZSTD, overriding pkg-config
2010-07-05 14:54:38 -04:00
LDFLAGS_EX extra linker flags for linking executables only
LDFLAGS_SL extra linker flags for linking shared libraries only
2019-01-18 02:29:42 -05:00
PERL Perl program
PYTHON Python program
MSGFMT msgfmt program for NLS
TCLSH Tcl interpreter program (tclsh)
2002-03-29 12:32:55 -05:00
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
2019-01-19 13:06:35 -05:00
Report bugs to <pgsql-bugs@lists.postgresql.org>.
2020-02-28 02:54:49 -05:00
PostgreSQL home page: <https://www.postgresql.org/>.
2002-03-29 12:32:55 -05:00
_ACEOF
2008-02-17 11:36:43 -05:00
ac_status=$?
2002-03-29 12:32:55 -05:00
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
2009-07-02 14:55:40 -04:00
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
2002-03-29 12:32:55 -05:00
ac_builddir=.
2008-02-17 11:36:43 -05:00
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
2009-07-02 14:55:40 -04:00
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
2008-02-17 11:36:43 -05:00
# A ".." for each directory in $ac_dir_suffix.
2009-07-02 14:55:40 -04:00
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
2008-02-17 11:36:43 -05:00
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
2002-03-29 12:32:55 -05:00
case $srcdir in
2008-02-17 11:36:43 -05:00
.) # We are building in place.
2002-03-29 12:32:55 -05:00
ac_srcdir=.
2008-02-17 11:36:43 -05:00
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
2002-03-29 12:32:55 -05:00
ac_srcdir=$srcdir$ac_dir_suffix;
2008-02-17 11:36:43 -05:00
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
2007-11-15 23:59:25 -05:00
esac
2008-02-17 11:36:43 -05:00
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
2002-03-29 12:32:55 -05:00
else
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
2008-02-17 11:36:43 -05:00
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
2002-03-29 12:32:55 -05:00
done
fi
2008-02-17 11:36:43 -05:00
test -n "$ac_init_help" && exit $ac_status
2002-03-29 12:32:55 -05:00
if $ac_init_version; then
cat <<\_ACEOF
2025-06-29 22:28:10 -04:00
PostgreSQL configure 19devel
2013-12-18 20:53:23 -05:00
generated by GNU Autoconf 2.69
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
Copyright (C) 2012 Free Software Foundation, Inc.
2002-03-29 12:32:55 -05:00
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
2026-01-01 13:24:10 -05:00
Copyright (c) 1996-2026, PostgreSQL Global Development Group
2002-03-29 12:32:55 -05:00
_ACEOF
2008-02-17 11:36:43 -05:00
exit
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
2002-03-29 12:32:55 -05:00
{
2013-12-18 20:53:23 -05:00
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
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:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_try_compile
2002-03-29 12:32:55 -05:00
2018-03-20 18:41:15 -04:00
# ac_fn_cxx_try_compile LINENO
# ----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
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:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
2013-12-18 20:53:23 -05:00
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_try_link
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
2002-03-29 12:32:55 -05:00
{
2013-12-18 20:53:23 -05:00
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
2002-03-29 12:32:55 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
2008-02-17 11:36:43 -05:00
test ! -s conftest.err
2013-12-18 20:53:23 -05:00
}; then :
ac_retval=0
1997-02-04 03:53:45 -05:00
else
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: failed program was:" >&5
2005-07-01 14:17:31 -04:00
sed 's/^/| /' conftest.$ac_ext >&5
2013-12-18 20:53:23 -05:00
ac_retval=1
2012-02-23 15:05:08 -05:00
fi
2013-12-18 20:53:23 -05:00
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
2007-11-15 23:59:25 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_try_cpp
2006-08-23 08:01:53 -04:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2013-12-18 20:53:23 -05:00
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
2007-07-10 09:14:22 -04:00
else
2013-12-18 20:53:23 -05:00
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-07-10 09:14:22 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
$4
#include <$2>
2007-07-10 09:14:22 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
2007-07-10 09:14:22 -04:00
else
2013-12-18 20:53:23 -05:00
ac_header_compiler=no
2007-07-10 09:14:22 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
2012-02-23 15:05:08 -05:00
else
2013-12-18 20:53:23 -05:00
ac_header_preproc=no
2012-02-23 15:05:08 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
2007-11-15 23:29:45 -05:00
2013-12-18 20:53:23 -05:00
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
2019-01-19 13:06:35 -05:00
( $as_echo "## ---------------------------------------------- ##
## Report this to pgsql-bugs@lists.postgresql.org ##
## ---------------------------------------------- ##"
2013-12-18 20:53:23 -05:00
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
2007-11-15 23:29:45 -05:00
else
2013-12-18 20:53:23 -05:00
eval "$3=\$ac_header_compiler"
2007-11-15 23:29:45 -05:00
fi
2013-12-18 20:53:23 -05:00
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
2007-11-15 23:29:45 -05:00
fi
2013-12-18 20:53:23 -05:00
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2007-11-15 23:29:45 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_check_header_mongrel
2007-07-10 09:14:22 -04:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_try_run LINENO
# ----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_c_try_run ()
2007-07-10 09:14:22 -04:00
{
2013-12-18 20:53:23 -05:00
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
2007-07-10 09:14:22 -04:00
ac_status=$?
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
2007-07-10 09:14:22 -04:00
else
2013-12-18 20:53:23 -05:00
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
2007-07-10 09:14:22 -04:00
sed 's/^/| /' conftest.$ac_ext >&5
2013-12-18 20:53:23 -05:00
ac_retval=$ac_status
2007-07-10 09:14:22 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_try_run
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
2008-02-17 11:36:43 -05:00
else
2013-12-18 20:53:23 -05:00
eval "$3=no"
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_check_header_compile
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
# INCLUDES, setting cache variable VAR accordingly.
ac_fn_c_check_member ()
2013-12-18 20:53:23 -05:00
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
$as_echo_n "checking for $2.$3... " >&6; }
if eval \${$4+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2008-02-17 11:36:43 -05:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
$5
2002-03-29 12:32:55 -05:00
int
main ()
{
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
static $2 ac_aggr;
if (ac_aggr.$3)
return 0;
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval "$4=yes"
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-08-23 08:01:53 -04:00
/* end confdefs.h. */
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
$5
2006-08-23 08:59:18 -04:00
int
main ()
{
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
static $2 ac_aggr;
if (sizeof ac_aggr.$3)
return 0;
2006-08-23 08:59:18 -04:00
;
return 0;
}
2006-08-23 08:01:53 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval "$4=yes"
2007-11-12 19:13:19 -05:00
else
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval "$4=no"
2007-11-12 19:13:19 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2007-11-15 23:59:25 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2008-02-17 11:36:43 -05:00
fi
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval ac_res=\$$4
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2008-02-17 11:36:43 -05:00
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
} # ac_fn_c_check_member
2011-01-23 20:44:48 -05:00
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
2013-12-18 20:53:23 -05:00
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
2011-01-23 20:44:48 -05:00
$as_echo_n "(cached) " >&6
else
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval "$3=no"
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
$4
2013-12-18 20:53:23 -05:00
int
main ()
{
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
if (sizeof ($2))
return 0;
2013-12-18 20:53:23 -05:00
;
return 0;
}
2011-01-23 20:44:48 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2011-01-23 20:44:48 -05:00
/* end confdefs.h. */
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
$4
2011-01-23 20:44:48 -05:00
int
main ()
{
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
if (sizeof (($2)))
return 0;
2011-01-23 20:44:48 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
2013-12-18 20:53:23 -05:00
else
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval "$3=yes"
2011-01-23 20:44:48 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2011-01-23 20:44:48 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2011-01-23 20:44:48 -05:00
fi
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
eval ac_res=\$$3
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2011-01-23 20:44:48 -05:00
Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro. We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.
HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below). PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test. (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)
This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.
Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL. (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)
[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies
Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-24 19:11:28 -05:00
} # ac_fn_c_check_type
2011-01-23 20:44:48 -05:00
2013-12-18 20:53:23 -05:00
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
# INCLUDES, setting VAR accordingly. Returns whether the value could be
# computed
ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-11-15 23:59:25 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0;
return test_array [0];
2007-11-15 23:59:25 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=0 ac_mid=0
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
2007-11-15 23:59:25 -05:00
int
main ()
{
2013-12-18 20:53:23 -05:00
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
2007-11-15 23:59:25 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid; break
2007-11-15 23:59:25 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_arith $ac_mid + 1 && ac_lo=$as_val
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
2008-02-17 11:36:43 -05:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-11-15 23:59:25 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0;
return test_array [0];
2007-11-15 23:59:25 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=-1 ac_mid=-1
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
2007-11-15 23:59:25 -05:00
int
main ()
{
2013-12-18 20:53:23 -05:00
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0;
return test_array [0];
2007-11-15 23:59:25 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=$ac_mid; break
2007-11-15 23:59:25 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
2007-11-15 23:59:25 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
2007-11-15 23:59:25 -05:00
else
2013-12-18 20:53:23 -05:00
ac_lo= ac_hi=
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2009-01-06 10:38:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid
else
as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in #((
?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
'') ac_retval=1 ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-01-06 10:38:44 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
$4
static long int longval () { return $2; }
static unsigned long int ulongval () { return $2; }
#include <stdio.h>
2009-01-06 10:38:44 -05:00
#include <stdlib.h>
int
main ()
{
2013-12-18 20:53:23 -05:00
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (($2) < 0)
{
long int i = longval ();
if (i != ($2))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ($2))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
2009-01-06 10:38:44 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_run "$LINENO"; then :
echo >>conftest.val; read $3 <conftest.val; ac_retval=0
2009-01-06 10:38:44 -05:00
else
2013-12-18 20:53:23 -05:00
ac_retval=1
2009-01-06 10:38:44 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
rm -f conftest.val
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
} # ac_fn_c_compute_int
2018-11-19 12:43:05 -05:00
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
# Initialize each $ac_[]_AC_LANG_ABBREV[]_decl_warn_flag once.
as_decl_name=`echo $2|sed 's/ *(.*//'`
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_werror_flag=$ac_c_werror_flag
ac_c_werror_flag="$ac_c_decl_warn_flag$ac_c_werror_flag"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_werror_flag
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_decl
2013-12-18 20:53:23 -05:00
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
2009-01-06 10:38:44 -05:00
2025-06-29 22:28:10 -04:00
It was created by PostgreSQL $as_me 19devel, which was
2013-12-18 20:53:23 -05:00
generated by GNU Autoconf 2.69. Invocation command line was
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
$ $0 $@
2009-01-06 10:38:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
$as_echo "/* confdefs.h */" > confdefs.h
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
# Predefined preprocessor variables.
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
2009-01-06 10:38:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
2009-01-06 10:38:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
2009-01-06 10:38:44 -05:00
fi
2013-12-18 20:53:23 -05:00
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
fi
done
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
2009-01-06 10:38:44 -05:00
fi
2013-12-18 20:53:23 -05:00
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
2009-01-06 10:38:44 -05:00
done
2013-12-18 20:53:23 -05:00
if $ac_cache_corrupted; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2009-01-06 10:38:44 -05:00
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
ac_aux_dir=
for ac_dir in config "$srcdir"/config; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5
fi
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
2002-04-10 18:47:09 -04:00
2020-02-10 11:12:46 -05:00
cat >>confdefs.h <<_ACEOF
#define CONFIGURE_ARGS "$ac_configure_args"
_ACEOF
2002-04-10 18:47:09 -04:00
2016-08-15 13:49:49 -04:00
PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`
2020-03-10 06:20:38 -04:00
PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`
test -n "$PG_MINORVERSION" || PG_MINORVERSION=0
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PG_MAJORVERSION "$PG_MAJORVERSION"
_ACEOF
2002-04-10 18:47:09 -04:00
2020-03-10 06:20:38 -04:00
cat >>confdefs.h <<_ACEOF
#define PG_MAJORVERSION_NUM $PG_MAJORVERSION
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PG_MINORVERSION_NUM $PG_MINORVERSION
_ACEOF
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-extra-version was given.
if test "${with_extra_version+set}" = set; then :
withval=$with_extra_version;
case $withval in
yes)
as_fn_error $? "argument required for --with-extra-version option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-extra-version option" "$LINENO" 5
;;
*)
PG_VERSION="$PACKAGE_VERSION$withval"
;;
esac
2003-01-25 00:19:47 -05:00
2013-12-18 20:53:23 -05:00
else
PG_VERSION="$PACKAGE_VERSION"
fi
2003-03-05 22:16:55 -05:00
2004-05-21 20:34:51 -04:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PG_VERSION"
_ACEOF
2004-05-21 20:34:51 -04:00
2004-06-24 14:55:21 -04:00
2013-12-18 20:53:23 -05:00
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
2004-07-14 13:55:10 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
2005-07-01 14:17:31 -04:00
2002-04-10 18:47:09 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
2008-02-17 11:36:43 -05:00
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
2002-04-10 18:47:09 -04:00
fi
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
template=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which template to use" >&5
$as_echo_n "checking which template to use... " >&6; }
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-template was given.
if test "${with_template+set}" = set; then :
withval=$with_template;
case $withval in
yes)
as_fn_error $? "argument required for --with-template option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-template option" "$LINENO" 5
;;
*)
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
case $withval in
list) echo; ls "$srcdir/src/template"; exit;;
*) if test -f "$srcdir/src/template/$with_template" ; then
template=$withval
else
as_fn_error $? "'$withval' is not a valid template name. Use 'list' for a list." "$LINENO" 5
fi;;
esac
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
;;
esac
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
else
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
# --with-template not given
2009-09-30 21:58:58 -04:00
2013-12-18 20:53:23 -05:00
case $host_os in
2019-12-19 02:28:37 -05:00
cygwin*|msys*) template=cygwin ;;
2013-12-18 20:53:23 -05:00
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
freebsd*) template=freebsd ;;
linux*|gnu*|k*bsd*-gnu)
template=linux ;;
mingw*) template=win32 ;;
netbsd*) template=netbsd ;;
openbsd*) template=openbsd ;;
solaris*) template=solaris ;;
esac
2013-07-25 11:39:08 -04:00
2013-12-18 20:53:23 -05:00
if test x"$template" = x"" ; then
as_fn_error $? "
*******************************************************************
PostgreSQL has apparently not been ported to your platform yet.
To try a manual configuration, look into the src/template directory
for a similar platform and use the '--with-template=' option.
2013-07-25 11:39:08 -04:00
2019-01-19 13:06:35 -05:00
Please also contact <pgsql-bugs@lists.postgresql.org> to see about
2013-12-18 20:53:23 -05:00
rectifying this. Include the above 'checking host system type...'
line.
*******************************************************************
" "$LINENO" 5
fi
2013-07-25 11:39:08 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $template" >&5
$as_echo "$template" >&6; }
2013-07-25 11:39:08 -04:00
2013-12-18 20:53:23 -05:00
PORTNAME=$template
2013-07-25 11:39:08 -04:00
2002-04-10 18:47:09 -04:00
2022-03-25 03:44:31 -04:00
# Default, works for most platforms, override in template file if needed
DLSUFFIX=".so"
2008-02-17 11:36:43 -05:00
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
##
## Command line options
##
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
#
# Add non-standard directories to the include path
#
2008-02-17 11:36:43 -05:00
2002-04-10 18:47:09 -04:00
2001-06-02 14:25:18 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-includes was given.
if test "${with_includes+set}" = set; then :
withval=$with_includes;
case $withval in
yes)
as_fn_error $? "argument required for --with-includes option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-includes option" "$LINENO" 5
;;
*)
;;
esac
2001-06-02 14:25:18 -04:00
fi
2002-03-29 12:32:55 -05:00
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
#
# Add non-standard directories to the library search path
#
2002-03-29 12:32:55 -05:00
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-libraries was given.
if test "${with_libraries+set}" = set; then :
withval=$with_libraries;
case $withval in
yes)
as_fn_error $? "argument required for --with-libraries option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-libraries option" "$LINENO" 5
;;
*)
LIBRARY_DIRS=$withval
;;
esac
2002-03-29 12:32:55 -05:00
2001-06-02 14:25:18 -04:00
fi
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-libs was given.
if test "${with_libs+set}" = set; then :
withval=$with_libs;
case $withval in
yes)
as_fn_error $? "argument required for --with-libs option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-libs option" "$LINENO" 5
;;
*)
LIBRARY_DIRS=$withval
;;
esac
1997-04-09 04:55:32 -04:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
#
2017-02-23 11:40:12 -05:00
# 64-bit integer date/time storage is now the only option, but to avoid
# unnecessary breakage of build scripts, continue to accept an explicit
# "--enable-integer-datetimes" switch.
2013-12-18 20:53:23 -05:00
#
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-integer-datetimes was given.
if test "${enable_integer_datetimes+set}" = set; then :
enableval=$enable_integer_datetimes;
case $enableval in
yes)
2017-02-23 11:40:12 -05:00
:
2013-12-18 20:53:23 -05:00
;;
no)
2017-02-23 11:40:12 -05:00
as_fn_error $? "--disable-integer-datetimes is no longer supported" "$LINENO" 5
2013-12-18 20:53:23 -05:00
;;
*)
as_fn_error $? "no argument expected for --enable-integer-datetimes option" "$LINENO" 5
;;
esac
2002-03-29 19:20:15 -05:00
2003-02-18 23:05:07 -05:00
else
2013-12-18 20:53:23 -05:00
enable_integer_datetimes=yes
2003-02-18 23:05:07 -05:00
fi
2008-02-17 11:36:43 -05:00
2003-02-18 23:05:07 -05:00
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
#
# NLS
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is wanted" >&5
$as_echo_n "checking whether NLS is wanted... " >&6; }
2003-02-18 23:05:07 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-nls was given.
if test "${enable_nls+set}" = set; then :
enableval=$enable_nls;
case $enableval in
yes)
:
;;
no)
:
;;
*)
enable_nls=yes
WANTED_LANGUAGES=$enableval
;;
esac
2003-02-18 23:05:07 -05:00
else
2013-12-18 20:53:23 -05:00
enable_nls=no
2004-11-30 01:13:04 -05:00
fi
2003-02-18 23:05:07 -05:00
2004-11-30 01:13:04 -05:00
2013-12-18 20:53:23 -05:00
if test "$enable_nls" = yes; then
2004-11-30 01:13:04 -05:00
2013-12-18 20:53:23 -05:00
$as_echo "#define ENABLE_NLS 1" >>confdefs.h
2004-11-30 01:13:04 -05:00
2002-03-29 12:32:55 -05:00
fi
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_nls" >&5
$as_echo "$enable_nls" >&6; }
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
#
# Default port number (--with-pgport), default 5432
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default port number" >&5
$as_echo_n "checking for default port number... " >&6; }
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-pgport was given.
if test "${with_pgport+set}" = set; then :
withval=$with_pgport;
case $withval in
yes)
as_fn_error $? "argument required for --with-pgport option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-pgport option" "$LINENO" 5
;;
*)
default_port=$withval
;;
esac
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
default_port=5432
2000-11-03 13:43:52 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $default_port" >&5
$as_echo "$default_port" >&6; }
# Need both of these because some places want an integer and some a string
cat >>confdefs.h <<_ACEOF
#define DEF_PGPORT ${default_port}
2002-03-29 19:20:15 -05:00
_ACEOF
2002-03-29 12:32:55 -05:00
2004-11-30 01:13:04 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define DEF_PGPORT_STR "${default_port}"
2004-11-30 01:13:04 -05:00
_ACEOF
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2004-11-30 01:13:04 -05:00
2016-03-14 10:41:29 -04:00
# It's worth validating port; you can get very confusing errors otherwise
if test x"$default_port" = x""; then
as_fn_error $? "invalid --with-pgport specification: empty string" "$LINENO" 5
elif test ! x`echo "$default_port" | sed -e 's/[0-9]*//'` = x""; then
as_fn_error $? "invalid --with-pgport specification: must be a number" "$LINENO" 5
elif test ! x`echo "$default_port" | sed -e 's/^0.//'` = x"$default_port"; then
as_fn_error $? "invalid --with-pgport specification: must not have leading 0" "$LINENO" 5
elif test "$default_port" -lt "1" -o "$default_port" -gt "65535"; then
as_fn_error $? "invalid --with-pgport specification: must be between 1 and 65535" "$LINENO" 5
fi
2013-12-18 20:53:23 -05:00
#
# '-rpath'-like feature can be disabled
#
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-rpath was given.
if test "${enable_rpath+set}" = set; then :
enableval=$enable_rpath;
case $enableval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-rpath option" "$LINENO" 5
;;
esac
2004-11-30 01:13:04 -05:00
else
2013-12-18 20:53:23 -05:00
enable_rpath=yes
2004-11-30 01:13:04 -05:00
fi
2002-04-10 18:47:09 -04:00
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
#
# --enable-debug adds -g to compiler flags
#
2008-02-17 11:36:43 -05:00
2004-11-30 01:13:04 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-debug was given.
if test "${enable_debug+set}" = set; then :
enableval=$enable_debug;
case $enableval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-debug option" "$LINENO" 5
;;
esac
2004-11-30 01:13:04 -05:00
else
2013-12-18 20:53:23 -05:00
enable_debug=no
2004-11-30 01:13:04 -05:00
fi
2013-12-18 20:53:23 -05:00
#
# --enable-profiling enables gcc profiling
#
# Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling;
case $enableval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-profiling option" "$LINENO" 5
;;
esac
1998-10-07 02:38:29 -04:00
else
2013-12-18 20:53:23 -05:00
enable_profiling=no
2005-07-01 14:17:31 -04:00
1998-02-23 23:02:20 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-04-10 18:47:09 -04:00
2013-12-18 20:53:23 -05:00
#
# --enable-coverage enables generation of code coverage metrics with gcov
#
# Check whether --enable-coverage was given.
if test "${enable_coverage+set}" = set; then :
enableval=$enable_coverage;
case $enableval in
yes)
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$GCOV"; then
for ac_prog in gcov
2013-12-18 20:53:23 -05:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_GCOV+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
2017-07-31 13:02:49 -04:00
case $GCOV in
[\\/]* | ?:[\\/]*)
ac_cv_path_GCOV="$GCOV" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2013-12-18 20:53:23 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_GCOV="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2005-07-01 14:17:31 -04:00
2017-07-31 13:02:49 -04:00
;;
esac
2002-04-10 18:47:09 -04:00
fi
2017-07-31 13:02:49 -04:00
GCOV=$ac_cv_path_GCOV
2013-12-18 20:53:23 -05:00
if test -n "$GCOV"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCOV" >&5
$as_echo "$GCOV" >&6; }
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
1998-02-23 23:02:20 -05:00
fi
2002-04-10 18:47:09 -04:00
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
test -n "$GCOV" && break
done
2004-12-02 16:41:12 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of GCOV in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCOV" >&5
$as_echo_n "checking for GCOV... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCOV" >&5
$as_echo "$GCOV" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$GCOV"; then
as_fn_error $? "gcov not found" "$LINENO" 5
fi
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$LCOV"; then
for ac_prog in lcov
2004-12-02 16:41:12 -05:00
do
2013-12-18 20:53:23 -05:00
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_LCOV+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2004-12-02 16:41:12 -05:00
else
2017-07-31 13:02:49 -04:00
case $LCOV in
[\\/]* | ?:[\\/]*)
ac_cv_path_LCOV="$LCOV" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2013-12-18 20:53:23 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_LCOV="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2005-07-01 14:17:31 -04:00
2017-07-31 13:02:49 -04:00
;;
esac
2004-12-02 16:41:12 -05:00
fi
2017-07-31 13:02:49 -04:00
LCOV=$ac_cv_path_LCOV
2013-12-18 20:53:23 -05:00
if test -n "$LCOV"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5
$as_echo "$LCOV" >&6; }
2004-12-02 16:41:12 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2004-12-02 16:41:12 -05:00
fi
2008-02-17 11:36:43 -05:00
2004-12-02 16:41:12 -05:00
2013-12-18 20:53:23 -05:00
test -n "$LCOV" && break
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of LCOV in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCOV" >&5
$as_echo_n "checking for LCOV... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5
$as_echo "$LCOV" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$LCOV"; then
as_fn_error $? "lcov not found" "$LINENO" 5
fi
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$GENHTML"; then
for ac_prog in genhtml
2013-12-18 20:53:23 -05:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_GENHTML+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2004-12-02 16:41:12 -05:00
else
2017-07-31 13:02:49 -04:00
case $GENHTML in
[\\/]* | ?:[\\/]*)
ac_cv_path_GENHTML="$GENHTML" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2013-12-18 20:53:23 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_GENHTML="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2004-12-02 16:41:12 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2004-12-02 16:41:12 -05:00
fi
2017-07-31 13:02:49 -04:00
GENHTML=$ac_cv_path_GENHTML
2013-12-18 20:53:23 -05:00
if test -n "$GENHTML"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5
$as_echo "$GENHTML" >&6; }
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2004-11-30 01:13:04 -05:00
fi
2013-12-18 20:53:23 -05:00
test -n "$GENHTML" && break
2004-11-30 01:13:04 -05:00
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of GENHTML in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GENHTML" >&5
$as_echo_n "checking for GENHTML... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5
$as_echo "$GENHTML" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$GENHTML"; then
as_fn_error $? "genhtml not found" "$LINENO" 5
2004-11-30 01:13:04 -05:00
fi
2013-12-18 20:53:23 -05:00
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-coverage option" "$LINENO" 5
;;
esac
2004-11-30 01:13:04 -05:00
2013-12-18 20:53:23 -05:00
else
enable_coverage=no
2004-11-30 01:13:04 -05:00
2004-12-02 16:41:12 -05:00
fi
2006-10-04 20:07:45 -04:00
2013-12-18 20:53:23 -05:00
#
# DTrace
#
# Check whether --enable-dtrace was given.
if test "${enable_dtrace+set}" = set; then :
enableval=$enable_dtrace;
case $enableval in
yes)
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$DTRACE"; then
for ac_prog in dtrace
2006-10-04 20:07:45 -04:00
do
2013-12-18 20:53:23 -05:00
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_DTRACE+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-10-04 20:07:45 -04:00
else
2017-07-31 13:02:49 -04:00
case $DTRACE in
[\\/]* | ?:[\\/]*)
ac_cv_path_DTRACE="$DTRACE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2013-12-18 20:53:23 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_DTRACE="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2006-10-04 20:07:45 -04:00
2017-07-31 13:02:49 -04:00
;;
esac
2006-10-04 20:07:45 -04:00
fi
2017-07-31 13:02:49 -04:00
DTRACE=$ac_cv_path_DTRACE
2013-12-18 20:53:23 -05:00
if test -n "$DTRACE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTRACE" >&5
$as_echo "$DTRACE" >&6; }
2006-10-04 20:07:45 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2006-10-04 20:07:45 -04:00
fi
2008-02-17 11:36:43 -05:00
2006-10-04 20:07:45 -04:00
2013-12-18 20:53:23 -05:00
test -n "$DTRACE" && break
done
2006-10-04 20:07:45 -04:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of DTRACE in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DTRACE" >&5
$as_echo_n "checking for DTRACE... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTRACE" >&5
$as_echo "$DTRACE" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$DTRACE"; then
as_fn_error $? "dtrace not found" "$LINENO" 5
2006-10-04 20:07:45 -04:00
fi
2013-12-18 20:53:23 -05:00
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-dtrace option" "$LINENO" 5
;;
esac
2006-10-04 20:07:45 -04:00
else
2013-12-18 20:53:23 -05:00
enable_dtrace=no
2006-10-04 20:07:45 -04:00
fi
2008-02-17 11:36:43 -05:00
2006-10-04 20:07:45 -04:00
2008-02-17 11:36:43 -05:00
2014-11-02 09:14:36 -05:00
#
# TAP tests
#
# Check whether --enable-tap-tests was given.
if test "${enable_tap_tests+set}" = set; then :
enableval=$enable_tap_tests;
case $enableval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-tap-tests option" "$LINENO" 5
;;
esac
else
enable_tap_tests=no
fi
2024-11-04 07:09:38 -05:00
Add backend support for injection points
Injection points are a new facility that makes possible for developers
to run custom code in pre-defined code paths. Its goal is to provide
ways to design and run advanced tests, for cases like:
- Race conditions, where processes need to do actions in a controlled
ordered manner.
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force
recovery, etc.
- Arbitrary sleeps.
This implements some basics, and there are plans to extend it more in
the future depending on what's required. Hence, this commit adds a set
of routines in the backend that allows developers to attach, detach and
run injection points:
- A code path calling an injection point can be declared with the macro
INJECTION_POINT(name).
- InjectionPointAttach() and InjectionPointDetach() to respectively
attach and detach a callback to/from an injection point. An injection
point name is registered in a shmem hash table with a library name and a
function name, which will be used to load the callback attached to an
injection point when its code path is run.
Injection point names are just strings, so as an injection point can be
declared and run by out-of-core extensions and modules, with callbacks
defined in external libraries.
This facility is hidden behind a dedicated switch for ./configure and
meson, disabled by default.
Note that backends use a local cache to store callbacks already loaded,
cleaning up their cache if a callback has found to be removed on a
best-effort basis. This could be refined further but any tests but what
we have here was fine with the tests I've written while implementing
these backend APIs.
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip
Kumar, Amul Sul, Nazir Bilal Yavuz
Discussion: https://postgr.es/m/ZTiV8tn_MIb_H2rE@paquier.xyz
2024-01-21 20:15:50 -05:00
#
# Injection points
#
# Check whether --enable-injection-points was given.
if test "${enable_injection_points+set}" = set; then :
enableval=$enable_injection_points;
case $enableval in
yes)
$as_echo "#define USE_INJECTION_POINTS 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-injection-points option" "$LINENO" 5
;;
esac
else
enable_injection_points=no
fi
2013-12-18 20:53:23 -05:00
#
# Block size
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for block size" >&5
$as_echo_n "checking for block size... " >&6; }
# Check whether --with-blocksize was given.
if test "${with_blocksize+set}" = set; then :
withval=$with_blocksize;
case $withval in
yes)
as_fn_error $? "argument required for --with-blocksize option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-blocksize option" "$LINENO" 5
;;
*)
blocksize=$withval
;;
esac
2006-10-04 20:07:45 -04:00
else
2013-12-18 20:53:23 -05:00
blocksize=8
2006-10-04 20:07:45 -04:00
fi
2013-12-18 20:53:23 -05:00
case ${blocksize} in
1) BLCKSZ=1024;;
2) BLCKSZ=2048;;
4) BLCKSZ=4096;;
8) BLCKSZ=8192;;
16) BLCKSZ=16384;;
32) BLCKSZ=32768;;
*) as_fn_error $? "Invalid block size. Allowed values are 1,2,4,8,16,32." "$LINENO" 5
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${blocksize}kB" >&5
$as_echo "${blocksize}kB" >&6; }
2006-10-04 20:07:45 -04:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define BLCKSZ ${BLCKSZ}
2006-10-04 20:07:45 -04:00
_ACEOF
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
#
# Relation segment size
#
2006-10-04 20:07:45 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-segsize was given.
if test "${with_segsize+set}" = set; then :
withval=$with_segsize;
case $withval in
yes)
as_fn_error $? "argument required for --with-segsize option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-segsize option" "$LINENO" 5
;;
*)
segsize=$withval
;;
esac
2006-10-04 20:07:45 -04:00
else
2013-12-18 20:53:23 -05:00
segsize=1
2006-10-04 20:07:45 -04:00
fi
2022-12-07 22:32:59 -05:00
# Check whether --with-segsize-blocks was given.
if test "${with_segsize_blocks+set}" = set; then :
withval=$with_segsize_blocks;
case $withval in
yes)
as_fn_error $? "argument required for --with-segsize-blocks option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-segsize-blocks option" "$LINENO" 5
;;
*)
segsize_blocks=$withval
;;
esac
else
segsize_blocks=0
fi
# If --with-segsize-blocks is non-zero, it is used, --with-segsize
# otherwise. segsize-blocks is only really useful for developers wanting to
# test segment related code. Warn if both are used.
if test $segsize_blocks -ne 0 -a $segsize -ne 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: both --with-segsize and --with-segsize-blocks specified, --with-segsize-blocks wins" >&5
$as_echo "$as_me: WARNING: both --with-segsize and --with-segsize-blocks specified, --with-segsize-blocks wins" >&2;}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for segment size" >&5
$as_echo_n "checking for segment size... " >&6; }
if test $segsize_blocks -eq 0; then
# this expression is set up to avoid unnecessary integer overflow
# blocksize is already guaranteed to be a factor of 1024
RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024`
test $? -eq 0 || exit 1
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${segsize}GB" >&5
2013-12-18 20:53:23 -05:00
$as_echo "${segsize}GB" >&6; }
2022-12-07 22:32:59 -05:00
else
RELSEG_SIZE=$segsize_blocks
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${RELSEG_SIZE} blocks" >&5
$as_echo "${RELSEG_SIZE} blocks" >&6; }
fi
2006-10-04 20:07:45 -04:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define RELSEG_SIZE ${RELSEG_SIZE}
_ACEOF
2006-10-04 20:07:45 -04:00
2013-12-18 20:53:23 -05:00
#
# WAL block size
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WAL block size" >&5
$as_echo_n "checking for WAL block size... " >&6; }
2006-10-04 20:07:45 -04:00
2004-12-02 16:41:12 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-wal-blocksize was given.
if test "${with_wal_blocksize+set}" = set; then :
withval=$with_wal_blocksize;
case $withval in
yes)
as_fn_error $? "argument required for --with-wal-blocksize option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-wal-blocksize option" "$LINENO" 5
;;
*)
wal_blocksize=$withval
;;
esac
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
else
wal_blocksize=8
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
case ${wal_blocksize} in
1) XLOG_BLCKSZ=1024;;
2) XLOG_BLCKSZ=2048;;
4) XLOG_BLCKSZ=4096;;
8) XLOG_BLCKSZ=8192;;
16) XLOG_BLCKSZ=16384;;
32) XLOG_BLCKSZ=32768;;
64) XLOG_BLCKSZ=65536;;
*) as_fn_error $? "Invalid WAL block size. Allowed values are 1,2,4,8,16,32,64." "$LINENO" 5
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${wal_blocksize}kB" >&5
$as_echo "${wal_blocksize}kB" >&6; }
cat >>confdefs.h <<_ACEOF
#define XLOG_BLCKSZ ${XLOG_BLCKSZ}
_ACEOF
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
#
# C compiler
#
2007-07-10 09:14:22 -04:00
Remove AIX support
There isn't a lot of user demand for AIX support, we have a bunch of
hacks to work around AIX-specific compiler bugs and idiosyncrasies,
and no one has stepped up to the plate to properly maintain it.
Remove support for AIX to get rid of that maintenance overhead. It's
still supported for stable versions.
The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:
TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.
That could be worked around, but we decided to just drop the AIX support
instead.
Discussion: https://www.postgresql.org/message-id/20240224172345.32@rfd.leadboat.com
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro
2024-02-28 06:10:51 -05:00
# If you don't specify a list of compilers to test, the AC_PROG_CC and
# AC_PROG_CXX macros test for a long list of unsupported compilers.
pgac_cc_list="gcc cc"
pgac_cxx_list="g++ c++"
2013-12-18 20:53:23 -05:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in $pgac_cc_list
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2007-07-12 10:36:52 -04:00
else
2013-12-18 20:53:23 -05:00
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
2007-07-12 10:36:52 -04:00
else
2013-12-18 20:53:23 -05:00
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2007-07-12 10:36:52 -04:00
fi
2013-12-18 20:53:23 -05:00
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
2007-07-10 09:14:22 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2007-07-12 10:36:52 -04:00
fi
2008-02-17 11:36:43 -05:00
2007-07-12 10:36:52 -04:00
2013-12-18 20:53:23 -05:00
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in $pgac_cc_list
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2007-07-12 10:36:52 -04:00
else
2013-12-18 20:53:23 -05:00
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2007-07-12 10:36:52 -04:00
fi
2013-12-18 20:53:23 -05:00
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
2007-07-12 10:36:52 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2007-07-10 09:14:22 -04:00
fi
2013-12-18 20:53:23 -05:00
test -n "$ac_ct_CC" && break
2007-07-12 10:36:52 -04:00
done
2013-12-18 20:53:23 -05:00
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
2007-07-12 10:36:52 -04:00
fi
2007-07-10 09:14:22 -04:00
2013-12-18 20:53:23 -05:00
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
2002-03-29 12:32:55 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2000-06-11 07:40:09 -04:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2002-03-29 19:20:15 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
2002-03-29 19:20:15 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
2000-06-11 07:40:09 -04:00
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
ac_file=''
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
2002-03-29 12:32:55 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
#include <stdio.h>
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
2002-03-29 12:32:55 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
2002-03-29 12:32:55 -05:00
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
1997-02-04 03:53:45 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
1997-02-04 03:53:45 -05:00
2013-12-18 20:53:23 -05:00
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
2008-02-17 11:36:43 -05:00
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
2013-12-18 20:53:23 -05:00
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
2002-03-29 12:32:55 -05:00
ac_status=$?
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
1997-02-04 03:53:45 -05:00
else
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: failed program was:" >&5
2005-07-01 14:17:31 -04:00
sed 's/^/| /' conftest.$ac_ext >&5
2013-12-18 20:53:23 -05:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
#ifndef __GNUC__
choke me
#endif
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
ac_compiler_gnu=no
1997-02-04 03:53:45 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
GCC=
2001-09-07 15:52:54 -04:00
fi
2013-12-18 20:53:23 -05:00
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2005-07-01 14:17:31 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
2001-09-07 15:52:54 -04:00
else
2013-12-18 20:53:23 -05:00
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
2003-02-14 09:05:00 -05:00
2013-12-18 20:53:23 -05:00
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
2003-02-14 09:05:00 -05:00
2013-12-18 20:53:23 -05:00
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2003-02-14 09:05:00 -05:00
do
2013-12-18 20:53:23 -05:00
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
2003-02-14 09:05:00 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
if test "x$ac_cv_prog_cc_c89" != xno; then :
2005-07-01 14:17:31 -04:00
2003-02-14 09:05:00 -05:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2003-02-14 09:05:00 -05:00
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
# Detect option needed for C11
# loosely modeled after code in later Autoconf versions
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C11" >&5
$as_echo_n "checking for $CC option to accept ISO C11... " >&6; }
if ${pgac_cv_prog_cc_c11+:} false; then :
2018-08-16 04:32:05 -04:00
$as_echo_n "(cached) " >&6
else
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
pgac_cv_prog_cc_c11=no
pgac_save_CC=$CC
for pgac_arg in '' '-std=gnu11' '-std=c11'; do
CC="$pgac_save_CC $pgac_arg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2018-08-16 04:32:05 -04:00
/* end confdefs.h. */
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
# error "Compiler does not advertise C11 conformance"
2018-08-16 04:32:05 -04:00
#endif
_ACEOF
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_cc_c11=$pgac_arg
2018-08-16 04:32:05 -04:00
fi
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test x"$pgac_cv_prog_cc_c11" != x"no" && break
2018-08-16 04:32:05 -04:00
done
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
CC=$pgac_save_CC
2018-08-16 04:32:05 -04:00
fi
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
if test x"$pgac_cv_prog_cc_c11" = x"no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; }
as_fn_error $? "C compiler \"$CC\" does not support C11" "$LINENO" 5
elif test x"$pgac_cv_prog_cc_c11" = x""; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_c11" >&5
$as_echo "$pgac_cv_prog_cc_c11" >&6; }
CC="$CC $pgac_cv_prog_cc_c11"
2018-08-23 21:33:40 -04:00
fi
Raise C requirement to C11
This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org
2025-08-26 04:43:14 -04:00
2018-03-20 18:41:15 -04:00
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -z "$CXX"; then
if test -n "$CCC"; then
CXX=$CCC
else
if test -n "$ac_tool_prefix"; then
for ac_prog in $pgac_cxx_list
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
$as_echo "$CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in $pgac_cxx_list
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
$as_echo "$ac_ct_CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CXX" && break
done
if test "x$ac_ct_CXX" = x; then
CXX="g++"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_ct_CXX
fi
fi
fi
fi
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
if ${ac_cv_cxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GXX=yes
else
GXX=
fi
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_cv_prog_cxx_g=no
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
else
CXXFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
$as_echo "$ac_cv_prog_cxx_g" >&6; }
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2013-12-18 20:53:23 -05:00
2026-01-22 02:39:39 -05:00
# Check if it actually found a C++ compiler.
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
2026-01-20 10:24:57 -05:00
have_cxx=yes
else
have_cxx=no
fi
2026-01-22 02:39:39 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$have_cxx" = yes; then
# Detect option needed for C++11
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to accept ISO C++11" >&5
$as_echo_n "checking for $CXX option to accept ISO C++11... " >&6; }
if ${pgac_cv_prog_cxx_cxx11+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_cv_prog_cxx_cxx11=no
pgac_save_CXX=$CXX
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
for pgac_arg in '' '-std=gnu++11' '-std=c++11'; do
CXX="$pgac_save_CXX $pgac_arg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if !defined __cplusplus || __cplusplus < 201103L
# error "Compiler does not advertise C++11 conformance"
#endif
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_cxx_cxx11=$pgac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test x"$pgac_cv_prog_cxx_cxx11" != x"no" && break
done
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
CXX=$pgac_save_CXX
fi
if test x"$pgac_cv_prog_cxx_cxx11" = x"no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C++ compiler \"$CXX\" does not support C++11" >&5
$as_echo "$as_me: WARNING: C++ compiler \"$CXX\" does not support C++11" >&2;}
have_cxx=no
elif test x"$pgac_cv_prog_cxx_cxx11" = x""; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cxx_cxx11" >&5
$as_echo "$pgac_cv_prog_cxx_cxx11" >&6; }
CXX="$CXX $pgac_cv_prog_cxx_cxx11"
fi
fi # have_cxx
2026-01-20 10:24:57 -05:00
2013-12-18 20:53:23 -05:00
# Check if it's Intel's compiler, which (usually) pretends to be gcc,
# but has idiosyncrasies of its own. We assume icc will define
# __INTEL_COMPILER regardless of CFLAGS.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
#ifndef __INTEL_COMPILER
choke me
#endif
;
return 0;
}
2003-02-14 09:05:00 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
ICC=yes
2003-02-14 09:05:00 -05:00
else
2018-03-20 20:26:25 -04:00
ICC=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#
# LLVM
#
# Checked early because subsequent tests depend on it.
# Check whether --with-llvm was given.
if test "${with_llvm+set}" = set; then :
withval=$with_llvm;
case $withval in
yes)
$as_echo "#define USE_LLVM 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-llvm option" "$LINENO" 5
;;
esac
else
with_llvm=no
fi
2018-11-17 23:16:00 -05:00
for ac_prog in gawk mawk nawk awk
2018-03-20 20:26:25 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$AWK" && break
done
2018-11-17 23:16:00 -05:00
if test "$with_llvm" = yes; then :
2018-03-20 20:26:25 -04:00
2018-11-19 12:01:47 -05:00
2018-03-20 20:26:25 -04:00
if test -z "$LLVM_CONFIG"; then
2024-05-15 21:41:03 -04:00
for ac_prog in llvm-config
2018-03-20 20:26:25 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_LLVM_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LLVM_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_LLVM_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
LLVM_CONFIG=$ac_cv_path_LLVM_CONFIG
if test -n "$LLVM_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
$as_echo "$LLVM_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$LLVM_CONFIG" && break
done
else
# Report the value of LLVM_CONFIG in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLVM_CONFIG" >&5
$as_echo_n "checking for LLVM_CONFIG... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
$as_echo "$LLVM_CONFIG" >&6; }
fi
# no point continuing if llvm wasn't found
if test -z "$LLVM_CONFIG"; then
as_fn_error $? "llvm-config not found, but required when compiling --with-llvm, specify with LLVM_CONFIG=" "$LINENO" 5
fi
# check if detected $LLVM_CONFIG is executable
pgac_llvm_version="$($LLVM_CONFIG --version 2> /dev/null || echo no)"
if test "x$pgac_llvm_version" = "xno"; then
as_fn_error $? "$LLVM_CONFIG does not work" "$LINENO" 5
fi
# and whether the version is supported
2024-10-01 04:49:11 -04:00
if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >= 14) exit 1; else exit 0;}';then
as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least 14 is required" "$LINENO" 5
2018-03-20 20:26:25 -04:00
fi
2023-10-21 21:17:00 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: using llvm $pgac_llvm_version" >&5
$as_echo "$as_me: using llvm $pgac_llvm_version" >&6;}
2018-03-20 20:26:25 -04:00
# need clang to create some bitcode files
if test -z "$CLANG"; then
2024-05-15 21:41:03 -04:00
for ac_prog in clang
2018-03-20 20:26:25 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CLANG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CLANG in
[\\/]* | ?:[\\/]*)
ac_cv_path_CLANG="$CLANG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CLANG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
CLANG=$ac_cv_path_CLANG
if test -n "$CLANG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG" >&5
$as_echo "$CLANG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CLANG" && break
done
else
# Report the value of CLANG in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLANG" >&5
$as_echo_n "checking for CLANG... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG" >&5
$as_echo "$CLANG" >&6; }
fi
if test -z "$CLANG"; then
as_fn_error $? "clang not found, but required when compiling --with-llvm, specify with CLANG=" "$LINENO" 5
fi
# make sure clang is executable
if test "x$($CLANG --version 2> /dev/null || echo no)" = "xno"; then
as_fn_error $? "$CLANG does not work" "$LINENO" 5
fi
# Could check clang version, but it doesn't seem that
# important. Systems with a new enough LLVM version are usually
# going to have a decent clang version too. It's also not entirely
# clear what the minimum version is.
# Collect compiler flags necessary to build the LLVM dependent
# shared library.
for pgac_option in `$LLVM_CONFIG --cppflags`; do
case $pgac_option in
-I*|-D*) LLVM_CPPFLAGS="$pgac_option $LLVM_CPPFLAGS";;
esac
done
for pgac_option in `$LLVM_CONFIG --ldflags`; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-L*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
2018-03-20 20:26:25 -04:00
esac
done
# ABI influencing options, standard influencing options
for pgac_option in `$LLVM_CONFIG --cxxflags`; do
case $pgac_option in
-fno-rtti*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
-std=*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
esac
done
# Look for components we're interested in, collect necessary
# libs. As some components are optional, we can't just list all of
# them as it'd raise an error.
pgac_components='';
for pgac_component in `$LLVM_CONFIG --components`; do
case $pgac_component in
engine) pgac_components="$pgac_components $pgac_component";;
debuginfodwarf) pgac_components="$pgac_components $pgac_component";;
orcjit) pgac_components="$pgac_components $pgac_component";;
passes) pgac_components="$pgac_components $pgac_component";;
2020-12-07 21:12:23 -05:00
native) pgac_components="$pgac_components $pgac_component";;
2018-03-20 20:26:25 -04:00
perfjitevents) pgac_components="$pgac_components $pgac_component";;
esac
done;
# And then get the libraries that need to be linked in for the
# selected components. They're large libraries, we only want to
# link them into the LLVM using shared library.
for pgac_option in `$LLVM_CONFIG --libs --system-libs $pgac_components`; do
case $pgac_option in
-l*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
esac
done
LLVM_BINPATH=`$LLVM_CONFIG --bindir`
2003-02-14 09:05:00 -05:00
2001-09-07 15:52:54 -04:00
2018-03-20 20:26:25 -04:00
2018-11-19 12:01:47 -05:00
fi # fi
2018-03-20 20:26:25 -04:00
2013-12-18 20:53:23 -05:00
unset CFLAGS
2018-03-21 21:40:23 -04:00
unset CXXFLAGS
2003-02-14 09:05:00 -05:00
2013-12-18 20:53:23 -05:00
#
# Read the template
#
. "$srcdir/src/template/$template" || exit
2003-02-14 09:05:00 -05:00
2018-03-20 18:41:15 -04:00
# C[XX]FLAGS are selected so:
2013-12-18 20:53:23 -05:00
# If the user specifies something in the environment, that is used.
# else: If the template file set something, that is used.
# else: If coverage was enabled, don't set anything.
# else: If the compiler is GCC, then we use -O2.
# else: If the compiler is something else, then we use -O, unless debugging.
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
elif test "${CFLAGS+set}" = set; then
: # (keep what template set)
elif test "$enable_coverage" = yes; then
: # no optimization by default
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
# if the user selected debug mode, don't use -O
if test "$enable_debug" != yes; then
CFLAGS="-O"
fi
fi
2001-09-07 15:52:54 -04:00
2018-03-20 18:41:15 -04:00
if test "$ac_env_CXXFLAGS_set" = set; then
CXXFLAGS=$ac_env_CXXFLAGS_value
elif test "${CXXFLAGS+set}" = set; then
: # (keep what template set)
elif test "$enable_coverage" = yes; then
: # no optimization by default
elif test "$GCC" = yes; then
CXXFLAGS="-O2"
else
# if the user selected debug mode, don't use -O
if test "$enable_debug" != yes; then
CXXFLAGS="-O"
fi
fi
2018-03-20 20:26:25 -04:00
# When generating bitcode (for inlining) we always want to use -O2
2021-11-18 14:50:13 -05:00
# even when --enable-debug is specified. The bitcode is not going to
2018-03-20 20:26:25 -04:00
# be used for line-by-line debugging, and JIT inlining doesn't work
# without at least -O1 (otherwise clang will emit 'noinline'
# attributes everywhere), which is bad for testing. Still allow the
# environment to override if done explicitly.
if test "$ac_env_BITCODE_CFLAGS_set" = set; then
BITCODE_CFLAGS=$ac_env_BITCODE_CFLAGS_value
else
BITCODE_CFLAGS="-O2 $BITCODE_CFLAGS"
fi
if test "$ac_env_BITCODE_CXXFLAGS_set" = set; then
BITCODE_CXXFLAGS=$ac_env_BITCODE_CXXFLAGS_value
else
2018-03-21 21:41:08 -04:00
BITCODE_CXXFLAGS="-O2 $BITCODE_CXXFLAGS"
2018-03-20 20:26:25 -04:00
fi
2018-03-20 18:41:15 -04:00
# C[XX]FLAGS we determined above will be added back at the end
2015-01-14 11:08:13 -05:00
user_CFLAGS=$CFLAGS
CFLAGS=""
2018-03-20 18:41:15 -04:00
user_CXXFLAGS=$CXXFLAGS
CXXFLAGS=""
2018-03-20 20:26:25 -04:00
user_BITCODE_CFLAGS=$BITCODE_CFLAGS
BITCODE_CFLAGS=""
user_BITCODE_CXXFLAGS=$BITCODE_CXXFLAGS
BITCODE_CXXFLAGS=""
2015-01-14 11:08:13 -05:00
2020-09-06 21:28:16 -04:00
# set CFLAGS_UNROLL_LOOPS and CFLAGS_VECTORIZE from the environment, if present
if test "$ac_env_CFLAGS_UNROLL_LOOPS_set" = set; then
CFLAGS_UNROLL_LOOPS=$ac_env_CFLAGS_UNROLL_LOOPS_value
fi
if test "$ac_env_CFLAGS_VECTORIZE_set" = set; then
CFLAGS_VECTORIZE=$ac_env_CFLAGS_VECTORIZE_value
2006-12-21 11:05:16 -05:00
fi
2013-12-18 20:53:23 -05:00
# Some versions of GCC support some additional useful warning flags.
# Check whether they are supported, and add them to CFLAGS if so.
# ICC pretends to be GCC but it's lying; it doesn't support these flags,
# but has its own. Also check other compiler-specific flags here.
if test "$GCC" = yes -a "$ICC" = no; then
2015-01-14 11:08:13 -05:00
CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
2018-03-20 18:41:15 -04:00
CXXFLAGS="-Wall -Wpointer-arith"
2013-12-18 20:53:23 -05:00
# These work in some but not all gcc versions
Change floating-point output format for improved performance.
Previously, floating-point output was done by rounding to a specific
decimal precision; by default, to 6 or 15 decimal digits (losing
information) or as requested using extra_float_digits. Drivers that
wanted exact float values, and applications like pg_dump that must
preserve values exactly, set extra_float_digits=3 (or sometimes 2 for
historical reasons, though this isn't enough for float4).
Unfortunately, decimal rounded output is slow enough to become a
noticable bottleneck when dealing with large result sets or COPY of
large tables when many floating-point values are involved.
Floating-point output can be done much faster when the output is not
rounded to a specific decimal length, but rather is chosen as the
shortest decimal representation that is closer to the original float
value than to any other value representable in the same precision. The
recently published Ryu algorithm by Ulf Adams is both relatively
simple and remarkably fast.
Accordingly, change float4out/float8out to output shortest decimal
representations if extra_float_digits is greater than 0, and make that
the new default. Applications that need rounded output can set
extra_float_digits back to 0 or below, and take the resulting
performance hit.
We make one concession to portability for systems with buggy
floating-point input: we do not output decimal values that fall
exactly halfway between adjacent representable binary values (which
would rely on the reader doing round-to-nearest-even correctly). This
is known to be a problem at least for VS2013 on Windows.
Our version of the Ryu code originates from
https://github.com/ulfjack/ryu/ at commit c9c3fb1979, but with the
following (significant) modifications:
- Output format is changed to use fixed-point notation for small
exponents, as printf would, and also to use lowercase 'e', a
minimum of 2 exponent digits, and a mandatory sign on the exponent,
to keep the formatting as close as possible to previous output.
- The output of exact midpoint values is disabled as noted above.
- The integer fast-path code is changed somewhat (since we have
fixed-point output and the upstream did not).
- Our project style has been largely applied to the code with the
exception of C99 declaration-after-statement, which has been
retained as an exception to our present policy.
- Most of upstream's debugging and conditionals are removed, and we
use our own configure tests to determine things like uint128
availability.
Changing the float output format obviously affects a number of
regression tests. This patch uses an explicit setting of
extra_float_digits=0 for test output that is not expected to be
exactly reproducible (e.g. due to numerical instability or differing
algorithms for transcendental functions).
Conversions from floats to numeric are unchanged by this patch. These
may appear in index expressions and it is not yet clear whether any
change should be made, so that can be left for another day.
This patch assumes that the only supported floating point format is
now IEEE format, and the documentation is updated to reflect that.
Code by me, adapting the work of Ulf Adams and other contributors.
References:
https://dl.acm.org/citation.cfm?id=3192369
Reviewed-by: Tom Lane, Andres Freund, Donald Dong
Discussion: https://postgr.es/m/87r2el1bx6.fsf@news-spur.riddles.org.uk
2019-02-13 10:20:33 -05:00
save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wdeclaration-after-statement, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wdeclaration-after-statement, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wdeclaration_after_statement+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-12-21 11:05:16 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wdeclaration-after-statement"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-12-21 11:05:16 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2006-12-21 11:05:16 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wdeclaration_after_statement=yes
2006-12-21 11:05:16 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wdeclaration_after_statement=no
2006-12-21 11:05:16 -05:00
fi
2008-02-17 11:36:43 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2013-12-18 20:53:23 -05:00
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" = x"yes"; then
CFLAGS="${CFLAGS} -Wdeclaration-after-statement"
2013-12-18 20:53:23 -05:00
fi
2006-12-21 11:05:16 -05:00
2018-03-20 15:58:08 -04:00
Change floating-point output format for improved performance.
Previously, floating-point output was done by rounding to a specific
decimal precision; by default, to 6 or 15 decimal digits (losing
information) or as requested using extra_float_digits. Drivers that
wanted exact float values, and applications like pg_dump that must
preserve values exactly, set extra_float_digits=3 (or sometimes 2 for
historical reasons, though this isn't enough for float4).
Unfortunately, decimal rounded output is slow enough to become a
noticable bottleneck when dealing with large result sets or COPY of
large tables when many floating-point values are involved.
Floating-point output can be done much faster when the output is not
rounded to a specific decimal length, but rather is chosen as the
shortest decimal representation that is closer to the original float
value than to any other value representable in the same precision. The
recently published Ryu algorithm by Ulf Adams is both relatively
simple and remarkably fast.
Accordingly, change float4out/float8out to output shortest decimal
representations if extra_float_digits is greater than 0, and make that
the new default. Applications that need rounded output can set
extra_float_digits back to 0 or below, and take the resulting
performance hit.
We make one concession to portability for systems with buggy
floating-point input: we do not output decimal values that fall
exactly halfway between adjacent representable binary values (which
would rely on the reader doing round-to-nearest-even correctly). This
is known to be a problem at least for VS2013 on Windows.
Our version of the Ryu code originates from
https://github.com/ulfjack/ryu/ at commit c9c3fb1979, but with the
following (significant) modifications:
- Output format is changed to use fixed-point notation for small
exponents, as printf would, and also to use lowercase 'e', a
minimum of 2 exponent digits, and a mandatory sign on the exponent,
to keep the formatting as close as possible to previous output.
- The output of exact midpoint values is disabled as noted above.
- The integer fast-path code is changed somewhat (since we have
fixed-point output and the upstream did not).
- Our project style has been largely applied to the code with the
exception of C99 declaration-after-statement, which has been
retained as an exception to our present policy.
- Most of upstream's debugging and conditionals are removed, and we
use our own configure tests to determine things like uint128
availability.
Changing the float output format obviously affects a number of
regression tests. This patch uses an explicit setting of
extra_float_digits=0 for test output that is not expected to be
exactly reproducible (e.g. due to numerical instability or differing
algorithms for transcendental functions).
Conversions from floats to numeric are unchanged by this patch. These
may appear in index expressions and it is not yet clear whether any
change should be made, so that can be left for another day.
This patch assumes that the only supported floating point format is
now IEEE format, and the documentation is updated to reflect that.
Code by me, adapting the work of Ulf Adams and other contributors.
References:
https://dl.acm.org/citation.cfm?id=3192369
Reviewed-by: Tom Lane, Andres Freund, Donald Dong
Discussion: https://postgr.es/m/87r2el1bx6.fsf@news-spur.riddles.org.uk
2019-02-13 10:20:33 -05:00
# -Wdeclaration-after-statement isn't applicable for C++. Specific C files
# disable it, so AC_SUBST the negative form.
PERMIT_DECLARATION_AFTER_STATEMENT=
2019-02-16 16:12:28 -05:00
if test x"$save_CFLAGS" != x"$CFLAGS"; then
Change floating-point output format for improved performance.
Previously, floating-point output was done by rounding to a specific
decimal precision; by default, to 6 or 15 decimal digits (losing
information) or as requested using extra_float_digits. Drivers that
wanted exact float values, and applications like pg_dump that must
preserve values exactly, set extra_float_digits=3 (or sometimes 2 for
historical reasons, though this isn't enough for float4).
Unfortunately, decimal rounded output is slow enough to become a
noticable bottleneck when dealing with large result sets or COPY of
large tables when many floating-point values are involved.
Floating-point output can be done much faster when the output is not
rounded to a specific decimal length, but rather is chosen as the
shortest decimal representation that is closer to the original float
value than to any other value representable in the same precision. The
recently published Ryu algorithm by Ulf Adams is both relatively
simple and remarkably fast.
Accordingly, change float4out/float8out to output shortest decimal
representations if extra_float_digits is greater than 0, and make that
the new default. Applications that need rounded output can set
extra_float_digits back to 0 or below, and take the resulting
performance hit.
We make one concession to portability for systems with buggy
floating-point input: we do not output decimal values that fall
exactly halfway between adjacent representable binary values (which
would rely on the reader doing round-to-nearest-even correctly). This
is known to be a problem at least for VS2013 on Windows.
Our version of the Ryu code originates from
https://github.com/ulfjack/ryu/ at commit c9c3fb1979, but with the
following (significant) modifications:
- Output format is changed to use fixed-point notation for small
exponents, as printf would, and also to use lowercase 'e', a
minimum of 2 exponent digits, and a mandatory sign on the exponent,
to keep the formatting as close as possible to previous output.
- The output of exact midpoint values is disabled as noted above.
- The integer fast-path code is changed somewhat (since we have
fixed-point output and the upstream did not).
- Our project style has been largely applied to the code with the
exception of C99 declaration-after-statement, which has been
retained as an exception to our present policy.
- Most of upstream's debugging and conditionals are removed, and we
use our own configure tests to determine things like uint128
availability.
Changing the float output format obviously affects a number of
regression tests. This patch uses an explicit setting of
extra_float_digits=0 for test output that is not expected to be
exactly reproducible (e.g. due to numerical instability or differing
algorithms for transcendental functions).
Conversions from floats to numeric are unchanged by this patch. These
may appear in index expressions and it is not yet clear whether any
change should be made, so that can be left for another day.
This patch assumes that the only supported floating point format is
now IEEE format, and the documentation is updated to reflect that.
Code by me, adapting the work of Ulf Adams and other contributors.
References:
https://dl.acm.org/citation.cfm?id=3192369
Reviewed-by: Tom Lane, Andres Freund, Donald Dong
Discussion: https://postgr.es/m/87r2el1bx6.fsf@news-spur.riddles.org.uk
2019-02-13 10:20:33 -05:00
PERMIT_DECLARATION_AFTER_STATEMENT=-Wno-declaration-after-statement
fi
2018-08-23 21:33:40 -04:00
# Really don't want VLAs to be used in our dialect of C
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Werror=vla, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Werror=vla, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Werror_vla+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Werror=vla"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Werror_vla=yes
else
pgac_cv_prog_CC_cflags__Werror_vla=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Werror_vla" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Werror_vla" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Werror_vla" = x"yes"; then
CFLAGS="${CFLAGS} -Werror=vla"
fi
2021-07-12 19:17:35 -04:00
# On macOS, complain about usage of symbols newer than the deployment target
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Werror=unguarded-availability-new, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Werror=unguarded-availability-new, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Werror=unguarded-availability-new"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new=yes
else
pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Werror_unguarded_availability_new" = x"yes"; then
CFLAGS="${CFLAGS} -Werror=unguarded-availability-new"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Werror=unguarded-availability-new, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Werror=unguarded-availability-new, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Werror=unguarded-availability-new"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new=yes
else
pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Werror_unguarded_availability_new" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Werror=unguarded-availability-new"
fi
2018-08-23 21:33:40 -04:00
# -Wvla is not applicable for C++
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wendif-labels, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wendif-labels, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wendif_labels+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wendif-labels"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-12-21 11:05:16 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2006-12-21 11:05:16 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wendif_labels=yes
2006-12-21 11:05:16 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wendif_labels=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wendif_labels" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wendif_labels" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wendif_labels" = x"yes"; then
CFLAGS="${CFLAGS} -Wendif-labels"
2006-12-21 11:05:16 -05:00
fi
2008-02-17 11:36:43 -05:00
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wendif-labels, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wendif-labels, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wendif_labels+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wendif-labels"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wendif_labels=yes
else
pgac_cv_prog_CXX_cxxflags__Wendif_labels=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wendif_labels" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wendif_labels" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wendif_labels" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wendif-labels"
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wmissing-format-attribute, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wmissing-format-attribute, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wmissing_format_attribute+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-12-21 11:05:16 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wmissing-format-attribute"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2006-12-21 11:05:16 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wmissing_format_attribute=yes
2006-12-21 11:05:16 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wmissing_format_attribute=no
2006-12-21 11:05:16 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wmissing_format_attribute" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wmissing_format_attribute" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wmissing_format_attribute" = x"yes"; then
CFLAGS="${CFLAGS} -Wmissing-format-attribute"
2007-04-15 08:48:24 -04:00
fi
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wmissing-format-attribute, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wmissing-format-attribute, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wmissing-format-attribute"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute=yes
else
pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wmissing_format_attribute" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wmissing-format-attribute"
fi
2020-05-12 16:01:52 -04:00
2020-05-13 15:31:14 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3+:} false; then :
2020-05-12 16:01:52 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
2020-05-13 15:31:14 -04:00
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
2020-05-12 16:01:52 -04:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2020-05-13 15:31:14 -04:00
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=yes
2020-05-12 16:01:52 -04:00
else
2020-05-13 15:31:14 -04:00
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=no
2020-05-12 16:01:52 -04:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
2020-05-13 15:31:14 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" = x"yes"; then
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
2020-05-12 16:01:52 -04:00
fi
2020-05-13 15:31:14 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3+:} false; then :
2020-05-12 16:01:52 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
2020-05-13 15:31:14 -04:00
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
2020-05-12 16:01:52 -04:00
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
2020-05-13 15:31:14 -04:00
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=yes
2020-05-12 16:01:52 -04:00
else
2020-05-13 15:31:14 -04:00
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=no
2020-05-12 16:01:52 -04:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
2020-05-13 15:31:14 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
2020-05-12 16:01:52 -04:00
fi
Fix -Wcast-function-type warnings
Three groups of issues needed to be addressed:
load_external_function() and related functions returned PGFunction,
even though not necessarily all callers are looking for a function of
type PGFunction. Since these functions are really just wrappers
around dlsym(), change to return void * just like dlsym().
In dynahash.c, we are using strlcpy() where a function with a
signature like memcpy() is expected. This should be safe, as the new
comment there explains, but the cast needs to be augmented to avoid
the warning.
In PL/Python, methods all need to be cast to PyCFunction, per Python
API, but this now runs afoul of these warnings. (This issue also
exists in core CPython.)
To fix the second and third case, we add a new type pg_funcptr_t that
is defined specifically so that gcc accepts it as a special function
pointer that can be cast to any other function pointer without the
warning.
Also add -Wcast-function-type to the standard warning flags, subject
to configure check.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1e97628e-6447-b4fd-e230-d109cec2d584%402ndquadrant.com
2020-07-14 13:36:30 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wcast-function-type, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wcast_function_type+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wcast-function-type"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wcast_function_type=yes
else
pgac_cv_prog_CC_cflags__Wcast_function_type=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type" = x"yes"; then
CFLAGS="${CFLAGS} -Wcast-function-type"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wcast-function-type, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wcast-function-type, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wcast_function_type+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wcast-function-type"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wcast_function_type=yes
else
pgac_cv_prog_CXX_cxxflags__Wcast_function_type=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wcast_function_type" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wcast_function_type" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wcast_function_type" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wcast-function-type"
fi
2022-10-06 23:50:31 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wshadow=compatible-local, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wshadow=compatible-local, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wshadow_compatible_local+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wshadow=compatible-local"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wshadow_compatible_local=yes
else
pgac_cv_prog_CC_cflags__Wshadow_compatible_local=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wshadow_compatible_local" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wshadow_compatible_local" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wshadow_compatible_local" = x"yes"; then
CFLAGS="${CFLAGS} -Wshadow=compatible-local"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wshadow=compatible-local, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wshadow=compatible-local, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wshadow=compatible-local"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local=yes
else
pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wshadow=compatible-local"
fi
2018-03-20 18:41:15 -04:00
# This was included in -Wall/-Wformat in older GCC versions
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-security, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wformat-security, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wformat_security+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2007-04-15 08:48:24 -04:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wformat-security"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-04-15 08:48:24 -04:00
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2007-04-15 08:48:24 -04:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2007-04-15 08:48:24 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wformat_security=yes
2007-04-15 08:48:24 -04:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wformat_security=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wformat_security" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wformat_security" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wformat_security" = x"yes"; then
CFLAGS="${CFLAGS} -Wformat-security"
2007-04-15 08:48:24 -04:00
fi
2008-02-17 11:36:43 -05:00
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wformat-security, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -Wformat-security, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__Wformat_security+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -Wformat-security"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__Wformat_security=yes
else
pgac_cv_prog_CXX_cxxflags__Wformat_security=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wformat_security" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wformat_security" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__Wformat_security" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -Wformat-security"
fi
2024-08-03 05:42:37 -04:00
# gcc 14+, clang for a while
# (Supported in C++ by clang but not gcc. For consistency, omit in C++.)
save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wmissing-variable-declarations, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wmissing-variable-declarations, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wmissing_variable_declarations+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -Wmissing-variable-declarations"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wmissing_variable_declarations=yes
else
pgac_cv_prog_CC_cflags__Wmissing_variable_declarations=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wmissing_variable_declarations" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wmissing_variable_declarations" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wmissing_variable_declarations" = x"yes"; then
CFLAGS="${CFLAGS} -Wmissing-variable-declarations"
fi
PERMIT_MISSING_VARIABLE_DECLARATIONS=
if test x"$save_CFLAGS" != x"$CFLAGS"; then
PERMIT_MISSING_VARIABLE_DECLARATIONS=-Wno-missing-variable-declarations
fi
2013-12-18 20:53:23 -05:00
# Disable strict-aliasing rules; needed for gcc 3.3+
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__fno_strict_aliasing+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2007-04-15 08:48:24 -04:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -fno-strict-aliasing"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2007-04-15 08:48:24 -04:00
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fno_strict_aliasing=yes
2007-04-15 08:48:24 -04:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fno_strict_aliasing=no
2007-04-15 08:48:24 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CC_cflags__fno_strict_aliasing" = x"yes"; then
CFLAGS="${CFLAGS} -fno-strict-aliasing"
2003-06-11 02:56:07 -04:00
fi
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fno-strict-aliasing, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -fno-strict-aliasing, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing=yes
else
pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
fi
2013-12-18 20:53:23 -05:00
# Disable optimizations that assume no overflow; needed for gcc 4.3+
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fwrapv, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -fwrapv, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__fwrapv+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-03-06 12:41:44 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -fwrapv"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-03-06 12:41:44 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2006-03-06 12:41:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fwrapv=yes
2006-03-06 12:41:44 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fwrapv=no
2006-03-06 12:41:44 -05:00
fi
2008-02-17 11:36:43 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2013-12-18 20:53:23 -05:00
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fwrapv" >&5
$as_echo "$pgac_cv_prog_CC_cflags__fwrapv" >&6; }
if test x"$pgac_cv_prog_CC_cflags__fwrapv" = x"yes"; then
CFLAGS="${CFLAGS} -fwrapv"
2013-12-18 20:53:23 -05:00
fi
2006-03-06 12:41:44 -05:00
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fwrapv, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -fwrapv, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fwrapv+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -fwrapv"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fwrapv=yes
else
pgac_cv_prog_CXX_cxxflags__fwrapv=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fwrapv" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fwrapv" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fwrapv" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -fwrapv"
fi
2013-12-18 20:53:23 -05:00
# Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fexcess-precision=standard, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -fexcess-precision=standard, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__fexcess_precision_standard+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -fexcess-precision=standard"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-03-06 12:41:44 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
;
return 0;
}
2006-03-06 12:41:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fexcess_precision_standard=yes
2006-03-06 12:41:44 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fexcess_precision_standard=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fexcess_precision_standard" >&5
$as_echo "$pgac_cv_prog_CC_cflags__fexcess_precision_standard" >&6; }
if test x"$pgac_cv_prog_CC_cflags__fexcess_precision_standard" = x"yes"; then
CFLAGS="${CFLAGS} -fexcess-precision=standard"
2006-03-06 12:41:44 -05:00
fi
2008-02-17 11:36:43 -05:00
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fexcess-precision=standard, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -fexcess-precision=standard, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -fexcess-precision=standard"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard=yes
else
pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fexcess_precision_standard" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -fexcess-precision=standard"
fi
2020-09-06 21:28:16 -04:00
# Optimization flags for specific files that benefit from loop unrolling
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -funroll-loops, for CFLAGS_UNROLL_LOOPS" >&5
$as_echo_n "checking whether ${CC} supports -funroll-loops, for CFLAGS_UNROLL_LOOPS... " >&6; }
2018-03-20 15:58:08 -04:00
if ${pgac_cv_prog_CC_cflags__funroll_loops+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-03-06 12:41:44 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
2020-09-06 21:28:16 -04:00
CFLAGS="${CFLAGS_UNROLL_LOOPS} -funroll-loops"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2006-03-06 12:41:44 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2006-03-06 12:41:44 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__funroll_loops=yes
2006-03-06 12:41:44 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__funroll_loops=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__funroll_loops" >&5
$as_echo "$pgac_cv_prog_CC_cflags__funroll_loops" >&6; }
if test x"$pgac_cv_prog_CC_cflags__funroll_loops" = x"yes"; then
2020-09-06 21:28:16 -04:00
CFLAGS_UNROLL_LOOPS="${CFLAGS_UNROLL_LOOPS} -funroll-loops"
2006-03-06 12:41:44 -05:00
fi
2018-03-20 15:58:08 -04:00
2020-09-06 21:28:16 -04:00
# Optimization flags for specific files that benefit from vectorization
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -ftree-vectorize, for CFLAGS_VECTORIZE" >&5
$as_echo_n "checking whether ${CC} supports -ftree-vectorize, for CFLAGS_VECTORIZE... " >&6; }
2018-03-20 15:58:08 -04:00
if ${pgac_cv_prog_CC_cflags__ftree_vectorize+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2006-03-06 12:41:44 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
2020-09-06 21:28:16 -04:00
CFLAGS="${CFLAGS_VECTORIZE} -ftree-vectorize"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-03-06 12:41:44 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
int
main ()
{
2006-03-06 12:41:44 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2006-03-06 12:41:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__ftree_vectorize=yes
2006-03-06 12:41:44 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__ftree_vectorize=no
2006-03-06 12:41:44 -05:00
fi
2008-02-17 11:36:43 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2013-12-18 20:53:23 -05:00
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__ftree_vectorize" >&5
$as_echo "$pgac_cv_prog_CC_cflags__ftree_vectorize" >&6; }
if test x"$pgac_cv_prog_CC_cflags__ftree_vectorize" = x"yes"; then
2020-09-06 21:28:16 -04:00
CFLAGS_VECTORIZE="${CFLAGS_VECTORIZE} -ftree-vectorize"
2006-03-06 12:41:44 -05:00
fi
2018-03-20 15:58:08 -04:00
2021-11-18 14:50:13 -05:00
#
# The following tests want to suppress various unhelpful warnings by adding
# -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
# switches, so we have to test for the positive form and if that works,
# add the negative form. Note that tests of this form typically need to
# be duplicated in the BITCODE_CFLAGS setup stanza below.
#
# Suppress clang's unhelpful unused-command-line-argument warnings.
2018-06-16 15:34:07 -04:00
NOT_THE_CFLAGS=""
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wunused_command_line_argument+:} false; then :
2015-04-05 13:01:55 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
2015-04-05 13:01:55 -04:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wunused_command_line_argument=yes
2015-04-05 13:01:55 -04:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__Wunused_command_line_argument=no
2015-04-05 13:01:55 -04:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2015-04-05 13:01:55 -04:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wunused_command_line_argument" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wunused_command_line_argument" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wunused_command_line_argument" = x"yes"; then
2015-04-05 13:01:55 -04:00
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
fi
2018-03-20 15:58:08 -04:00
2015-04-05 13:01:55 -04:00
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
fi
2021-11-10 20:51:00 -05:00
# Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
2021-11-18 14:50:13 -05:00
# of warnings when building plperl because of usages in the Perl headers.
2021-11-10 20:51:00 -05:00
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro=yes
else
pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wcompound_token_split_by_macro" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-compound-token-split-by-macro"
fi
2018-06-16 15:34:07 -04:00
# Similarly disable useless truncation warnings from gcc 8+
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-truncation, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wformat-truncation, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wformat_truncation+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wformat_truncation=yes
else
pgac_cv_prog_CC_cflags__Wformat_truncation=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wformat_truncation" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wformat_truncation" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wformat_truncation" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-format-truncation"
fi
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wstringop-truncation, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wstringop-truncation, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wstringop_truncation+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wstringop_truncation=yes
else
pgac_cv_prog_CC_cflags__Wstringop_truncation=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wstringop_truncation" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wstringop_truncation" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wstringop_truncation" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-stringop-truncation"
fi
2022-12-12 16:03:28 -05:00
# Suppress clang 16's strict warnings about function casts
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__Wcast_function_type_strict+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=yes
else
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&5
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&6; }
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
fi
2013-12-18 20:53:23 -05:00
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -mp1, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -mp1, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__mp1+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
2006-03-06 12:41:44 -05:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -mp1"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2006-03-06 12:41:44 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2006-03-06 12:41:44 -05:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__mp1=yes
2013-12-18 20:53:23 -05:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__mp1=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__mp1" >&5
$as_echo "$pgac_cv_prog_CC_cflags__mp1" >&6; }
if test x"$pgac_cv_prog_CC_cflags__mp1" = x"yes"; then
CFLAGS="${CFLAGS} -mp1"
2006-03-06 12:41:44 -05:00
fi
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -mp1, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -mp1, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__mp1+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -mp1"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__mp1=yes
else
pgac_cv_prog_CXX_cxxflags__mp1=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__mp1" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__mp1" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__mp1" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -mp1"
fi
2013-12-18 20:53:23 -05:00
# Make sure strict aliasing is off (though this is said to be the default)
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__fno_strict_aliasing+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2003-06-11 02:56:07 -04:00
else
2013-12-18 20:53:23 -05:00
pgac_save_CFLAGS=$CFLAGS
2018-03-20 15:58:08 -04:00
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -fno-strict-aliasing"
2013-12-18 20:53:23 -05:00
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2003-06-11 02:56:07 -04:00
2013-12-18 20:53:23 -05:00
;
return 0;
}
2003-06-11 02:56:07 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fno_strict_aliasing=yes
2003-06-11 02:56:07 -04:00
else
2018-03-20 15:58:08 -04:00
pgac_cv_prog_CC_cflags__fno_strict_aliasing=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
2018-03-20 15:58:08 -04:00
CC="$pgac_save_CC"
2013-12-18 20:53:23 -05:00
fi
2018-03-20 15:58:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CC_cflags__fno_strict_aliasing" = x"yes"; then
CFLAGS="${CFLAGS} -fno-strict-aliasing"
2003-06-11 02:56:07 -04:00
fi
2008-02-17 11:36:43 -05:00
2018-03-20 15:58:08 -04:00
2018-03-20 18:41:15 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fno-strict-aliasing, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -fno-strict-aliasing, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing=yes
else
pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fno_strict_aliasing" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
fi
2007-10-23 17:38:16 -04:00
fi
2022-09-10 01:53:02 -04:00
# If the compiler knows how to hide symbols, add the switch needed for that to
# CFLAGS_SL_MODULE and define HAVE_VISIBILITY_ATTRIBUTE.
#
# This is done separately from the above because -fvisibility is supported by
# quite a few different compilers, making the required repetition bothersome.
#
# We might need to add a separate test to check if
# __attribute__((visibility("hidden"))) is supported, if we encounter a
# compiler that supports one of the supported variants of -fvisibility=hidden
# but uses a different syntax to mark a symbol as exported.
2025-09-11 05:55:29 -04:00
if test "$GCC" = yes; then
2022-09-10 01:53:02 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fvisibility=hidden, for CFLAGS_SL_MODULE" >&5
$as_echo_n "checking whether ${CC} supports -fvisibility=hidden, for CFLAGS_SL_MODULE... " >&6; }
if ${pgac_cv_prog_CC_cflags__fvisibility_hidden+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS_SL_MODULE} -fvisibility=hidden"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__fvisibility_hidden=yes
else
pgac_cv_prog_CC_cflags__fvisibility_hidden=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fvisibility_hidden" >&5
$as_echo "$pgac_cv_prog_CC_cflags__fvisibility_hidden" >&6; }
if test x"$pgac_cv_prog_CC_cflags__fvisibility_hidden" = x"yes"; then
CFLAGS_SL_MODULE="${CFLAGS_SL_MODULE} -fvisibility=hidden"
fi
# For C++ we additionally want -fvisibility-inlines-hidden
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fvisibility=hidden, for CXXFLAGS_SL_MODULE" >&5
$as_echo_n "checking whether ${CXX} supports -fvisibility=hidden, for CXXFLAGS_SL_MODULE... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fvisibility_hidden+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS_SL_MODULE} -fvisibility=hidden"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fvisibility_hidden=yes
else
pgac_cv_prog_CXX_cxxflags__fvisibility_hidden=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fvisibility_hidden" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fvisibility_hidden" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fvisibility_hidden" = x"yes"; then
CXXFLAGS_SL_MODULE="${CXXFLAGS_SL_MODULE} -fvisibility=hidden"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -fvisibility-inlines-hidden, for CXXFLAGS_SL_MODULE" >&5
$as_echo_n "checking whether ${CXX} supports -fvisibility-inlines-hidden, for CXXFLAGS_SL_MODULE... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS_SL_MODULE} -fvisibility-inlines-hidden"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden=yes
else
pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__fvisibility_inlines_hidden" = x"yes"; then
CXXFLAGS_SL_MODULE="${CXXFLAGS_SL_MODULE} -fvisibility-inlines-hidden"
fi
have_visibility_attribute=$pgac_cv_prog_CC_cflags__fvisibility_hidden
fi
if test "$have_visibility_attribute" = "yes"; then
$as_echo "#define HAVE_VISIBILITY_ATTRIBUTE 1" >>confdefs.h
fi
2007-10-23 17:38:16 -04:00
2020-09-06 21:28:16 -04:00
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
2022-07-17 20:49:51 -04:00
2021-11-18 14:50:13 -05:00
# Determine flags used to emit bitcode for JIT inlining.
# 1. We must duplicate any behaviour-changing compiler flags used above,
# to keep compatibility with the compiler used for normal Postgres code.
# 2. We don't bother to duplicate extra-warnings switches --- seeing a
# warning in the main build is enough.
# 3. But we must duplicate -Wno-warning flags, else we'll see those anyway.
2018-03-20 20:26:25 -04:00
if test "$with_llvm" = yes ; then
CLANGXX="$CLANG -xc++"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -fno-strict-aliasing, for BITCODE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -fno-strict-aliasing, for BITCODE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__fno_strict_aliasing+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${BITCODE_CFLAGS} -fno-strict-aliasing"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__fno_strict_aliasing=yes
else
pgac_cv_prog_CLANG_cflags__fno_strict_aliasing=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__fno_strict_aliasing" = x"yes"; then
BITCODE_CFLAGS="${BITCODE_CFLAGS} -fno-strict-aliasing"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANGXX} supports -fno-strict-aliasing, for BITCODE_CXXFLAGS" >&5
$as_echo_n "checking whether ${CLANGXX} supports -fno-strict-aliasing, for BITCODE_CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CLANGXX}
CXXFLAGS="${BITCODE_CXXFLAGS} -fno-strict-aliasing"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing=yes
else
pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing" >&5
$as_echo "$pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing" >&6; }
if test x"$pgac_cv_prog_CLANGXX_cxxflags__fno_strict_aliasing" = x"yes"; then
BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -fno-strict-aliasing"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -fwrapv, for BITCODE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -fwrapv, for BITCODE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__fwrapv+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${BITCODE_CFLAGS} -fwrapv"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__fwrapv=yes
else
pgac_cv_prog_CLANG_cflags__fwrapv=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__fwrapv" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__fwrapv" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__fwrapv" = x"yes"; then
BITCODE_CFLAGS="${BITCODE_CFLAGS} -fwrapv"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANGXX} supports -fwrapv, for BITCODE_CXXFLAGS" >&5
$as_echo_n "checking whether ${CLANGXX} supports -fwrapv, for BITCODE_CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CLANGXX_cxxflags__fwrapv+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CLANGXX}
CXXFLAGS="${BITCODE_CXXFLAGS} -fwrapv"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CLANGXX_cxxflags__fwrapv=yes
else
pgac_cv_prog_CLANGXX_cxxflags__fwrapv=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANGXX_cxxflags__fwrapv" >&5
$as_echo "$pgac_cv_prog_CLANGXX_cxxflags__fwrapv" >&6; }
if test x"$pgac_cv_prog_CLANGXX_cxxflags__fwrapv" = x"yes"; then
BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -fwrapv"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -fexcess-precision=standard, for BITCODE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -fexcess-precision=standard, for BITCODE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__fexcess_precision_standard+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${BITCODE_CFLAGS} -fexcess-precision=standard"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__fexcess_precision_standard=yes
else
pgac_cv_prog_CLANG_cflags__fexcess_precision_standard=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__fexcess_precision_standard" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__fexcess_precision_standard" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__fexcess_precision_standard" = x"yes"; then
BITCODE_CFLAGS="${BITCODE_CFLAGS} -fexcess-precision=standard"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANGXX} supports -fexcess-precision=standard, for BITCODE_CXXFLAGS" >&5
$as_echo_n "checking whether ${CLANGXX} supports -fexcess-precision=standard, for BITCODE_CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CLANGXX}
CXXFLAGS="${BITCODE_CXXFLAGS} -fexcess-precision=standard"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard=yes
else
pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" >&5
$as_echo "$pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" >&6; }
if test x"$pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" = x"yes"; then
BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -fexcess-precision=standard"
fi
2021-11-18 14:50:13 -05:00
jit: Use -mno-outline-atomics for bitcode on ARM.
If the executable's .o files were produced by a compiler (probably gcc)
not using -moutline-atomics, and the corresponding .bc files were
produced by clang using -moutline-atomics (probably by default), then
the generated bitcode functions would have the target attribute
"+outline-atomics", and could fail at runtime when inlined. If the
target ISA at bitcode generation time was armv8-a (the most conservative
aarch64 target, no LSE), then LLVM IR atomic instructions would generate
calls to functions in libgcc.a or libclang_rt.*.a that switch between
LL/SC and faster LSE instructions depending on a runtime AT_HWCAP check.
Since the corresponding .o files didn't need those functions, they
wouldn't have been included in the executable, and resolution would
fail.
At least Debian and Ubuntu are known to ship gcc and clang compilers
that target armv8-a but differ on the use of outline atomics by default.
Fix, by suppressing the outline atomics attribute in bitcode explicitly.
Inline LL/SC instructions will be generated for atomic operations in
bitcode built for armv8-a. Only configure scripts are adjusted for now,
because the meson build system doesn't generate bitcode yet.
This doesn't seem to be a new phenomenon, so real cases of functions
using atomics that are inlined by JIT must be rare in the wild given how
long it took for a bug report to arrive. The reported case could be
reduced to:
postgres=# set jit_inline_above_cost = 0;
SET
postgres=# set jit_above_cost = 0;
SET
postgres=# select pg_last_wal_receive_lsn();
WARNING: failed to resolve name __aarch64_swp4_acq_rel
FATAL: fatal llvm error: Program used external function
'__aarch64_swp4_acq_rel' which could not be resolved!
The change doesn't affect non-ARM systems or later target ISAs.
Back-patch to all supported releases.
Reported-by: Alexander Kozhemyakin <a.kozhemyakin@postgrespro.ru>
Discussion: https://postgr.es/m/18610-37bf303f904fede3%40postgresql.org
2024-11-21 20:53:21 -05:00
# Ideally bitcode should perhaps match $CC's use, or not, of outline atomic
# functions, but for now we err on the side of suppressing them in bitcode,
# because we can't assume they're available at runtime. This affects aarch64
# builds using the basic armv8-a ISA without LSE support.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -mno-outline-atomics, for BITCODE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -mno-outline-atomics, for BITCODE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CLANG}
CXXFLAGS="${BITCODE_CFLAGS} -mno-outline-atomics"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics=yes
else
pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" >&5
$as_echo "$pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" >&6; }
if test x"$pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" = x"yes"; then
BITCODE_CFLAGS="${BITCODE_CFLAGS} -mno-outline-atomics"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -mno-outline-atomics, for BITCODE_CXXFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -mno-outline-atomics, for BITCODE_CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CLANG}
CXXFLAGS="${BITCODE_CXXFLAGS} -mno-outline-atomics"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics=yes
else
pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" >&5
$as_echo "$pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" >&6; }
if test x"$pgac_cv_prog_CLANG_cxxflags__mno_outline_atomics" = x"yes"; then
BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -mno-outline-atomics"
fi
2021-11-18 14:50:13 -05:00
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=yes
else
pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__Wunused_command_line_argument" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
fi
if test -n "$NOT_THE_CFLAGS"; then
BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-unused-command-line-argument"
fi
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=yes
else
pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__Wcompound_token_split_by_macro" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcompound-token-split-by-macro"
fi
if test -n "$NOT_THE_CFLAGS"; then
BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-compound-token-split-by-macro"
fi
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -Wformat-truncation, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__Wformat_truncation+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__Wformat_truncation=yes
else
pgac_cv_prog_CLANG_cflags__Wformat_truncation=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__Wformat_truncation" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__Wformat_truncation" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wformat-truncation"
fi
if test -n "$NOT_THE_CFLAGS"; then
BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-format-truncation"
fi
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -Wstringop-truncation, for NOT_THE_CFLAGS... " >&6; }
if ${pgac_cv_prog_CLANG_cflags__Wstringop_truncation+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CLANG}
CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CLANG_cflags__Wstringop_truncation=yes
else
pgac_cv_prog_CLANG_cflags__Wstringop_truncation=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&5
$as_echo "$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" >&6; }
if test x"$pgac_cv_prog_CLANG_cflags__Wstringop_truncation" = x"yes"; then
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wstringop-truncation"
fi
if test -n "$NOT_THE_CFLAGS"; then
BITCODE_CFLAGS="$BITCODE_CFLAGS -Wno-stringop-truncation"
fi
2018-03-20 20:26:25 -04:00
fi
2013-12-18 20:53:23 -05:00
# supply -g if --enable-debug
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
2007-10-23 17:38:16 -04:00
fi
2018-03-20 18:41:15 -04:00
if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
CXXFLAGS="$CXXFLAGS -g"
fi
2013-12-18 20:53:23 -05:00
# enable code coverage if --enable-coverage
if test "$enable_coverage" = yes; then
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
2018-03-20 18:41:15 -04:00
CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
2013-12-18 20:53:23 -05:00
else
as_fn_error $? "--enable-coverage is supported only when using GCC" "$LINENO" 5
fi
2007-10-23 17:38:16 -04:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# enable profiling if --enable-profiling
if test "$enable_profiling" = yes && test "$ac_cv_prog_cc_g" = yes; then
if test "$GCC" = yes; then
2007-10-23 17:38:16 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define PROFILE_PID_DIR 1" >>confdefs.h
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
CFLAGS="$CFLAGS -pg $PLATFORM_PROFILE_FLAGS"
2018-03-20 18:41:15 -04:00
CXXFLAGS="$CXXFLAGS -pg $PLATFORM_PROFILE_FLAGS"
2013-12-18 20:53:23 -05:00
else
as_fn_error $? "--enable-profiling is supported only when using GCC" "$LINENO" 5
fi
2009-07-02 14:55:40 -04:00
fi
2024-12-03 12:44:43 -05:00
# On Solaris, we need these #defines to get POSIX-conforming versions
# of many interfaces (sigwait, getpwuid_r, shmdt, ...).
2021-07-14 20:23:47 -04:00
if test "$PORTNAME" = "solaris"; then
2024-12-03 20:21:23 -05:00
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
2021-07-14 20:23:47 -04:00
fi
2013-12-18 20:53:23 -05:00
# We already have this in Makefile.win32, but configure needs it too
if test "$PORTNAME" = "win32"; then
2020-03-25 09:23:25 -04:00
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
2013-12-18 20:53:23 -05:00
fi
2009-07-02 14:55:40 -04:00
2018-03-20 18:41:15 -04:00
# Now that we're done automatically adding stuff to C[XX]FLAGS, put back the
2015-01-14 11:08:13 -05:00
# user-specified flags (if any) at the end. This lets users override
# the automatic additions.
CFLAGS="$CFLAGS $user_CFLAGS"
2018-03-20 18:41:15 -04:00
CXXFLAGS="$CXXFLAGS $user_CXXFLAGS"
2018-03-20 20:26:25 -04:00
BITCODE_CFLAGS="$BITCODE_CFLAGS $user_BITCODE_CFLAGS"
BITCODE_CXXFLAGS="$BITCODE_CXXFLAGS $user_BITCODE_CXXFLAGS"
2019-10-21 12:32:35 -04:00
# The template file must set up CFLAGS_SL; we don't support user override
2018-03-20 20:26:25 -04:00
2015-01-14 11:08:13 -05:00
# Check if the compiler still works with the final flag settings
2018-03-20 18:41:15 -04:00
# (note, we're not checking that for CXX, which is optional)
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler still works" >&5
$as_echo_n "checking whether the C compiler still works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "cannot proceed" "$LINENO" 5
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
# Defend against gcc -ffast-math
if test "$GCC" = yes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifdef __FAST_MATH__
choke me
#endif
;
return 0;
}
2009-07-02 14:55:40 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "do not put -ffast-math in CFLAGS" "$LINENO" 5
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2009-07-02 14:55:40 -04:00
fi
Error out for clang on x86-32 without SSE2 support, no -fexcess-precision.
As clang currently doesn't support -fexcess-precision=standard,
compiling x86-32 code with SSE2 disabled, can lead to problems with
floating point overflow checks and the like.
This issue was noticed because clang, on at least some BSDs, defaults
to i386 compatibility, whereas it defaults to pentium4 on Linux. Our
forced usage of __builtin_isinf() lead to some overflow checks not
triggering when compiling for i386, e.g. when the result of the
calculation didn't overflow in 80bit registers, but did so in 64bit.
While we could just fall back to a non-builtin isinf, it seems likely
that the use of 80bit registers leads to other problems (which is why
we force the flag for GCC already). Therefore error out when
detecting clang in that situation.
Reported-By: Victor Wagner
Analyzed-By: Andrew Gierth and Andres Freund
Author: Andres Freund
Discussion: https://postgr.es/m/20180905005130.ewk4xcs5dgyzcy45@alap3.anarazel.de
Backpatch: 9.3-, all supported versions are affected
2018-09-13 17:18:43 -04:00
# Defend against clang being used on x86-32 without SSE2 enabled. As current
# versions of clang do not understand -fexcess-precision=standard, the use of
# x87 floating point operations leads to problems like isinf possibly returning
# false for a value that is infinite when converted from the 80bit register to
# the 8byte memory representation.
#
# Only perform the test if the compiler doesn't understand
# -fexcess-precision=standard, that way a potentially fixed compiler will work
# automatically.
if test "$pgac_cv_prog_CC_cflags__fexcess_precision_standard" = no; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#if defined(__clang__) && defined(__i386__) && !defined(__SSE2_MATH__)
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
as_fn_error $? "Compiling PostgreSQL with clang, on 32bit x86, requires SSE2 support. Use -msse2 or use gcc." "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
2013-12-18 20:53:23 -05:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
2011-12-10 15:35:41 -05:00
$as_echo_n "(cached) " >&6
else
2013-12-18 20:53:23 -05:00
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2011-12-10 15:35:41 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
2011-12-10 15:35:41 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_cpp "$LINENO"; then :
2011-12-10 15:35:41 -05:00
2013-12-18 20:53:23 -05:00
else
# Broken: fails on valid input.
continue
2011-12-10 15:35:41 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f conftest.err conftest.i conftest.$ac_ext
2011-12-10 15:35:41 -05:00
2013-12-18 20:53:23 -05:00
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2011-12-10 15:35:41 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
#include <ac_nonexistent.h>
2011-12-10 15:35:41 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
2011-12-10 15:35:41 -05:00
else
2013-12-18 20:53:23 -05:00
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
2011-12-10 15:35:41 -05:00
2013-12-18 20:53:23 -05:00
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
2011-12-10 15:35:41 -05:00
fi
2013-12-18 20:53:23 -05:00
done
ac_cv_prog_CPP=$CPP
2011-12-10 15:35:41 -05:00
fi
2013-12-18 20:53:23 -05:00
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
2011-12-10 15:35:41 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
2011-12-10 15:35:41 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_cpp "$LINENO"; then :
2011-12-10 15:35:41 -05:00
2013-12-18 20:53:23 -05:00
else
# Broken: fails on valid input.
continue
2011-12-10 15:35:41 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f conftest.err conftest.i conftest.$ac_ext
2011-12-10 15:35:41 -05:00
2013-12-18 20:53:23 -05:00
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-07-02 14:55:40 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
#include <ac_nonexistent.h>
2009-07-02 14:55:40 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
# Passes both tests.
ac_preproc_ok=:
break
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f conftest.err conftest.i conftest.$ac_ext
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2009-07-02 14:55:40 -04:00
2007-10-23 17:38:16 -04:00
2022-03-25 03:44:31 -04:00
cat >>confdefs.h <<_ACEOF
#define DLSUFFIX "$DLSUFFIX"
_ACEOF
2020-03-17 12:09:26 -04:00
#
# Set up pkg_config in case we need it below
#
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
2007-04-06 00:21:44 -04:00
2013-12-18 20:53:23 -05:00
#
# Automatic dependency tracking
#
2007-04-06 00:21:44 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-depend was given.
if test "${enable_depend+set}" = set; then :
enableval=$enable_depend;
case $enableval in
yes)
autodepend=yes
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-depend option" "$LINENO" 5
;;
esac
2007-04-06 00:21:44 -04:00
else
2013-12-18 20:53:23 -05:00
enable_depend=no
2007-04-06 00:21:44 -04:00
fi
2008-02-17 11:36:43 -05:00
2007-04-06 00:21:44 -04:00
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
#
# Enable assert checks
#
2007-04-06 00:21:44 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --enable-cassert was given.
if test "${enable_cassert+set}" = set; then :
enableval=$enable_cassert;
case $enableval in
yes)
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_ASSERT_CHECKING 1" >>confdefs.h
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --enable-cassert option" "$LINENO" 5
;;
esac
2008-02-17 11:36:43 -05:00
2007-04-06 00:21:44 -04:00
else
2013-12-18 20:53:23 -05:00
enable_cassert=no
2007-04-06 00:21:44 -04:00
fi
2008-02-17 11:36:43 -05:00
2007-04-06 00:21:44 -04:00
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
#
# Include directories
#
ac_save_IFS=$IFS
IFS="${IFS}${PATH_SEPARATOR}"
# SRCH_INC comes from the template file
for dir in $with_includes $SRCH_INC; do
if test -d "$dir"; then
INCLUDES="$INCLUDES -I$dir"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Include directory $dir does not exist." >&5
$as_echo "$as_me: WARNING: *** Include directory $dir does not exist." >&2;}
fi
done
IFS=$ac_save_IFS
2007-04-06 00:21:44 -04:00
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
#
# Library directories
#
ac_save_IFS=$IFS
IFS="${IFS}${PATH_SEPARATOR}"
# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
for dir in $LIBRARY_DIRS $SRCH_LIB; do
if test -d "$dir"; then
LIBDIRS="$LIBDIRS -L$dir"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Library directory $dir does not exist." >&5
$as_echo "$as_me: WARNING: *** Library directory $dir does not exist." >&2;}
fi
done
IFS=$ac_save_IFS
2017-03-23 15:25:34 -04:00
#
# ICU
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with ICU support" >&5
$as_echo_n "checking whether to build with ICU support... " >&6; }
# Check whether --with-icu was given.
if test "${with_icu+set}" = set; then :
withval=$with_icu;
case $withval in
yes)
$as_echo "#define USE_ICU 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-icu option" "$LINENO" 5
;;
esac
else
2023-04-18 16:20:11 -04:00
with_icu=yes
$as_echo "#define USE_ICU 1" >>confdefs.h
2017-03-23 15:25:34 -04:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_icu" >&5
$as_echo "$with_icu" >&6; }
if test "$with_icu" = yes; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for icu-uc icu-i18n" >&5
$as_echo_n "checking for icu-uc icu-i18n... " >&6; }
if test -n "$ICU_CFLAGS"; then
pkg_cv_ICU_CFLAGS="$ICU_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc icu-i18n\""; } >&5
($PKG_CONFIG --exists --print-errors "icu-uc icu-i18n") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ICU_CFLAGS=`$PKG_CONFIG --cflags "icu-uc icu-i18n" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$ICU_LIBS"; then
pkg_cv_ICU_LIBS="$ICU_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc icu-i18n\""; } >&5
($PKG_CONFIG --exists --print-errors "icu-uc icu-i18n") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ICU_LIBS=`$PKG_CONFIG --libs "icu-uc icu-i18n" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
ICU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "icu-uc icu-i18n" 2>&1`
else
ICU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "icu-uc icu-i18n" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$ICU_PKG_ERRORS" >&5
2024-08-20 14:24:00 -04:00
as_fn_error $? "Package requirements (icu-uc icu-i18n) were not met:
$ICU_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
2017-03-23 15:25:34 -04:00
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2024-08-20 14:24:00 -04:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
2017-03-23 15:25:34 -04:00
else
ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
ICU_LIBS=$pkg_cv_ICU_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
2013-12-18 20:53:23 -05:00
#
# Optionally build Tcl modules (PL/Tcl)
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with Tcl" >&5
$as_echo_n "checking whether to build with Tcl... " >&6; }
2010-02-12 21:34:16 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-tcl was given.
if test "${with_tcl+set}" = set; then :
withval=$with_tcl;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-tcl option" "$LINENO" 5
;;
esac
2010-02-12 21:34:16 -05:00
2013-12-18 20:53:23 -05:00
else
with_tcl=no
2010-02-12 21:34:16 -05:00
2001-09-07 15:52:54 -04:00
fi
2002-03-29 12:32:55 -05:00
2011-06-16 15:39:09 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcl" >&5
$as_echo "$with_tcl" >&6; }
2011-06-16 15:39:09 -04:00
2013-12-18 20:53:23 -05:00
# We see if the path to the Tcl/Tk configuration scripts is specified.
# This will override the use of tclsh to find the paths to search.
2011-06-16 15:39:09 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-tclconfig was given.
if test "${with_tclconfig+set}" = set; then :
withval=$with_tclconfig;
case $withval in
yes)
as_fn_error $? "argument required for --with-tclconfig option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-tclconfig option" "$LINENO" 5
;;
*)
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
;;
esac
2005-07-01 14:17:31 -04:00
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
#
# Optionally build Perl modules (PL/Perl)
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Perl modules" >&5
$as_echo_n "checking whether to build Perl modules... " >&6; }
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2003-04-24 17:16:45 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-perl was given.
if test "${with_perl+set}" = set; then :
withval=$with_perl;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-perl option" "$LINENO" 5
;;
esac
2003-04-24 17:16:45 -04:00
else
2013-12-18 20:53:23 -05:00
with_perl=no
2008-02-17 11:36:43 -05:00
2003-04-24 17:16:45 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_perl" >&5
$as_echo "$with_perl" >&6; }
2012-09-30 14:38:31 -04:00
2013-12-18 20:53:23 -05:00
#
# Optionally build Python modules (PL/Python)
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Python modules" >&5
$as_echo_n "checking whether to build Python modules... " >&6; }
2012-09-30 14:38:31 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-python was given.
if test "${with_python+set}" = set; then :
withval=$with_python;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-python option" "$LINENO" 5
;;
esac
2012-09-30 14:38:31 -04:00
else
2013-12-18 20:53:23 -05:00
with_python=no
2012-09-30 14:38:31 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_python" >&5
$as_echo "$with_python" >&6; }
2012-09-30 14:38:31 -04:00
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
2013-12-18 20:53:23 -05:00
#
# GSSAPI
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with GSSAPI support" >&5
$as_echo_n "checking whether to build with GSSAPI support... " >&6; }
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-gssapi was given.
if test "${with_gssapi+set}" = set; then :
withval=$with_gssapi;
case $withval in
yes)
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
2013-12-18 20:53:23 -05:00
$as_echo "#define ENABLE_GSS 1" >>confdefs.h
krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-gssapi option" "$LINENO" 5
;;
esac
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
else
2013-12-18 20:53:23 -05:00
with_gssapi=no
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_gssapi" >&5
$as_echo "$with_gssapi" >&6; }
Improve handling of ereport(ERROR) and elog(ERROR).
In commit 71450d7fd6c7cf7b3e38ac56e363bff6a681973c, we added code to inform
suitably-intelligent compilers that ereport() doesn't return if the elevel
is ERROR or higher. This patch extends that to elog(), and also fixes a
double-evaluation hazard that the previous commit created in ereport(),
as well as reducing the emitted code size.
The elog() improvement requires the compiler to support __VA_ARGS__, which
should be available in just about anything nowadays since it's required by
C99. But our minimum language baseline is still C89, so add a configure
test for that.
The previous commit assumed that ereport's elevel could be evaluated twice,
which isn't terribly safe --- there are already counterexamples in xlog.c.
On compilers that have __builtin_constant_p, we can use that to protect the
second test, since there's no possible optimization gain if the compiler
doesn't know the value of elevel. Otherwise, use a local variable inside
the macros to prevent double evaluation. The local-variable solution is
inferior because (a) it leads to useless code being emitted when elevel
isn't constant, and (b) it increases the optimization level needed for the
compiler to recognize that subsequent code is unreachable. But it seems
better than not teaching non-gcc compilers about unreachability at all.
Lastly, if the compiler has __builtin_unreachable(), we can use that
instead of abort(), resulting in a noticeable code savings since no
function call is actually emitted. However, it seems wise to do this only
in non-assert builds. In an assert build, continue to use abort(), so that
the behavior will be predictable and debuggable if the "impossible"
happens.
These changes involve making the ereport and elog macros emit do-while
statement blocks not just expressions, which forces small changes in
a few call sites.
Andres Freund, Tom Lane, Heikki Linnakangas
2013-01-13 18:39:20 -05:00
2013-12-18 20:53:23 -05:00
2012-05-14 23:06:48 -04:00
2018-03-05 14:42:11 -05:00
2013-12-18 20:53:23 -05:00
#
# Kerberos configuration parameters
#
2002-03-29 19:20:15 -05:00
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-krb-srvnam was given.
if test "${with_krb_srvnam+set}" = set; then :
withval=$with_krb_srvnam;
case $withval in
yes)
as_fn_error $? "argument required for --with-krb-srvnam option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-krb-srvnam option" "$LINENO" 5
;;
*)
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
;;
esac
2005-07-01 14:17:31 -04:00
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
with_krb_srvnam="postgres"
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
2018-03-05 14:42:11 -05:00
2002-03-29 19:20:15 -05:00
cat >>confdefs.h <<_ACEOF
2013-12-18 20:53:23 -05:00
#define PG_KRB_SRVNAM "$with_krb_srvnam"
2002-03-29 19:20:15 -05:00
_ACEOF
2002-02-22 23:17:47 -05:00
2013-12-18 20:53:23 -05:00
#
# PAM
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with PAM support" >&5
$as_echo_n "checking whether to build with PAM support... " >&6; }
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-pam was given.
if test "${with_pam+set}" = set; then :
withval=$with_pam;
case $withval in
yes)
$as_echo "#define USE_PAM 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-pam option" "$LINENO" 5
;;
esac
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
with_pam=no
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_pam" >&5
$as_echo "$with_pam" >&6; }
2009-07-02 14:55:40 -04:00
2016-04-08 13:51:54 -04:00
#
# BSD AUTH
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with BSD Authentication support" >&5
$as_echo_n "checking whether to build with BSD Authentication support... " >&6; }
# Check whether --with-bsd-auth was given.
if test "${with_bsd_auth+set}" = set; then :
withval=$with_bsd_auth;
case $withval in
yes)
$as_echo "#define USE_BSD_AUTH 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-bsd-auth option" "$LINENO" 5
;;
esac
else
with_bsd_auth=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_bsd_auth" >&5
$as_echo "$with_bsd_auth" >&6; }
2013-12-18 20:53:23 -05:00
#
# LDAP
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with LDAP support" >&5
$as_echo_n "checking whether to build with LDAP support... " >&6; }
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-ldap was given.
if test "${with_ldap+set}" = set; then :
withval=$with_ldap;
case $withval in
yes)
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_LDAP 1" >>confdefs.h
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-ldap option" "$LINENO" 5
;;
esac
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
else
with_ldap=no
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_ldap" >&5
$as_echo "$with_ldap" >&6; }
2009-07-02 14:55:40 -04:00
2018-03-03 01:29:51 -05:00
2013-12-18 20:53:23 -05:00
#
# Bonjour
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with Bonjour support" >&5
$as_echo_n "checking whether to build with Bonjour support... " >&6; }
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-bonjour was given.
if test "${with_bonjour+set}" = set; then :
withval=$with_bonjour;
case $withval in
yes)
$as_echo "#define USE_BONJOUR 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-bonjour option" "$LINENO" 5
;;
esac
2002-02-22 23:17:47 -05:00
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
with_bonjour=no
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_bonjour" >&5
$as_echo "$with_bonjour" >&6; }
2008-02-17 11:36:43 -05:00
2002-03-29 19:59:52 -05:00
2013-12-18 20:53:23 -05:00
#
# SELinux
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with SELinux support" >&5
$as_echo_n "checking whether to build with SELinux support... " >&6; }
2003-06-12 03:36:51 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-selinux was given.
if test "${with_selinux+set}" = set; then :
withval=$with_selinux;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-selinux option" "$LINENO" 5
;;
esac
2003-06-23 19:52:00 -04:00
else
2013-12-18 20:53:23 -05:00
with_selinux=no
2003-06-23 19:52:00 -04:00
2013-12-18 20:53:23 -05:00
fi
2003-06-23 19:52:00 -04:00
2004-08-31 00:08:33 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_selinux" >&5
$as_echo "$with_selinux" >&6; }
2004-08-31 00:08:33 -04:00
2015-11-17 06:46:17 -05:00
#
# Systemd
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with systemd support" >&5
$as_echo_n "checking whether to build with systemd support... " >&6; }
# Check whether --with-systemd was given.
if test "${with_systemd+set}" = set; then :
withval=$with_systemd;
case $withval in
yes)
$as_echo "#define USE_SYSTEMD 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-systemd option" "$LINENO" 5
;;
esac
else
with_systemd=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_systemd" >&5
$as_echo "$with_systemd" >&6; }
2013-12-18 20:53:23 -05:00
#
# Readline
#
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-readline was given.
if test "${with_readline+set}" = set; then :
withval=$with_readline;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-readline option" "$LINENO" 5
;;
esac
2003-06-23 19:52:00 -04:00
2013-12-18 20:53:23 -05:00
else
with_readline=yes
fi
2003-06-23 19:52:00 -04:00
2013-12-18 20:53:23 -05:00
# readline on MinGW has problems with backslashes in psql and other bugs.
# This is particularly a problem with non-US code pages.
# Therefore disable its use until we understand the cause. 2004-07-20
if test "$PORTNAME" = "win32"; then
if test "$with_readline" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Readline does not work on MinGW --- disabling" >&5
$as_echo "$as_me: WARNING: *** Readline does not work on MinGW --- disabling" >&2;}
with_readline=no
fi
2003-06-23 19:52:00 -04:00
fi
2020-01-02 15:02:21 -05:00
2013-12-18 20:53:23 -05:00
#
# Prefer libedit
#
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-libedit-preferred was given.
if test "${with_libedit_preferred+set}" = set; then :
withval=$with_libedit_preferred;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libedit-preferred option" "$LINENO" 5
;;
esac
2004-08-31 00:08:33 -04:00
else
2013-12-18 20:53:23 -05:00
with_libedit_preferred=no
2005-07-01 14:17:31 -04:00
fi
2008-02-17 11:36:43 -05:00
2005-07-01 14:17:31 -04:00
2025-03-18 14:40:05 -04:00
#
# liburing
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with liburing support" >&5
$as_echo_n "checking whether to build with liburing support... " >&6; }
# Check whether --with-liburing was given.
if test "${with_liburing+set}" = set; then :
withval=$with_liburing;
case $withval in
yes)
$as_echo "#define USE_LIBURING 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-liburing option" "$LINENO" 5
;;
esac
else
with_liburing=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_liburing" >&5
$as_echo "$with_liburing" >&6; }
if test "$with_liburing" = yes; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for liburing" >&5
$as_echo_n "checking for liburing... " >&6; }
if test -n "$LIBURING_CFLAGS"; then
pkg_cv_LIBURING_CFLAGS="$LIBURING_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liburing\""; } >&5
($PKG_CONFIG --exists --print-errors "liburing") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBURING_CFLAGS=`$PKG_CONFIG --cflags "liburing" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBURING_LIBS"; then
pkg_cv_LIBURING_LIBS="$LIBURING_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liburing\""; } >&5
($PKG_CONFIG --exists --print-errors "liburing") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBURING_LIBS=`$PKG_CONFIG --libs "liburing" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBURING_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liburing" 2>&1`
else
LIBURING_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liburing" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBURING_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (liburing) were not met:
$LIBURING_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBURING_CFLAGS
and LIBURING_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBURING_CFLAGS
and LIBURING_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LIBURING_CFLAGS=$pkg_cv_LIBURING_CFLAGS
LIBURING_LIBS=$pkg_cv_LIBURING_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
#
2014-05-27 19:42:08 -04:00
# UUID library
#
# There are at least three UUID libraries in common use: the FreeBSD/NetBSD
# library, the e2fsprogs libuuid (now part of util-linux-ng), and the OSSP
# UUID library. More than one of these might be present on a given platform,
# so we make the user say which one she wants.
2013-12-18 20:53:23 -05:00
#
2005-07-01 14:17:31 -04:00
2014-05-27 19:42:08 -04:00
# Check whether --with-uuid was given.
if test "${with_uuid+set}" = set; then :
withval=$with_uuid;
case $withval in
yes)
as_fn_error $? "argument required for --with-uuid option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-uuid option" "$LINENO" 5
;;
*)
;;
esac
fi
if test x"$with_uuid" = x"" ; then
with_uuid=no
fi
2013-12-18 20:53:23 -05:00
# Check whether --with-ossp-uuid was given.
if test "${with_ossp_uuid+set}" = set; then :
withval=$with_ossp_uuid;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-ossp-uuid option" "$LINENO" 5
;;
esac
2005-07-01 14:17:31 -04:00
else
2013-12-18 20:53:23 -05:00
with_ossp_uuid=no
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2014-05-27 19:42:08 -04:00
if test "$with_ossp_uuid" = yes ; then
with_uuid=ossp
fi
2021-01-22 21:33:04 -05:00
if test "$with_uuid" != no ; then
if test "$with_uuid" = bsd ; then
2014-05-27 19:42:08 -04:00
$as_echo "#define HAVE_UUID_BSD 1" >>confdefs.h
2021-01-22 21:33:04 -05:00
elif test "$with_uuid" = e2fs ; then
2014-05-27 19:42:08 -04:00
$as_echo "#define HAVE_UUID_E2FS 1" >>confdefs.h
2021-01-22 21:33:04 -05:00
elif test "$with_uuid" = ossp ; then
2014-05-27 19:42:08 -04:00
$as_echo "#define HAVE_UUID_OSSP 1" >>confdefs.h
2021-01-22 21:33:04 -05:00
else
as_fn_error $? "--with-uuid must specify one of bsd, e2fs, or ossp" "$LINENO" 5
fi
2014-05-27 19:42:08 -04:00
fi
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
#
# libcurl
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with libcurl support" >&5
$as_echo_n "checking whether to build with libcurl support... " >&6; }
# Check whether --with-libcurl was given.
if test "${with_libcurl+set}" = set; then :
withval=$with_libcurl;
case $withval in
yes)
$as_echo "#define USE_LIBCURL 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libcurl option" "$LINENO" 5
;;
esac
else
with_libcurl=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libcurl" >&5
$as_echo "$with_libcurl" >&6; }
if test "$with_libcurl" = yes ; then
# Check for libcurl 7.61.0 or higher (corresponding to RHEL8 and the ability
# to explicitly set TLS 1.3 ciphersuites).
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= 7.61.0" >&5
$as_echo_n "checking for libcurl >= 7.61.0... " >&6; }
if test -n "$LIBCURL_CFLAGS"; then
pkg_cv_LIBCURL_CFLAGS="$LIBCURL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= 7.61.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libcurl >= 7.61.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBCURL_CFLAGS=`$PKG_CONFIG --cflags "libcurl >= 7.61.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBCURL_LIBS"; then
pkg_cv_LIBCURL_LIBS="$LIBCURL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl >= 7.61.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libcurl >= 7.61.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBCURL_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.61.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBCURL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcurl >= 7.61.0" 2>&1`
else
LIBCURL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcurl >= 7.61.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBCURL_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libcurl >= 7.61.0) were not met:
$LIBCURL_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBCURL_CFLAGS
and LIBCURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBCURL_CFLAGS
and LIBCURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LIBCURL_CFLAGS=$pkg_cv_LIBCURL_CFLAGS
LIBCURL_LIBS=$pkg_cv_LIBCURL_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
# Curl's flags are kept separate from the standard CPPFLAGS/LDFLAGS. We use
# them only for libpq-oauth.
LIBCURL_CPPFLAGS=
LIBCURL_LDFLAGS=
# We only care about -I, -D, and -L switches. Note that -lcurl will be added
# to LIBCURL_LDLIBS by PGAC_CHECK_LIBCURL, below.
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
for pgac_option in $LIBCURL_CFLAGS; do
case $pgac_option in
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
-I*|-D*) LIBCURL_CPPFLAGS="$LIBCURL_CPPFLAGS $pgac_option";;
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
esac
done
for pgac_option in $LIBCURL_LIBS; do
case $pgac_option in
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
-L*) LIBCURL_LDFLAGS="$LIBCURL_LDFLAGS $pgac_option";;
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
esac
done
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
# OAuth requires python for testing
if test "$with_python" != yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** OAuth support tests require --with-python to run" >&5
$as_echo "$as_me: WARNING: *** OAuth support tests require --with-python to run" >&2;}
fi
fi
2025-04-07 16:51:49 -04:00
#
# libnuma
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with libnuma support" >&5
$as_echo_n "checking whether to build with libnuma support... " >&6; }
# Check whether --with-libnuma was given.
if test "${with_libnuma+set}" = set; then :
withval=$with_libnuma;
case $withval in
yes)
$as_echo "#define USE_LIBNUMA 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libnuma option" "$LINENO" 5
;;
esac
else
with_libnuma=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libnuma" >&5
$as_echo "$with_libnuma" >&6; }
if test "$with_libnuma" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for numa_available in -lnuma" >&5
$as_echo_n "checking for numa_available in -lnuma... " >&6; }
if ${ac_cv_lib_numa_numa_available+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnuma $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char numa_available ();
int
main ()
{
return numa_available ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_numa_numa_available=yes
else
ac_cv_lib_numa_numa_available=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_numa_numa_available" >&5
$as_echo "$ac_cv_lib_numa_numa_available" >&6; }
if test "x$ac_cv_lib_numa_numa_available" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNUMA 1
_ACEOF
LIBS="-lnuma $LIBS"
else
as_fn_error $? "library 'libnuma' is required for NUMA support" "$LINENO" 5
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for numa" >&5
$as_echo_n "checking for numa... " >&6; }
if test -n "$LIBNUMA_CFLAGS"; then
pkg_cv_LIBNUMA_CFLAGS="$LIBNUMA_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"numa\""; } >&5
($PKG_CONFIG --exists --print-errors "numa") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNUMA_CFLAGS=`$PKG_CONFIG --cflags "numa" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBNUMA_LIBS"; then
pkg_cv_LIBNUMA_LIBS="$LIBNUMA_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"numa\""; } >&5
($PKG_CONFIG --exists --print-errors "numa") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNUMA_LIBS=`$PKG_CONFIG --libs "numa" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBNUMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "numa" 2>&1`
else
LIBNUMA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "numa" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBNUMA_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (numa) were not met:
$LIBNUMA_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBNUMA_CFLAGS
and LIBNUMA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBNUMA_CFLAGS
and LIBNUMA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LIBNUMA_CFLAGS=$pkg_cv_LIBNUMA_CFLAGS
LIBNUMA_LIBS=$pkg_cv_LIBNUMA_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
2013-12-18 20:53:23 -05:00
#
# XML
#
2020-03-17 12:09:26 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with XML support" >&5
$as_echo_n "checking whether to build with XML support... " >&6; }
2004-08-31 00:08:33 -04:00
2004-09-02 11:39:56 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-libxml was given.
if test "${with_libxml+set}" = set; then :
withval=$with_libxml;
case $withval in
yes)
2004-08-31 00:08:33 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_LIBXML 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libxml option" "$LINENO" 5
;;
esac
2004-08-31 00:08:33 -04:00
2003-06-23 19:52:00 -04:00
else
2013-12-18 20:53:23 -05:00
with_libxml=no
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2020-03-17 12:09:26 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libxml" >&5
$as_echo "$with_libxml" >&6; }
2013-12-18 20:53:23 -05:00
if test "$with_libxml" = yes ; then
2020-03-17 12:09:26 -04:00
# Check pkg-config, then xml2-config. But for backwards compatibility,
# setting XML2_CONFIG overrides pkg-config.
have_libxml2_pkg_config=no
if test -z "$XML2_CONFIG" -a -n "$PKG_CONFIG"; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.23" >&5
$as_echo_n "checking for libxml-2.0 >= 2.6.23... " >&6; }
if test -n "$XML2_CFLAGS"; then
pkg_cv_XML2_CFLAGS="$XML2_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.23\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.23") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.23" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$XML2_LIBS"; then
pkg_cv_XML2_LIBS="$XML2_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.23\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.23") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_XML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.23" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
XML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.23" 2>&1`
else
XML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.23" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$XML2_PKG_ERRORS" >&5
# do nothing
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
# do nothing
else
XML2_CFLAGS=$pkg_cv_XML2_CFLAGS
XML2_LIBS=$pkg_cv_XML2_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_libxml2_pkg_config=yes
fi
fi
if test "$have_libxml2_pkg_config" = no ; then
if test -z "$XML2_CONFIG"; then
2013-12-18 20:53:23 -05:00
for ac_prog in xml2-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_XML2_CONFIG+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
2005-07-01 14:17:31 -04:00
else
2017-07-31 13:02:49 -04:00
case $XML2_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2013-12-18 20:53:23 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2005-07-01 14:17:31 -04:00
2017-07-31 13:02:49 -04:00
;;
esac
2004-08-31 00:08:33 -04:00
fi
2017-07-31 13:02:49 -04:00
XML2_CONFIG=$ac_cv_path_XML2_CONFIG
2013-12-18 20:53:23 -05:00
if test -n "$XML2_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5
$as_echo "$XML2_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2003-06-23 19:52:00 -04:00
fi
2013-12-18 20:53:23 -05:00
test -n "$XML2_CONFIG" && break
done
2003-06-23 19:52:00 -04:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of XML2_CONFIG in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML2_CONFIG" >&5
$as_echo_n "checking for XML2_CONFIG... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5
$as_echo "$XML2_CONFIG" >&6; }
fi
2019-01-18 02:29:42 -05:00
if test -n "$XML2_CONFIG"; then
2020-03-17 12:09:26 -04:00
XML2_CFLAGS=`$XML2_CONFIG --cflags`
XML2_LIBS=`$XML2_CONFIG --libs`
fi
2013-12-18 20:53:23 -05:00
fi
2020-03-17 12:09:26 -04:00
# Note the user could also set XML2_CFLAGS/XML2_LIBS directly
for pgac_option in $XML2_CFLAGS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-I*|-D*) INCLUDES="$INCLUDES $pgac_option";;
2020-03-17 12:09:26 -04:00
esac
done
for pgac_option in $XML2_LIBS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-L*) LIBDIRS="$LIBDIRS $pgac_option";;
2020-03-17 12:09:26 -04:00
esac
done
2003-07-23 19:30:41 -04:00
fi
2013-12-18 20:53:23 -05:00
#
# XSLT
#
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-libxslt was given.
if test "${with_libxslt+set}" = set; then :
withval=$with_libxslt;
case $withval in
yes)
$as_echo "#define USE_LIBXSLT 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-libxslt option" "$LINENO" 5
;;
esac
2004-08-31 00:08:33 -04:00
else
2013-12-18 20:53:23 -05:00
with_libxslt=no
2005-07-01 14:17:31 -04:00
2003-07-23 19:30:41 -04:00
fi
2008-02-17 11:36:43 -05:00
2003-07-23 19:30:41 -04:00
2003-04-01 19:49:28 -05:00
2013-12-18 20:53:23 -05:00
#
# tzdata
#
2003-04-01 19:49:28 -05:00
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
# Check whether --with-system-tzdata was given.
if test "${with_system_tzdata+set}" = set; then :
withval=$with_system_tzdata;
case $withval in
yes)
as_fn_error $? "argument required for --with-system-tzdata option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-system-tzdata option" "$LINENO" 5
;;
*)
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
;;
esac
2005-07-01 14:17:31 -04:00
2003-04-01 19:49:28 -05:00
fi
2008-02-17 11:36:43 -05:00
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
#
# Zlib
#
2003-04-01 19:49:28 -05:00
2013-12-18 20:53:23 -05:00
# Check whether --with-zlib was given.
if test "${with_zlib+set}" = set; then :
withval=$with_zlib;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-zlib option" "$LINENO" 5
;;
esac
else
with_zlib=yes
2002-02-22 23:17:47 -05:00
fi
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
#
# LZ4
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with LZ4 support" >&5
$as_echo_n "checking whether to build with LZ4 support... " >&6; }
# Check whether --with-lz4 was given.
if test "${with_lz4+set}" = set; then :
withval=$with_lz4;
case $withval in
yes)
$as_echo "#define USE_LZ4 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-lz4 option" "$LINENO" 5
;;
esac
else
with_lz4=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lz4" >&5
$as_echo "$with_lz4" >&6; }
if test "$with_lz4" = yes; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblz4" >&5
$as_echo_n "checking for liblz4... " >&6; }
if test -n "$LZ4_CFLAGS"; then
pkg_cv_LZ4_CFLAGS="$LZ4_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblz4\""; } >&5
($PKG_CONFIG --exists --print-errors "liblz4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LZ4_CFLAGS=`$PKG_CONFIG --cflags "liblz4" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LZ4_LIBS"; then
pkg_cv_LZ4_LIBS="$LZ4_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblz4\""; } >&5
($PKG_CONFIG --exists --print-errors "liblz4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LZ4_LIBS=`$PKG_CONFIG --libs "liblz4" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LZ4_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liblz4" 2>&1`
else
LZ4_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liblz4" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LZ4_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (liblz4) were not met:
$LZ4_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LZ4_CFLAGS
and LZ4_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LZ4_CFLAGS
and LZ4_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LZ4_CFLAGS=$pkg_cv_LZ4_CFLAGS
LZ4_LIBS=$pkg_cv_LZ4_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
2021-03-21 17:20:17 -04:00
# We only care about -I, -D, and -L switches;
# note that -llz4 will be added by AC_CHECK_LIB below.
for pgac_option in $LZ4_CFLAGS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-I*|-D*) INCLUDES="$INCLUDES $pgac_option";;
2021-03-21 17:20:17 -04:00
esac
done
for pgac_option in $LZ4_LIBS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-L*) LIBDIRS="$LIBDIRS $pgac_option";;
2021-03-21 17:20:17 -04:00
esac
done
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
fi
2022-02-18 13:40:31 -05:00
#
# ZSTD
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with ZSTD support" >&5
$as_echo_n "checking whether to build with ZSTD support... " >&6; }
# Check whether --with-zstd was given.
if test "${with_zstd+set}" = set; then :
withval=$with_zstd;
case $withval in
yes)
$as_echo "#define USE_ZSTD 1" >>confdefs.h
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-zstd option" "$LINENO" 5
;;
esac
else
with_zstd=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_zstd" >&5
$as_echo "$with_zstd" >&6; }
if test "$with_zstd" = yes; then
pkg_failed=no
2022-04-01 11:05:52 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd >= 1.4.0" >&5
$as_echo_n "checking for libzstd >= 1.4.0... " >&6; }
2022-02-18 13:40:31 -05:00
if test -n "$ZSTD_CFLAGS"; then
pkg_cv_ZSTD_CFLAGS="$ZSTD_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
2022-04-01 11:05:52 -04:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd >= 1.4.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libzstd >= 1.4.0") 2>&5
2022-02-18 13:40:31 -05:00
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
2022-04-01 11:05:52 -04:00
pkg_cv_ZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd >= 1.4.0" 2>/dev/null`
2022-02-18 13:40:31 -05:00
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$ZSTD_LIBS"; then
pkg_cv_ZSTD_LIBS="$ZSTD_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
2022-04-01 11:05:52 -04:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd >= 1.4.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libzstd >= 1.4.0") 2>&5
2022-02-18 13:40:31 -05:00
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
2022-04-01 11:05:52 -04:00
pkg_cv_ZSTD_LIBS=`$PKG_CONFIG --libs "libzstd >= 1.4.0" 2>/dev/null`
2022-02-18 13:40:31 -05:00
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
2022-04-01 11:05:52 -04:00
ZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd >= 1.4.0" 2>&1`
2022-02-18 13:40:31 -05:00
else
2022-04-01 11:05:52 -04:00
ZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd >= 1.4.0" 2>&1`
2022-02-18 13:40:31 -05:00
fi
# Put the nasty error message in config.log where it belongs
echo "$ZSTD_PKG_ERRORS" >&5
2022-04-01 11:05:52 -04:00
as_fn_error $? "Package requirements (libzstd >= 1.4.0) were not met:
2022-02-18 13:40:31 -05:00
$ZSTD_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ZSTD_CFLAGS
and ZSTD_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables ZSTD_CFLAGS
and ZSTD_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS
ZSTD_LIBS=$pkg_cv_ZSTD_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
# We only care about -I, -D, and -L switches;
# note that -lzstd will be added by AC_CHECK_LIB below.
for pgac_option in $ZSTD_CFLAGS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-I*|-D*) INCLUDES="$INCLUDES $pgac_option";;
2022-02-18 13:40:31 -05:00
esac
done
for pgac_option in $ZSTD_LIBS; do
case $pgac_option in
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
-L*) LIBDIRS="$LIBDIRS $pgac_option";;
2022-02-18 13:40:31 -05:00
esac
done
fi
2013-12-18 20:53:23 -05:00
#
# Assignments
#
2009-12-31 14:41:37 -05:00
2013-12-18 20:53:23 -05:00
CPPFLAGS="$CPPFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS $LIBDIRS"
2009-12-31 14:41:37 -05:00
2013-12-18 20:53:23 -05:00
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
2010-05-25 13:28:20 -04:00
fi
2013-12-18 20:53:23 -05:00
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
$as_echo "$STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2010-05-25 13:28:20 -04:00
2013-12-18 20:53:23 -05:00
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
2011-02-08 16:04:18 -05:00
$as_echo_n "(cached) " >&6
else
2013-12-18 20:53:23 -05:00
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
2011-02-08 16:04:18 -05:00
else
2013-12-18 20:53:23 -05:00
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2011-02-08 16:04:18 -05:00
2013-12-18 20:53:23 -05:00
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
$as_echo "$ac_ct_STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2011-02-08 16:04:18 -05:00
2013-12-18 20:53:23 -05:00
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
2011-02-08 16:04:18 -05:00
esac
2013-12-18 20:53:23 -05:00
STRIP=$ac_ct_STRIP
fi
2011-02-08 16:04:18 -05:00
else
2013-12-18 20:53:23 -05:00
STRIP="$ac_cv_prog_STRIP"
2011-02-08 16:04:18 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is possible to strip libraries" >&5
$as_echo_n "checking whether it is possible to strip libraries... " >&6; }
if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then
2023-04-20 18:12:32 -04:00
STRIP_STATIC_LIB="$STRIP --strip-unneeded"
2013-12-18 20:53:23 -05:00
STRIP_SHARED_LIB="$STRIP --strip-unneeded"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
case $host_os in
darwin*)
STRIP="$STRIP -x"
STRIP_STATIC_LIB=$STRIP
STRIP_SHARED_LIB=$STRIP
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
;;
*)
STRIP_STATIC_LIB=:
STRIP_SHARED_LIB=:
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
esac
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2011-02-08 16:04:18 -05:00
fi
fi
2013-12-18 20:53:23 -05:00
AR=$ac_cv_prog_AR
if test -n "$AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
$as_echo "$AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2011-02-08 16:04:18 -05:00
fi
fi
2013-12-18 20:53:23 -05:00
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_AR+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
else
2013-12-18 20:53:23 -05:00
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
$as_echo "$ac_ct_AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
if test "x$ac_ct_AR" = x; then
AR="ar"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
2009-07-02 14:55:40 -04:00
esac
2013-12-18 20:53:23 -05:00
AR=$ac_ct_AR
fi
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
AR="$ac_cv_prog_AR"
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
if test "$PORTNAME" = "win32"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_WINDRES+:} false; then :
$as_echo_n "(cached) " >&6
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
if test -n "$WINDRES"; then
ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2009-07-02 14:55:40 -04:00
2002-04-10 18:47:09 -04:00
fi
fi
2013-12-18 20:53:23 -05:00
WINDRES=$ac_cv_prog_WINDRES
if test -n "$WINDRES"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5
$as_echo "$WINDRES" >&6; }
2002-04-10 18:47:09 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2002-04-10 18:47:09 -04:00
fi
2013-12-18 20:53:23 -05:00
fi
if test -z "$ac_cv_prog_WINDRES"; then
ac_ct_WINDRES=$WINDRES
# Extract the first word of "windres", so it can be a program name with args.
set dummy windres; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_WINDRES+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2001-12-20 16:23:05 -05:00
else
2013-12-18 20:53:23 -05:00
if test -n "$ac_ct_WINDRES"; then
ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_WINDRES="windres"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2004-08-31 00:08:33 -04:00
2013-12-18 20:53:23 -05:00
fi
fi
ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES
if test -n "$ac_ct_WINDRES"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WINDRES" >&5
$as_echo "$ac_ct_WINDRES" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_WINDRES" = x; then
WINDRES="windres"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
WINDRES=$ac_ct_WINDRES
fi
2001-12-20 16:23:05 -05:00
else
2013-12-18 20:53:23 -05:00
WINDRES="$ac_cv_prog_WINDRES"
fi
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
2005-07-01 14:17:31 -04:00
else
2013-12-18 20:53:23 -05:00
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in #((
./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
done
IFS=$as_save_IFS
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
rm -rf conftest.one conftest.two conftest.dir
2008-02-17 11:36:43 -05:00
2004-09-02 11:39:56 -04:00
fi
2013-12-18 20:53:23 -05:00
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
2001-12-20 16:23:05 -05:00
2013-12-18 20:53:23 -05:00
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# When Autoconf chooses install-sh as install program it tries to generate
2017-02-06 04:33:58 -05:00
# a relative path to it in each makefile where it substitutes it. This clashes
2013-12-18 20:53:23 -05:00
# with our Makefile.global concept. This workaround helps.
case $INSTALL in
*install-sh*) install_bin='';;
*) install_bin=$INSTALL;;
esac
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$TAR"; then
for ac_prog in tar
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_TAR+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2005-07-01 14:17:31 -04:00
else
2013-12-18 20:53:23 -05:00
case $TAR in
[\\/]* | ?:[\\/]*)
ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
fi
TAR=$ac_cv_path_TAR
if test -n "$TAR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
$as_echo "$TAR" >&6; }
2005-07-01 14:17:31 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2005-07-01 14:17:31 -04:00
2000-05-24 10:58:21 -04:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
test -n "$TAR" && break
done
else
# Report the value of TAR in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TAR" >&5
$as_echo_n "checking for TAR... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
$as_echo "$TAR" >&6; }
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
$as_echo "no, using $LN_S" >&6; }
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
if ${ac_cv_path_mkdir+:} false; then :
$as_echo_n "(cached) " >&6
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
'mkdir (fileutils) '4.1*)
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
break 3;;
esac
done
done
done
IFS=$as_save_IFS
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
test -d ./--version && rmdir ./--version
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
# As a last resort, use the slow shell script. Don't cache a
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
MKDIR_P="$ac_install_sh -d"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# When Autoconf chooses install-sh as mkdir -p program it tries to generate
2017-02-06 04:33:58 -05:00
# a relative path to it in each makefile where it substitutes it. This clashes
2013-12-18 20:53:23 -05:00
# with our Makefile.global concept. This workaround helps.
case $MKDIR_P in
*install-sh*) MKDIR_P='\${SHELL} \${top_srcdir}/config/install-sh -c -d';;
2008-02-17 11:36:43 -05:00
esac
2005-07-01 14:17:31 -04:00
2025-12-08 20:39:08 -05:00
# Extract the first word of "nm", so it can be a program name with args.
set dummy nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $NM in
[\\/]* | ?:[\\/]*)
ac_cv_path_NM="$NM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_NM="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
NM=$ac_cv_path_NM
if test -n "$NM"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
$as_echo "$NM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$BISON"; then
for ac_prog in bison
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_BISON+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BISON in
[\\/]* | ?:[\\/]*)
ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
fi
BISON=$ac_cv_path_BISON
if test -n "$BISON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
$as_echo "$BISON" >&6; }
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
test -n "$BISON" && break
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of BISON in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BISON" >&5
$as_echo_n "checking for BISON... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
$as_echo "$BISON" >&6; }
2005-07-01 14:17:31 -04:00
fi
2008-02-17 11:36:43 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
2013-12-18 20:53:23 -05:00
if test "$BISON"; then
pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
{ $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_bison_version" >&5
$as_echo "$as_me: using $pgac_bison_version" >&6;}
2022-09-06 00:41:58 -04:00
if echo "$pgac_bison_version" | $AWK '{ if ($4 < 2.3) exit 0; else exit 1;}'
2013-12-18 20:53:23 -05:00
then
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
as_fn_error $? "
2013-12-18 20:53:23 -05:00
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
*** Bison version 2.3 or later is required, but this is $pgac_bison_version." "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2014-06-03 22:36:35 -04:00
# Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
# of the now preferred %name-prefix "base_yy", but the latter
# doesn't work with Bison 2.3 or less. So for now we silence the
# deprecation warnings.
if echo "$pgac_bison_version" | $AWK '{ if ($4 >= 3) exit 0; else exit 1;}'
then
BISONFLAGS="$BISONFLAGS -Wno-deprecated"
fi
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
if test -z "$BISON"; then
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
as_fn_error $? "bison not found" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2000-05-24 10:58:21 -04:00
2025-01-17 02:35:52 -05:00
if test -z "$FLEX"; then
for ac_prog in flex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_FLEX+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2025-01-17 02:35:52 -05:00
case $FLEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2025-01-17 02:35:52 -05:00
IFS=$as_save_IFS
;;
esac
2005-07-01 14:17:31 -04:00
fi
2025-01-17 02:35:52 -05:00
FLEX=$ac_cv_path_FLEX
if test -n "$FLEX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
$as_echo "$FLEX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2008-02-17 11:36:43 -05:00
2025-01-17 02:35:52 -05:00
test -n "$FLEX" && break
done
else
# Report the value of FLEX in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FLEX" >&5
$as_echo_n "checking for FLEX... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
$as_echo "$FLEX" >&6; }
2002-03-29 12:32:55 -05:00
fi
2025-01-17 02:35:52 -05:00
if test -z "$FLEX"; then
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
as_fn_error $? "flex not found" "$LINENO" 5
2002-03-29 19:20:15 -05:00
fi
2001-02-17 23:39:42 -05:00
2025-01-17 02:35:52 -05:00
pgac_flex_version=`$FLEX --version 2>/dev/null`
{ $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_flex_version" >&5
$as_echo "$as_me: using $pgac_flex_version" >&6;}
2001-02-17 23:39:42 -05:00
2007-07-12 10:10:39 -04:00
2013-12-18 20:53:23 -05:00
if test -z "$PERL"; then
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
for ac_prog in perl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PERL+:} false; then :
$as_echo_n "(cached) " >&6
2007-07-12 10:10:39 -04:00
else
2013-12-18 20:53:23 -05:00
case $PERL in
[\\/]* | ?:[\\/]*)
ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2007-07-12 10:10:39 -04:00
2013-12-18 20:53:23 -05:00
;;
esac
2007-07-12 10:10:39 -04:00
fi
2013-12-18 20:53:23 -05:00
PERL=$ac_cv_path_PERL
if test -n "$PERL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
$as_echo "$PERL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2002-03-29 12:32:55 -05:00
fi
2002-03-29 19:20:15 -05:00
2012-01-01 22:39:59 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
test -n "$PERL" && break
done
else
# Report the value of PERL in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PERL" >&5
$as_echo_n "checking for PERL... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
$as_echo "$PERL" >&6; }
2013-12-18 20:53:23 -05:00
fi
2012-01-01 22:39:59 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
2013-12-18 20:53:23 -05:00
if test "$PERL"; then
pgac_perl_version=`$PERL -v 2>/dev/null | sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: using perl $pgac_perl_version" >&5
$as_echo "$as_me: using perl $pgac_perl_version" >&6;}
if echo "$pgac_perl_version" | sed 's/[.a-z_]/ /g' | \
2022-09-13 22:58:13 -04:00
$AWK '{ if ($1 == 5 && ($2 >= 14)) exit 1; else exit 0;}'
2013-12-18 20:53:23 -05:00
then
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
as_fn_error $? "
2013-12-18 20:53:23 -05:00
*** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
*** Perl version 5.14 or later is required, but this is $pgac_perl_version." "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2012-01-01 22:39:59 -05:00
fi
2013-12-18 20:53:23 -05:00
if test -z "$PERL"; then
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 08:51:52 -05:00
as_fn_error $? "Perl not found" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2012-01-01 22:39:59 -05:00
2013-12-18 20:53:23 -05:00
if test "$with_perl" = yes; then
if test -z "$PERL"; then
as_fn_error $? "Perl not found" "$LINENO" 5
fi
2012-01-01 22:39:59 -05:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl archlibexp" >&5
$as_echo_n "checking for Perl archlibexp... " >&6; }
perl_archlibexp=`$PERL -MConfig -e 'print $Config{archlibexp}'`
test "$PORTNAME" = "win32" && perl_archlibexp=`echo $perl_archlibexp | sed 's,\\\\,/,g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_archlibexp" >&5
$as_echo "$perl_archlibexp" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl privlibexp" >&5
$as_echo_n "checking for Perl privlibexp... " >&6; }
perl_privlibexp=`$PERL -MConfig -e 'print $Config{privlibexp}'`
test "$PORTNAME" = "win32" && perl_privlibexp=`echo $perl_privlibexp | sed 's,\\\\,/,g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_privlibexp" >&5
$as_echo "$perl_privlibexp" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl useshrplib" >&5
$as_echo_n "checking for Perl useshrplib... " >&6; }
perl_useshrplib=`$PERL -MConfig -e 'print $Config{useshrplib}'`
test "$PORTNAME" = "win32" && perl_useshrplib=`echo $perl_useshrplib | sed 's,\\\\,/,g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_useshrplib" >&5
$as_echo "$perl_useshrplib" >&6; }
Move interpreter shared library detection to configure
For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of
libperl, libpython, and libtcl, respectively. Previously, this was
checked in the makefiles, skipping the PL build with a warning if no
shared library was available. Now this is checked in configure, with an
error if no shared library is available.
The previous situation arose because in the olden days, the configure
options --with-perl, --with-python, and --with-tcl controlled whether
frontend interfaces for those languages would be built. The procedural
languages were added later, and shared libraries were often not
available in the beginning. So it was decided skip the builds of the
procedural languages in those cases. The frontend interfaces have since
been removed from the tree, and shared libraries are now available most
of the time, so that setup makes much less sense now.
Also, the new setup allows contrib modules and pgxs users to rely on the
respective PLs being available based on configure flags.
2015-05-01 21:38:21 -04:00
if test "$perl_useshrplib" != yes && test "$perl_useshrplib" != true; then
as_fn_error $? "cannot build PL/Perl because libperl is not a shared library
You might have to rebuild your Perl installation. Refer to the
documentation for details. Use --without-perl to disable building
PL/Perl." "$LINENO" 5
fi
2018-09-25 13:23:29 -04:00
# On most platforms, archlibexp is also where the Perl include files live ...
Still further rethinking of build changes for macOS Mojave.
To avoid the sorts of problems complained of by Jakob Egger, it'd be
best if configure didn't emit any references to the sysroot path at all.
In the case of PL/Tcl, we can do that just by keeping our hands off the
TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to
substitute -iwithsysroot for -I in the compile commands, which is easily
handled if we change to using a configure output variable that includes
the switch not only the directory name. Since PL/Tcl and PL/Python
already do it like that, this seems like good consistency cleanup anyway.
Hence, this replaces the advice given to Perl-related extensions in commit
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should
just write "$(perl_includespec)". (The old way continues to work, but not
on recent macOS.)
It's still the case that configure needs to be aware of the sysroot
path internally, but that's cleaner than what we had before.
As before, back-patch to all supported versions.
Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
2018-10-18 14:55:23 -04:00
perl_includespec="-I$perl_archlibexp/CORE"
# ... but on newer macOS versions, we must use -iwithsysroot to look
# under $PG_SYSROOT
if test \! -f "$perl_archlibexp/CORE/perl.h" ; then
2018-10-16 16:27:15 -04:00
if test -f "$PG_SYSROOT$perl_archlibexp/CORE/perl.h" ; then
Still further rethinking of build changes for macOS Mojave.
To avoid the sorts of problems complained of by Jakob Egger, it'd be
best if configure didn't emit any references to the sysroot path at all.
In the case of PL/Tcl, we can do that just by keeping our hands off the
TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to
substitute -iwithsysroot for -I in the compile commands, which is easily
handled if we change to using a configure output variable that includes
the switch not only the directory name. Since PL/Tcl and PL/Python
already do it like that, this seems like good consistency cleanup anyway.
Hence, this replaces the advice given to Perl-related extensions in commit
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should
just write "$(perl_includespec)". (The old way continues to work, but not
on recent macOS.)
It's still the case that configure needs to be aware of the sysroot
path internally, but that's cleaner than what we had before.
As before, back-patch to all supported versions.
Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
2018-10-18 14:55:23 -04:00
perl_includespec="-iwithsysroot $perl_archlibexp/CORE"
2018-09-25 13:23:29 -04:00
fi
fi
2012-01-01 22:39:59 -05:00
PL/Perl portability fix: absorb relevant -D switches from Perl.
The Perl documentation is very clear that stuff calling libperl should
be built with the compiler switches shown by Perl's $Config{ccflags}.
We'd been ignoring that up to now, and mostly getting away with it,
but recent Perl versions contain ABI compatibility cross-checks that
fail on some builds because of this omission. In particular the
sizeof(PerlInterpreter) can come out different due to some fields being
added or removed; which means we have a live ABI hazard that we'd better
fix rather than continuing to sweep it under the rug.
However, it still seems like a bad idea to just absorb $Config{ccflags}
verbatim. In some environments Perl was built with a different compiler
that doesn't even use the same switch syntax. -D switch syntax is pretty
universal though, and absorbing Perl's -D switches really ought to be
enough to fix the problem.
Furthermore, Perl likes to inject stuff like -D_LARGEFILE_SOURCE and
-D_FILE_OFFSET_BITS=64 into $Config{ccflags}, which affect libc ABIs on
platforms where they're relevant. Adopting those seems dangerous too.
It's unclear whether a build wherein Perl and Postgres have different ideas
of sizeof(off_t) etc would work, or whether anyone would care about making
it work. But it's dead certain that having different stdio ABIs in
core Postgres and PL/Perl will not work; we've seen that movie before.
Therefore, let's also ignore -D switches for symbols beginning with
underscore. The symbols that we actually need to import should be the ones
mentioned in perl.h's PL_bincompat_options stanza, and none of those start
with underscore, so this seems likely to work. (If it turns out not to
work everywhere, we could consider intersecting the symbols mentioned in
PL_bincompat_options with the -D switches. But that will be much more
complicated, so let's try this way first.)
This will need to be back-patched, but first let's see what the
buildfarm makes of it.
Ashutosh Sharma, some adjustments by me
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-07-28 14:25:28 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAGS recommended by Perl" >&5
$as_echo_n "checking for CFLAGS recommended by Perl... " >&6; }
perl_ccflags=`$PERL -MConfig -e 'print $Config{ccflags}'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_ccflags" >&5
$as_echo "$perl_ccflags" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAGS to compile embedded Perl" >&5
$as_echo_n "checking for CFLAGS to compile embedded Perl... " >&6; }
Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.
Commit 3c163a7fc's original choice to ignore all #define symbols whose
names begin with underscore turns out to be too simplistic. On Windows,
some Perl installations are built with -D_USE_32BIT_TIME_T, and we must
absorb that or we get the wrong result for sizeof(PerlInterpreter).
This effectively re-reverts commit ef58b87df, which injected that symbol
in a hacky way, making it apply to all of Postgres not just PL/Perl.
More significantly, it did so on *all* 32-bit Windows builds, even when
the Perl build to be used did not select this option; so that it fails
to work properly with some newer Perl builds.
By making this change, we would be introducing an ABI break in 32-bit
Windows builds; but fortunately we have not used type time_t in any
exported Postgres APIs in a long time. So it should be OK, both for
PL/Perl itself and for third-party extensions, if an extension library
is built with a different _USE_32BIT_TIME_T setting than the core code.
Patch by me, based on research by Ashutosh Sharma and Robert Haas.
Back-patch to all supported branches, as commit 3c163a7fc was.
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-08-14 11:48:59 -04:00
perl_embed_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}'`
PL/Perl portability fix: absorb relevant -D switches from Perl.
The Perl documentation is very clear that stuff calling libperl should
be built with the compiler switches shown by Perl's $Config{ccflags}.
We'd been ignoring that up to now, and mostly getting away with it,
but recent Perl versions contain ABI compatibility cross-checks that
fail on some builds because of this omission. In particular the
sizeof(PerlInterpreter) can come out different due to some fields being
added or removed; which means we have a live ABI hazard that we'd better
fix rather than continuing to sweep it under the rug.
However, it still seems like a bad idea to just absorb $Config{ccflags}
verbatim. In some environments Perl was built with a different compiler
that doesn't even use the same switch syntax. -D switch syntax is pretty
universal though, and absorbing Perl's -D switches really ought to be
enough to fix the problem.
Furthermore, Perl likes to inject stuff like -D_LARGEFILE_SOURCE and
-D_FILE_OFFSET_BITS=64 into $Config{ccflags}, which affect libc ABIs on
platforms where they're relevant. Adopting those seems dangerous too.
It's unclear whether a build wherein Perl and Postgres have different ideas
of sizeof(off_t) etc would work, or whether anyone would care about making
it work. But it's dead certain that having different stdio ABIs in
core Postgres and PL/Perl will not work; we've seen that movie before.
Therefore, let's also ignore -D switches for symbols beginning with
underscore. The symbols that we actually need to import should be the ones
mentioned in perl.h's PL_bincompat_options stanza, and none of those start
with underscore, so this seems likely to work. (If it turns out not to
work everywhere, we could consider intersecting the symbols mentioned in
PL_bincompat_options with the -D switches. But that will be much more
complicated, so let's try this way first.)
This will need to be back-patched, but first let's see what the
buildfarm makes of it.
Ashutosh Sharma, some adjustments by me
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-07-28 14:25:28 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_embed_ccflags" >&5
$as_echo "$perl_embed_ccflags" >&6; }
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flags to link embedded Perl" >&5
$as_echo_n "checking for flags to link embedded Perl... " >&6; }
if test "$PORTNAME" = "win32" ; then
2017-11-23 23:22:04 -05:00
perl_lib=`basename $perl_archlibexp/CORE/perl[5-9]*.lib .lib`
if test -e "$perl_archlibexp/CORE/$perl_lib.lib"; then
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
else
perl_lib=`basename $perl_archlibexp/CORE/libperl[5-9]*.a .a | sed 's/^lib//'`
if test -e "$perl_archlibexp/CORE/lib$perl_lib.a"; then
perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
fi
fi
2013-12-18 20:53:23 -05:00
else
2017-11-23 23:22:04 -05:00
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
2022-08-23 10:00:38 -04:00
pgac_tmp2=`$PERL -MConfig -e 'print "$Config{ccdlflags} $Config{ldflags}"'`
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%"`
2013-12-18 20:53:23 -05:00
fi
if test -z "$perl_embed_ldflags" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "could not determine flags for linking embedded Perl.
This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not
installed." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_embed_ldflags" >&5
$as_echo "$perl_embed_ldflags" >&6; }
2010-01-16 14:50:26 -05:00
fi
2006-01-17 18:52:31 -05:00
2013-12-18 20:53:23 -05:00
fi
2002-07-27 16:10:05 -04:00
2013-12-18 20:53:23 -05:00
if test "$with_python" = yes; then
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$PYTHON"; then
2022-02-17 01:47:35 -05:00
for ac_prog in python3 python
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PYTHON+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2000-07-09 09:14:19 -04:00
else
2013-12-18 20:53:23 -05:00
case $PYTHON in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
fi
PYTHON=$ac_cv_path_PYTHON
if test -n "$PYTHON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
$as_echo "$PYTHON" >&6; }
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
test -n "$PYTHON" && break
done
else
# Report the value of PYTHON in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHON" >&5
$as_echo_n "checking for PYTHON... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
$as_echo "$PYTHON" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test x"$PYTHON" = x""; then
as_fn_error $? "Python not found" "$LINENO" 5
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
2018-04-02 12:26:09 -04:00
python_fullversion=`${PYTHON} -c "import sys; print(sys.version)" | sed q`
{ $as_echo "$as_me:${as_lineno-$LINENO}: using python $python_fullversion" >&5
$as_echo "$as_me: using python $python_fullversion" >&6;}
# python_fullversion is typically n.n.n plus some trailing junk
python_majorversion=`echo "$python_fullversion" | sed 's/^\([0-9]*\).*/\1/'`
python_minorversion=`echo "$python_fullversion" | sed 's/^[0-9]*\.\([0-9]*\).*/\1/'`
python_version=`echo "$python_fullversion" | sed 's/^\([0-9]*\.[0-9]*\).*/\1/'`
# Reject unsupported Python versions as soon as practical.
2022-02-17 01:47:35 -05:00
if test "$python_majorversion" -lt 3; then
as_fn_error $? "Python version $python_version is too old (version 3 or later is required)" "$LINENO" 5
2018-04-02 12:26:09 -04:00
fi
2022-01-25 18:52:44 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python sysconfig module" >&5
$as_echo_n "checking for Python sysconfig module... " >&6; }
if "${PYTHON}" -c 'import sysconfig' 2>&5
2013-12-18 20:53:23 -05:00
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
2010-01-16 14:50:26 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2022-01-25 18:52:44 -05:00
as_fn_error $? "sysconfig module not found" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2018-04-02 12:26:09 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python configuration directory" >&5
$as_echo_n "checking Python configuration directory... " >&6; }
2022-01-25 18:52:44 -05:00
python_configdir=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LIBPL'))))"`
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_configdir" >&5
$as_echo "$python_configdir" >&6; }
2010-01-16 14:50:26 -05:00
2022-01-25 18:52:44 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python include directory" >&5
$as_echo_n "checking Python include directory... " >&6; }
python_includespec=`${PYTHON} -c "import sysconfig; print('-I' + sysconfig.get_config_var('INCLUDEPY'))"`
2015-05-03 08:17:04 -04:00
if test "$PORTNAME" = win32 ; then
2015-05-03 09:37:15 -04:00
python_includespec=`echo $python_includespec | sed 's,[\],/,g'`
2015-05-03 08:17:04 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_includespec" >&5
$as_echo "$python_includespec" >&6; }
2000-07-09 09:14:19 -04:00
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link an embedded Python application" >&5
$as_echo_n "checking how to link an embedded Python application... " >&6; }
2002-03-29 19:20:15 -05:00
2022-01-25 18:52:44 -05:00
python_libdir=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LIBDIR'))))"`
python_ldlibrary=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LDLIBRARY'))))"`
2005-07-01 14:17:31 -04:00
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
# If LDLIBRARY exists and has a shlib extension, use it verbatim.
ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's/\.dylib$//' -e 's/\.sl$//'`
if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
2013-12-18 20:53:23 -05:00
then
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
2016-10-05 11:44:57 -04:00
found_shlib=1
2013-12-18 20:53:23 -05:00
else
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
# Otherwise, guess the base name of the shlib.
2016-10-05 22:47:23 -04:00
# LDVERSION was added in Python 3.2, before that use VERSION,
# or failing that, $python_version from _PGAC_CHECK_PYTHON_DIRS.
2022-01-25 18:52:44 -05:00
python_ldversion=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LDVERSION'))))"`
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
if test x"${python_ldversion}" != x""; then
ldlibrary="python${python_ldversion}"
else
2022-01-25 18:52:44 -05:00
python_version_var=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('VERSION'))))"`
2016-10-05 22:47:23 -04:00
if test x"${python_version_var}" != x""; then
ldlibrary="python${python_version_var}"
else
ldlibrary="python${python_version}"
fi
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
fi
# Search for a likely-looking file.
found_shlib=0
2016-10-04 16:38:45 -04:00
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do
2022-07-06 01:30:16 -04:00
if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then
python_libdir="$d"
found_shlib=1
break 2
fi
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
done
2016-10-05 11:44:57 -04:00
# Some platforms (OpenBSD) require us to accept a bare versioned shlib
# (".so.n.n") as well. However, check this only after failing to find
# ".so" anywhere, because yet other platforms (Debian) put the .so
# symlink in a different directory from the underlying versioned shlib.
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
if test "$found_shlib" != 1; then
2016-10-05 11:44:57 -04:00
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do
for f in "$d/lib${ldlibrary}.so."* ; do
if test -e "$f"; then
python_libdir="$d"
found_shlib=1
break 2
fi
done
done
fi
2016-10-07 11:27:34 -04:00
# As usual, Windows has its own ideas. Possible default library
# locations include c:/Windows/System32 and (for Cygwin) /usr/bin,
# and the "lib" prefix might not be there.
if test "$found_shlib" != 1 -a \( "$PORTNAME" = win32 -o "$PORTNAME" = cygwin \); then
for d in "${python_libdir}" "${python_configdir}" c:/Windows/System32 /usr/bin
2016-10-05 22:47:23 -04:00
do
for f in "$d/lib${ldlibrary}.dll" "$d/${ldlibrary}.dll" ; do
if test -e "$f"; then
python_libdir="$d"
found_shlib=1
break 2
fi
done
done
fi
2016-10-05 11:44:57 -04:00
fi
if test "$found_shlib" != 1; then
as_fn_error $? "could not find shared library for Python
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
You might have to rebuild your Python installation. Refer to the
documentation for details. Use --without-python to disable building
PL/Python." "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
2016-10-04 15:23:02 -04:00
python_libspec="-L${python_libdir} -l${ldlibrary}"
2003-09-06 23:43:57 -04:00
2022-01-25 18:52:44 -05:00
python_additional_libs=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
1998-08-01 15:30:29 -04:00
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${python_libspec} ${python_additional_libs}" >&5
$as_echo "${python_libspec} ${python_additional_libs}" >&6; }
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
2010-01-16 14:50:26 -05:00
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2021-11-30 17:18:04 -05:00
if test x"$cross_compiling" = x"yes" && test -z "$with_system_tzdata"; then
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$ZIC"; then
for ac_prog in zic
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZIC+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
1999-01-16 22:22:52 -05:00
else
2013-12-18 20:53:23 -05:00
case $ZIC in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZIC="$ZIC" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZIC="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
fi
ZIC=$ac_cv_path_ZIC
if test -n "$ZIC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIC" >&5
$as_echo "$ZIC" >&6; }
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
2005-07-01 14:17:31 -04:00
1999-01-16 22:22:52 -05:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
test -n "$ZIC" && break
done
else
# Report the value of ZIC in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZIC" >&5
$as_echo_n "checking for ZIC... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIC" >&5
$as_echo "$ZIC" >&6; }
fi
2013-12-18 20:53:23 -05:00
if test -z "$ZIC"; then
as_fn_error $? "
When cross-compiling, either use the option --with-system-tzdata to use
existing time-zone data, or set the environment variable ZIC to a zic
program to use during the build." "$LINENO" 5
fi
2002-03-29 19:20:15 -05:00
fi
2009-04-07 18:48:30 -04:00
2015-07-08 17:05:45 -04:00
#
# Pthreads
#
# For each platform, we need to know about any special compile and link
# libraries, and whether the normal C function names are thread-safe.
# WIN32 doesn't need the pthread tests; it always uses threads
#
# These tests are run before the library-tests, because linking with the
# other libraries can pull in the pthread functions as a side-effect. We
# want to use the -pthread or similar flags directly, and not rely on
# the side-effects of linking with some other library.
2019-02-09 09:55:17 -05:00
2018-11-19 15:05:33 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
for ac_i in 1 2 3 4 5 6 7; do
ac_script="$ac_script$as_nl$ac_script"
done
echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
{ ac_script=; unset ac_script;}
if test -z "$SED"; then
ac_path_SED_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_SED" || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
*GNU*)
ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo '' >> "conftest.nl"
"$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_SED_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_SED="$ac_path_SED"
ac_path_SED_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_SED_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_SED"; then
as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
fi
else
ac_cv_path_SED=$SED
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
$as_echo "$ac_cv_path_SED" >&6; }
SED="$ac_cv_path_SED"
rm -f conftest.sed
2019-07-01 18:46:24 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call in
the script. If the first call is within an if-block, the additional code is
put inside the if-block too, even though it is needed by subsequent
AC_CHECK_HEADERS checks and should always be executed. When I moved the
pthread-related checks earlier in the script, the pthread.h test inside
the block became the very first AC_CHECK_HEADERS call in the script,
triggering that problem.
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
and makes sure the additional code is always executed. To be completely
safe from this issue (and others), we should always be using AS_IF instead
of plain if, but that seems like excessive caution given that this is the
first time we have trouble like this. Plain if-then is more readable than
AS_IF.
This should fix compilation with --disable-thread-safety, and hopefully the
buildfarm failure on forgmouth, related to mingw standard headers, too.
I backpatched the previous fixes to 9.5, but it's starting to look like
these changes are too fiddly to backpatch, so commit this to master only,
and revert all the pthread-related configure changes in 9.5.
2015-07-09 04:38:34 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
2023-07-11 14:20:37 -04:00
if test "$PORTNAME" != "win32"; then :
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call in
the script. If the first call is within an if-block, the additional code is
put inside the if-block too, even though it is needed by subsequent
AC_CHECK_HEADERS checks and should always be executed. When I moved the
pthread-related checks earlier in the script, the pthread.h test inside
the block became the very first AC_CHECK_HEADERS call in the script,
triggering that problem.
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
and makes sure the additional code is always executed. To be completely
safe from this issue (and others), we should always be using AS_IF instead
of plain if, but that seems like excessive caution given that this is the
first time we have trouble like this. Plain if-then is more readable than
AS_IF.
This should fix compilation with --disable-thread-safety, and hopefully the
buildfarm failure on forgmouth, related to mingw standard headers, too.
I backpatched the previous fixes to 9.5, but it's starting to look like
these changes are too fiddly to backpatch, so commit this to master only,
and revert all the pthread-related configure changes in 9.5.
2015-07-09 04:38:34 -04:00
# then
2013-12-18 20:53:23 -05:00
2015-07-30 07:14:50 -04:00
2018-11-19 15:05:33 -05:00
2015-07-08 17:05:45 -04:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
ax_pthread_ok=no
2009-04-07 18:48:30 -04:00
2015-07-08 17:05:45 -04:00
# We used to check for pthread.h first, but this fails if pthread.h
2015-07-30 07:14:50 -04:00
# requires special compiler flags (e.g. on Tru64 or Sequent).
2015-07-08 17:05:45 -04:00
# It gets checked for in the link test anyway.
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
2018-11-19 15:05:33 -05:00
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
if test "x$PTHREAD_CC" != "x"; then :
CC="$PTHREAD_CC"
fi
2015-07-08 17:05:45 -04:00
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
2015-07-30 07:14:50 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5
$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; }
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-04-07 18:48:30 -04:00
/* end confdefs.h. */
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char pthread_join ();
2006-06-18 14:30:21 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return pthread_join ();
2006-06-18 14:30:21 -04:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ax_pthread_ok=yes
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
$as_echo "$ax_pthread_ok" >&6; }
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_ok" = "xno"; then
2015-07-08 17:05:45 -04:00
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
2018-11-19 15:05:33 -05:00
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
2006-06-18 14:30:21 -04:00
2015-07-08 17:05:45 -04:00
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
2008-02-17 11:36:43 -05:00
2018-11-19 15:05:33 -05:00
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
2015-07-08 17:05:45 -04:00
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
2015-07-30 07:14:50 -04:00
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
2018-11-19 15:05:33 -05:00
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
2015-07-08 17:05:45 -04:00
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
2015-07-30 07:14:50 -04:00
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
2018-11-19 15:05:33 -05:00
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
2015-07-30 07:14:50 -04:00
# -mthreads: Mingw32/gcc, Lynx/gcc
2015-07-08 17:05:45 -04:00
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
2015-07-30 07:14:50 -04:00
case $host_os in
2018-11-19 15:05:33 -05:00
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
2015-07-30 07:14:50 -04:00
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5
$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;}
fi
rm -f conftest*
;;
2015-07-08 17:05:45 -04:00
solaris*)
2018-11-19 15:05:33 -05:00
# On Solaris (at least, for some versions), libc contains stubbed
2015-07-08 17:05:45 -04:00
# (non-functional) versions of the pthreads routines, so link-based
2018-11-19 15:05:33 -05:00
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
2015-07-08 17:05:45 -04:00
2018-11-19 15:05:33 -05:00
ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
2015-07-08 17:05:45 -04:00
;;
esac
2018-11-19 15:05:33 -05:00
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
if test "x$GCC" = "xyes"; then :
ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"
fi
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
2015-07-08 17:05:45 -04:00
2018-11-19 15:05:33 -05:00
case $host_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
if test "x$ax_pthread_check_macro" = "x--"; then :
ax_pthread_check_cond=0
else
ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
fi
# Are we compiling with Clang?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5
$as_echo_n "checking whether $CC is Clang... " >&6; }
if ${ax_cv_PTHREAD_CLANG+:} false; then :
2015-07-30 07:14:50 -04:00
$as_echo_n "(cached) " >&6
else
2018-11-19 15:05:33 -05:00
ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-02-06 19:28:55 -05:00
/* end confdefs.h. */
2018-11-19 15:05:33 -05:00
/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
2006-10-01 20:06:18 -04:00
_ACEOF
2018-11-19 15:05:33 -05:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then :
ax_cv_PTHREAD_CLANG=yes
fi
rm -f conftest*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5
$as_echo "$ax_cv_PTHREAD_CLANG" >&6; }
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
ax_pthread_clang_warning=no
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
PTHREAD_CFLAGS="-pthread"
PTHREAD_LIBS=
ax_pthread_ok=yes
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
$as_echo_n "(cached) " >&6
2015-07-08 17:05:45 -04:00
else
2018-11-19 15:05:33 -05:00
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
if test "x$ax_pthread_try" = "xunknown"; then :
break
2006-10-01 20:06:18 -04:00
fi
2018-11-19 15:05:33 -05:00
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(void){return 0;}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_link="$ax_pthread_2step_ac_link"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(void){return 0;}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
break
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
2015-07-30 07:14:50 -04:00
fi
2018-11-19 15:05:33 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
if test "x$ax_pthread_try" = "x"; then :
ax_pthread_try=no
fi
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
2015-07-30 07:14:50 -04:00
fi
2018-11-19 15:05:33 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
2015-07-08 17:05:45 -04:00
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
2015-07-08 17:05:45 -04:00
2018-11-19 15:05:33 -05:00
case $ax_pthread_try_flag in
2015-07-08 17:05:45 -04:00
none)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
$as_echo_n "checking whether pthreads work without any flags... " >&6; }
;;
2015-07-30 07:14:50 -04:00
-mt,pthread)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5
$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; }
PTHREAD_CFLAGS="-mt"
PTHREAD_LIBS="-lpthread"
;;
2015-07-08 17:05:45 -04:00
-*)
2018-11-19 15:05:33 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5
$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; }
PTHREAD_CFLAGS="$ax_pthread_try_flag"
2015-07-08 17:05:45 -04:00
;;
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
pthread-config)
# Extract the first word of "pthread-config", so it can be a program name with args.
set dummy pthread-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ax_pthread_config+:} false; then :
$as_echo_n "(cached) " >&6
2006-10-01 20:06:18 -04:00
else
2015-07-08 17:05:45 -04:00
if test -n "$ax_pthread_config"; then
ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ax_pthread_config="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no"
2013-12-18 20:53:23 -05:00
fi
2006-10-01 20:06:18 -04:00
fi
2015-07-08 17:05:45 -04:00
ax_pthread_config=$ac_cv_prog_ax_pthread_config
if test -n "$ax_pthread_config"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5
$as_echo "$ax_pthread_config" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2010-01-16 14:50:26 -05:00
fi
2006-10-01 20:06:18 -04:00
2013-12-18 20:53:23 -05:00
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_config" = "xno"; then :
continue
fi
2015-07-08 17:05:45 -04:00
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
2018-11-19 15:05:33 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5
$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; }
PTHREAD_LIBS="-l$ax_pthread_try_flag"
2015-07-08 17:05:45 -04:00
;;
esac
2018-11-19 15:05:33 -05:00
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2015-07-08 17:05:45 -04:00
LIBS="$PTHREAD_LIBS $LIBS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
2018-11-19 15:05:33 -05:00
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
2018-11-19 15:05:33 -05:00
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
2015-07-08 17:05:45 -04:00
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }
2006-10-01 20:06:18 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */
2006-10-01 20:06:18 -04:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ax_pthread_ok=yes
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext conftest.$ac_ext
2013-12-18 20:53:23 -05:00
2018-11-19 15:05:33 -05:00
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
2006-10-01 20:06:18 -04:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
$as_echo "$ax_pthread_ok" >&6; }
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_ok" = "xyes"; then :
break
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
# Various other checks:
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
2015-07-08 17:05:45 -04:00
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2018-11-19 15:05:33 -05:00
LIBS="$PTHREAD_LIBS $LIBS"
2015-07-08 17:05:45 -04:00
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
$as_echo_n "checking for joinable pthread attribute... " >&6; }
2015-07-30 07:14:50 -04:00
if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_cv_PTHREAD_JOINABLE_ATTR=unknown
2018-11-19 15:05:33 -05:00
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
2015-07-30 07:14:50 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2015-07-08 17:05:45 -04:00
/* end confdefs.h. */
#include <pthread.h>
2003-01-06 00:46:18 -05:00
int
main ()
{
2018-11-19 15:05:33 -05:00
int attr = $ax_pthread_attr; return attr /* ; */
2009-07-02 14:55:40 -04:00
;
2003-03-29 06:31:52 -05:00
return 0;
2009-07-02 14:55:40 -04:00
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
2018-11-19 15:05:33 -05:00
ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext conftest.$ac_ext
2015-07-30 07:14:50 -04:00
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5
$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; }
2018-11-19 15:05:33 -05:00
if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"; then :
2003-01-06 00:46:18 -05:00
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
2015-07-30 07:14:50 -04:00
#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR
2015-07-08 17:05:45 -04:00
_ACEOF
2003-01-06 01:06:04 -05:00
2018-11-19 15:05:33 -05:00
ax_pthread_joinable_attr_defined=yes
2015-07-30 07:14:50 -04:00
fi
2003-01-06 01:06:04 -05:00
2018-11-19 15:05:33 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5
$as_echo_n "checking whether more special flags are required for pthreads... " >&6; }
2015-07-30 07:14:50 -04:00
if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_cv_PTHREAD_SPECIAL_FLAGS=no
2018-11-19 15:05:33 -05:00
case $host_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
2015-07-30 07:14:50 -04:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5
$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; }
if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"; then :
PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
1998-01-13 14:22:29 -05:00
else
2015-07-30 07:14:50 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2015-07-08 17:05:45 -04:00
/* end confdefs.h. */
#include <pthread.h>
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
int i = PTHREAD_PRIO_INHERIT;
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ax_cv_PTHREAD_PRIO_INHERIT=yes
else
ax_cv_PTHREAD_PRIO_INHERIT=no
1998-01-13 14:22:29 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext conftest.$ac_ext
1998-01-13 14:22:29 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
2018-11-19 15:05:33 -05:00
if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"; then :
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
2013-12-18 20:53:23 -05:00
2018-11-19 15:05:33 -05:00
ax_pthread_prio_inherit_defined=yes
2013-12-18 20:53:23 -05:00
fi
2018-11-19 15:05:33 -05:00
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
2015-07-08 17:05:45 -04:00
# More AIX lossage: compile with *_r variant
2018-11-19 15:05:33 -05:00
if test "x$GCC" != "xyes"; then
2015-07-08 17:05:45 -04:00
case $host_os in
aix*)
case "x/$CC" in #(
x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
#handle absolute path differently from PATH based program lookup
2018-11-19 15:05:33 -05:00
case "x$CC" in #(
2015-07-08 17:05:45 -04:00
x/*) :
if as_fn_executable_p ${CC}_r; then :
PTHREAD_CC="${CC}_r"
fi ;; #(
*) :
for ac_prog in ${CC}_r
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_PTHREAD_CC+:} false; then :
2010-01-16 14:50:26 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
if test -n "$PTHREAD_CC"; then
ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_PTHREAD_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
2013-12-18 20:53:23 -05:00
fi
done
2015-07-08 17:05:45 -04:00
done
IFS=$as_save_IFS
1997-12-18 22:08:03 -05:00
fi
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
if test -n "$PTHREAD_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5
$as_echo "$PTHREAD_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
test -n "$PTHREAD_CC" && break
2013-12-18 20:53:23 -05:00
done
2015-07-08 17:05:45 -04:00
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
;;
esac ;; #(
*) :
;;
esac
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
2018-11-19 15:05:33 -05:00
if test "x$ax_pthread_ok" = "xyes"; then
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
:
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ax_pthread_ok=no
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
# set thread flags
# Some platforms use these, so just define them. They can't hurt if they
2021-07-14 20:23:47 -04:00
# are not supported.
PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE"
2015-07-08 17:05:45 -04:00
# Check for *_r functions
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
if test "x$ac_cv_header_pthread_h" = xyes; then :
2002-03-29 12:32:55 -05:00
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "
2023-07-11 14:20:37 -04:00
pthread.h not found" "$LINENO" 5
1997-12-18 22:08:03 -05:00
fi
2015-07-08 17:05:45 -04:00
2022-08-13 17:57:48 -04:00
for ac_func in strerror_r
2015-07-08 17:05:45 -04:00
do :
2022-08-13 17:57:48 -04:00
ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
if test "x$ac_cv_func_strerror_r" = xyes; then :
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
2022-08-13 17:57:48 -04:00
#define HAVE_STRERROR_R 1
2015-07-08 17:05:45 -04:00
_ACEOF
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
# Do test here with the proper thread flags
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns int" >&5
$as_echo_n "checking whether strerror_r returns int... " >&6; }
if ${pgac_cv_func_strerror_r_int+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
int
main ()
{
2018-09-26 18:23:13 -04:00
char buf[100];
switch (strerror_r(1, buf, sizeof(buf)))
{ case 0: break; default: break; }
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_func_strerror_r_int=yes
else
pgac_cv_func_strerror_r_int=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_strerror_r_int" >&5
$as_echo "$pgac_cv_func_strerror_r_int" >&6; }
if test x"$pgac_cv_func_strerror_r_int" = xyes ; then
$as_echo "#define STRERROR_R_INT 1" >>confdefs.h
fi
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call in
the script. If the first call is within an if-block, the additional code is
put inside the if-block too, even though it is needed by subsequent
AC_CHECK_HEADERS checks and should always be executed. When I moved the
pthread-related checks earlier in the script, the pthread.h test inside
the block became the very first AC_CHECK_HEADERS call in the script,
triggering that problem.
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
and makes sure the additional code is always executed. To be completely
safe from this issue (and others), we should always be using AS_IF instead
of plain if, but that seems like excessive caution given that this is the
first time we have trouble like this. Plain if-then is more readable than
AS_IF.
This should fix compilation with --disable-thread-safety, and hopefully the
buildfarm failure on forgmouth, related to mingw standard headers, too.
I backpatched the previous fixes to 9.5, but it's starting to look like
these changes are too fiddly to backpatch, so commit this to master only,
and revert all the pthread-related configure changes in 9.5.
2015-07-09 04:38:34 -04:00
2015-07-08 17:05:45 -04:00
else
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call in
the script. If the first call is within an if-block, the additional code is
put inside the if-block too, even though it is needed by subsequent
AC_CHECK_HEADERS checks and should always be executed. When I moved the
pthread-related checks earlier in the script, the pthread.h test inside
the block became the very first AC_CHECK_HEADERS call in the script,
triggering that problem.
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
and makes sure the additional code is always executed. To be completely
safe from this issue (and others), we should always be using AS_IF instead
of plain if, but that seems like excessive caution given that this is the
first time we have trouble like this. Plain if-then is more readable than
AS_IF.
This should fix compilation with --disable-thread-safety, and hopefully the
buildfarm failure on forgmouth, related to mingw standard headers, too.
I backpatched the previous fixes to 9.5, but it's starting to look like
these changes are too fiddly to backpatch, so commit this to master only,
and revert all the pthread-related configure changes in 9.5.
2015-07-09 04:38:34 -04:00
# else
2015-07-08 17:05:45 -04:00
# do not use values from template file
PTHREAD_CFLAGS=
PTHREAD_LIBS=
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call in
the script. If the first call is within an if-block, the additional code is
put inside the if-block too, even though it is needed by subsequent
AC_CHECK_HEADERS checks and should always be executed. When I moved the
pthread-related checks earlier in the script, the pthread.h test inside
the block became the very first AC_CHECK_HEADERS call in the script,
triggering that problem.
To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
and makes sure the additional code is always executed. To be completely
safe from this issue (and others), we should always be using AS_IF instead
of plain if, but that seems like excessive caution given that this is the
first time we have trouble like this. Plain if-then is more readable than
AS_IF.
This should fix compilation with --disable-thread-safety, and hopefully the
buildfarm failure on forgmouth, related to mingw standard headers, too.
I backpatched the previous fixes to 9.5, but it's starting to look like
these changes are too fiddly to backpatch, so commit this to master only,
and revert all the pthread-related configure changes in 9.5.
2015-07-09 04:38:34 -04:00
fi # fi
2015-07-08 17:05:45 -04:00
##
## Libraries
##
## Most libraries are included only if they demonstrably provide a function
## we need, but libm is an exception: always include it, because there are
## too many compilers that play cute optimization games that will break
## probes for standard functions such as pow().
##
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
$as_echo_n "checking for main in -lm... " >&6; }
if ${ac_cv_lib_m_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m_main=yes
else
ac_cv_lib_m_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
$as_echo "$ac_cv_lib_m_main" >&6; }
if test "x$ac_cv_lib_m_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
LIBS="-lm $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setproctitle" >&5
$as_echo_n "checking for library containing setproctitle... " >&6; }
if ${ac_cv_search_setproctitle+:} false; then :
2015-06-30 13:20:38 -04:00
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char setproctitle ();
2015-06-30 13:20:38 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return setproctitle ();
2015-06-30 13:20:38 -04:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' util; do
2015-06-30 13:20:38 -04:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_search_setproctitle=$ac_res
2015-06-30 13:20:38 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_setproctitle+:} false; then :
2015-06-30 13:20:38 -04:00
break
fi
done
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_setproctitle+:} false; then :
2015-06-30 13:20:38 -04:00
else
2015-07-08 17:05:45 -04:00
ac_cv_search_setproctitle=no
2015-06-30 13:20:38 -04:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setproctitle" >&5
$as_echo "$ac_cv_search_setproctitle" >&6; }
ac_res=$ac_cv_search_setproctitle
2015-06-30 13:20:38 -04:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
2022-03-23 15:43:14 -04:00
# gcc/clang's sanitizer helper library provides dlopen but not dlsym, thus
# when enabling asan the dlopen check doesn't notice that -ldl is actually
# required. Just checking for dlsym() ought to suffice.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
$as_echo_n "checking for library containing dlsym... " >&6; }
if ${ac_cv_search_dlsym+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
1997-02-04 17:39:56 -05:00
else
2013-12-18 20:53:23 -05:00
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2022-03-23 15:43:14 -04:00
char dlsym ();
2002-03-29 12:32:55 -05:00
int
main ()
{
2022-03-23 15:43:14 -04:00
return dlsym ();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' dl; do
2013-12-18 20:53:23 -05:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2022-03-23 15:43:14 -04:00
ac_cv_search_dlsym=$ac_res
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
2022-03-23 15:43:14 -04:00
if ${ac_cv_search_dlsym+:} false; then :
2013-12-18 20:53:23 -05:00
break
fi
done
2022-03-23 15:43:14 -04:00
if ${ac_cv_search_dlsym+:} false; then :
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
else
2022-03-23 15:43:14 -04:00
ac_cv_search_dlsym=no
2013-12-18 20:53:23 -05:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2022-03-23 15:43:14 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5
$as_echo "$ac_cv_search_dlsym" >&6; }
ac_res=$ac_cv_search_dlsym
2013-12-18 20:53:23 -05:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
$as_echo_n "checking for library containing socket... " >&6; }
if ${ac_cv_search_socket+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char socket ();
2002-03-29 19:20:15 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return socket ();
2002-03-29 19:20:15 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' socket ws2_32; do
2013-12-18 20:53:23 -05:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_search_socket=$ac_res
1997-02-04 17:39:56 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_socket+:} false; then :
2010-01-16 14:50:26 -05:00
break
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
done
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_socket+:} false; then :
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_search_socket=no
1997-03-17 14:03:05 -05:00
fi
2013-12-18 20:53:23 -05:00
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5
$as_echo "$ac_cv_search_socket" >&6; }
ac_res=$ac_cv_search_socket
2013-12-18 20:53:23 -05:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
fi
1997-03-20 02:30:26 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getopt_long" >&5
$as_echo_n "checking for library containing getopt_long... " >&6; }
if ${ac_cv_search_getopt_long+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2003-04-01 19:49:28 -05:00
else
2013-12-18 20:53:23 -05:00
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2003-04-01 19:49:28 -05:00
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char getopt_long ();
2005-07-01 14:17:31 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return getopt_long ();
2003-04-01 19:49:28 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' getopt gnugetopt; do
2013-12-18 20:53:23 -05:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_search_getopt_long=$ac_res
2003-04-01 19:49:28 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_getopt_long+:} false; then :
2013-12-18 20:53:23 -05:00
break
2003-04-01 19:49:28 -05:00
fi
2013-12-18 20:53:23 -05:00
done
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_getopt_long+:} false; then :
2003-04-01 19:49:28 -05:00
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_search_getopt_long=no
2013-12-18 20:53:23 -05:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getopt_long" >&5
$as_echo "$ac_cv_search_getopt_long" >&6; }
ac_res=$ac_cv_search_getopt_long
2013-12-18 20:53:23 -05:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2003-04-01 19:49:28 -05:00
2013-12-18 20:53:23 -05:00
fi
2006-04-07 13:50:03 -04:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5
$as_echo_n "checking for library containing shm_open... " >&6; }
if ${ac_cv_search_shm_open+:} false; then :
2010-01-16 14:50:26 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
ac_func_search_save_LIBS=$LIBS
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char shm_open ();
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return shm_open ();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' rt; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_shm_open=$ac_res
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_shm_open+:} false; then :
break
fi
done
if ${ac_cv_search_shm_open+:} false; then :
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_search_shm_open=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_open" >&5
$as_echo "$ac_cv_search_shm_open" >&6; }
ac_res=$ac_cv_search_shm_open
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_unlink" >&5
$as_echo_n "checking for library containing shm_unlink... " >&6; }
if ${ac_cv_search_shm_unlink+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
2002-03-29 12:32:55 -05:00
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char shm_unlink ();
2005-07-01 14:17:31 -04:00
int
main ()
2013-12-18 20:53:23 -05:00
{
2015-07-08 17:05:45 -04:00
return shm_unlink ();
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' rt; do
2013-12-18 20:53:23 -05:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_search_shm_unlink=$ac_res
2003-02-18 23:05:07 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_shm_unlink+:} false; then :
2013-12-18 20:53:23 -05:00
break
2003-02-18 23:05:07 -05:00
fi
2013-12-18 20:53:23 -05:00
done
2015-07-08 17:05:45 -04:00
if ${ac_cv_search_shm_unlink+:} false; then :
2003-02-18 23:05:07 -05:00
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_search_shm_unlink=no
2003-02-18 23:05:07 -05:00
fi
2013-12-18 20:53:23 -05:00
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_unlink" >&5
$as_echo "$ac_cv_search_shm_unlink" >&6; }
ac_res=$ac_cv_search_shm_unlink
2013-12-18 20:53:23 -05:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2003-02-18 23:05:07 -05:00
2013-12-18 20:53:23 -05:00
fi
2003-02-18 23:05:07 -05:00
Use clock_gettime(), if available, in instr_time measurements.
The advantage of clock_gettime() is that the API allows the result to
be precise to nanoseconds, not just microseconds as in gettimeofday().
Now that it's routinely possible to do tens of plan node executions
in 1us, we really need more precision than gettimeofday() can offer
for EXPLAIN ANALYZE to accumulate statistics with.
Some research shows that clock_gettime() is available on pretty nearly
every modern Unix-ish platform, and as far as I have been able to test,
it has about the same execution time as gettimeofday(), so there's no
loss in switching over. (By the same token, this doesn't do anything
to fix the fact that we really wish clock readings were faster. But
there's enough win here to justify changing anyway.)
A small side benefit is that on most platforms, we can use CLOCK_MONOTONIC
instead of CLOCK_REALTIME and thereby render EXPLAIN impervious to
concurrent resets of the system clock. (This means that code must not
assume that the contents of struct instr_time have any well-defined
interpretation as timestamps, but really that was true before.)
Some platforms offer nonstandard clock IDs that might be of interest.
This patch knows we should use CLOCK_MONOTONIC_RAW on macOS, because it
provides more precision and is faster to read than their CLOCK_MONOTONIC.
If there turn out to be many more cases where we need special rules, it
might be appropriate to handle the selection of clock ID in configure,
but for the moment that doesn't seem worth the trouble.
Discussion: https://postgr.es/m/31856.1400021891@sss.pgh.pa.us
2017-01-02 13:41:51 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
$as_echo_n "checking for library containing clock_gettime... " >&6; }
if ${ac_cv_search_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
int
main ()
{
return clock_gettime ();
;
return 0;
}
_ACEOF
2023-08-17 00:16:43 -04:00
for ac_lib in '' rt; do
Use clock_gettime(), if available, in instr_time measurements.
The advantage of clock_gettime() is that the API allows the result to
be precise to nanoseconds, not just microseconds as in gettimeofday().
Now that it's routinely possible to do tens of plan node executions
in 1us, we really need more precision than gettimeofday() can offer
for EXPLAIN ANALYZE to accumulate statistics with.
Some research shows that clock_gettime() is available on pretty nearly
every modern Unix-ish platform, and as far as I have been able to test,
it has about the same execution time as gettimeofday(), so there's no
loss in switching over. (By the same token, this doesn't do anything
to fix the fact that we really wish clock readings were faster. But
there's enough win here to justify changing anyway.)
A small side benefit is that on most platforms, we can use CLOCK_MONOTONIC
instead of CLOCK_REALTIME and thereby render EXPLAIN impervious to
concurrent resets of the system clock. (This means that code must not
assume that the contents of struct instr_time have any well-defined
interpretation as timestamps, but really that was true before.)
Some platforms offer nonstandard clock IDs that might be of interest.
This patch knows we should use CLOCK_MONOTONIC_RAW on macOS, because it
provides more precision and is faster to read than their CLOCK_MONOTONIC.
If there turn out to be many more cases where we need special rules, it
might be appropriate to handle the selection of clock ID in configure,
but for the moment that doesn't seem worth the trouble.
Discussion: https://postgr.es/m/31856.1400021891@sss.pgh.pa.us
2017-01-02 13:41:51 -05:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_clock_gettime=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_clock_gettime+:} false; then :
break
fi
done
if ${ac_cv_search_clock_gettime+:} false; then :
else
ac_cv_search_clock_gettime=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
$as_echo "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
2021-07-24 12:16:39 -04:00
# Cygwin:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shmget" >&5
$as_echo_n "checking for library containing shmget... " >&6; }
if ${ac_cv_search_shmget+:} false; then :
2010-01-16 14:50:26 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
ac_func_search_save_LIBS=$LIBS
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2021-07-24 12:16:39 -04:00
char shmget ();
2002-03-29 12:32:55 -05:00
int
main ()
{
2021-07-24 12:16:39 -04:00
return shmget ();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2021-07-24 12:16:39 -04:00
for ac_lib in '' cygipc; do
2015-07-08 17:05:45 -04:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2021-07-24 12:16:39 -04:00
ac_cv_search_shmget=$ac_res
1997-03-17 14:03:05 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext
2021-07-24 12:16:39 -04:00
if ${ac_cv_search_shmget+:} false; then :
2015-07-08 17:05:45 -04:00
break
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2021-07-24 12:16:39 -04:00
if ${ac_cv_search_shmget+:} false; then :
2010-01-16 14:50:26 -05:00
else
2021-07-24 12:16:39 -04:00
ac_cv_search_shmget=no
2015-07-08 17:05:45 -04:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
2013-12-18 20:53:23 -05:00
fi
2021-07-24 12:16:39 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shmget" >&5
$as_echo "$ac_cv_search_shmget" >&6; }
ac_res=$ac_cv_search_shmget
2015-07-08 17:05:45 -04:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
2021-07-24 12:16:39 -04:00
# *BSD:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace_symbols" >&5
$as_echo_n "checking for library containing backtrace_symbols... " >&6; }
if ${ac_cv_search_backtrace_symbols+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2007-01-27 20:12:05 -05:00
else
2015-07-08 17:05:45 -04:00
ac_func_search_save_LIBS=$LIBS
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-01-27 20:12:05 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2021-07-24 12:16:39 -04:00
char backtrace_symbols ();
2007-01-27 20:12:05 -05:00
int
main ()
{
2021-07-24 12:16:39 -04:00
return backtrace_symbols ();
2007-01-27 20:12:05 -05:00
;
return 0;
}
_ACEOF
2021-07-24 12:16:39 -04:00
for ac_lib in '' execinfo; do
2015-07-08 17:05:45 -04:00
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2021-07-24 12:16:39 -04:00
ac_cv_search_backtrace_symbols=$ac_res
2007-01-27 20:12:05 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext
2021-07-24 12:16:39 -04:00
if ${ac_cv_search_backtrace_symbols+:} false; then :
2015-07-08 17:05:45 -04:00
break
2007-01-27 20:12:05 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2021-07-24 12:16:39 -04:00
if ${ac_cv_search_backtrace_symbols+:} false; then :
2007-01-27 22:50:34 -05:00
2013-12-18 20:53:23 -05:00
else
2021-07-24 12:16:39 -04:00
ac_cv_search_backtrace_symbols=no
2015-07-08 17:05:45 -04:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
2007-01-27 20:12:05 -05:00
fi
2021-07-24 12:16:39 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace_symbols" >&5
$as_echo "$ac_cv_search_backtrace_symbols" >&6; }
ac_res=$ac_cv_search_backtrace_symbols
2015-07-08 17:05:45 -04:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2007-01-27 20:12:05 -05:00
2013-12-18 20:53:23 -05:00
fi
2007-01-27 22:50:34 -05:00
2010-01-16 14:50:26 -05:00
2023-07-11 14:20:37 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_barrier_wait" >&5
2021-03-12 23:21:01 -05:00
$as_echo_n "checking for library containing pthread_barrier_wait... " >&6; }
if ${ac_cv_search_pthread_barrier_wait+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_barrier_wait ();
int
main ()
{
return pthread_barrier_wait ();
;
return 0;
}
_ACEOF
for ac_lib in '' pthread; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_pthread_barrier_wait=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_pthread_barrier_wait+:} false; then :
break
fi
done
if ${ac_cv_search_pthread_barrier_wait+:} false; then :
else
ac_cv_search_pthread_barrier_wait=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_barrier_wait" >&5
$as_echo "$ac_cv_search_pthread_barrier_wait" >&6; }
ac_res=$ac_cv_search_pthread_barrier_wait
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
2015-07-08 17:05:45 -04:00
if test "$with_readline" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing readline" >&5
$as_echo_n "checking for library containing readline... " >&6; }
if ${pgac_cv_check_readline+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
pgac_cv_check_readline=no
pgac_save_LIBS=$LIBS
if test x"$with_libedit_preferred" != x"yes"
then READLINE_ORDER="-lreadline -ledit"
else READLINE_ORDER="-ledit -lreadline"
fi
for pgac_rllib in $READLINE_ORDER ; do
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2013-12-18 20:53:23 -05:00
/* end confdefs.h. */
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
2002-03-29 12:32:55 -05:00
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char readline ();
2005-07-01 14:17:31 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return readline ();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
2019-08-18 00:53:28 -04:00
# Older NetBSD and OpenBSD have a broken linker that does not
2015-07-08 17:05:45 -04:00
# recognize dependent libraries; assume curses is needed if we didn't
# find any dependency.
case $host_os in
2019-08-18 00:53:28 -04:00
netbsd* | openbsd*)
2015-07-08 17:05:45 -04:00
if test x"$pgac_lib" = x"" ; then
pgac_lib=" -lcurses"
fi ;;
esac
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
break
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
2015-07-08 17:05:45 -04:00
done
if test "$pgac_cv_check_readline" != no ; then
break
fi
done
LIBS=$pgac_save_LIBS
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_check_readline" >&5
$as_echo "$pgac_cv_check_readline" >&6; }
if test "$pgac_cv_check_readline" != no ; then
LIBS="$pgac_cv_check_readline $LIBS"
2002-07-27 16:10:05 -04:00
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h
2002-07-27 16:10:05 -04:00
2013-12-18 20:53:23 -05:00
fi
2002-07-27 16:10:05 -04:00
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
if test x"$pgac_cv_check_readline" = x"no"; then
as_fn_error $? "readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support." "$LINENO" 5
fi
2014-05-27 19:42:08 -04:00
fi
2015-07-08 17:05:45 -04:00
if test "$with_zlib" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5
$as_echo_n "checking for inflate in -lz... " >&6; }
if ${ac_cv_lib_z_inflate+:} false; then :
2014-05-27 19:42:08 -04:00
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
2015-07-08 17:05:45 -04:00
LIBS="-lz $LIBS"
2014-05-27 19:42:08 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char inflate ();
2014-05-27 19:42:08 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return inflate ();
2014-05-27 19:42:08 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_lib_z_inflate=yes
2014-05-27 19:42:08 -04:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_z_inflate=no
2014-05-27 19:42:08 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5
$as_echo "$ac_cv_lib_z_inflate" >&6; }
if test "x$ac_cv_lib_z_inflate" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBZ 1
_ACEOF
LIBS="-lz $LIBS"
2014-05-27 19:42:08 -04:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "zlib library not found
If you have zlib already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support." "$LINENO" 5
2014-05-27 19:42:08 -04:00
fi
fi
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
if test "$with_libcurl" = yes ; then
2025-07-11 13:06:41 -04:00
# libcurl compiler/linker flags are kept separate from the global flags, so
# they have to be added back temporarily for the following tests.
pgac_save_CPPFLAGS=$CPPFLAGS
pgac_save_LDFLAGS=$LDFLAGS
pgac_save_LIBS=$LIBS
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
LDFLAGS="$LDFLAGS $LIBCURL_LDFLAGS"
2025-07-11 13:06:41 -04:00
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
ac_fn_c_check_header_mongrel "$LINENO" "curl/curl.h" "ac_cv_header_curl_curl_h" "$ac_includes_default"
if test "x$ac_cv_header_curl_curl_h" = xyes; then :
else
as_fn_error $? "header file <curl/curl.h> is required for --with-libcurl" "$LINENO" 5
fi
2025-07-11 13:06:41 -04:00
# LIBCURL_LDLIBS is determined here. Like the compiler flags, it should not
# pollute the global LIBS setting.
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_multi_init in -lcurl" >&5
$as_echo_n "checking for curl_multi_init in -lcurl... " >&6; }
if ${ac_cv_lib_curl_curl_multi_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcurl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char curl_multi_init ();
int
main ()
{
return curl_multi_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_curl_curl_multi_init=yes
else
ac_cv_lib_curl_curl_multi_init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curl_curl_multi_init" >&5
$as_echo "$ac_cv_lib_curl_curl_multi_init" >&6; }
if test "x$ac_cv_lib_curl_curl_multi_init" = xyes; then :
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h
LIBCURL_LDLIBS=-lcurl
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
else
as_fn_error $? "library 'curl' does not provide curl_multi_init" "$LINENO" 5
fi
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
LIBS="$LIBCURL_LDLIBS $LIBS"
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
# Check to see whether the current platform supports threadsafe Curl
# initialization.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_global_init thread safety" >&5
$as_echo_n "checking for curl_global_init thread safety... " >&6; }
if ${pgac_cv__libcurl_threadsafe_init+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
pgac_cv__libcurl_threadsafe_init=unknown
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <curl/curl.h>
int
main ()
{
curl_version_info_data *info;
if (curl_global_init(CURL_GLOBAL_ALL))
return -1;
info = curl_version_info(CURLVERSION_NOW);
#ifdef CURL_VERSION_THREADSAFE
if (info->features & CURL_VERSION_THREADSAFE)
return 0;
#endif
return 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
pgac_cv__libcurl_threadsafe_init=yes
else
pgac_cv__libcurl_threadsafe_init=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__libcurl_threadsafe_init" >&5
$as_echo "$pgac_cv__libcurl_threadsafe_init" >&6; }
if test x"$pgac_cv__libcurl_threadsafe_init" = xyes ; then
$as_echo "#define HAVE_THREADSAFE_CURL_GLOBAL_INIT 1" >>confdefs.h
fi
2025-03-18 23:56:19 -04:00
# Fail if a thread-friendly DNS resolver isn't built.
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl support for asynchronous DNS" >&5
$as_echo_n "checking for curl support for asynchronous DNS... " >&6; }
if ${pgac_cv__libcurl_async_dns+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
pgac_cv__libcurl_async_dns=unknown
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <curl/curl.h>
int
main ()
{
curl_version_info_data *info;
if (curl_global_init(CURL_GLOBAL_ALL))
return -1;
info = curl_version_info(CURLVERSION_NOW);
return (info->features & CURL_VERSION_ASYNCHDNS) ? 0 : 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
pgac_cv__libcurl_async_dns=yes
else
pgac_cv__libcurl_async_dns=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__libcurl_async_dns" >&5
$as_echo "$pgac_cv__libcurl_async_dns" >&6; }
2025-03-18 23:56:19 -04:00
if test x"$pgac_cv__libcurl_async_dns" = xno ; then
as_fn_error $? "
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
*** The installed version of libcurl does not support asynchronous DNS
2025-03-18 23:56:19 -04:00
*** lookups. Rebuild libcurl with the AsynchDNS feature enabled in order
*** to use it with libpq." "$LINENO" 5
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
fi
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
CPPFLAGS=$pgac_save_CPPFLAGS
LDFLAGS=$pgac_save_LDFLAGS
LIBS=$pgac_save_LIBS
Add support for OAUTHBEARER SASL mechanism
This commit implements OAUTHBEARER, RFC 7628, and OAuth 2.0 Device
Authorization Grants, RFC 8628. In order to use this there is a
new pg_hba auth method called oauth. When speaking to a OAuth-
enabled server, it looks a bit like this:
$ psql 'host=example.org oauth_issuer=... oauth_client_id=...'
Visit https://oauth.example.org/login and enter the code: FPQ2-M4BG
Device authorization is currently the only supported flow so the
OAuth issuer must support that in order for users to authenticate.
Third-party clients may however extend this and provide their own
flows. The built-in device authorization flow is currently not
supported on Windows.
In order for validation to happen server side a new framework for
plugging in OAuth validation modules is added. As validation is
implementation specific, with no default specified in the standard,
PostgreSQL does not ship with one built-in. Each pg_hba entry can
specify a specific validator or be left blank for the validator
installed as default.
This adds a requirement on libcurl for the client side support,
which is optional to build, but the server side has no additional
build requirements. In order to run the tests, Python is required
as this adds a https server written in Python. Tests are gated
behind PG_TEST_EXTRA as they open ports.
This patch has been a multi-year project with many contributors
involved with reviews and in-depth discussions: Michael Paquier,
Heikki Linnakangas, Zhihong Yu, Mahendrakar Srinivasarao, Andrey
Chudnovsky and Stephen Frost to name a few. While Jacob Champion
is the main author there have been some levels of hacking by others.
Daniel Gustafsson contributed the validation module and various bits
and pieces; Thomas Munro wrote the client side support for kqueue.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Reviewed-by: Kashif Zeeshan <kashi.zeeshan@gmail.com>
Discussion: https://postgr.es/m/d1b467a78e0e36ed85a09adf979d04cf124a9d4b.camel@vmware.com
2025-02-20 10:25:17 -05:00
fi
2015-07-08 17:05:45 -04:00
if test "$with_gssapi" = yes ; then
if test "$PORTNAME" != "win32"; then
2023-04-17 10:13:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gss_store_cred_into" >&5
$as_echo_n "checking for library containing gss_store_cred_into... " >&6; }
if ${ac_cv_search_gss_store_cred_into+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2009-04-04 17:55:50 -04:00
else
2015-07-08 17:05:45 -04:00
ac_func_search_save_LIBS=$LIBS
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-04-04 17:55:50 -04:00
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
2010-01-16 14:50:26 -05:00
#endif
2023-04-17 10:13:08 -04:00
char gss_store_cred_into ();
2013-12-18 20:53:23 -05:00
int
main ()
{
2023-04-17 10:13:08 -04:00
return gss_store_cred_into ();
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
for ac_lib in '' gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
2023-04-17 10:13:08 -04:00
ac_cv_search_gss_store_cred_into=$ac_res
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
2015-07-08 17:05:45 -04:00
conftest$ac_exeext
2023-04-17 10:13:08 -04:00
if ${ac_cv_search_gss_store_cred_into+:} false; then :
2015-07-08 17:05:45 -04:00
break
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2023-04-17 10:13:08 -04:00
if ${ac_cv_search_gss_store_cred_into+:} false; then :
2015-07-08 17:05:45 -04:00
2013-12-18 20:53:23 -05:00
else
2023-04-17 10:13:08 -04:00
ac_cv_search_gss_store_cred_into=no
2015-07-08 17:05:45 -04:00
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
2023-04-17 10:13:08 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gss_store_cred_into" >&5
$as_echo "$ac_cv_search_gss_store_cred_into" >&6; }
ac_res=$ac_cv_search_gss_store_cred_into
2015-07-08 17:05:45 -04:00
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
2023-04-17 10:13:08 -04:00
as_fn_error $? "could not find function 'gss_store_cred_into' required for GSSAPI" "$LINENO" 5
2015-07-08 17:05:45 -04:00
fi
else
LIBS="$LIBS -lgssapi32"
fi
fi
2021-02-01 05:19:44 -05:00
#
# SSL Library
#
# There is currently only one supported SSL/TLS library: OpenSSL.
#
# Check whether --with-ssl was given.
if test "${with_ssl+set}" = set; then :
withval=$with_ssl;
case $withval in
yes)
as_fn_error $? "argument required for --with-ssl option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-ssl option" "$LINENO" 5
;;
*)
;;
esac
fi
if test x"$with_ssl" = x"" ; then
with_ssl=no
fi
# Check whether --with-openssl was given.
if test "${with_openssl+set}" = set; then :
withval=$with_openssl;
case $withval in
yes)
:
;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-openssl option" "$LINENO" 5
;;
esac
else
with_openssl=no
fi
2015-07-08 17:05:45 -04:00
if test "$with_openssl" = yes ; then
2021-02-01 05:19:44 -05:00
with_ssl=openssl
fi
if test "$with_ssl" = openssl ; then
2024-10-24 09:20:19 -04:00
# Minimum required OpenSSL version is 1.1.1
2020-07-19 06:14:42 -04:00
2024-10-24 09:20:19 -04:00
$as_echo "#define OPENSSL_API_COMPAT 0x10101000L" >>confdefs.h
2020-07-19 06:14:42 -04:00
2025-02-06 14:26:46 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5
2015-07-08 17:05:45 -04:00
$as_echo_n "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_CRYPTO_new_ex_data+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
2015-07-08 17:05:45 -04:00
LIBS="-lcrypto $LIBS"
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2015-07-08 17:05:45 -04:00
char CRYPTO_new_ex_data ();
2009-04-04 17:55:50 -04:00
int
main ()
{
2015-07-08 17:05:45 -04:00
return CRYPTO_new_ex_data ();
2009-04-04 17:55:50 -04:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_lib_crypto_CRYPTO_new_ex_data=yes
2009-04-04 17:55:50 -04:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_crypto_CRYPTO_new_ex_data=no
2009-04-04 17:55:50 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2009-04-04 17:55:50 -04:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_new_ex_data" >&5
$as_echo "$ac_cv_lib_crypto_CRYPTO_new_ex_data" >&6; }
if test "x$ac_cv_lib_crypto_CRYPTO_new_ex_data" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
LIBS="-lcrypto $LIBS"
2009-04-04 17:55:50 -04:00
2015-07-08 17:05:45 -04:00
else
as_fn_error $? "library 'crypto' is required for OpenSSL" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2011-07-25 23:48:44 -04:00
2025-02-06 14:26:46 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
$as_echo_n "checking for SSL_new in -lssl... " >&6; }
if ${ac_cv_lib_ssl_SSL_new+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
ac_check_lib_save_LIBS=$LIBS
LIBS="-lssl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2002-03-29 12:32:55 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
char SSL_new ();
2005-07-01 14:17:31 -04:00
int
main ()
{
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
return SSL_new ();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
ac_cv_lib_ssl_SSL_new=yes
2002-03-29 12:32:55 -05:00
else
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
ac_cv_lib_ssl_SSL_new=no
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
Support OpenSSL 1.1.0.
Changes needed to build at all:
- Check for SSL_new in configure, now that SSL_library_init is a macro.
- Do not access struct members directly. This includes some new code in
pgcrypto, to use the resource owner mechanism to ensure that we don't
leak OpenSSL handles, now that we can't embed them in other structs
anymore.
- RAND_SSLeay() -> RAND_OpenSSL()
Changes that were needed to silence deprecation warnings, but were not
strictly necessary:
- RAND_pseudo_bytes() -> RAND_bytes().
- SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
- ASN1_STRING_data() -> ASN1_STRING_get0_data()
- DH_generate_parameters() -> DH_generate_parameters()
- Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
riddance!)
Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
immemorial.
Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
Regenerate the test certificates with that. The "openssl" binary, used to
generate the certificates, is also now more picky, and throws an error
if an X509 extension is specified in "req_extensions", but that section
is empty.
Backpatch to all supported branches, per popular demand. In back-branches,
we still support OpenSSL 0.9.7 and above. OpenSSL 0.9.6 should still work
too, but I didn't test it. In master, we only support 0.9.8 and above.
Patch by Andreas Karlsson, with additional changes by me.
Discussion: <20160627151604.GD1051@msg.df7cb.de>
2016-09-15 05:36:21 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5
$as_echo "$ac_cv_lib_ssl_SSL_new" >&6; }
if test "x$ac_cv_lib_ssl_SSL_new" = xyes; then :
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSSL 1
2002-03-29 12:32:55 -05:00
_ACEOF
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
LIBS="-lssl $LIBS"
1997-02-04 03:53:45 -05:00
2015-07-08 17:05:45 -04:00
else
as_fn_error $? "library 'ssl' is required for OpenSSL" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
1997-02-04 03:53:45 -05:00
2024-10-24 09:20:19 -04:00
# Functions introduced in OpenSSL 1.1.1.
for ac_func in SSL_CTX_set_ciphersuites
2013-12-18 20:53:23 -05:00
do :
2024-10-24 09:20:19 -04:00
ac_fn_c_check_func "$LINENO" "SSL_CTX_set_ciphersuites" "ac_cv_func_SSL_CTX_set_ciphersuites"
if test "x$ac_cv_func_SSL_CTX_set_ciphersuites" = xyes; then :
2002-03-29 12:32:55 -05:00
cat >>confdefs.h <<_ACEOF
2024-10-24 09:20:19 -04:00
#define HAVE_SSL_CTX_SET_CIPHERSUITES 1
2002-03-29 12:32:55 -05:00
_ACEOF
2010-01-16 14:50:26 -05:00
2024-10-24 09:20:19 -04:00
else
as_fn_error $? "OpenSSL version >= 1.1.1 is required for SSL support" "$LINENO" 5
2016-09-15 15:29:39 -04:00
fi
done
2024-10-24 09:20:19 -04:00
# Function introduced in OpenSSL 1.0.2, not in LibreSSL.
for ac_func in SSL_CTX_set_cert_cb
2016-09-15 15:29:39 -04:00
do :
2024-10-24 09:20:19 -04:00
ac_fn_c_check_func "$LINENO" "SSL_CTX_set_cert_cb" "ac_cv_func_SSL_CTX_set_cert_cb"
if test "x$ac_cv_func_SSL_CTX_set_cert_cb" = xyes; then :
2016-09-15 15:29:39 -04:00
cat >>confdefs.h <<_ACEOF
2024-10-24 09:20:19 -04:00
#define HAVE_SSL_CTX_SET_CERT_CB 1
2016-09-15 15:29:39 -04:00
_ACEOF
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
OpenSSL 1.1.1 and newer versions have added support for RSA-PSS
certificates, which requires the use of a specific routine in OpenSSL to
determine which hash function to use when compiling it when using
channel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is the
original routine the channel binding code has relied on, is not able to
determine which hash algorithm to use for such certificates. However,
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. This
commit switches the channel binding logic to rely on
X509_get_signature_info() over X509_get_signature_nid(), which would be
the choice when building with 1.1.1 or newer.
The error could have been triggered on the client or the server, hence
libpq and the backend need to have their related code paths patched.
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0
or older leads to a failure due to an unsupported algorithm.
The discovery of relying on X509_get_signature_info() comes from Jacob,
the tests have been written by Heikki (with few tweaks from me), while I
have bundled the whole together while adding the bits needed for MSVC
and meson.
This issue exists since channel binding exists, so backpatch all the way
down. Some tests are added in 15~, triggered if compiling with OpenSSL
1.1.1 or newer, where the certificate and key files can easily be
generated for RSA-PSS.
Reported-by: Gunnar "Nick" Bluth
Author: Jacob Champion, Heikki Linnakangas
Discussion: https://postgr.es/m/17760-b6c61e752ec07060@postgresql.org
Backpatch-through: 11
2023-02-14 20:12:16 -05:00
fi
done
2024-09-02 07:51:48 -04:00
# Function introduced in OpenSSL 1.1.1, not in LibreSSL.
2025-04-03 07:16:43 -04:00
for ac_func in X509_get_signature_info SSL_CTX_set_num_tickets SSL_CTX_set_keylog_callback
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
OpenSSL 1.1.1 and newer versions have added support for RSA-PSS
certificates, which requires the use of a specific routine in OpenSSL to
determine which hash function to use when compiling it when using
channel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is the
original routine the channel binding code has relied on, is not able to
determine which hash algorithm to use for such certificates. However,
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. This
commit switches the channel binding logic to rely on
X509_get_signature_info() over X509_get_signature_nid(), which would be
the choice when building with 1.1.1 or newer.
The error could have been triggered on the client or the server, hence
libpq and the backend need to have their related code paths patched.
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0
or older leads to a failure due to an unsupported algorithm.
The discovery of relying on X509_get_signature_info() comes from Jacob,
the tests have been written by Heikki (with few tweaks from me), while I
have bundled the whole together while adding the bits needed for MSVC
and meson.
This issue exists since channel binding exists, so backpatch all the way
down. Some tests are added in 15~, triggered if compiling with OpenSSL
1.1.1 or newer, where the certificate and key files can easily be
generated for RSA-PSS.
Reported-by: Gunnar "Nick" Bluth
Author: Jacob Champion, Heikki Linnakangas
Discussion: https://postgr.es/m/17760-b6c61e752ec07060@postgresql.org
Backpatch-through: 11
2023-02-14 20:12:16 -05:00
do :
2024-07-26 05:09:45 -04:00
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
OpenSSL 1.1.1 and newer versions have added support for RSA-PSS
certificates, which requires the use of a specific routine in OpenSSL to
determine which hash function to use when compiling it when using
channel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is the
original routine the channel binding code has relied on, is not able to
determine which hash algorithm to use for such certificates. However,
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. This
commit switches the channel binding logic to rely on
X509_get_signature_info() over X509_get_signature_nid(), which would be
the choice when building with 1.1.1 or newer.
The error could have been triggered on the client or the server, hence
libpq and the backend need to have their related code paths patched.
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0
or older leads to a failure due to an unsupported algorithm.
The discovery of relying on X509_get_signature_info() comes from Jacob,
the tests have been written by Heikki (with few tweaks from me), while I
have bundled the whole together while adding the bits needed for MSVC
and meson.
This issue exists since channel binding exists, so backpatch all the way
down. Some tests are added in 15~, triggered if compiling with OpenSSL
1.1.1 or newer, where the certificate and key files can easily be
generated for RSA-PSS.
Reported-by: Gunnar "Nick" Bluth
Author: Jacob Champion, Heikki Linnakangas
Discussion: https://postgr.es/m/17760-b6c61e752ec07060@postgresql.org
Backpatch-through: 11
2023-02-14 20:12:16 -05:00
cat >>confdefs.h <<_ACEOF
2024-07-26 05:09:45 -04:00
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
OpenSSL 1.1.1 and newer versions have added support for RSA-PSS
certificates, which requires the use of a specific routine in OpenSSL to
determine which hash function to use when compiling it when using
channel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is the
original routine the channel binding code has relied on, is not able to
determine which hash algorithm to use for such certificates. However,
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. This
commit switches the channel binding logic to rely on
X509_get_signature_info() over X509_get_signature_nid(), which would be
the choice when building with 1.1.1 or newer.
The error could have been triggered on the client or the server, hence
libpq and the backend need to have their related code paths patched.
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0
or older leads to a failure due to an unsupported algorithm.
The discovery of relying on X509_get_signature_info() comes from Jacob,
the tests have been written by Heikki (with few tweaks from me), while I
have bundled the whole together while adding the bits needed for MSVC
and meson.
This issue exists since channel binding exists, so backpatch all the way
down. Some tests are added in 15~, triggered if compiling with OpenSSL
1.1.1 or newer, where the certificate and key files can easily be
generated for RSA-PSS.
Reported-by: Gunnar "Nick" Bluth
Author: Jacob Champion, Heikki Linnakangas
Discussion: https://postgr.es/m/17760-b6c61e752ec07060@postgresql.org
Backpatch-through: 11
2023-02-14 20:12:16 -05:00
_ACEOF
1999-11-04 16:48:36 -05:00
fi
2002-03-29 12:32:55 -05:00
done
1999-11-04 16:48:36 -05:00
2021-02-01 05:19:44 -05:00
$as_echo "#define USE_OPENSSL 1" >>confdefs.h
elif test "$with_ssl" != no ; then
as_fn_error $? "--with-ssl must specify openssl" "$LINENO" 5
2015-07-08 17:05:45 -04:00
fi
2002-03-29 12:32:55 -05:00
2021-02-01 05:19:44 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_pam" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
$as_echo_n "checking for pam_start in -lpam... " >&6; }
if ${ac_cv_lib_pam_pam_start+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpam $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pam_start ();
int
main ()
{
return pam_start ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pam_pam_start=yes
else
ac_cv_lib_pam_pam_start=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5
$as_echo "$ac_cv_lib_pam_pam_start" >&6; }
if test "x$ac_cv_lib_pam_pam_start" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_LIBPAM 1
2013-12-18 20:53:23 -05:00
_ACEOF
2002-03-29 12:32:55 -05:00
2015-07-08 17:05:45 -04:00
LIBS="-lpam $LIBS"
else
as_fn_error $? "library 'pam' is required for PAM" "$LINENO" 5
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_libxml" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlSaveToBuffer in -lxml2" >&5
$as_echo_n "checking for xmlSaveToBuffer in -lxml2... " >&6; }
if ${ac_cv_lib_xml2_xmlSaveToBuffer+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxml2 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
2013-12-18 20:53:23 -05:00
#endif
2015-07-08 17:05:45 -04:00
char xmlSaveToBuffer ();
int
main ()
{
return xmlSaveToBuffer ();
;
return 0;
}
2005-07-01 14:17:31 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_xml2_xmlSaveToBuffer=yes
else
ac_cv_lib_xml2_xmlSaveToBuffer=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlSaveToBuffer" >&5
$as_echo "$ac_cv_lib_xml2_xmlSaveToBuffer" >&6; }
if test "x$ac_cv_lib_xml2_xmlSaveToBuffer" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_LIBXML2 1
2002-03-29 12:32:55 -05:00
_ACEOF
2005-07-01 14:17:31 -04:00
2015-07-08 17:05:45 -04:00
LIBS="-lxml2 $LIBS"
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
else
as_fn_error $? "library 'xml2' (version >= 2.6.23) is required for XML support" "$LINENO" 5
fi
2002-03-29 12:32:55 -05:00
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_libxslt" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xsltCleanupGlobals in -lxslt" >&5
$as_echo_n "checking for xsltCleanupGlobals in -lxslt... " >&6; }
if ${ac_cv_lib_xslt_xsltCleanupGlobals+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxslt $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
2013-12-18 20:53:23 -05:00
#endif
2015-07-08 17:05:45 -04:00
char xsltCleanupGlobals ();
int
main ()
{
return xsltCleanupGlobals ();
;
return 0;
}
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_xslt_xsltCleanupGlobals=yes
else
ac_cv_lib_xslt_xsltCleanupGlobals=no
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xslt_xsltCleanupGlobals" >&5
$as_echo "$ac_cv_lib_xslt_xsltCleanupGlobals" >&6; }
if test "x$ac_cv_lib_xslt_xsltCleanupGlobals" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_LIBXSLT 1
2013-12-18 20:53:23 -05:00
_ACEOF
2010-12-15 23:50:41 -05:00
2015-07-08 17:05:45 -04:00
LIBS="-lxslt $LIBS"
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'xslt' is required for XSLT support" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2010-12-15 23:50:41 -05:00
fi
2025-07-07 21:03:16 -04:00
if test "$with_liburing" = yes; then
_LIBS="$LIBS"
LIBS="$LIBURING_LIBS $LIBS"
for ac_func in io_uring_queue_init_mem
do :
ac_fn_c_check_func "$LINENO" "io_uring_queue_init_mem" "ac_cv_func_io_uring_queue_init_mem"
if test "x$ac_cv_func_io_uring_queue_init_mem" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_IO_URING_QUEUE_INIT_MEM 1
_ACEOF
fi
done
LIBS="$_LIBS"
fi
2021-03-21 17:20:17 -04:00
if test "$with_lz4" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_compress_default in -llz4" >&5
$as_echo_n "checking for LZ4_compress_default in -llz4... " >&6; }
if ${ac_cv_lib_lz4_LZ4_compress_default+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-llz4 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char LZ4_compress_default ();
int
main ()
{
return LZ4_compress_default ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_lz4_LZ4_compress_default=yes
else
ac_cv_lib_lz4_LZ4_compress_default=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lz4_LZ4_compress_default" >&5
$as_echo "$ac_cv_lib_lz4_LZ4_compress_default" >&6; }
if test "x$ac_cv_lib_lz4_LZ4_compress_default" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBLZ4 1
_ACEOF
LIBS="-llz4 $LIBS"
else
as_fn_error $? "library 'lz4' is required for LZ4 support" "$LINENO" 5
fi
fi
2022-02-18 13:40:31 -05:00
if test "$with_zstd" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD_compress in -lzstd" >&5
$as_echo_n "checking for ZSTD_compress in -lzstd... " >&6; }
if ${ac_cv_lib_zstd_ZSTD_compress+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lzstd $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ZSTD_compress ();
int
main ()
{
return ZSTD_compress ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_zstd_ZSTD_compress=yes
else
ac_cv_lib_zstd_ZSTD_compress=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_compress" >&5
$as_echo "$ac_cv_lib_zstd_ZSTD_compress" >&6; }
if test "x$ac_cv_lib_zstd_ZSTD_compress" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBZSTD 1
_ACEOF
LIBS="-lzstd $LIBS"
else
as_fn_error $? "library 'zstd' is required for ZSTD support" "$LINENO" 5
fi
fi
Remove AIX support
There isn't a lot of user demand for AIX support, we have a bunch of
hacks to work around AIX-specific compiler bugs and idiosyncrasies,
and no one has stepped up to the plate to properly maintain it.
Remove support for AIX to get rid of that maintenance overhead. It's
still supported for stable versions.
The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:
TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.
That could be worked around, but we decided to just drop the AIX support
instead.
Discussion: https://www.postgresql.org/message-id/20240224172345.32@rfd.leadboat.com
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro
2024-02-28 06:10:51 -05:00
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
2015-07-08 17:05:45 -04:00
if test "$with_ldap" = yes ; then
_LIBS="$LIBS"
if test "$PORTNAME" != "win32"; then
2021-07-09 16:59:07 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
2015-07-08 17:05:45 -04:00
$as_echo_n "(cached) " >&6
else
2021-07-09 16:59:07 -04:00
ac_check_lib_save_LIBS=$LIBS
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2021-07-09 16:59:07 -04:00
char ldap_bind ();
2015-07-08 17:05:45 -04:00
int
main ()
{
2021-07-09 16:59:07 -04:00
return ldap_bind ();
2015-07-08 17:05:45 -04:00
;
return 0;
}
2005-07-01 14:17:31 -04:00
_ACEOF
2021-07-09 16:59:07 -04:00
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ldap_ldap_bind=yes
else
ac_cv_lib_ldap_ldap_bind=no
2015-07-08 17:05:45 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
2021-07-09 16:59:07 -04:00
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2015-07-08 17:05:45 -04:00
fi
2021-07-09 16:59:07 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBLDAP 1
_ACEOF
2005-07-01 14:17:31 -04:00
2021-07-09 16:59:07 -04:00
LIBS="-lldap $LIBS"
2015-07-08 17:05:45 -04:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2021-07-09 16:59:07 -04:00
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
2021-07-10 13:19:30 -04:00
# This test is carried out against libldap.
for ac_func in ldap_initialize
do :
ac_fn_c_check_func "$LINENO" "ldap_initialize" "ac_cv_func_ldap_initialize"
if test "x$ac_cv_func_ldap_initialize" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LDAP_INITIALIZE 1
_ACEOF
fi
done
2022-05-10 18:42:02 -04:00
# The separate ldap_r library only exists in OpenLDAP < 2.5, and if we
# have 2.5 or later, we shouldn't even probe for ldap_r (we might find a
# library from a separate OpenLDAP installation). The most reliable
# way to check that is to check for a function introduced in 2.5.
ac_fn_c_check_func "$LINENO" "ldap_verify_credentials" "ac_cv_func_ldap_verify_credentials"
if test "x$ac_cv_func_ldap_verify_credentials" = xyes; then :
thread_safe_libldap=yes
else
thread_safe_libldap=no
fi
2023-07-11 14:20:37 -04:00
if test "$thread_safe_libldap" = no; then
2021-07-09 16:59:07 -04:00
# Use ldap_r for FE if available, else assume ldap is thread-safe.
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
LIBS="$_LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap_r" >&5
$as_echo_n "checking for ldap_bind in -lldap_r... " >&6; }
if ${ac_cv_lib_ldap_r_ldap_bind+:} false; then :
2015-07-08 17:05:45 -04:00
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
2021-07-09 16:59:07 -04:00
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2005-07-01 14:17:31 -04:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
2021-07-09 12:38:55 -04:00
char ldap_bind ();
2015-07-08 17:05:45 -04:00
int
main ()
{
2021-07-09 12:38:55 -04:00
return ldap_bind ();
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
2021-07-09 16:59:07 -04:00
ac_cv_lib_ldap_r_ldap_bind=yes
2015-07-08 17:05:45 -04:00
else
2021-07-09 16:59:07 -04:00
ac_cv_lib_ldap_r_ldap_bind=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2002-03-29 12:32:55 -05:00
fi
2021-07-09 16:59:07 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_bind" >&5
$as_echo "$ac_cv_lib_ldap_r_ldap_bind" >&6; }
if test "x$ac_cv_lib_ldap_r_ldap_bind" = xyes; then :
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
2013-12-18 20:53:23 -05:00
else
2021-07-09 16:59:07 -04:00
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
2015-07-08 17:05:45 -04:00
fi
2002-03-29 12:32:55 -05:00
2021-07-09 16:59:07 -04:00
else
2015-07-08 17:05:45 -04:00
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lwldap32" >&5
$as_echo_n "checking for ldap_bind in -lwldap32... " >&6; }
if ${ac_cv_lib_wldap32_ldap_bind+:} false; then :
$as_echo_n "(cached) " >&6
2002-07-27 16:10:05 -04:00
else
2015-07-08 17:05:45 -04:00
ac_check_lib_save_LIBS=$LIBS
LIBS="-lwldap32 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ldap_bind ();
int
main ()
{
return ldap_bind ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_wldap32_ldap_bind=yes
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_wldap32_ldap_bind=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wldap32_ldap_bind" >&5
$as_echo "$ac_cv_lib_wldap32_ldap_bind" >&6; }
if test "x$ac_cv_lib_wldap32_ldap_bind" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_LIBWLDAP32 1
2013-12-18 20:53:23 -05:00
_ACEOF
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
LIBS="-lwldap32 $LIBS"
2010-01-16 14:50:26 -05:00
2010-12-26 10:34:47 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'wldap32' is required for LDAP" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2010-12-26 10:34:47 -05:00
2015-07-08 17:05:45 -04:00
LDAP_LIBS_FE="-lwldap32"
LDAP_LIBS_BE="-lwldap32"
fi
LIBS="$_LIBS"
2010-12-26 10:34:47 -05:00
fi
2013-12-18 20:53:23 -05:00
2010-12-26 10:34:47 -05:00
2015-07-08 17:05:45 -04:00
# for contrib/sepgsql
if test "$with_selinux" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_compute_create_name in -lselinux" >&5
$as_echo_n "checking for security_compute_create_name in -lselinux... " >&6; }
if ${ac_cv_lib_selinux_security_compute_create_name+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lselinux $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-12-26 10:34:47 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char security_compute_create_name ();
int
main ()
{
return security_compute_create_name ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_selinux_security_compute_create_name=yes
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_selinux_security_compute_create_name=no
2010-12-26 10:34:47 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2010-12-26 10:34:47 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_compute_create_name" >&5
$as_echo "$ac_cv_lib_selinux_security_compute_create_name" >&6; }
if test "x$ac_cv_lib_selinux_security_compute_create_name" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_LIBSELINUX 1
2010-12-26 10:34:47 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
LIBS="-lselinux $LIBS"
2010-12-26 10:34:47 -05:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'libselinux', version 2.1.10 or newer, is required for SELinux support" "$LINENO" 5
2010-12-26 10:34:47 -05:00
fi
2002-04-10 18:47:09 -04:00
fi
2002-03-29 12:32:55 -05:00
2015-07-08 17:05:45 -04:00
# for contrib/uuid-ossp
if test "$with_uuid" = bsd ; then
# On BSD, the UUID functions are in libc
ac_fn_c_check_func "$LINENO" "uuid_to_string" "ac_cv_func_uuid_to_string"
if test "x$ac_cv_func_uuid_to_string" = xyes; then :
UUID_LIBS=""
else
as_fn_error $? "BSD UUID functions are not present" "$LINENO" 5
2010-09-29 15:38:04 -04:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
elif test "$with_uuid" = e2fs ; then
Refer to OS X as "macOS", except for the port name which is still "darwin".
We weren't terribly consistent about whether to call Apple's OS "OS X"
or "Mac OS X", and the former is probably confusing to people who aren't
Apple users. Now that Apple has rebranded it "macOS", follow their lead
to establish a consistent naming pattern. Also, avoid the use of the
ancient project name "Darwin", except as the port code name which does not
seem desirable to change. (In short, this patch touches documentation and
comments, but no actual code.)
I didn't touch contrib/start-scripts/osx/, either. I suspect those are
obsolete and due for a rewrite, anyway.
I dithered about whether to apply this edit to old release notes, but
those were responsible for quite a lot of the inconsistencies, so I ended
up changing them too. Anyway, Apple's being ahistorical about this,
so why shouldn't we be?
2016-09-25 15:40:57 -04:00
# On macOS, the UUID functions are in libc
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "uuid_generate" "ac_cv_func_uuid_generate"
if test "x$ac_cv_func_uuid_generate" = xyes; then :
UUID_LIBS=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_generate+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_generate ();
int
main ()
{
return uuid_generate ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_generate=yes
2008-02-18 20:05:28 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_uuid_uuid_generate=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate" >&5
$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate" = xyes; then :
UUID_LIBS="-luuid"
2008-02-18 20:05:28 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'uuid' is required for E2FS UUID" "$LINENO" 5
2008-02-18 20:05:28 -05:00
fi
fi
2012-12-18 16:22:13 -05:00
2015-07-08 17:05:45 -04:00
elif test "$with_uuid" = ossp ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_export in -lossp-uuid" >&5
$as_echo_n "checking for uuid_export in -lossp-uuid... " >&6; }
if ${ac_cv_lib_ossp_uuid_uuid_export+:} false; then :
$as_echo_n "(cached) " >&6
2012-12-18 16:22:13 -05:00
else
2015-07-08 17:05:45 -04:00
ac_check_lib_save_LIBS=$LIBS
LIBS="-lossp-uuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2008-02-18 20:05:28 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_export ();
int
main ()
{
return uuid_export ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ossp_uuid_uuid_export=yes
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_lib_ossp_uuid_uuid_export=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
2008-02-18 20:05:28 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossp_uuid_uuid_export" >&5
$as_echo "$ac_cv_lib_ossp_uuid_uuid_export" >&6; }
if test "x$ac_cv_lib_ossp_uuid_uuid_export" = xyes; then :
UUID_LIBS="-lossp-uuid"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_export in -luuid" >&5
$as_echo_n "checking for uuid_export in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_export+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2008-02-18 20:05:28 -05:00
2015-07-08 17:05:45 -04:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_export ();
int
main ()
{
return uuid_export ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_export=yes
else
ac_cv_lib_uuid_uuid_export=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_export" >&5
$as_echo "$ac_cv_lib_uuid_uuid_export" >&6; }
if test "x$ac_cv_lib_uuid_uuid_export" = xyes; then :
UUID_LIBS="-luuid"
2002-08-20 13:54:45 -04:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "library 'ossp-uuid' or 'uuid' is required for OSSP UUID" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
##
## Header files
##
2026-01-04 21:03:43 -05:00
for ac_header in copyfile.h execinfo.h getopt.h ifaddrs.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/ucred.h termios.h uchar.h ucred.h xlocale.h
2013-12-18 20:53:23 -05:00
do :
2015-07-08 17:05:45 -04:00
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
2005-07-01 14:17:31 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
fi
done
2015-07-08 17:05:45 -04:00
if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
for ac_header in readline/readline.h
2014-05-27 19:42:08 -04:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_readline_h" = xyes; then :
2014-05-27 19:42:08 -04:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_READLINE_READLINE_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
else
for ac_header in readline.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "readline.h" "ac_cv_header_readline_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_READLINE_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "readline header not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support." "$LINENO" 5
2014-05-27 19:42:08 -04:00
fi
2015-07-08 17:05:45 -04:00
done
2014-05-27 19:42:08 -04:00
fi
done
2015-07-08 17:05:45 -04:00
for ac_header in readline/history.h
2014-05-27 19:42:08 -04:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_history_h" = xyes; then :
2014-05-27 19:42:08 -04:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_READLINE_HISTORY_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
else
for ac_header in history.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "history.h" "ac_cv_header_history_h" "$ac_includes_default"
if test "x$ac_cv_header_history_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_HISTORY_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "history header not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support." "$LINENO" 5
2014-05-27 19:42:08 -04:00
fi
2015-07-08 17:05:45 -04:00
done
fi
done
fi
if expr x"$pgac_cv_check_readline" : 'x-ledit' >/dev/null ; then
# Some installations of libedit usurp /usr/include/readline/, which seems
# bad practice, since in combined installations readline will have its headers
# there. We might have to resort to AC_EGREP checks to make sure we found
# the proper header...
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
if test "x$ac_cv_header_editline_readline_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_EDITLINE_READLINE_H 1
_ACEOF
2014-05-27 19:42:08 -04:00
else
2015-07-08 17:05:45 -04:00
for ac_header in readline.h
2014-05-27 19:42:08 -04:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "readline.h" "ac_cv_header_readline_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_h" = xyes; then :
2014-05-27 19:42:08 -04:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_READLINE_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
else
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_readline_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_READLINE_READLINE_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "readline header not found
If you have libedit already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable libedit support." "$LINENO" 5
2014-05-27 19:42:08 -04:00
fi
2015-07-08 17:05:45 -04:00
done
2014-05-27 19:42:08 -04:00
fi
done
fi
done
2015-07-08 17:05:45 -04:00
# Note: in a libedit installation, history.h is sometimes a dummy, and may
# not be there at all. Hence, don't complain if not found. We must check
# though, since in yet other versions it is an independent header.
for ac_header in editline/history.h
2013-12-18 20:53:23 -05:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "editline/history.h" "ac_cv_header_editline_history_h" "$ac_includes_default"
if test "x$ac_cv_header_editline_history_h" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_EDITLINE_HISTORY_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
2014-05-27 19:42:08 -04:00
else
2015-07-08 17:05:45 -04:00
for ac_header in history.h
2013-12-18 20:53:23 -05:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "history.h" "ac_cv_header_history_h" "$ac_includes_default"
if test "x$ac_cv_header_history_h" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_HISTORY_H 1
2013-12-18 20:53:23 -05:00
_ACEOF
2014-05-27 19:42:08 -04:00
2015-07-08 17:05:45 -04:00
else
for ac_header in readline/history.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default"
if test "x$ac_cv_header_readline_history_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_READLINE_HISTORY_H 1
2014-05-27 19:42:08 -04:00
_ACEOF
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
done
2013-12-18 20:53:23 -05:00
fi
done
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
done
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
if test "$with_zlib" = yes; then
ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
if test "x$ac_cv_header_zlib_h" = xyes; then :
else
as_fn_error $? "zlib header not found
If you have zlib already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support." "$LINENO" 5
fi
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
fi
2022-02-13 20:40:34 -05:00
if test -z "$LZ4"; then
for ac_prog in lz4
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_LZ4+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LZ4 in
[\\/]* | ?:[\\/]*)
ac_cv_path_LZ4="$LZ4" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_LZ4="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
LZ4=$ac_cv_path_LZ4
if test -n "$LZ4"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LZ4" >&5
$as_echo "$LZ4" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$LZ4" && break
done
else
# Report the value of LZ4 in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4" >&5
$as_echo_n "checking for LZ4... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LZ4" >&5
$as_echo "$LZ4" >&6; }
fi
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
if test "$with_lz4" = yes; then
ac_fn_c_check_header_mongrel "$LINENO" "lz4.h" "ac_cv_header_lz4_h" "$ac_includes_default"
if test "x$ac_cv_header_lz4_h" = xyes; then :
else
as_fn_error $? "lz4.h header file is required for LZ4" "$LINENO" 5
fi
2022-02-18 13:40:31 -05:00
fi
if test -z "$ZSTD"; then
for ac_prog in zstd
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZSTD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZSTD in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZSTD="$ZSTD" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZSTD="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ZSTD=$ac_cv_path_ZSTD
if test -n "$ZSTD"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZSTD" >&5
$as_echo "$ZSTD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ZSTD" && break
done
else
# Report the value of ZSTD in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD" >&5
$as_echo_n "checking for ZSTD... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZSTD" >&5
$as_echo "$ZSTD" >&6; }
fi
if test "$with_zstd" = yes; then
ac_fn_c_check_header_mongrel "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
if test "x$ac_cv_header_zstd_h" = xyes; then :
else
as_fn_error $? "zstd.h header file is required for ZSTD" "$LINENO" 5
fi
Allow configurable LZ4 TOAST compression.
There is now a per-column COMPRESSION option which can be set to pglz
(the default, and the only option in up until now) or lz4. Or, if you
like, you can set the new default_toast_compression GUC to lz4, and
then that will be the default for new table columns for which no value
is specified. We don't have lz4 support in the PostgreSQL code, so
to use lz4 compression, PostgreSQL must be built --with-lz4.
In general, TOAST compression means compression of individual column
values, not the whole tuple, and those values can either be compressed
inline within the tuple or compressed and then stored externally in
the TOAST table, so those properties also apply to this feature.
Prior to this commit, a TOAST pointer has two unused bits as part of
the va_extsize field, and a compessed datum has two unused bits as
part of the va_rawsize field. These bits are unused because the length
of a varlena is limited to 1GB; we now use them to indicate the
compression type that was used. This means we only have bit space for
2 more built-in compresison types, but we could work around that
problem, if necessary, by introducing a new vartag_external value for
any further types we end up wanting to add. Hopefully, it won't be
too important to offer a wide selection of algorithms here, since
each one we add not only takes more coding but also adds a build
dependency for every packager. Nevertheless, it seems worth doing
at least this much, because LZ4 gets better compression than PGLZ
with less CPU usage.
It's possible for LZ4-compressed datums to leak into composite type
values stored on disk, just as it is for PGLZ. It's also possible for
LZ4-compressed attributes to be copied into a different table via SQL
commands such as CREATE TABLE AS or INSERT .. SELECT. It would be
expensive to force such values to be decompressed, so PostgreSQL has
never done so. For the same reasons, we also don't force recompression
of already-compressed values even if the target table prefers a
different compression method than was used for the source data. These
architectural decisions are perhaps arguable but revisiting them is
well beyond the scope of what seemed possible to do as part of this
project. However, it's relatively cheap to recompress as part of
VACUUM FULL or CLUSTER, so this commit adjusts those commands to do
so, if the configured compression method of the table happens not to
match what was used for some column value stored therein.
Dilip Kumar. The original patches on which this work was based were
written by Ildus Kurbangaliev, and those were patches were based on
even earlier work by Nikita Glukhov, but the design has since changed
very substantially, since allow a potentially large number of
compression methods that could be added and dropped on a running
system proved too problematic given some of the architectural issues
mentioned above; the choice of which specific compression method to
add first is now different; and a lot of the code has been heavily
refactored. More recently, Justin Przyby helped quite a bit with
testing and reviewing and this version also includes some code
contributions from him. Other design input and review from Tomas
Vondra, Álvaro Herrera, Andres Freund, Oleg Bartunov, Alexander
Korotkov, and me.
Discussion: http://postgr.es/m/20170907194236.4cefce96%40wp.localdomain
Discussion: http://postgr.es/m/CAFiTN-uUpX3ck%3DK0mLEk-G_kUQY%3DSNOTeqdaNRR9FMdQrHKebw%40mail.gmail.com
2021-03-19 15:10:38 -04:00
fi
2015-07-08 17:05:45 -04:00
if test "$with_gssapi" = yes ; then
for ac_header in gssapi/gssapi.h
2013-12-18 20:53:23 -05:00
do :
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi.h" "ac_cv_header_gssapi_gssapi_h" "$ac_includes_default"
if test "x$ac_cv_header_gssapi_gssapi_h" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_GSSAPI_GSSAPI_H 1
_ACEOF
else
for ac_header in gssapi.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default"
if test "x$ac_cv_header_gssapi_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GSSAPI_H 1
2010-01-16 14:50:26 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
else
as_fn_error $? "gssapi.h header file is required for GSSAPI" "$LINENO" 5
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
done
2010-01-16 14:50:26 -05:00
fi
2023-04-13 08:55:13 -04:00
done
for ac_header in gssapi/gssapi_ext.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi_ext.h" "ac_cv_header_gssapi_gssapi_ext_h" "$ac_includes_default"
if test "x$ac_cv_header_gssapi_gssapi_ext_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GSSAPI_GSSAPI_EXT_H 1
_ACEOF
else
for ac_header in gssapi_ext.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "gssapi_ext.h" "ac_cv_header_gssapi_ext_h" "$ac_includes_default"
if test "x$ac_cv_header_gssapi_ext_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GSSAPI_EXT_H 1
_ACEOF
else
as_fn_error $? "gssapi_ext.h header file is required for GSSAPI" "$LINENO" 5
fi
done
fi
2015-07-08 17:05:45 -04:00
done
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
fi
2013-12-18 20:53:23 -05:00
2022-10-20 15:01:05 -04:00
if test -z "$OPENSSL"; then
for ac_prog in openssl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_OPENSSL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $OPENSSL in
[\\/]* | ?:[\\/]*)
ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
OPENSSL=$ac_cv_path_OPENSSL
if test -n "$OPENSSL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
$as_echo "$OPENSSL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$OPENSSL" && break
done
else
# Report the value of OPENSSL in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5
$as_echo_n "checking for OPENSSL... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
$as_echo "$OPENSSL" >&6; }
fi
2023-10-24 20:26:22 -04:00
pgac_openssl_version="$($OPENSSL version 2> /dev/null || echo openssl not found)"
{ $as_echo "$as_me:${as_lineno-$LINENO}: using openssl: $pgac_openssl_version" >&5
$as_echo "$as_me: using openssl: $pgac_openssl_version" >&6;}
2021-02-01 05:19:44 -05:00
if test "$with_ssl" = openssl ; then
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
else
as_fn_error $? "header file <openssl/ssl.h> is required for OpenSSL" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default"
if test "x$ac_cv_header_openssl_err_h" = xyes; then :
2004-04-23 14:15:55 -04:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <openssl/err.h> is required for OpenSSL" "$LINENO" 5
2004-04-23 14:15:55 -04:00
fi
2015-07-08 17:05:45 -04:00
2013-12-18 20:53:23 -05:00
fi
2004-04-23 14:15:55 -04:00
2015-07-08 17:05:45 -04:00
if test "$with_pam" = yes ; then
for ac_header in security/pam_appl.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default"
if test "x$ac_cv_header_security_pam_appl_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SECURITY_PAM_APPL_H 1
2009-01-06 10:38:44 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
else
for ac_header in pam/pam_appl.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "pam/pam_appl.h" "ac_cv_header_pam_pam_appl_h" "$ac_includes_default"
if test "x$ac_cv_header_pam_pam_appl_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PAM_PAM_APPL_H 1
2009-01-06 10:38:44 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
2009-01-06 10:38:44 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM." "$LINENO" 5
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2009-01-06 10:38:44 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2016-04-08 13:51:54 -04:00
fi
if test "$with_bsd_auth" = yes ; then
ac_fn_c_check_header_mongrel "$LINENO" "bsd_auth.h" "ac_cv_header_bsd_auth_h" "$ac_includes_default"
if test "x$ac_cv_header_bsd_auth_h" = xyes; then :
else
as_fn_error $? "header file <bsd_auth.h> is required for BSD Authentication support" "$LINENO" 5
fi
2015-11-17 06:46:17 -05:00
fi
if test "$with_systemd" = yes ; then
ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-daemon.h" "ac_cv_header_systemd_sd_daemon_h" "$ac_includes_default"
if test "x$ac_cv_header_systemd_sd_daemon_h" = xyes; then :
else
as_fn_error $? "header file <systemd/sd-daemon.h> is required for systemd support" "$LINENO" 5
fi
2004-04-23 14:15:55 -04:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_libxml" = yes ; then
ac_fn_c_check_header_mongrel "$LINENO" "libxml/parser.h" "ac_cv_header_libxml_parser_h" "$ac_includes_default"
if test "x$ac_cv_header_libxml_parser_h" = xyes; then :
2013-12-18 20:53:23 -05:00
2003-06-18 12:04:15 -04:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <libxml/parser.h> is required for XML support" "$LINENO" 5
2003-06-18 12:04:15 -04:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_libxslt" = yes ; then
ac_fn_c_check_header_mongrel "$LINENO" "libxslt/xslt.h" "ac_cv_header_libxslt_xslt_h" "$ac_includes_default"
if test "x$ac_cv_header_libxslt_xslt_h" = xyes; then :
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <libxslt/xslt.h> is required for XSLT support" "$LINENO" 5
2009-01-06 10:38:44 -05:00
fi
2015-07-08 17:05:45 -04:00
2009-01-06 10:38:44 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
if test "$with_ldap" = yes ; then
if test "$PORTNAME" != "win32"; then
2022-08-18 13:41:42 -04:00
ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
2015-07-08 17:05:45 -04:00
if test "x$ac_cv_header_ldap_h" = xyes; then :
2010-01-16 14:50:26 -05:00
2012-01-07 15:38:52 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <ldap.h> is required for LDAP" "$LINENO" 5
2012-01-07 15:38:52 -05:00
fi
2012-12-18 16:22:13 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compatible LDAP implementation" >&5
$as_echo_n "checking for compatible LDAP implementation... " >&6; }
if ${pgac_cv_ldap_safe+:} false; then :
2014-11-23 09:34:03 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2014-11-23 09:34:03 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <ldap.h>
#if !defined(LDAP_VENDOR_VERSION) || \
(defined(LDAP_API_FEATURE_X_OPENLDAP) && \
LDAP_VENDOR_VERSION >= 20424 && LDAP_VENDOR_VERSION <= 20431)
choke me
#endif
2014-11-23 09:34:03 -05:00
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2015-07-08 17:05:45 -04:00
pgac_cv_ldap_safe=yes
2014-11-23 09:34:03 -05:00
else
2015-07-08 17:05:45 -04:00
pgac_cv_ldap_safe=no
2014-11-23 09:34:03 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_ldap_safe" >&5
$as_echo "$pgac_cv_ldap_safe" >&6; }
2014-11-23 09:34:03 -05:00
2015-07-08 17:05:45 -04:00
if test "$pgac_cv_ldap_safe" != yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend
*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and
*** also uses LDAP will crash on exit." >&5
$as_echo "$as_me: WARNING:
*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend
*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and
*** also uses LDAP will crash on exit." >&2;}
fi
else
2022-08-18 13:41:42 -04:00
ac_fn_c_check_header_compile "$LINENO" "winldap.h" "ac_cv_header_winldap_h" "$ac_includes_default
2015-07-08 17:05:45 -04:00
#include <windows.h>
2012-12-18 16:22:13 -05:00
2015-07-08 17:05:45 -04:00
"
if test "x$ac_cv_header_winldap_h" = xyes; then :
2012-12-18 16:22:13 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <winldap.h> is required for LDAP" "$LINENO" 5
2012-12-18 16:22:13 -05:00
fi
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
fi
2012-12-18 16:22:13 -05:00
2015-07-08 17:05:45 -04:00
if test "$with_bonjour" = yes ; then
ac_fn_c_check_header_mongrel "$LINENO" "dns_sd.h" "ac_cv_header_dns_sd_h" "$ac_includes_default"
if test "x$ac_cv_header_dns_sd_h" = xyes; then :
2012-12-18 16:22:13 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <dns_sd.h> is required for Bonjour" "$LINENO" 5
2012-12-18 16:22:13 -05:00
fi
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
# for contrib/uuid-ossp
if test "$with_uuid" = bsd ; then
for ac_header in uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_H 1
_ACEOF
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2012-12-18 16:22:13 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <uuid.h>
2012-12-18 16:22:13 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uuid_to_string" >/dev/null 2>&1; then :
2012-12-18 16:22:13 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <uuid.h> does not match BSD UUID library" "$LINENO" 5
2012-01-07 15:38:52 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f conftest*
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <uuid.h> is required for BSD UUID" "$LINENO" 5
2004-03-20 11:11:22 -05:00
fi
2009-01-06 10:38:44 -05:00
2015-07-08 17:05:45 -04:00
done
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
elif test "$with_uuid" = e2fs ; then
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_UUID_H 1
_ACEOF
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2013-12-18 20:53:23 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <uuid/uuid.h>
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uuid_generate" >/dev/null 2>&1; then :
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <uuid/uuid.h> does not match E2FS UUID library" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f conftest*
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
for ac_header in uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_H 1
_ACEOF
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2013-12-18 20:53:23 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <uuid.h>
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uuid_generate" >/dev/null 2>&1; then :
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <uuid.h> does not match E2FS UUID library" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f conftest*
else
as_fn_error $? "header file <uuid/uuid.h> or <uuid.h> is required for E2FS UUID" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
done
2010-01-16 14:50:26 -05:00
2015-02-10 03:54:40 -05:00
fi
2015-07-08 17:05:45 -04:00
done
elif test "$with_uuid" = ossp ; then
for ac_header in ossp/uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "ossp/uuid.h" "ac_cv_header_ossp_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_ossp_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OSSP_UUID_H 1
_ACEOF
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2015-02-10 03:54:40 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <ossp/uuid.h>
2015-02-10 03:54:40 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uuid_export" >/dev/null 2>&1; then :
2015-02-10 03:54:40 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <ossp/uuid.h> does not match OSSP UUID library" "$LINENO" 5
2015-02-10 03:54:40 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f conftest*
2015-02-10 03:54:40 -05:00
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
for ac_header in uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_H 1
_ACEOF
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-01-06 10:38:44 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <uuid.h>
2013-12-18 20:53:23 -05:00
2004-03-20 11:11:22 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "uuid_export" >/dev/null 2>&1; then :
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
as_fn_error $? "header file <uuid.h> does not match OSSP UUID library" "$LINENO" 5
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f conftest*
else
as_fn_error $? "header file <ossp/uuid.h> or <uuid.h> is required for OSSP UUID" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
done
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
done
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
if test "$PORTNAME" = "win32" ; then
for ac_header in crtdefs.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "crtdefs.h" "ac_cv_header_crtdefs_h" "$ac_includes_default"
if test "x$ac_cv_header_crtdefs_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_CRTDEFS_H 1
_ACEOF
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
done
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
if test "$with_libcurl" = yes ; then
# Error out early if this platform can't support libpq-oauth.
if test "$ac_cv_header_sys_event_h" != yes -a "$ac_cv_header_sys_epoll_h" != yes; then
2025-05-05 16:25:46 -04:00
as_fn_error $? "client-side OAuth is not supported on this platform" "$LINENO" 5
oauth: Move the builtin flow into a separate module
The additional packaging footprint of the OAuth Curl dependency, as well
as the existence of libcurl in the address space even if OAuth isn't
ever used by a client, has raised some concerns. Split off this
dependency into a separate loadable module called libpq-oauth.
When configured using --with-libcurl, libpq.so searches for this new
module via dlopen(). End users may choose not to install the libpq-oauth
module, in which case the default flow is disabled.
For static applications using libpq.a, the libpq-oauth staticlib is a
mandatory link-time dependency for --with-libcurl builds. libpq.pc has
been updated accordingly.
The default flow relies on some libpq internals. Some of these can be
safely duplicated (such as the SIGPIPE handlers), but others need to be
shared between libpq and libpq-oauth for thread-safety. To avoid
exporting these internals to all libpq clients forever, these
dependencies are instead injected from the libpq side via an
initialization function. This also lets libpq communicate the offsets of
PGconn struct members to libpq-oauth, so that we can function without
crashing if the module on the search path came from a different build of
Postgres. (A minor-version upgrade could swap the libpq-oauth module out
from under a long-running libpq client before it does its first load of
the OAuth flow.)
This ABI is considered "private". The module has no SONAME or version
symlinks, and it's named libpq-oauth-<major>.so to avoid mixing and
matching across Postgres versions. (Future improvements may promote this
"OAuth flow plugin" to a first-class concept, at which point we would
need a public API to replace this anyway.)
Additionally, NLS support for error messages in b3f0be788a was
incomplete, because the new error macros weren't being scanned by
xgettext. Fix that now.
Per request from Tom Lane and Bruce Momjian. Based on an initial patch
by Daniel Gustafsson, who also contributed docs changes. The "bare"
dlopen() concept came from Thomas Munro. Many people reviewed the design
and implementation; thank you!
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Wolfgang Walther <walther@technowledgy.de>
Discussion: https://postgr.es/m/641687.1742360249%40sss.pgh.pa.us
2025-05-01 12:14:30 -04:00
fi
fi
2015-07-08 17:05:45 -04:00
##
## Types, structures, compiler characteristics
##
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
if ${ac_cv_c_bigendian+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
ac_cv_c_bigendian=unknown
# See if we're dealing with a universal compiler.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2010-01-16 14:50:26 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#ifndef __APPLE_CC__
not a universal capable compiler
#endif
typedef int dummy;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
# Check for potential -arch flags. It is not universal unless
# there are at least two -arch flags with different values.
ac_arch=
ac_prev=
for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
if test -n "$ac_prev"; then
case $ac_word in
i?86 | x86_64 | ppc | ppc64)
if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
ac_arch=$ac_word
else
ac_cv_c_bigendian=universal
break
fi
;;
esac
ac_prev=
elif test "x$ac_word" = "x-arch"; then
ac_prev=arch
fi
done
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_c_bigendian = unknown; then
# See if sys/param.h defines the BYTE_ORDER macro.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/param.h>
2010-01-16 14:50:26 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
&& defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
&& LITTLE_ENDIAN)
bogus endian macros
#endif
2013-12-18 20:53:23 -05:00
2010-01-16 14:50:26 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2015-07-08 17:05:45 -04:00
# It does; now see whether it defined to BIG_ENDIAN or not.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2010-01-16 14:50:26 -05:00
/* end confdefs.h. */
2013-12-18 20:53:23 -05:00
#include <sys/types.h>
2015-07-08 17:05:45 -04:00
#include <sys/param.h>
2013-12-18 20:53:23 -05:00
2010-01-16 14:50:26 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
2010-01-16 14:50:26 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_c_bigendian=yes
2010-01-16 14:50:26 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_c_bigendian=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $ac_cv_c_bigendian = unknown; then
# See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <limits.h>
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
int
main ()
{
#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
bogus endian macros
#endif
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
2010-01-16 14:50:26 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_compile "$LINENO"; then :
# It does; now see whether it defined to _BIG_ENDIAN or not.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2013-12-18 20:53:23 -05:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <limits.h>
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
#ifndef _BIG_ENDIAN
not big endian
#endif
2013-12-18 20:53:23 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_bigendian=yes
2009-01-06 10:38:44 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_c_bigendian=no
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2009-01-06 10:38:44 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test $ac_cv_c_bigendian = unknown; then
# Compile a test program.
if test "$cross_compiling" = yes; then :
# Try to guess by grepping values from an object file.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
short int ascii_mm[] =
{ 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short int ascii_ii[] =
{ 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
int use_ascii (int i) {
return ascii_mm[i] + ascii_ii[i];
}
short int ebcdic_ii[] =
{ 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short int ebcdic_mm[] =
{ 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
int use_ebcdic (int i) {
return ebcdic_mm[i] + ebcdic_ii[i];
}
extern int foo;
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
int
main ()
{
return use_ascii (foo) == use_ebcdic (foo);
;
return 0;
}
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_compile "$LINENO"; then :
if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
ac_cv_c_bigendian=yes
fi
if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
if test "$ac_cv_c_bigendian" = unknown; then
ac_cv_c_bigendian=no
else
# finding both strings is unlikely to happen, but who knows?
ac_cv_c_bigendian=unknown
fi
fi
2004-03-20 11:11:22 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
2004-03-20 11:11:22 -05:00
2015-07-08 17:05:45 -04:00
/* Are we little or big endian? From Harbison&Steele. */
union
{
long int l;
char c[sizeof (long int)];
} u;
u.l = 1;
return u.c[sizeof (long int) - 1] == 1;
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_c_bigendian=no
else
ac_cv_c_bigendian=yes
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2009-01-06 10:38:44 -05:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
fi
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
$as_echo "$ac_cv_c_bigendian" >&6; }
case $ac_cv_c_bigendian in #(
yes)
$as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
;; #(
no)
;; #(
universal)
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
;; #(
*)
as_fn_error $? "unknown endianness
presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
esac
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
$as_echo_n "checking for inline... " >&6; }
if ${ac_cv_c_inline+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
static $ac_kw foo_t static_foo () {return 0; }
$ac_kw foo_t foo () {return 0; }
2013-12-18 20:53:23 -05:00
#endif
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_inline=$ac_kw
2010-01-16 14:50:26 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$ac_cv_c_inline" != no && break
done
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
$as_echo "$ac_cv_c_inline" >&6; }
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
case $ac_cv_c_inline in
inline | yes) ;;
*)
case $ac_cv_c_inline in
no) ac_val=;;
*) ac_val=$ac_cv_c_inline;;
esac
cat >>confdefs.h <<_ACEOF
#ifndef __cplusplus
#define inline $ac_val
#endif
2006-07-27 09:20:24 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
;;
esac
2006-07-27 09:20:24 -04:00
2025-12-10 17:09:10 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C printf format archetype" >&5
$as_echo_n "checking for C printf format archetype... " >&6; }
2015-07-08 17:05:45 -04:00
if ${pgac_cv_printf_archetype+:} false; then :
$as_echo_n "(cached) " >&6
2006-09-08 23:15:40 -04:00
else
2018-10-09 11:10:07 -04:00
pgac_cv_printf_archetype=gnu_printf
ac_save_c_werror_flag=$ac_c_werror_flag
2015-07-08 17:05:45 -04:00
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2006-09-08 23:15:40 -04:00
/* end confdefs.h. */
2018-10-09 11:10:07 -04:00
extern void pgac_write(int ignore, const char *fmt,...)
__attribute__((format($pgac_cv_printf_archetype, 2, 3)));
2006-09-08 23:15:40 -04:00
int
main ()
{
2018-10-09 11:10:07 -04:00
pgac_write(0, "error %s: %m", "foo");
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_archetype_ok=yes
else
ac_archetype_ok=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
2013-12-18 20:53:23 -05:00
2018-10-09 11:10:07 -04:00
if [ "$ac_archetype_ok" = no ]; then
pgac_cv_printf_archetype=__syslog__
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void pgac_write(int ignore, const char *fmt,...)
__attribute__((format($pgac_cv_printf_archetype, 2, 3)));
int
main ()
{
pgac_write(0, "error %s: %m", "foo");
2006-09-08 23:15:40 -04:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2018-10-09 11:10:07 -04:00
ac_archetype_ok=yes
2015-07-08 17:05:45 -04:00
else
2018-10-09 11:10:07 -04:00
ac_archetype_ok=no
2013-12-18 20:53:23 -05:00
fi
2009-01-06 10:38:44 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2015-07-08 17:05:45 -04:00
ac_c_werror_flag=$ac_save_c_werror_flag
2018-10-09 11:10:07 -04:00
if [ "$ac_archetype_ok" = no ]; then
pgac_cv_printf_archetype=printf
fi
fi
2009-01-06 10:38:44 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_printf_archetype" >&5
$as_echo "$pgac_cv_printf_archetype" >&6; }
2002-07-27 16:10:05 -04:00
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
2025-12-10 17:09:10 -05:00
#define PG_C_PRINTF_ATTRIBUTE $pgac_cv_printf_archetype
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ printf format archetype" >&5
$as_echo_n "checking for C++ printf format archetype... " >&6; }
if ${pgac_cv_cxx_printf_archetype+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_cv_cxx_printf_archetype=gnu_printf
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void pgac_write(int ignore, const char *fmt,...)
__attribute__((format($pgac_cv_cxx_printf_archetype, 2, 3)));
int
main ()
{
pgac_write(0, "error %s: %m", "foo");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_archetype_ok=yes
else
ac_archetype_ok=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
if [ "$ac_archetype_ok" = no ]; then
pgac_cv_cxx_printf_archetype=__syslog__
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void pgac_write(int ignore, const char *fmt,...)
__attribute__((format($pgac_cv_cxx_printf_archetype, 2, 3)));
int
main ()
{
pgac_write(0, "error %s: %m", "foo");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_archetype_ok=yes
else
ac_archetype_ok=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
if [ "$ac_archetype_ok" = no ]; then
pgac_cv_cxx_printf_archetype=printf
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_cxx_printf_archetype" >&5
$as_echo "$pgac_cv_cxx_printf_archetype" >&6; }
cat >>confdefs.h <<_ACEOF
#define PG_CXX_PRINTF_ATTRIBUTE $pgac_cv_cxx_printf_archetype
2015-07-08 17:05:45 -04:00
_ACEOF
2009-01-06 10:38:44 -05:00
2025-12-15 05:43:11 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for statement expressions" >&5
$as_echo_n "checking for statement expressions... " >&6; }
if ${pgac_cv_statement_expressions+:} false; then :
2015-07-08 17:05:45 -04:00
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
int
main ()
{
({ _Static_assert(1, "foo"); })
;
return 0;
}
2005-07-01 14:17:31 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
2025-12-15 05:43:11 -05:00
pgac_cv_statement_expressions=yes
2015-07-08 17:05:45 -04:00
else
2025-12-15 05:43:11 -05:00
pgac_cv_statement_expressions=no
2015-07-08 17:05:45 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
2025-12-15 05:43:11 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_statement_expressions" >&5
$as_echo "$pgac_cv_statement_expressions" >&6; }
if test x"$pgac_cv_statement_expressions" = xyes ; then
2010-01-16 14:50:26 -05:00
2025-12-15 05:43:11 -05:00
$as_echo "#define HAVE_STATEMENT_EXPRESSIONS 1" >>confdefs.h
2013-12-18 20:53:23 -05:00
2017-03-09 15:18:59 -05:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof" >&5
$as_echo_n "checking for typeof... " >&6; }
if ${pgac_cv_c_typeof+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_cv_c_typeof=no
2025-01-05 05:30:48 -05:00
for pgac_kw in typeof __typeof__; do
2017-03-09 15:18:59 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int x = 0;
$pgac_kw(x) y;
y = x;
return y;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_c_typeof=$pgac_kw
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$pgac_cv_c_typeof" != no && break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_typeof" >&5
$as_echo "$pgac_cv_c_typeof" >&6; }
if test "$pgac_cv_c_typeof" != no; then
$as_echo "#define HAVE_TYPEOF 1" >>confdefs.h
if test "$pgac_cv_c_typeof" != typeof; then
2017-03-28 22:28:56 -04:00
cat >>confdefs.h <<_ACEOF
#define typeof $pgac_cv_c_typeof
_ACEOF
2017-03-09 15:18:59 -05:00
fi
2013-12-18 20:53:23 -05:00
fi
2026-02-04 02:39:55 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof_unqual" >&5
$as_echo_n "checking for typeof_unqual... " >&6; }
if ${pgac_cv_c_typeof_unqual+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_cv_c_typeof_unqual=no
for pgac_kw in typeof_unqual __typeof_unqual__; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int x = 0;
$pgac_kw(x) y;
y = x;
return y;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_c_typeof_unqual=$pgac_kw
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$pgac_cv_c_typeof_unqual" != no && break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_typeof_unqual" >&5
$as_echo "$pgac_cv_c_typeof_unqual" >&6; }
if test "$pgac_cv_c_typeof_unqual" != no; then
$as_echo "#define HAVE_TYPEOF_UNQUAL 1" >>confdefs.h
if test "$pgac_cv_c_typeof_unqual" != typeof_unqual; then
cat >>confdefs.h <<_ACEOF
#define typeof_unqual $pgac_cv_c_typeof_unqual
_ACEOF
fi
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_types_compatible_p" >&5
$as_echo_n "checking for __builtin_types_compatible_p... " >&6; }
if ${pgac_cv__types_compatible+:} false; then :
$as_echo_n "(cached) " >&6
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2010-01-16 14:50:26 -05:00
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
int x; static int y[__builtin_types_compatible_p(__typeof__(x), int)];
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_compile "$LINENO"; then :
2015-07-08 17:05:45 -04:00
pgac_cv__types_compatible=yes
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
pgac_cv__types_compatible=no
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2015-07-08 17:05:45 -04:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__types_compatible" >&5
$as_echo "$pgac_cv__types_compatible" >&6; }
if test x"$pgac_cv__types_compatible" = xyes ; then
2002-07-27 16:10:05 -04:00
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE__BUILTIN_TYPES_COMPATIBLE_P 1" >>confdefs.h
2002-07-27 16:10:05 -04:00
2019-02-13 14:10:06 -05:00
fi
2019-02-13 18:09:48 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_constant_p" >&5
$as_echo_n "checking for __builtin_constant_p... " >&6; }
if ${pgac_cv__builtin_constant_p+:} false; then :
2019-02-13 14:10:06 -05:00
$as_echo_n "(cached) " >&6
else
2019-02-13 18:09:48 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2019-02-13 14:10:06 -05:00
/* end confdefs.h. */
2019-02-13 18:09:48 -05:00
static int x;
static int y[__builtin_constant_p(x) ? x : 1];
static int z[__builtin_constant_p("string literal") ? 1 : x];
2019-02-13 14:10:06 -05:00
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
2019-02-13 18:09:48 -05:00
pgac_cv__builtin_constant_p=yes
2019-02-13 14:10:06 -05:00
else
2019-02-13 18:09:48 -05:00
pgac_cv__builtin_constant_p=no
2019-02-13 14:10:06 -05:00
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
2019-02-13 18:09:48 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_constant_p" >&5
$as_echo "$pgac_cv__builtin_constant_p" >&6; }
if test x"$pgac_cv__builtin_constant_p" = xyes ; then
2019-02-13 14:10:06 -05:00
2019-02-13 18:09:48 -05:00
$as_echo "#define HAVE__BUILTIN_CONSTANT_P 1" >>confdefs.h
2019-02-13 14:10:06 -05:00
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_mul_overflow" >&5
$as_echo_n "checking for __builtin_mul_overflow... " >&6; }
if ${pgac_cv__builtin_op_overflow+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdint.h>
int64_t a = 1;
int64_t b = 1;
int64_t result;
int oflo;
int
main ()
{
oflo = __builtin_mul_overflow(a, b, &result);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_op_overflow=yes
else
pgac_cv__builtin_op_overflow=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_op_overflow" >&5
$as_echo "$pgac_cv__builtin_op_overflow" >&6; }
if test x"$pgac_cv__builtin_op_overflow" = xyes ; then
$as_echo "#define HAVE__BUILTIN_OP_OVERFLOW 1" >>confdefs.h
2019-02-13 14:10:06 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unreachable" >&5
$as_echo_n "checking for __builtin_unreachable... " >&6; }
if ${pgac_cv__builtin_unreachable+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
__builtin_unreachable();
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2015-07-08 17:05:45 -04:00
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_unreachable=yes
else
pgac_cv__builtin_unreachable=no
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_unreachable" >&5
$as_echo "$pgac_cv__builtin_unreachable" >&6; }
if test x"$pgac_cv__builtin_unreachable" = xyes ; then
$as_echo "#define HAVE__BUILTIN_UNREACHABLE 1" >>confdefs.h
2017-03-20 13:35:21 -04:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for computed goto support" >&5
$as_echo_n "checking for computed goto support... " >&6; }
if ${pgac_cv_computed_goto+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
void *labeladdrs[] = {&&my_label};
goto *labeladdrs[0];
my_label:
return 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_computed_goto=yes
else
pgac_cv_computed_goto=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_computed_goto" >&5
$as_echo "$pgac_cv_computed_goto" >&6; }
if test x"$pgac_cv_computed_goto" = xyes ; then
$as_echo "#define HAVE_COMPUTED_GOTO 1" >>confdefs.h
2015-07-08 17:05:45 -04:00
fi
ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
2019-10-07 10:28:56 -04:00
#include <time.h>
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
"
if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_STRUCT_TM_TM_ZONE 1
2010-01-16 14:50:26 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
fi
2002-03-29 12:32:55 -05:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_type "$LINENO" "union semun" "ac_cv_type_union_semun" "#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
2022-08-13 07:34:12 -04:00
2015-07-08 17:05:45 -04:00
"
if test "x$ac_cv_type_union_semun" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UNION_SEMUN 1
_ACEOF
2021-11-09 09:20:47 -05:00
fi
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/socket.h>
"
if test "x$ac_cv_type_socklen_t" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SOCKLEN_T 1
_ACEOF
2013-12-18 20:53:23 -05:00
fi
2005-08-20 19:26:37 -04:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include <sys/types.h>
#include <sys/socket.h>
"
if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
2013-12-18 20:53:23 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
2005-08-20 19:26:37 -04:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
2026-01-14 09:12:25 -05:00
# MSVC doesn't cope well with defining restrict to __restrict, the
# spelling it understands, because it conflicts with
# __declspec(restrict) in C++ mode. Therefore we define pg_restrict to
# the appropriate definition, which presumably won't conflict.
2017-10-12 18:25:38 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
if ${ac_cv_c_restrict+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_c_restrict=no
# The order here caters to the fact that C++ does not require restrict.
for ac_kw in __restrict __restrict__ _Restrict restrict; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
typedef int * int_ptr;
int foo (int_ptr $ac_kw ip) {
return ip[0];
}
int
main ()
{
int s[1];
int * $ac_kw t = s;
t[0] = 0;
return foo(t)
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_restrict=$ac_kw
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$ac_cv_c_restrict" != no && break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
$as_echo "$ac_cv_c_restrict" >&6; }
case $ac_cv_c_restrict in
restrict) ;;
no) $as_echo "#define restrict /**/" >>confdefs.h
;;
*) cat >>confdefs.h <<_ACEOF
#define restrict $ac_cv_c_restrict
_ACEOF
;;
esac
2026-01-14 09:12:25 -05:00
if test "$ac_cv_c_restrict" = "no"; then
pg_restrict=""
else
pg_restrict="$ac_cv_c_restrict"
fi
cat >>confdefs.h <<_ACEOF
#define pg_restrict $pg_restrict
_ACEOF
2017-10-12 18:25:38 -04:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_type "$LINENO" "struct option" "ac_cv_type_struct_option" "#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
"
if test "x$ac_cv_type_struct_option" = xyes; then :
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_OPTION 1
_ACEOF
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
case $host_cpu in
Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT.
Test for the compiler builtins __builtin_clz, __builtin_ctz, and
__builtin_popcount, and make use of these in preference to
handwritten C code if they're available. Create src/port
infrastructure for "leftmost one", "rightmost one", and "popcount"
so as to centralize these decisions.
On x86_64, __builtin_popcount generally won't make use of the POPCNT
opcode because that's not universally supported yet. Provide code
that checks CPUID and then calls POPCNT via asm() if available.
This requires indirecting through a function pointer, which is
an annoying amount of overhead for a one-instruction operation,
but it's probably not worth working harder than this for our
current use-cases.
I'm not sure we've found all the existing places that could profit
from this new infrastructure; but we at least touched all the
ones that used copied-and-pasted versions of the bitmapset.c code,
and got rid of multiple copies of the associated constant arrays.
While at it, replace c-compiler.m4's one-per-builtin-function
macros with a single one that can handle all the cases we need
to worry about so far. Also, because I'm paranoid, make those
checks into AC_LINK checks rather than just AC_COMPILE; the
former coding failed to verify that libgcc has support for the
builtin, in cases where it's not inline code.
David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane
Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
2019-02-15 23:22:27 -05:00
x86_64)
# On x86_64, check if we can compile a popcntq instruction
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports x86_64 popcntq" >&5
$as_echo_n "checking whether assembler supports x86_64 popcntq... " >&6; }
if ${pgac_cv_have_x86_64_popcntq+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
long long x = 1; long long r;
__asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_have_x86_64_popcntq=yes
else
pgac_cv_have_x86_64_popcntq=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_x86_64_popcntq" >&5
$as_echo "$pgac_cv_have_x86_64_popcntq" >&6; }
if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
$as_echo "#define HAVE_X86_64_POPCNTQ 1" >>confdefs.h
fi
;;
2015-07-08 17:05:45 -04:00
ppc*|powerpc*)
2022-08-13 13:36:39 -04:00
# On PPC, check if compiler accepts "i"(x) when __builtin_constant_p(x).
2019-10-18 23:20:52 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __builtin_constant_p(x) implies \"i\"(x) acceptance" >&5
$as_echo_n "checking whether __builtin_constant_p(x) implies \"i\"(x) acceptance... " >&6; }
if ${pgac_cv_have_i_constraint__builtin_constant_p+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
static inline int
addi(int ra, int si)
{
int res = 0;
if (__builtin_constant_p(si))
__asm__ __volatile__(
" addi %0,%1,%2\n" : "=r"(res) : "b"(ra), "i"(si));
return res;
}
int test_adds(int x) { return addi(3, x) + addi(x, 5); }
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_have_i_constraint__builtin_constant_p=yes
else
pgac_cv_have_i_constraint__builtin_constant_p=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_i_constraint__builtin_constant_p" >&5
$as_echo "$pgac_cv_have_i_constraint__builtin_constant_p" >&6; }
if test x"$pgac_cv_have_i_constraint__builtin_constant_p" = xyes ; then
$as_echo "#define HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P 1" >>confdefs.h
2015-07-08 17:05:45 -04:00
fi
;;
2008-02-17 11:36:43 -05:00
esac
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
# Check largefile support. You might think this is a system service not a
# compiler characteristic, but you'd be wrong. We must check this before
# probing existence of related functions such as fseeko, since the largefile
# defines can affect what is generated for that.
if test "$PORTNAME" != "win32"; then
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
if test "$enable_largefile" != no; then
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
if ${ac_cv_sys_largefile_CC+:} false; then :
$as_echo_n "(cached) " >&6
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
break
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext
CC="$CC -n32"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_largefile_CC=' -n32'; break
2007-11-15 23:59:25 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext
break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
fi
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
$as_echo "$ac_cv_sys_largefile_CC" >&6; }
if test "$ac_cv_sys_largefile_CC" != no; then
CC=$CC$ac_cv_sys_largefile_CC
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
if ${ac_cv_sys_file_offset_bits+:} false; then :
$as_echo_n "(cached) " >&6
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=no; break
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=64; break
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_file_offset_bits=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
_ACEOF
;;
2008-02-17 11:36:43 -05:00
esac
2015-07-08 17:05:45 -04:00
rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
if ${ac_cv_sys_large_files+:} false; then :
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
2005-07-01 14:17:31 -04:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=no; break
2000-12-27 18:59:14 -05:00
fi
2015-07-08 17:05:45 -04:00
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGE_FILES 1
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=1; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_large_files=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
$as_echo "$ac_cv_sys_large_files" >&6; }
case $ac_cv_sys_large_files in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _LARGE_FILES $ac_cv_sys_large_files
_ACEOF
;;
2013-12-18 20:53:23 -05:00
esac
2015-07-08 17:05:45 -04:00
rm -rf conftest*
fi
2013-12-18 20:53:23 -05:00
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
fi
2002-03-29 12:32:55 -05:00
2005-07-01 14:17:31 -04:00
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5
$as_echo_n "checking size of off_t... " >&6; }
if ${ac_cv_sizeof_off_t+:} false; then :
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then :
2000-12-27 18:59:14 -05:00
2015-07-08 17:05:45 -04:00
else
if test "$ac_cv_type_off_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (off_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_off_t=0
fi
2013-12-18 20:53:23 -05:00
fi
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5
$as_echo "$ac_cv_sizeof_off_t" >&6; }
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
_ACEOF
2010-01-16 14:50:26 -05:00
2022-12-07 22:32:59 -05:00
# If we don't have largefile support, can't handle segment size >= 2GB.
if test "$ac_cv_sizeof_off_t" -lt 8; then
2025-11-06 02:00:35 -05:00
if expr $RELSEG_SIZE '*' $blocksize '>=' 2 '*' 1024 '*' 1024 >/dev/null; then
2022-12-07 22:32:59 -05:00
as_fn_error $? "Large file support is not enabled. Segment size cannot be larger than 1GB." "$LINENO" 5
fi
2013-12-18 20:53:23 -05:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
##
## Functions, global variables
##
2015-03-14 14:08:45 -04:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for int timezone" >&5
$as_echo_n "checking for int timezone... " >&6; }
if ${pgac_cv_var_int_timezone+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
int res;
int
main ()
{
#ifndef __CYGWIN__
res = timezone / 60;
#else
res = _timezone / 60;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_var_int_timezone=yes
else
pgac_cv_var_int_timezone=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_int_timezone" >&5
$as_echo "$pgac_cv_var_int_timezone" >&6; }
if test x"$pgac_cv_var_int_timezone" = xyes ; then
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
2010-01-16 14:50:26 -05:00
Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>.
Previously, we included <xlocale.h> only if necessary to get the definition
of type locale_t. According to notes in PGAC_TYPE_LOCALE_T, this is
important because on some versions of glibc that file supplies an
incompatible declaration of locale_t. (This info may be obsolete, because
on my RHEL6 box that seems to be the *only* definition of locale_t; but
there may still be glibc's in the wild for which it's a live concern.)
It turns out though that on FreeBSD and maybe other BSDen, you can get
locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from
<xlocale.h>. This was leaving us compiling calls to mbstowcs_l() and
friends with no visible prototype, which causes a warning and could
possibly cause actual trouble, since it's not declared to return int.
Hence, adjust the configure checks so that we'll include <xlocale.h>
either if it's necessary to get type locale_t or if it's necessary to
get a declaration of mbstowcs_l().
Report and patch by Aleksander Alekseev, somewhat whacked around by me.
Back-patch to all supported branches, since we have been using
mbstowcs_l() since 9.1.
2016-03-15 13:19:57 -04:00
fi
2010-01-16 14:50:26 -05:00
2015-07-08 17:05:45 -04:00
# Some versions of libedit contain strlcpy(), setproctitle(), and other
# symbols that that library has no business exposing to the world. Pending
# acquisition of a clue by those developers, ignore libedit (including its
# possible alias of libreadline) while checking for everything else.
LIBS_including_readline="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
2010-01-16 14:50:26 -05:00
2025-05-18 12:45:55 -04:00
for ac_func in backtrace_symbols copyfile copy_file_range elf_aux_info getauxval getifaddrs getpeerucred inet_pton kqueue localeconv_l mbstowcs_l posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strsignal syncfs sync_file_range uselocale wcstombs_l
2015-07-08 17:05:45 -04:00
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
2002-03-29 12:32:55 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
fi
done
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT.
Test for the compiler builtins __builtin_clz, __builtin_ctz, and
__builtin_popcount, and make use of these in preference to
handwritten C code if they're available. Create src/port
infrastructure for "leftmost one", "rightmost one", and "popcount"
so as to centralize these decisions.
On x86_64, __builtin_popcount generally won't make use of the POPCNT
opcode because that's not universally supported yet. Provide code
that checks CPUID and then calls POPCNT via asm() if available.
This requires indirecting through a function pointer, which is
an annoying amount of overhead for a one-instruction operation,
but it's probably not worth working harder than this for our
current use-cases.
I'm not sure we've found all the existing places that could profit
from this new infrastructure; but we at least touched all the
ones that used copied-and-pasted versions of the bitmapset.c code,
and got rid of multiple copies of the associated constant arrays.
While at it, replace c-compiler.m4's one-per-builtin-function
macros with a single one that can handle all the cases we need
to worry about so far. Also, because I'm paranoid, make those
checks into AC_LINK checks rather than just AC_COMPILE; the
former coding failed to verify that libgcc has support for the
builtin, in cases where it's not inline code.
David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane
Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
2019-02-15 23:22:27 -05:00
# These typically are compiler builtins, for which AC_CHECK_FUNCS fails.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap16" >&5
$as_echo_n "checking for __builtin_bswap16... " >&6; }
if ${pgac_cv__builtin_bswap16+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap16(int x)
{
return __builtin_bswap16(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap16=yes
else
pgac_cv__builtin_bswap16=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap16" >&5
$as_echo "$pgac_cv__builtin_bswap16" >&6; }
if test x"${pgac_cv__builtin_bswap16}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP16 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap32" >&5
$as_echo_n "checking for __builtin_bswap32... " >&6; }
if ${pgac_cv__builtin_bswap32+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap32(int x)
{
return __builtin_bswap32(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap32=yes
else
pgac_cv__builtin_bswap32=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap32" >&5
$as_echo "$pgac_cv__builtin_bswap32" >&6; }
if test x"${pgac_cv__builtin_bswap32}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP32 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap64" >&5
$as_echo_n "checking for __builtin_bswap64... " >&6; }
if ${pgac_cv__builtin_bswap64+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap64(long int x)
{
return __builtin_bswap64(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap64=yes
else
pgac_cv__builtin_bswap64=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap64" >&5
$as_echo "$pgac_cv__builtin_bswap64" >&6; }
if test x"${pgac_cv__builtin_bswap64}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP64 1
_ACEOF
fi
# We assume that we needn't test all widths of these explicitly:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_clz" >&5
$as_echo_n "checking for __builtin_clz... " >&6; }
if ${pgac_cv__builtin_clz+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_clz(unsigned int x)
{
return __builtin_clz(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_clz=yes
else
pgac_cv__builtin_clz=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_clz" >&5
$as_echo "$pgac_cv__builtin_clz" >&6; }
if test x"${pgac_cv__builtin_clz}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_CLZ 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_ctz" >&5
$as_echo_n "checking for __builtin_ctz... " >&6; }
if ${pgac_cv__builtin_ctz+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_ctz(unsigned int x)
{
return __builtin_ctz(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_ctz=yes
else
pgac_cv__builtin_ctz=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_ctz" >&5
$as_echo "$pgac_cv__builtin_ctz" >&6; }
if test x"${pgac_cv__builtin_ctz}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_CTZ 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
$as_echo_n "checking for __builtin_popcount... " >&6; }
if ${pgac_cv__builtin_popcount+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_popcount(unsigned int x)
{
return __builtin_popcount(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_popcount=yes
else
pgac_cv__builtin_popcount=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_popcount" >&5
$as_echo "$pgac_cv__builtin_popcount" >&6; }
if test x"${pgac_cv__builtin_popcount}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_POPCOUNT 1
_ACEOF
2022-02-17 22:45:34 -05:00
fi
# __builtin_frame_address may draw a diagnostic for non-constant argument,
# so it needs a different test function.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_frame_address" >&5
$as_echo_n "checking for __builtin_frame_address... " >&6; }
if ${pgac_cv__builtin_frame_address+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
void *
call__builtin_frame_address(void)
{
return __builtin_frame_address(0);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_frame_address=yes
else
pgac_cv__builtin_frame_address=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_frame_address" >&5
$as_echo "$pgac_cv__builtin_frame_address" >&6; }
if test x"${pgac_cv__builtin_frame_address}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_FRAME_ADDRESS 1
_ACEOF
Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT.
Test for the compiler builtins __builtin_clz, __builtin_ctz, and
__builtin_popcount, and make use of these in preference to
handwritten C code if they're available. Create src/port
infrastructure for "leftmost one", "rightmost one", and "popcount"
so as to centralize these decisions.
On x86_64, __builtin_popcount generally won't make use of the POPCNT
opcode because that's not universally supported yet. Provide code
that checks CPUID and then calls POPCNT via asm() if available.
This requires indirecting through a function pointer, which is
an annoying amount of overhead for a one-instruction operation,
but it's probably not worth working harder than this for our
current use-cases.
I'm not sure we've found all the existing places that could profit
from this new infrastructure; but we at least touched all the
ones that used copied-and-pasted versions of the bitmapset.c code,
and got rid of multiple copies of the associated constant arrays.
While at it, replace c-compiler.m4's one-per-builtin-function
macros with a single one that can handle all the cases we need
to worry about so far. Also, because I'm paranoid, make those
checks into AC_LINK checks rather than just AC_COMPILE; the
former coding failed to verify that libgcc has support for the
builtin, in cases where it's not inline code.
David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane
Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
2019-02-15 23:22:27 -05:00
fi
2020-02-21 12:49:42 -05:00
# We require 64-bit fseeko() to be available, but run this check anyway
# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
2015-07-08 17:05:45 -04:00
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
if ${ac_cv_sys_largefile_source+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
while :; do
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <sys/types.h> /* for off_t */
#include <stdio.h>
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_sys_largefile_source=no; break
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#define _LARGEFILE_SOURCE 1
#include <sys/types.h> /* for off_t */
#include <stdio.h>
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
ac_cv_sys_largefile_source=1; break
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
2015-07-08 17:05:45 -04:00
ac_cv_sys_largefile_source=unknown
break
done
2002-03-29 12:32:55 -05:00
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
$as_echo "$ac_cv_sys_largefile_source" >&6; }
case $ac_cv_sys_largefile_source in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
_ACEOF
;;
esac
rm -rf conftest*
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
# in glibc 2.1.3, but that breaks too many other things.
# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
if test $ac_cv_sys_largefile_source != unknown; then
$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
fi
2020-02-21 12:49:42 -05:00
2002-03-29 12:32:55 -05:00
2022-07-23 17:32:34 -04:00
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
# by calling it, 2009-04-02
# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
2018-11-19 12:43:05 -05:00
# The Clang compiler raises a warning for an undeclared identifier that matches
# a compiler builtin function. All extant Clang versions are affected, as of
# Clang 3.6.0. Test a builtin known to every version. This problem affects the
# C and Objective C languages, but Clang does report an error under C++ and
# Objective C++.
#
# Passing -fno-builtin to the compiler would suppress this problem. That
# strategy would have the advantage of being insensitive to stray warnings, but
# it would make tests less realistic.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how $CC reports undeclared, standard C functions" >&5
$as_echo_n "checking how $CC reports undeclared, standard C functions... " >&6; }
if ${ac_cv_c_decl_report+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
(void) strchr;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
if test -s conftest.err; then :
# For AC_CHECK_DECL to react to warnings, the compiler must be silent on
# valid AC_CHECK_DECL input. No library function is consistently available
# on freestanding implementations, so test against a dummy declaration.
# Include always-available headers on the off chance that they somehow
# elicit warnings.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <float.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
extern void ac_decl (int, char *);
int
main ()
{
#ifdef __cplusplus
(void) ac_decl ((int) 0, (char *) 0);
(void) ac_decl;
#else
(void) ac_decl;
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
if test -s conftest.err; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot detect from compiler exit status or warnings
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_c_decl_report=warning
fi
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compile a simple declaration test
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "compiler does not report undeclared identifiers
See \`config.log' for more details" "$LINENO" 5; }
fi
else
ac_cv_c_decl_report=error
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_decl_report" >&5
$as_echo "$ac_cv_c_decl_report" >&6; }
case $ac_cv_c_decl_report in
warning) ac_c_decl_warn_flag=yes ;;
*) ac_c_decl_warn_flag= ;;
esac
2018-11-19 12:01:47 -05:00
if test "$PORTNAME" != "solaris"; then :
2015-07-08 17:05:45 -04:00
for ac_func in posix_fadvise
do :
ac_fn_c_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise"
if test "x$ac_cv_func_posix_fadvise" = xyes; then :
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
2015-07-08 17:05:45 -04:00
#define HAVE_POSIX_FADVISE 1
2002-03-29 12:32:55 -05:00
_ACEOF
2015-07-08 17:05:45 -04:00
2013-12-18 20:53:23 -05:00
fi
done
2015-07-08 17:05:45 -04:00
ac_fn_c_check_decl "$LINENO" "posix_fadvise" "ac_cv_have_decl_posix_fadvise" "#include <fcntl.h>
"
if test "x$ac_cv_have_decl_posix_fadvise" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_POSIX_FADVISE $ac_have_decl
2005-07-01 14:17:31 -04:00
_ACEOF
2015-07-08 17:05:45 -04:00
2018-11-19 12:01:47 -05:00
fi # fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_decl "$LINENO" "fdatasync" "ac_cv_have_decl_fdatasync" "#include <unistd.h>
"
if test "x$ac_cv_have_decl_fdatasync" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_FDATASYNC $ac_have_decl
_ACEOF
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_decl "$LINENO" "strlcat" "ac_cv_have_decl_strlcat" "$ac_includes_default"
if test "x$ac_cv_have_decl_strlcat" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRLCAT $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "strlcpy" "ac_cv_have_decl_strlcpy" "$ac_includes_default"
if test "x$ac_cv_have_decl_strlcpy" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRLCPY $ac_have_decl
_ACEOF
2024-07-22 03:47:02 -04:00
ac_fn_c_check_decl "$LINENO" "strsep" "ac_cv_have_decl_strsep" "$ac_includes_default"
if test "x$ac_cv_have_decl_strsep" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRSEP $ac_have_decl
_ACEOF
2025-04-02 08:32:40 -04:00
ac_fn_c_check_decl "$LINENO" "timingsafe_bcmp" "ac_cv_have_decl_timingsafe_bcmp" "$ac_includes_default"
if test "x$ac_cv_have_decl_timingsafe_bcmp" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_TIMINGSAFE_BCMP $ac_have_decl
_ACEOF
2015-07-08 17:05:45 -04:00
2021-07-12 19:17:35 -04:00
2023-11-28 22:44:19 -05:00
# We can't use AC_CHECK_FUNCS to detect these functions, because it
2021-07-12 19:17:35 -04:00
# won't handle deployment target restrictions on macOS
ac_fn_c_check_decl "$LINENO" "preadv" "ac_cv_have_decl_preadv" "#include <sys/uio.h>
"
if test "x$ac_cv_have_decl_preadv" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_PREADV $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "pwritev" "ac_cv_have_decl_pwritev" "#include <sys/uio.h>
"
if test "x$ac_cv_have_decl_pwritev" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_PWRITEV $ac_have_decl
_ACEOF
2025-04-01 16:49:51 -04:00
ac_fn_c_check_decl "$LINENO" "strchrnul" "ac_cv_have_decl_strchrnul" "#include <string.h>
"
if test "x$ac_cv_have_decl_strchrnul" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRCHRNUL $ac_have_decl
_ACEOF
2025-05-18 12:45:55 -04:00
ac_fn_c_check_decl "$LINENO" "memset_s" "ac_cv_have_decl_memset_s" "#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
"
if test "x$ac_cv_have_decl_memset_s" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_MEMSET_S $ac_have_decl
_ACEOF
2021-07-12 19:17:35 -04:00
Refer to OS X as "macOS", except for the port name which is still "darwin".
We weren't terribly consistent about whether to call Apple's OS "OS X"
or "Mac OS X", and the former is probably confusing to people who aren't
Apple users. Now that Apple has rebranded it "macOS", follow their lead
to establish a consistent naming pattern. Also, avoid the use of the
ancient project name "Darwin", except as the port code name which does not
seem desirable to change. (In short, this patch touches documentation and
comments, but no actual code.)
I didn't touch contrib/start-scripts/osx/, either. I suspect those are
obsolete and due for a rewrite, anyway.
I dithered about whether to apply this edit to old release notes, but
those were responsible for quite a lot of the inconsistencies, so I ended
up changing them too. Anyway, Apple's being ahistorical about this,
so why shouldn't we be?
2016-09-25 15:40:57 -04:00
# This is probably only present on macOS, but may as well check always
2015-07-08 17:05:45 -04:00
ac_fn_c_check_decl "$LINENO" "F_FULLFSYNC" "ac_cv_have_decl_F_FULLFSYNC" "#include <fcntl.h>
"
if test "x$ac_cv_have_decl_F_FULLFSYNC" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_F_FULLFSYNC $ac_have_decl
_ACEOF
2019-09-05 02:15:58 -04:00
ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
if test "x$ac_cv_func_explicit_bzero" = xyes; then :
$as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h
else
case " $LIBOBJS " in
*" explicit_bzero.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
;;
esac
fi
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt"
if test "x$ac_cv_func_getopt" = xyes; then :
$as_echo "#define HAVE_GETOPT 1" >>confdefs.h
2015-07-08 13:36:06 -04:00
else
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" getopt.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2019-10-30 07:58:32 -04:00
ac_fn_c_check_func "$LINENO" "getpeereid" "ac_cv_func_getpeereid"
if test "x$ac_cv_func_getpeereid" = xyes; then :
$as_echo "#define HAVE_GETPEEREID 1" >>confdefs.h
else
case " $LIBOBJS " in
*" getpeereid.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getpeereid.$ac_objext"
;;
esac
fi
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton"
if test "x$ac_cv_func_inet_aton" = xyes; then :
$as_echo "#define HAVE_INET_ATON 1" >>confdefs.h
2013-12-18 20:53:23 -05:00
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" inet_aton.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS inet_aton.$ac_objext"
;;
esac
fi
ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"
if test "x$ac_cv_func_mkdtemp" = xyes; then :
$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" mkdtemp.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS mkdtemp.$ac_objext"
;;
esac
2005-07-01 14:17:31 -04:00
2007-11-15 23:59:25 -05:00
fi
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
$as_echo "#define HAVE_STRLCAT 1" >>confdefs.h
2015-07-08 13:36:06 -04:00
2015-07-08 17:05:45 -04:00
else
case " $LIBOBJS " in
*" strlcat.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strlcat.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy"
if test "x$ac_cv_func_strlcpy" = xyes; then :
$as_echo "#define HAVE_STRLCPY 1" >>confdefs.h
else
case " $LIBOBJS " in
*" strlcpy.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strlcpy.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2024-07-22 03:47:02 -04:00
ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep"
if test "x$ac_cv_func_strsep" = xyes; then :
$as_echo "#define HAVE_STRSEP 1" >>confdefs.h
else
case " $LIBOBJS " in
*" strsep.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strsep.$ac_objext"
;;
esac
fi
2025-04-02 08:32:40 -04:00
ac_fn_c_check_func "$LINENO" "timingsafe_bcmp" "ac_cv_func_timingsafe_bcmp"
if test "x$ac_cv_func_timingsafe_bcmp" = xyes; then :
$as_echo "#define HAVE_TIMINGSAFE_BCMP 1" >>confdefs.h
else
case " $LIBOBJS " in
*" timingsafe_bcmp.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS timingsafe_bcmp.$ac_objext"
;;
esac
fi
2015-07-08 13:36:06 -04:00
2023-07-11 14:20:37 -04:00
ac_fn_c_check_func "$LINENO" "pthread_barrier_wait" "ac_cv_func_pthread_barrier_wait"
2021-03-12 23:21:01 -05:00
if test "x$ac_cv_func_pthread_barrier_wait" = xyes; then :
$as_echo "#define HAVE_PTHREAD_BARRIER_WAIT 1" >>confdefs.h
else
case " $LIBOBJS " in
*" pthread_barrier_wait.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS pthread_barrier_wait.$ac_objext"
;;
esac
fi
2019-12-19 02:28:37 -05:00
if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
2019-02-15 20:50:16 -05:00
# Cygwin and (apparently, based on test results) Mingw both
2022-07-13 22:22:49 -04:00
# have a broken strtof(), so substitute its implementation.
# That's not a perfect fix, since it doesn't avoid double-rounding,
2022-08-06 20:42:11 -04:00
# but we have no better options.
2019-12-19 02:28:37 -05:00
case " $LIBOBJS " in
2019-02-15 20:50:16 -05:00
*" strtof.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strtof.$ac_objext"
;;
esac
2019-12-19 02:28:37 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: On $host_os we will use our strtof wrapper." >&5
2019-02-15 20:50:16 -05:00
$as_echo "$as_me: On $host_os we will use our strtof wrapper." >&6;}
2019-12-19 02:28:37 -05:00
fi
2019-02-15 20:50:16 -05:00
2015-07-08 17:05:45 -04:00
# Similarly, use system's getopt_long() only if system provides struct option.
if test x"$ac_cv_type_struct_option" = xyes ; then
ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long"
if test "x$ac_cv_func_getopt_long" = xyes; then :
$as_echo "#define HAVE_GETOPT_LONG 1" >>confdefs.h
2015-07-08 13:36:06 -04:00
2015-07-08 17:05:45 -04:00
else
case " $LIBOBJS " in
*" getopt_long.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 13:36:06 -04:00
else
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" getopt_long.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2015-07-08 17:05:45 -04:00
2019-01-18 15:06:26 -05:00
# On OpenBSD and Solaris, getopt() doesn't do what we want for long options
# (i.e., allow '-' as a flag character), so use our version on those platforms.
if test "$PORTNAME" = "openbsd" -o "$PORTNAME" = "solaris"; then
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" getopt.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
fi
2015-07-08 17:05:45 -04:00
# mingw has adopted a GNU-centric interpretation of optind/optreset,
# so always use our version on Windows.
if test "$PORTNAME" = "win32"; then
case " $LIBOBJS " in
*" getopt.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" getopt_long.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
2015-07-08 13:36:06 -04:00
;;
esac
2015-07-08 17:05:45 -04:00
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
# Win32 (really MinGW) support
if test "$PORTNAME" = "win32"; then
case " $LIBOBJS " in
*" dirmod.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS dirmod.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" kill.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS kill.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" open.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS open.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" system.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS system.$ac_objext"
;;
esac
2015-07-08 13:36:06 -04:00
Fix detection of unseekable files for fseek() and ftello() with MSVC
Calling fseek() or ftello() on a handle to a non-seeking device such as
a pipe or a communications device is not supported. Unfortunately,
MSVC's flavor of these routines, _fseeki64() and _ftelli64(), do not
return an error when given a pipe as handle. Some of the logic of
pg_dump and restore relies on these routines to check if a handle is
seekable, causing failures when passing the contents of pg_dump to
pg_restore through a pipe, for example.
This commit introduces wrappers for fseeko() and ftello() on MSVC so as
any callers are able to properly detect the cases of non-seekable
handles. This relies mainly on GetFileType(), sharing a bit of code
with the MSVC port for fstat(). The code in charge of getting a file
type is refactored into a new file called win32common.c, shared by
win32stat.c and the new win32fseek.c. It includes the MSVC ports for
fseeko() and ftello().
Like 765f5df, this is backpatched down to 14, where the fstat()
implementation for MSVC is able to understand about files larger than
4GB in size. Using a TAP test for that is proving to be tricky as
IPC::Run handles the pipes by itself, still I have been able to check
the fix manually.
Reported-by: Daniel Watzinger
Author: Juan José Santamaría Flecha, Michael Paquier
Discussion: https://postgr.es/m/CAC+AXB26a4EmxM2suXxPpJaGrqAdxracd7hskLg-zxtPB50h7A@mail.gmail.com
Backpatch-through: 14
2023-04-11 20:09:38 -04:00
case " $LIBOBJS " in
*" win32common.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32common.$ac_objext"
;;
esac
2022-08-04 17:12:45 -04:00
case " $LIBOBJS " in
*" win32dlopen.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32dlopen.$ac_objext"
;;
esac
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" win32env.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32env.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" win32error.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32error.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2022-08-05 00:10:05 -04:00
case " $LIBOBJS " in
*" win32fdatasync.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32fdatasync.$ac_objext"
;;
esac
2024-02-11 16:47:57 -05:00
case " $LIBOBJS " in
*" win32gai_strerror.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32gai_strerror.$ac_objext"
;;
esac
2022-08-13 07:35:24 -04:00
case " $LIBOBJS " in
*" win32getrusage.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32getrusage.$ac_objext"
;;
esac
2022-08-04 17:36:50 -04:00
case " $LIBOBJS " in
*" win32link.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32link.$ac_objext"
;;
esac
2021-12-09 22:13:14 -05:00
case " $LIBOBJS " in
*" win32ntdll.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32ntdll.$ac_objext"
;;
esac
2022-08-04 17:42:31 -04:00
case " $LIBOBJS " in
*" win32pread.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32pread.$ac_objext"
;;
esac
case " $LIBOBJS " in
*" win32pwrite.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32pwrite.$ac_objext"
;;
esac
2016-01-07 16:50:28 -05:00
case " $LIBOBJS " in
*" win32security.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32security.$ac_objext"
;;
esac
2015-07-08 17:05:45 -04:00
case " $LIBOBJS " in
*" win32setlocale.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32setlocale.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
2020-10-09 16:20:12 -04:00
case " $LIBOBJS " in
*" win32stat.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32stat.$ac_objext"
;;
esac
2013-12-18 20:53:23 -05:00
fi
2015-07-08 17:05:45 -04:00
# Cygwin needs only a bit of that
if test "$PORTNAME" = "cygwin"; then
case " $LIBOBJS " in
*" dirmod.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS dirmod.$ac_objext"
;;
esac
fi
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog"
if test "x$ac_cv_func_syslog" = xyes; then :
ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default"
if test "x$ac_cv_header_syslog_h" = xyes; then :
$as_echo "#define HAVE_SYSLOG 1" >>confdefs.h
1999-03-25 14:05:19 -05:00
2015-07-08 17:05:45 -04:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
fi
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for opterr" >&5
$as_echo_n "checking for opterr... " >&6; }
if ${pgac_cv_var_int_opterr+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <unistd.h>
2002-03-29 12:32:55 -05:00
int
main ()
{
2015-07-08 17:05:45 -04:00
extern int opterr; opterr = 1;
2002-03-29 12:32:55 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
pgac_cv_var_int_opterr=yes
2002-03-29 12:32:55 -05:00
else
2015-07-08 17:05:45 -04:00
pgac_cv_var_int_opterr=no
2002-03-29 12:32:55 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_int_opterr" >&5
$as_echo "$pgac_cv_var_int_opterr" >&6; }
if test x"$pgac_cv_var_int_opterr" = x"yes"; then
2013-12-18 20:53:23 -05:00
2015-07-08 17:05:45 -04:00
$as_echo "#define HAVE_INT_OPTERR 1" >>confdefs.h
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
fi
2005-07-01 14:17:31 -04:00
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for optreset" >&5
$as_echo_n "checking for optreset... " >&6; }
if ${pgac_cv_var_int_optreset+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
else
2015-07-08 17:05:45 -04:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2005-07-01 14:17:31 -04:00
/* end confdefs.h. */
2015-07-08 17:05:45 -04:00
#include <unistd.h>
2002-03-29 12:32:55 -05:00
int
main ()
1999-03-25 14:05:19 -05:00
{
2015-07-08 17:05:45 -04:00
extern int optreset; optreset = 1;
2002-03-29 12:32:55 -05:00
;
return 0;
1999-03-25 14:05:19 -05:00
}
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
2015-07-08 17:05:45 -04:00
pgac_cv_var_int_optreset=yes
2013-12-18 20:53:23 -05:00
else
2015-07-08 17:05:45 -04:00
pgac_cv_var_int_optreset=no
2013-12-18 20:53:23 -05:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
2015-07-08 17:05:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_int_optreset" >&5
$as_echo "$pgac_cv_var_int_optreset" >&6; }
if test x"$pgac_cv_var_int_optreset" = x"yes"; then
$as_echo "#define HAVE_INT_OPTRESET 1" >>confdefs.h
fi
2017-03-23 15:25:34 -04:00
if test "$with_icu" = yes; then
2017-08-05 11:47:28 -04:00
ac_save_CPPFLAGS=$CPPFLAGS
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
CPPFLAGS="$CPPFLAGS $ICU_CFLAGS"
2017-08-05 11:47:28 -04:00
# Verify we have ICU's header files
ac_fn_c_check_header_mongrel "$LINENO" "unicode/ucol.h" "ac_cv_header_unicode_ucol_h" "$ac_includes_default"
if test "x$ac_cv_header_unicode_ucol_h" = xyes; then :
else
as_fn_error $? "header file <unicode/ucol.h> is required for ICU" "$LINENO" 5
fi
2017-03-23 15:25:34 -04:00
2017-08-05 11:47:28 -04:00
CPPFLAGS=$ac_save_CPPFLAGS
2017-03-23 15:25:34 -04:00
fi
2015-07-08 17:05:45 -04:00
# Lastly, restore full LIBS list and check for readline/libedit symbols
LIBS="$LIBS_including_readline"
if test "$with_readline" = yes; then
2022-02-02 23:01:56 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
2020-01-23 18:20:57 -05:00
$as_echo_n "checking for rl_completion_suppress_quote... " >&6; }
if ${pgac_cv_var_rl_completion_suppress_quote+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#if defined(HAVE_READLINE_READLINE_H)
#include <readline/readline.h>
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_H)
#include <readline.h>
#endif
int
main ()
{
rl_completion_suppress_quote = 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_var_rl_completion_suppress_quote=yes
else
pgac_cv_var_rl_completion_suppress_quote=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_completion_suppress_quote" >&5
$as_echo "$pgac_cv_var_rl_completion_suppress_quote" >&6; }
if test x"$pgac_cv_var_rl_completion_suppress_quote" = x"yes"; then
$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_QUOTE 1" >>confdefs.h
1999-03-25 14:05:19 -05:00
fi
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-23 11:07:12 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_filename_quote_characters" >&5
$as_echo_n "checking for rl_filename_quote_characters... " >&6; }
if ${pgac_cv_var_rl_filename_quote_characters+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#if defined(HAVE_READLINE_READLINE_H)
#include <readline/readline.h>
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_H)
#include <readline.h>
#endif
int
main ()
{
rl_filename_quote_characters = "x";
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_var_rl_filename_quote_characters=yes
else
pgac_cv_var_rl_filename_quote_characters=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_filename_quote_characters" >&5
$as_echo "$pgac_cv_var_rl_filename_quote_characters" >&6; }
if test x"$pgac_cv_var_rl_filename_quote_characters" = x"yes"; then
$as_echo "#define HAVE_RL_FILENAME_QUOTE_CHARACTERS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_filename_quoting_function" >&5
$as_echo_n "checking for rl_filename_quoting_function... " >&6; }
if ${pgac_cv_var_rl_filename_quoting_function+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#if defined(HAVE_READLINE_READLINE_H)
#include <readline/readline.h>
#elif defined(HAVE_EDITLINE_READLINE_H)
#include <editline/readline.h>
#elif defined(HAVE_READLINE_H)
#include <readline.h>
#endif
int
main ()
{
rl_filename_quoting_function = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_var_rl_filename_quoting_function=yes
else
pgac_cv_var_rl_filename_quoting_function=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_filename_quoting_function" >&5
$as_echo "$pgac_cv_var_rl_filename_quoting_function" >&6; }
if test x"$pgac_cv_var_rl_filename_quoting_function" = x"yes"; then
$as_echo "#define HAVE_RL_FILENAME_QUOTING_FUNCTION 1" >>confdefs.h
fi
2021-12-02 13:06:27 -05:00
for ac_func in append_history history_truncate_file rl_completion_matches rl_filename_completion_function rl_reset_screen_size rl_variable_bind
2015-07-08 17:05:45 -04:00
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
2008-02-17 11:36:43 -05:00
2015-07-08 17:05:45 -04:00
fi
done
1999-03-25 14:05:19 -05:00
2015-07-08 17:05:45 -04:00
fi
2013-12-18 20:53:23 -05:00
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.
# This check should come after all modifications of compiler or linker
# variables, and before any other run tests.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking test program" >&5
$as_echo_n "checking test program... " >&6; }
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling" >&5
$as_echo "cross-compiling" >&6; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main() { return 0; }
2002-03-29 12:32:55 -05:00
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
$as_echo "failed" >&6; }
as_fn_error $? "
Could not execute a simple test program. This may be a problem
related to locating shared libraries. Check the file 'config.log'
for the exact reason." "$LINENO" 5
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# --------------------
# Run tests below here
# --------------------
# Check size of void *, size_t (enables tweaks for > 32bit address space)
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
$as_echo_n "checking size of void *... " >&6; }
if ${ac_cv_sizeof_void_p+:} false; then :
$as_echo_n "(cached) " >&6
2010-01-16 14:50:26 -05:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
else
if test "$ac_cv_type_void_p" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2010-01-16 14:50:26 -05:00
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2013-12-18 20:53:23 -05:00
as_fn_error 77 "cannot compute sizeof (void *)
See \`config.log' for more details" "$LINENO" 5; }
2010-01-16 14:50:26 -05:00
else
2013-12-18 20:53:23 -05:00
ac_cv_sizeof_void_p=0
2010-01-16 14:50:26 -05:00
fi
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
$as_echo "$ac_cv_sizeof_void_p" >&6; }
2010-01-16 14:50:26 -05:00
2009-07-02 14:55:40 -04:00
cat >>confdefs.h <<_ACEOF
2013-12-18 20:53:23 -05:00
#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
2009-07-02 14:55:40 -04:00
_ACEOF
2013-12-18 20:53:23 -05:00
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5
$as_echo_n "checking size of size_t... " >&6; }
if ${ac_cv_sizeof_size_t+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then :
2010-01-16 14:50:26 -05:00
2009-07-02 14:55:40 -04:00
else
2013-12-18 20:53:23 -05:00
if test "$ac_cv_type_size_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (size_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_size_t=0
fi
2009-07-02 14:55:40 -04:00
fi
2013-12-18 20:53:23 -05:00
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5
$as_echo "$ac_cv_sizeof_size_t" >&6; }
2005-07-01 14:17:31 -04:00
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
2002-03-29 12:32:55 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
$as_echo_n "checking size of long... " >&6; }
if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
else
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long=0
fi
2002-03-29 19:20:15 -05:00
fi
2008-02-17 11:36:43 -05:00
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
$as_echo "$ac_cv_sizeof_long" >&6; }
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG $ac_cv_sizeof_long
2002-03-29 19:20:15 -05:00
_ACEOF
2010-01-16 14:50:26 -05:00
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
$as_echo_n "checking size of long long... " >&6; }
if ${ac_cv_sizeof_long_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long long)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long_long=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
$as_echo "$ac_cv_sizeof_long_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
_ACEOF
Support "j" length modifier in snprintf.c.
POSIX has for a long time defined the "j" length modifier for
printf conversions as meaning the size of intmax_t or uintmax_t.
We got away without supporting that so far, because we were not
using intmax_t anywhere. However, commit e6be84356 re-introduced
upstream's use of intmax_t and PRIdMAX into zic.c. It emerges
that on some platforms (at least FreeBSD and macOS), <inttypes.h>
defines PRIdMAX as "jd", so that snprintf.c falls over if that is
used. (We hadn't noticed yet because it would only be apparent
if bad data is fed to zic, resulting in an error report, and even
then the only visible symptom is a missing line number in the
error message.)
We could revert that decision from our copy of zic.c, but
on the whole it seems better to update snprintf.c to support
this standard modifier. There might well be extensions,
now or in future, that expect it to work.
I did this in the lazy man's way of translating "j" to either
"l" or "ll" depending on a compile-time sizeof() check, just
as was done long ago to support "z" for size_t. One could
imagine promoting intmax_t to have full support in snprintf.c,
for example converting fmtint()'s value argument and internal
arithmetic to use [u]intmax_t not [unsigned] long long. But
that'd be more work and I'm hesitant to do it anyway: if there
are any platforms out there where intmax_t is actually wider
than "long long", this would doubtless result in a noticeable
speed penalty to snprintf(). Let's not go there until we have
positive evidence that there's a reason to, and some way to
measure what size of penalty we're taking.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3210703.1765236740@sss.pgh.pa.us
2025-12-09 11:43:25 -05:00
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of intmax_t" >&5
$as_echo_n "checking size of intmax_t... " >&6; }
if ${ac_cv_sizeof_intmax_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (intmax_t))" "ac_cv_sizeof_intmax_t" "$ac_includes_default"; then :
else
if test "$ac_cv_type_intmax_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (intmax_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_intmax_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_intmax_t" >&5
$as_echo "$ac_cv_sizeof_intmax_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_INTMAX_T $ac_cv_sizeof_intmax_t
_ACEOF
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
# Determine memory alignment requirements for the basic C data types.
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of short" >&5
$as_echo_n "checking alignment of short... " >&6; }
if ${ac_cv_alignof_short+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-08-20 13:54:45 -04:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_short" "$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; short y; } ac__type_alignof_;"; then :
2010-01-16 14:50:26 -05:00
else
2013-12-18 20:53:23 -05:00
if test "$ac_cv_type_short" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute alignment of short
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_alignof_short=0
fi
fi
2010-01-16 14:50:26 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_short" >&5
$as_echo "$ac_cv_alignof_short" >&6; }
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_SHORT $ac_cv_alignof_short
_ACEOF
2010-01-16 14:50:26 -05:00
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of int" >&5
$as_echo_n "checking alignment of int... " >&6; }
if ${ac_cv_alignof_int+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_int" "$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; int y; } ac__type_alignof_;"; then :
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
else
if test "$ac_cv_type_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute alignment of int
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_alignof_int=0
fi
2002-08-20 13:54:45 -04:00
fi
2008-02-17 11:36:43 -05:00
2002-08-20 13:54:45 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_int" >&5
$as_echo "$ac_cv_alignof_int" >&6; }
2010-01-16 14:50:26 -05:00
2002-08-20 13:54:45 -04:00
cat >>confdefs.h <<_ACEOF
2013-12-18 20:53:23 -05:00
#define ALIGNOF_INT $ac_cv_alignof_int
2002-08-20 13:54:45 -04:00
_ACEOF
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of long" >&5
$as_echo_n "checking alignment of long... " >&6; }
if ${ac_cv_alignof_long+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-08-20 13:54:45 -04:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_long" "$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; long y; } ac__type_alignof_;"; then :
2010-01-16 14:50:26 -05:00
else
2013-12-18 20:53:23 -05:00
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute alignment of long
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_alignof_long=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_long" >&5
$as_echo "$ac_cv_alignof_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_LONG $ac_cv_alignof_long
_ACEOF
2010-01-16 14:50:26 -05:00
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
# The cast to long int works around a bug in the HP C Compiler,
2013-12-18 20:53:23 -05:00
# see AC_CHECK_SIZEOF for more information.
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of int64_t" >&5
$as_echo_n "checking alignment of int64_t... " >&6; }
if ${ac_cv_alignof_int64_t+:} false; then :
2013-12-18 20:53:23 -05:00
$as_echo_n "(cached) " >&6
2002-08-20 13:54:45 -04:00
else
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_int64_t" "$ac_includes_default
2013-12-18 20:53:23 -05:00
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
typedef struct { char x; int64_t y; } ac__type_alignof_;"; then :
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
else
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
if test "$ac_cv_type_int64_t" = yes; then
2013-12-18 20:53:23 -05:00
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
as_fn_error 77 "cannot compute alignment of int64_t
2013-12-18 20:53:23 -05:00
See \`config.log' for more details" "$LINENO" 5; }
else
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
ac_cv_alignof_int64_t=0
2013-12-18 20:53:23 -05:00
fi
2002-08-20 13:54:45 -04:00
fi
2008-02-17 11:36:43 -05:00
2002-08-20 13:54:45 -04:00
fi
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_int64_t" >&5
$as_echo "$ac_cv_alignof_int64_t" >&6; }
2013-12-18 20:53:23 -05:00
2010-01-16 14:50:26 -05:00
2002-08-20 13:54:45 -04:00
cat >>confdefs.h <<_ACEOF
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
#define ALIGNOF_INT64_T $ac_cv_alignof_int64_t
2002-08-20 13:54:45 -04:00
_ACEOF
2002-03-29 19:20:15 -05:00
2013-12-18 20:53:23 -05:00
# The cast to long int works around a bug in the HP C Compiler,
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of double" >&5
$as_echo_n "checking alignment of double... " >&6; }
if ${ac_cv_alignof_double+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2008-03-10 16:06:27 -04:00
else
2013-12-18 20:53:23 -05:00
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_double" "$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; double y; } ac__type_alignof_;"; then :
2010-01-16 14:50:26 -05:00
2008-03-10 16:06:27 -04:00
else
2013-12-18 20:53:23 -05:00
if test "$ac_cv_type_double" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute alignment of double
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_alignof_double=0
fi
fi
2008-03-10 16:06:27 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_double" >&5
$as_echo "$ac_cv_alignof_double" >&6; }
2008-03-10 16:06:27 -04:00
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_DOUBLE $ac_cv_alignof_double
_ACEOF
2010-01-16 14:50:26 -05:00
2013-12-18 20:53:23 -05:00
# Compute maximum alignment of any basic type.
Remove AIX support
There isn't a lot of user demand for AIX support, we have a bunch of
hacks to work around AIX-specific compiler bugs and idiosyncrasies,
and no one has stepped up to the plate to properly maintain it.
Remove support for AIX to get rid of that maintenance overhead. It's
still supported for stable versions.
The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:
TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.
That could be worked around, but we decided to just drop the AIX support
instead.
Discussion: https://www.postgresql.org/message-id/20240224172345.32@rfd.leadboat.com
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro
2024-02-28 06:10:51 -05:00
#
2024-02-28 07:44:32 -05:00
# We require 'double' to have the strictest alignment among the basic types,
Remove AIX support
There isn't a lot of user demand for AIX support, we have a bunch of
hacks to work around AIX-specific compiler bugs and idiosyncrasies,
and no one has stepped up to the plate to properly maintain it.
Remove support for AIX to get rid of that maintenance overhead. It's
still supported for stable versions.
The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:
TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.
That could be worked around, but we decided to just drop the AIX support
instead.
Discussion: https://www.postgresql.org/message-id/20240224172345.32@rfd.leadboat.com
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro
2024-02-28 06:10:51 -05:00
# because otherwise the C ABI might impose 8-byte alignment on some of the
# other C types that correspond to TYPALIGN_DOUBLE SQL types. That could
# cause a mismatch between the tuple layout and the C struct layout of a
# catalog tuple. We used to carefully order catalog columns such that any
# fixed-width, attalign=4 columns were at offsets divisible by 8 regardless
# of MAXIMUM_ALIGNOF to avoid that, but we no longer support any platforms
# where TYPALIGN_DOUBLE != MAXIMUM_ALIGNOF.
#
# We assume without checking that long's alignment is at least as strong as
# char, short, or int. Note that we intentionally do not consider any types
# wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8 would be too
# much of a penalty for disk and memory space.
MAX_ALIGNOF=$ac_cv_alignof_double
2013-12-18 20:53:23 -05:00
Remove AIX support
There isn't a lot of user demand for AIX support, we have a bunch of
hacks to work around AIX-specific compiler bugs and idiosyncrasies,
and no one has stepped up to the plate to properly maintain it.
Remove support for AIX to get rid of that maintenance overhead. It's
still supported for stable versions.
The acute issue that triggered this decision was that after commit
8af2565248, the AIX buildfarm members have been hitting this
assertion:
TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.
That could be worked around, but we decided to just drop the AIX support
instead.
Discussion: https://www.postgresql.org/message-id/20240224172345.32@rfd.leadboat.com
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro
2024-02-28 06:10:51 -05:00
if test $ac_cv_alignof_long -gt $MAX_ALIGNOF ; then
as_fn_error $? "alignment of 'long' is greater than the alignment of 'double'" "$LINENO" 5
2013-12-18 20:53:23 -05:00
fi
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
if test $ac_cv_alignof_int64_t -gt $MAX_ALIGNOF ; then
as_fn_error $? "alignment of 'int64_t' is greater than the alignment of 'double'" "$LINENO" 5
2010-01-16 14:50:26 -05:00
fi
cat >>confdefs.h <<_ACEOF
2013-12-18 20:53:23 -05:00
#define MAXIMUM_ALIGNOF $MAX_ALIGNOF
2010-01-16 14:50:26 -05:00
_ACEOF
2017-11-14 15:03:55 -05:00
# Some compilers offer a 128-bit integer scalar type.
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128" >&5
$as_echo_n "checking for __int128... " >&6; }
if ${pgac_cv__128bit_int+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/*
2018-01-18 11:09:44 -05:00
* We don't actually run this test, just link it to verify that any support
* functions needed for __int128 are present.
*
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
* These are globals to discourage the compiler from folding all the
* arithmetic tests down to compile-time constants. We do not have
2018-01-18 11:09:44 -05:00
* convenient support for 128bit literals at this point...
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
*/
__int128 a = 48828125;
2018-01-18 11:09:44 -05:00
__int128 b = 97656250;
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
int
main ()
{
__int128 c,d;
a = (a << 12) + 1; /* 200000000001 */
b = (b << 12) + 5; /* 400000000005 */
2018-01-18 11:09:44 -05:00
/* try the most relevant arithmetic ops */
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
c = a * b;
d = (c + b) / b;
2018-01-18 11:09:44 -05:00
/* must use the results, else compiler may optimize arithmetic away */
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
if (d != a+1)
2018-01-18 11:09:44 -05:00
return 1;
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__128bit_int=yes
else
pgac_cv__128bit_int=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int" >&5
$as_echo "$pgac_cv__128bit_int" >&6; }
if test x"$pgac_cv__128bit_int" = xyes ; then
2018-01-18 11:09:44 -05:00
# Use of non-default alignment with __int128 tickles bugs in some compilers.
# If not cross-compiling, we can test for bugs and disable use of __int128
# with buggy compilers. If cross-compiling, hope for the best.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83925
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128 alignment bug" >&5
$as_echo_n "checking for __int128 alignment bug... " >&6; }
if ${pgac_cv__128bit_int_bug+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
pgac_cv__128bit_int_bug="assuming ok"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* This must match the corresponding code in c.h: */
2025-09-11 05:55:29 -04:00
#if defined(__GNUC__)
2018-01-18 11:09:44 -05:00
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
2022-09-20 21:11:23 -04:00
#elif defined(_MSC_VER)
#define pg_attribute_aligned(a) __declspec(align(a))
2018-01-18 11:09:44 -05:00
#endif
typedef __int128 int128a
#if defined(pg_attribute_aligned)
pg_attribute_aligned(8)
#endif
;
int128a holder;
void pass_by_val(void *buffer, int128a par) { holder = par; }
int
main ()
{
long int i64 = 97656225L << 12;
int128a q;
pass_by_val(main, (int128a) i64);
q = (int128a) i64;
if (q != holder)
return 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
pgac_cv__128bit_int_bug=ok
else
pgac_cv__128bit_int_bug=broken
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int_bug" >&5
$as_echo "$pgac_cv__128bit_int_bug" >&6; }
if test x"$pgac_cv__128bit_int_bug" != xbroken ; then
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
$as_echo "#define PG_INT128_TYPE __int128" >>confdefs.h
2018-01-18 11:09:44 -05:00
# The cast to long int works around a bug in the HP C Compiler,
2017-11-14 15:03:55 -05:00
# see AC_CHECK_SIZEOF for more information.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of PG_INT128_TYPE" >&5
$as_echo_n "checking alignment of PG_INT128_TYPE... " >&6; }
if ${ac_cv_alignof_PG_INT128_TYPE+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_PG_INT128_TYPE" "$ac_includes_default
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; PG_INT128_TYPE y; } ac__type_alignof_;"; then :
else
if test "$ac_cv_type_PG_INT128_TYPE" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute alignment of PG_INT128_TYPE
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_alignof_PG_INT128_TYPE=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_PG_INT128_TYPE" >&5
$as_echo "$ac_cv_alignof_PG_INT128_TYPE" >&6; }
cat >>confdefs.h <<_ACEOF
#define ALIGNOF_PG_INT128_TYPE $ac_cv_alignof_PG_INT128_TYPE
_ACEOF
2018-01-18 11:09:44 -05:00
fi
Add, optional, support for 128bit integers.
We will, for the foreseeable future, not expose 128 bit datatypes to
SQL. But being able to use 128bit math will allow us, in a later patch,
to use 128bit accumulators for some aggregates; leading to noticeable
speedups over using numeric.
So far we only detect a gcc/clang extension that supports 128bit math,
but no 128bit literals, and no *printf support. We might want to expand
this in the future to further compilers; if there are any that that
provide similar support.
Discussion: 544BB5F1.50709@proxel.se
Author: Andreas Karlsson, with significant editorializing by me
Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
2015-03-20 05:26:17 -04:00
fi
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomic
operations. This new API avoids the need to splatter compiler and
architecture dependent code over all the locations employing atomic
ops.
For several of the potential usages it'd be problematic to maintain
both, a atomics using implementation and one using spinlocks or
similar. In all likelihood one of the implementations would not get
tested regularly under concurrency. To avoid that scenario the new API
provides a automatic fallback of atomic operations to spinlocks. All
properties of atomic operations are maintained. This fallback -
obviously - isn't as fast as just using atomic ops, but it's not bad
either. For one of the future users the atomics ontop spinlocks
implementation was actually slightly faster than the old purely
spinlock using implementation. That's important because it reduces the
fear of regressing older platforms when improving the scalability for
new ones.
The API, loosely modeled after the C11 atomics support, currently
provides 'atomic flags' and 32 bit unsigned integers. If the platform
efficiently supports atomic 64 bit unsigned integers those are also
provided.
To implement atomics support for a platform/architecture/compiler for
a type of atomics 32bit compare and exchange needs to be
implemented. If available and more efficient native support for flags,
32 bit atomic addition, and corresponding 64 bit operations may also
be provided. Additional useful atomic operations are implemented
generically ontop of these.
The implementation for various versions of gcc, msvc and sun studio have
been tested. Additional existing stub implementations for
* Intel icc
* HUPX acc
* IBM xlc
are included but have never been tested. These will likely require
fixes based on buildfarm and user feedback.
As atomic operations also require barriers for some operations the
existing barrier support has been moved into the atomics code.
Author: Andres Freund with contributions from Oskari Saarenmaa
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
20131015123303.GH5300@awork2.anarazel.de,
20131028205522.GI20248@awork2.anarazel.de
2014-09-25 17:49:05 -04:00
# Check for various atomic operations now that we have checked how to declare
# 64bit integers.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __sync char locking functions" >&5
$as_echo_n "checking for builtin __sync char locking functions... " >&6; }
if ${pgac_cv_gcc_sync_char_tas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
char lock = 0;
__sync_lock_test_and_set(&lock, 1);
__sync_lock_release(&lock);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_sync_char_tas="yes"
else
pgac_cv_gcc_sync_char_tas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_sync_char_tas" >&5
$as_echo "$pgac_cv_gcc_sync_char_tas" >&6; }
if test x"$pgac_cv_gcc_sync_char_tas" = x"yes"; then
$as_echo "#define HAVE_GCC__SYNC_CHAR_TAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __sync int32 locking functions" >&5
$as_echo_n "checking for builtin __sync int32 locking functions... " >&6; }
if ${pgac_cv_gcc_sync_int32_tas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int lock = 0;
__sync_lock_test_and_set(&lock, 1);
__sync_lock_release(&lock);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_sync_int32_tas="yes"
else
pgac_cv_gcc_sync_int32_tas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_sync_int32_tas" >&5
$as_echo "$pgac_cv_gcc_sync_int32_tas" >&6; }
if test x"$pgac_cv_gcc_sync_int32_tas" = x"yes"; then
$as_echo "#define HAVE_GCC__SYNC_INT32_TAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __sync int32 atomic operations" >&5
$as_echo_n "checking for builtin __sync int32 atomic operations... " >&6; }
if ${pgac_cv_gcc_sync_int32_cas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int val = 0;
__sync_val_compare_and_swap(&val, 0, 37);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_sync_int32_cas="yes"
else
pgac_cv_gcc_sync_int32_cas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_sync_int32_cas" >&5
$as_echo "$pgac_cv_gcc_sync_int32_cas" >&6; }
if test x"$pgac_cv_gcc_sync_int32_cas" = x"yes"; then
$as_echo "#define HAVE_GCC__SYNC_INT32_CAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __sync int64 atomic operations" >&5
$as_echo_n "checking for builtin __sync int64 atomic operations... " >&6; }
if ${pgac_cv_gcc_sync_int64_cas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
#include <stdint.h>
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomic
operations. This new API avoids the need to splatter compiler and
architecture dependent code over all the locations employing atomic
ops.
For several of the potential usages it'd be problematic to maintain
both, a atomics using implementation and one using spinlocks or
similar. In all likelihood one of the implementations would not get
tested regularly under concurrency. To avoid that scenario the new API
provides a automatic fallback of atomic operations to spinlocks. All
properties of atomic operations are maintained. This fallback -
obviously - isn't as fast as just using atomic ops, but it's not bad
either. For one of the future users the atomics ontop spinlocks
implementation was actually slightly faster than the old purely
spinlock using implementation. That's important because it reduces the
fear of regressing older platforms when improving the scalability for
new ones.
The API, loosely modeled after the C11 atomics support, currently
provides 'atomic flags' and 32 bit unsigned integers. If the platform
efficiently supports atomic 64 bit unsigned integers those are also
provided.
To implement atomics support for a platform/architecture/compiler for
a type of atomics 32bit compare and exchange needs to be
implemented. If available and more efficient native support for flags,
32 bit atomic addition, and corresponding 64 bit operations may also
be provided. Additional useful atomic operations are implemented
generically ontop of these.
The implementation for various versions of gcc, msvc and sun studio have
been tested. Additional existing stub implementations for
* Intel icc
* HUPX acc
* IBM xlc
are included but have never been tested. These will likely require
fixes based on buildfarm and user feedback.
As atomic operations also require barriers for some operations the
existing barrier support has been moved into the atomics code.
Author: Andres Freund with contributions from Oskari Saarenmaa
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
20131015123303.GH5300@awork2.anarazel.de,
20131028205522.GI20248@awork2.anarazel.de
2014-09-25 17:49:05 -04:00
int
main ()
{
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
int64_t lock = 0;
__sync_val_compare_and_swap(&lock, 0, (int64_t) 37);
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomic
operations. This new API avoids the need to splatter compiler and
architecture dependent code over all the locations employing atomic
ops.
For several of the potential usages it'd be problematic to maintain
both, a atomics using implementation and one using spinlocks or
similar. In all likelihood one of the implementations would not get
tested regularly under concurrency. To avoid that scenario the new API
provides a automatic fallback of atomic operations to spinlocks. All
properties of atomic operations are maintained. This fallback -
obviously - isn't as fast as just using atomic ops, but it's not bad
either. For one of the future users the atomics ontop spinlocks
implementation was actually slightly faster than the old purely
spinlock using implementation. That's important because it reduces the
fear of regressing older platforms when improving the scalability for
new ones.
The API, loosely modeled after the C11 atomics support, currently
provides 'atomic flags' and 32 bit unsigned integers. If the platform
efficiently supports atomic 64 bit unsigned integers those are also
provided.
To implement atomics support for a platform/architecture/compiler for
a type of atomics 32bit compare and exchange needs to be
implemented. If available and more efficient native support for flags,
32 bit atomic addition, and corresponding 64 bit operations may also
be provided. Additional useful atomic operations are implemented
generically ontop of these.
The implementation for various versions of gcc, msvc and sun studio have
been tested. Additional existing stub implementations for
* Intel icc
* HUPX acc
* IBM xlc
are included but have never been tested. These will likely require
fixes based on buildfarm and user feedback.
As atomic operations also require barriers for some operations the
existing barrier support has been moved into the atomics code.
Author: Andres Freund with contributions from Oskari Saarenmaa
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
20131015123303.GH5300@awork2.anarazel.de,
20131028205522.GI20248@awork2.anarazel.de
2014-09-25 17:49:05 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_sync_int64_cas="yes"
else
pgac_cv_gcc_sync_int64_cas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_sync_int64_cas" >&5
$as_echo "$pgac_cv_gcc_sync_int64_cas" >&6; }
if test x"$pgac_cv_gcc_sync_int64_cas" = x"yes"; then
$as_echo "#define HAVE_GCC__SYNC_INT64_CAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __atomic int32 atomic operations" >&5
$as_echo_n "checking for builtin __atomic int32 atomic operations... " >&6; }
if ${pgac_cv_gcc_atomic_int32_cas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
int val = 0;
int expect = 0;
__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_atomic_int32_cas="yes"
else
pgac_cv_gcc_atomic_int32_cas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_atomic_int32_cas" >&5
$as_echo "$pgac_cv_gcc_atomic_int32_cas" >&6; }
if test x"$pgac_cv_gcc_atomic_int32_cas" = x"yes"; then
$as_echo "#define HAVE_GCC__ATOMIC_INT32_CAS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __atomic int64 atomic operations" >&5
$as_echo_n "checking for builtin __atomic int64 atomic operations... " >&6; }
if ${pgac_cv_gcc_atomic_int64_cas+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
#include <stdint.h>
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomic
operations. This new API avoids the need to splatter compiler and
architecture dependent code over all the locations employing atomic
ops.
For several of the potential usages it'd be problematic to maintain
both, a atomics using implementation and one using spinlocks or
similar. In all likelihood one of the implementations would not get
tested regularly under concurrency. To avoid that scenario the new API
provides a automatic fallback of atomic operations to spinlocks. All
properties of atomic operations are maintained. This fallback -
obviously - isn't as fast as just using atomic ops, but it's not bad
either. For one of the future users the atomics ontop spinlocks
implementation was actually slightly faster than the old purely
spinlock using implementation. That's important because it reduces the
fear of regressing older platforms when improving the scalability for
new ones.
The API, loosely modeled after the C11 atomics support, currently
provides 'atomic flags' and 32 bit unsigned integers. If the platform
efficiently supports atomic 64 bit unsigned integers those are also
provided.
To implement atomics support for a platform/architecture/compiler for
a type of atomics 32bit compare and exchange needs to be
implemented. If available and more efficient native support for flags,
32 bit atomic addition, and corresponding 64 bit operations may also
be provided. Additional useful atomic operations are implemented
generically ontop of these.
The implementation for various versions of gcc, msvc and sun studio have
been tested. Additional existing stub implementations for
* Intel icc
* HUPX acc
* IBM xlc
are included but have never been tested. These will likely require
fixes based on buildfarm and user feedback.
As atomic operations also require barriers for some operations the
existing barrier support has been moved into the atomics code.
Author: Andres Freund with contributions from Oskari Saarenmaa
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
20131015123303.GH5300@awork2.anarazel.de,
20131028205522.GI20248@awork2.anarazel.de
2014-09-25 17:49:05 -04:00
int
main ()
{
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
int64_t val = 0;
int64_t expect = 0;
Add a basic atomic ops API abstracting away platform/architecture details.
Several upcoming performance/scalability improvements require atomic
operations. This new API avoids the need to splatter compiler and
architecture dependent code over all the locations employing atomic
ops.
For several of the potential usages it'd be problematic to maintain
both, a atomics using implementation and one using spinlocks or
similar. In all likelihood one of the implementations would not get
tested regularly under concurrency. To avoid that scenario the new API
provides a automatic fallback of atomic operations to spinlocks. All
properties of atomic operations are maintained. This fallback -
obviously - isn't as fast as just using atomic ops, but it's not bad
either. For one of the future users the atomics ontop spinlocks
implementation was actually slightly faster than the old purely
spinlock using implementation. That's important because it reduces the
fear of regressing older platforms when improving the scalability for
new ones.
The API, loosely modeled after the C11 atomics support, currently
provides 'atomic flags' and 32 bit unsigned integers. If the platform
efficiently supports atomic 64 bit unsigned integers those are also
provided.
To implement atomics support for a platform/architecture/compiler for
a type of atomics 32bit compare and exchange needs to be
implemented. If available and more efficient native support for flags,
32 bit atomic addition, and corresponding 64 bit operations may also
be provided. Additional useful atomic operations are implemented
generically ontop of these.
The implementation for various versions of gcc, msvc and sun studio have
been tested. Additional existing stub implementations for
* Intel icc
* HUPX acc
* IBM xlc
are included but have never been tested. These will likely require
fixes based on buildfarm and user feedback.
As atomic operations also require barriers for some operations the
existing barrier support has been moved into the atomics code.
Author: Andres Freund with contributions from Oskari Saarenmaa
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
20131015123303.GH5300@awork2.anarazel.de,
20131028205522.GI20248@awork2.anarazel.de
2014-09-25 17:49:05 -04:00
__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_gcc_atomic_int64_cas="yes"
else
pgac_cv_gcc_atomic_int64_cas="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_atomic_int64_cas" >&5
$as_echo "$pgac_cv_gcc_atomic_int64_cas" >&6; }
if test x"$pgac_cv_gcc_atomic_int64_cas" = x"yes"; then
$as_echo "#define HAVE_GCC__ATOMIC_INT64_CAS 1" >>confdefs.h
fi
2010-01-16 14:50:26 -05:00
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
# Check for __get_cpuid() and __cpuid()
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid" >&5
$as_echo_n "checking for __get_cpuid... " >&6; }
if ${pgac_cv__get_cpuid+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <cpuid.h>
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
__get_cpuid(1, &exx[0], &exx[1], &exx[2], &exx[3]);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__get_cpuid="yes"
else
pgac_cv__get_cpuid="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__get_cpuid" >&5
$as_echo "$pgac_cv__get_cpuid" >&6; }
if test x"$pgac_cv__get_cpuid" = x"yes"; then
$as_echo "#define HAVE__GET_CPUID 1" >>confdefs.h
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
else
# __cpuid()
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuid" >&5
$as_echo_n "checking for __cpuid... " >&6; }
if ${pgac_cv__cpuid+:} false; then :
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
#include <intrin.h>
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
__cpuid(exx, 1);
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
pgac_cv__cpuid="yes"
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
else
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
pgac_cv__cpuid="no"
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuid" >&5
$as_echo "$pgac_cv__cpuid" >&6; }
if test x"$pgac_cv__cpuid" = x"yes"; then
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
$as_echo "#define HAVE__CPUID 1" >>confdefs.h
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
fi
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
fi
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5
$as_echo_n "checking for __get_cpuid_count... " >&6; }
if ${pgac_cv__get_cpuid_count+:} false; then :
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
#include <cpuid.h>
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
__get_cpuid_count(7, 0, &exx[0], &exx[1], &exx[2], &exx[3]);
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
pgac_cv__get_cpuid_count="yes"
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
else
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
pgac_cv__get_cpuid_count="no"
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__get_cpuid_count" >&5
$as_echo "$pgac_cv__get_cpuid_count" >&6; }
if test x"$pgac_cv__get_cpuid_count" = x"yes"; then
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
$as_echo "#define HAVE__GET_CPUID_COUNT 1" >>confdefs.h
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
else
# __cpuidex()
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
$as_echo_n "checking for __cpuidex... " >&6; }
if ${pgac_cv__cpuidex+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <intrin.h>
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
__cpuidex(exx, 7, 0);
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__cpuidex="yes"
else
pgac_cv__cpuidex="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuidex" >&5
$as_echo "$pgac_cv__cpuidex" >&6; }
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
if test x"$pgac_cv__cpuidex" = x"yes"; then
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
$as_echo "#define HAVE__CPUIDEX 1" >>confdefs.h
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13
2025-07-29 22:55:42 -04:00
fi
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
fi
# Check for XSAVE intrinsics
#
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv" >&5
$as_echo_n "checking for _xgetbv... " >&6; }
if ${pgac_cv_xsave_intrinsics+:} false; then :
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
$as_echo_n "(cached) " >&6
else
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
/* end confdefs.h. */
#include <immintrin.h>
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
#if defined(__has_attribute) && __has_attribute (target)
__attribute__((target("xsave")))
#endif
static int xsave_test(void)
{
return _xgetbv(0) & 0xe0;
}
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
int
main ()
{
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
return xsave_test();
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
pgac_cv_xsave_intrinsics=yes
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
else
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
pgac_cv_xsave_intrinsics=no
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics" >&5
$as_echo "$pgac_cv_xsave_intrinsics" >&6; }
if test x"$pgac_cv_xsave_intrinsics" = x"yes"; then
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
pgac_xsave_intrinsics=yes
fi
if test x"$pgac_xsave_intrinsics" = x"yes"; then
$as_echo "#define HAVE_XSAVE_INTRINSICS 1" >>confdefs.h
fi
# Check for AVX-512 popcount intrinsics
#
if test x"$host_cpu" = x"x86_64"; then
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64" >&5
$as_echo_n "checking for _mm512_popcnt_epi64... " >&6; }
if ${pgac_cv_avx512_popcnt_intrinsics+:} false; then :
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
$as_echo_n "(cached) " >&6
else
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
/* end confdefs.h. */
#include <immintrin.h>
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
#include <stdint.h>
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
char buf[sizeof(__m512i)];
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
#if defined(__has_attribute) && __has_attribute (target)
2024-11-07 16:27:32 -05:00
__attribute__((target("avx512vpopcntdq,avx512bw")))
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
#endif
static int popcount_test(void)
{
Use <stdint.h> and <inttypes.h> for c.h integers.
Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.
One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.
This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
2024-12-03 20:46:59 -05:00
int64_t popcnt = 0;
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
__m512i accum = _mm512_setzero_si512();
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
__m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
__m512i cnt = _mm512_popcnt_epi64(val);
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
accum = _mm512_add_epi64(accum, cnt);
popcnt = _mm512_reduce_add_epi64(accum);
return (int) popcnt;
}
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
int
main ()
{
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
return popcount_test();
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
pgac_cv_avx512_popcnt_intrinsics=yes
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
else
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
pgac_cv_avx512_popcnt_intrinsics=no
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
Use __attribute__((target(...))) for AVX-512 support.
Presently, we check for compiler support for the required
intrinsics both with and without extra compiler flags (e.g.,
-mxsave), and then depending on the results of those checks, we
pick which files to compile with which flags. This is tedious and
complicated, and it results in unsustainable coding patterns such
as separate files for each portion of code may need to be built
with different compiler flags.
This commit introduces support for __attribute__((target(...))) and
uses it for the AVX-512 code. This simplifies both the
configure-time checks and the build scripts, and it allows us to
place the functions that use the intrinsics in files that we
otherwise do not want to build with special CPU instructions. We
are careful to avoid using __attribute__((target(...))) on
compilers that do not understand it, but we still perform the
configure-time checks in case the compiler allows using the
intrinsics without it (e.g., MSVC).
A similar change could likely be made for some of the CRC-32C code,
but that is left as a future exercise.
Suggested-by: Andres Freund
Reviewed-by: Raghuveer Devulapalli, Andres Freund
Discussion: https://postgr.es/m/20240731205254.vfpap7uxwmebqeaf%40awork3.anarazel.de
2024-11-07 14:58:43 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics" >&5
$as_echo "$pgac_cv_avx512_popcnt_intrinsics" >&6; }
if test x"$pgac_cv_avx512_popcnt_intrinsics" = x"yes"; then
Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible. Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers. This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions. If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().
Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16. The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.
Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
2024-04-06 22:56:23 -04:00
pgac_avx512_popcnt_intrinsics=yes
fi
if test x"$pgac_avx512_popcnt_intrinsics" = x"yes"; then
$as_echo "#define USE_AVX512_POPCNT_WITH_RUNTIME_CHECK 1" >>confdefs.h
fi
fi
2025-03-28 17:20:20 -04:00
# Check for SVE popcount intrinsics
#
if test x"$host_cpu" = x"aarch64"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for svcnt_x" >&5
$as_echo_n "checking for svcnt_x... " >&6; }
if ${pgac_cv_sve_popcnt_intrinsics+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <arm_sve.h>
char buf[128];
#if defined(__has_attribute) && __has_attribute (target)
__attribute__((target("arch=armv8-a+sve")))
#endif
static int popcount_test(void)
{
svbool_t pred = svptrue_b64();
svuint8_t vec8;
svuint64_t accum1 = svdup_u64(0),
accum2 = svdup_u64(0),
vec64;
char *p = buf;
uint64_t popcnt,
mask = 0x5555555555555555;
vec64 = svand_n_u64_x(pred, svld1_u64(pred, (const uint64_t *) p), mask);
accum1 = svadd_u64_x(pred, accum1, svcnt_u64_x(pred, vec64));
p += svcntb();
vec64 = svand_n_u64_x(pred, svld1_u64(pred, (const uint64_t *) p), mask);
accum2 = svadd_u64_x(pred, accum2, svcnt_u64_x(pred, vec64));
p += svcntb();
popcnt = svaddv_u64(pred, svadd_u64_x(pred, accum1, accum2));
pred = svwhilelt_b8_s32(0, sizeof(buf));
vec8 = svand_n_u8_x(pred, svld1_u8(pred, (const uint8_t *) p), 0x55);
return (int) (popcnt + svaddv_u8(pred, svcnt_u8_x(pred, vec8)));
}
int
main ()
{
return popcount_test();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_sve_popcnt_intrinsics=yes
else
pgac_cv_sve_popcnt_intrinsics=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_sve_popcnt_intrinsics" >&5
$as_echo "$pgac_cv_sve_popcnt_intrinsics" >&6; }
if test x"$pgac_cv_sve_popcnt_intrinsics" = x"yes"; then
pgac_sve_popcnt_intrinsics=yes
fi
if test x"$pgac_sve_popcnt_intrinsics" = x"yes"; then
$as_echo "#define USE_SVE_POPCNT_WITH_RUNTIME_CHECK 1" >>confdefs.h
fi
fi
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.
#
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u32" >&5
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u32... " >&6; }
if ${pgac_cv_sse42_crc32_intrinsics+:} false; then :
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
$as_echo_n "(cached) " >&6
else
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
/* end confdefs.h. */
#include <nmmintrin.h>
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
unsigned int crc;
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
#if defined(__has_attribute) && __has_attribute (target)
__attribute__((target("sse4.2")))
#endif
static int crc32_sse42_test(void)
{
crc = _mm_crc32_u8(crc, 0);
crc = _mm_crc32_u32(crc, 0);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
}
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
int
main ()
{
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
return crc32_sse42_test();
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
pgac_cv_sse42_crc32_intrinsics=yes
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
else
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
pgac_cv_sse42_crc32_intrinsics=no
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_sse42_crc32_intrinsics" >&5
$as_echo "$pgac_cv_sse42_crc32_intrinsics" >&6; }
if test x"$pgac_cv_sse42_crc32_intrinsics" = x"yes"; then
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
pgac_sse42_crc32_intrinsics=yes
fi
2015-04-14 12:56:03 -04:00
# Are we targeting a processor that supports SSE 4.2? gcc, clang and icc all
# define __SSE4_2__ in that case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __SSE4_2__
#error __SSE4_2__ not defined
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
SSE4_2_TARGETED=1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
# Check for ARMv8 CRC Extension intrinsics to do CRC calculations.
#
# First check if __crc32c* intrinsics can be used with the default compiler
2024-11-25 12:50:17 -05:00
# flags. If not, check if adding "-march=armv8-a+crc+simd" flag helps.
# On systems using soft-float ABI, "-march=armv8-a+crc" is required instead.
2022-12-01 21:46:55 -05:00
# CFLAGS_CRC is set if the extra flag is required.
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=" >&5
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... " >&6; }
if ${pgac_cv_armv8_crc32c_intrinsics_+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS "
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <arm_acle.h>
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
unsigned int crc;
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
int
main ()
{
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
crc = __crc32cb(crc, 0);
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
crc = __crc32ch(crc, 0);
crc = __crc32cw(crc, 0);
crc = __crc32cd(crc, 0);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_armv8_crc32c_intrinsics_=yes
else
pgac_cv_armv8_crc32c_intrinsics_=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS="$pgac_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics_" >&5
$as_echo "$pgac_cv_armv8_crc32c_intrinsics_" >&6; }
if test x"$pgac_cv_armv8_crc32c_intrinsics_" = x"yes"; then
2022-12-01 21:46:55 -05:00
CFLAGS_CRC=""
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
pgac_armv8_crc32c_intrinsics=yes
fi
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
2024-11-25 12:50:17 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd" >&5
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd... " >&6; }
if ${pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS -march=armv8-a+crc+simd"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <arm_acle.h>
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
unsigned int crc;
2024-11-25 12:50:17 -05:00
int
main ()
{
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
crc = __crc32cb(crc, 0);
2024-11-25 12:50:17 -05:00
crc = __crc32ch(crc, 0);
crc = __crc32cw(crc, 0);
crc = __crc32cd(crc, 0);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd=yes
else
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS="$pgac_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" >&5
$as_echo "$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" >&6; }
if test x"$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" = x"yes"; then
CFLAGS_CRC="-march=armv8-a+crc+simd"
pgac_armv8_crc32c_intrinsics=yes
fi
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc" >&5
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... " >&6; }
if ${pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
CFLAGS="$pgac_save_CFLAGS -march=armv8-a+crc"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <arm_acle.h>
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
unsigned int crc;
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
int
main ()
{
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
crc = __crc32cb(crc, 0);
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
crc = __crc32ch(crc, 0);
crc = __crc32cw(crc, 0);
crc = __crc32cd(crc, 0);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc=yes
else
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS="$pgac_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" >&5
$as_echo "$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" >&6; }
if test x"$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" = x"yes"; then
2022-12-01 21:46:55 -05:00
CFLAGS_CRC="-march=armv8-a+crc"
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
pgac_armv8_crc32c_intrinsics=yes
fi
2024-11-25 12:50:17 -05:00
fi
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
fi
2023-08-10 00:36:15 -04:00
# Check for LoongArch CRC intrinsics to do CRC calculations.
#
# Check if __builtin_loongarch_crcc_* intrinsics can be used
# with the default compiler flags.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_loongarch_crcc_w_b_w, __builtin_loongarch_crcc_w_h_w, __builtin_loongarch_crcc_w_w_w and __builtin_loongarch_crcc_w_d_w" >&5
$as_echo_n "checking for __builtin_loongarch_crcc_w_b_w, __builtin_loongarch_crcc_w_h_w, __builtin_loongarch_crcc_w_w_w and __builtin_loongarch_crcc_w_d_w... " >&6; }
if ${pgac_cv_loongarch_crc32c_intrinsics+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
unsigned int crc;
2023-08-10 00:36:15 -04:00
int
main ()
{
Be more paranoid in configure's checks for CRC and POPCNT intrinsics.
In these tests, we need to verify not only that the compiler has heard
of these intrinsics, but that lower-level tools cope with them too.
(For example, the assembler must also know the instructions, and on
some platforms there might be library support involved.) The hazard
is that the compiler might optimize away the calls altogether,
allowing the configure check to succeed only to have the build fail
later if lower-level support is missing. The existing code tried to
prevent that by ensuring that the result of the intrinsic is used
for something, but that's really insufficient because we were feeding
constant input to it. So the compiler would be perfectly entitled to
optimize away the calls anyway. Fix by making the inputs into global
variables. (Hypothetically, LTO optimization could still remove the
code --- but that's well past where we'd be likely to hit trouble.)
It is not known that any current compiler would actually optimize
away these calls, and even if that happened it would be unlikely
that any problem would manifest. Our concern for this stems from
largely-bygone days when it was common to install gcc on platforms
with some other native compiler, so that a compiler-vs-library
support discrepancy was more probable. Still, there's little
point in defending against such cases in a way that is visibly
incomplete.
I'm content to fix this in master for now; we can back-patch if
any indication appears that it's a live problem for someone.
Discussion: https://postgr.es/m/3368102.1741993462@sss.pgh.pa.us
2025-03-20 16:23:09 -04:00
crc = __builtin_loongarch_crcc_w_b_w(0, crc);
2023-08-10 00:36:15 -04:00
crc = __builtin_loongarch_crcc_w_h_w(0, crc);
crc = __builtin_loongarch_crcc_w_w_w(0, crc);
crc = __builtin_loongarch_crcc_w_d_w(0, crc);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_loongarch_crc32c_intrinsics=yes
else
pgac_cv_loongarch_crc32c_intrinsics=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_loongarch_crc32c_intrinsics" >&5
$as_echo "$pgac_cv_loongarch_crc32c_intrinsics" >&6; }
if test x"$pgac_cv_loongarch_crc32c_intrinsics" = x"yes"; then
pgac_loongarch_crc32c_intrinsics=yes
fi
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
2022-12-01 21:46:55 -05:00
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
# Select CRC-32C implementation.
#
Compute CRC32C using AVX-512 instructions where available
The previous implementation of CRC32C on x86 relied on the native
CRC32 instruction from the SSE 4.2 extension, which operates on
up to 8 bytes at a time. We can get a substantial speedup by using
carryless multiplication on SIMD registers, processing 64 bytes per
loop iteration. Shorter inputs fall back to ordinary CRC instructions.
On Intel Tiger Lake hardware (2020), CRC is now 50% faster for inputs
between 64 and 112 bytes, and 3x faster for 256 bytes.
The VPCLMULQDQ instruction on 512-bit registers has been available
on Intel hardware since 2019 and AMD since 2022. There is an older
variant for 128-bit registers, but at least on Zen 2 it performs worse
than normal CRC instructions for short inputs.
We must now do a runtime check, even for builds that target SSE
4.2. This doesn't matter in practice for WAL (arguably the most
critical case), because since commit e2809e3a1 the final computation
with the 20-byte WAL header is inlined and unrolled when targeting
that extension. Compared with two direct function calls, testing
showed equal or slightly faster performance in performing an indirect
function call on several dozen bytes followed by inlined instructions
on constant input of 20 bytes.
The MIT-licensed implementation was generated with the "generate"
program from
https://github.com/corsix/fast-crc32/
Based on: "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ
Instruction" V. Gopal, E. Ozturk, et al., 2009
Co-authored-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Co-authored-by: Paul Amonson <paul.d.amonson@intel.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Matthew Sterrett <matthewsterrett2@gmail.com> (earlier version)
Tested-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Tested-by: David Rowley <<dgrowleyml@gmail.com>> (earlier version)
Discussion: https://postgr.es/m/BL1PR11MB530401FA7E9B1CA432CF9DC3DC192@BL1PR11MB5304.namprd11.prod.outlook.com
Discussion: https://postgr.es/m/PH8PR11MB82869FF741DFA4E9A029FF13FBF72@PH8PR11MB8286.namprd11.prod.outlook.com
2025-04-06 03:04:30 -04:00
# There are three methods of calculating CRC, in order of increasing
# performance:
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
#
Compute CRC32C using AVX-512 instructions where available
The previous implementation of CRC32C on x86 relied on the native
CRC32 instruction from the SSE 4.2 extension, which operates on
up to 8 bytes at a time. We can get a substantial speedup by using
carryless multiplication on SIMD registers, processing 64 bytes per
loop iteration. Shorter inputs fall back to ordinary CRC instructions.
On Intel Tiger Lake hardware (2020), CRC is now 50% faster for inputs
between 64 and 112 bytes, and 3x faster for 256 bytes.
The VPCLMULQDQ instruction on 512-bit registers has been available
on Intel hardware since 2019 and AMD since 2022. There is an older
variant for 128-bit registers, but at least on Zen 2 it performs worse
than normal CRC instructions for short inputs.
We must now do a runtime check, even for builds that target SSE
4.2. This doesn't matter in practice for WAL (arguably the most
critical case), because since commit e2809e3a1 the final computation
with the 20-byte WAL header is inlined and unrolled when targeting
that extension. Compared with two direct function calls, testing
showed equal or slightly faster performance in performing an indirect
function call on several dozen bytes followed by inlined instructions
on constant input of 20 bytes.
The MIT-licensed implementation was generated with the "generate"
program from
https://github.com/corsix/fast-crc32/
Based on: "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ
Instruction" V. Gopal, E. Ozturk, et al., 2009
Co-authored-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Co-authored-by: Paul Amonson <paul.d.amonson@intel.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Matthew Sterrett <matthewsterrett2@gmail.com> (earlier version)
Tested-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Tested-by: David Rowley <<dgrowleyml@gmail.com>> (earlier version)
Discussion: https://postgr.es/m/BL1PR11MB530401FA7E9B1CA432CF9DC3DC192@BL1PR11MB5304.namprd11.prod.outlook.com
Discussion: https://postgr.es/m/PH8PR11MB82869FF741DFA4E9A029FF13FBF72@PH8PR11MB8286.namprd11.prod.outlook.com
2025-04-06 03:04:30 -04:00
# 1. The fallback using a lookup table, called slicing-by-8
# 2. CRC-32C instructions (found in e.g. Intel SSE 4.2 and ARMv8 CRC Extension)
# 3. Algorithms using carryless multiplication instructions
# (e.g. Intel PCLMUL and Arm PMULL)
#
# If we can produce code (via function attributes or additional compiler
# flags) that uses #2 (and possibly #3), we compile all implementations
# and select which one to use at runtime, depending on what is supported
# by the processor we're running on.
#
# If we are targeting a processor that has #2, we can use that without
# runtime selection.
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
#
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
Presently, we check for compiler support for the required
intrinsics both with and without the -msse4.2 compiler flag, and
then depending on the results of those checks, we pick which files
to compile with which flags. This is tedious and complicated, and
it results in unsustainable coding patterns such as separate files
for each portion of code that may need to be built with different
compiler flags.
This commit makes use of the newly-added support for
__attribute__((target(...))) in the SSE4.2 CRC-32C code. This
simplifies both the configure-time checks and the build scripts,
and it allows us to place the functions that use the intrinsics in
files that we otherwise do not want to build with special CPU
instructions (although this commit refrains from doing so). This
is also preparatory work for a proposed follow-up commit that will
further optimize the CRC-32C code with AVX-512 instructions.
While at it, this commit modifies meson's checks for SSE4.2 CRC
support to be the same as autoconf's. meson was choosing whether
to use a runtime check based purely on whether -msse4.2 is
required, while autoconf has long checked for the __SSE4_2__
preprocessor symbol to decide. meson's previous approach seems to
work just fine, but this change avoids needing to build multiple
test programs and to keep track of whether to actually use
pg_attribute_target().
Ideally we'd use __attribute__((target(...))) for ARMv8 CRC
support, too, but there's little point in doing so because until
clang 16, using the ARM intrinsics still requires special compiler
flags. Perhaps we can re-evaluate this decision after some time
has passed.
Author: Raghuveer Devulapalli
Discussion: https://postgr.es/m/PH8PR11MB8286BE735A463468415D46B5FB5C2%40PH8PR11MB8286.namprd11.prod.outlook.com
2024-11-27 17:19:05 -05:00
# Note that we do not use __attribute__((target("..."))) for the ARM CRC
# instructions because until clang 16, using the ARM intrinsics still requires
# special -march flags. Perhaps we can re-evaluate this decision after some
# time has passed.
#
2023-08-10 00:36:15 -04:00
# You can skip the runtime check by setting the appropriate USE_*_CRC32 flag to 1
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
# in the template or configure command line.
2023-08-10 00:36:15 -04:00
#
# If we are targeting a LoongArch processor, CRC instructions are
# always available (at least on 64 bit), so no runtime check is needed.
if test x"$USE_SLICING_BY_8_CRC32C" = x"" && test x"$USE_SSE42_CRC32C" = x"" && test x"$USE_SSE42_CRC32C_WITH_RUNTIME_CHECK" = x"" && test x"$USE_ARMV8_CRC32C" = x"" && test x"$USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK" = x"" && test x"$USE_LOONGARCH_CRC32C" = x""; then
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
# Use Intel SSE 4.2 if available.
2015-04-14 12:56:03 -04:00
if test x"$pgac_sse42_crc32_intrinsics" = x"yes" && test x"$SSE4_2_TARGETED" = x"1" ; then
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
USE_SSE42_CRC32C=1
else
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
# Intel SSE 4.2, with runtime check? The CPUID instruction is needed for
# the runtime check.
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
if test x"$pgac_sse42_crc32_intrinsics" = x"yes" && (test x"$pgac_cv__get_cpuid" = x"yes" || test x"$pgac_cv__cpuid" = x"yes"); then
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK=1
else
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
# Use ARM CRC Extension if available.
2022-12-01 21:46:55 -05:00
if test x"$pgac_armv8_crc32c_intrinsics" = x"yes" && test x"$CFLAGS_CRC" = x""; then
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
USE_ARMV8_CRC32C=1
else
2018-05-02 18:06:43 -04:00
# ARM CRC Extension, with runtime check?
if test x"$pgac_armv8_crc32c_intrinsics" = x"yes"; then
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK=1
else
2023-08-10 00:36:15 -04:00
# LoongArch CRCC instructions.
if test x"$pgac_loongarch_crc32c_intrinsics" = x"yes"; then
USE_LOONGARCH_CRC32C=1
else
# fall back to slicing-by-8 algorithm, which doesn't require any
# special CPU support.
USE_SLICING_BY_8_CRC32C=1
fi
fi
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
fi
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
fi
fi
fi
# Set PG_CRC32C_OBJS appropriately depending on the selected implementation.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which CRC-32C implementation to use" >&5
$as_echo_n "checking which CRC-32C implementation to use... " >&6; }
if test x"$USE_SSE42_CRC32C" = x"1"; then
$as_echo "#define USE_SSE42_CRC32C 1" >>confdefs.h
Compute CRC32C using AVX-512 instructions where available
The previous implementation of CRC32C on x86 relied on the native
CRC32 instruction from the SSE 4.2 extension, which operates on
up to 8 bytes at a time. We can get a substantial speedup by using
carryless multiplication on SIMD registers, processing 64 bytes per
loop iteration. Shorter inputs fall back to ordinary CRC instructions.
On Intel Tiger Lake hardware (2020), CRC is now 50% faster for inputs
between 64 and 112 bytes, and 3x faster for 256 bytes.
The VPCLMULQDQ instruction on 512-bit registers has been available
on Intel hardware since 2019 and AMD since 2022. There is an older
variant for 128-bit registers, but at least on Zen 2 it performs worse
than normal CRC instructions for short inputs.
We must now do a runtime check, even for builds that target SSE
4.2. This doesn't matter in practice for WAL (arguably the most
critical case), because since commit e2809e3a1 the final computation
with the 20-byte WAL header is inlined and unrolled when targeting
that extension. Compared with two direct function calls, testing
showed equal or slightly faster performance in performing an indirect
function call on several dozen bytes followed by inlined instructions
on constant input of 20 bytes.
The MIT-licensed implementation was generated with the "generate"
program from
https://github.com/corsix/fast-crc32/
Based on: "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ
Instruction" V. Gopal, E. Ozturk, et al., 2009
Co-authored-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Co-authored-by: Paul Amonson <paul.d.amonson@intel.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Matthew Sterrett <matthewsterrett2@gmail.com> (earlier version)
Tested-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Tested-by: David Rowley <<dgrowleyml@gmail.com>> (earlier version)
Discussion: https://postgr.es/m/BL1PR11MB530401FA7E9B1CA432CF9DC3DC192@BL1PR11MB5304.namprd11.prod.outlook.com
Discussion: https://postgr.es/m/PH8PR11MB82869FF741DFA4E9A029FF13FBF72@PH8PR11MB8286.namprd11.prod.outlook.com
2025-04-06 03:04:30 -04:00
PG_CRC32C_OBJS="pg_crc32c_sse42.o pg_crc32c_sse42_choose.o"
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: SSE 4.2" >&5
$as_echo "SSE 4.2" >&6; }
else
if test x"$USE_SSE42_CRC32C_WITH_RUNTIME_CHECK" = x"1"; then
$as_echo "#define USE_SSE42_CRC32C_WITH_RUNTIME_CHECK 1" >>confdefs.h
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
PG_CRC32C_OBJS="pg_crc32c_sse42.o pg_crc32c_sb8.o pg_crc32c_sse42_choose.o"
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: SSE 4.2 with runtime check" >&5
$as_echo "SSE 4.2 with runtime check" >&6; }
else
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
if test x"$USE_ARMV8_CRC32C" = x"1"; then
$as_echo "#define USE_ARMV8_CRC32C 1" >>confdefs.h
PG_CRC32C_OBJS="pg_crc32c_armv8.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ARMv8 CRC instructions" >&5
$as_echo "ARMv8 CRC instructions" >&6; }
else
if test x"$USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK" = x"1"; then
$as_echo "#define USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK 1" >>confdefs.h
PG_CRC32C_OBJS="pg_crc32c_armv8.o pg_crc32c_sb8.o pg_crc32c_armv8_choose.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ARMv8 CRC instructions with runtime check" >&5
$as_echo "ARMv8 CRC instructions with runtime check" >&6; }
else
2023-08-10 00:36:15 -04:00
if test x"$USE_LOONGARCH_CRC32C" = x"1"; then
$as_echo "#define USE_LOONGARCH_CRC32C 1" >>confdefs.h
PG_CRC32C_OBJS="pg_crc32c_loongarch.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LoongArch CRCC instructions" >&5
$as_echo "LoongArch CRCC instructions" >&6; }
else
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
$as_echo "#define USE_SLICING_BY_8_CRC32C 1" >>confdefs.h
2023-08-10 00:36:15 -04:00
PG_CRC32C_OBJS="pg_crc32c_sb8.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: slicing-by-8" >&5
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
$as_echo "slicing-by-8" >&6; }
2023-08-10 00:36:15 -04:00
fi
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 05:22:45 -04:00
fi
fi
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
fi
fi
Compute CRC32C using AVX-512 instructions where available
The previous implementation of CRC32C on x86 relied on the native
CRC32 instruction from the SSE 4.2 extension, which operates on
up to 8 bytes at a time. We can get a substantial speedup by using
carryless multiplication on SIMD registers, processing 64 bytes per
loop iteration. Shorter inputs fall back to ordinary CRC instructions.
On Intel Tiger Lake hardware (2020), CRC is now 50% faster for inputs
between 64 and 112 bytes, and 3x faster for 256 bytes.
The VPCLMULQDQ instruction on 512-bit registers has been available
on Intel hardware since 2019 and AMD since 2022. There is an older
variant for 128-bit registers, but at least on Zen 2 it performs worse
than normal CRC instructions for short inputs.
We must now do a runtime check, even for builds that target SSE
4.2. This doesn't matter in practice for WAL (arguably the most
critical case), because since commit e2809e3a1 the final computation
with the 20-byte WAL header is inlined and unrolled when targeting
that extension. Compared with two direct function calls, testing
showed equal or slightly faster performance in performing an indirect
function call on several dozen bytes followed by inlined instructions
on constant input of 20 bytes.
The MIT-licensed implementation was generated with the "generate"
program from
https://github.com/corsix/fast-crc32/
Based on: "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ
Instruction" V. Gopal, E. Ozturk, et al., 2009
Co-authored-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Co-authored-by: Paul Amonson <paul.d.amonson@intel.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Matthew Sterrett <matthewsterrett2@gmail.com> (earlier version)
Tested-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Tested-by: David Rowley <<dgrowleyml@gmail.com>> (earlier version)
Discussion: https://postgr.es/m/BL1PR11MB530401FA7E9B1CA432CF9DC3DC192@BL1PR11MB5304.namprd11.prod.outlook.com
Discussion: https://postgr.es/m/PH8PR11MB82869FF741DFA4E9A029FF13FBF72@PH8PR11MB8286.namprd11.prod.outlook.com
2025-04-06 03:04:30 -04:00
# Check for carryless multiplication intrinsics to do vectorized CRC calculations.
#
if test x"$host_cpu" = x"x86_64"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_clmulepi64_epi128" >&5
$as_echo_n "checking for _mm512_clmulepi64_epi128... " >&6; }
if ${pgac_cv_avx512_pclmul_intrinsics+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <immintrin.h>
__m512i x;
__m512i y;
#if defined(__has_attribute) && __has_attribute (target)
__attribute__((target("vpclmulqdq,avx512vl")))
#endif
static int avx512_pclmul_test(void)
{
__m128i z;
2025-06-23 11:50:21 -04:00
x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x);
Compute CRC32C using AVX-512 instructions where available
The previous implementation of CRC32C on x86 relied on the native
CRC32 instruction from the SSE 4.2 extension, which operates on
up to 8 bytes at a time. We can get a substantial speedup by using
carryless multiplication on SIMD registers, processing 64 bytes per
loop iteration. Shorter inputs fall back to ordinary CRC instructions.
On Intel Tiger Lake hardware (2020), CRC is now 50% faster for inputs
between 64 and 112 bytes, and 3x faster for 256 bytes.
The VPCLMULQDQ instruction on 512-bit registers has been available
on Intel hardware since 2019 and AMD since 2022. There is an older
variant for 128-bit registers, but at least on Zen 2 it performs worse
than normal CRC instructions for short inputs.
We must now do a runtime check, even for builds that target SSE
4.2. This doesn't matter in practice for WAL (arguably the most
critical case), because since commit e2809e3a1 the final computation
with the 20-byte WAL header is inlined and unrolled when targeting
that extension. Compared with two direct function calls, testing
showed equal or slightly faster performance in performing an indirect
function call on several dozen bytes followed by inlined instructions
on constant input of 20 bytes.
The MIT-licensed implementation was generated with the "generate"
program from
https://github.com/corsix/fast-crc32/
Based on: "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ
Instruction" V. Gopal, E. Ozturk, et al., 2009
Co-authored-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Co-authored-by: Paul Amonson <paul.d.amonson@intel.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)
Reviewed-by: Matthew Sterrett <matthewsterrett2@gmail.com> (earlier version)
Tested-by: Raghuveer Devulapalli <raghuveer.devulapalli@intel.com>
Tested-by: David Rowley <<dgrowleyml@gmail.com>> (earlier version)
Discussion: https://postgr.es/m/BL1PR11MB530401FA7E9B1CA432CF9DC3DC192@BL1PR11MB5304.namprd11.prod.outlook.com
Discussion: https://postgr.es/m/PH8PR11MB82869FF741DFA4E9A029FF13FBF72@PH8PR11MB8286.namprd11.prod.outlook.com
2025-04-06 03:04:30 -04:00
y = _mm512_clmulepi64_epi128(x, y, 0);
z = _mm_ternarylogic_epi64(
_mm512_castsi512_si128(y),
_mm512_extracti32x4_epi32(y, 1),
_mm512_extracti32x4_epi32(y, 2),
0x96);
return _mm_crc32_u64(0, _mm_extract_epi64(z, 0));
}
int
main ()
{
return avx512_pclmul_test();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_avx512_pclmul_intrinsics=yes
else
pgac_cv_avx512_pclmul_intrinsics=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_pclmul_intrinsics" >&5
$as_echo "$pgac_cv_avx512_pclmul_intrinsics" >&6; }
if test x"$pgac_cv_avx512_pclmul_intrinsics" = x"yes"; then
pgac_avx512_pclmul_intrinsics=yes
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for vectorized CRC-32C" >&5
$as_echo_n "checking for vectorized CRC-32C... " >&6; }
if test x"$pgac_avx512_pclmul_intrinsics" = x"yes"; then
$as_echo "#define USE_AVX512_CRC32C_WITH_RUNTIME_CHECK 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: AVX-512 with runtime check" >&5
$as_echo "AVX-512 with runtime check" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
$as_echo "none" >&6; }
fi
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 10:05:03 -04:00
2002-05-04 20:03:29 -04:00
# Select semaphore implementation type.
2006-04-29 16:47:31 -04:00
if test "$PORTNAME" != "win32"; then
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
if test x"$PREFERRED_SEMAPHORES" = x"NAMED_POSIX" ; then
# Need sem_open for this
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_open" >&5
$as_echo_n "checking for library containing sem_open... " >&6; }
if ${ac_cv_search_sem_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char sem_open ();
int
main ()
{
return sem_open ();
;
return 0;
}
_ACEOF
for ac_lib in '' rt pthread; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_sem_open=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_sem_open+:} false; then :
break
fi
done
if ${ac_cv_search_sem_open+:} false; then :
else
ac_cv_search_sem_open=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sem_open" >&5
$as_echo "$ac_cv_search_sem_open" >&6; }
ac_res=$ac_cv_search_sem_open
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
USE_NAMED_POSIX_SEMAPHORES=1
fi
fi
if test x"$PREFERRED_SEMAPHORES" = x"UNNAMED_POSIX" ; then
# Need sem_init for this
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
$as_echo_n "checking for library containing sem_init... " >&6; }
if ${ac_cv_search_sem_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char sem_init ();
int
main ()
{
return sem_init ();
;
return 0;
}
_ACEOF
for ac_lib in '' rt pthread; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_sem_init=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_sem_init+:} false; then :
break
fi
done
if ${ac_cv_search_sem_init+:} false; then :
else
ac_cv_search_sem_init=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sem_init" >&5
$as_echo "$ac_cv_search_sem_init" >&6; }
ac_res=$ac_cv_search_sem_init
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
USE_UNNAMED_POSIX_SEMAPHORES=1
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which semaphore API to use" >&5
$as_echo_n "checking which semaphore API to use... " >&6; }
2006-04-29 16:47:31 -04:00
if test x"$USE_NAMED_POSIX_SEMAPHORES" = x"1" ; then
2002-05-04 20:03:29 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_NAMED_POSIX_SEMAPHORES 1" >>confdefs.h
2002-05-04 20:03:29 -04:00
2006-04-29 16:47:31 -04:00
SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
sematype="named POSIX"
2006-04-29 16:47:31 -04:00
else
if test x"$USE_UNNAMED_POSIX_SEMAPHORES" = x"1" ; then
2002-05-04 20:03:29 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_UNNAMED_POSIX_SEMAPHORES 1" >>confdefs.h
2002-05-04 20:03:29 -04:00
2006-04-29 16:47:31 -04:00
SEMA_IMPLEMENTATION="src/backend/port/posix_sema.c"
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
sematype="unnamed POSIX"
2006-04-29 16:47:31 -04:00
else
2002-05-04 20:03:29 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_SYSV_SEMAPHORES 1" >>confdefs.h
2002-05-04 20:03:29 -04:00
2006-04-29 16:47:31 -04:00
SEMA_IMPLEMENTATION="src/backend/port/sysv_sema.c"
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
sematype="System V"
2006-04-29 16:47:31 -04:00
fi
2016-12-06 19:34:29 -05:00
fi
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sematype" >&5
$as_echo "$sematype" >&6; }
2006-04-29 16:47:31 -04:00
else
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_WIN32_SEMAPHORES 1" >>confdefs.h
2006-04-29 16:47:31 -04:00
SEMA_IMPLEMENTATION="src/backend/port/win32_sema.c"
2002-05-04 20:03:29 -04:00
fi
# Select shared-memory implementation type.
2007-03-21 10:39:23 -04:00
if test "$PORTNAME" != "win32"; then
2002-05-04 20:03:29 -04:00
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_SYSV_SHARED_MEMORY 1" >>confdefs.h
2002-05-04 20:03:29 -04:00
2007-03-21 10:39:23 -04:00
SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
else
2013-12-18 20:53:23 -05:00
$as_echo "#define USE_WIN32_SHARED_MEMORY 1" >>confdefs.h
2002-05-04 20:03:29 -04:00
2007-03-21 10:39:23 -04:00
SHMEM_IMPLEMENTATION="src/backend/port/win32_shmem.c"
fi
2002-05-04 20:03:29 -04:00
2020-11-20 06:26:57 -05:00
# Select random number source. If a TLS library is used then it will be the
# first choice, else the native platform sources (Windows API or /dev/urandom)
# will be used.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which random number source to use" >&5
$as_echo_n "checking which random number source to use... " >&6; }
2021-02-01 05:19:44 -05:00
if test x"$with_ssl" = x"openssl" ; then
2020-11-20 06:26:57 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OpenSSL" >&5
$as_echo "OpenSSL" >&6; }
elif test x"$PORTNAME" = x"win32" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows native" >&5
$as_echo "Windows native" >&6; }
2021-11-30 17:18:04 -05:00
elif test x"$cross_compiling" = x"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming /dev/urandom" >&5
$as_echo "assuming /dev/urandom" >&6; }
2020-11-20 06:26:57 -05:00
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: /dev/urandom" >&5
$as_echo "/dev/urandom" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
Replace PostmasterRandom() with a stronger source, second attempt.
This adds a new routine, pg_strong_random() for generating random bytes,
for use in both frontend and backend. At the moment, it's only used in
the backend, but the upcoming SCRAM authentication patches need strong
random numbers in libpq as well.
pg_strong_random() is based on, and replaces, the existing implementation
in pgcrypto. It can acquire strong random numbers from a number of sources,
depending on what's available:
- OpenSSL RAND_bytes(), if built with OpenSSL
- On Windows, the native cryptographic functions are used
- /dev/urandom
Unlike the current pgcrypto function, the source is chosen by configure.
That makes it easier to test different implementations, and ensures that
we don't accidentally fall back to a less secure implementation, if the
primary source fails. All of those methods are quite reliable, it would be
pretty surprising for them to fail, so we'd rather find out by failing
hard.
If no strong random source is available, we fall back to using erand48(),
seeded from current timestamp, like PostmasterRandom() was. That isn't
cryptographically secure, but allows us to still work on platforms that
don't have any of the above stronger sources. Because it's not very secure,
the built-in implementation is only used if explicitly requested with
--disable-strong-random.
This replaces the more complicated Fortuna algorithm we used to have in
pgcrypto, which is unfortunate, but all modern platforms have /dev/urandom,
so it doesn't seem worth the maintenance effort to keep that. pgcrypto
functions that require strong random numbers will be disabled with
--disable-strong-random.
Original patch by Magnus Hagander, tons of further work by Michael Paquier
and me.
Discussion: https://www.postgresql.org/message-id/CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAB7nPqRWkNYRRPJA7-cF+LfroYV10pvjdz6GNvxk-Eee9FypKA@mail.gmail.com
2016-12-05 06:42:59 -05:00
$as_echo_n "checking for /dev/urandom... " >&6; }
if ${ac_cv_file__dev_urandom+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/urandom"; then
ac_cv_file__dev_urandom=yes
else
ac_cv_file__dev_urandom=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5
$as_echo "$ac_cv_file__dev_urandom" >&6; }
if test "x$ac_cv_file__dev_urandom" = xyes; then :
fi
2020-11-20 06:26:57 -05:00
if test x"$ac_cv_file__dev_urandom" = x"no" ; then
as_fn_error $? "
2019-01-01 06:05:51 -05:00
no source of strong random numbers was found
2020-11-20 06:26:57 -05:00
PostgreSQL can use OpenSSL, native Windows API or /dev/urandom as a source of random numbers." "$LINENO" 5
fi
Replace PostmasterRandom() with a stronger source, second attempt.
This adds a new routine, pg_strong_random() for generating random bytes,
for use in both frontend and backend. At the moment, it's only used in
the backend, but the upcoming SCRAM authentication patches need strong
random numbers in libpq as well.
pg_strong_random() is based on, and replaces, the existing implementation
in pgcrypto. It can acquire strong random numbers from a number of sources,
depending on what's available:
- OpenSSL RAND_bytes(), if built with OpenSSL
- On Windows, the native cryptographic functions are used
- /dev/urandom
Unlike the current pgcrypto function, the source is chosen by configure.
That makes it easier to test different implementations, and ensures that
we don't accidentally fall back to a less secure implementation, if the
primary source fails. All of those methods are quite reliable, it would be
pretty surprising for them to fail, so we'd rather find out by failing
hard.
If no strong random source is available, we fall back to using erand48(),
seeded from current timestamp, like PostmasterRandom() was. That isn't
cryptographically secure, but allows us to still work on platforms that
don't have any of the above stronger sources. Because it's not very secure,
the built-in implementation is only used if explicitly requested with
--disable-strong-random.
This replaces the more complicated Fortuna algorithm we used to have in
pgcrypto, which is unfortunate, but all modern platforms have /dev/urandom,
so it doesn't seem worth the maintenance effort to keep that. pgcrypto
functions that require strong random numbers will be disabled with
--disable-strong-random.
Original patch by Magnus Hagander, tons of further work by Michael Paquier
and me.
Discussion: https://www.postgresql.org/message-id/CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAB7nPqRWkNYRRPJA7-cF+LfroYV10pvjdz6GNvxk-Eee9FypKA@mail.gmail.com
2016-12-05 06:42:59 -05:00
fi
2006-02-03 08:53:15 -05:00
# If not set in template file, set bytes to use libc memset()
if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
MEMSET_LOOP_LIMIT=1024
fi
cat >>confdefs.h <<_ACEOF
2007-11-15 23:29:45 -05:00
#define MEMSET_LOOP_LIMIT ${MEMSET_LOOP_LIMIT}
_ACEOF
2006-08-23 08:59:18 -04:00
2008-02-17 11:36:43 -05:00
if test "$enable_nls" = yes ; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing bind_textdomain_codeset" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for library containing bind_textdomain_codeset... " >&6; }
2013-12-18 20:53:23 -05:00
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2008-02-17 11:36:43 -05:00
else
ac_func_search_save_LIBS=$LIBS
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2007-11-15 23:59:25 -05:00
/* end confdefs.h. */
2008-02-17 11:36:43 -05:00
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
2002-03-29 19:20:15 -05:00
#ifdef __cplusplus
extern "C"
#endif
2008-05-27 18:18:04 -04:00
char bind_textdomain_codeset ();
2002-03-29 19:20:15 -05:00
int
main ()
{
2008-05-27 18:18:04 -04:00
return bind_textdomain_codeset ();
2002-03-29 19:20:15 -05:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
for ac_lib in '' intl; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_bind_textdomain_codeset=$ac_res
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
break
fi
done
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
ac_cv_search_bind_textdomain_codeset=no
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_bind_textdomain_codeset" >&5
$as_echo "$ac_cv_search_bind_textdomain_codeset" >&6; }
ac_res=$ac_cv_search_bind_textdomain_codeset
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "a gettext implementation is required for NLS" "$LINENO" 5
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default"
if test "x$ac_cv_header_libintl_h" = xyes; then :
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "header file <libintl.h> is required for NLS" "$LINENO" 5
2002-03-29 19:20:15 -05:00
fi
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$MSGFMT"; then
2002-03-29 19:20:15 -05:00
for ac_prog in msgfmt
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_MSGFMT+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 19:20:15 -05:00
else
2017-07-31 13:02:49 -04:00
case $MSGFMT in
[\\/]* | ?:[\\/]*)
ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2002-03-29 19:20:15 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 19:20:15 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 19:20:15 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2002-03-29 19:20:15 -05:00
fi
2017-07-31 13:02:49 -04:00
MSGFMT=$ac_cv_path_MSGFMT
2002-03-29 19:20:15 -05:00
if test -n "$MSGFMT"; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$MSGFMT" >&6; }
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2002-03-29 19:20:15 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
test -n "$MSGFMT" && break
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of MSGFMT in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSGFMT" >&5
$as_echo_n "checking for MSGFMT... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
$as_echo "$MSGFMT" >&6; }
fi
2019-01-18 02:29:42 -05:00
if test -z "$MSGFMT"; then
2013-12-18 20:53:23 -05:00
as_fn_error $? "msgfmt is required for NLS" "$LINENO" 5
2002-03-29 19:20:15 -05:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgfmt flags" >&5
2013-09-11 14:34:28 -04:00
$as_echo_n "checking for msgfmt flags... " >&6; }
2013-12-18 20:53:23 -05:00
if ${pgac_cv_msgfmt_flags+:} false; then :
2013-09-11 14:34:28 -04:00
$as_echo_n "(cached) " >&6
else
if test x"$MSGFMT" != x"" && "$MSGFMT" --version 2>&1 | grep "GNU" >/dev/null; then
pgac_cv_msgfmt_flags=-c
fi
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_msgfmt_flags" >&5
2013-09-11 14:34:28 -04:00
$as_echo "$pgac_cv_msgfmt_flags" >&6; }
MSGFMT_FLAGS=$pgac_cv_msgfmt_flags
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$MSGMERGE"; then
2002-03-29 19:20:15 -05:00
for ac_prog in msgmerge
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_MSGMERGE+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 19:20:15 -05:00
else
2017-07-31 13:02:49 -04:00
case $MSGMERGE in
[\\/]* | ?:[\\/]*)
ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2002-03-29 19:20:15 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 19:20:15 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 19:20:15 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2002-03-29 19:20:15 -05:00
fi
2017-07-31 13:02:49 -04:00
MSGMERGE=$ac_cv_path_MSGMERGE
2002-03-29 19:20:15 -05:00
if test -n "$MSGMERGE"; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$MSGMERGE" >&6; }
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2002-03-29 19:20:15 -05:00
fi
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
test -n "$MSGMERGE" && break
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of MSGMERGE in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSGMERGE" >&5
$as_echo_n "checking for MSGMERGE... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
$as_echo "$MSGMERGE" >&6; }
fi
if test -z "$XGETTEXT"; then
2002-03-29 19:20:15 -05:00
for ac_prog in xgettext
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
2017-07-31 13:02:49 -04:00
if ${ac_cv_path_XGETTEXT+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2002-03-29 19:20:15 -05:00
else
2017-07-31 13:02:49 -04:00
case $XGETTEXT in
[\\/]* | ?:[\\/]*)
ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2002-03-29 19:20:15 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-07-31 13:02:49 -04:00
ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 19:20:15 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 19:20:15 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2002-03-29 19:20:15 -05:00
fi
2017-07-31 13:02:49 -04:00
XGETTEXT=$ac_cv_path_XGETTEXT
2002-03-29 19:20:15 -05:00
if test -n "$XGETTEXT"; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$XGETTEXT" >&6; }
2002-03-29 19:20:15 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2002-03-29 12:32:55 -05:00
fi
2002-03-29 19:20:15 -05:00
2008-02-17 11:36:43 -05:00
2002-03-29 19:20:15 -05:00
test -n "$XGETTEXT" && break
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of XGETTEXT in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGETTEXT" >&5
$as_echo_n "checking for XGETTEXT... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
$as_echo "$XGETTEXT" >&6; }
fi
2002-03-29 19:20:15 -05:00
2002-03-29 12:32:55 -05:00
fi
2002-03-29 19:20:15 -05:00
2000-09-25 18:23:01 -04:00
# Check for Tcl configuration script tclConfig.sh
if test "$with_tcl" = yes; then
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
if test -z "$TCLSH"; then
for ac_prog in tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84
2000-09-25 18:23:01 -04:00
do
2002-03-29 12:32:55 -05:00
# Extract the first word of "$ac_prog", so it can be a program name with args.
2000-09-25 18:23:01 -04:00
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
2013-12-18 20:53:23 -05:00
if ${ac_cv_path_TCLSH+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
1998-10-18 00:19:05 -04:00
else
2002-03-29 12:32:55 -05:00
case $TCLSH in
[\\/]* | ?:[\\/]*)
1998-10-18 00:19:05 -04:00
ac_cv_path_TCLSH="$TCLSH" # Let the user override the test with a path.
;;
*)
2002-03-29 12:32:55 -05:00
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2002-03-29 12:32:55 -05:00
ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 12:32:55 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 12:32:55 -05:00
1998-10-18 00:19:05 -04:00
;;
esac
fi
2002-03-29 12:32:55 -05:00
TCLSH=$ac_cv_path_TCLSH
1998-10-18 00:19:05 -04:00
if test -n "$TCLSH"; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$TCLSH" >&6; }
1998-10-18 00:19:05 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
1998-10-18 00:19:05 -04:00
fi
1998-10-15 12:01:45 -04:00
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
test -n "$TCLSH" && break
2000-09-25 18:23:01 -04:00
done
1998-10-15 12:01:45 -04:00
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
# Report the value of TCLSH in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TCLSH" >&5
$as_echo_n "checking for TCLSH... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
$as_echo "$TCLSH" >&6; }
fi
2008-07-23 13:07:50 -04:00
if test x"$TCLSH" = x""; then
2013-12-18 20:53:23 -05:00
as_fn_error $? "Tcl shell not found" "$LINENO" 5
2008-07-23 13:07:50 -04:00
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclConfig.sh" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for tclConfig.sh... " >&6; }
2000-09-25 18:23:01 -04:00
# Let user override test
if test -z "$TCL_CONFIG_SH"; then
pgac_test_dirs="$with_tclconfig"
1998-10-15 12:01:45 -04:00
2000-09-25 18:23:01 -04:00
set X $pgac_test_dirs; shift
if test $# -eq 0; then
2013-12-18 20:53:23 -05:00
test -z "$TCLSH" && as_fn_error $? "unable to locate tclConfig.sh because no Tcl shell was found" "$LINENO" 5
2018-09-25 13:23:29 -04:00
pgac_test_dirs=`echo 'puts $auto_path' | $TCLSH`
# On newer macOS, $auto_path frequently doesn't include the place
# where tclConfig.sh actually lives. Append that to the end, so as not
# to break cases where a non-default Tcl installation is being used.
if test -d "$PG_SYSROOT/System/Library/Frameworks/Tcl.framework" ; then
pgac_test_dirs="$pgac_test_dirs $PG_SYSROOT/System/Library/Frameworks/Tcl.framework"
fi
set X $pgac_test_dirs; shift
1999-10-31 06:51:29 -05:00
fi
2000-09-30 06:45:17 -04:00
for pgac_dir do
2000-09-25 18:23:01 -04:00
if test -r "$pgac_dir/tclConfig.sh"; then
TCL_CONFIG_SH=$pgac_dir/tclConfig.sh
break
fi
done
1998-10-15 12:01:45 -04:00
fi
2000-09-25 18:23:01 -04:00
if test -z "$TCL_CONFIG_SH"; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2013-12-18 20:53:23 -05:00
as_fn_error $? "file 'tclConfig.sh' is required for Tcl" "$LINENO" 5
2000-09-25 18:23:01 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCL_CONFIG_SH" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$TCL_CONFIG_SH" >&6; }
2000-09-25 18:23:01 -04:00
fi
2000-07-15 11:54:52 -04:00
1998-10-15 12:01:45 -04:00
2002-05-24 14:10:17 -04:00
. "$TCL_CONFIG_SH"
2003-02-11 16:05:35 -05:00
eval TCL_INCLUDE_SPEC=\"$TCL_INCLUDE_SPEC\"
2002-05-24 14:10:17 -04:00
eval TCL_LIBS=\"$TCL_LIBS\"
eval TCL_LIB_SPEC=\"$TCL_LIB_SPEC\"
eval TCL_SHARED_BUILD=\"$TCL_SHARED_BUILD\"
2022-08-18 11:22:13 -04:00
if test "$TCL_SHARED_BUILD" != 1; then
Move interpreter shared library detection to configure
For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of
libperl, libpython, and libtcl, respectively. Previously, this was
checked in the makefiles, skipping the PL build with a warning if no
shared library was available. Now this is checked in configure, with an
error if no shared library is available.
The previous situation arose because in the olden days, the configure
options --with-perl, --with-python, and --with-tcl controlled whether
frontend interfaces for those languages would be built. The procedural
languages were added later, and shared libraries were often not
available in the beginning. So it was decided skip the builds of the
procedural languages in those cases. The frontend interfaces have since
been removed from the tree, and shared libraries are now available most
of the time, so that setup makes much less sense now.
Also, the new setup allows contrib modules and pgxs users to rely on the
respective PLs being available based on configure flags.
2015-05-01 21:38:21 -04:00
as_fn_error $? "cannot build PL/Tcl because Tcl is not a shared library
Use --without-tcl to disable building PL/Tcl." "$LINENO" 5
fi
# now that we have TCL_INCLUDE_SPEC, we can check for <tcl.h>
2004-12-16 15:41:01 -05:00
ac_save_CPPFLAGS=$CPPFLAGS
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
2013-12-18 20:53:23 -05:00
ac_fn_c_check_header_mongrel "$LINENO" "tcl.h" "ac_cv_header_tcl_h" "$ac_includes_default"
if test "x$ac_cv_header_tcl_h" = xyes; then :
2004-12-16 15:41:01 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "header file <tcl.h> is required for Tcl" "$LINENO" 5
2004-12-16 15:41:01 -05:00
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
1998-02-22 15:02:34 -05:00
2013-01-09 19:41:37 -05:00
# check for <perl.h>
if test "$with_perl" = yes; then
ac_save_CPPFLAGS=$CPPFLAGS
Still further rethinking of build changes for macOS Mojave.
To avoid the sorts of problems complained of by Jakob Egger, it'd be
best if configure didn't emit any references to the sysroot path at all.
In the case of PL/Tcl, we can do that just by keeping our hands off the
TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to
substitute -iwithsysroot for -I in the compile commands, which is easily
handled if we change to using a configure output variable that includes
the switch not only the directory name. Since PL/Tcl and PL/Python
already do it like that, this seems like good consistency cleanup anyway.
Hence, this replaces the advice given to Perl-related extensions in commit
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should
just write "$(perl_includespec)". (The old way continues to work, but not
on recent macOS.)
It's still the case that configure needs to be aware of the sysroot
path internally, but that's cleaner than what we had before.
As before, back-patch to all supported versions.
Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
2018-10-18 14:55:23 -04:00
CPPFLAGS="$CPPFLAGS $perl_includespec"
2013-12-18 20:53:23 -05:00
ac_fn_c_check_header_compile "$LINENO" "perl.h" "ac_cv_header_perl_h" "#include <EXTERN.h>
"
if test "x$ac_cv_header_perl_h" = xyes; then :
2013-01-09 19:41:37 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "header file <perl.h> is required for Perl" "$LINENO" 5
2013-01-09 19:41:37 -05:00
fi
# While we're at it, check that we can link to libperl.
# On most platforms, if perl.h is there then libperl.so will be too, but at
# this writing Debian packages them separately. There is no known reason to
# waste cycles on separate probes for the Tcl or Python libraries, though.
2019-10-21 13:52:25 -04:00
# On some Red Hat platforms, the link attempt can fail if we don't use
# CFLAGS_SL while building the test program.
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFLAGS_SL"
2013-01-09 19:41:37 -05:00
pgac_save_LIBS=$LIBS
2013-01-09 23:46:44 -05:00
LIBS="$perl_embed_ldflags"
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libperl" >&5
2013-01-09 19:41:37 -05:00
$as_echo_n "checking for libperl... " >&6; }
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2013-01-09 19:41:37 -05:00
/* end confdefs.h. */
#include <EXTERN.h>
#include <perl.h>
int
main ()
{
perl_alloc();
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2013-01-09 19:41:37 -05:00
$as_echo "yes" >&6; }
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2013-01-09 19:41:37 -05:00
$as_echo "no" >&6; }
2013-12-18 20:53:23 -05:00
as_fn_error $? "libperl library is required for Perl" "$LINENO" 5
2013-01-09 19:41:37 -05:00
fi
2013-12-18 20:53:23 -05:00
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
2013-01-09 19:41:37 -05:00
LIBS=$pgac_save_LIBS
2019-10-21 13:52:25 -04:00
CFLAGS=$ac_save_CFLAGS
2013-01-09 19:41:37 -05:00
CPPFLAGS=$ac_save_CPPFLAGS
fi
2011-02-26 14:17:57 -05:00
# check for <Python.h>
if test "$with_python" = yes; then
ac_save_CPPFLAGS=$CPPFLAGS
Don't put library-supplied -L/-I switches before user-supplied ones.
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13
2025-07-29 15:17:40 -04:00
CPPFLAGS="$CPPFLAGS $python_includespec"
2013-12-18 20:53:23 -05:00
ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
if test "x$ac_cv_header_Python_h" = xyes; then :
2011-02-26 14:17:57 -05:00
else
2013-12-18 20:53:23 -05:00
as_fn_error $? "header file <Python.h> is required for Python" "$LINENO" 5
2011-02-26 14:17:57 -05:00
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
2000-11-05 16:04:07 -05:00
#
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
# Check for documentation-building tools
2000-11-05 16:04:07 -05:00
#
2017-11-23 09:39:47 -05:00
if test -z "$XMLLINT"; then
for ac_prog in xmllint
2000-11-05 16:04:07 -05:00
do
2002-03-29 12:32:55 -05:00
# Extract the first word of "$ac_prog", so it can be a program name with args.
2000-11-05 16:04:07 -05:00
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
2017-11-23 09:39:47 -05:00
if ${ac_cv_path_XMLLINT+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2000-11-05 16:04:07 -05:00
else
2017-11-23 09:39:47 -05:00
case $XMLLINT in
2017-07-31 13:02:49 -04:00
[\\/]* | ?:[\\/]*)
2017-11-23 09:39:47 -05:00
ac_cv_path_XMLLINT="$XMLLINT" # Let the user override the test with a path.
2017-07-31 13:02:49 -04:00
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2002-03-29 12:32:55 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2017-11-23 09:39:47 -05:00
ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 12:32:55 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 12:32:55 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2000-11-05 16:04:07 -05:00
fi
2017-11-23 09:39:47 -05:00
XMLLINT=$ac_cv_path_XMLLINT
if test -n "$XMLLINT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5
$as_echo "$XMLLINT" >&6; }
2000-11-05 16:04:07 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2000-11-05 16:04:07 -05:00
fi
2008-02-17 11:36:43 -05:00
2017-11-23 09:39:47 -05:00
test -n "$XMLLINT" && break
2000-11-05 16:04:07 -05:00
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
2017-11-23 09:39:47 -05:00
# Report the value of XMLLINT in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMLLINT" >&5
$as_echo_n "checking for XMLLINT... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5
$as_echo "$XMLLINT" >&6; }
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if test -z "$XSLTPROC"; then
for ac_prog in xsltproc
2014-09-13 20:14:17 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if ${ac_cv_path_XSLTPROC+:} false; then :
2014-09-13 20:14:17 -04:00
$as_echo_n "(cached) " >&6
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
case $XSLTPROC in
2017-07-31 13:02:49 -04:00
[\\/]* | ?:[\\/]*)
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path.
2017-07-31 13:02:49 -04:00
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2014-09-13 20:14:17 -04:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
2014-09-13 20:14:17 -04:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2017-07-31 13:02:49 -04:00
;;
esac
2014-09-13 20:14:17 -04:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
XSLTPROC=$ac_cv_path_XSLTPROC
if test -n "$XSLTPROC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5
$as_echo "$XSLTPROC" >&6; }
2014-09-13 20:14:17 -04:00
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
test -n "$XSLTPROC" && break
2014-09-13 20:14:17 -04:00
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
# Report the value of XSLTPROC in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSLTPROC" >&5
$as_echo_n "checking for XSLTPROC... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5
$as_echo "$XSLTPROC" >&6; }
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if test -z "$FOP"; then
for ac_prog in fop
2000-11-05 16:04:07 -05:00
do
2002-03-29 12:32:55 -05:00
# Extract the first word of "$ac_prog", so it can be a program name with args.
2000-11-05 16:04:07 -05:00
set dummy $ac_prog; ac_word=$2
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2009-07-02 14:55:40 -04:00
$as_echo_n "checking for $ac_word... " >&6; }
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if ${ac_cv_path_FOP+:} false; then :
2009-07-02 14:55:40 -04:00
$as_echo_n "(cached) " >&6
2000-11-05 16:04:07 -05:00
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
case $FOP in
2017-07-31 13:02:49 -04:00
[\\/]* | ?:[\\/]*)
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_FOP="$FOP" # Let the user override the test with a path.
2017-07-31 13:02:49 -04:00
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2002-03-29 12:32:55 -05:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_FOP="$as_dir/$ac_word$ac_exec_ext"
2013-12-18 20:53:23 -05:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
2002-03-29 12:32:55 -05:00
break 2
fi
done
2013-12-18 20:53:23 -05:00
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
2002-03-29 12:32:55 -05:00
2017-07-31 13:02:49 -04:00
;;
esac
2000-11-05 16:04:07 -05:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
FOP=$ac_cv_path_FOP
if test -n "$FOP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FOP" >&5
$as_echo "$FOP" >&6; }
2000-11-05 16:04:07 -05:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2009-07-02 14:55:40 -04:00
$as_echo "no" >&6; }
2000-11-05 16:04:07 -05:00
fi
2008-02-17 11:36:43 -05:00
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
test -n "$FOP" && break
2000-11-05 16:04:07 -05:00
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
# Report the value of FOP in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FOP" >&5
$as_echo_n "checking for FOP... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $FOP" >&5
$as_echo "$FOP" >&6; }
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if test -z "$DBTOEPUB"; then
for ac_prog in dbtoepub
2017-04-06 22:03:52 -04:00
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
if ${ac_cv_path_DBTOEPUB+:} false; then :
2017-04-06 22:03:52 -04:00
$as_echo_n "(cached) " >&6
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
case $DBTOEPUB in
2017-07-31 13:02:49 -04:00
[\\/]* | ?:[\\/]*)
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_DBTOEPUB="$DBTOEPUB" # Let the user override the test with a path.
2017-07-31 13:02:49 -04:00
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2017-04-06 22:03:52 -04:00
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
ac_cv_path_DBTOEPUB="$as_dir/$ac_word$ac_exec_ext"
2017-04-06 22:03:52 -04:00
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
2017-07-31 13:02:49 -04:00
;;
esac
2017-04-06 22:03:52 -04:00
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
DBTOEPUB=$ac_cv_path_DBTOEPUB
if test -n "$DBTOEPUB"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBTOEPUB" >&5
$as_echo "$DBTOEPUB" >&6; }
2017-04-06 22:03:52 -04:00
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
test -n "$DBTOEPUB" && break
2017-04-06 22:03:52 -04:00
done
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
else
Remove configure-time probe for DocBook DTD.
Checking for DocBook being installed was valuable when we were on the
OpenSP docs toolchain, because that was rather hard to get installed
fully. Nowadays, as long as you have xmllint and xsltproc installed,
you're good, because those programs will fetch the DocBook files off
the net at need. Moreover, testing this at configure time means that
a network access may well occur whether or not you have any interest
in building the docs later. That can be slow (typically 2 or 3
seconds, though much higher delays have been reported), and it seems
not very nice to be doing an off-machine access without warning, too.
Hence, drop the PGAC_CHECK_DOCBOOK probe, and adjust related
documentation. Without that macro, there's not much left of
config/docbook.m4 at all, so I just removed it.
Back-patch to v11, where we started to use xmllint in the
PGAC_CHECK_DOCBOOK probe.
Discussion: https://postgr.es/m/E2EE6B76-2D96-408A-B961-CAE47D1A86F0@yesql.se
Discussion: https://postgr.es/m/A55A7FC9-FA60-47FE-98B5-139CDC57CE6E@gmail.com
2020-11-30 15:24:13 -05:00
# Report the value of DBTOEPUB in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBTOEPUB" >&5
$as_echo_n "checking for DBTOEPUB... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBTOEPUB" >&5
$as_echo "$DBTOEPUB" >&6; }
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 11:40:00 -04:00
fi
2000-11-05 16:04:07 -05:00
2014-04-14 21:33:46 -04:00
#
# Check for test tools
#
2014-11-02 09:14:36 -05:00
if test "$enable_tap_tests" = yes; then
2021-11-22 12:54:52 -05:00
# Make sure we know where prove is.
2017-08-07 16:42:18 -04:00
if test -z "$PROVE"; then
for ac_prog in prove
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PROVE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PROVE in
[\\/]* | ?:[\\/]*)
ac_cv_path_PROVE="$PROVE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PROVE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PROVE=$ac_cv_path_PROVE
if test -n "$PROVE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROVE" >&5
$as_echo "$PROVE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$PROVE" && break
done
else
# Report the value of PROVE in configure's output in all cases.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PROVE" >&5
$as_echo_n "checking for PROVE... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROVE" >&5
$as_echo "$PROVE" >&6; }
fi
if test -z "$PROVE"; then
as_fn_error $? "prove not found" "$LINENO" 5
fi
2021-11-22 12:54:52 -05:00
# Check for necessary Perl modules. You might think we should use
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
# installation than perl, eg on MSys, so we have to check using prove.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
2022-02-18 16:59:30 -05:00
__CONFIG_HOST_OS__=$host_os; export __CONFIG_HOST_OS__
2021-11-22 12:54:52 -05:00
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
if test $? -eq 0; then
# log the module version details, but don't show them interactively
echo "$modulestderr" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
# on failure, though, show the results to the user
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
$as_echo "$modulestderr" >&6; }
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
fi
2014-11-02 09:14:36 -05:00
fi
2014-04-14 21:33:46 -04:00
2009-06-10 17:24:11 -04:00
# If compiler will take -Wl,--as-needed (or various platform-specific
# spellings thereof) then add that to LDFLAGS. This is much easier than
# trying to filter LIBS to the minimum for each executable.
2008-05-19 23:30:22 -04:00
# On (at least) some Red-Hat-derived systems, this switch breaks linking to
# libreadline; therefore we postpone testing it until we know what library
# dependencies readline has. The test code will try to link with $LIBS.
if test "$with_readline" = yes; then
link_test_func=readline
else
link_test_func=exit
fi
2009-06-10 17:24:11 -04:00
if test "$PORTNAME" = "darwin"; then
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,-dead_strip_dylibs, for LDFLAGS" >&5
$as_echo_n "checking whether $CC supports -Wl,-dead_strip_dylibs, for LDFLAGS... " >&6; }
if ${pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs+:} false; then :
2010-09-29 15:38:04 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_LDFLAGS=$LDFLAGS
2009-06-10 17:24:11 -04:00
LDFLAGS="$pgac_save_LDFLAGS -Wl,-dead_strip_dylibs"
2013-12-18 20:53:23 -05:00
if test "$cross_compiling" = yes; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs="assuming no"
2008-06-26 20:36:16 -04:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2008-05-19 23:30:22 -04:00
/* end confdefs.h. */
2008-06-26 20:36:16 -04:00
extern void $link_test_func (); void (*fptr) () = $link_test_func;
2008-05-19 23:30:22 -04:00
int
main ()
{
2008-06-26 20:36:16 -04:00
2008-05-19 23:30:22 -04:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_run "$LINENO"; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs=yes
2008-05-19 23:30:22 -04:00
else
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs=no
2008-05-19 23:30:22 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2008-06-26 20:36:16 -04:00
fi
2010-09-29 15:38:04 -04:00
LDFLAGS="$pgac_save_LDFLAGS"
fi
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs" >&5
$as_echo "$pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs" >&6; }
if test x"$pgac_cv_prog_cc_LDFLAGS__Wl__dead_strip_dylibs" = x"yes"; then
LDFLAGS="${LDFLAGS} -Wl,-dead_strip_dylibs"
2010-09-29 15:38:04 -04:00
fi
2008-05-19 23:30:22 -04:00
2022-12-06 21:55:28 -05:00
2009-06-10 17:24:11 -04:00
elif test "$PORTNAME" = "openbsd"; then
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,-Bdynamic, for LDFLAGS" >&5
$as_echo_n "checking whether $CC supports -Wl,-Bdynamic, for LDFLAGS... " >&6; }
if ${pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic+:} false; then :
2010-09-29 15:38:04 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_LDFLAGS=$LDFLAGS
2009-06-10 17:24:11 -04:00
LDFLAGS="$pgac_save_LDFLAGS -Wl,-Bdynamic"
2013-12-18 20:53:23 -05:00
if test "$cross_compiling" = yes; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic="assuming no"
2008-05-19 23:30:22 -04:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2009-06-10 17:24:11 -04:00
/* end confdefs.h. */
extern void $link_test_func (); void (*fptr) () = $link_test_func;
int
main ()
{
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_run "$LINENO"; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic=yes
2009-06-10 17:24:11 -04:00
else
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic=no
2009-06-10 17:24:11 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2009-06-10 17:24:11 -04:00
fi
2010-09-29 15:38:04 -04:00
LDFLAGS="$pgac_save_LDFLAGS"
fi
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic" >&5
$as_echo "$pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic" >&6; }
if test x"$pgac_cv_prog_cc_LDFLAGS__Wl__Bdynamic" = x"yes"; then
LDFLAGS="${LDFLAGS} -Wl,-Bdynamic"
2010-09-29 15:38:04 -04:00
fi
2009-06-10 17:24:11 -04:00
2022-12-06 21:55:28 -05:00
2009-06-10 17:24:11 -04:00
else
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,--as-needed, for LDFLAGS" >&5
$as_echo_n "checking whether $CC supports -Wl,--as-needed, for LDFLAGS... " >&6; }
if ${pgac_cv_prog_cc_LDFLAGS__Wl___as_needed+:} false; then :
2010-09-29 15:38:04 -04:00
$as_echo_n "(cached) " >&6
else
pgac_save_LDFLAGS=$LDFLAGS
2009-06-10 17:24:11 -04:00
LDFLAGS="$pgac_save_LDFLAGS -Wl,--as-needed"
2013-12-18 20:53:23 -05:00
if test "$cross_compiling" = yes; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl___as_needed="assuming no"
2008-06-26 20:36:16 -04:00
else
2013-12-18 20:53:23 -05:00
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2008-05-19 23:30:22 -04:00
/* end confdefs.h. */
2008-06-26 20:36:16 -04:00
extern void $link_test_func (); void (*fptr) () = $link_test_func;
2008-05-19 23:30:22 -04:00
int
main ()
{
2008-06-26 20:36:16 -04:00
2008-05-19 23:30:22 -04:00
;
return 0;
}
_ACEOF
2013-12-18 20:53:23 -05:00
if ac_fn_c_try_run "$LINENO"; then :
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl___as_needed=yes
2008-05-19 23:30:22 -04:00
else
2022-12-06 21:55:28 -05:00
pgac_cv_prog_cc_LDFLAGS__Wl___as_needed=no
2008-05-19 23:30:22 -04:00
fi
2013-12-18 20:53:23 -05:00
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2008-06-26 20:36:16 -04:00
fi
2010-09-29 15:38:04 -04:00
LDFLAGS="$pgac_save_LDFLAGS"
fi
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_LDFLAGS__Wl___as_needed" >&5
$as_echo "$pgac_cv_prog_cc_LDFLAGS__Wl___as_needed" >&6; }
if test x"$pgac_cv_prog_cc_LDFLAGS__Wl___as_needed" = x"yes"; then
LDFLAGS="${LDFLAGS} -Wl,--as-needed"
fi
fi
# For linkers that understand --export-dynamic, add that to the LDFLAGS_EX_BE
# (backend specific ldflags). One some platforms this will always fail (e.g.,
# windows), but on others it depends on the choice of linker (e.g., solaris).
2024-07-31 00:22:02 -04:00
# macOS uses -export_dynamic instead. (On macOS, the option is only
# needed when also using -flto, but we add it anyway since it's
# harmless.)
2022-12-06 21:55:28 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,--export-dynamic, for LDFLAGS_EX_BE" >&5
$as_echo_n "checking whether $CC supports -Wl,--export-dynamic, for LDFLAGS_EX_BE... " >&6; }
if ${pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_LDFLAGS=$LDFLAGS
LDFLAGS="$pgac_save_LDFLAGS -Wl,--export-dynamic"
if test "$cross_compiling" = yes; then :
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic="assuming no"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void $link_test_func (); void (*fptr) () = $link_test_func;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic=yes
else
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
2010-09-29 15:38:04 -04:00
fi
2008-05-19 23:30:22 -04:00
2022-12-06 21:55:28 -05:00
LDFLAGS="$pgac_save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic" >&5
$as_echo "$pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic" >&6; }
if test x"$pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl___export_dynamic" = x"yes"; then
LDFLAGS_EX_BE="${LDFLAGS_EX_BE} -Wl,--export-dynamic"
2008-05-19 23:30:22 -04:00
fi
2024-07-31 00:22:02 -04:00
if test x"$LDFLAGS_EX_BE" = x""; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,-export_dynamic, for LDFLAGS_EX_BE" >&5
$as_echo_n "checking whether $CC supports -Wl,-export_dynamic, for LDFLAGS_EX_BE... " >&6; }
if ${pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_LDFLAGS=$LDFLAGS
LDFLAGS="$pgac_save_LDFLAGS -Wl,-export_dynamic"
if test "$cross_compiling" = yes; then :
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic="assuming no"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void $link_test_func (); void (*fptr) () = $link_test_func;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic=yes
else
pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
LDFLAGS="$pgac_save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic" >&5
$as_echo "$pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic" >&6; }
if test x"$pgac_cv_prog_cc_LDFLAGS_EX_BE__Wl__export_dynamic" = x"yes"; then
LDFLAGS_EX_BE="${LDFLAGS_EX_BE} -Wl,-export_dynamic"
fi
fi
2022-12-06 21:55:28 -05:00
2009-01-06 10:38:44 -05:00
# Create compiler version string
if test x"$GCC" = x"yes" ; then
2011-05-06 15:14:53 -04:00
cc_string=`${CC} --version | sed q`
case $cc_string in [A-Za-z]*) ;; *) cc_string="GCC $cc_string";; esac
2009-01-06 10:38:44 -05:00
else
cc_string=$CC
fi
cat >>confdefs.h <<_ACEOF
2013-12-12 21:53:21 -05:00
#define PG_VERSION_STR "PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
2009-01-06 10:38:44 -05:00
_ACEOF
# Supply a numeric version string for use by 3rd party add-ons
# awk -F is a regex on some platforms, and not on others, so make "." a tab
2020-03-10 12:46:07 -04:00
PG_VERSION_NUM="`echo $PG_MAJORVERSION $PG_MINORVERSION |
2017-11-06 19:46:52 -05:00
$AWK '{printf "%d%04d", $1, $2}'`"
2009-01-06 10:38:44 -05:00
cat >>confdefs.h <<_ACEOF
#define PG_VERSION_NUM $PG_VERSION_NUM
_ACEOF
2018-11-02 18:54:00 -04:00
# If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not
# literally, so that it's possible to override it at build time using
# a command like "make ... PG_SYSROOT=path". This has to be done after
# we've finished all configure checks that depend on CPPFLAGS.
On macOS, use -isysroot in link steps as well as compile steps.
We previously put the -isysroot switch only into CPPFLAGS, theorizing
that it was only needed to find the right copies of include files.
However, it seems that we also need to use it while linking programs,
to find the right stub ".tbd" files for libraries. We got away
without that up to now, but apparently that was mostly luck. It may
also be that failures are only observed when the Xcode version is
noticeably out of sync with the host macOS version; the case that's
prompting action right now is that builds fail when using latest Xcode
(12.2) on macOS Catalina, even though it's fine on Big Sur.
Hence, add -isysroot to LDFLAGS as well. (It seems that the more
common practice is to put it in CFLAGS, whence it'd be included at
both compile and link steps. However, we can't mess with CFLAGS in
the platform template file without confusing configure's logic for
choosing default CFLAGS.)
This should be back-patched, but first let's see if the buildfarm
likes it on HEAD.
Report and patch by James Hilliard (some cosmetic mods by me)
Discussion: https://postgr.es/m/20201120003314.20560-1-james.hilliard1@gmail.com
2020-11-20 00:07:09 -05:00
# The same for LDFLAGS, too.
2018-11-02 18:54:00 -04:00
if test x"$PG_SYSROOT" != x; then
CPPFLAGS=`echo "$CPPFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
On macOS, use -isysroot in link steps as well as compile steps.
We previously put the -isysroot switch only into CPPFLAGS, theorizing
that it was only needed to find the right copies of include files.
However, it seems that we also need to use it while linking programs,
to find the right stub ".tbd" files for libraries. We got away
without that up to now, but apparently that was mostly luck. It may
also be that failures are only observed when the Xcode version is
noticeably out of sync with the host macOS version; the case that's
prompting action right now is that builds fail when using latest Xcode
(12.2) on macOS Catalina, even though it's fine on Big Sur.
Hence, add -isysroot to LDFLAGS as well. (It seems that the more
common practice is to put it in CFLAGS, whence it'd be included at
both compile and link steps. However, we can't mess with CFLAGS in
the platform template file without confusing configure's logic for
choosing default CFLAGS.)
This should be back-patched, but first let's see if the buildfarm
likes it on HEAD.
Report and patch by James Hilliard (some cosmetic mods by me)
Discussion: https://postgr.es/m/20201120003314.20560-1-james.hilliard1@gmail.com
2020-11-20 00:07:09 -05:00
LDFLAGS=`echo "$LDFLAGS" | sed -e "s| $PG_SYSROOT | \\\$(PG_SYSROOT) |"`
2018-11-02 18:54:00 -04:00
fi
2015-07-02 17:24:36 -04:00
2011-08-28 17:14:52 -04:00
# Begin output steps
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: using compiler=$cc_string" >&5
2011-08-28 17:14:52 -04:00
$as_echo "$as_me: using compiler=$cc_string" >&6;}
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: using CFLAGS=$CFLAGS" >&5
2011-08-28 17:14:52 -04:00
$as_echo "$as_me: using CFLAGS=$CFLAGS" >&6;}
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: using CPPFLAGS=$CPPFLAGS" >&5
2011-08-28 17:14:52 -04:00
$as_echo "$as_me: using CPPFLAGS=$CPPFLAGS" >&6;}
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: using LDFLAGS=$LDFLAGS" >&5
2011-08-28 17:14:52 -04:00
$as_echo "$as_me: using LDFLAGS=$LDFLAGS" >&6;}
2018-03-20 20:26:25 -04:00
# Currently only used when LLVM is used
if test "$with_llvm" = yes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: using CXX=$CXX" >&5
$as_echo "$as_me: using CXX=$CXX" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: using CXXFLAGS=$CXXFLAGS" >&5
$as_echo "$as_me: using CXXFLAGS=$CXXFLAGS" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: using CLANG=$CLANG" >&5
$as_echo "$as_me: using CLANG=$CLANG" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: using BITCODE_CFLAGS=$BITCODE_CFLAGS" >&5
$as_echo "$as_me: using BITCODE_CFLAGS=$BITCODE_CFLAGS" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: using BITCODE_CXXFLAGS=$BITCODE_CXXFLAGS" >&5
$as_echo "$as_me: using BITCODE_CXXFLAGS=$BITCODE_CXXFLAGS" >&6;}
fi
2011-08-28 17:14:52 -04:00
2001-03-03 10:53:41 -05:00
# prepare build tree if outside source tree
2001-09-10 19:52:04 -04:00
# Note 1: test -ef might not exist, but it's more reliable than `pwd`.
# Note 2: /bin/pwd might be better than shell's built-in at getting
# a symlink-free name.
2003-11-27 13:14:02 -05:00
if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
vpath_build=no
else
vpath_build=yes
if test "$no_create" != yes; then
2009-07-02 14:55:40 -04:00
$as_echo_n "preparing build tree... " >&6
2002-03-29 12:32:55 -05:00
pgac_abs_top_srcdir=`cd "$srcdir" && pwd`
$SHELL "$ac_aux_dir/prep_buildtree" "$pgac_abs_top_srcdir" "." \
2013-12-18 20:53:23 -05:00
|| as_fn_error $? "failed" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
2009-07-02 14:55:40 -04:00
$as_echo "done" >&6; }
2002-03-29 12:32:55 -05:00
fi
2000-10-20 17:04:27 -04:00
fi
2002-03-29 12:32:55 -05:00
2003-11-27 13:14:02 -05:00
2008-02-17 11:36:43 -05:00
ac_config_files="$ac_config_files GNUmakefile src/Makefile.global"
2002-03-29 12:32:55 -05:00
2018-09-06 04:07:24 -04:00
ac_config_links="$ac_config_links src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION} src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION} src/include/pg_config_os.h:src/include/port/${template}.h src/Makefile.port:src/makefiles/Makefile.${template}"
2002-03-29 12:32:55 -05:00
2004-09-10 09:53:40 -04:00
if test "$PORTNAME" = "win32"; then
2008-02-17 11:36:43 -05:00
ac_config_commands="$ac_config_commands check_win32_symlinks"
2004-05-17 15:14:47 -04:00
2004-09-10 09:53:40 -04:00
fi
2004-05-17 15:14:47 -04:00
2008-02-17 11:36:43 -05:00
ac_config_headers="$ac_config_headers src/include/pg_config.h"
2006-08-23 08:01:53 -04:00
2008-02-17 11:36:43 -05:00
ac_config_headers="$ac_config_headers src/interfaces/ecpg/include/ecpg_config.h"
2006-08-23 08:01:53 -04:00
2002-03-29 12:32:55 -05:00
cat >confcache <<\_ACEOF
2000-09-25 18:23:01 -04:00
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
2002-03-29 12:32:55 -05:00
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
2000-09-25 18:23:01 -04:00
#
2002-03-29 12:32:55 -05:00
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
2000-09-25 18:23:01 -04:00
#
2005-07-01 14:17:31 -04:00
# `ac_cv_env_foo' variables (set or unset) will be overridden when
2002-03-29 12:32:55 -05:00
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
2000-09-25 18:23:01 -04:00
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
2008-02-17 11:36:43 -05:00
# So, we kill variables containing newlines.
2000-09-25 18:23:01 -04:00
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
2008-02-17 11:36:43 -05:00
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
2013-12-18 20:53:23 -05:00
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
2008-02-17 11:36:43 -05:00
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
2009-07-02 14:55:40 -04:00
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
2013-12-18 20:53:23 -05:00
*) { eval $ac_var=; unset $ac_var;} ;;
2008-02-17 11:36:43 -05:00
esac ;;
esac
done
2002-03-29 12:32:55 -05:00
(set) 2>&1 |
2008-02-17 11:36:43 -05:00
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
2013-12-18 20:53:23 -05:00
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
2002-03-29 12:32:55 -05:00
sed -n \
2005-07-01 14:17:31 -04:00
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
2008-02-17 11:36:43 -05:00
;; #(
2002-03-29 12:32:55 -05:00
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
2008-02-17 11:36:43 -05:00
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
2002-03-29 12:32:55 -05:00
;;
2008-02-17 11:36:43 -05:00
esac |
sort
) |
2002-03-29 12:32:55 -05:00
sed '
2008-02-17 11:36:43 -05:00
/^ac_cv_env_/b end
2002-03-29 12:32:55 -05:00
t clear
2008-02-17 11:36:43 -05:00
:clear
2002-03-29 12:32:55 -05:00
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
2008-02-17 11:36:43 -05:00
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
2013-12-18 20:53:23 -05:00
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: updating cache $cache_file" >&6;}
2013-12-18 20:53:23 -05:00
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
2000-09-25 18:23:01 -04:00
else
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
2000-09-25 18:23:01 -04:00
fi
1998-02-22 15:02:34 -05:00
fi
2000-09-25 18:23:01 -04:00
rm -f confcache
1998-02-22 15:02:34 -05:00
2000-09-25 18:23:01 -04:00
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
1997-02-04 03:53:45 -05:00
2005-07-01 14:17:31 -04:00
ac_libobjs=
ac_ltlibobjs=
2013-12-18 20:53:23 -05:00
U=
2005-07-01 14:17:31 -04:00
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
2008-02-17 11:36:43 -05:00
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
2009-07-02 14:55:40 -04:00
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
2008-02-17 11:36:43 -05:00
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
2013-12-18 20:53:23 -05:00
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
2005-07-01 14:17:31 -04:00
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
1997-02-04 03:53:45 -05:00
2009-07-02 14:55:40 -04:00
2013-12-18 20:53:23 -05:00
: "${CONFIG_STATUS=./config.status}"
2009-07-02 14:55:40 -04:00
ac_write_fail=0
2002-03-29 12:32:55 -05:00
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
2013-12-18 20:53:23 -05:00
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
2002-03-29 12:32:55 -05:00
#! $SHELL
# Generated by $as_me.
1997-02-04 03:53:45 -05:00
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
2002-03-29 12:32:55 -05:00
# configure, is in config.log if it exists.
1997-02-04 03:53:45 -05:00
2002-03-29 12:32:55 -05:00
debug=false
2005-07-01 14:17:31 -04:00
ac_cs_recheck=false
ac_cs_silent=false
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
2002-03-29 12:32:55 -05:00
2008-02-17 11:36:43 -05:00
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
2013-12-18 20:53:23 -05:00
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
2002-03-29 12:32:55 -05:00
emulate sh
NULLCMD=:
2009-07-02 14:55:40 -04:00
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
2005-07-01 14:17:31 -04:00
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
2008-02-17 11:36:43 -05:00
setopt NO_GLOB_SUBST
else
2013-12-18 20:53:23 -05:00
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
2008-02-17 11:36:43 -05:00
esac
fi
2009-07-02 14:55:40 -04:00
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
2013-12-18 20:53:23 -05:00
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
2009-07-02 14:55:40 -04:00
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
2008-02-17 11:36:43 -05:00
else
2009-07-02 14:55:40 -04:00
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
2013-12-18 20:53:23 -05:00
case $arg in #(
2009-07-02 14:55:40 -04:00
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
2008-02-17 11:36:43 -05:00
fi
2009-07-02 14:55:40 -04:00
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
2002-03-29 12:32:55 -05:00
fi
2005-07-01 14:17:31 -04:00
2008-02-17 11:36:43 -05:00
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
2013-12-18 20:53:23 -05:00
as_myself=
case $0 in #((
2008-02-17 11:36:43 -05:00
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
2013-12-18 20:53:23 -05:00
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
2008-02-17 11:36:43 -05:00
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
2009-07-02 14:55:40 -04:00
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
2013-12-18 20:53:23 -05:00
exit 1
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
2008-02-17 11:36:43 -05:00
done
2005-07-01 14:17:31 -04:00
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
2009-07-02 14:55:40 -04:00
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
2005-07-01 14:17:31 -04:00
2013-12-18 20:53:23 -05:00
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
2008-02-17 11:36:43 -05:00
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
2005-07-01 14:17:31 -04:00
as_expr=expr
else
as_expr=false
fi
2008-02-17 11:36:43 -05:00
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
2005-07-01 14:17:31 -04:00
as_basename=basename
else
as_basename=false
fi
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
2002-03-29 12:32:55 -05:00
2008-02-17 11:36:43 -05:00
as_me=`$as_basename -- "$0" ||
2002-03-29 12:32:55 -05:00
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
2008-02-17 11:36:43 -05:00
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
2009-07-02 14:55:40 -04:00
$as_echo X/"$0" |
2008-02-17 11:36:43 -05:00
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
2008-02-17 11:36:43 -05:00
ECHO_C= ECHO_N= ECHO_T=
2013-12-18 20:53:23 -05:00
case `echo -n x` in #(((((
2008-02-17 11:36:43 -05:00
-n*)
2013-12-18 20:53:23 -05:00
case `echo 'xy\c'` in
2008-02-17 11:36:43 -05:00
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
2013-12-18 20:53:23 -05:00
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
2008-02-17 11:36:43 -05:00
esac;;
*)
ECHO_N='-n';;
2002-03-29 12:32:55 -05:00
esac
1997-03-20 02:30:26 -05:00
2002-03-29 12:32:55 -05:00
rm -f conf$$ conf$$.exe conf$$.file
2008-02-17 11:36:43 -05:00
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
2009-07-02 14:55:40 -04:00
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
2013-12-18 20:53:23 -05:00
# In both cases, we have to default to `cp -pR'.
2009-07-02 14:55:40 -04:00
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
2013-12-18 20:53:23 -05:00
as_ln_s='cp -pR'
2009-07-02 14:55:40 -04:00
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
2013-12-18 20:53:23 -05:00
as_ln_s='cp -pR'
2009-07-02 14:55:40 -04:00
fi
2002-03-29 12:32:55 -05:00
else
2013-12-18 20:53:23 -05:00
as_ln_s='cp -pR'
2002-03-29 12:32:55 -05:00
fi
2008-02-17 11:36:43 -05:00
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
2005-07-01 14:17:31 -04:00
if mkdir -p . 2>/dev/null; then
2013-12-18 20:53:23 -05:00
as_mkdir_p='mkdir -p "$as_dir"'
2005-07-01 14:17:31 -04:00
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
2013-12-18 20:53:23 -05:00
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
2002-03-29 12:32:55 -05:00
# Sed expression to map a string onto a valid CPP name.
2005-07-01 14:17:31 -04:00
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
2002-03-29 12:32:55 -05:00
# Sed expression to map a string onto a valid variable name.
2005-07-01 14:17:31 -04:00
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
2002-03-29 12:32:55 -05:00
exec 6>&1
2013-12-18 20:53:23 -05:00
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
2002-03-29 12:32:55 -05:00
# report actual input values of CONFIG_FILES etc. instead of their
2008-02-17 11:36:43 -05:00
# values after options handling.
ac_log="
2025-06-29 22:28:10 -04:00
This file was extended by PostgreSQL $as_me 19devel, which was
2013-12-18 20:53:23 -05:00
generated by GNU Autoconf 2.69. Invocation command line was
2002-03-29 12:32:55 -05:00
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
2008-02-17 11:36:43 -05:00
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
2002-03-29 12:32:55 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2002-03-29 12:32:55 -05:00
# Files that config.status was made for.
2008-02-17 11:36:43 -05:00
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_links="$ac_config_links"
config_commands="$ac_config_commands"
2007-11-15 23:59:25 -05:00
2008-02-17 11:36:43 -05:00
_ACEOF
2002-03-29 12:32:55 -05:00
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2002-03-29 12:32:55 -05:00
ac_cs_usage="\
2013-12-18 20:53:23 -05:00
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
Usage: $0 [OPTION]... [TAG]...
2002-03-29 12:32:55 -05:00
-h, --help print this help, then exit
2008-02-17 11:36:43 -05:00
-V, --version print version number and configuration settings, then exit
2013-12-18 20:53:23 -05:00
--config print configuration, then exit
2009-07-02 14:55:40 -04:00
-q, --quiet, --silent
do not print progress messages
2002-03-29 12:32:55 -05:00
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
2009-07-02 14:55:40 -04:00
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
2002-03-29 12:32:55 -05:00
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration links:
$config_links
2004-05-17 15:14:47 -04:00
Configuration commands:
$config_commands
2020-02-28 02:54:49 -05:00
Report bugs to <pgsql-bugs@lists.postgresql.org>.
PostgreSQL home page: <https://www.postgresql.org/>."
2007-11-15 23:59:25 -05:00
2008-02-17 11:36:43 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2013-12-18 20:53:23 -05:00
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2002-03-29 12:32:55 -05:00
ac_cs_version="\\
2025-06-29 22:28:10 -04:00
PostgreSQL config.status 19devel
2013-12-18 20:53:23 -05:00
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
Copyright (C) 2012 Free Software Foundation, Inc.
2002-03-29 12:32:55 -05:00
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
2008-02-17 11:36:43 -05:00
ac_pwd='$ac_pwd'
srcdir='$srcdir'
2012-06-27 06:40:51 -04:00
INSTALL='$INSTALL'
2009-08-26 18:24:44 -04:00
MKDIR_P='$MKDIR_P'
2009-07-02 14:55:40 -04:00
AWK='$AWK'
test -n "\$AWK" || AWK=awk
2002-03-29 12:32:55 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
2002-03-29 12:32:55 -05:00
ac_need_defaults=:
while test $# != 0
do
case $1 in
2013-12-18 20:53:23 -05:00
--*=?*)
2008-02-17 11:36:43 -05:00
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
2005-07-01 14:17:31 -04:00
ac_shift=:
;;
2013-12-18 20:53:23 -05:00
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
2008-02-17 11:36:43 -05:00
*)
2005-07-01 14:17:31 -04:00
ac_option=$1
ac_optarg=$2
ac_shift=shift
2002-03-29 12:32:55 -05:00
;;
esac
2005-07-01 14:17:31 -04:00
case $ac_option in
2002-03-29 12:32:55 -05:00
# Handling of the options.
2005-07-01 14:17:31 -04:00
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
2008-02-17 11:36:43 -05:00
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
2009-07-02 14:55:40 -04:00
$as_echo "$ac_cs_version"; exit ;;
2013-12-18 20:53:23 -05:00
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
2008-02-17 11:36:43 -05:00
--debug | --debu | --deb | --de | --d | -d )
2002-03-29 12:32:55 -05:00
debug=: ;;
--file | --fil | --fi | --f )
2005-07-01 14:17:31 -04:00
$ac_shift
2009-07-02 14:55:40 -04:00
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
2013-12-18 20:53:23 -05:00
'') as_fn_error $? "missing file argument" ;;
2009-07-02 14:55:40 -04:00
esac
2013-12-18 20:53:23 -05:00
as_fn_append CONFIG_FILES " '$ac_optarg'"
2002-03-29 12:32:55 -05:00
ac_need_defaults=false;;
--header | --heade | --head | --hea )
2005-07-01 14:17:31 -04:00
$ac_shift
2009-07-02 14:55:40 -04:00
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
2013-12-18 20:53:23 -05:00
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
2002-03-29 12:32:55 -05:00
ac_need_defaults=false;;
2008-02-17 11:36:43 -05:00
--he | --h)
# Conflict between --help and --header
2013-12-18 20:53:23 -05:00
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
2008-02-17 11:36:43 -05:00
--help | --hel | -h )
2009-07-02 14:55:40 -04:00
$as_echo "$ac_cs_usage"; exit ;;
2005-07-01 14:17:31 -04:00
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
2002-03-29 12:32:55 -05:00
# This is an error.
2013-12-18 20:53:23 -05:00
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
2002-03-29 12:32:55 -05:00
2013-12-18 20:53:23 -05:00
*) as_fn_append ac_config_targets " $1"
2008-02-17 11:36:43 -05:00
ac_need_defaults=false ;;
2002-03-29 12:32:55 -05:00
esac
shift
done
2005-07-01 14:17:31 -04:00
ac_configure_extra_args=
2007-11-15 23:59:25 -05:00
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
2007-11-15 23:29:45 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
if \$ac_cs_recheck; then
2013-12-18 20:53:23 -05:00
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
2009-07-02 14:55:40 -04:00
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
2008-02-17 11:36:43 -05:00
export CONFIG_SHELL
2009-07-02 14:55:40 -04:00
exec "\$@"
2008-02-17 11:36:43 -05:00
fi
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
2009-07-02 14:55:40 -04:00
$as_echo "$ac_log"
2008-02-17 11:36:43 -05:00
} >&5
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2002-03-29 12:32:55 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
# Handling of arguments.
2002-03-29 12:32:55 -05:00
for ac_config_target in $ac_config_targets
do
2008-02-17 11:36:43 -05:00
case $ac_config_target in
"GNUmakefile") CONFIG_FILES="$CONFIG_FILES GNUmakefile" ;;
"src/Makefile.global") CONFIG_FILES="$CONFIG_FILES src/Makefile.global" ;;
"src/backend/port/pg_sema.c") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION}" ;;
"src/backend/port/pg_shmem.c") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION}" ;;
"src/include/pg_config_os.h") CONFIG_LINKS="$CONFIG_LINKS src/include/pg_config_os.h:src/include/port/${template}.h" ;;
"src/Makefile.port") CONFIG_LINKS="$CONFIG_LINKS src/Makefile.port:src/makefiles/Makefile.${template}" ;;
"check_win32_symlinks") CONFIG_COMMANDS="$CONFIG_COMMANDS check_win32_symlinks" ;;
"src/include/pg_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/include/pg_config.h" ;;
"src/interfaces/ecpg/include/ecpg_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/interfaces/ecpg/include/ecpg_config.h" ;;
2013-12-18 20:53:23 -05:00
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
2002-03-29 12:32:55 -05:00
esac
1997-03-20 02:30:26 -05:00
done
2002-03-29 12:32:55 -05:00
2008-02-17 11:36:43 -05:00
2002-03-29 12:32:55 -05:00
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links
2004-05-17 15:14:47 -04:00
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
1997-03-20 02:30:26 -05:00
fi
2005-07-01 14:17:31 -04:00
# Have a temporary directory for convenience. Make it in the build tree
2008-02-17 11:36:43 -05:00
# simply because there is no reason against having it here, and in addition,
2005-07-01 14:17:31 -04:00
# creating and moving files from /tmp can sometimes cause problems.
2008-02-17 11:36:43 -05:00
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
2002-03-29 12:32:55 -05:00
$debug ||
{
2013-12-18 20:53:23 -05:00
tmp= ac_tmp=
2008-02-17 11:36:43 -05:00
trap 'exit_status=$?
2013-12-18 20:53:23 -05:00
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
2008-02-17 11:36:43 -05:00
' 0
2013-12-18 20:53:23 -05:00
trap 'as_fn_exit 1' 1 2 13 15
2002-03-29 12:32:55 -05:00
}
# Create a (secure) tmp directory for tmp files.
2005-07-01 14:17:31 -04:00
2002-03-29 12:32:55 -05:00
{
2008-02-17 11:36:43 -05:00
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
2013-12-18 20:53:23 -05:00
test -d "$tmp"
2002-03-29 12:32:55 -05:00
} ||
{
2008-02-17 11:36:43 -05:00
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
2013-12-18 20:53:23 -05:00
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
2002-03-29 12:32:55 -05:00
2009-07-02 14:55:40 -04:00
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
2008-02-17 11:36:43 -05:00
if test -n "$CONFIG_FILES"; then
2013-12-18 20:53:23 -05:00
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
2009-07-02 14:55:40 -04:00
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
2008-02-17 11:36:43 -05:00
fi
2013-12-18 20:53:23 -05:00
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
2008-02-17 11:36:43 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
2008-02-17 11:36:43 -05:00
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
2009-07-02 14:55:40 -04:00
. ./conf$$subs.sh ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
2009-07-02 14:55:40 -04:00
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
2008-02-17 11:36:43 -05:00
break
elif $ac_last_try; then
2013-12-18 20:53:23 -05:00
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
2008-02-17 11:36:43 -05:00
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
2009-07-02 14:55:40 -04:00
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2013-12-18 20:53:23 -05:00
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
2009-07-02 14:55:40 -04:00
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
2013-12-18 20:53:23 -05:00
s/\(.\{148\}\)..*/\1/
2009-07-02 14:55:40 -04:00
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
2013-12-18 20:53:23 -05:00
s/\(.\{148\}\)..*/\1/
2009-07-02 14:55:40 -04:00
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' <conf$$subs.awk | sed '
/^[^""]/{
N
s/\n//
}
' >>$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
2013-12-18 20:53:23 -05:00
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
2009-07-02 14:55:40 -04:00
for (key in S) S_is_set[key] = 1
FS = " "
2008-02-17 11:36:43 -05:00
2009-07-02 14:55:40 -04:00
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
2002-03-29 12:32:55 -05:00
2009-07-02 14:55:40 -04:00
_ACAWK
2008-02-17 11:36:43 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
2013-12-18 20:53:23 -05:00
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
2002-03-29 12:32:55 -05:00
_ACEOF
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
2008-02-17 11:36:43 -05:00
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
2013-12-18 20:53:23 -05:00
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
2008-02-17 11:36:43 -05:00
s/:*$//
2013-12-18 20:53:23 -05:00
x
s/\(=[ ]*\).*/\1/
G
s/\n//
2008-02-17 11:36:43 -05:00
s/^[^=]*=[ ]*$//
}'
fi
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
fi # test -n "$CONFIG_FILES"
2009-07-02 14:55:40 -04:00
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
2013-12-18 20:53:23 -05:00
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
2009-07-02 14:55:40 -04:00
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
2013-12-18 20:53:23 -05:00
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
2009-07-02 14:55:40 -04:00
break
elif $ac_last_try; then
2013-12-18 20:53:23 -05:00
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
2009-07-02 14:55:40 -04:00
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
2008-02-17 11:36:43 -05:00
2009-07-02 14:55:40 -04:00
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = " "
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2013-12-18 20:53:23 -05:00
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
2009-07-02 14:55:40 -04:00
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS"
shift
for ac_tag
2008-02-17 11:36:43 -05:00
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
2013-12-18 20:53:23 -05:00
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
2008-02-17 11:36:43 -05:00
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
2013-12-18 20:53:23 -05:00
-) ac_f="$ac_tmp/stdin";;
2008-02-17 11:36:43 -05:00
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
2013-12-18 20:53:23 -05:00
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
2008-02-17 11:36:43 -05:00
esac
2009-07-02 14:55:40 -04:00
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
2013-12-18 20:53:23 -05:00
as_fn_append ac_file_inputs " '$ac_f'"
2008-02-17 11:36:43 -05:00
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
2009-07-02 14:55:40 -04:00
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
2008-02-17 11:36:43 -05:00
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: creating $ac_file" >&6;}
2008-02-17 11:36:43 -05:00
fi
2009-07-02 14:55:40 -04:00
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
2008-02-17 11:36:43 -05:00
case $ac_tag in
2013-12-18 20:53:23 -05:00
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
2008-02-17 11:36:43 -05:00
esac
;;
2002-03-29 12:32:55 -05:00
esac
2008-02-17 11:36:43 -05:00
ac_dir=`$as_dirname -- "$ac_file" ||
2002-03-29 12:32:55 -05:00
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
2005-07-01 14:17:31 -04:00
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
2008-02-17 11:36:43 -05:00
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
2009-07-02 14:55:40 -04:00
$as_echo X"$ac_file" |
2008-02-17 11:36:43 -05:00
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
2013-12-18 20:53:23 -05:00
as_dir="$ac_dir"; as_fn_mkdir_p
2002-03-29 12:32:55 -05:00
ac_builddir=.
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
2009-07-02 14:55:40 -04:00
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
2008-02-17 11:36:43 -05:00
# A ".." for each directory in $ac_dir_suffix.
2009-07-02 14:55:40 -04:00
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
2008-02-17 11:36:43 -05:00
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
1997-02-04 03:53:45 -05:00
2002-03-29 12:32:55 -05:00
case $srcdir in
2008-02-17 11:36:43 -05:00
.) # We are building in place.
2002-03-29 12:32:55 -05:00
ac_srcdir=.
2008-02-17 11:36:43 -05:00
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
2002-03-29 12:32:55 -05:00
ac_srcdir=$srcdir$ac_dir_suffix;
2008-02-17 11:36:43 -05:00
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
2002-03-29 12:32:55 -05:00
esac
2008-02-17 11:36:43 -05:00
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
2005-07-01 14:17:31 -04:00
1997-02-04 03:53:45 -05:00
2008-02-17 11:36:43 -05:00
case $ac_mode in
:F)
#
# CONFIG_FILE
#
1997-03-20 02:30:26 -05:00
2012-06-27 06:40:51 -04:00
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
2009-08-26 18:24:44 -04:00
ac_MKDIR_P=$MKDIR_P
case $MKDIR_P in
[\\/$]* | ?:[\\/]* ) ;;
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
esac
2008-02-17 11:36:43 -05:00
_ACEOF
2007-11-15 23:29:45 -05:00
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
2009-07-02 14:55:40 -04:00
ac_sed_dataroot='
/datarootdir/ {
2008-02-17 11:36:43 -05:00
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
2013-12-18 20:53:23 -05:00
/@mandir@/p'
2009-07-02 14:55:40 -04:00
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
2008-02-17 11:36:43 -05:00
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
2008-02-17 11:36:43 -05:00
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2008-02-17 11:36:43 -05:00
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
2013-12-18 20:53:23 -05:00
s&\\\${datarootdir}&$datarootdir&g' ;;
2008-02-17 11:36:43 -05:00
esac
2002-03-29 12:32:55 -05:00
_ACEOF
2008-02-17 11:36:43 -05:00
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
2002-03-29 12:32:55 -05:00
$extrasub
_ACEOF
2009-07-02 14:55:40 -04:00
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2002-03-29 12:32:55 -05:00
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
2009-07-02 14:55:40 -04:00
s|@configure_input@|$ac_sed_conf_input|;t t
2008-02-17 11:36:43 -05:00
s&@top_builddir@&$ac_top_builddir_sub&;t t
2009-07-02 14:55:40 -04:00
s&@top_build_prefix@&$ac_top_build_prefix&;t t
2008-02-17 11:36:43 -05:00
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
2012-06-27 06:40:51 -04:00
s&@INSTALL@&$ac_INSTALL&;t t
2009-08-26 18:24:44 -04:00
s&@MKDIR_P@&$ac_MKDIR_P&;t t
2008-02-17 11:36:43 -05:00
$ac_datarootdir_hack
2009-07-02 14:55:40 -04:00
"
2013-12-18 20:53:23 -05:00
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
2008-02-17 11:36:43 -05:00
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
2013-12-18 20:53:23 -05:00
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
2013-12-18 20:53:23 -05:00
which seems to be undefined. Please make sure it is defined" >&2;}
2008-02-17 11:36:43 -05:00
2013-12-18 20:53:23 -05:00
rm -f "$ac_tmp/stdin"
2007-11-15 23:59:25 -05:00
case $ac_file in
2013-12-18 20:53:23 -05:00
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
2009-07-02 14:55:40 -04:00
esac \
2013-12-18 20:53:23 -05:00
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
2008-02-17 11:36:43 -05:00
;;
:H)
#
# CONFIG_HEADER
#
2002-03-29 12:32:55 -05:00
if test x"$ac_file" != x-; then
2009-07-02 14:55:40 -04:00
{
$as_echo "/* $configure_input */" \
2013-12-18 20:53:23 -05:00
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: $ac_file is unchanged" >&6;}
2002-03-29 12:32:55 -05:00
else
2009-07-02 14:55:40 -04:00
rm -f "$ac_file"
2013-12-18 20:53:23 -05:00
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
2002-03-29 12:32:55 -05:00
fi
else
2009-07-02 14:55:40 -04:00
$as_echo "/* $configure_input */" \
2013-12-18 20:53:23 -05:00
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
2002-03-29 12:32:55 -05:00
fi
;;
2008-02-17 11:36:43 -05:00
:L)
#
# CONFIG_LINK
#
2006-08-23 08:59:18 -04:00
2009-07-02 14:55:40 -04:00
if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then
:
else
# Prefer the file from the source tree if names are identical.
if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then
ac_source=$srcdir/$ac_source
fi
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: linking $ac_source to $ac_file" >&6;}
2007-11-15 23:59:25 -05:00
2009-07-02 14:55:40 -04:00
if test ! -r "$ac_source"; then
2013-12-18 20:53:23 -05:00
as_fn_error $? "$ac_source: file not found" "$LINENO" 5
2009-07-02 14:55:40 -04:00
fi
rm -f "$ac_file"
1997-02-08 23:34:07 -05:00
2009-07-02 14:55:40 -04:00
# Try a relative symlink, then a hard link, then a copy.
2013-12-18 20:53:23 -05:00
case $ac_source in
2009-07-02 14:55:40 -04:00
[\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;;
*) ac_rel_source=$ac_top_build_prefix$ac_source ;;
esac
ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
ln "$ac_source" "$ac_file" 2>/dev/null ||
cp -p "$ac_source" "$ac_file" ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5
2009-07-02 14:55:40 -04:00
fi
2008-02-17 11:36:43 -05:00
;;
2013-12-18 20:53:23 -05:00
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: executing $ac_file commands" >&6;}
2008-02-17 11:36:43 -05:00
;;
esac
2006-08-23 08:59:18 -04:00
2007-11-15 23:59:25 -05:00
2008-02-17 11:36:43 -05:00
case $ac_file$ac_mode in
"check_win32_symlinks":C)
2004-05-17 15:14:47 -04:00
# Links sometimes fail undetected on Mingw -
# so here we detect it and warn the user
2004-05-28 16:52:42 -04:00
for FILE in $CONFIG_LINKS
2004-05-17 15:14:47 -04:00
do
# test -e works for symlinks in the MinGW console
2013-12-18 20:53:23 -05:00
test -e `expr "$FILE" : '\([^:]*\)'` || { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** link for $FILE -- please fix by hand" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: *** link for $FILE -- please fix by hand" >&2;}
2004-05-17 15:14:47 -04:00
done
;;
2008-02-17 11:36:43 -05:00
"src/include/pg_config.h":H)
# Update timestamp for pg_config.h (see Makefile.global)
echo >src/include/stamp-h
;;
2009-01-22 17:27:13 -05:00
"src/interfaces/ecpg/include/ecpg_config.h":H) echo >src/interfaces/ecpg/include/stamp-h ;;
2008-02-17 11:36:43 -05:00
2004-05-17 15:14:47 -04:00
esac
2008-02-17 11:36:43 -05:00
done # for ac_tag
1997-02-04 03:53:45 -05:00
2000-12-29 15:39:09 -05:00
2013-12-18 20:53:23 -05:00
as_fn_exit 0
2002-03-29 12:32:55 -05:00
_ACEOF
ac_clean_files=$ac_clean_files_save
2009-07-02 14:55:40 -04:00
test $ac_write_fail = 0 ||
2013-12-18 20:53:23 -05:00
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
2009-07-02 14:55:40 -04:00
2002-03-29 12:32:55 -05:00
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
2005-07-01 14:17:31 -04:00
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
2002-03-29 12:32:55 -05:00
exec 5>/dev/null
2005-07-01 14:17:31 -04:00
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
2002-03-29 12:32:55 -05:00
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
2013-12-18 20:53:23 -05:00
$ac_cs_success || as_fn_exit 1
2002-03-29 12:32:55 -05:00
fi
2009-07-02 14:55:40 -04:00
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
2013-12-18 20:53:23 -05:00
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
2009-07-02 14:55:40 -04:00
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
1998-04-05 17:29:49 -04:00
meson: Add initial version of meson based build system
Autoconf is showing its age, fewer and fewer contributors know how to wrangle
it. Recursive make has a lot of hard to resolve dependency issues and slow
incremental rebuilds. Our home-grown MSVC build system is hard to maintain for
developers not using Windows and runs tests serially. While these and other
issues could individually be addressed with incremental improvements, together
they seem best addressed by moving to a more modern build system.
After evaluating different build system choices, we chose to use meson, to a
good degree based on the adoption by other open source projects.
We decided that it's more realistic to commit a relatively early version of
the new build system and mature it in tree.
This commit adds an initial version of a meson based build system. It supports
building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD,
Solaris and Windows (however only gcc is supported on aix, solaris). For
Windows/MSVC postgres can now be built with ninja (faster, particularly for
incremental builds) and msbuild (supporting the visual studio GUI, but
building slower).
Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM
bitcode generation, documentation adjustments) are done in subsequent commits
requiring further review. Other aspects (e.g. not installing test-only
extensions) are not yet addressed.
When building on Windows with msbuild, builds are slower when using a visual
studio version older than 2019, because those versions do not support
MultiToolTask, required by meson for intra-target parallelism.
The plan is to remove the MSVC specific build system in src/tools/msvc soon
after reaching feature parity. However, we're not planning to remove the
autoconf/make build system in the near future. Likely we're going to keep at
least the parts required for PGXS to keep working around until all supported
versions build with meson.
Some initial help for postgres developers is at
https://wiki.postgresql.org/wiki/Meson
With contributions from Thomas Munro, John Naylor, Stone Tickle and others.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de
2022-09-22 00:53:12 -04:00
# Ensure that any meson build directories would reconfigure and see that
# there's a conflicting in-tree build and can error out.
2024-04-25 10:51:33 -04:00
if test "$vpath_build" = "no"; then
meson: Add initial version of meson based build system
Autoconf is showing its age, fewer and fewer contributors know how to wrangle
it. Recursive make has a lot of hard to resolve dependency issues and slow
incremental rebuilds. Our home-grown MSVC build system is hard to maintain for
developers not using Windows and runs tests serially. While these and other
issues could individually be addressed with incremental improvements, together
they seem best addressed by moving to a more modern build system.
After evaluating different build system choices, we chose to use meson, to a
good degree based on the adoption by other open source projects.
We decided that it's more realistic to commit a relatively early version of
the new build system and mature it in tree.
This commit adds an initial version of a meson based build system. It supports
building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD,
Solaris and Windows (however only gcc is supported on aix, solaris). For
Windows/MSVC postgres can now be built with ninja (faster, particularly for
incremental builds) and msbuild (supporting the visual studio GUI, but
building slower).
Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM
bitcode generation, documentation adjustments) are done in subsequent commits
requiring further review. Other aspects (e.g. not installing test-only
extensions) are not yet addressed.
When building on Windows with msbuild, builds are slower when using a visual
studio version older than 2019, because those versions do not support
MultiToolTask, required by meson for intra-target parallelism.
The plan is to remove the MSVC specific build system in src/tools/msvc soon
after reaching feature parity. However, we're not planning to remove the
autoconf/make build system in the near future. Likely we're going to keep at
least the parts required for PGXS to keep working around until all supported
versions build with meson.
Some initial help for postgres developers is at
https://wiki.postgresql.org/wiki/Meson
With contributions from Thomas Munro, John Naylor, Stone Tickle and others.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de
2022-09-22 00:53:12 -04:00
touch meson.build
fi