Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1984be

Browse files
committed
Fix ./configure checks with __cpuidex() and __cpuid()
The configure checks used two incorrect functions when checking thepresence 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 ofthese functions, impacting environments where these exist, like Windows.Simply fixing the function name does not work. For example, usingconfigure with MinGW on Windows causes the checks to detect all four of__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to beavailable, causing a compilation failure as this messes up with theMinGW headers as we would include both <intrin.h> and <cpuid.h>.The Postgres code expects only one in { __get_cpuid() , __cpuid() } andone in { __get_cpuid_count() , __cpuidex() } to exist. This commitreshapes the configure checks to do exactly what meson is doing, whichhas been working well for us: check one, then the other, but never allowboth to be detected in a given build.The logic is wrong since3dc2d62 and792752a where thesechecks have been introduced (the second case is most likely a copy-pastocoming from the first case), with meson documenting that the configurechecks were broken. As far as I can see, they are not once appliedconsistently with what the code expects, but let's see if the buildfarmhas different something to say. The comment in meson.build is adjustedas 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.xyzBackpatch-through: 13
1 parentbbc20c8 commitc1984be

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

‎configure‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17897,7 +17897,7 @@ $as_echo "#define HAVE_GCC__ATOMIC_INT64_CAS 1" >>confdefs.h
1789717897
fi
1789817898

1789917899

17900-
# Check forx86 cpuid instruction
17900+
# Check for__get_cpuid() and __cpuid()
1790117901
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid" >&5
1790217902
$as_echo_n "checking for __get_cpuid... " >&6; }
1790317903
if ${pgac_cv__get_cpuid+:} false; then :
@@ -17930,9 +17930,9 @@ if test x"$pgac_cv__get_cpuid" = x"yes"; then
1793017930

1793117931
$as_echo "#define HAVE__GET_CPUID 1" >>confdefs.h
1793217932

17933-
fi
17934-
17935-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuid" >&5
17933+
else
17934+
# __cpuid()
17935+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuid" >&5
1793617936
$as_echo_n "checking for __cpuid... " >&6; }
1793717937
if ${pgac_cv__cpuid+:} false; then :
1793817938
$as_echo_n "(cached) " >&6
@@ -17944,7 +17944,7 @@ int
1794417944
main ()
1794517945
{
1794617946
unsigned int exx[4] = {0, 0, 0, 0};
17947-
__get_cpuid(exx[0], 1);
17947+
__cpuid(exx, 1);
1794817948

1794917949
;
1795017950
return 0;
@@ -17960,10 +17960,11 @@ rm -f core conftest.err conftest.$ac_objext \
1796017960
fi
1796117961
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuid" >&5
1796217962
$as_echo "$pgac_cv__cpuid" >&6; }
17963-
if test x"$pgac_cv__cpuid" = x"yes"; then
17963+
if test x"$pgac_cv__cpuid" = x"yes"; then
1796417964

1796517965
$as_echo "#define HAVE__CPUID 1" >>confdefs.h
1796617966

17967+
fi
1796717968
fi
1796817969

1796917970
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.

‎configure.ac‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ PGAC_HAVE_GCC__ATOMIC_INT32_CAS
20812081
PGAC_HAVE_GCC__ATOMIC_INT64_CAS
20822082

20832083

2084-
# Check forx86 cpuid instruction
2084+
# Check for__get_cpuid() and __cpuid()
20852085
AC_CACHE_CHECK([for __get_cpuid],[pgac_cv__get_cpuid],
20862086
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cpuid.h>],
20872087
[[unsigned int exx[4] = {0, 0, 0, 0};
@@ -2091,17 +2091,18 @@ AC_CACHE_CHECK([for __get_cpuid], [pgac_cv__get_cpuid],
20912091
[pgac_cv__get_cpuid="no"])])
20922092
if test x"$pgac_cv__get_cpuid" = x"yes"; then
20932093
AC_DEFINE(HAVE__GET_CPUID,1,[Define to 1 if you have __get_cpuid.])
2094-
fi
2095-
2096-
AC_CACHE_CHECK([for __cpuid],[pgac_cv__cpuid],
2097-
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <intrin.h>],
2098-
[[unsigned int exx[4] = {0, 0, 0, 0};
2099-
__get_cpuid(exx[0], 1);
2100-
]])],
2101-
[pgac_cv__cpuid="yes"],
2102-
[pgac_cv__cpuid="no"])])
2103-
if test x"$pgac_cv__cpuid" = x"yes"; then
2104-
AC_DEFINE(HAVE__CPUID,1,[Define to 1 if you have __cpuid.])
2094+
else
2095+
# __cpuid()
2096+
AC_CACHE_CHECK([for __cpuid],[pgac_cv__cpuid],
2097+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <intrin.h>],
2098+
[[unsigned int exx[4] = {0, 0, 0, 0};
2099+
__cpuid(exx, 1);
2100+
]])],
2101+
[pgac_cv__cpuid="yes"],
2102+
[pgac_cv__cpuid="no"])])
2103+
if test x"$pgac_cv__cpuid" = x"yes"; then
2104+
AC_DEFINE(HAVE__CPUID,1,[Define to 1 if you have __cpuid.])
2105+
fi
21052106
fi
21062107

21072108
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp